patch-2.3.99-pre4 linux/net/core/skbuff.c

Next file: linux/net/core/sock.c
Previous file: linux/net/core/filter.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre3/linux/net/core/skbuff.c linux/net/core/skbuff.c
@@ -4,7 +4,7 @@
  *	Authors:	Alan Cox <iiitac@pyr.swan.ac.uk>
  *			Florian La Roche <rzsfl@rz.uni-sb.de>
  *
- *	Version:	$Id: skbuff.c,v 1.70 2000/03/17 14:41:39 davem Exp $
+ *	Version:	$Id: skbuff.c,v 1.71 2000/03/29 11:58:33 davem Exp $
  *
  *	Fixes:	
  *		Alan Cox	:	Fixed the worst of the load balancer bugs.
@@ -77,6 +77,15 @@
  *	reliable. 
  */
 
+/**
+ *	skb_over_panic	- 	private function
+ *	@skb: buffer
+ *	@sz: size
+ *	@here: address
+ *
+ *	Out of line support code for skb_put. Not user callable
+ */
+ 
 void skb_over_panic(struct sk_buff *skb, int sz, void *here)
 {
 	printk("skput:over: %p:%d put:%d dev:%s", 
@@ -84,6 +93,16 @@
 	*(int*)0 = 0;
 }
 
+/**
+ *	skb_under_panic	- 	private function
+ *	@skb: buffer
+ *	@sz: size
+ *	@here: address
+ *
+ *	Out of line support code for skb_push. Not user callable
+ */
+ 
+
 void skb_under_panic(struct sk_buff *skb, int sz, void *here)
 {
         printk("skput:under: %p:%d put:%d dev:%s",
@@ -130,6 +149,19 @@
  * 
  */
 
+/**
+ *	alloc_skb	-	allocate a network buffer
+ *	@size: size to allocate
+ *	@gfp_mask: allocation mask
+ *
+ *	Allocate a new sk_buff. The returned buffer has no headroom and a
+ *	tail room of size bytes. The object has a reference count of one.
+ *	The return is the buffer. On a failure the return is NULL.
+ *
+ *	Buffers may only be allocated from interrupts using a gfp_mask of
+ *	GFP_ATOMIC.
+ */
+ 
 struct sk_buff *alloc_skb(unsigned int size,int gfp_mask)
 {
 	struct sk_buff *skb;
@@ -227,8 +259,13 @@
 	skb_head_to_pool(skb);
 }
 
-/*
- *	Free an sk_buff. Release anything attached to the buffer. Clean the state.
+/**
+ *	__kfree_skb - private function 
+ *	@skb: buffer
+ *
+ *	Free an sk_buff. Release anything attached to the buffer. 
+ *	Clean the state. This is an internal helper function. Users should
+ *	always call kfree_skb
  */
 
 void __kfree_skb(struct sk_buff *skb)
@@ -258,8 +295,18 @@
 	kfree_skbmem(skb);
 }
 
-/*
- *	Duplicate an sk_buff. The new one is not owned by a socket.
+/**
+ *	skb_clone	-	duplicate an sk_buff
+ *	@skb: buffer to clone
+ *	@gfp_mask: allocation priority
+ *
+ *	Duplicate an sk_buff. The new one is not owned by a socket. Both
+ *	copies share the same packet data but not structure. The new
+ *	buffer has a reference count of 1. If the allocation fails the 
+ *	function returns NULL otherwise the new buffer is returned.
+ *	
+ *	If this function is called from an interrupt gfp_mask must be
+ *	GFP_ATOMIC.
  */
 
 struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask)
@@ -331,8 +378,18 @@
 #endif
 }
 
-/*
- *	This is slower, and copies the whole data area 
+/**
+ *	skb_copy	-	copy an sk_buff
+ *	@skb: buffer to copy
+ *	@gfp_mask: allocation priority
+ *
+ *	Make a copy of both an sk_buff and its data. This is used when the
+ *	caller wishes to modify the data and needs a private copy of the 
+ *	data to alter. Returns NULL on failure or the pointer to the buffer
+ *	on success. The returned buffer has a reference count of 1.
+ *
+ *	You must pass GFP_ATOMIC as the allocation priority if this function
+ *	is called from an interrupt.
  */
  
 struct sk_buff *skb_copy(const struct sk_buff *skb, int gfp_mask)
@@ -358,6 +415,26 @@
 
 	return n;
 }
+
+/**
+ *	skb_copy	-	copy and expand sk_buff
+ *	@skb: buffer to copy
+ *	@newheadroom: new free bytes at head
+ *	@newtailroom: new free bytes at tail
+ *	@gfp_mask: allocation priority
+ *
+ *	Make a copy of both an sk_buff and its data and while doing so 
+ *	allocate additional space.
+ *
+ *	This is used when the caller wishes to modify the data and needs a 
+ *	private copy of the data to alter as well as more space for new fields.
+ *	 Returns NULL on failure or the pointer to the buffer
+ *	on success. The returned buffer has a reference count of 1.
+ *
+ *	You must pass GFP_ATOMIC as the allocation priority if this function
+ *	is called from an interrupt.
+ */
+ 
 
 struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
 				int newheadroom,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)