netdev
[Top] [All Lists]

Re: [patch] 3c59x.c for 2.2.17

To: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [patch] 3c59x.c for 2.2.17
From: Bogdan Costescu <Bogdan.Costescu@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Jun 2000 16:08:18 +0200 (CEST)
Cc: Andrew Morton <andrewm@xxxxxxxxxx>, "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>, Andreas Tobler <toa@xxxxxxxxxxx>
In-reply-to: <E136BEN-0002B9-00@the-village.bc.nu>
Sender: owner-netdev@xxxxxxxxxxx
On Sun, 25 Jun 2000, Alan Cox wrote:

> This is a mess in a lot of Don Becker skeleton base drivers. Its much cleaner 
> if the last ring buffer slot is about to be used and the new alloc fails to 
> simply recycle the buffer and throw the received packet away.
> 
> Several drivers simply require the ring remains full and they are a lot 
> cleaner
> for it.

If I understand it right, you want that the driver never passes one of its
preallocated Rx buffers to the upper levels, so that the Rx ring is always
of size RX_RING_SIZE. On receiving, it tries to allocate a new buffer; if
it's OK it copies the the data to it and sends it up, if it fails it just
ignores that so that the received data (already in the Rx ring buffer) is
discarded.

Don Becker's skeleton has a rx_copybreak scheme which allows this
situation to happen now with a small modification. If you set rx_copybreak
> 1512, it will always allocate a new buffer and memcpy the data to it;
however, in the failing case, it goes through the other branch of 'if', as
the 2 conditions (pkt_len < rx_copybreak and dev_alloc_skb =! NULL) are
AND-ed - a split in two 'if' solves this problem. 
The reason for this AND is that if the new alloc fails, the Rx ring buffer
(with data) is sent up and the re-filling of the Rx ring will (hopefully)
get a new buffer.

So, as I see it, your solution denies the delivery of received data in the
few ring buffers in favor of keeping the already allocated memory. In both
cases, in an OOM situation, the flow of data to upper levels will stop; so
what is the advantage?

Sincerely,

Bogdan Costescu

IWR - Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen
Universitaet Heidelberg, INF 368, D-69120 Heidelberg, GERMANY
Telephone: +49 6221 54 8869, Telefax: +49 6221 54 8868
E-mail: Bogdan.Costescu@xxxxxxxxxxxxxxxxxxxxx


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