Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa39c2c0 authored by Eli Britstein's avatar Eli Britstein Committed by Saeed Mahameed
Browse files

net/mlx5: E-Switch, Change vhca id valid bool field to bit flag



Change the driver flow destination struct to use bit flags with the vhca
id valid being the 1st one. The flags field is more extendable and will
be used in downstream patch.

Signed-off-by: default avatarEli Britstein <elibr@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: default avatarOz Shlomo <ozsh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 1b115498
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -125,8 +125,9 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
				dest[i].vport.num = attr->out_rep[j]->vport;
				dest[i].vport.vhca_id =
					MLX5_CAP_GEN(attr->out_mdev[j], vhca_id);
				dest[i].vport.vhca_id_valid =
					!!MLX5_CAP_ESW(esw->dev, merged_eswitch);
				if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
					dest[i].vport.flags |=
						MLX5_FLOW_DEST_VPORT_VHCA_ID;
				i++;
			}
		}
@@ -220,7 +221,8 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
		dest[i].vport.num = attr->out_rep[i]->vport;
		dest[i].vport.vhca_id =
			MLX5_CAP_GEN(attr->out_mdev[i], vhca_id);
		dest[i].vport.vhca_id_valid = !!MLX5_CAP_ESW(esw->dev, merged_eswitch);
		if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
			dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
	}
	dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
	dest[i].ft = fwd_fdb,
+2 −1
Original line number Diff line number Diff line
@@ -387,7 +387,8 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
				id = dst->dest_attr.vport.num;
				MLX5_SET(dest_format_struct, in_dests,
					 destination_eswitch_owner_vhca_id_valid,
					 dst->dest_attr.vport.vhca_id_valid);
					 !!(dst->dest_attr.vport.flags &
					    MLX5_FLOW_DEST_VPORT_VHCA_ID));
				MLX5_SET(dest_format_struct, in_dests,
					 destination_eswitch_owner_vhca_id,
					 dst->dest_attr.vport.vhca_id);
+5 −1
Original line number Diff line number Diff line
@@ -86,6 +86,10 @@ struct mlx5_flow_spec {
	u32  match_value[MLX5_ST_SZ_DW(fte_match_param)];
};

enum {
	MLX5_FLOW_DEST_VPORT_VHCA_ID      = BIT(0),
};

struct mlx5_flow_destination {
	enum mlx5_flow_destination_type	type;
	union {
@@ -96,7 +100,7 @@ struct mlx5_flow_destination {
		struct {
			u16		num;
			u16		vhca_id;
			bool		vhca_id_valid;
			u8		flags;
		} vport;
	};
};