Commit a53cf949 authored by Parav Pandit's avatar Parav Pandit Committed by David S. Miller

net/mlx5: E-switch, Read controller number from device

ECPF supports one external host controller. Read controller number
from the device.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6b5472d4
...@@ -217,6 +217,7 @@ struct mlx5_esw_offload { ...@@ -217,6 +217,7 @@ struct mlx5_esw_offload {
atomic64_t num_flows; atomic64_t num_flows;
enum devlink_eswitch_encap_mode encap; enum devlink_eswitch_encap_mode encap;
struct ida vport_metadata_ida; struct ida vport_metadata_ida;
unsigned int host_number; /* ECPF supports one external host */
}; };
/* E-Switch MC FDB table hash node */ /* E-Switch MC FDB table hash node */
......
...@@ -2110,6 +2110,24 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type ...@@ -2110,6 +2110,24 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type
return NOTIFY_OK; return NOTIFY_OK;
} }
static int mlx5_esw_host_number_init(struct mlx5_eswitch *esw)
{
const u32 *query_host_out;
if (!mlx5_core_is_ecpf_esw_manager(esw->dev))
return 0;
query_host_out = mlx5_esw_query_functions(esw->dev);
if (IS_ERR(query_host_out))
return PTR_ERR(query_host_out);
/* Mark non local controller with non zero controller number. */
esw->offloads.host_number = MLX5_GET(query_esw_functions_out, query_host_out,
host_params_context.host_number);
kvfree(query_host_out);
return 0;
}
int esw_offloads_enable(struct mlx5_eswitch *esw) int esw_offloads_enable(struct mlx5_eswitch *esw)
{ {
struct mlx5_vport *vport; struct mlx5_vport *vport;
...@@ -2124,6 +2142,10 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) ...@@ -2124,6 +2142,10 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
mutex_init(&esw->offloads.termtbl_mutex); mutex_init(&esw->offloads.termtbl_mutex);
mlx5_rdma_enable_roce(esw->dev); mlx5_rdma_enable_roce(esw->dev);
err = mlx5_esw_host_number_init(esw);
if (err)
goto err_vport_metadata;
err = esw_set_passing_vport_metadata(esw, true); err = esw_set_passing_vport_metadata(esw, true);
if (err) if (err)
goto err_vport_metadata; goto err_vport_metadata;
......
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