diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 87 |
1 files changed, 86 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index b8292d8cc9fa..e27d1c782f32 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/hrtimer.h> | 32 | #include <linux/hrtimer.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/netdev_features.h> | 34 | #include <linux/netdev_features.h> |
35 | #include <net/flow_keys.h> | ||
35 | 36 | ||
36 | /* Don't change this without changing skb_csum_unnecessary! */ | 37 | /* Don't change this without changing skb_csum_unnecessary! */ |
37 | #define CHECKSUM_NONE 0 | 38 | #define CHECKSUM_NONE 0 |
@@ -316,6 +317,8 @@ enum { | |||
316 | SKB_GSO_FCOE = 1 << 5, | 317 | SKB_GSO_FCOE = 1 << 5, |
317 | 318 | ||
318 | SKB_GSO_GRE = 1 << 6, | 319 | SKB_GSO_GRE = 1 << 6, |
320 | |||
321 | SKB_GSO_UDP_TUNNEL = 1 << 7, | ||
319 | }; | 322 | }; |
320 | 323 | ||
321 | #if BITS_PER_LONG > 32 | 324 | #if BITS_PER_LONG > 32 |
@@ -387,6 +390,7 @@ typedef unsigned char *sk_buff_data_t; | |||
387 | * @vlan_tci: vlan tag control information | 390 | * @vlan_tci: vlan tag control information |
388 | * @inner_transport_header: Inner transport layer header (encapsulation) | 391 | * @inner_transport_header: Inner transport layer header (encapsulation) |
389 | * @inner_network_header: Network layer header (encapsulation) | 392 | * @inner_network_header: Network layer header (encapsulation) |
393 | * @inner_mac_header: Link layer header (encapsulation) | ||
390 | * @transport_header: Transport layer header | 394 | * @transport_header: Transport layer header |
391 | * @network_header: Network layer header | 395 | * @network_header: Network layer header |
392 | * @mac_header: Link layer header | 396 | * @mac_header: Link layer header |
@@ -505,6 +509,7 @@ struct sk_buff { | |||
505 | 509 | ||
506 | sk_buff_data_t inner_transport_header; | 510 | sk_buff_data_t inner_transport_header; |
507 | sk_buff_data_t inner_network_header; | 511 | sk_buff_data_t inner_network_header; |
512 | sk_buff_data_t inner_mac_header; | ||
508 | sk_buff_data_t transport_header; | 513 | sk_buff_data_t transport_header; |
509 | sk_buff_data_t network_header; | 514 | sk_buff_data_t network_header; |
510 | sk_buff_data_t mac_header; | 515 | sk_buff_data_t mac_header; |
@@ -570,7 +575,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) | |||
570 | skb->_skb_refdst = (unsigned long)dst; | 575 | skb->_skb_refdst = (unsigned long)dst; |
571 | } | 576 | } |
572 | 577 | ||
573 | extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); | 578 | extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, |
579 | bool force); | ||
580 | |||
581 | /** | ||
582 | * skb_dst_set_noref - sets skb dst, hopefully, without taking reference | ||
583 | * @skb: buffer | ||
584 | * @dst: dst entry | ||
585 | * | ||
586 | * Sets skb dst, assuming a reference was not taken on dst. | ||
587 | * If dst entry is cached, we do not take reference and dst_release | ||
588 | * will be avoided by refdst_drop. If dst entry is not cached, we take | ||
589 | * reference, so that last dst_release can destroy the dst immediately. | ||
590 | */ | ||
591 | static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) | ||
592 | { | ||
593 | __skb_dst_set_noref(skb, dst, false); | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * skb_dst_set_noref_force - sets skb dst, without taking reference | ||
598 | * @skb: buffer | ||
599 | * @dst: dst entry | ||
600 | * | ||
601 | * Sets skb dst, assuming a reference was not taken on dst. | ||
602 | * No reference is taken and no dst_release will be called. While for | ||
603 | * cached dsts deferred reclaim is a basic feature, for entries that are | ||
604 | * not cached it is caller's job to guarantee that last dst_release for | ||
605 | * provided dst happens when nobody uses it, eg. after a RCU grace period. | ||
606 | */ | ||
607 | static inline void skb_dst_set_noref_force(struct sk_buff *skb, | ||
608 | struct dst_entry *dst) | ||
609 | { | ||
610 | __skb_dst_set_noref(skb, dst, true); | ||
611 | } | ||
574 | 612 | ||
575 | /** | 613 | /** |
576 | * skb_dst_is_noref - Test if skb dst isn't refcounted | 614 | * skb_dst_is_noref - Test if skb dst isn't refcounted |
@@ -1471,6 +1509,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
1471 | 1509 | ||
1472 | static inline void skb_reset_inner_headers(struct sk_buff *skb) | 1510 | static inline void skb_reset_inner_headers(struct sk_buff *skb) |
1473 | { | 1511 | { |
1512 | skb->inner_mac_header = skb->mac_header; | ||
1474 | skb->inner_network_header = skb->network_header; | 1513 | skb->inner_network_header = skb->network_header; |
1475 | skb->inner_transport_header = skb->transport_header; | 1514 | skb->inner_transport_header = skb->transport_header; |
1476 | } | 1515 | } |
@@ -1516,6 +1555,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1516 | skb->inner_network_header += offset; | 1555 | skb->inner_network_header += offset; |
1517 | } | 1556 | } |
1518 | 1557 | ||
1558 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
1559 | { | ||
1560 | return skb->head + skb->inner_mac_header; | ||
1561 | } | ||
1562 | |||
1563 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
1564 | { | ||
1565 | skb->inner_mac_header = skb->data - skb->head; | ||
1566 | } | ||
1567 | |||
1568 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
1569 | const int offset) | ||
1570 | { | ||
1571 | skb_reset_inner_mac_header(skb); | ||
1572 | skb->inner_mac_header += offset; | ||
1573 | } | ||
1519 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1574 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
1520 | { | 1575 | { |
1521 | return skb->transport_header != ~0U; | 1576 | return skb->transport_header != ~0U; |
@@ -1609,6 +1664,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1609 | skb->inner_network_header = skb->data + offset; | 1664 | skb->inner_network_header = skb->data + offset; |
1610 | } | 1665 | } |
1611 | 1666 | ||
1667 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
1668 | { | ||
1669 | return skb->inner_mac_header; | ||
1670 | } | ||
1671 | |||
1672 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
1673 | { | ||
1674 | skb->inner_mac_header = skb->data; | ||
1675 | } | ||
1676 | |||
1677 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
1678 | const int offset) | ||
1679 | { | ||
1680 | skb->inner_mac_header = skb->data + offset; | ||
1681 | } | ||
1612 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1682 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
1613 | { | 1683 | { |
1614 | return skb->transport_header != NULL; | 1684 | return skb->transport_header != NULL; |
@@ -1666,6 +1736,19 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | |||
1666 | } | 1736 | } |
1667 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | 1737 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ |
1668 | 1738 | ||
1739 | static inline void skb_probe_transport_header(struct sk_buff *skb, | ||
1740 | const int offset_hint) | ||
1741 | { | ||
1742 | struct flow_keys keys; | ||
1743 | |||
1744 | if (skb_transport_header_was_set(skb)) | ||
1745 | return; | ||
1746 | else if (skb_flow_dissect(skb, &keys)) | ||
1747 | skb_set_transport_header(skb, keys.thoff); | ||
1748 | else | ||
1749 | skb_set_transport_header(skb, offset_hint); | ||
1750 | } | ||
1751 | |||
1669 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) | 1752 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) |
1670 | { | 1753 | { |
1671 | if (skb_mac_header_was_set(skb)) { | 1754 | if (skb_mac_header_was_set(skb)) { |
@@ -2811,6 +2894,8 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb) | |||
2811 | 2894 | ||
2812 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); | 2895 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); |
2813 | 2896 | ||
2897 | u32 __skb_get_poff(const struct sk_buff *skb); | ||
2898 | |||
2814 | /** | 2899 | /** |
2815 | * skb_head_is_locked - Determine if the skb->head is locked down | 2900 | * skb_head_is_locked - Determine if the skb->head is locked down |
2816 | * @skb: skb to check | 2901 | * @skb: skb to check |