net/mlx5e: TC, Remove CT action reordering
authorPaul Blakey <paulb@nvidia.com>
Sun, 4 Dec 2022 14:53:56 +0000 (16:53 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 6 Apr 2023 01:57:32 +0000 (18:57 -0700)
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: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

index eba0c86989263f167fed61f897fc02e9411ad771..fc923a99b6a483d5eaddba1f01c76d66549b74a3 100644 (file)
@@ -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,
index cdcddf6e1b08b663aad9e99b2ce22045a96604c4..d7615e329e6d9bc24e0c402c9b66f796750933d6 100644 (file)
@@ -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,
index 32b50d68531250fec9cee3dcaf22d5c8c7cd0f01..15deb1df4df3770285f6c10b3922bfeff87f57c4 100644 (file)
@@ -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);