Skip to content

Commit 6f7bbad

Browse files
jialiu02Saeed Mahameed
authored andcommitted
net/mlx5e: E-Switch, Specify flow_source for rule with no in_port
The flow_source must be specified, even for rule without matching source vport, because some actions are only allowed in uplink. Otherwise, rule can't be offloaded and firmware syndrome happens. Fixes: 6fb0701 ("net/mlx5: E-Switch, Add support for offloading rules with no in_port") Signed-off-by: Jianbo Liu <[email protected]> Reviewed-by: Chris Mi <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 0faddfe commit 6f7bbad

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ static struct mlx5_eswitch_rep *mlx5_eswitch_get_rep(struct mlx5_eswitch *esw,
236236
return &esw->offloads.vport_reps[idx];
237237
}
238238

239+
static void
240+
mlx5_eswitch_set_rule_flow_source(struct mlx5_eswitch *esw,
241+
struct mlx5_flow_spec *spec,
242+
struct mlx5_esw_flow_attr *attr)
243+
{
244+
if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) &&
245+
attr && attr->in_rep && attr->in_rep->vport == MLX5_VPORT_UPLINK)
246+
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
247+
}
239248

240249
static void
241250
mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
@@ -276,10 +285,6 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
276285

277286
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
278287
}
279-
280-
if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) &&
281-
attr->in_rep->vport == MLX5_VPORT_UPLINK)
282-
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
283288
}
284289

285290
struct mlx5_flow_handle *
@@ -377,9 +382,6 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
377382
flow_act.modify_hdr = attr->modify_hdr;
378383

379384
if (split) {
380-
if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) &&
381-
attr->in_rep->vport == MLX5_VPORT_UPLINK)
382-
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
383385
fdb = esw_vport_tbl_get(esw, attr);
384386
} else {
385387
if (attr->chain || attr->prio)
@@ -396,6 +398,8 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
396398
goto err_esw_get;
397399
}
398400

401+
mlx5_eswitch_set_rule_flow_source(esw, spec, attr);
402+
399403
if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec))
400404
rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr,
401405
&flow_act, dest, i);
@@ -462,6 +466,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
462466
i++;
463467

464468
mlx5_eswitch_set_rule_source_port(esw, spec, attr);
469+
mlx5_eswitch_set_rule_flow_source(esw, spec, attr);
465470

466471
if (attr->outer_match_level != MLX5_MATCH_NONE)
467472
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;

0 commit comments

Comments
 (0)