History

net/mlx5e: Fix matchall police parameters validation

Referenced commit prepared the code for upcoming extension that allows mlx5 to offload police action attached to flower classifier. However, with regard to existing matchall classifier offload validation should be reversed as FLOW_ACTION_CONTINUE is the only supported notexceed police action type. Fix the problem by allowing FLOW_ACTION_CONTINUE for police action and extend scan_tc_matchall_fdb_actions() to only allow such actions with matchall classifier.

Vlad Buslov committed 4 years ago

Commit 4d1e07d1 parent 052f7441 file · +6 −7Browse files

Unified · Split

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+6−7
@@ -4529,13 +4529,6 @@ static int mlx5e_policer_validate(const struct flow_action *action, · 4528 unmodified lines
4529 return -EOPNOTSUPP;4529 return -EOPNOTSUPP;
4530 }4530 }
4531 4531
4532 if (act->police.notexceed.act_id != FLOW_ACTION_PIPE &&
4533 act->police.notexceed.act_id != FLOW_ACTION_ACCEPT) {
4534 NL_SET_ERR_MSG_MOD(extack,
4535 "Offload not supported when conform action is not pipe or ok");
4536 return -EOPNOTSUPP;
4537 }
4538
4539 if (act->police.notexceed.act_id == FLOW_ACTION_ACCEPT &&4532 if (act->police.notexceed.act_id == FLOW_ACTION_ACCEPT &&
4540 !flow_action_is_last_entry(action, act)) {4533 !flow_action_is_last_entry(action, act)) {
4541 NL_SET_ERR_MSG_MOD(extack,4534 NL_SET_ERR_MSG_MOD(extack,
@@ -4586,6 +4579,12 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv, · 44 unmodified lines
4586 flow_action_for_each(i, act, flow_action) {4579 flow_action_for_each(i, act, flow_action) {
4587 switch (act->id) {4580 switch (act->id) {
4588 case FLOW_ACTION_POLICE:4581 case FLOW_ACTION_POLICE:
4582 if (act->police.notexceed.act_id != FLOW_ACTION_CONTINUE) {
4583 NL_SET_ERR_MSG_MOD(extack,
4584 "Offload not supported when conform action is not continue");
4585 return -EOPNOTSUPP;
4586 }
4587
4589 err = mlx5e_policer_validate(flow_action, act, extack);4588 err = mlx5e_policer_validate(flow_action, act, extack);
4590 if (err)4589 if (err)
4591 return err;4590 return err;