netdev
[Top] [All Lists]

Re: PATCH: sundance #5 (variable per-interface MTU support)

To: Jason Lunz <lunz@xxxxxxxxxxxx>
Subject: Re: PATCH: sundance #5 (variable per-interface MTU support)
From: Donald Becker <becker@xxxxxxxxx>
Date: Thu, 19 Sep 2002 18:28:09 -0400 (EDT)
Cc: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Richard Gooch <rgooch@xxxxxxxxxxxxxxx>, "Patrick R. McManus" <mcmanus@xxxxxxxxxxxx>, <edward_peng@xxxxxxxxxxxx>
In-reply-to: <20020919210348.GC17492@orr.falooley.org>
Sender: netdev-bounce@xxxxxxxxxxx
On Thu, 19 Sep 2002, Jason Lunz wrote:

> This is a straightforward merge of variable mtu from donald's driver.

-       np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
+       np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 36);

Errrmm, not quite right.

Try
        np->rx_buf_sz = (dev->mtu <= 1520 ? PKT_BUF_SZ : dev->mtu + 16);

The idea is that all ethernet-like drivers always allocate skbuffs of
the same size, PKT_BUF_SZ (1536=3*512), unless a jumbo MTU forces a
larger size. 

Specificially, using VLANs (+4 bytes on the frame size) on some interfaces
should not result in a mix of allocation sizes.  Most VLAN-like
encapsulation should add fewer than (1536-1518 = 18) 18 extra bytes.

BTW, always leave a few extra bytes at the end of the data buffer.
You never know when some chip might decide to dribble an extra word or
two, or include the CRC because someone frobbed the driver.

-- 
Donald Becker                           becker@xxxxxxxxx
Scyld Computing Corporation             http://www.scyld.com
410 Severn Ave. Suite 210               Second Generation Beowulf Clusters
Annapolis MD 21403                      410-990-9993


<Prev in Thread] Current Thread [Next in Thread>