DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <matan@nvidia.com>,
	<rasland@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH v2 1/2] net/mlx5: fix metadata endianness in modify field action
Date: Thu, 3 Feb 2022 10:46:51 +0200	[thread overview]
Message-ID: <20220203084652.19167-1-viacheslavo@nvidia.com> (raw)
In-Reply-To: <49fa76c7-30fe-3128-81ac-38779f557f33@intel.com>

As modify field action immediate source parameter the metadata
should follow the CPU endianness (according to SET_META action
structure format), and mlx5 PMD wrongly handled the immediate
parameter metadata buffer as big-endian, resulting in wrong
metadata set action with incorrect endianness.

Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index af90a7fd0a..10ef2af06a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1867,7 +1867,7 @@ flow_dv_convert_action_modify_field
 	struct field_modify_info dcopy[MLX5_ACT_MAX_MOD_FIELDS] = {
 								{0, 0, 0} };
 	uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS] = {0, 0, 0, 0, 0};
-	uint32_t type;
+	uint32_t type, meta = 0;
 	uint32_t shift = 0;
 
 	if (conf->src.field == RTE_FLOW_FIELD_POINTER ||
@@ -1880,6 +1880,11 @@ flow_dv_convert_action_modify_field
 		item.spec = conf->src.field == RTE_FLOW_FIELD_POINTER ?
 					(void *)(uintptr_t)conf->src.pvalue :
 					(void *)(uintptr_t)&conf->src.value;
+		if (conf->dst.field == RTE_FLOW_FIELD_META) {
+			meta = *(const unaligned_uint32_t *)item.spec;
+			meta = rte_cpu_to_be_32(meta);
+			item.spec = &meta;
+		}
 	} else {
 		type = MLX5_MODIFICATION_TYPE_COPY;
 		/** For COPY fill the destination field (dcopy) without mask. */
-- 
2.18.1


  reply	other threads:[~2022-02-03  8:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 12:32 [PATCH] " Viacheslav Ovsiienko
2021-12-06  8:56 ` Raslan Darawsheh
2021-12-07 13:44 ` Ferruh Yigit
2021-12-16  9:50   ` Slava Ovsiienko
2021-12-17 12:59     ` Ferruh Yigit
2022-02-03  8:46       ` Viacheslav Ovsiienko [this message]
2022-02-03  8:46         ` [PATCH v2 2/2] net/mlx5: remove unused metadata shift parameter Viacheslav Ovsiienko
2022-02-08 10:48           ` Ferruh Yigit
2022-02-09  8:50         ` [PATCH v2 1/2] net/mlx5: fix metadata endianness in modify field action Raslan Darawsheh

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=20220203084652.19167-1-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    /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).