Commit 6d5b7321 authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed
Browse files

net/mlx5: DR, handle more than one peer domain



Currently, DR domain is using the assumption that each domain can only
have a single peer.
In order to support VF LAG of more then two ports, expand peer domain
to use an array of peers, and align the code accordingly.

Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 014e4d48
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -2778,7 +2778,9 @@ static int mlx5_esw_offloads_set_ns_peer(struct mlx5_eswitch *esw,
					 struct mlx5_eswitch *peer_esw,
					 bool pair)
{
	u8 peer_idx = mlx5_get_dev_index(peer_esw->dev);
	struct mlx5_flow_root_namespace *peer_ns;
	u8 idx = mlx5_get_dev_index(esw->dev);
	struct mlx5_flow_root_namespace *ns;
	int err;

@@ -2786,18 +2788,18 @@ static int mlx5_esw_offloads_set_ns_peer(struct mlx5_eswitch *esw,
	ns = esw->dev->priv.steering->fdb_root_ns;

	if (pair) {
		err = mlx5_flow_namespace_set_peer(ns, peer_ns);
		err = mlx5_flow_namespace_set_peer(ns, peer_ns, peer_idx);
		if (err)
			return err;

		err = mlx5_flow_namespace_set_peer(peer_ns, ns);
		err = mlx5_flow_namespace_set_peer(peer_ns, ns, idx);
		if (err) {
			mlx5_flow_namespace_set_peer(ns, NULL);
			mlx5_flow_namespace_set_peer(ns, NULL, peer_idx);
			return err;
		}
	} else {
		mlx5_flow_namespace_set_peer(ns, NULL);
		mlx5_flow_namespace_set_peer(peer_ns, NULL);
		mlx5_flow_namespace_set_peer(ns, NULL, peer_idx);
		mlx5_flow_namespace_set_peer(peer_ns, NULL, idx);
	}

	return 0;
+2 −1
Original line number Diff line number Diff line
@@ -139,7 +139,8 @@ static void mlx5_cmd_stub_modify_header_dealloc(struct mlx5_flow_root_namespace
}

static int mlx5_cmd_stub_set_peer(struct mlx5_flow_root_namespace *ns,
				  struct mlx5_flow_root_namespace *peer_ns)
				  struct mlx5_flow_root_namespace *peer_ns,
				  u8 peer_idx)
{
	return 0;
}
+2 −1
Original line number Diff line number Diff line
@@ -93,7 +93,8 @@ struct mlx5_flow_cmds {
				      struct mlx5_modify_hdr *modify_hdr);

	int (*set_peer)(struct mlx5_flow_root_namespace *ns,
			struct mlx5_flow_root_namespace *peer_ns);
			struct mlx5_flow_root_namespace *peer_ns,
			u8 peer_idx);

	int (*create_ns)(struct mlx5_flow_root_namespace *ns);
	int (*destroy_ns)(struct mlx5_flow_root_namespace *ns);
+3 −2
Original line number Diff line number Diff line
@@ -3620,7 +3620,8 @@ void mlx5_destroy_match_definer(struct mlx5_core_dev *dev,
}

int mlx5_flow_namespace_set_peer(struct mlx5_flow_root_namespace *ns,
				 struct mlx5_flow_root_namespace *peer_ns)
				 struct mlx5_flow_root_namespace *peer_ns,
				 u8 peer_idx)
{
	if (peer_ns && ns->mode != peer_ns->mode) {
		mlx5_core_err(ns->dev,
@@ -3628,7 +3629,7 @@ int mlx5_flow_namespace_set_peer(struct mlx5_flow_root_namespace *ns,
		return -EINVAL;
	}

	return ns->cmds->set_peer(ns, peer_ns);
	return ns->cmds->set_peer(ns, peer_ns, peer_idx);
}

/* This function should be called only at init stage of the namespace.
+2 −1
Original line number Diff line number Diff line
@@ -295,7 +295,8 @@ void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void);

int mlx5_flow_namespace_set_peer(struct mlx5_flow_root_namespace *ns,
				 struct mlx5_flow_root_namespace *peer_ns);
				 struct mlx5_flow_root_namespace *peer_ns,
				 u8 peer_idx);

int mlx5_flow_namespace_set_mode(struct mlx5_flow_namespace *ns,
				 enum mlx5_flow_steering_mode mode);
Loading