patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix tag ID conflict with sample action
@ 2021-11-03 13:07 Jiawei Wang
  2021-11-10  8:47 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawei Wang @ 2021-11-03 13:07 UTC (permalink / raw)
  To: viacheslavo, matan, orika; +Cc: dev, rasland, stable

For the flows containing sample action, the tag action was added
implicitly to store the unique flow index into metadata
register in the split prefix subflow, and then match on this index in the
split suffix subflow. The metadata register for flow index of sample split
subflows was also used to store application metadata TAG 0 item, this
might cause TAG 0 corruption in the flows with sample actions.

This patch uses the same metadata register C index as used for
ASO action since it's reserved and not used directly by the application,
and adds the checking in validation to make sure not to conflict
with ASO CT in the same flow.

Fixes: b4c0ddb ("net/mlx5: split sample flow into two sub-flows")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c    | 3 ++-
 drivers/net/mlx5/mlx5_flow.h    | 1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 2385a0b550..5f869c0867 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -897,6 +897,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev,
 	case MLX5_MTR_COLOR:
 	case MLX5_ASO_FLOW_HIT:
 	case MLX5_ASO_CONNTRACK:
+	case MLX5_SAMPLE_ID:
 		/* All features use the same REG_C. */
 		MLX5_ASSERT(priv->mtr_color_reg != REG_NON);
 		return priv->mtr_color_reg;
@@ -5532,7 +5533,7 @@ 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_APP_TAG, 0, error);
+		ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error);
 		if (ret < 0)
 			return ret;
 		mlx5_ipool_malloc(priv->sh->ipool
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 5509c28f01..198b1db2e6 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -109,6 +109,7 @@ enum mlx5_feature_name {
 	MLX5_MTR_ID,
 	MLX5_ASO_FLOW_HIT,
 	MLX5_ASO_CONNTRACK,
+	MLX5_SAMPLE_ID,
 };
 
 /* Default queue number. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8962d26c75..8197553b27 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5574,6 +5574,10 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "wrong action order, jump should "
 					  "be after sample action");
+	if (*action_flags & MLX5_FLOW_ACTION_CT)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "Sample after CT not supported");
 	act = sample->actions;
 	for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++) {
 		if (actions_n == MLX5_DV_MAX_NUMBER_OF_ACTIONS)
-- 
2.18.1


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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix tag ID conflict with sample action
  2021-11-03 13:07 [dpdk-stable] [PATCH] net/mlx5: fix tag ID conflict with sample action Jiawei Wang
@ 2021-11-10  8:47 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2021-11-10  8:47 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Slava Ovsiienko, Matan Azrad, Ori Kam; +Cc: dev, stable

Hi,

> -----Original Message-----
> From: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Sent: Wednesday, November 3, 2021 3:08 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Ori Kam <orika@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix tag ID conflict with sample action
> 
> For the flows containing sample action, the tag action was added implicitly to
> store the unique flow index into metadata register in the split prefix subflow,
> and then match on this index in the split suffix subflow. The metadata
> register for flow index of sample split subflows was also used to store
> application metadata TAG 0 item, this might cause TAG 0 corruption in the
> flows with sample actions.
> 
> This patch uses the same metadata register C index as used for ASO action
> since it's reserved and not used directly by the application, and adds the
> checking in validation to make sure not to conflict with ASO CT in the same
> flow.
> 
> Fixes: b4c0ddb ("net/mlx5: split sample flow into two sub-flows")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2021-11-10  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 13:07 [dpdk-stable] [PATCH] net/mlx5: fix tag ID conflict with sample action Jiawei Wang
2021-11-10  8:47 ` Raslan Darawsheh

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git