From patchwork Fri Feb 26 21:13:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8441851 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E9D169F2F0 for ; Fri, 26 Feb 2016 21:14:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07271203AD for ; Fri, 26 Feb 2016 21:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1E23203B6 for ; Fri, 26 Feb 2016 21:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbcBZVOO (ORCPT ); Fri, 26 Feb 2016 16:14:14 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:63452 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbcBZVON (ORCPT ); Fri, 26 Feb 2016 16:14:13 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0LlItW-1a1je62MPm-00b0db; Fri, 26 Feb 2016 22:13:40 +0100 From: Arnd Bergmann To: Matan Barak , Leon Romanovsky , Saeed Mahameed Cc: linux-arm-kernel@lists.infradead.org, "David S . Miller" , Arnd Bergmann , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net/mlx5e: make VXLAN support conditional Date: Fri, 26 Feb 2016 22:13:31 +0100 Message-Id: <1456521217-2174580-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:ndRwKInuQYe7SfAvi9RDml7uwvUsi/f6IMmbh/Eq7oKkZYUVbfd zHYhlDU3b+5724o+53I+xGP1OovszZzosuLth/BvtW/W6R2AACukqHA1gYzxWDFTk3fbdHw 9iSzjas3Hw8gS6bgUF/k3u3lJGb0zcm3TnFAovut0BMQsNA//LhjWTKxyIpnqP0X2NRLPcC sYk+9SEEbvF394BOMOdGw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Uj8JLtl1YzU=:ho/atANrH5YZhaMIz28Hpu q6JriZhRFDIG5SPAalCHkyEDZj2MjuzhFCLuzXA3q8dG/hdiYIcaejybwcm6/Y8nAFngrqgYu +ofKprh4U4U2S9EPiUb53tV6EitTl8KSCsJn/r20f9ppTC86sRRBNcAOyGxLXin2sI1Po8rcl /wyMaK6ZzgZyL6JZdktIervA7glMvzV74+L63rv9+RTgwhr938opV7oMhxB2UF5YKjuYkpmYF VgpDo/Y9bIR4z3qBDmwgiOtpu3+uqW7IjE3kdD6WHi8tWW+0EAawImtDUuOKud0oZAii5fLTc hIG5sVhPDGHZE7237Q087zViu649xr7A29alS8a3DtO1YmouWuPTP5fIp1vZhuKf62TN38pge Mdb8bzqeT1DKxJcIwbdOEXqSHAtjHHaz7bF8wKIcDULOR9DidrfMmENDc7TciIqr9/1Zr+da7 EMuYXLnOs/A+2whsPPlqN5Qcu9uEV8rlrAF5aNagGRfD99ou8rzD7MIm5S545UX6/iEFxK6cV AzYYSVxFa5CY/sWQYRDWJcvkA7AmMWZDLAQoakN79+Zwn/8gKd6f9RRiYIKbzD0/fitsijmGo 7qPbGcbB8Uw+SjywX4MouIX5skAwNi7Ofz7WDwIV4H785U1+H4AsSQ83quedg8E4ucktB+F9l ng6K/3ge0v41XEBRXfzSvkkXodl+8N+11O+t+3Frp8o6PSQW2c5/FWFsCw/yvoFwJ/Bs= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP VXLAN can be disabled at compile-time or it can be a loadable module while mlx5 is built-in, which leads to a link error: drivers/net/built-in.o: In function `mlx5e_create_netdev': ntb_netdev.c:(.text+0x106de4): undefined reference to `vxlan_get_rx_port' This avoids the link error and makes the vxlan code optional, like the other ethernet drivers do as well. Signed-off-by: Arnd Bergmann Fixes: b3f63c3d5e2c ("net/mlx5e: Add netdev support for VXLAN tunneling") --- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 7 +++++++ drivers/net/ethernet/mellanox/mlx5/core/Makefile | 4 +++- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | 11 +++++++++-- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index 1cf722eba607..f5c3b9465d8d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig @@ -31,3 +31,10 @@ config MLX5_CORE_EN_DCB This flag is depended on the kernel's DCB support. If unsure, set to Y + +config MLX5_CORE_EN_VXLAN + bool "VXLAN offloads Support" + default y + depends on MLX5_CORE_EN && VXLAN && !(MLX5_CORE=y && VXLAN=m) + ---help--- + Say Y here if you want to use VXLAN offloads in the driver. diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile index 11b592dbf16a..3ecef5f74ccf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile @@ -6,6 +6,8 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \ mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \ en_main.o en_fs.o en_ethtool.o en_tx.o en_rx.o \ - en_txrx.o en_clock.o vxlan.o + en_txrx.o en_clock.o + +mlx5_core-$(CONFIG_MLX5_CORE_EN_VXLAN) += vxlan.o mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 1dca3dcf90f5..18040da1c3a5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -552,7 +552,9 @@ struct mlx5e_priv { struct mlx5e_flow_tables fts; struct mlx5e_eth_addr_db eth_addr; struct mlx5e_vlan_db vlan; +#ifdef CONFIG_MLX5_CORE_EN_VXLAN struct mlx5e_vxlan_db vxlan; +#endif struct mlx5e_params params; spinlock_t async_events_spinlock; /* sync hw events */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 0d45f35aee72..44fc4bc35ffd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2116,6 +2116,9 @@ static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv, u16 proto; u16 port = 0; + if (!IS_ENABLED(CONFIG_MLX5_CORE_EN_VXLAN)) + goto out; + switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): proto = ip_hdr(skb)->protocol; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h index a01685056ab1..8c57861e0f8a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h @@ -41,14 +41,21 @@ struct mlx5e_vxlan { static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev) { - return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) && + return IS_ENABLED(CONFIG_MLX5_CORE_EN_VXLAN) && + (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) && mlx5_core_is_pf(mdev)); } +#ifdef CONFIG_MLX5_CORE_EN_VXLAN void mlx5e_vxlan_init(struct mlx5e_priv *priv); +void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv); +#else +static inline void mlx5e_vxlan_init(struct mlx5e_priv *priv) {} +static inline void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv) {} +#endif + int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port); void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port); struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port); -void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv); #endif /* __MLX5_VXLAN_H__ */