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.h73
1 files changed, 48 insertions, 25 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c0a4f3ab0cc0..a24218c9c84b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.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 {
@@ -1562,16 +1579,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1562 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1579 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1563} 1580}
1564 1581
1565static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, 1582static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1566 unsigned int length) 1583 unsigned int length, gfp_t gfp)
1567{ 1584{
1568 struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); 1585 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
1569 1586
1570 if (NET_IP_ALIGN && skb) 1587 if (NET_IP_ALIGN && skb)
1571 skb_reserve(skb, NET_IP_ALIGN); 1588 skb_reserve(skb, NET_IP_ALIGN);
1572 return skb; 1589 return skb;
1573} 1590}
1574 1591
1592static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1593 unsigned int length)
1594{
1595 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
1596}
1597
1575/** 1598/**
1576 * __netdev_alloc_page - allocate a page for ps-rx on a specific device 1599 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1577 * @dev: network device to receive on 1600 * @dev: network device to receive on
@@ -2028,8 +2051,7 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
2028 * skb_tx_timestamp() - Driver hook for transmit timestamping 2051 * skb_tx_timestamp() - Driver hook for transmit timestamping
2029 * 2052 *
2030 * Ethernet MAC Drivers should call this function in their hard_xmit() 2053 * 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 2054 * function immediately before giving the sk_buff to the MAC hardware.
2032 * hardware, but before freeing the sk_buff.
2033 * 2055 *
2034 * @skb: A socket buffer. 2056 * @skb: A socket buffer.
2035 */ 2057 */
@@ -2266,5 +2288,6 @@ static inline void skb_checksum_none_assert(struct sk_buff *skb)
2266} 2288}
2267 2289
2268bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); 2290bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2291
2269#endif /* __KERNEL__ */ 2292#endif /* __KERNEL__ */
2270#endif /* _LINUX_SKBUFF_H */ 2293#endif /* _LINUX_SKBUFF_H */