Commit 8611df72 authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed

net/mlx5: E-switch, mark devcom as not ready when all eswitches are unpaired

Whenever an eswitch is unpaired with another, the driver mark devcom
as not ready. While this is correct in case we are pairing only two
eswitches, in order to support pairing of more than two eswitches,
driver need to mark devcom as not ready only when all eswitches are
unpaired.
Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent e67f928a
......@@ -343,6 +343,7 @@ struct mlx5_eswitch {
int mode;
u16 manager_vport;
u16 first_host_vport;
u8 num_peers;
struct mlx5_esw_functions esw_funcs;
struct {
u32 large_group_num;
......
......@@ -2836,6 +2836,8 @@ static int mlx5_esw_offloads_devcom_event(int event,
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = true;
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = true;
esw->num_peers++;
peer_esw->num_peers++;
mlx5_devcom_comp_set_ready(devcom, MLX5_DEVCOM_ESW_OFFLOADS, true);
break;
......@@ -2843,7 +2845,10 @@ static int mlx5_esw_offloads_devcom_event(int event,
if (!esw->paired[mlx5_get_dev_index(peer_esw->dev)])
break;
mlx5_devcom_comp_set_ready(devcom, MLX5_DEVCOM_ESW_OFFLOADS, false);
peer_esw->num_peers--;
esw->num_peers--;
if (!esw->num_peers && !peer_esw->num_peers)
mlx5_devcom_comp_set_ready(devcom, MLX5_DEVCOM_ESW_OFFLOADS, false);
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = false;
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = false;
mlx5_esw_offloads_unpair(peer_esw, esw);
......@@ -2884,6 +2889,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw)
mlx5_esw_offloads_devcom_event,
esw);
esw->num_peers = 0;
mlx5_devcom_send_event(devcom,
MLX5_DEVCOM_ESW_OFFLOADS,
ESW_OFFLOADS_DEVCOM_PAIR, esw);
......
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