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: sta...@dpdk.org

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

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,
-- 
2.34.1

Reply via email to