From: Philby John <pjohn@in.mvista.com>
To: Nicholas Van Orton <turanammo@gmail.com>
Cc: Peter Chacko <peterchacko35@gmail.com>,
jon_zhou@agilent.com, radhamohan_ch@yahoo.com,
netdev@vger.kernel.org
Subject: Re: can we reuse an skb
Date: Mon, 22 Jun 2009 19:04:14 +0530 [thread overview]
Message-ID: <1245677654.4541.37.camel@localhost.localdomain> (raw)
In-Reply-To: <b9e8fcbd0906190311k1db4653bm1d560743faa4ded1@mail.gmail.com>
On Fri, 2009-06-19 at 15:41 +0530, Nicholas Van Orton wrote:
> 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()?
Yes, I think that is the case. Except when the user calls an ioctl that
closes your ethernet device, by say using $ifconfig eth0 down, in which
case you must free the ring skb buffer's allocated using
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?
You are using an old version of the kernel, can't see such code in
2.6.30. From what I know, this usually happens if skb->users is not
equal to one, which means the buffer is in use by some user. Like I
said, you needn't call dev_kfree_skb() explicitly, it will be freed
after use by the upper network layers.
netif_receive_skb() ->deliver_skb()-> pt_prev->func() ->
ip_rcv() -> ip_rcv_finish()
ip_rcv_finish() would finally free it as per the specified protocol.
This I think is the flow, but I guess there would be experts here who
would correct me if I am wrong.
-Philby
next prev parent reply other threads:[~2009-06-22 13:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-19 10:11 can we reuse an skb Nicholas Van Orton
2009-06-22 13:34 ` Philby John [this message]
2009-06-22 13:56 ` Peter Chacko
2009-06-22 14:33 ` Philby John
-- strict thread matches above, loose matches on Subject: below --
2009-06-19 6:46 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245677654.4541.37.camel@localhost.localdomain \
--to=pjohn@in.mvista.com \
--cc=jon_zhou@agilent.com \
--cc=netdev@vger.kernel.org \
--cc=peterchacko35@gmail.com \
--cc=radhamohan_ch@yahoo.com \
--cc=turanammo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.