[PATCH 0/9] net/mlx5: lazily allocate HWS actions

Raslan Darawsheh rasland at nvidia.com
Mon Mar 2 12:22:22 CET 2026


Hi,


On 25/02/2026 1:59 PM, Dariusz Sosnowski wrote:
> In mlx5 PMD, HWS flow engine is configured either:
> 
> - implicitly on port start or
> - explicitly on rte_flow_configure().
> 
> As part of flow engine configuration, PMD allocates a set of global
> HWS action objects. These are used to implement flow actions such as:
> 
> - DROP
> - MARK and FLAG (HWS tag action)
> - OF_PUSH_VLAN
> - OF_POP_VLAN
> - SEND_TO_KERNEL
> - NAT64
> - PORT_REPRESENTOR (HWS default miss action).
> 
> These actions can be allocated once, for each flow domain,
> and parametrized on runtime.
> Allocation of these actions requires allocation of STCs,
> HW objects used to set up HW actions.
> These STCs are allocated in bulk to reduce amount of syscalls needed.
> 
> In case of global actions listed above, these STCs were allocated always
> even if none of the related flow actions were used by the application.
> This caused unnecessary system memory usage which could reach 4 MB per port.
> On systems with multiple VFs/SFs, memory usage could reach couple of GBs.
> 
> This patchset addresses that by introducing lazy allocation of these actions:
> 
> - Patch 1 - Redefines mlx5dr_action_mh_pattern to use rte_be64_t instead of __be64.
>    This is to prevent compilation issues when mlx5dr.h is included in new files.
> - Patch 2 - Add helpers for translating HWS flow table type to HWS action flags
>    used on allocation to simplify logic added in follow up patches.
> - Patch 3 - Introduces dedicated internal interface for lazily allocating
>    HWS actions. Drop action is handled first.
> - Patch 4-9 - Each patch adjusts one action type to use lazy allocation.
> 
> Dariusz Sosnowski (9):
>    net/mlx5: use DPDK be64 type in modify header pattern
>    net/mlx5/hws: add table type to action flags conversion
>    net/mlx5: lazily allocate drop HWS action
>    net/mlx5: lazily allocate tag HWS action
>    net/mlx5: lazily allocate HWS pop VLAN action
>    net/mlx5: lazily allocate HWS push VLAN action
>    net/mlx5: lazily allocate HWS send to kernel action
>    net/mlx5: lazily allocate HWS NAT64 action
>    net/mlx5: lazily allocate HWS default miss action
> 
>   drivers/net/mlx5/hws/mlx5dr.h              |  19 +-
>   drivers/net/mlx5/hws/mlx5dr_action.c       |  26 +-
>   drivers/net/mlx5/hws/mlx5dr_pat_arg.c      |  20 +-
>   drivers/net/mlx5/hws/mlx5dr_pat_arg.h      |   8 +-
>   drivers/net/mlx5/hws/mlx5dr_table.c        |  75 +++
>   drivers/net/mlx5/meson.build               |   1 +
>   drivers/net/mlx5/mlx5.h                    |  21 +-
>   drivers/net/mlx5/mlx5_flow.h               |   1 +
>   drivers/net/mlx5/mlx5_flow_dv.c            |   2 +-
>   drivers/net/mlx5/mlx5_flow_hw.c            | 557 ++++++---------------
>   drivers/net/mlx5/mlx5_hws_global_actions.c | 273 ++++++++++
>   drivers/net/mlx5/mlx5_hws_global_actions.h |  71 +++
>   12 files changed, 611 insertions(+), 463 deletions(-)
>   create mode 100644 drivers/net/mlx5/mlx5_hws_global_actions.c
>   create mode 100644 drivers/net/mlx5/mlx5_hws_global_actions.h
> 
> --
> 2.47.3
> 


Series applied to next-net-mlx,

Kindest regards
Raslan Darawsheh



More information about the dev mailing list