Commit 67efaf45 authored by Paul Blakey's avatar Paul Blakey Committed by Saeed Mahameed
Browse files

net/mlx5e: TC, Remove CT action reordering



CT action reordering was done as a workaround when CT misses
used to restore the relevant filter's tc chain and continuing sw processing
from that chain. As such, there was a need to reorder CT action to be before
any packet modifying actions (e.g mac rewrite).

Currently (after patch "net/mlx5e: TC, Set CT miss to the specific ct
action instance"), CT misses continues from the relevant ct action in
software, and so reordering isn't needed anymore.

Remove the reordering.

Signed-off-by: default avatarPaul Blakey <paulb@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 13aca17b
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -82,26 +82,6 @@ mlx5e_tc_act_init_parse_state(struct mlx5e_tc_act_parse_state *parse_state,
	parse_state->flow_action = flow_action;
}

void
mlx5e_tc_act_reorder_flow_actions(struct flow_action *flow_action,
				  struct mlx5e_tc_flow_action *flow_action_reorder)
{
	struct flow_action_entry *act;
	int i, j = 0;

	flow_action_for_each(i, act, flow_action) {
		/* Add CT action to be first. */
		if (act->id == FLOW_ACTION_CT)
			flow_action_reorder->entries[j++] = act;
	}

	flow_action_for_each(i, act, flow_action) {
		if (act->id == FLOW_ACTION_CT)
			continue;
		flow_action_reorder->entries[j++] = act;
	}
}

int
mlx5e_tc_act_post_parse(struct mlx5e_tc_act_parse_state *parse_state,
			struct flow_action *flow_action,
+0 −4
Original line number Diff line number Diff line
@@ -112,10 +112,6 @@ mlx5e_tc_act_init_parse_state(struct mlx5e_tc_act_parse_state *parse_state,
			      struct flow_action *flow_action,
			      struct netlink_ext_ack *extack);

void
mlx5e_tc_act_reorder_flow_actions(struct flow_action *flow_action,
				  struct mlx5e_tc_flow_action *flow_action_reorder);

int
mlx5e_tc_act_post_parse(struct mlx5e_tc_act_parse_state *parse_state,
			struct flow_action *flow_action,
+9 −23
Original line number Diff line number Diff line
@@ -4045,32 +4045,22 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
		 struct flow_action *flow_action)
{
	struct netlink_ext_ack *extack = parse_state->extack;
	struct mlx5e_tc_flow_action flow_action_reorder;
	struct mlx5e_tc_flow *flow = parse_state->flow;
	struct mlx5e_tc_jump_state jump_state = {};
	struct mlx5_flow_attr *attr = flow->attr;
	enum mlx5_flow_namespace_type ns_type;
	struct mlx5e_priv *priv = flow->priv;
	struct flow_action_entry *act, **_act;
	struct mlx5_flow_attr *prev_attr;
	struct flow_action_entry *act;
	struct mlx5e_tc_act *tc_act;
	bool is_missable;
	int err, i;

	flow_action_reorder.num_entries = flow_action->num_entries;
	flow_action_reorder.entries = kcalloc(flow_action->num_entries,
					      sizeof(flow_action), GFP_KERNEL);
	if (!flow_action_reorder.entries)
		return -ENOMEM;

	mlx5e_tc_act_reorder_flow_actions(flow_action, &flow_action_reorder);

	ns_type = mlx5e_get_flow_namespace(flow);
	list_add(&attr->list, &flow->attrs);

	flow_action_for_each(i, _act, &flow_action_reorder) {
	flow_action_for_each(i, act, flow_action) {
		jump_state.jump_target = false;
		act = *_act;
		is_missable = false;
		prev_attr = attr;

@@ -4078,23 +4068,23 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
		if (!tc_act) {
			NL_SET_ERR_MSG_MOD(extack, "Not implemented offload action");
			err = -EOPNOTSUPP;
			goto out_free;
			goto out_free_post_acts;
		}

		if (tc_act->can_offload && !tc_act->can_offload(parse_state, act, i, attr)) {
			err = -EOPNOTSUPP;
			goto out_free;
			goto out_free_post_acts;
		}

		err = tc_act->parse_action(parse_state, act, priv, attr);
		if (err)
			goto out_free;
			goto out_free_post_acts;

		dec_jump_count(act, tc_act, attr, priv, &jump_state);

		err = parse_branch_ctrl(act, tc_act, flow, attr, &jump_state, extack);
		if (err)
			goto out_free;
			goto out_free_post_acts;

		parse_state->actions |= attr->action;

@@ -4102,17 +4092,17 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
		if (jump_state.jump_target ||
		    (tc_act->is_multi_table_act &&
		    tc_act->is_multi_table_act(priv, act, attr) &&
		    i < flow_action_reorder.num_entries - 1)) {
		    i < flow_action->num_entries - 1)) {
			is_missable = tc_act->is_missable ? tc_act->is_missable(act) : false;

			err = mlx5e_tc_act_post_parse(parse_state, flow_action, attr, ns_type);
			if (err)
				goto out_free;
				goto out_free_post_acts;

			attr = mlx5e_clone_flow_attr_for_post_act(flow->attr, ns_type);
			if (!attr) {
				err = -ENOMEM;
				goto out_free;
				goto out_free_post_acts;
			}

			list_add(&attr->list, &flow->attrs);
@@ -4129,8 +4119,6 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
		}
	}

	kfree(flow_action_reorder.entries);

	err = mlx5e_tc_act_post_parse(parse_state, flow_action, attr, ns_type);
	if (err)
		goto out_free_post_acts;
@@ -4141,8 +4129,6 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,

	return 0;

out_free:
	kfree(flow_action_reorder.entries);
out_free_post_acts:
	free_flow_post_acts(flow);