net/mlx5: fix flex item header length translation

Message ID 20220301122825.32056-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix flex item header length translation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
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
ci/iol-abi-testing success Testing PASS

Commit Message

Gregory Etelson March 1, 2022, 12:28 p.m. UTC
  Flex item API provides support for network header with a fixed and
variable lengths.
When PMD compiles a new flex item object configuration it converts
RTE parameters into matching PMD PARSE_GRAPH parameters and checks
the parameter values against port capabilities.

Current implementation mismatched PARSE_GRAPH configuration fields
for the fixed size header.

Cc: stable@dpdk.org

Fixes: b293e8e49d78 ("net/mlx5: translate flex item configuration")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_flex.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
  

Comments

Raslan Darawsheh March 2, 2022, 4:34 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Tuesday, March 1, 2022 2:28 PM
> To: dev@dpdk.org
> Cc: Gregory Etelson <getelson@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org; Slava Ovsiienko <viacheslavo@nvidia.com>
> Subject: [PATCH] net/mlx5: fix flex item header length translation
> 
> Flex item API provides support for network header with a fixed and
> variable lengths.
> When PMD compiles a new flex item object configuration it converts
> RTE parameters into matching PMD PARSE_GRAPH parameters and checks
> the parameter values against port capabilities.
> 
> Current implementation mismatched PARSE_GRAPH configuration fields
> for the fixed size header.
> 
> Cc: stable@dpdk.org
> 
> Fixes: b293e8e49d78 ("net/mlx5: translate flex item configuration")
> Signed-off-by: Gregory Etelson <getelson@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_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c
index 26f0dfa36f..fb08910ddb 100644
--- a/drivers/net/mlx5/mlx5_flow_flex.c
+++ b/drivers/net/mlx5/mlx5_flow_flex.c
@@ -382,15 +382,11 @@  mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr,
 			return rte_flow_error_set
 				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
 				 "unsupported header length field mode (FIXED)");
-		if (attr->header_length_mask_width < field->field_size)
-			return rte_flow_error_set
-				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
-				 "header length field width exceeds limit");
-		if (field->offset_shift < 0 ||
-		    field->offset_shift > attr->header_length_mask_width)
+		if (field->field_size ||
+		    field->offset_mask || field->offset_shift)
 			return rte_flow_error_set
 				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
-				 "invalid header length field shift (FIXED");
+				 "invalid fields for fixed mode");
 		if (field->field_base < 0)
 			return rte_flow_error_set
 				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,