Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/mlx5: Enable devlink port for embedded cpu VF vports

Enable creation of a devlink port for EC VF vports.

Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: William Tu <witu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

authored by

Daniel Jurgens and committed by
Saeed Mahameed
dc131808 93b36d0f

+33 -1
+20
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 343 343 bool mlx5_vnet_supported(struct mlx5_core_dev *dev); 344 344 bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev); 345 345 346 + static inline u16 mlx5_core_ec_vf_vport_base(const struct mlx5_core_dev *dev) 347 + { 348 + return MLX5_CAP_GEN_2(dev, ec_vf_vport_base); 349 + } 350 + 351 + static inline u16 mlx5_core_ec_sriov_enabled(const struct mlx5_core_dev *dev) 352 + { 353 + return mlx5_core_is_ecpf(dev) && mlx5_core_ec_vf_vport_base(dev); 354 + } 355 + 356 + static inline bool mlx5_core_is_ec_vf_vport(const struct mlx5_core_dev *dev, u16 vport_num) 357 + { 358 + int base_vport = mlx5_core_ec_vf_vport_base(dev); 359 + int max_vport = base_vport + mlx5_core_max_ec_vfs(dev); 360 + 361 + if (!mlx5_core_ec_sriov_enabled(dev)) 362 + return false; 363 + 364 + return (vport_num >= base_vport && vport_num < max_vport); 365 + } 346 366 #endif /* __MLX5_CORE_H__ */
+6
include/linux/mlx5/driver.h
··· 474 474 struct mlx5_vf_context *vfs_ctx; 475 475 int num_vfs; 476 476 u16 max_vfs; 477 + u16 max_ec_vfs; 477 478 }; 478 479 479 480 struct mlx5_fc_pool { ··· 1243 1242 static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev) 1244 1243 { 1245 1244 return dev->priv.sriov.max_vfs; 1245 + } 1246 + 1247 + static inline u16 mlx5_core_max_ec_vfs(const struct mlx5_core_dev *dev) 1248 + { 1249 + return dev->priv.sriov.max_ec_vfs; 1246 1250 } 1247 1251 1248 1252 static inline int mlx5_get_gid_table_len(u16 param)