net/mlx5: fix GENEVE resource overwritten

Message ID 20221123115712.808661-1-suanmingm@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix GENEVE resource overwritten |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional fail Functional Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance fail Performance Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Suanming Mou Nov. 23, 2022, 11:57 a.m. UTC
  Currently, one rte_flow may be split to multiple sub mlx5_flows.
While GENEVE option resource was allocated in the first mlx5_flow,
the flag will be overwritten by next sub mlx5_flow. This caused
GENEVE option resource leakage.

This commit adds the check of GENEVE option resource to avoid the
GENEVE option flag be overwritten.

Fixes: cd4ab742064a ("net/mlx5: split flow item matcher and value translation")

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

Comments

Raslan Darawsheh Dec. 18, 2022, 12:05 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> Sent: Wednesday, November 23, 2022 1:57 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] net/mlx5: fix GENEVE resource overwritten
> 
> Currently, one rte_flow may be split to multiple sub mlx5_flows.
> While GENEVE option resource was allocated in the first mlx5_flow,
> the flag will be overwritten by next sub mlx5_flow. This caused
> GENEVE option resource leakage.
> 
> This commit adds the check of GENEVE option resource to avoid the
> GENEVE option flag be overwritten.
> 
> Fixes: cd4ab742064a ("net/mlx5: split flow item matcher and value
> translation")
> 
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 62c38b87a1..7ca909999b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -13717,7 +13717,12 @@  flow_dv_translate_items_sws(struct rte_eth_dev *dev,
 	 * is the suffix flow.
 	 */
 	dev_flow->handle->layers |= wks.item_flags;
-	dev_flow->flow->geneve_tlv_option = wks.geneve_tlv_option;
+	/*
+	 * Update geneve_tlv_option flag only it is set in workspace.
+	 * Avoid be overwritten by other sub mlx5_flows.
+	 */
+	if (wks.geneve_tlv_option)
+		dev_flow->flow->geneve_tlv_option = wks.geneve_tlv_option;
 	return 0;
 }