From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A195DC28EB7 for ; Thu, 6 Jun 2019 11:06:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7636A20868 for ; Thu, 6 Jun 2019 11:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559819186; bh=MggCww4Nr90s9KcsmgOFeKOEH5YQAz9EHIrC4YOrP80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dq+kVEOTtLJ062kNcBSRibnAC5gb/LwO0Wcpb74Q+Ykp+oUiAO8PjjLC7oDR4DUlv 8OQQtBPs1YivT6qLt9ns41SJrR6OJwBArfUEKKyRSn37+DQmYV3m5E4BcwsA4/zBEa TDQN/3y9yUlByOxaGQvWpI5Zc5CIdNdpEv1wGFbo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbfFFLGZ (ORCPT ); Thu, 6 Jun 2019 07:06:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:57312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbfFFLGZ (ORCPT ); Thu, 6 Jun 2019 07:06:25 -0400 Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3917206E0; Thu, 6 Jun 2019 11:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559819184; bh=MggCww4Nr90s9KcsmgOFeKOEH5YQAz9EHIrC4YOrP80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlNFXI2JRGUyWmQUEMMPi1uhTKv1TNV0DV2sLfdorrtsLoRq5pzk/9jCDZSMfqZiw 84bT0rsLr2Wie/BqzyKk4PatLboohWu6SXQUc3O72yvRHkT/gd6P5/Ci6RpYPdEy70 9qS8nod7xCP0NL9K+XNxMmQuFSarkZo+l2g/ssL8= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , RDMA mailing list , Maor Gottlieb , Mark Bloch , Saeed Mahameed , linux-netdev Subject: [PATCH mlx5-next 1/3] net/mlx5: Expose eswitch encap mode Date: Thu, 6 Jun 2019 14:06:07 +0300 Message-Id: <20190606110609.11588-2-leon@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190606110609.11588-1-leon@kernel.org> References: <20190606110609.11588-1-leon@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Gottlieb Add API to get the current Eswitch encap mode. It will be used in downstream patches to check if flow table can be created with encap support or not. Signed-off-by: Maor Gottlieb Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 10 ++++++++++ include/linux/mlx5/eswitch.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 9ea0ccfe5ef5..1da7f9569ee8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -2452,6 +2452,16 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw) } EXPORT_SYMBOL_GPL(mlx5_eswitch_mode); +u16 mlx5_eswitch_get_encap_mode(struct mlx5_core_dev *dev) +{ + struct mlx5_eswitch *esw; + + esw = dev->priv.eswitch; + return ESW_ALLOWED(esw) ? esw->offloads.encap : + DEVLINK_ESWITCH_ENCAP_MODE_NONE; +} +EXPORT_SYMBOL(mlx5_eswitch_get_encap_mode); + bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { if ((dev0->priv.eswitch->mode == SRIOV_NONE && diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h index 0ca77dd1429c..7be43c0fcdc5 100644 --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h @@ -7,6 +7,7 @@ #define _MLX5_ESWITCH_ #include +#include #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager) @@ -60,4 +61,13 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw); struct mlx5_flow_handle * mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn); + +#ifdef CONFIG_MLX5_ESWITCH +u16 mlx5_eswitch_get_encap_mode(struct mlx5_core_dev *dev); +#else /* CONFIG_MLX5_ESWITCH */ +static inline u16 mlx5_eswitch_get_encap_mode(struct mlx5_core_dev *dev) +{ + return DEVLINK_ESWITCH_ENCAP_MODE_NONE; +} +#endif /* CONFIG_MLX5_ESWITCH */ #endif -- 2.20.1