From patchwork Thu Feb 27 21:26:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Chu X-Patchwork-Id: 324953 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BBC202C008F for ; Fri, 28 Feb 2014 08:26:35 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751874AbaB0V0c (ORCPT ); Thu, 27 Feb 2014 16:26:32 -0500 Received: from mail-ob0-f202.google.com ([209.85.214.202]:62945 "EHLO mail-ob0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbaB0V0a (ORCPT ); Thu, 27 Feb 2014 16:26:30 -0500 Received: by mail-ob0-f202.google.com with SMTP id wo20so151670obc.1 for ; Thu, 27 Feb 2014 13:26:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=kGoaA5SHPwgWPi9+suge3PwUejg+88B71hSP94ZzAts=; b=gZg7rcuwxsxB7DeYBMC/BnCgkKlowKozZ9OgslQDlO6Q9co+T2SMHNNLac7XpNIHOC G0LtaoLIt5vRwpwnl+WAi1lSVSGBUfTFag7iJH8n8fzKPsuvluHHb9f5LU7VT4aj7BOz OSyy5GRL2WRmI7Ms38QmdOv9e8GlM8Oka8H79cg/BVgYsKlxa7M17RLdXtYi4H9rRnLL 3JuauvSeSF8LbVgk+Fj6cVa9Zh4N9Y/FJSYjG3B6ck84dZa88hubGRhNI1GwQUhmrqAq ES3fh+GbeUb7NN2REuk99JNsbKvhL0P+9eq9TJXUKX4Lr+tYBcu+YIcyYZ0CAuv+R+qg ppBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kGoaA5SHPwgWPi9+suge3PwUejg+88B71hSP94ZzAts=; b=iqyuFZoSp4v9W6z+pzjZvonjw1HR9PcNT0JsRZ7Fl4//iMtAcQBMaOzUl7B1lzEQpF AxBPcyFeNpUi426j41Tbd7YtRAHVT4SlHnNTHMyreuxYJXBYUkI5a2oDL3hRMqg+DoTa Ye8Z9S0hi5Z2SbMNqKZS/fiEbGmcfhXJXPH9ZubONFEGJcRIdOXDHy+5IM3H4po4v9iU 0W78wjIQaCxJQquQL0ZysmVtC+5p8KO0aqluMMlmMu7SM9MivPIPV6eliy9woKAtP3Hw +CnXgdJ5ioyocp18M+N1x7/7OpXyTyOZoRScgwXATqTgrCz+5EB1apwlOGRHdFHGoJH4 gBUw== X-Gm-Message-State: ALoCoQlyqL78xsnw+lEh7MTvMUUNSXhi7P/tP/I3Swy4pr3UcDdp6hPxqKULc5IHhN+dz7s+W1L6PiooN1RoHY8qXBumTnSttiw8HKAvwHpzSa0Zc6/v2k299kuTirLak5I+wG7RGi5Z9BOFhHFGUUmIILKo0L0os2gpas4Hnf9CoBKOSn44mjyxLqiukb4eszjnd4EJk7iualicRErmYw2YCv5iLxn2Tg== X-Received: by 10.42.53.135 with SMTP id n7mr3196747icg.11.1393536390596; Thu, 27 Feb 2014 13:26:30 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x29si976855yha.0.2014.02.27.13.26.30 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Feb 2014 13:26:30 -0800 (PST) Received: from taipei.mtv.corp.google.com (taipei.mtv.corp.google.com [172.17.130.75]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 6A91031C25A; Thu, 27 Feb 2014 13:26:30 -0800 (PST) Received: by taipei.mtv.corp.google.com (Postfix, from userid 19823) id 0E780A0B17; Thu, 27 Feb 2014 13:26:29 -0800 (PST) From: "H.K. Jerry Chu" To: edumazet@google.com, ogerlitz@mellanox.com, davem@davemloft.net Cc: netdev@vger.kernel.org, Jerry Chu Subject: [PATCH] net-gre-gro: Fix a bug that breaks the forwarding path Date: Thu, 27 Feb 2014 13:26:17 -0800 Message-Id: <1393536377-32243-1-git-send-email-hkchu@google.com> X-Mailer: git-send-email 1.9.0.279.gdc9e3eb Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jerry Chu I stumbled across a bug that was introduced by my own GRE-GRO patch (bf5a755f5e9186406bbf50f4087100af5bd68e40 net-gre-gro: Add GRE support to the GRO stack) submitted a while back that breaks the forwarding path because various GSO related fields were not set. This will cause on the egress path either the GSO code to fail, or a GRE-TSO capable (NETIF_F_GSO_GRE) NICs to choke. The following fix has been tested for both cases. Signed-off-by: H.K. Jerry Chu --- net/core/dev.c | 2 ++ net/ipv4/af_inet.c | 3 +++ net/ipv4/gre_offload.c | 3 +++ net/ipv4/tcp_offload.c | 2 +- net/ipv6/tcpv6_offload.c | 2 +- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index b1b0c8d..75517d8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4045,6 +4045,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) skb->vlan_tci = 0; skb->dev = napi->dev; skb->skb_iif = 0; + skb->encapsulation = 0; + skb_shinfo(skb)->gso_type = 0; napi->skb = skb; } diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index ecd2c3f..68229ca 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1431,6 +1431,9 @@ static int inet_gro_complete(struct sk_buff *skb, int nhoff) int proto = iph->protocol; int err = -ENOSYS; + if (skb->encapsulation) + skb_set_inner_network_header(skb, nhoff); + csum_replace2(&iph->check, iph->tot_len, newlen); iph->tot_len = newlen; diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index f1d3228..2d24f29 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -255,6 +255,9 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff) int err = -ENOENT; __be16 type; + skb->encapsulation = 1; + skb_shinfo(skb)->gso_type = SKB_GSO_GRE; + type = greh->protocol; if (greh->flags & GRE_KEY) grehlen += GRE_HEADER_SECTION; diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index b92b817..c25953a 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -310,7 +310,7 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff) th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr, iph->daddr, 0); - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; + skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; return tcp_gro_complete(skb); } diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index 0d78132..3e8458a 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c @@ -73,7 +73,7 @@ static int tcp6_gro_complete(struct sk_buff *skb, int thoff) th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr, &iph->daddr, 0); - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; + skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6; return tcp_gro_complete(skb); }