From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 786A41B8B5 for ; Wed, 17 Apr 2019 22:01:53 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from orika@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 Apr 2019 23:01:49 +0300 Received: from pegasus03.mtr.labs.mlnx (pegasus03.mtr.labs.mlnx [10.210.16.124]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3HK1nHj003264; Wed, 17 Apr 2019 23:01:49 +0300 From: Ori Kam To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, dekelp@mellanox.com, stable@dpdk.org Date: Wed, 17 Apr 2019 20:01:45 +0000 Message-Id: <1555531305-90597-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1555273197-1949-1-git-send-email-orika@mellanox.com> References: <1555273197-1949-1-git-send-email-orika@mellanox.com> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix modify header action position X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2019 20:01:53 -0000 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: dekelp@mellanox.com Cc: stable@dpdk.org Signed-off-by: Ori Kam --- v2: * Move setting the index position outside the case. --- drivers/net/mlx5/mlx5_flow_dv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3862b26..c84779d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3235,6 +3235,7 @@ struct field_modify_info modify_tcp[] = { }; 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; @@ -3474,13 +3475,16 @@ struct field_modify_info modify_tcp[] = { 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; -- 1.8.3.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CC131A00E6 for ; Wed, 17 Apr 2019 22:01:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E46D61B8B8; Wed, 17 Apr 2019 22:01:54 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 786A41B8B5 for ; Wed, 17 Apr 2019 22:01:53 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from orika@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 Apr 2019 23:01:49 +0300 Received: from pegasus03.mtr.labs.mlnx (pegasus03.mtr.labs.mlnx [10.210.16.124]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3HK1nHj003264; Wed, 17 Apr 2019 23:01:49 +0300 From: Ori Kam To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, dekelp@mellanox.com, stable@dpdk.org Date: Wed, 17 Apr 2019 20:01:45 +0000 Message-Id: <1555531305-90597-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1555273197-1949-1-git-send-email-orika@mellanox.com> References: <1555273197-1949-1-git-send-email-orika@mellanox.com> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix modify header action position X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190417200145.HYyC_AwFGRdn44kHpmGar9avL4SeoglqIxB3B22Rmrc@z> 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: dekelp@mellanox.com Cc: stable@dpdk.org Signed-off-by: Ori Kam --- v2: * Move setting the index position outside the case. --- drivers/net/mlx5/mlx5_flow_dv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3862b26..c84779d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3235,6 +3235,7 @@ struct field_modify_info modify_tcp[] = { }; 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; @@ -3474,13 +3475,16 @@ struct field_modify_info modify_tcp[] = { 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; -- 1.8.3.1