Skip to content

Commit aa39c2c

Browse files
Eli BritsteinSaeed Mahameed
authored andcommitted
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: Eli Britstein <elibr@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Oz Shlomo <ozsh@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent 1b11549 commit aa39c2c

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
125125
dest[i].vport.num = attr->out_rep[j]->vport;
126126
dest[i].vport.vhca_id =
127127
MLX5_CAP_GEN(attr->out_mdev[j], vhca_id);
128-
dest[i].vport.vhca_id_valid =
129-
!!MLX5_CAP_ESW(esw->dev, merged_eswitch);
128+
if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
129+
dest[i].vport.flags |=
130+
MLX5_FLOW_DEST_VPORT_VHCA_ID;
130131
i++;
131132
}
132133
}
@@ -220,7 +221,8 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
220221
dest[i].vport.num = attr->out_rep[i]->vport;
221222
dest[i].vport.vhca_id =
222223
MLX5_CAP_GEN(attr->out_mdev[i], vhca_id);
223-
dest[i].vport.vhca_id_valid = !!MLX5_CAP_ESW(esw->dev, merged_eswitch);
224+
if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
225+
dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
224226
}
225227
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
226228
dest[i].ft = fwd_fdb,

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
387387
id = dst->dest_attr.vport.num;
388388
MLX5_SET(dest_format_struct, in_dests,
389389
destination_eswitch_owner_vhca_id_valid,
390-
dst->dest_attr.vport.vhca_id_valid);
390+
!!(dst->dest_attr.vport.flags &
391+
MLX5_FLOW_DEST_VPORT_VHCA_ID));
391392
MLX5_SET(dest_format_struct, in_dests,
392393
destination_eswitch_owner_vhca_id,
393394
dst->dest_attr.vport.vhca_id);

include/linux/mlx5/fs.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ struct mlx5_flow_spec {
8686
u32 match_value[MLX5_ST_SZ_DW(fte_match_param)];
8787
};
8888

89+
enum {
90+
MLX5_FLOW_DEST_VPORT_VHCA_ID = BIT(0),
91+
};
92+
8993
struct mlx5_flow_destination {
9094
enum mlx5_flow_destination_type type;
9195
union {
@@ -96,7 +100,7 @@ struct mlx5_flow_destination {
96100
struct {
97101
u16 num;
98102
u16 vhca_id;
99-
bool vhca_id_valid;
103+
u8 flags;
100104
} vport;
101105
};
102106
};

0 commit comments

Comments
 (0)