net/mlx5: fix error notification for large patterns
Checks
Commit Message
HWS has limited resources to translate flow pattern.
When pattern translation does not fit STE, HWS translation fails with
E2BIG error.
The patch verifies that the E2BIG error value is kept during flow
error notification.
Fixes: e38776c36c8a ("net/mlx5: introduce HWS for non-template flow API")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_bwc.c | 2 +-
drivers/net/mlx5/mlx5_flow_hw.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
Comments
Hi,
On 06/05/2025 4:31 PM, Gregory Etelson wrote:
> HWS has limited resources to translate flow pattern.
> When pattern translation does not fit STE, HWS translation fails with
> E2BIG error.
>
> The patch verifies that the E2BIG error value is kept during flow
> error notification.
>
> Fixes: e38776c36c8a ("net/mlx5: introduce HWS for non-template flow API")
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Patch applied to next-net-mlx,
@@ -137,7 +137,7 @@ mlx5dr_bwc_matcher_create(struct mlx5dr_table *table,
bwc_matcher->num_of_at,
&attr);
if (!bwc_matcher->matcher) {
- rte_errno = EINVAL;
+ /* rte_errno must be set */
goto free_at;
}
@@ -13894,7 +13894,7 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev,
if (sub_error.type != RTE_FLOW_ERROR_TYPE_NONE)
rte_memcpy(error, &sub_error, sizeof(sub_error));
}
- return rte_flow_error_set(error, ENOMEM,
+ return rte_flow_error_set(error, rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, "fail to register matcher");
}
@@ -14070,8 +14070,12 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type,
goto error;
}
ret = flow_hw_register_matcher(dev, attr, items, external, *flow, &matcher, error);
- if (ret)
+ if (ret) {
+ if (rte_errno == E2BIG)
+ rte_flow_error_set(error, E2BIG, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+ "flow pattern is too big");
goto error;
+ }
/*
* ASO allocation – iterating on actions list to allocate missing resources.