DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: yskoh@mellanox.com, shahafs@mellanox.com
Cc: dev@dpdk.org, orika@mellanox.com, dekelp@mellanox.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix modify header action position
Date: Wed, 17 Apr 2019 20:01:45 +0000	[thread overview]
Message-ID: <1555531305-90597-1-git-send-email-orika@mellanox.com> (raw)
Message-ID: <20190417200145.HYyC_AwFGRdn44kHpmGar9avL4SeoglqIxB3B22Rmrc@z> (raw)
In-Reply-To: <1555273197-1949-1-git-send-email-orika@mellanox.com>

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 <orika@mellanox.com>
---
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


  parent reply	other threads:[~2019-04-17 20:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 20:19 [dpdk-dev] [PATCH] " Ori Kam
2019-04-14 20:19 ` Ori Kam
2019-04-16 23:41 ` Yongseok Koh
2019-04-16 23:41   ` Yongseok Koh
2019-04-17  5:03   ` Ori Kam
2019-04-17  5:03     ` Ori Kam
2019-04-17 20:01 ` Ori Kam [this message]
2019-04-17 20:01   ` [dpdk-dev] [PATCH v2] " Ori Kam
2019-04-18 13:25   ` Yongseok Koh
2019-04-18 13:25     ` Yongseok Koh
2019-04-18 18:55     ` Shahaf Shuler
2019-04-18 18:55       ` Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1555531305-90597-1-git-send-email-orika@mellanox.com \
    --to=orika@mellanox.com \
    --cc=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).