net/mlx5: remove unneeded GENEVE option length assert

Message ID 20221109014018.23965-1-suanmingm@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: remove unneeded GENEVE option length assert |

Checks

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

Commit Message

Suanming Mou Nov. 9, 2022, 1:40 a.m. UTC
  In order to share flow items translate code, flow items translation
of spec and mask was split individually.

In that case, the assert for GENEVE option length with mask becomes
invalid, since the length in mask is bitmask. And as memcpy around
the assert already checks the GENEVE option length, the assert looks
redundant.

This commit removes the unneeded GENEVE option length assert.

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

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ----
 1 file changed, 4 deletions(-)
  

Comments

Slava Ovsiienko Nov. 9, 2022, 7:27 a.m. UTC | #1
> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> Sent: Wednesday, November 9, 2022 3:40
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] net/mlx5: remove unneeded GENEVE option length assert
> 
> In order to share flow items translate code, flow items translation of spec
> and mask was split individually.
> 
> In that case, the assert for GENEVE option length with mask becomes invalid,
> since the length in mask is bitmask. And as memcpy around the assert already
> checks the GENEVE option length, the assert looks redundant.
> 
> This commit removes the unneeded GENEVE option length assert.
> 
> 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>
  
Raslan Darawsheh Nov. 9, 2022, 8:26 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> Sent: Wednesday, November 9, 2022 3:40 AM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] net/mlx5: remove unneeded GENEVE option length assert
> 
> In order to share flow items translate code, flow items translation of spec
> and mask was split individually.
> 
> In that case, the assert for GENEVE option length with mask becomes invalid,
> since the length in mask is bitmask. And as memcpy around the assert
> already checks the GENEVE option length, the assert looks redundant.
> 
> This commit removes the unneeded GENEVE option length assert.
> 
> Fixes: cd4ab742064a ("net/mlx5: split flow item matcher and value
> translation")
> 
> Signed-off-by: Suanming Mou <suanmingm@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 acd7ea8b79..7808a28787 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -9616,13 +9616,9 @@  flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key,
 		memcpy(&opt_data_key, data,
 			RTE_MIN((uint32_t)(geneve_opt_v->option_len * 4),
 				sizeof(opt_data_key)));
-		MLX5_ASSERT((uint32_t)(geneve_opt_v->option_len * 4) <=
-				sizeof(opt_data_key));
 		memcpy(&opt_data_mask, geneve_opt_m->data,
 			RTE_MIN((uint32_t)(geneve_opt_v->option_len * 4),
 				sizeof(opt_data_mask)));
-		MLX5_ASSERT((uint32_t)(geneve_opt_v->option_len * 4) <=
-				sizeof(opt_data_mask));
 		MLX5_SET(fte_match_set_misc3, misc3_v,
 				geneve_tlv_option_0_data,
 			rte_be_to_cpu_32(opt_data_key & opt_data_mask));