netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can we reuse an skb
@ 2009-06-19  6:46 Radha Mohan
  2009-06-19  6:51 ` jon_zhou
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Radha Mohan @ 2009-06-19  6:46 UTC (permalink / raw)
  To: netdev


Hi,

For an ethernet driver, we need to allocate some pool of SKBs for receiving packets. Is there any way we can reuse the same SKBs without the need to re-allocate in atomic every time one has been used up for netif_rx(). 

Any pointers will be helpful.

-- Mohan


      ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket.yahoo.com


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: can we reuse an skb
@ 2009-06-19 10:11 Nicholas Van Orton
  2009-06-22 13:34 ` Philby John
  0 siblings, 1 reply; 18+ messages in thread
From: Nicholas Van Orton @ 2009-06-19 10:11 UTC (permalink / raw)
  To: Peter Chacko; +Cc: jon_zhou, radhamohan_ch, netdev

On Fri, 2009-06-19 at 12:51 +0530, Peter Chacko wrote:
Radha,
>
> skb memory is coming from slab allocation pool, which itself are
> re-usable pools. kmalloc(ATOMIC) on these object caches don't incur
> much penalty as think for a case when it does memory
> allocation/de-allocation. So the intelligence you want to put in the
> driver is already done by slab layer. But if you want to add some
> thing like per-flow ring-buffers, optimized for a point-to-point link
> or similar purpose, you can have a driver level cache .

Does this mean that when skb buffer has been allocated using
dev_alloc_skb(), filled with received data and passed to the upper
layers
the kernel would automatically do the task of releasing this buffer
without the user calling dev_kfree_skb()? I once got
KERNEL: assertion (!atomic_read(&skb->users)) failed at net/core/dev.c
errors when trying
to free them using dev_kfree_skb()

Could this be cause I did not wait until netif_rx_completed() was called?

Regards,
Nicholas




>
> thanks
>
> On Fri, Jun 19, 2009 at 12:21 PM, <jon_zhou@agilent.com> wrote:
> > I am also thinking about this...
> >
> > i.e.pcnet32.c
> > seems the skb will be claimed to be unuseful(mark some bits) in the device driver, than it will be recycled in the softirq handler,
> >
> > that means unable to reuse it, unless modidy the driver.
> >
> > Regards,
> > zhou rui
> >
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On Behalf Of Radha Mohan
> > Sent: Friday, June 19, 2009 2:47 PM
> > To: netdev@vger.kernel.org
> > Subject: can we reuse an skb
> >
> >
> > Hi,
> >
> > For an ethernet driver, we need to allocate some pool of SKBs for receiving packets. Is there any way we can reuse the same SKBs without the need to re-allocate in atomic every time one has been used up for netif_rx().
> >
> > Any pointers will be helpful.
> >
> > -- Mohan
> >
> >
> >      ICC World Twenty20 England &#39;09 exclusively on YAHOO! CRICKET http://cricket.yahoo.com
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-06-22 14:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19  6:46 can we reuse an skb Radha Mohan
2009-06-19  6:51 ` jon_zhou
2009-06-19  7:10   ` Radha Mohan
2009-06-19  7:21   ` Peter Chacko
2009-06-19 10:37 ` Saikiran Madugula
2009-06-19 18:41   ` Neil Horman
2009-06-19 16:56 ` Rick Jones
2009-06-19 23:29   ` David Miller
2009-06-20  3:54     ` Peter Chacko
2009-06-20  8:00       ` Evgeniy Polyakov
2009-06-20 11:51       ` Ben Hutchings
2009-06-21  5:41     ` Peter Chacko
2009-06-21  5:49       ` David Miller
2009-06-21 11:46       ` [RFD] Pluggable code design (was: can we reuse an skb) Al Boldi
  -- strict thread matches above, loose matches on Subject: below --
2009-06-19 10:11 can we reuse an skb Nicholas Van Orton
2009-06-22 13:34 ` Philby John
2009-06-22 13:56   ` Peter Chacko
2009-06-22 14:33     ` Philby John

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).