aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
commitbbb20089a3275a19e475dbc21320c3742e3ca423 (patch)
tree216fdc1cbef450ca688135c5b8969169482d9a48 /include/linux/skbuff.h
parent3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff)
parent657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff)
Merge branch 'dmaengine' into async-tx-next
Conflicts: crypto/async_tx/async_xor.c drivers/dma/ioat/dma_v2.h drivers/dma/ioat/pci.c drivers/md/raid5.c
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h73
1 files changed, 58 insertions, 15 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5fd389162f01..b47b3f039d14 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -15,6 +15,7 @@
15#define _LINUX_SKBUFF_H 15#define _LINUX_SKBUFF_H
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kmemcheck.h>
18#include <linux/compiler.h> 19#include <linux/compiler.h>
19#include <linux/time.h> 20#include <linux/time.h>
20#include <linux/cache.h> 21#include <linux/cache.h>
@@ -189,20 +190,23 @@ struct skb_shared_info {
189 atomic_t dataref; 190 atomic_t dataref;
190 unsigned short nr_frags; 191 unsigned short nr_frags;
191 unsigned short gso_size; 192 unsigned short gso_size;
193#ifdef CONFIG_HAS_DMA
194 dma_addr_t dma_head;
195#endif
192 /* Warning: this field is not always filled in (UFO)! */ 196 /* Warning: this field is not always filled in (UFO)! */
193 unsigned short gso_segs; 197 unsigned short gso_segs;
194 unsigned short gso_type; 198 unsigned short gso_type;
195 __be32 ip6_frag_id; 199 __be32 ip6_frag_id;
196 union skb_shared_tx tx_flags; 200 union skb_shared_tx tx_flags;
197#ifdef CONFIG_HAS_DMA
198 unsigned int num_dma_maps;
199#endif
200 struct sk_buff *frag_list; 201 struct sk_buff *frag_list;
201 struct skb_shared_hwtstamps hwtstamps; 202 struct skb_shared_hwtstamps hwtstamps;
202 skb_frag_t frags[MAX_SKB_FRAGS]; 203 skb_frag_t frags[MAX_SKB_FRAGS];
203#ifdef CONFIG_HAS_DMA 204#ifdef CONFIG_HAS_DMA
204 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; 205 dma_addr_t dma_maps[MAX_SKB_FRAGS];
205#endif 206#endif
207 /* Intermediate layers must ensure that destructor_arg
208 * remains valid until skb destructor */
209 void * destructor_arg;
206}; 210};
207 211
208/* We divide dataref into two halves. The higher 16 bits hold references 212/* We divide dataref into two halves. The higher 16 bits hold references
@@ -261,7 +265,7 @@ typedef unsigned char *sk_buff_data_t;
261 * @transport_header: Transport layer header 265 * @transport_header: Transport layer header
262 * @network_header: Network layer header 266 * @network_header: Network layer header
263 * @mac_header: Link layer header 267 * @mac_header: Link layer header
264 * @dst: destination entry 268 * @_skb_dst: destination entry
265 * @sp: the security path, used for xfrm 269 * @sp: the security path, used for xfrm
266 * @cb: Control buffer. Free for use by every layer. Put private vars here 270 * @cb: Control buffer. Free for use by every layer. Put private vars here
267 * @len: Length of actual data 271 * @len: Length of actual data
@@ -301,9 +305,6 @@ typedef unsigned char *sk_buff_data_t;
301 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
302 * @ndisc_nodetype: router type (from link layer) 306 * @ndisc_nodetype: router type (from link layer)
303 * @do_not_encrypt: set to prevent encryption of this frame 307 * @do_not_encrypt: set to prevent encryption of this frame
304 * @requeue: set to indicate that the wireless core should attempt
305 * a software retry on this frame if we failed to
306 * receive an ACK for it
307 * @dma_cookie: a cookie to one of several possible DMA operations 308 * @dma_cookie: a cookie to one of several possible DMA operations
308 * done by skb DMA functions 309 * done by skb DMA functions
309 * @secmark: security marking 310 * @secmark: security marking
@@ -319,10 +320,7 @@ struct sk_buff {
319 ktime_t tstamp; 320 ktime_t tstamp;
320 struct net_device *dev; 321 struct net_device *dev;
321 322
322 union { 323 unsigned long _skb_dst;
323 struct dst_entry *dst;
324 struct rtable *rtable;
325 };
326#ifdef CONFIG_XFRM 324#ifdef CONFIG_XFRM
327 struct sec_path *sp; 325 struct sec_path *sp;
328#endif 326#endif
@@ -346,6 +344,7 @@ struct sk_buff {
346 }; 344 };
347 }; 345 };
348 __u32 priority; 346 __u32 priority;
347 kmemcheck_bitfield_begin(flags1);
349 __u8 local_df:1, 348 __u8 local_df:1,
350 cloned:1, 349 cloned:1,
351 ip_summed:2, 350 ip_summed:2,
@@ -356,6 +355,7 @@ struct sk_buff {
356 ipvs_property:1, 355 ipvs_property:1,
357 peeked:1, 356 peeked:1,
358 nf_trace:1; 357 nf_trace:1;
358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol; 359 __be16 protocol;
360 360
361 void (*destructor)(struct sk_buff *skb); 361 void (*destructor)(struct sk_buff *skb);
@@ -375,13 +375,16 @@ struct sk_buff {
375 __u16 tc_verd; /* traffic control verdict */ 375 __u16 tc_verd; /* traffic control verdict */
376#endif 376#endif
377#endif 377#endif
378
379 kmemcheck_bitfield_begin(flags2);
378#ifdef CONFIG_IPV6_NDISC_NODETYPE 380#ifdef CONFIG_IPV6_NDISC_NODETYPE
379 __u8 ndisc_nodetype:2; 381 __u8 ndisc_nodetype:2;
380#endif 382#endif
381#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
382 __u8 do_not_encrypt:1; 384 __u8 do_not_encrypt:1;
383 __u8 requeue:1;
384#endif 385#endif
386 kmemcheck_bitfield_end(flags2);
387
385 /* 0/13/14 bit hole */ 388 /* 0/13/14 bit hole */
386 389
387#ifdef CONFIG_NET_DMA 390#ifdef CONFIG_NET_DMA
@@ -423,6 +426,21 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
423 enum dma_data_direction dir); 426 enum dma_data_direction dir);
424#endif 427#endif
425 428
429static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
430{
431 return (struct dst_entry *)skb->_skb_dst;
432}
433
434static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
435{
436 skb->_skb_dst = (unsigned long)dst;
437}
438
439static inline struct rtable *skb_rtable(const struct sk_buff *skb)
440{
441 return (struct rtable *)skb_dst(skb);
442}
443
426extern void kfree_skb(struct sk_buff *skb); 444extern void kfree_skb(struct sk_buff *skb);
427extern void consume_skb(struct sk_buff *skb); 445extern void consume_skb(struct sk_buff *skb);
428extern void __kfree_skb(struct sk_buff *skb); 446extern void __kfree_skb(struct sk_buff *skb);
@@ -1062,7 +1080,7 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1062 int off, int size); 1080 int off, int size);
1063 1081
1064#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1082#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1065#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 1083#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frags(skb))
1066#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 1084#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
1067 1085
1068#ifdef NET_SKBUFF_DATA_USES_OFFSET 1086#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -1701,6 +1719,25 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1701 skb = skb->prev) 1719 skb = skb->prev)
1702 1720
1703 1721
1722static inline bool skb_has_frags(const struct sk_buff *skb)
1723{
1724 return skb_shinfo(skb)->frag_list != NULL;
1725}
1726
1727static inline void skb_frag_list_init(struct sk_buff *skb)
1728{
1729 skb_shinfo(skb)->frag_list = NULL;
1730}
1731
1732static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
1733{
1734 frag->next = skb_shinfo(skb)->frag_list;
1735 skb_shinfo(skb)->frag_list = frag;
1736}
1737
1738#define skb_walk_frags(skb, iter) \
1739 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
1740
1704extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 1741extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
1705 int *peeked, int *err); 1742 int *peeked, int *err);
1706extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1743extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
@@ -1715,8 +1752,14 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1715 struct iovec *iov); 1752 struct iovec *iov);
1716extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 1753extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1717 int offset, 1754 int offset,
1718 struct iovec *from, 1755 const struct iovec *from,
1756 int from_offset,
1719 int len); 1757 int len);
1758extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1759 int offset,
1760 const struct iovec *to,
1761 int to_offset,
1762 int size);
1720extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1763extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1721extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1764extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1722 unsigned int flags); 1765 unsigned int flags);