Commit 4d1e07d8 authored by Vlad Buslov's avatar Vlad Buslov Committed by David S. Miller
Browse files

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.

Fixes: d97b4b10 ("flow_offload: reject offload for all drivers with invalid police parameters")
Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
Acked-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 052f744f
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -4529,13 +4529,6 @@ static int mlx5e_policer_validate(const struct flow_action *action,
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}


	if (act->police.notexceed.act_id != FLOW_ACTION_PIPE &&
	    act->police.notexceed.act_id != FLOW_ACTION_ACCEPT) {
		NL_SET_ERR_MSG_MOD(extack,
				   "Offload not supported when conform action is not pipe or ok");
		return -EOPNOTSUPP;
	}

	if (act->police.notexceed.act_id == FLOW_ACTION_ACCEPT &&
	if (act->police.notexceed.act_id == FLOW_ACTION_ACCEPT &&
	    !flow_action_is_last_entry(action, act)) {
	    !flow_action_is_last_entry(action, act)) {
		NL_SET_ERR_MSG_MOD(extack,
		NL_SET_ERR_MSG_MOD(extack,
@@ -4586,6 +4579,12 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv,
	flow_action_for_each(i, act, flow_action) {
	flow_action_for_each(i, act, flow_action) {
		switch (act->id) {
		switch (act->id) {
		case FLOW_ACTION_POLICE:
		case FLOW_ACTION_POLICE:
			if (act->police.notexceed.act_id != FLOW_ACTION_CONTINUE) {
				NL_SET_ERR_MSG_MOD(extack,
						   "Offload not supported when conform action is not continue");
				return -EOPNOTSUPP;
			}

			err = mlx5e_policer_validate(flow_action, act, extack);
			err = mlx5e_policer_validate(flow_action, act, extack);
			if (err)
			if (err)
				return err;
				return err;