aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/gre_offload.c
diff options
context:
space:
mode:
authorAlexander Duyck <aduyck@mirantis.com>2016-02-05 15:28:08 -0800
committerDavid S. Miller <davem@davemloft.net>2016-02-11 08:55:34 -0500
commit38720352412a4305a108ff37ae6099dab3f44a38 (patch)
tree2fdb20a0647dcdb4c0c921a4d2b1b45ff230abbf /net/ipv4/gre_offload.c
parentgre: Use GSO flags to determine csum need instead of GRE flags (diff)
downloadlinux-dev-38720352412a4305a108ff37ae6099dab3f44a38.tar.xz
linux-dev-38720352412a4305a108ff37ae6099dab3f44a38.zip
gre: Use inner_proto to obtain inner header protocol
Instead of parsing headers to determine the inner protocol we can just pull the value from inner_proto. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/gre_offload.c')
-rw-r--r--net/ipv4/gre_offload.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index c15441b5ff61..003b0ebbcfdd 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -20,7 +20,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
{
int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
struct sk_buff *segs = ERR_PTR(-EINVAL);
- struct gre_base_hdr *greh;
u16 mac_offset = skb->mac_header;
__be16 protocol = skb->protocol;
u16 mac_len = skb->mac_len;
@@ -48,15 +47,13 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
if (unlikely(!pskb_may_pull(skb, tnl_hlen)))
goto out;
- greh = (struct gre_base_hdr *)skb_transport_header(skb);
-
/* setup inner skb. */
- skb->protocol = greh->protocol;
skb->encapsulation = 0;
__skb_pull(skb, tnl_hlen);
skb_reset_mac_header(skb);
skb_set_network_header(skb, skb_inner_network_offset(skb));
skb->mac_len = skb_inner_network_offset(skb);
+ skb->protocol = skb->inner_protocol;
need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM);
skb->encap_hdr_csum = need_csum;
@@ -75,6 +72,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
gre_offset = outer_hlen - tnl_hlen;
skb = segs;
do {
+ struct gre_base_hdr *greh;
__be32 *pcsum;
skb_reset_inner_headers(skb);