From patchwork Thu Jun 16 19:23:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 636663 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 3rVtb04Y09z9t0w for ; Fri, 17 Jun 2016 05:23:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mirantis.com header.i=@mirantis.com header.b=cr3MN/rV; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754643AbcFPTXV (ORCPT ); Thu, 16 Jun 2016 15:23:21 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:33104 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754349AbcFPTXU (ORCPT ); Thu, 16 Jun 2016 15:23:20 -0400 Received: by mail-pf0-f170.google.com with SMTP id i123so18938615pfg.0 for ; Thu, 16 Jun 2016 12:23:20 -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=61o6/8d4R6CWT+26Y5S/ME5MbIvLL2HrsLEfxx8Vlcg=; b=cr3MN/rVAS03IecKCc25dKwDijZg0c36aTKXV/7LwzHXYQUmOq3tTyob5ZJzf1PJTh 0X4Sji03RWLvApGW9Www76IZqWz23ywUk7OiqLHPpW8mE49/8Rwll4D1leN2YuZB9idf yaJq3ALPtxe6w0y63FrsOsBD77CTDhnv2eFpg= 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=61o6/8d4R6CWT+26Y5S/ME5MbIvLL2HrsLEfxx8Vlcg=; b=b/0owetXjQRtSFspKajiFB64JqvKDSbNsUHLwnx8Jl2bllZbaIX7FO+OzHGq87Z5I1 OJXEzg7ZpNPY1Kr8tyjarkZxGr7skanA2Cg6OoXBufB9SGdbzm4x0R5TME6I6xQdZMpc V/MQN2NwRuItLgjXAdWSJQbncb4RHbRCQsZz2fz9AHb5iAyyl4GfXn3nigR7B4b2RZnn ELNhTbD9XN/bw1sEqQO4gK3UbnM+v6GkOy4AJ1I/gD/MddiVV7CLQpL/E4UNAvXkaTQp MXCWHVoBzucrhyyDr0gqLUwWFLsQeK+w7Y4Z6AiyPmIm8hyIyNY/zrBhTs+uPixzH930 WJHQ== X-Gm-Message-State: ALyK8tKNKIofP0Ke5Drs3pQwskk6Y4Fv39j+yLBD6ygfC5D/ImSg7fB+jlqZ4/OrW1EVG9vU X-Received: by 10.98.80.79 with SMTP id e76mr7067801pfb.67.1466105000137; Thu, 16 Jun 2016 12:23:20 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id w194sm53979178pfd.58.2016.06.16.12.23.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jun 2016 12:23:19 -0700 (PDT) Subject: [net-next PATCH v3 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: Thu, 16 Jun 2016 12:23:19 -0700 Message-ID: <20160616192318.20872.40266.stgit@localhost.localdomain> In-Reply-To: <20160616191851.20872.67154.stgit@localhost.localdomain> References: <20160616191851.20872.67154.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 Acked-by: Hannes Frederic Sowa --- drivers/net/vxlan.c | 6 ++++++ include/net/udp_tunnel.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 31aeec967175..abb9cd2df9e9 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -998,6 +998,8 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs) spin_lock(&vn->sock_lock); hlist_del_rcu(&vs->hlist); udp_tunnel_notify_del_rx_port(vs->sock, + (vs->flags & VXLAN_F_GPE) ? + UDP_TUNNEL_TYPE_VXLAN_GPE : UDP_TUNNEL_TYPE_VXLAN); spin_unlock(&vn->sock_lock); @@ -2488,6 +2490,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); @@ -2691,6 +2695,8 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6, spin_lock(&vn->sock_lock); hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); udp_tunnel_notify_add_rx_port(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 {