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
> 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
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?
IWR - Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen
Universitaet Heidelberg, INF 368, D-69120 Heidelberg, GERMANY
Telephone: +49 6221 54 8869, Telefax: +49 6221 54 8868