aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h83
1 files changed, 56 insertions, 27 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c0a4f3ab0cc..0f966460a34 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -20,7 +20,7 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22 22
23#include <asm/atomic.h> 23#include <linux/atomic.h>
24#include <asm/types.h> 24#include <asm/types.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/net.h> 26#include <linux/net.h>
@@ -187,6 +187,20 @@ enum {
187 187
188 /* ensure the originating sk reference is available on driver level */ 188 /* ensure the originating sk reference is available on driver level */
189 SKBTX_DRV_NEEDS_SK_REF = 1 << 3, 189 SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
190
191 /* device driver supports TX zero-copy buffers */
192 SKBTX_DEV_ZEROCOPY = 1 << 4,
193};
194
195/*
196 * The callback notifies userspace to release buffers when skb DMA is done in
197 * lower device, the skb last reference should be 0 when calling this.
198 * The desc is used to track userspace buffer index.
199 */
200struct ubuf_info {
201 void (*callback)(void *);
202 void *arg;
203 unsigned long desc;
190}; 204};
191 205
192/* This data is invariant across clones and lives at 206/* This data is invariant across clones and lives at
@@ -211,6 +225,7 @@ struct skb_shared_info {
211 /* Intermediate layers must ensure that destructor_arg 225 /* Intermediate layers must ensure that destructor_arg
212 * remains valid until skb destructor */ 226 * remains valid until skb destructor */
213 void * destructor_arg; 227 void * destructor_arg;
228
214 /* must be last field, see pskb_expand_head() */ 229 /* must be last field, see pskb_expand_head() */
215 skb_frag_t frags[MAX_SKB_FRAGS]; 230 skb_frag_t frags[MAX_SKB_FRAGS];
216}; 231};
@@ -270,15 +285,12 @@ typedef unsigned char *sk_buff_data_t;
270 * struct sk_buff - socket buffer 285 * struct sk_buff - socket buffer
271 * @next: Next buffer in list 286 * @next: Next buffer in list
272 * @prev: Previous buffer in list 287 * @prev: Previous buffer in list
273 * @sk: Socket we are owned by
274 * @tstamp: Time we arrived 288 * @tstamp: Time we arrived
289 * @sk: Socket we are owned by
275 * @dev: Device we arrived on/are leaving by 290 * @dev: Device we arrived on/are leaving by
276 * @transport_header: Transport layer header 291 * @cb: Control buffer. Free for use by every layer. Put private vars here
277 * @network_header: Network layer header
278 * @mac_header: Link layer header
279 * @_skb_refdst: destination entry (with norefcount bit) 292 * @_skb_refdst: destination entry (with norefcount bit)
280 * @sp: the security path, used for xfrm 293 * @sp: the security path, used for xfrm
281 * @cb: Control buffer. Free for use by every layer. Put private vars here
282 * @len: Length of actual data 294 * @len: Length of actual data
283 * @data_len: Data length 295 * @data_len: Data length
284 * @mac_len: Length of link layer header 296 * @mac_len: Length of link layer header
@@ -286,40 +298,45 @@ typedef unsigned char *sk_buff_data_t;
286 * @csum: Checksum (must include start/offset pair) 298 * @csum: Checksum (must include start/offset pair)
287 * @csum_start: Offset from skb->head where checksumming should start 299 * @csum_start: Offset from skb->head where checksumming should start
288 * @csum_offset: Offset from csum_start where checksum should be stored 300 * @csum_offset: Offset from csum_start where checksum should be stored
301 * @priority: Packet queueing priority
289 * @local_df: allow local fragmentation 302 * @local_df: allow local fragmentation
290 * @cloned: Head may be cloned (check refcnt to be sure) 303 * @cloned: Head may be cloned (check refcnt to be sure)
304 * @ip_summed: Driver fed us an IP checksum
291 * @nohdr: Payload reference only, must not modify header 305 * @nohdr: Payload reference only, must not modify header
306 * @nfctinfo: Relationship of this skb to the connection
292 * @pkt_type: Packet class 307 * @pkt_type: Packet class
293 * @fclone: skbuff clone status 308 * @fclone: skbuff clone status
294 * @ip_summed: Driver fed us an IP checksum
295 * @priority: Packet queueing priority
296 * @users: User count - see {datagram,tcp}.c
297 * @protocol: Packet protocol from driver
298 * @truesize: Buffer size
299 * @head: Head of buffer
300 * @data: Data head pointer
301 * @tail: Tail pointer
302 * @end: End pointer
303 * @destructor: Destruct function
304 * @mark: Generic packet mark
305 * @nfct: Associated connection, if any
306 * @ipvs_property: skbuff is owned by ipvs 309 * @ipvs_property: skbuff is owned by ipvs
307 * @peeked: this packet has been seen already, so stats have been 310 * @peeked: this packet has been seen already, so stats have been
308 * done for it, don't do them again 311 * done for it, don't do them again
309 * @nf_trace: netfilter packet trace flag 312 * @nf_trace: netfilter packet trace flag
310 * @nfctinfo: Relationship of this skb to the connection 313 * @protocol: Packet protocol from driver
314 * @destructor: Destruct function
315 * @nfct: Associated connection, if any
311 * @nfct_reasm: netfilter conntrack re-assembly pointer 316 * @nfct_reasm: netfilter conntrack re-assembly pointer
312 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 317 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
313 * @skb_iif: ifindex of device we arrived on 318 * @skb_iif: ifindex of device we arrived on
314 * @rxhash: the packet hash computed on receive
315 * @queue_mapping: Queue mapping for multiqueue devices
316 * @tc_index: Traffic control index 319 * @tc_index: Traffic control index
317 * @tc_verd: traffic control verdict 320 * @tc_verd: traffic control verdict
321 * @rxhash: the packet hash computed on receive
322 * @queue_mapping: Queue mapping for multiqueue devices
318 * @ndisc_nodetype: router type (from link layer) 323 * @ndisc_nodetype: router type (from link layer)
324 * @ooo_okay: allow the mapping of a socket to a queue to be changed
319 * @dma_cookie: a cookie to one of several possible DMA operations 325 * @dma_cookie: a cookie to one of several possible DMA operations
320 * done by skb DMA functions 326 * done by skb DMA functions
321 * @secmark: security marking 327 * @secmark: security marking
328 * @mark: Generic packet mark
329 * @dropcount: total number of sk_receive_queue overflows
322 * @vlan_tci: vlan tag control information 330 * @vlan_tci: vlan tag control information
331 * @transport_header: Transport layer header
332 * @network_header: Network layer header
333 * @mac_header: Link layer header
334 * @tail: Tail pointer
335 * @end: End pointer
336 * @head: Head of buffer
337 * @data: Data head pointer
338 * @truesize: Buffer size
339 * @users: User count - see {datagram,tcp}.c
323 */ 340 */
324 341
325struct sk_buff { 342struct sk_buff {
@@ -507,6 +524,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
507extern bool skb_recycle_check(struct sk_buff *skb, int skb_size); 524extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
508 525
509extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 526extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
527extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
510extern struct sk_buff *skb_clone(struct sk_buff *skb, 528extern struct sk_buff *skb_clone(struct sk_buff *skb,
511 gfp_t priority); 529 gfp_t priority);
512extern struct sk_buff *skb_copy(const struct sk_buff *skb, 530extern struct sk_buff *skb_copy(const struct sk_buff *skb,
@@ -1562,16 +1580,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1562 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1580 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1563} 1581}
1564 1582
1565static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, 1583static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1566 unsigned int length) 1584 unsigned int length, gfp_t gfp)
1567{ 1585{
1568 struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); 1586 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
1569 1587
1570 if (NET_IP_ALIGN && skb) 1588 if (NET_IP_ALIGN && skb)
1571 skb_reserve(skb, NET_IP_ALIGN); 1589 skb_reserve(skb, NET_IP_ALIGN);
1572 return skb; 1590 return skb;
1573} 1591}
1574 1592
1593static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1594 unsigned int length)
1595{
1596 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
1597}
1598
1575/** 1599/**
1576 * __netdev_alloc_page - allocate a page for ps-rx on a specific device 1600 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1577 * @dev: network device to receive on 1601 * @dev: network device to receive on
@@ -1996,8 +2020,13 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1996/** 2020/**
1997 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps 2021 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1998 * 2022 *
2023 * PHY drivers may accept clones of transmitted packets for
2024 * timestamping via their phy_driver.txtstamp method. These drivers
2025 * must call this function to return the skb back to the stack, with
2026 * or without a timestamp.
2027 *
1999 * @skb: clone of the the original outgoing packet 2028 * @skb: clone of the the original outgoing packet
2000 * @hwtstamps: hardware time stamps 2029 * @hwtstamps: hardware time stamps, may be NULL if not available
2001 * 2030 *
2002 */ 2031 */
2003void skb_complete_tx_timestamp(struct sk_buff *skb, 2032void skb_complete_tx_timestamp(struct sk_buff *skb,
@@ -2028,8 +2057,7 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
2028 * skb_tx_timestamp() - Driver hook for transmit timestamping 2057 * skb_tx_timestamp() - Driver hook for transmit timestamping
2029 * 2058 *
2030 * Ethernet MAC Drivers should call this function in their hard_xmit() 2059 * Ethernet MAC Drivers should call this function in their hard_xmit()
2031 * function as soon as possible after giving the sk_buff to the MAC 2060 * function immediately before giving the sk_buff to the MAC hardware.
2032 * hardware, but before freeing the sk_buff.
2033 * 2061 *
2034 * @skb: A socket buffer. 2062 * @skb: A socket buffer.
2035 */ 2063 */
@@ -2266,5 +2294,6 @@ static inline void skb_checksum_none_assert(struct sk_buff *skb)
2266} 2294}
2267 2295
2268bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); 2296bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2297
2269#endif /* __KERNEL__ */ 2298#endif /* __KERNEL__ */
2270#endif /* _LINUX_SKBUFF_H */ 2299#endif /* _LINUX_SKBUFF_H */