patch-2.3.41 linux/include/linux/skbuff.h
Next file: linux/include/linux/slab.h
Previous file: linux/include/linux/serialP.h
Back to the patch index
Back to the overall index
- Lines: 28
- Date:
Fri Jan 28 08:01:31 2000
- Orig file:
v2.3.40/linux/include/linux/skbuff.h
- Orig date:
Fri Jan 7 19:13:23 2000
diff -u --recursive --new-file v2.3.40/linux/include/linux/skbuff.h linux/include/linux/skbuff.h
@@ -202,16 +202,25 @@
return (list->next == (struct sk_buff *) list);
}
+extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb)
+{
+ atomic_inc(&skb->users);
+ return skb;
+}
+
+/* If users==1, we are the only owner and are can avoid redundant
+ * atomic change.
+ */
extern __inline__ void kfree_skb(struct sk_buff *skb)
{
- if (atomic_dec_and_test(&skb->users))
+ if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
__kfree_skb(skb);
}
/* Use this if you didn't touch the skb state [for fast switching] */
extern __inline__ void kfree_skb_fast(struct sk_buff *skb)
{
- if (atomic_dec_and_test(&skb->users))
+ if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
kfree_skbmem(skb);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)