net/mlx5: Support querying max VFs from device
For ECPF with eswitch manager privilege, query the host max VF count by querying the device using query_functions command. With this enhancement: 1. flow steering entries are created only for valid vports based on the max VF count of the PF. 2. Driver only queries cap of valid vport. Eswitch requires the max VFs when doing initialization, so do sr-iov init before eswitch init. Signed-off-by: Bodong Wang <bodong@mellanox.com> Reviewed-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:

committed by
Saeed Mahameed

parent
10ee82cedb
commit
86eec50bea
@@ -470,6 +470,7 @@ struct mlx5_core_sriov {
|
||||
struct mlx5_vf_context *vfs_ctx;
|
||||
int num_vfs;
|
||||
int enabled_vfs;
|
||||
u16 max_vfs;
|
||||
};
|
||||
|
||||
struct mlx5_fc_stats {
|
||||
@@ -1103,13 +1104,9 @@ static inline bool mlx5_ecpf_vport_exists(struct mlx5_core_dev *dev)
|
||||
return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists);
|
||||
}
|
||||
|
||||
#define MLX5_HOST_PF_MAX_VFS (127u)
|
||||
static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev)
|
||||
{
|
||||
if (mlx5_core_is_ecpf_esw_manager(dev))
|
||||
return MLX5_HOST_PF_MAX_VFS;
|
||||
else
|
||||
return pci_sriov_get_totalvfs(dev->pdev);
|
||||
return dev->priv.sriov.max_vfs;
|
||||
}
|
||||
|
||||
static inline int mlx5_get_gid_table_len(u16 param)
|
||||
|
@@ -9711,7 +9711,7 @@ struct mlx5_ifc_host_params_context_bits {
|
||||
u8 reserved_at_8[0x8];
|
||||
u8 host_num_of_vfs[0x10];
|
||||
|
||||
u8 reserved_at_20[0x10];
|
||||
u8 host_total_vfs[0x10];
|
||||
u8 host_pci_bus[0x10];
|
||||
|
||||
u8 reserved_at_40[0x10];
|
||||
|
Reference in New Issue
Block a user