Skip to contentSkip to conversation

net: add documentation for skb recycling

PATCH Applied Lennert Buytenhek 2 participants 5 messages Oct 21, 2008 – Nov 2, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20081020190654.49d4e5d2@extreme

#1 lore raw
Quoted 14 lines · Stephen Hemminger

Include description of function from Lennert's original checkin.

---
As a matter of policy, any exported function should have docbook.

net/core/skbuff.c +1 -0
@@ -449,6 +449,18 @@ void kfree_skb(struct sk_buff *skb)
 	__kfree_skb(skb);
 }
 
+/**

net/core/skbuff.c void kfree_skb(struct sk_buff *skb) · line 462

Quoted 10 lines
net/core/skbuff.c +10 -0
+ * 	skb_recycle_check - check if skb can be reused for receive
+ *	@skb: buffer
+ * 	@skb_size: minimum receive buffer size
+ *
+ * 	Checks that the skb is not shared or cloned, and that it is
+ * 	linear and its head portion large enough (as determined by
+ * 	the driver) to be recycled as a receive buffer.  If these
+ * 	conditions are met, it does any necessary reference count
+ * 	dropping and cleans up the skbuff as if it just came from
+ * 	__alloc_skb().

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().

?

maintainer
#2 lore raw

From: Lennert Buytenhek <[email protected]>
Date: Tue, 21 Oct 2008 05:17:32 +0200

Quoted 29 lines · Stephen Hemminger
Quoted 15 lines

Include description of function from Lennert's original checkin.

---
As a matter of policy, any exported function should have docbook.

net/core/skbuff.c +1 -0
@@ -449,6 +449,18 @@ void kfree_skb(struct sk_buff *skb)
 	__kfree_skb(skb);
 }
 
+/**

net/core/skbuff.c void kfree_skb(struct sk_buff *skb) · line 462

Quoted 10 lines
net/core/skbuff.c +10 -0
+ * 	skb_recycle_check - check if skb can be reused for receive
+ *	@skb: buffer
+ * 	@skb_size: minimum receive buffer size
+ *
+ * 	Checks that the skb is not shared or cloned, and that it is
+ * 	linear and its head portion large enough (as determined by
+ * 	the driver) to be recycled as a receive buffer.  If these
+ * 	conditions are met, it does any necessary reference count
+ * 	dropping and cleans up the skbuff as if it just came from
+ * 	__alloc_skb().

How about tweaking this slightly and saying:

Quoted 6 lines

* 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.

Thanks!

#3 lore raw
Quoted 11 lines · David Miller
Quoted 8 lines

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 <[email protected]>
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.

net/core/skbuff.c +12 -0
index 4e22e3a..ebb6b94 100644
@@ -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;
maintainer Applied
#4 lore raw

From: Lennert Buytenhek <[email protected]>
Date: Sat, 1 Nov 2008 03:59:29 +0100

Quoted 11 lines · David Miller
Quoted 10 lines
Quoted 9 lines

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().

Quoted 4 lines
Quoted 2 lines

I like this tweak, someone please send me the final version with proper signoffs etc.

How about this:

Applied, thanks a lot everyone.

maintainer
#5 lore raw
In reply to a message not in the archive

From: Stephen Hemminger <[email protected]>
Date: Mon, 20 Oct 2008 19:06:54 -0700

"Randy.Dunlap" needs to be fully quoted when it appears in email headers otherwise it is a syntax error, as a result this posting was rejected by vger.kernel.org

Quoted 3 lines

Include description of function from Lennert's original checkin.

I'll apply this, thanks Stephen.

Quoted 1 line

As a matter of policy, any exported function should have docbook.

I don't think this is a reasonable black and white rule, sometimes things are exported so that two subsystems or pieces of code can communicate (and only those specific pieces of code), in which case docbook is not all that useful. Especially if it's an inteface which might change a lot.

But in this case it is definitely warranted, as this interface is meant to be used by drivers.

Quoted 21 lines
net/core/skbuff.c +12 -0
@@ -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 is not shared or cloned, and that it is
+ * 	linear and its head portion large enough (as determined by
+ * 	the driver) to be recycled as a receive buffer.  If these
+ * 	conditions are met, it 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;