From: Alexander Duyck <aduyck@mirantis.com>
To: talal@mellanox.com, netdev@vger.kernel.org, davem@davemloft.net,
galp@mellanox.com, ogerlitz@mellanox.com, eranbe@mellanox.com
Subject: [net-next PATCH 2/8] gso: Only allow GSO_PARTIAL if we can checksum the inner protocol
Date: Mon, 25 Apr 2016 11:31:07 -0700 [thread overview]
Message-ID: <20160425183107.11331.67524.stgit@ahduyck-xeon-server> (raw)
In-Reply-To: <20160425182442.11331.88349.stgit@ahduyck-xeon-server>
This patch addresses a possible issue that can occur if we get into any odd
corner cases where we support TSO for a given protocol but not the checksum
or scatter-gather offload. There are few drivers floating around that
setup their tunnels this way and by enforcing the checksum piece we can
avoid mangling any frames.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
net/core/skbuff.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7ff7788b0151..d2871d081750 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3080,8 +3080,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
unsigned int headroom;
unsigned int len = head_skb->len;
__be16 proto;
- bool csum;
- int sg = !!(features & NETIF_F_SG);
+ bool csum, sg;
int nfrags = skb_shinfo(head_skb)->nr_frags;
int err = -ENOMEM;
int i = 0;
@@ -3093,13 +3092,14 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
if (unlikely(!proto))
return ERR_PTR(-EINVAL);
+ sg = !!(features & NETIF_F_SG);
csum = !!can_checksum_protocol(features, proto);
/* GSO partial only requires that we trim off any excess that
* doesn't fit into an MSS sized block, so take care of that
* now.
*/
- if (features & NETIF_F_GSO_PARTIAL) {
+ if (sg && csum && (features & NETIF_F_GSO_PARTIAL)) {
partial_segs = len / mss;
mss *= partial_segs;
}
next prev parent reply other threads:[~2016-04-25 18:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-25 18:30 [net-next PATCH 0/8] Fix Tunnel features and enable GSO partial for Mellanox adapters Alexander Duyck
2016-04-25 18:31 ` [net-next PATCH 1/8] net: Disable segmentation if checksumming is not supported Alexander Duyck
2016-04-25 18:31 ` Alexander Duyck [this message]
2016-04-25 18:31 ` [net-next PATCH 3/8] net: Fix netdev_fix_features so that TSO_MANGLEID is only available with TSO Alexander Duyck
2016-04-25 18:31 ` [net-next PATCH 4/8] vxlan: Add checksum check to the features check function Alexander Duyck
2016-04-25 18:31 ` [net-next PATCH 5/8] mlx4: Add support for UDP tunnel segmentation with outer checksum offload Alexander Duyck
2016-04-25 18:31 ` [net-next PATCH 6/8] mlx4: Add support for inner IPv6 checksum offloads and TSO Alexander Duyck
2016-04-26 14:37 ` Saeed Mahameed
2016-04-26 15:50 ` Alex Duyck
2016-04-26 20:23 ` Saeed Mahameed
2016-04-26 21:01 ` Alexander Duyck
2016-04-27 15:39 ` Tariq Toukan
2016-04-27 18:05 ` Alexander Duyck
2016-04-28 13:26 ` Tariq Toukan
2016-04-25 18:31 ` [net-next PATCH 7/8] mlx5e: Add support for UDP tunnel segmentation with outer checksum offload Alexander Duyck
2016-04-25 18:31 ` [net-next PATCH 8/8] mlx5e: Fix IPv6 tunnel " Alexander Duyck
2016-04-29 17:31 ` [net-next PATCH 0/8] Fix Tunnel features and enable GSO partial for Mellanox adapters David Miller
2016-04-29 17:32 ` Alex Duyck
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=20160425183107.11331.67524.stgit@ahduyck-xeon-server \
--to=aduyck@mirantis.com \
--cc=davem@davemloft.net \
--cc=eranbe@mellanox.com \
--cc=galp@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=talal@mellanox.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).