netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH net-next 4/6] gre: Add support for checksum unnecessary conversions
Date: Sun, 31 Aug 2014 15:12:44 -0700	[thread overview]
Message-ID: <1409523166-9215-5-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1409523166-9215-1-git-send-email-therbert@google.com>

Call skb_checksum_try_convert and skb_gro_checksum_try_convert
after checksum is found present and validated in the GRE header
for normal and GRO paths respectively.

In GRO path, call skb_gro_checksum_try_convert

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/gre_demux.c   | 4 ++++
 net/ipv4/gre_offload.c | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 0485bf7..7e0756d 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -125,6 +125,10 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 			*csum_err = true;
 			return -EINVAL;
 		}
+
+		skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
+					 null_compute_pseudo);
+
 		options++;
 	}
 
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index a4d7965..d3fe2ac 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -172,10 +172,14 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
 	}
 
 	/* Don't bother verifying checksum if we're going to flush anyway. */
-	if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush &&
-	    skb_gro_checksum_simple_validate(skb))
+	if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush) {
+		if (skb_gro_checksum_simple_validate(skb))
 			goto out_unlock;
 
+		skb_gro_checksum_try_convert(skb, IPPROTO_GRE, 0,
+					     null_compute_pseudo);
+	}
+
 	flush = 0;
 
 	for (p = *head; p; p = p->next) {
-- 
2.1.0.rc2.206.gedb03e5

  parent reply	other threads:[~2014-08-31 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-31 22:12 [PATCH net-next 0/6] net: Checksum offload changes - Part VI Tom Herbert
2014-08-31 22:12 ` [PATCH net-next 1/6] net: Support for csum_bad in skbuff Tom Herbert
2014-08-31 22:12 ` [PATCH net-next 2/6] net: Infrastructure for checksum unnecessary conversions Tom Herbert
2014-08-31 22:12 ` [PATCH net-next 3/6] udp: Add support for doing checksum unnecessary conversion Tom Herbert
2014-08-31 22:12 ` Tom Herbert [this message]
2014-08-31 22:12 ` [PATCH net-next 5/6] vxlan: Enable checksum unnecessary conversions for vxlan/UDP sockets Tom Herbert
2014-08-31 22:12 ` [PATCH net-next 6/6] l2tp: Enable checksum unnecessary conversions for l2tp/UDP sockets Tom Herbert
2014-09-02  4:42 ` [PATCH net-next 0/6] net: Checksum offload changes - Part VI 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=1409523166-9215-5-git-send-email-therbert@google.com \
    --to=therbert@google.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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).