From patchwork Wed Jun 15 22:09:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 636128 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 3rVLJk3ktfz9t1f for ; Thu, 16 Jun 2016 08:09:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mirantis.com header.i=@mirantis.com header.b=c4vvYy8Q; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932842AbcFOWJI (ORCPT ); Wed, 15 Jun 2016 18:09:08 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34597 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753105AbcFOWJG (ORCPT ); Wed, 15 Jun 2016 18:09:06 -0400 Received: by mail-pf0-f182.google.com with SMTP id 62so12756320pfd.1 for ; Wed, 15 Jun 2016 15:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com; s=google; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=m/zXQLd44A0ionpb01MI22SgTxQSORFLcBV2E46BnZI=; b=c4vvYy8QKYtF8l7/EsAfz3gveHKHORP1yDwp43EURIlDd4sk9KVzARVR/jVHrkKZ8U M9j7l1XgpUl8v9nG/2ZxvmslnyIgk3TZgJaK75PAfcEG2MV/DyPmXN1xT15ghdgt5iHM 9GLIfFiSrg9V4fhGOZN5ceRIPFcfmpzX4/Xts= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=m/zXQLd44A0ionpb01MI22SgTxQSORFLcBV2E46BnZI=; b=QJu+1d2nW30WWZmd9SceG2+U2I0AlohZTZAZjjH8BMZ3LlVgWGE851KyXrHpxFJwXo hU/Vf0zu3+u/nfDyS6//QNrkM8h+x0Z7rgM07DBxj3hwp89Mh2T/w5+nlUb/M1SrilJF ScErIhx+30P2BIe7Fbb3hCkWLaU3C8hh2Ma3FsDSQ9LOqjI12eplLCQh3R+vRSbuW9DJ ZnI8P1VirlN3Gn4h79QAeLvzPZ/1Lt7dI1oBOIYZzQdFm8teMX2AX0rYbMQfd++zZZ6Q GlnROUlKy0T7020P5iuoTdDFtCDrKlHzsS1x2vcDFnBQe6RDHLBfKyrGp6huU3dr6jZD TVYg== X-Gm-Message-State: ALyK8tK2PgCWeZqURZEsnAiA4g/oPVI5uUjB4PDxbCCwYEMxK3o2/25Oi1lZPhkL2BUn/o5c X-Received: by 10.98.55.1 with SMTP id e1mr1047879pfa.107.1466028545682; Wed, 15 Jun 2016 15:09:05 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id 189sm55348846pfd.18.2016.06.15.15.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jun 2016 15:09:05 -0700 (PDT) Subject: [net-next PATCH v2 17/17] vxlan: Add new UDP encapsulation offload type for VXLAN-GPE From: Alexander Duyck To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: hannes@redhat.com, jesse@kernel.org, eugenia@mellanox.com, jbenc@redhat.com, alexander.duyck@gmail.com, saeedm@mellanox.com, ariel.elior@qlogic.com, tom@herbertland.com, michael.chan@broadcom.com, Dept-GELinuxNICDev@qlogic.com, davem@davemloft.net Date: Wed, 15 Jun 2016 15:09:04 -0700 Message-ID: <20160615220904.15575.77650.stgit@localhost.localdomain> In-Reply-To: <20160615220449.15575.17031.stgit@localhost.localdomain> References: <20160615220449.15575.17031.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The fact is VXLAN with Generic Protocol Extensions cannot be supported by the same hardware parsers that support VXLAN. The protocol extensions allow for things like a Next Protocol field which in turn allows for things other than Ethernet to be passed over the tunnel. Most existing parsers will not know how to interpret this. To resolve this I am giving VXLAN-GPE its own UDP encapsulation offload type. This way hardware that does support GPE can simply add this type to the switch statement for VXLAN, and if they don't support it then this will fix any issues where headers might be interpreted incorrectly. Signed-off-by: Alexander Duyck --- drivers/net/vxlan.c | 12 ++++++++++-- include/net/udp_tunnel.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 888356bc1233..ff1b47c9c03d 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -605,13 +605,19 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff) /* Notify netdevs that UDP port started listening */ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs) { - udp_tunnel_notify_add_rx_port(vs->sock, UDP_TUNNEL_TYPE_VXLAN); + udp_tunnel_notify_add_rx_port(vs->sock, + (vs->flags & VXLAN_F_GPE) ? + UDP_TUNNEL_TYPE_VXLAN_GPE : + UDP_TUNNEL_TYPE_VXLAN); } /* Notify netdevs that UDP port is no more listening */ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs) { - udp_tunnel_notify_del_rx_port(vs->sock, UDP_TUNNEL_TYPE_VXLAN); + udp_tunnel_notify_del_rx_port(vs->sock, + (vs->flags & VXLAN_F_GPE) ? + UDP_TUNNEL_TYPE_VXLAN_GPE : + UDP_TUNNEL_TYPE_VXLAN); } /* Add new entry to forwarding table -- assumes lock held */ @@ -2499,6 +2505,8 @@ static void vxlan_push_rx_ports(struct net_device *dev) for (i = 0; i < PORT_HASH_SIZE; ++i) { hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) udp_tunnel_push_rx_port(dev, vs->sock, + (vs->flags & VXLAN_F_GPE) ? + UDP_TUNNEL_TYPE_VXLAN_GPE : UDP_TUNNEL_TYPE_VXLAN); } spin_unlock(&vn->sock_lock); diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index 1c9408a04213..02c5be037451 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -103,6 +103,7 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock, enum udp_parsable_tunnel_type { UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */ UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */ + UDP_TUNNEL_TYPE_VXLAN_GPE, /* draft-ietf-nvo3-vxlan-gpe */ }; struct udp_tunnel_info {