summaryrefslogtreecommitdiffstats
path: root/include/linux/mlx5
diff options
context:
space:
mode:
authorMark Bloch <mbloch@nvidia.com>2023-12-06 16:01:37 +0200
committerLeon Romanovsky <leon@kernel.org>2023-12-12 09:04:04 +0200
commiteb524d0fd46249b0b9e5d52372dc65d8b32430c3 (patch)
tree9066b7194e26948c3b7a0f78d60674112349daa5 /include/linux/mlx5
parentabf8e8f29a3cb6d9c0f599d335f9ad3dcf2dcf11 (diff)
downloadlinux-stable-eb524d0fd46249b0b9e5d52372dc65d8b32430c3.tar.gz
linux-stable-eb524d0fd46249b0b9e5d52372dc65d8b32430c3.tar.bz2
linux-stable-eb524d0fd46249b0b9e5d52372dc65d8b32430c3.zip
net/mlx5: E-Switch, expose eswitch manager vport
Expose the ability the query the eswitch manager vport number. Next patch will utilize this capability to reveal the correct register C0 value to the users. Signed-off-by: Mark Bloch <mbloch@nvidia.com> Link: https://lore.kernel.org/r/614fb0e216250e2ce3340471ec141b83ec45c7f4.1701871118.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'include/linux/mlx5')
-rw-r--r--include/linux/mlx5/eswitch.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h
index 950d2431a53c..df73a2ccc9af 100644
--- a/include/linux/mlx5/eswitch.h
+++ b/include/linux/mlx5/eswitch.h
@@ -7,6 +7,7 @@
#define _MLX5_ESWITCH_
#include <linux/mlx5/driver.h>
+#include <linux/mlx5/vport.h>
#include <net/devlink.h>
#define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager)
@@ -210,4 +211,11 @@ static inline bool is_mdev_switchdev_mode(struct mlx5_core_dev *dev)
return mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS;
}
+/* The returned number is valid only when the dev is eswitch manager. */
+static inline u16 mlx5_eswitch_manager_vport(struct mlx5_core_dev *dev)
+{
+ return mlx5_core_is_ecpf_esw_manager(dev) ?
+ MLX5_VPORT_ECPF : MLX5_VPORT_PF;
+}
+
#endif