aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
diff options
context:
space:
mode:
authorParav Pandit <parav@nvidia.com>2021-02-26 14:36:22 +0200
committerSaeed Mahameed <saeedm@nvidia.com>2021-04-14 11:02:38 -0700
commitb16f2bb6b6ca926e303273913288461091ba8cd8 (patch)
treeef255be35f4a5daba2acdb86de7b729d608cd1e7 /drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
parentnet/mlx5: E-Switch Make cleanup sequence mirror of init (diff)
downloadlinux-dev-b16f2bb6b6ca926e303273913288461091ba8cd8.tar.xz
linux-dev-b16f2bb6b6ca926e303273913288461091ba8cd8.zip
net/mlx5: E-Switch, Convert a macro to a helper routine
Convert ESW_ALLOWED macro to a helper routine so that it can be used in other eswitch files. Signed-off-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/eswitch.h')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index a4b9f78bf4d6..a61a33c36fa8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -521,6 +521,11 @@ const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev);
#define esw_debug(dev, format, ...) \
mlx5_core_dbg_mask(dev, MLX5_DEBUG_ESWITCH_MASK, format, ##__VA_ARGS__)
+static inline bool mlx5_esw_allowed(const struct mlx5_eswitch *esw)
+{
+ return esw && MLX5_ESWITCH_MANAGER(esw->dev);
+}
+
/* The returned number is valid only when the dev is eswitch manager. */
static inline u16 mlx5_eswitch_manager_vport(struct mlx5_core_dev *dev)
{