[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A4114C1019D2F34CA5D6CDF8A4D1890178BEB834A0@EXMAIL.ad.emulex.com>
Date: Thu, 25 Sep 2008 06:03:03 -0700
From: Ram.Natarajan@...lex.Com
To: <netdev@...r.kernel.org>
Subject: Using skb_get() to recycle skbs
In our netdev driver, we preallocate a pool of skb which are
used by our h/w to DMA frames.
Normally, when we indicate a packet to stack (netif_rx),
the stack ends up freeing it. If we do a skb_get() prior
to that, then the stack just reduces the use_count,
and our driver is able to re-use it. We do have to use
caution to see that stack has dropped it's reference
(atomic_read(skb->users) <= 1) prior to returning
the buffer to our h/w.
Is this a valid approach? It so it could save some
CPU cycles which are used in alloc_skb(). If this
can be done, how come more drivers in tree are not
doing it, is there any flip side to it? One could be
that stack may not free it in time (we could starve
the hardware of free buffers), but in that case
we can drop our reference, and let the stack
free it up, and force an allocation instead of
reuse.
Thanks for your response.
Ram Natarajan
Emulex Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists