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 03/10] net: Update remote checksum segmentation to support use of GSO checksum
Date: Fri, 05 Feb 2016 15:27:43 -0800 [thread overview]
Message-ID: <20160205232743.18529.68800.stgit@localhost.localdomain> (raw)
In-Reply-To: <20160205232109.18529.99816.stgit@localhost.localdomain>
This patch addresses two main issues.
First in the case of remote checksum offload we were avoiding dealing with
scatter-gather issues. As a result it would be possible to assemble a
series of frames that used frags instead of being linearized as they should
have if remote checksum offload was enabled.
Second I have updated the code so that we now let GSO take care of doing
the checksum on the data itself and drop the special case that was added
for remote checksum offload.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
net/core/skbuff.c | 10 ++++++----
net/ipv4/udp_offload.c | 22 ++++++++++------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 02c638a643ea..9c065ac72e87 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3098,8 +3098,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
if (nskb->len == len + doffset)
goto perform_csum_check;
- if (!sg && !nskb->remcsum_offload) {
- nskb->ip_summed = CHECKSUM_NONE;
+ if (!sg) {
+ if (!nskb->remcsum_offload)
+ nskb->ip_summed = CHECKSUM_NONE;
SKB_GSO_CB(nskb)->csum =
skb_copy_and_csum_bits(head_skb, offset,
skb_put(nskb, len),
@@ -3171,8 +3172,9 @@ skip_fraglist:
nskb->truesize += nskb->data_len;
perform_csum_check:
- if (!csum && !nskb->remcsum_offload) {
- nskb->ip_summed = CHECKSUM_NONE;
+ if (!csum) {
+ if (!nskb->remcsum_offload)
+ nskb->ip_summed = CHECKSUM_NONE;
SKB_GSO_CB(nskb)->csum =
skb_checksum(nskb, doffset,
nskb->len - doffset, 0);
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index ce64c2b7ba55..86687f58d613 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -66,6 +66,16 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
features &= skb->dev->hw_enc_features;
+ /* The only checksum offload we care about from here on out is the
+ * outer one so strip the existing checksum feature flags and
+ * instead set the flag based on our outer checksum offload value.
+ */
+ if (remcsum) {
+ features &= ~NETIF_F_CSUM_MASK;
+ if (offload_csum)
+ features |= NETIF_F_HW_CSUM;
+ }
+
/* segment inner packet. */
segs = gso_inner_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) {
@@ -116,18 +126,6 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum_start = skb_transport_header(skb) - skb->head;
skb->csum_offset = offsetof(struct udphdr, check);
- } else if (remcsum) {
- /* Need to calculate checksum from scratch,
- * inner checksums are never when doing
- * remote_checksum_offload.
- */
-
- skb->csum = skb_checksum(skb, udp_offset,
- skb->len - udp_offset,
- 0);
- uh->check = csum_fold(skb->csum);
- if (uh->check == 0)
- uh->check = CSUM_MANGLED_0;
} else {
uh->check = gso_make_checksum(skb, ~uh->check);
next prev parent reply other threads:[~2016-02-05 23:27 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 ` Alexander Duyck [this message]
2016-02-06 20:44 ` [net-next PATCH 03/10] net: Update remote checksum segmentation to support use of GSO checksum 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 ` [net-next PATCH 07/10] gre: Use inner_proto to obtain inner header protocol Alexander Duyck
2016-02-06 20:55 ` 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=20160205232743.18529.68800.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).