diff options
author | David S. Miller <davem@davemloft.net> | 2009-06-09 03:17:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-09 03:17:13 -0400 |
commit | ee0398717078260ee4ffa97d407071bc774e2dac (patch) | |
tree | 57dff8cfd1c2dde383f3fcb49cdb8eb7b7d640a7 /include | |
parent | 05f77f85f47e30a53f7971b687f3b0250e42f665 (diff) |
skbuff: Add frag list abstraction interfaces.
With the hope that these can be used to eliminate direct
references to the frag list implementation.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/skbuff.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index aad484cd5863..f1c93b878b3b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1077,7 +1077,7 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, | |||
1077 | int off, int size); | 1077 | int off, int size); |
1078 | 1078 | ||
1079 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | 1079 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) |
1080 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 1080 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frags(skb)) |
1081 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 1081 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
1082 | 1082 | ||
1083 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | 1083 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
@@ -1716,6 +1716,25 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1716 | skb = skb->prev) | 1716 | skb = skb->prev) |
1717 | 1717 | ||
1718 | 1718 | ||
1719 | static inline bool skb_has_frags(const struct sk_buff *skb) | ||
1720 | { | ||
1721 | return skb_shinfo(skb)->frag_list != NULL; | ||
1722 | } | ||
1723 | |||
1724 | static inline void skb_frag_list_init(struct sk_buff *skb) | ||
1725 | { | ||
1726 | skb_shinfo(skb)->frag_list = NULL; | ||
1727 | } | ||
1728 | |||
1729 | static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) | ||
1730 | { | ||
1731 | frag->next = skb_shinfo(skb)->frag_list; | ||
1732 | skb_shinfo(skb)->frag_list = frag; | ||
1733 | } | ||
1734 | |||
1735 | #define skb_walk_frags(skb, iter) \ | ||
1736 | for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) | ||
1737 | |||
1719 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | 1738 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, |
1720 | int *peeked, int *err); | 1739 | int *peeked, int *err); |
1721 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 1740 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |