mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
net/mlx5: Remove redundant max_sfs check and field from struct mlx5_sf_dev_table
table->max_sfs is initialized in mlx5_sf_dev_table_create() and only used to check for 0 in mlx5_sf_dev_add(). mlx5_sf_dev_add() is called either from mlx5_sf_dev_state_change_handler() or mlx5_sf_dev_add_active_work(). Both ensure max SF count is not 0, using mlx5_sf_max_functions() helper before calling mlx5_sf_dev_add(). So remove the redundant check and no longer used max_sfs field. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
2fe6545ef5
commit
7c35cd836f
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
struct mlx5_sf_dev_table {
|
||||
struct xarray devices;
|
||||
unsigned int max_sfs;
|
||||
phys_addr_t base_address;
|
||||
u64 sf_bar_length;
|
||||
struct notifier_block nb;
|
||||
|
|
@ -110,12 +109,6 @@ static void mlx5_sf_dev_add(struct mlx5_core_dev *dev, u16 sf_index, u16 fn_id,
|
|||
sf_dev->parent_mdev = dev;
|
||||
sf_dev->fn_id = fn_id;
|
||||
|
||||
if (!table->max_sfs) {
|
||||
mlx5_adev_idx_free(id);
|
||||
kfree(sf_dev);
|
||||
err = -EOPNOTSUPP;
|
||||
goto add_err;
|
||||
}
|
||||
sf_dev->bar_base_addr = table->base_address + (sf_index * table->sf_bar_length);
|
||||
|
||||
trace_mlx5_sf_dev_add(dev, sf_dev, id);
|
||||
|
|
@ -296,7 +289,6 @@ static void mlx5_sf_dev_destroy_active_work(struct mlx5_sf_dev_table *table)
|
|||
void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_sf_dev_table *table;
|
||||
unsigned int max_sfs;
|
||||
int err;
|
||||
|
||||
if (!mlx5_sf_dev_supported(dev))
|
||||
|
|
@ -310,13 +302,8 @@ void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
|
|||
|
||||
table->nb.notifier_call = mlx5_sf_dev_state_change_handler;
|
||||
table->dev = dev;
|
||||
if (MLX5_CAP_GEN(dev, max_num_sf))
|
||||
max_sfs = MLX5_CAP_GEN(dev, max_num_sf);
|
||||
else
|
||||
max_sfs = 1 << MLX5_CAP_GEN(dev, log_max_sf);
|
||||
table->sf_bar_length = 1 << (MLX5_CAP_GEN(dev, log_min_sf_size) + 12);
|
||||
table->base_address = pci_resource_start(dev->pdev, 2);
|
||||
table->max_sfs = max_sfs;
|
||||
xa_init(&table->devices);
|
||||
mutex_init(&table->table_lock);
|
||||
dev->priv.sf_dev_table = table;
|
||||
|
|
@ -332,7 +319,6 @@ void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
|
|||
err = mlx5_sf_dev_vhca_arm_all(table);
|
||||
if (err)
|
||||
goto arm_err;
|
||||
mlx5_core_dbg(dev, "SF DEV: max sf devices=%d\n", max_sfs);
|
||||
return;
|
||||
|
||||
arm_err:
|
||||
|
|
@ -340,7 +326,6 @@ void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
|
|||
add_active_err:
|
||||
mlx5_vhca_event_notifier_unregister(dev, &table->nb);
|
||||
vhca_err:
|
||||
table->max_sfs = 0;
|
||||
kfree(table);
|
||||
dev->priv.sf_dev_table = NULL;
|
||||
table_err:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user