net/mlx5: fix modify header action position
authorOri Kam <orika@mellanox.com>
Wed, 17 Apr 2019 20:01:45 +0000 (20:01 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:55 +0000 (14:51 +0200)
According to RTE flow the action order should be the order that the
actions were given.
In the case of modify actions the position of the action was always
last.

This commit solves this issue by saving the position of the first modify
action, and then adds to this position the pointer to the modify action.

Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: stable@dpdk.org
Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
drivers/net/mlx5/mlx5_flow_dv.c

index 427e657..c6235b0 100644 (file)
@@ -3234,6 +3234,7 @@ flow_dv_translate(struct rte_eth_dev *dev,
        };
        union flow_dv_attr flow_attr = { .attr = 0 };
        struct mlx5_flow_dv_tag_resource tag_resource;
+       uint32_t modify_action_position = UINT32_MAX;
 
        if (priority == MLX5_FLOW_PRIO_RSVD)
                priority = priv->config.flow_prio - 1;
@@ -3473,13 +3474,16 @@ cnt_err:
                                                                 dev_flow,
                                                                 error))
                                        return -rte_errno;
-                               dev_flow->dv.actions[actions_n++] =
+                               dev_flow->dv.actions[modify_action_position] =
                                        dev_flow->dv.modify_hdr->verbs_action;
                        }
                        break;
                default:
                        break;
                }
+               if ((action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS) &&
+                   modify_action_position == UINT32_MAX)
+                       modify_action_position = actions_n++;
        }
        dev_flow->dv.actions_n = actions_n;
        flow->actions = action_flags;