From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Ram.Natarajan@Emulex.Com
Cc: netdev@vger.kernel.org
Subject: Re: Using skb_get() to recycle skbs
Date: Thu, 25 Sep 2008 18:28:33 +0400 [thread overview]
Message-ID: <20080925142833.GA15185@2ka.mipt.ru> (raw)
In-Reply-To: <A4114C1019D2F34CA5D6CDF8A4D1890178BEB834A0@EXMAIL.ad.emulex.com>
Hi.
On Thu, Sep 25, 2008 at 06:03:03AM -0700, Ram.Natarajan@Emulex.Com (Ram.Natarajan@Emulex.Com) wrote:
> 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.
Now stack allocates new skb and copy data from old one to the new, since
it belives that skb is shared between different users and thus can not
be modified in the rx path. You can check how skb_share_check() is
called in ip_rcv() and similar receiving functions.
--
Evgeniy Polyakov
prev parent reply other threads:[~2008-09-25 14:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-14 10:25 [PATCH] sendfile() and UDP socket Johann Baudy
2008-09-16 4:17 ` Simon Horman
2008-09-16 4:24 ` Simon Horman
2008-09-16 12:01 ` Hirokazu Takahashi
2008-09-18 17:31 ` Rémi Denis-Courmont
2008-09-19 12:28 ` Hirokazu Takahashi
2008-09-19 13:14 ` Rémi Denis-Courmont
2008-09-21 8:04 ` David Miller
2008-09-22 0:21 ` Evgeniy Polyakov
2008-09-22 0:44 ` David Miller
2008-09-22 1:08 ` Evgeniy Polyakov
2008-09-22 2:07 ` David Miller
2008-09-22 4:19 ` Evgeniy Polyakov
2008-09-22 4:27 ` David Miller
2008-09-22 4:40 ` Evgeniy Polyakov
2008-09-22 5:06 ` David Miller
2008-09-22 5:49 ` Evgeniy Polyakov
2008-09-22 6:54 ` David Miller
2008-09-22 7:04 ` Evgeniy Polyakov
2008-09-23 4:54 ` Herbert Xu
2008-09-23 6:27 ` Evgeniy Polyakov
2008-09-23 7:01 ` Herbert Xu
2008-09-23 7:07 ` Evgeniy Polyakov
2008-09-24 4:53 ` Bill Fink
[not found] ` <7e0dd21a0810140009k49c8876ax66f744d0a3a4931b@mail.gmail.com>
2008-10-14 7:10 ` Johann Baudy
2008-09-25 13:03 ` Using skb_get() to recycle skbs Ram.Natarajan
2008-09-25 14:28 ` Evgeniy Polyakov [this message]
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=20080925142833.GA15185@2ka.mipt.ru \
--to=johnpol@2ka.mipt.ru \
--cc=Ram.Natarajan@Emulex.Com \
--cc=netdev@vger.kernel.org \
/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 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).