Commit 6e74e6ea authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: SF, Use device pointer directly

At many places in the code, device pointer is directly available. Make
use of it, instead of accessing it from the table.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 57b92bdd
...@@ -67,8 +67,8 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) ...@@ -67,8 +67,8 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum)
goto exist_err; goto exist_err;
} }
hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, sw_id); hw_fn_id = mlx5_sf_sw_to_hw_id(dev, sw_id);
err = mlx5_cmd_alloc_sf(table->dev, hw_fn_id); err = mlx5_cmd_alloc_sf(dev, hw_fn_id);
if (err) if (err)
goto err; goto err;
...@@ -80,7 +80,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) ...@@ -80,7 +80,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum)
return sw_id; return sw_id;
vhca_err: vhca_err:
mlx5_cmd_dealloc_sf(table->dev, hw_fn_id); mlx5_cmd_dealloc_sf(dev, hw_fn_id);
err: err:
table->sfs[i].allocated = false; table->sfs[i].allocated = false;
exist_err: exist_err:
...@@ -93,8 +93,8 @@ static void _mlx5_sf_hw_id_free(struct mlx5_core_dev *dev, u16 id) ...@@ -93,8 +93,8 @@ static void _mlx5_sf_hw_id_free(struct mlx5_core_dev *dev, u16 id)
struct mlx5_sf_hw_table *table = dev->priv.sf_hw_table; struct mlx5_sf_hw_table *table = dev->priv.sf_hw_table;
u16 hw_fn_id; u16 hw_fn_id;
hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, id); hw_fn_id = mlx5_sf_sw_to_hw_id(dev, id);
mlx5_cmd_dealloc_sf(table->dev, hw_fn_id); mlx5_cmd_dealloc_sf(dev, hw_fn_id);
table->sfs[id].allocated = false; table->sfs[id].allocated = false;
table->sfs[id].pending_delete = false; table->sfs[id].pending_delete = false;
} }
...@@ -123,7 +123,7 @@ void mlx5_sf_hw_table_sf_deferred_free(struct mlx5_core_dev *dev, u16 id) ...@@ -123,7 +123,7 @@ void mlx5_sf_hw_table_sf_deferred_free(struct mlx5_core_dev *dev, u16 id)
goto err; goto err;
state = MLX5_GET(query_vhca_state_out, out, vhca_state_context.vhca_state); state = MLX5_GET(query_vhca_state_out, out, vhca_state_context.vhca_state);
if (state == MLX5_VHCA_STATE_ALLOCATED) { if (state == MLX5_VHCA_STATE_ALLOCATED) {
mlx5_cmd_dealloc_sf(table->dev, hw_fn_id); mlx5_cmd_dealloc_sf(dev, hw_fn_id);
table->sfs[id].allocated = false; table->sfs[id].allocated = false;
} else { } else {
table->sfs[id].pending_delete = true; table->sfs[id].pending_delete = true;
...@@ -216,7 +216,7 @@ int mlx5_sf_hw_table_create(struct mlx5_core_dev *dev) ...@@ -216,7 +216,7 @@ int mlx5_sf_hw_table_create(struct mlx5_core_dev *dev)
return 0; return 0;
table->vhca_nb.notifier_call = mlx5_sf_hw_vhca_event; table->vhca_nb.notifier_call = mlx5_sf_hw_vhca_event;
return mlx5_vhca_event_notifier_register(table->dev, &table->vhca_nb); return mlx5_vhca_event_notifier_register(dev, &table->vhca_nb);
} }
void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev) void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev)
...@@ -226,7 +226,7 @@ void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev) ...@@ -226,7 +226,7 @@ void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev)
if (!table) if (!table)
return; return;
mlx5_vhca_event_notifier_unregister(table->dev, &table->vhca_nb); mlx5_vhca_event_notifier_unregister(dev, &table->vhca_nb);
/* Dealloc SFs whose firmware event has been missed. */ /* Dealloc SFs whose firmware event has been missed. */
mlx5_sf_hw_dealloc_all(table); mlx5_sf_hw_dealloc_all(table);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment