Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tunneling: Capture inner mac header during encapsulation.

This patch adds inner mac header. This will be used in next patch
to find tunner header length. Header len is required to copy tunnel
header to each gso segment.
This patch does not change any functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pravin B Shelar and committed by
David S. Miller
aefbd2b3 f5b17294

+36
+34
include/linux/skbuff.h
··· 387 387 * @vlan_tci: vlan tag control information 388 388 * @inner_transport_header: Inner transport layer header (encapsulation) 389 389 * @inner_network_header: Network layer header (encapsulation) 390 + * @inner_mac_header: Link layer header (encapsulation) 390 391 * @transport_header: Transport layer header 391 392 * @network_header: Network layer header 392 393 * @mac_header: Link layer header ··· 506 505 507 506 sk_buff_data_t inner_transport_header; 508 507 sk_buff_data_t inner_network_header; 508 + sk_buff_data_t inner_mac_header; 509 509 sk_buff_data_t transport_header; 510 510 sk_buff_data_t network_header; 511 511 sk_buff_data_t mac_header; ··· 1468 1466 1469 1467 static inline void skb_reset_inner_headers(struct sk_buff *skb) 1470 1468 { 1469 + skb->inner_mac_header = skb->mac_header; 1471 1470 skb->inner_network_header = skb->network_header; 1472 1471 skb->inner_transport_header = skb->transport_header; 1473 1472 } ··· 1514 1511 skb->inner_network_header += offset; 1515 1512 } 1516 1513 1514 + static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) 1515 + { 1516 + return skb->head + skb->inner_mac_header; 1517 + } 1518 + 1519 + static inline void skb_reset_inner_mac_header(struct sk_buff *skb) 1520 + { 1521 + skb->inner_mac_header = skb->data - skb->head; 1522 + } 1523 + 1524 + static inline void skb_set_inner_mac_header(struct sk_buff *skb, 1525 + const int offset) 1526 + { 1527 + skb_reset_inner_mac_header(skb); 1528 + skb->inner_mac_header += offset; 1529 + } 1517 1530 static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1518 1531 { 1519 1532 return skb->transport_header != ~0U; ··· 1623 1604 skb->inner_network_header = skb->data + offset; 1624 1605 } 1625 1606 1607 + static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) 1608 + { 1609 + return skb->inner_mac_header; 1610 + } 1611 + 1612 + static inline void skb_reset_inner_mac_header(struct sk_buff *skb) 1613 + { 1614 + skb->inner_mac_header = skb->data; 1615 + } 1616 + 1617 + static inline void skb_set_inner_mac_header(struct sk_buff *skb, 1618 + const int offset) 1619 + { 1620 + skb->inner_mac_header = skb->data + offset; 1621 + } 1626 1622 static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1627 1623 { 1628 1624 return skb->transport_header != NULL;
+2
net/core/skbuff.c
··· 673 673 new->mac_header = old->mac_header; 674 674 new->inner_transport_header = old->inner_transport_header; 675 675 new->inner_network_header = old->inner_network_header; 676 + new->inner_mac_header = old->inner_mac_header; 676 677 skb_dst_copy(new, old); 677 678 new->rxhash = old->rxhash; 678 679 new->ooo_okay = old->ooo_okay; ··· 877 876 skb->mac_header += off; 878 877 skb->inner_transport_header += off; 879 878 skb->inner_network_header += off; 879 + skb->inner_mac_header += off; 880 880 } 881 881 882 882 static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)