netdev
[Top] [All Lists]

Re: [PATCH] cleanup large frame handling for natsemi.c

To: Jeff Garzik <jgarzik@xxxxxxxxx>
Subject: Re: [PATCH] cleanup large frame handling for natsemi.c
From: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Date: Sun, 20 Jun 2004 21:31:22 +0200
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20040620183855.GA26392@xxxxxxxxxxxxx>
References: <40D57FC3.9040008@xxxxxxxxxxxxxxxx> <20040620163036.GD16038@xxxxxxxxxxxxx> <40D5BE9B.9040106@xxxxxxxxxxxxxxxx> <20040620183855.GA26392@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.6) Gecko/20040510
Jeff Garzik wrote:

On Sun, Jun 20, 2004 at 06:43:07PM +0200, Manfred Spraul wrote:
@@ -1909,9 +1916,13 @@
        np->dirty_rx = 0;
        np->cur_rx = RX_RING_SIZE;
        np->oom = 0;
-       np->rx_buf_sz = PKT_BUF_SZ;
-       if (dev->mtu > ETH_DATA_LEN)
-               np->rx_buf_sz += dev->mtu - ETH_DATA_LEN;
+       if (dev->mtu <= ETH_DATA_LEN)
+               np->rx_buf_sz = ETH_DATA_LEN + NATSEMI_HEADERS;
+       else
+               np->rx_buf_sz = dev->mtu + NATSEMI_HEADERS;
+       if (np->rx_buf_sz > NATSEMI_RX_LIMIT)
+               np->rx_buf_sz = NATSEMI_RX_LIMIT;
+

Double NAK:

1) Use PKT_BUF_SZ, don't alloc smaller than that.

The alloc size is never smaller than PKT_BUF_SZ: ETH_DATA_LEN+NATSEMI_HEADERS+NATSEMI_PADDING is 1586 bytes [still smaller than the 1620 byte skb kmalloc cache]

2) The final check should not be needed.  The code should guarantee that
np->rx_buf_sz never exceeds NATSEMI_RX_LIMIT.

You mean: implement a change_mtu callback and reject mtu values above 2020 byte?

--
   Manfred

        Jeff




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