patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix assert on getting register of sample flow
@ 2022-12-09 13:59 Jiawei Wang
  2022-12-09 14:18 ` [PATCH v2] " Jiawei Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiawei Wang @ 2022-12-09 13:59 UTC (permalink / raw)
  To: viacheslavo, matan, Shahaf Shuler; +Cc: dev, rasland, Jiawei Wang, stable

From: Jiawei Wang <jiaweiw@mellanox.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@mellanox.com>
Acked-by: Slava Ovsiienko <viacheslavo@nvidia.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] net/mlx5: fix assert on getting register of sample flow
  2022-12-09 13:59 [PATCH] net/mlx5: fix assert on getting register of sample flow Jiawei Wang
@ 2022-12-09 14:18 ` Jiawei Wang
  2022-12-09 14:34 ` [PATCH v3] " Jiawei Wang
  2022-12-21  8:26 ` [PATCH] " Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Jiawei Wang @ 2022-12-09 14:18 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, stable

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: Slava Ovsiienko <viacheslavo@nvidia.com>
---
v2: fix commit mailmap error
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3] net/mlx5: fix assert on getting register of sample flow
  2022-12-09 13:59 [PATCH] net/mlx5: fix assert on getting register of sample flow Jiawei Wang
  2022-12-09 14:18 ` [PATCH v2] " Jiawei Wang
@ 2022-12-09 14:34 ` Jiawei Wang
  2022-12-21  8:26 ` [PATCH] " Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Jiawei Wang @ 2022-12-09 14:34 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, stable

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] net/mlx5: fix assert on getting register of sample flow
  2022-12-09 13:59 [PATCH] net/mlx5: fix assert on getting register of sample flow Jiawei Wang
  2022-12-09 14:18 ` [PATCH v2] " Jiawei Wang
  2022-12-09 14:34 ` [PATCH v3] " Jiawei Wang
@ 2022-12-21  8:26 ` Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2022-12-21  8:26 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Slava Ovsiienko, Matan Azrad, Shahaf Shuler
  Cc: dev, stable

Hi,
> -----Original Message-----
> From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Sent: Friday, December 9, 2022 3:59 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Jiawei(Jonny)
> Wang <jiaweiw@mellanox.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix assert on getting register of sample flow
> 
> From: Jiawei Wang <jiaweiw@mellanox.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@mellanox.com>
> Acked-by: Slava Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-21  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 13:59 [PATCH] net/mlx5: fix assert on getting register of sample flow Jiawei Wang
2022-12-09 14:18 ` [PATCH v2] " Jiawei Wang
2022-12-09 14:34 ` [PATCH v3] " Jiawei Wang
2022-12-21  8:26 ` [PATCH] " Raslan Darawsheh

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).