Skip to content

Commit

Permalink
net/mlx5: fix flex item header length translation
Browse files Browse the repository at this point in the history
[ upstream commit 7bda5be ]

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.

Fixes: b293e8e ("net/mlx5: translate flex item configuration")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
getelson-at-mellanox authored and kevintraynor committed Mar 8, 2022
1 parent 80f0ecc commit 49180a4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/net/mlx5/mlx5_flow_flex.c
Expand Up @@ -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,
Expand Down

0 comments on commit 49180a4

Please sign in to comment.