From patchwork Sun Jul 13 14:46:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Chu X-Patchwork-Id: 369413 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 BB8E21400B2 for ; Mon, 14 Jul 2014 00:46:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753571AbaGMOq1 (ORCPT ); Sun, 13 Jul 2014 10:46:27 -0400 Received: from mail-qc0-f202.google.com ([209.85.216.202]:57889 "EHLO mail-qc0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751493AbaGMOqZ (ORCPT ); Sun, 13 Jul 2014 10:46:25 -0400 Received: by mail-qc0-f202.google.com with SMTP id x13so527840qcv.5 for ; Sun, 13 Jul 2014 07:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5bHyvCAmO/ZPaNgJOM4bRdETqcTyM5NmqzaEj1HzPNs=; b=XDRHNi/5qDwKwnSb8mnU/P9b8dRBCCSxXsWV78cVSLgV7pU96r1SrxuOdAH4pjjOYf +86BwiupAD5r0CAM51Azk9hrxHjZ2U5e56EW3mXDl+wCCpng5YZD534EYJkW2nM4Kp8p 3nYGcrJppApUOFwQv2YMiIuid8D/zt5z+IX60TfqltVWov1DbEmGAn+gU8q1kj86xPMI O1KIEPA5Uz9Gqwx4J0jSpd10I1umvKFi4msfu31LxcMh4Avi5kO1wIag0W/iJxSIrLDA Un27PHDWgqTIwZq6c96/U/wKq58XBg/w0ITOR/MSuVPuBYpSeHKNdLrbcwDj/ZZxVAyO 2kkg== 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=5bHyvCAmO/ZPaNgJOM4bRdETqcTyM5NmqzaEj1HzPNs=; b=EWy3uSaTd4ZSua74bg11NCEPSbc2TPVpxeFJL3sYRf38j5KVmP2zuW2qOURSM+YvwV 7Wr2gwsAFzKEuoFM5Iuk33j5zFjJkUEj1HNC8a2cdFsIzciFvzgF6f+oEAhh5TKtf++M 1XjgvEVOLcGn103839GNEvzkQEzESv/6tzFXkLvrrGb62H6PPjucOJ7f50HDz3g3tWwu MW4I/vI/FlAv0JuVZRJqCR9eATckOcgIpfghdhfOqf/ReBDTjc2SmYEHfH5KGhoJvSrG IVOgwzNSO5Ylr92nCGsxOi3J86HjmAM1PYL655EcdENbzrpY8z677e6tUXsIdR7JQu41 Q8ug== X-Gm-Message-State: ALoCoQlC14YW46SGtjC8GUN6+WD71ne6cEr7v86L9TIrBBLtD4LVsH8VnG481AfMoIDMBgM6jFoT X-Received: by 10.58.99.38 with SMTP id en6mr5370369veb.19.1405262784731; Sun, 13 Jul 2014 07:46:24 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id v44si459753yhv.0.2014.07.13.07.46.24 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 Jul 2014 07:46:24 -0700 (PDT) Received: from taipei.mtv.corp.google.com (taipei.mtv.corp.google.com [172.17.130.75]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 897955A4278; Sun, 13 Jul 2014 07:46:24 -0700 (PDT) Received: by taipei.mtv.corp.google.com (Postfix, from userid 19823) id 14052A0EE2; Sun, 13 Jul 2014 07:46:23 -0700 (PDT) From: "H.K. Jerry Chu" To: edumazet@google.com, ogerlitz@mellanox.com, linux@stwm.de Cc: davem@davemloft.net, netdev@vger.kernel.org, Jerry Chu Subject: [PATCH net-next] net-gre-gro: Fix a bug that breaks the forwarding path Date: Sun, 13 Jul 2014 07:46:20 -0700 Message-Id: <1405262780-20232-1-git-send-email-hkchu@google.com> X-Mailer: git-send-email 2.0.0.526.g5318336 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jerry Chu Fixed a bug that was introduced by my GRE-GRO patch (bf5a755f5e9186406bbf50f4087100af5bd68e40 net-gre-gro: Add GRE support to the GRO stack) that breaks the forwarding path because various GSO related fields were not set. The bug 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 6e2a2cd..d603c14 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4089,6 +4089,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; skb->truesize = SKB_TRUESIZE(skb_end_offset(skb)); napi->skb = skb; diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index d5e6836..d156b3c 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1429,6 +1429,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 eb92deb..f0bdd47 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -263,6 +263,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 4e86c59..55046ec 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -309,7 +309,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 8517d3c..01b0ff9 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); }