netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* larger than 1500 MTU support for 8139too - request for comments
@ 2013-07-27 21:35 Tim Small
  0 siblings, 0 replies; only message in thread
From: Tim Small @ 2013-07-27 21:35 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

I'm interested in enabling > 1500 octet MTU support for the 8139 so that
I can use it for GRE and PPPoE etc. encapsulation with a 1500 MTU
payload - the datasheet suggests that it'll receive 4k frames, but it
the 8139B and 8139D which I have seem to stop receiving packets with an
MTU of more than 1722 (the cards start logging receive errors).  Still -
plenty for 'mini jumbos' / 'baby giants' or whatever you want to call
them.  I've tried poking a few other things in the driver to see if I
can improve on this without success.

The patch is pretty straightforward - the only possible downside which I
can see in normal operation is that the total tx buffer size goes from
6144 bytes to 6944 bytes.

I think I have a few other 8139 variant cards somewhere, but before I
try to find them and do further testing with more real and virtual
hardware (I'm currently working on 3.2.46 - because that's my distro
kernel), I thought I'd see if this was likely to be accepted upstream at
all?

As an MTU of 1600 seems to be what's frequently defined as 'baby giant'
for encapsulation purposes, I was wondering if this would be a better
figure to pick (tx buffer alloc goes from 6144 to 6544 bytes).  I assume
that I shouldn't bother to implement dynamic buffer allocation for that
gain of 400 bytes, but perhaps that's wrong?

Alternatively, if anyone has any other ideas for getting 4k frames
working on these chips, it'd be interesting to see if that'd work.

Thanks,

Tim.




[-- Attachment #2: 8139too-mtu.diff --]
[-- Type: text/x-patch, Size: 1873 bytes --]

--- 8139too.c.old	2013-05-30 14:35:16.000000000 +0100
+++ 8139too.c	2013-07-27 22:09:50.519097242 +0100
@@ -182,8 +182,11 @@
 /* Number of Tx descriptor registers. */
 #define NUM_TX_DESC	4
 
-/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
-#define MAX_ETH_FRAME_SIZE	1536
+/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).
+ * Whilst the 8139 datasheets suggest that "4k" frames can be received,
+ * this figure has been derived impirically using 8139B and 8139D hardware.
+ */
+#define MAX_ETH_FRAME_SIZE	1736
 
 /* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
 #define TX_BUF_SIZE	MAX_ETH_FRAME_SIZE
@@ -639,6 +642,7 @@
 static int rtl8139_set_mac_address(struct net_device *dev, void *p);
 static int rtl8139_poll(struct napi_struct *napi, int budget);
 static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
+static int rtl8139_change_mtu (struct net_device *dev, int new_mtu);
 static int rtl8139_close (struct net_device *dev);
 static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
 static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
@@ -912,7 +916,7 @@
 	.ndo_open		= rtl8139_open,
 	.ndo_stop		= rtl8139_close,
 	.ndo_get_stats		= rtl8139_get_stats,
-	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_change_mtu		= rtl8139_change_mtu,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_mac_address 	= rtl8139_set_mac_address,
 	.ndo_start_xmit		= rtl8139_start_xmit,
@@ -924,6 +928,14 @@
 #endif
 };
 
+static int rtl8139_change_mtu(struct net_device *dev, int new_mtu)
+{
+	if (new_mtu < 68 || new_mtu > (MAX_ETH_FRAME_SIZE - 36))
+                return -EINVAL;
+        dev->mtu = new_mtu;
+        return 0;
+}
+
 static int __devinit rtl8139_init_one (struct pci_dev *pdev,
 				       const struct pci_device_id *ent)
 {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-27 21:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-27 21:35 larger than 1500 MTU support for 8139too - request for comments Tim Small

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).