Patchwork net: add documentation for skb recycling

login
register
mail settings
Submitter Lennert Buytenhek
Date Nov. 1, 2008, 2:59 a.m.
Message ID <20081101025929.GA13377@xi.wantstofly.org>
Download mbox | patch
Permalink /patch/6768/
State Accepted
Delegated to: David Miller
Headers show

Comments

Lennert Buytenhek - Nov. 1, 2008, 2:59 a.m.
On Sun, Oct 26, 2008 at 11:05:00PM -0700, David Miller wrote:

> > How about tweaking this slightly and saying:
> > 
> >  * 	Checks that the skb passed in is not shared or cloned, and
> >  *	that it is linear and its head portion at least as large as
> >  *	skb_size so that it can be recycled as a receive buffer.
> >  * 	If these conditions are met, this function does any necessary
> >  *	reference count dropping and cleans up the skbuff as if it
> >  *	just came from __alloc_skb().
> 
> I like this tweak, someone please send me the final version with
> proper signoffs etc.

How about this:



From: Stephen Hemminger <shemminger@vyatta.com>
Subject: net: add documentation for skb recycling

Commit 04a4bb55bcf35b63d40fd2725e58599ff8310dd7 ("net: add
skb_recycle_check() to enable netdriver skb recycling") added a
method for network drivers to recycle skbuffs, but while use of
this mechanism was documented in the commit message, it should
really have been added as a docbook comment as well -- this
patch does that.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Lennert Buytenhek <buytenh@marvell.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
David Miller - Nov. 2, 2008, 4:01 a.m.
From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Sat, 1 Nov 2008 03:59:29 +0100

> On Sun, Oct 26, 2008 at 11:05:00PM -0700, David Miller wrote:
> 
> > > How about tweaking this slightly and saying:
> > > 
> > >  * 	Checks that the skb passed in is not shared or cloned, and
> > >  *	that it is linear and its head portion at least as large as
> > >  *	skb_size so that it can be recycled as a receive buffer.
> > >  * 	If these conditions are met, this function does any necessary
> > >  *	reference count dropping and cleans up the skbuff as if it
> > >  *	just came from __alloc_skb().
> > 
> > I like this tweak, someone please send me the final version with
> > proper signoffs etc.
> 
> How about this:

Applied, thanks a lot everyone.
--
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

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e22e3a..ebb6b94 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -449,6 +449,18 @@  void kfree_skb(struct sk_buff *skb)
 	__kfree_skb(skb);
 }
 
+/**
+ *	skb_recycle_check - check if skb can be reused for receive
+ *	@skb: buffer
+ *	@skb_size: minimum receive buffer size
+ *
+ *	Checks that the skb passed in is not shared or cloned, and
+ *	that it is linear and its head portion at least as large as
+ *	skb_size so that it can be recycled as a receive buffer.
+ *	If these conditions are met, this function does any necessary
+ *	reference count dropping and cleans up the skbuff as if it
+ *	just came from __alloc_skb().
+ */
 int skb_recycle_check(struct sk_buff *skb, int skb_size)
 {
 	struct skb_shared_info *shinfo;