patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jiawei Wang <jiaweiw@nvidia.com>
To: <viacheslavo@nvidia.com>, <matan@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH v3] net/mlx5: fix assert on getting register of sample flow
Date: Fri, 9 Dec 2022 16:34:06 +0200	[thread overview]
Message-ID: <20221209143406.4856-1-jiaweiw@nvidia.com> (raw)
In-Reply-To: <20221209135907.48619-1-jiaweiw@nvidia.com>

The sample flow tried to get the reserved metadata register for
match implicitly, and if the reserved metadata register was invalid
then back to use the application tag.

The assertion failure was caused while getting register due to
the reserved metadata regC is invalid on CX-5 trusted device(VF/SF).

This patch adds the checking for reserved metadata register before
getting the register, to avoid assertion failure.

Fixes: 9a726360dd30 ("net/mlx5: fix sample flow action on trusted device")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: fix commit mailmap issue
v3: fix commit mailmap issue
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a0cf677fb0..1768ec3cdb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -6125,13 +6125,14 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
 		/* Prepare the prefix tag action. */
 		append_index++;
 		set_tag = (void *)(actions_pre + actions_n + append_index);
-		ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error);
 		/* Trust VF/SF on CX5 not supported meter so that the reserved
 		 * metadata regC is REG_NON, back to use application tag
 		 * index 0.
 		 */
-		if (unlikely(ret == REG_NON))
+		if (unlikely(priv->mtr_color_reg == REG_NON))
 			ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error);
+		else
+			ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error);
 		if (ret < 0)
 			return ret;
 		mlx5_ipool_malloc(priv->sh->ipool
-- 
2.18.1


  parent reply	other threads:[~2022-12-09 14:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 13:59 [PATCH] " Jiawei Wang
2022-12-09 14:18 ` [PATCH v2] " Jiawei Wang
2022-12-09 14:34 ` Jiawei Wang [this message]
2022-12-21  8:26 ` [PATCH] " 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=20221209143406.4856-1-jiaweiw@nvidia.com \
    --to=jiaweiw@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.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).