diff options
author | Parav Pandit <parav@mellanox.com> | 2019-05-15 00:04:27 -0500 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2019-07-03 12:50:42 -0700 |
commit | 2752b823169b216db142c4466b43269281962dcf (patch) | |
tree | 6c01796b4436773d85fec714f879cc301a66bb79 /include | |
parent | e4075c44287638b9a99430fea79a2d1468fbc27d (diff) | |
download | linux-2752b823169b216db142c4466b43269281962dcf.tar.bz2 |
net/mlx5: Introduce and use mlx5_eswitch_get_total_vports()
Instead MLX5_TOTAL_VPORTS, use mlx5_eswitch_get_total_vports().
mlx5_eswitch_get_total_vports() in subsequent patch accounts for SF
vports as well.
Expanding MLX5_TOTAL_VPORTS macro would require exposing SF internals to
more generic vport.h header file. Such exposure is not desired.
Hence a mlx5_eswitch_get_total_vports() is introduced.
Given that mlx5_eswitch_get_total_vports() API wants to work on const
mlx5_core_dev*, change its helper functions also to accept const *dev.
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mlx5/driver.h | 9 | ||||
-rw-r--r-- | include/linux/mlx5/eswitch.h | 3 | ||||
-rw-r--r-- | include/linux/mlx5/vport.h | 3 |
3 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 24b02ab206c3..031043341ed5 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -1085,7 +1085,7 @@ enum { MLX5_PCI_DEV_IS_VF = 1 << 0, }; -static inline bool mlx5_core_is_pf(struct mlx5_core_dev *dev) +static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev) { return dev->coredev_type == MLX5_COREDEV_PF; } @@ -1095,17 +1095,18 @@ static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) return dev->caps.embedded_cpu; } -static inline bool mlx5_core_is_ecpf_esw_manager(struct mlx5_core_dev *dev) +static inline bool +mlx5_core_is_ecpf_esw_manager(const struct mlx5_core_dev *dev) { return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager); } -static inline bool mlx5_ecpf_vport_exists(struct mlx5_core_dev *dev) +static inline bool mlx5_ecpf_vport_exists(const struct mlx5_core_dev *dev) { return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists); } -static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev) +static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev) { return dev->priv.sriov.max_vfs; } diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h index d4731199edb4..61db37aa9642 100644 --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h @@ -66,6 +66,8 @@ struct mlx5_flow_handle * mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn); +u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev); + #ifdef CONFIG_MLX5_ESWITCH enum devlink_eswitch_encap_mode mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev); @@ -93,4 +95,5 @@ mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw, return 0; }; #endif /* CONFIG_MLX5_ESWITCH */ + #endif diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 6cbf29229749..16060fb9b5e5 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h @@ -44,9 +44,6 @@ MLX5_VPORT_UPLINK_PLACEHOLDER + \ MLX5_VPORT_ECPF_PLACEHOLDER(mdev)) -#define MLX5_TOTAL_VPORTS(mdev) (MLX5_SPECIAL_VPORTS(mdev) + \ - mlx5_core_max_vfs(mdev)) - #define MLX5_VPORT_MANAGER(mdev) \ (MLX5_CAP_GEN(mdev, vport_group_manager) && \ (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \ |