Commit aefbd2b3 authored by Pravin B Shelar's avatar Pravin B Shelar Committed by David S. Miller

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: default avatarPravin B Shelar <pshelar@nicira.com>
Acked-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5b17294
...@@ -387,6 +387,7 @@ typedef unsigned char *sk_buff_data_t; ...@@ -387,6 +387,7 @@ typedef unsigned char *sk_buff_data_t;
* @vlan_tci: vlan tag control information * @vlan_tci: vlan tag control information
* @inner_transport_header: Inner transport layer header (encapsulation) * @inner_transport_header: Inner transport layer header (encapsulation)
* @inner_network_header: Network layer header (encapsulation) * @inner_network_header: Network layer header (encapsulation)
* @inner_mac_header: Link layer header (encapsulation)
* @transport_header: Transport layer header * @transport_header: Transport layer header
* @network_header: Network layer header * @network_header: Network layer header
* @mac_header: Link layer header * @mac_header: Link layer header
...@@ -505,6 +506,7 @@ struct sk_buff { ...@@ -505,6 +506,7 @@ struct sk_buff {
sk_buff_data_t inner_transport_header; sk_buff_data_t inner_transport_header;
sk_buff_data_t inner_network_header; sk_buff_data_t inner_network_header;
sk_buff_data_t inner_mac_header;
sk_buff_data_t transport_header; sk_buff_data_t transport_header;
sk_buff_data_t network_header; sk_buff_data_t network_header;
sk_buff_data_t mac_header; sk_buff_data_t mac_header;
...@@ -1466,6 +1468,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len) ...@@ -1466,6 +1468,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
static inline void skb_reset_inner_headers(struct sk_buff *skb) static inline void skb_reset_inner_headers(struct sk_buff *skb)
{ {
skb->inner_mac_header = skb->mac_header;
skb->inner_network_header = skb->network_header; skb->inner_network_header = skb->network_header;
skb->inner_transport_header = skb->transport_header; skb->inner_transport_header = skb->transport_header;
} }
...@@ -1511,6 +1514,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, ...@@ -1511,6 +1514,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
skb->inner_network_header += offset; skb->inner_network_header += offset;
} }
static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
{
return skb->head + skb->inner_mac_header;
}
static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
{
skb->inner_mac_header = skb->data - skb->head;
}
static inline void skb_set_inner_mac_header(struct sk_buff *skb,
const int offset)
{
skb_reset_inner_mac_header(skb);
skb->inner_mac_header += offset;
}
static inline bool skb_transport_header_was_set(const struct sk_buff *skb) static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
{ {
return skb->transport_header != ~0U; return skb->transport_header != ~0U;
...@@ -1604,6 +1623,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, ...@@ -1604,6 +1623,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
skb->inner_network_header = skb->data + offset; skb->inner_network_header = skb->data + offset;
} }
static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
{
return skb->inner_mac_header;
}
static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
{
skb->inner_mac_header = skb->data;
}
static inline void skb_set_inner_mac_header(struct sk_buff *skb,
const int offset)
{
skb->inner_mac_header = skb->data + offset;
}
static inline bool skb_transport_header_was_set(const struct sk_buff *skb) static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
{ {
return skb->transport_header != NULL; return skb->transport_header != NULL;
......
...@@ -673,6 +673,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) ...@@ -673,6 +673,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
new->mac_header = old->mac_header; new->mac_header = old->mac_header;
new->inner_transport_header = old->inner_transport_header; new->inner_transport_header = old->inner_transport_header;
new->inner_network_header = old->inner_network_header; new->inner_network_header = old->inner_network_header;
new->inner_mac_header = old->inner_mac_header;
skb_dst_copy(new, old); skb_dst_copy(new, old);
new->rxhash = old->rxhash; new->rxhash = old->rxhash;
new->ooo_okay = old->ooo_okay; new->ooo_okay = old->ooo_okay;
...@@ -876,6 +877,7 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off) ...@@ -876,6 +877,7 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off)
skb->mac_header += off; skb->mac_header += off;
skb->inner_transport_header += off; skb->inner_transport_header += off;
skb->inner_network_header += off; skb->inner_network_header += off;
skb->inner_mac_header += off;
} }
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment