From patchwork Mon Dec 15 07:24:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 420986 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 4B1F81400DD for ; Mon, 15 Dec 2014 18:24:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbaLOHYr (ORCPT ); Mon, 15 Dec 2014 02:24:47 -0500 Received: from mail-la0-f51.google.com ([209.85.215.51]:34546 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbaLOHYq (ORCPT ); Mon, 15 Dec 2014 02:24:46 -0500 Received: by mail-la0-f51.google.com with SMTP id ms9so8879289lab.38 for ; Sun, 14 Dec 2014 23:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=B3XUbczmZVlb1BUmHMqhTnCQgSq4n9/6qD5JuSuMH20=; b=ovmaH+3hFINlhTaMgctiq+wwV8sCyACpLWtvug5phpiS/qkQBYYYOfTEmoNXIgNIIh rPasqlVAf5ViJV5R5shkba9JToJen/OUxD9INMsl7+XQP2howb3+FdaD33/CKmCWR3lT gndYJOktmas0p8fDAzxB+oahLSCslY94+SDBtg5A1I0i5UCcHVA1ahQdWPSsxTu7YDhq OdjLAP9PePtn4xHSvcGpfjnR12y57kdL+pxPo6Ms1JXOAeuk8+obKSVSr66PgIOsYcVm b9Dj6CRUinVV9B1WBCLBZbJgaXvrQgqUho/SDidPmFG3zD8V/b87j/rxHcOAD4223TZN iJpA== X-Received: by 10.152.87.142 with SMTP id ay14mr6692913lab.45.1418628285162; Sun, 14 Dec 2014 23:24:45 -0800 (PST) Received: from vostro.util.wtbts.net ([83.145.235.199]) by mx.google.com with ESMTPSA id r6sm2472751laa.31.2014.12.14.23.24.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Dec 2014 23:24:44 -0800 (PST) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: David Miller , netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , Tom Herbert , Alexander Duyck Subject: [PATCH net, v2] gre: fix the inner mac header in nbma tunnel xmit path Date: Mon, 15 Dec 2014 09:24:13 +0200 Message-Id: <1418628253-4950-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 2.2.0 In-Reply-To: <20141211.150706.1736198745550279282.davem@davemloft.net> References: <20141211.150706.1736198745550279282.davem@davemloft.net> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The NBMA GRE tunnels temporarily push GRE header that contain the per-packet NBMA destination on the skb via header ops early in xmit path. It is the later pulled before the real GRE header is constructed. The inner mac was thus set differently in nbma case: the GRE header has been pushed by neighbor layer, and mac header points to beginning of the temporary gre header (set by dev_queue_xmit). Now that the offloads expect mac header to point to the gre payload, fix the xmit patch to: - pull first the temporary gre header away - and reset mac header to point to gre payload This fixes tso to work again with nbma tunnels. Fixes: 14051f0452a2 ("gre: Use inner mac length when computing tunnel length") Signed-off-by: Timo Teräs Cc: Tom Herbert Cc: Alexander Duyck --- Fixed the stupid typo of skb_reset_mac_header()'s argument. And yes, I did recompile, retest and verify that this works. Comments from v1 apply: Though, normally mac header does point to the begging of the hardware header. E.g. in ethernet case it's pointing to the ethernet header. But now in gre case it's instead pointing to the payload which seems counter-intuitive to me. But I guess tunnels are a bit of special case, and there's valid reasons to have it point to tunnel payload too. Applying this patch on top of the Tom's previous fix of 14051f0452a2 seems to now make my dmvpn scenario work again. So this should go to -stable too (atleast 3.14). net/ipv4/ip_gre.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 94213c8..b40b90d 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -250,10 +250,6 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, struct ip_tunnel *tunnel = netdev_priv(dev); const struct iphdr *tnl_params; - skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM)); - if (IS_ERR(skb)) - goto out; - if (dev->header_ops) { /* Need space for new headers */ if (skb_cow_head(skb, dev->needed_headroom - @@ -266,6 +262,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, * to gre header. */ skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); + skb_reset_mac_header(skb); } else { if (skb_cow_head(skb, dev->needed_headroom)) goto free_skb; @@ -273,6 +270,10 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, tnl_params = &tunnel->parms.iph; } + skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM)); + if (IS_ERR(skb)) + goto out; + __gre_xmit(skb, dev, tnl_params, skb->protocol); return NETDEV_TX_OK;