From patchwork Thu Dec 11 07:14:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 419970 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 26FF81400E7 for ; Thu, 11 Dec 2014 18:15:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757191AbaLKHPJ (ORCPT ); Thu, 11 Dec 2014 02:15:09 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:38826 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753905AbaLKHPI (ORCPT ); Thu, 11 Dec 2014 02:15:08 -0500 Received: by mail-lb0-f180.google.com with SMTP id l4so3573444lbv.25 for ; Wed, 10 Dec 2014 23:15:06 -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=jq4KdZoGU6ctNdair7u8DellDurwXl7V4FjDVKz44gs=; b=QNZU5ZZkYPBWuQw7Ix7X9LQ7YbhrHNaip8N8Wnnk6T/fsODWt1B9DWQlTWu2id1hyV hxh3QgaLIK2ENB5jaiIeUPM591xeBuBzqQh2rNOV/lF/wHUp9W91YNVs/D0EhMNLVro1 Q82BE1s02q/JsX9de9een6CkL1gJ1Agci4xjETjrpx321Qt6OWOfsrj9hVjx2hz80I6Z eQU0lu36cevHN2KMj2fRckndTOSaqdDAud4r9YMBZTCBVH0fGbPF4QtCq07UcjIS4GVK daABO7ZzP6AN0xAQuaQQJXwkbUvcKATRDRzEVO0x9qJFvv1533uaOjPrcrFh6RizvG9B kfhg== X-Received: by 10.112.43.66 with SMTP id u2mr1650332lbl.35.1418282105989; Wed, 10 Dec 2014 23:15:05 -0800 (PST) Received: from vostro.util.wtbts.net ([83.145.235.199]) by mx.google.com with ESMTPSA id az15sm115114lab.30.2014.12.10.23.15.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Dec 2014 23:15:05 -0800 (PST) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: Linux Netdev List Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , Tom Herbert , Alexander Duyck Subject: [net] gre: fix the inner mac header in nbma gre tunnels xmit path Date: Thu, 11 Dec 2014 09:14:39 +0200 Message-Id: <1418282079-30245-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 2.2.0 In-Reply-To: References: 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 --- 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..6d2f84d 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(mac); } 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;