diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 320e976d5ab8..821c7f45d2a7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -230,6 +230,13 @@ enum { | |||
230 | 230 | ||
231 | /* generate wifi status information (where possible) */ | 231 | /* generate wifi status information (where possible) */ |
232 | SKBTX_WIFI_STATUS = 1 << 4, | 232 | SKBTX_WIFI_STATUS = 1 << 4, |
233 | |||
234 | /* This indicates at least one fragment might be overwritten | ||
235 | * (as in vmsplice(), sendfile() ...) | ||
236 | * If we need to compute a TX checksum, we'll need to copy | ||
237 | * all frags to avoid possible bad checksum | ||
238 | */ | ||
239 | SKBTX_SHARED_FRAG = 1 << 5, | ||
233 | }; | 240 | }; |
234 | 241 | ||
235 | /* | 242 | /* |
@@ -307,6 +314,8 @@ enum { | |||
307 | SKB_GSO_TCPV6 = 1 << 4, | 314 | SKB_GSO_TCPV6 = 1 << 4, |
308 | 315 | ||
309 | SKB_GSO_FCOE = 1 << 5, | 316 | SKB_GSO_FCOE = 1 << 5, |
317 | |||
318 | SKB_GSO_GRE = 1 << 6, | ||
310 | }; | 319 | }; |
311 | 320 | ||
312 | #if BITS_PER_LONG > 32 | 321 | #if BITS_PER_LONG > 32 |
@@ -797,6 +806,16 @@ static inline int skb_cloned(const struct sk_buff *skb) | |||
797 | (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; | 806 | (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; |
798 | } | 807 | } |
799 | 808 | ||
809 | static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) | ||
810 | { | ||
811 | might_sleep_if(pri & __GFP_WAIT); | ||
812 | |||
813 | if (skb_cloned(skb)) | ||
814 | return pskb_expand_head(skb, 0, 0, pri); | ||
815 | |||
816 | return 0; | ||
817 | } | ||
818 | |||
800 | /** | 819 | /** |
801 | * skb_header_cloned - is the header a clone | 820 | * skb_header_cloned - is the header a clone |
802 | * @skb: buffer to check | 821 | * @skb: buffer to check |
@@ -1492,6 +1511,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1492 | skb->inner_network_header += offset; | 1511 | skb->inner_network_header += offset; |
1493 | } | 1512 | } |
1494 | 1513 | ||
1514 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | ||
1515 | { | ||
1516 | return skb->transport_header != ~0U; | ||
1517 | } | ||
1518 | |||
1495 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) | 1519 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) |
1496 | { | 1520 | { |
1497 | return skb->head + skb->transport_header; | 1521 | return skb->head + skb->transport_header; |
@@ -1580,6 +1604,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1580 | skb->inner_network_header = skb->data + offset; | 1604 | skb->inner_network_header = skb->data + offset; |
1581 | } | 1605 | } |
1582 | 1606 | ||
1607 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | ||
1608 | { | ||
1609 | return skb->transport_header != NULL; | ||
1610 | } | ||
1611 | |||
1583 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) | 1612 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) |
1584 | { | 1613 | { |
1585 | return skb->transport_header; | 1614 | return skb->transport_header; |
@@ -1815,6 +1844,10 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) | |||
1815 | kfree_skb(skb); | 1844 | kfree_skb(skb); |
1816 | } | 1845 | } |
1817 | 1846 | ||
1847 | #define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768) | ||
1848 | #define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER) | ||
1849 | #define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE | ||
1850 | |||
1818 | extern void *netdev_alloc_frag(unsigned int fragsz); | 1851 | extern void *netdev_alloc_frag(unsigned int fragsz); |
1819 | 1852 | ||
1820 | extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, | 1853 | extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, |
@@ -2191,6 +2224,19 @@ static inline int skb_linearize(struct sk_buff *skb) | |||
2191 | } | 2224 | } |
2192 | 2225 | ||
2193 | /** | 2226 | /** |
2227 | * skb_has_shared_frag - can any frag be overwritten | ||
2228 | * @skb: buffer to test | ||
2229 | * | ||
2230 | * Return true if the skb has at least one frag that might be modified | ||
2231 | * by an external entity (as in vmsplice()/sendfile()) | ||
2232 | */ | ||
2233 | static inline bool skb_has_shared_frag(const struct sk_buff *skb) | ||
2234 | { | ||
2235 | return skb_is_nonlinear(skb) && | ||
2236 | skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG; | ||
2237 | } | ||
2238 | |||
2239 | /** | ||
2194 | * skb_linearize_cow - make sure skb is linear and writable | 2240 | * skb_linearize_cow - make sure skb is linear and writable |
2195 | * @skb: buffer to process | 2241 | * @skb: buffer to process |
2196 | * | 2242 | * |
@@ -2688,6 +2734,21 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | |||
2688 | } | 2734 | } |
2689 | #endif | 2735 | #endif |
2690 | 2736 | ||
2737 | /* Keeps track of mac header offset relative to skb->head. | ||
2738 | * It is useful for TSO of Tunneling protocol. e.g. GRE. | ||
2739 | * For non-tunnel skb it points to skb_mac_header() and for | ||
2740 | * tunnel skb it points to outer mac header. */ | ||
2741 | struct skb_gso_cb { | ||
2742 | int mac_offset; | ||
2743 | }; | ||
2744 | #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) | ||
2745 | |||
2746 | static inline int skb_tnl_header_len(const struct sk_buff *inner_skb) | ||
2747 | { | ||
2748 | return (skb_mac_header(inner_skb) - inner_skb->head) - | ||
2749 | SKB_GSO_CB(inner_skb)->mac_offset; | ||
2750 | } | ||
2751 | |||
2691 | static inline bool skb_is_gso(const struct sk_buff *skb) | 2752 | static inline bool skb_is_gso(const struct sk_buff *skb) |
2692 | { | 2753 | { |
2693 | return skb_shinfo(skb)->gso_size; | 2754 | return skb_shinfo(skb)->gso_size; |