From: Roopa Prabhu <roopa@cumulusnetworks.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: dsa@cumulusnetworks.com, buytenh@wantstofly.org,
ebiederm@xmission.com, rshearma@brocade.com,
simon.horman@netronome.com, tom@herbertland.com, tgraf@suug.ch,
olivier.dugeon@orange.com
Subject: [PATCH net-next 2/3] net: mpls fixes for GSO
Date: Wed, 10 Aug 2016 23:43:31 -0700 [thread overview]
Message-ID: <1470897812-8213-3-git-send-email-roopa@cumulusnetworks.com> (raw)
In-Reply-To: <1470897812-8213-1-git-send-email-roopa@cumulusnetworks.com>
From: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Reported-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
net/mpls/mpls_gso.c | 24 ++++++++++++++++--------
net/mpls/mpls_iptunnel.c | 7 +++++++
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index 2055e57..8829ee0 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -22,26 +22,28 @@
static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
netdev_features_t features)
{
+ int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
struct sk_buff *segs = ERR_PTR(-EINVAL);
+ u16 mac_offset = skb->mac_header;
netdev_features_t mpls_features;
__be16 mpls_protocol;
+ u16 mac_len = skb->mac_len;
/* Setup inner SKB. */
mpls_protocol = skb->protocol;
skb->protocol = skb->inner_protocol;
- /* Push back the mac header that skb_mac_gso_segment() has pulled.
- * It will be re-pulled by the call to skb_mac_gso_segment() below
- */
- __skb_push(skb, skb->mac_len);
+ __skb_pull(skb, tnl_hlen);
+ skb->mac_len = skb_inner_network_offset(skb);
/* Segment inner packet. */
mpls_features = skb->dev->mpls_features & features;
segs = skb_mac_gso_segment(skb, mpls_features);
-
-
- /* Restore outer protocol. */
- skb->protocol = mpls_protocol;
+ if (IS_ERR_OR_NULL(segs)) {
+ skb_gso_error_unwind(skb, mpls_protocol, tnl_hlen, mac_offset,
+ mac_len);
+ goto out;
+ }
/* Re-pull the mac header that the call to skb_mac_gso_segment()
* above pulled. It will be re-pushed after returning
@@ -49,6 +51,12 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
*/
__skb_pull(skb, skb->data - skb_mac_header(skb));
+ /* Restore outer protocol. */
+ skb->protocol = mpls_protocol;
+ for (skb = segs; skb; skb = skb->next)
+ skb->protocol = mpls_protocol;
+
+out:
return segs;
}
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index aed872c..87e035a 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -90,8 +90,15 @@ static int mpls_xmit(struct sk_buff *skb)
if (skb_cow(skb, hh_len + new_header_size))
goto drop;
+ skb_reset_mac_header(skb);
+ skb_reset_inner_headers(skb);
+ skb->encapsulation = 1;
+
skb_push(skb, new_header_size);
+
skb_reset_network_header(skb);
+ skb_reset_transport_header(skb);
+ skb_set_inner_protocol(skb, skb->protocol);
skb->dev = out_dev;
skb->protocol = htons(ETH_P_MPLS_UC);
--
1.9.1
next prev parent reply other threads:[~2016-08-11 6:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 6:43 [PATCH net-next 0/3] lwtunnel, mpls fragmentation and gso fixes Roopa Prabhu
2016-08-11 6:43 ` [PATCH net-next 1/3] lwtunnel: xmit redirect Roopa Prabhu
2016-08-11 7:04 ` kbuild test robot
2016-08-11 7:07 ` kbuild test robot
2016-08-11 6:43 ` Roopa Prabhu [this message]
2016-08-11 7:47 ` [PATCH net-next 2/3] net: mpls fixes for GSO Simon Horman
2016-08-11 13:30 ` Simon Horman
2016-08-11 13:47 ` David Ahern
2016-08-11 6:43 ` [PATCH net-next 3/3] net: veth: set features for MPLS Roopa Prabhu
2016-08-11 13:49 ` [PATCH net-next 0/3] lwtunnel, mpls fragmentation and gso fixes Roopa Prabhu
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=1470897812-8213-3-git-send-email-roopa@cumulusnetworks.com \
--to=roopa@cumulusnetworks.com \
--cc=buytenh@wantstofly.org \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.org \
--cc=olivier.dugeon@orange.com \
--cc=rshearma@brocade.com \
--cc=simon.horman@netronome.com \
--cc=tgraf@suug.ch \
--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