net/mlx5: fix the masked value for a rule for sync API
PATCH 2/2 net/mlx5: fix the masked value for a rule for sync API
When inserting a rule via HWS synchronous API, the underlayer implementaiton is a bit different from HWS. The template(async) API calls are re-used. In the template API definition, the user should ensure that there is no value bit that is not masked by the template.
In the legacy SWS synchronous API, when translating the item, if a mask is provided together with the spec. The value is the result of the spec OP-AND mask. If no mask, a default mask with all 1s are used and the value of the spec remain the original input.
By introducing the new logic to do the OP-AND and duplicate the items from the input in the rte_flow layer. The spec field will be with the correct value after inline OP-AND calculating. The rule will be inserted with proper value as expected by the user.
---
Depends-on: patch-158854("lib/ethdev: support inline calculating masked item value")
--- drivers/net/mlx5/mlx5_flow.h | 2 ++ drivers/net/mlx5/mlx5_flow_hw.c | 43 ++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1945,6 +1945,8 @@ struct mlx5_flow_workspace {/* The final policy when meter policy is hierarchy. */ #ifdef HAVE_MLX5_HWS_SUPPORT struct rte_flow_template_table *table; +struct rte_flow_item *masked_items; +size_t masked_items_size;#endif uint32_t skip_matcher_reg:1;/* Indicates if need to skip matcher register in translate. */
drivers/net/mlx5/mlx5_flow_hw.c +42 -1
61 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 16 lines · On Mon, 17 Nov 2025 10:09:42 +0200 Bing Zhao <[email protected]> wrote:
When inserting a rule via HWS synchronous API, the underlayer implementaiton is a bit different from HWS. The template(async) API calls are re-used. In the template API definition, the user should ensure that there is no value bit that is not masked by the template.
In the legacy SWS synchronous API, when translating the item, if a mask is provided together with the spec. The value is the result of the spec OP-AND mask. If no mask, a default mask with all 1s are used and the value of the spec remain the original input.
By introducing the new logic to do the OP-AND and duplicate the items from the input in the
rte_flowlayer. The spec field will be with the correct value after inline OP-AND calculating. The rule will be inserted with proper value as expected by the user.
Quoted 6 lines
Fixes e38776c36c8a ("net/mlx5: introduce HWS for non-template flow API")Signed-off-by Bing Zhao <[email protected]>---
Depends-on: patch-158854("lib/ethdev: support inline calculating masked item value")
Please don't use depends-on if possible, since CI system doesn't really support it.