netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <aduyck@mirantis.com>
To: netdev@vger.kernel.org, alexander.duyck@gmail.com
Cc: ecree@solarflare.com, tom@herbertland.com, davem@davemloft.net
Subject: [net-next PATCH 07/10] gre: Use inner_proto to obtain inner header protocol
Date: Fri, 05 Feb 2016 15:28:08 -0800	[thread overview]
Message-ID: <20160205232807.18529.87448.stgit@localhost.localdomain> (raw)
In-Reply-To: <20160205232109.18529.99816.stgit@localhost.localdomain>

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>
---
 net/ipv4/gre_offload.c |    6 ++----
 1 file 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);

  parent reply	other threads:[~2016-02-05 23:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 23:27 [net-next PATCH 00/10] Add GSO support for outer checksum w/ inner checksum offloads Alexander Duyck
2016-02-05 23:27 ` [net-next PATCH 01/10] net: Drop unecessary enc_features variable from tunnel segmentation functions Alexander Duyck
2016-02-06 20:38   ` Tom Herbert
2016-02-05 23:27 ` [net-next PATCH 02/10] net: Move GSO csum into SKB_GSO_CB Alexander Duyck
2016-02-06 20:41   ` Tom Herbert
2016-02-05 23:27 ` [net-next PATCH 03/10] net: Update remote checksum segmentation to support use of GSO checksum Alexander Duyck
2016-02-06 20:44   ` Tom Herbert
2016-02-07 10:13     ` Alexander Duyck
2016-02-05 23:27 ` [net-next PATCH 04/10] net: Store checksum result for offloaded GSO checksums Alexander Duyck
2016-02-05 23:27 ` [net-next PATCH 05/10] net: Move skb_has_shared_frag check out of GRE code and into segmentation Alexander Duyck
2016-02-06 20:45   ` Tom Herbert
2016-02-05 23:28 ` [net-next PATCH 06/10] gre: Use GSO flags to determine csum need instead of GRE flags Alexander Duyck
2016-02-06 20:52   ` Tom Herbert
2016-02-07 10:06     ` Alexander Duyck
2016-02-05 23:28 ` Alexander Duyck [this message]
2016-02-06 20:55   ` [net-next PATCH 07/10] gre: Use inner_proto to obtain inner header protocol Tom Herbert
2016-02-07 10:11     ` Alexander Duyck
2016-02-05 23:28 ` [net-next PATCH 08/10] udp: Clean up the use of flags in UDP segmentation offload Alexander Duyck
2016-02-06 20:57   ` Tom Herbert
2016-02-05 23:28 ` [net-next PATCH 09/10] udp: Use uh->len instead of skb->len to compute checksum in segmentation Alexander Duyck
2016-02-06 20:59   ` Tom Herbert
2016-02-05 23:28 ` [net-next PATCH 10/10] net: Allow tunnels to use inner checksum offloads with outer checksums needed Alexander Duyck
2016-02-06 21:00   ` Tom Herbert
2016-02-11 14:32 ` [net-next PATCH 00/10] Add GSO support for outer checksum w/ inner checksum offloads David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160205232807.18529.87448.stgit@localhost.localdomain \
    --to=aduyck@mirantis.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).