mlx5 HW-Managed Flow Steering in FS core level
Subsystems (6)
Tariq Toukan
maintainerv2 cover mlx5 HW-Managed Flow Steering in FS core level
Hi,
This patchset by Moshe follows Yevgeny's patchsets [1][2] on subject "HW-Managed Flow Steering in mlx5 driver". As introduced there in HW managed Flow Steering mode (HWS) the driver is configuring steering rules directly to the HW using WQs with a special new type of WQE (Work Queue Element). This way we can reach higher rule insertion/deletion rate with much lower CPU utilization compared to SW Managed Flow Steering (SWS).
This patchset adds API to manage namespace, flow tables, flow groups and prepare FTE (Flow Table Entry) rules. It also adds caching and pool mechanisms for HWS actions to allow sharing of steering actions among different rules. The implementation of this API in FS layer, allows FS core to use HW Managed Flow Steering in addition to the existing FW or SW Managed Flow Steering.
Patch 13 of this series adds support for configuring HW Managed Flow Steering mode through devlink param, similar to configuring SW Managed Flow Steering mode:
# devlink dev param set pci/0000:08:00.0 name flow_steering_mode \
cmode runtime value hmfsIn addition, the series contains 2 HWS patches from Yevgeny that implement flow update support.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Regards,
Tariq
V2:
- Added two HWS patches to the series
- Added documentation on mlx5.rst
- Added prefix to static functions (Przemek Kitszel)
- Fixed returned error value and copyright year (Przemek Kitszel)
- Added missing braces (Przemek Kitszel)
- Added comma on enum definition (Przemek Kitszel)
Moshe Shemesh (13):
net/mlx5: fs, add HWS root namespace functions net/mlx5: fs, add HWS flow table API functions net/mlx5: fs, add HWS flow group API functions net/mlx5: fs, add HWS actions pool
net/mlx5: fs, add HWS packet reformat API function net/mlx5: fs, add HWS modify header API function net/mlx5: fs, manage flow counters HWS action sharing by refcount net/mlx5: fs, add dest table cache
net/mlx5: fs, add HWS fte API functions
net/mlx5: fs, add support for dest vport HWS action net/mlx5: fs, set create match definer to not supported by HWS net/mlx5: fs, add HWS get capabilities
net/mlx5: fs, add HWS to steering mode options
Yevgeny Kliteynik (2):
net/mlx5: HWS, update flow - remove the use of dual RTCs net/mlx5: HWS, update flow - support through bigger action RTC
Documentation/networking/devlink/mlx5.rst | 3 + .../net/ethernet/mellanox/mlx5/core/Makefile | 5 +- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 50 +- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 62 +- .../ethernet/mellanox/mlx5/core/fs_counters.c | 42 +- .../net/ethernet/mellanox/mlx5/core/fs_pool.c | 5 +- .../net/ethernet/mellanox/mlx5/core/fs_pool.h | 5 +- .../mellanox/mlx5/core/steering/hws/debug.c | 10 +- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 1377 +++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 80 + .../mlx5/core/steering/hws/fs_hws_pools.c | 450 ++++++ .../mlx5/core/steering/hws/fs_hws_pools.h | 73 + .../mlx5/core/steering/hws/internal.h | 1 - .../mellanox/mlx5/core/steering/hws/matcher.c | 180 +-- .../mellanox/mlx5/core/steering/hws/matcher.h | 8 +- .../mellanox/mlx5/core/steering/hws/rule.c | 141 +- .../mellanox/mlx5/core/steering/hws/rule.h | 16 +- .../mellanox/mlx5/core/steering/hws/send.c | 20 +- include/linux/mlx5/mlx5_ifc.h | 1 + 19 files changed, 2245 insertions(+), 284 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.h
base-commit: a3b3d2dc389568a77d0e25da17203e3616218e93
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 1/15 net/mlx5: fs, add HWS root namespace functions
From: Moshe Shemesh <[email protected]>
Add flow steering commands structure for HW steering. Implement create, destroy and set peer HW steering root namespace functions.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 4 +- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 9 ++- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 56 +++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 25 +++++++++ 4 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +2 -2
@@ -151,8 +151,8 @@ mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/cmd.o \ steering/hws/bwc.o \ steering/hws/debug.o \ steering/hws/vport.o \ - steering/hws/bwc_complex.o - + steering/hws/bwc_complex.o \ + steering/hws/fs_hws.o # # SF device
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +7 -2
@@ -38,6 +38,7 @@#include <linux/rhashtable.h> #include <linux/llist.h> #include <steering/sws/fs_dr.h> +#include <steering/hws/fs_hws.h> #define FDB_TC_MAX_CHAIN 3#define FDB_FT_CHAIN (FDB_TC_MAX_CHAIN + 1)
@@ -126,7 +127,8 @@ enum fs_fte_status {enum mlx5_flow_steering_mode {MLX5_FLOW_STEERING_MODE_DMFS , -MLX5_FLOW_STEERING_MODE_SMFS +MLX5_FLOW_STEERING_MODE_SMFS , +MLX5_FLOW_STEERING_MODE_HMFS , };enum mlx5_flow_steering_capabilty {
@@ -293,7 +295,10 @@ struct mlx5_flow_group {struct mlx5_flow_root_namespace {struct mlx5_flow_namespace ns;enum mlx5_flow_steering_mode mode; -struct mlx5_fs_dr_domain fs_dr_domain; +union { +struct mlx5_fs_dr_domain fs_dr_domain; +struct mlx5_fs_hws_context fs_hws_context; + };enum fs_flow_table_type table_type;struct mlx5_core_dev *dev;struct mlx5_flow_table *root_ft;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c new file +56 -0
56 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2025 NVIDIA Corporation & Affiliates */ + +#ifndef _MLX5_FS_HWS_ +#define _MLX5_FS_HWS_ + +#include "mlx5hws.h" + +struct mlx5_fs_hws_context { +struct mlx5hws_context *hws_ctx; +}; + +#ifdef CONFIG_MLX5_HW_STEERING + +const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void ); + +#else + +static inline const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void ) +{ +return NULL ; +} + +#endif /* CONFIG_MLX5_HWS_STEERING */ +#endif
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 2/15 net/mlx5: fs, add HWS flow table API functions
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add API functions to create, modify and destroy HW Steering flow tables. Modify table enables change, connect or disconnect default miss table. Add update root flow table API function.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 5 +- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 113 ++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 5 + 3 files changed, 122 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +4 -1
@@ -192,7 +192,10 @@ struct mlx5_flow_handle {/* Type of children is mlx5_flow_group */ struct mlx5_flow_table {struct fs_node node; -struct mlx5_fs_dr_table fs_dr_table; +union { +struct mlx5_fs_dr_table fs_dr_table; +struct mlx5_fs_hws_table fs_hws_table; + };u32 id;u16 vport;unsigned int max_fte;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +113 -0
120 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +5 -0
@@ -10,6 +10,11 @@ struct mlx5_fs_hws_context {struct mlx5hws_context *hws_ctx; }; +struct mlx5_fs_hws_table { +struct mlx5hws_table *hws_table; +bool miss_ft_set; +}; +#ifdef CONFIG_MLX5_HW_STEERING const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void );
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 3/15 net/mlx5: fs, add HWS flow group API functions
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add API functions to create and destroy HW Steering flow groups. Each flow group consists of a Backward Compatible (BWC) HW Steering matcher which holds the flow group match criteria.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 5 ++- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 42 +++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 4 ++ 3 files changed, 50 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +4 -1
@@ -285,7 +285,10 @@ struct mlx5_flow_group_mask {/* Type of children is fs_fte */ struct mlx5_flow_group {struct fs_node node; -struct mlx5_fs_dr_matcher fs_dr_matcher; +union { +struct mlx5_fs_dr_matcher fs_dr_matcher; +struct mlx5_fs_hws_matcher fs_hws_matcher; + };struct mlx5_flow_group_mask mask;u32 start_index;u32 max_ftes;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +42 -0
53 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +4 -0
@@ -15,6 +15,10 @@ struct mlx5_fs_hws_table {bool miss_ft_set; }; +struct mlx5_fs_hws_matcher { +struct mlx5hws_bwc_matcher *matcher; +}; +#ifdef CONFIG_MLX5_HW_STEERING const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void );
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 4/15 net/mlx5: fs, add HWS actions pool
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
The HW Steering actions pool will help utilize the option in HW Steering to share steering actions among different rules.
Create pool on root namespace creation and add few HW Steering actions that don't depend on the steering rule itself and thus can be shared between rules, created on same namespace: tag, pop_vlan, push_vlan, drop, decap l2.
--- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 58 +++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 9 +++ 2 files changed, 67 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +58 -0
@@ -9,9 +9,60 @@#define MLX5HWS_CTX_MAX_NUM_OF_QUEUES 16#define MLX5HWS_CTX_QUEUE_SIZE 256 +static int mlx5_fs_init_hws_actions_pool (struct mlx5_fs_hws_context *fs_ctx) +{ +u32 flags =MLX5HWS_ACTION_FLAG_HWS_FDB |MLX5HWS_ACTION_FLAG_SHARED ; +struct mlx5_fs_hws_actions_pool *hws_pool = &fs_ctx->hws_pool; +struct mlx5hws_action_reformat_header reformat_hdr = {}; +struct mlx5hws_context *ctx = fs_ctx->hws_ctx; +enum mlx5hws_action_type action_type; + + hws_pool->tag_action =mlx5hws_action_create_tag (ctx, flags); +if (!hws_pool->tag_action) +return -ENOSPC ; + hws_pool->pop_vlan_action =mlx5hws_action_create_pop_vlan (ctx, flags); +if (!hws_pool->pop_vlan_action) + goto destroy_tag; + hws_pool->push_vlan_action =mlx5hws_action_create_push_vlan (ctx, flags); +if (!hws_pool->push_vlan_action) + goto destroy_pop_vlan; + hws_pool->drop_action =mlx5hws_action_create_dest_drop (ctx, flags); +if (!hws_pool->drop_action) + goto destroy_push_vlan; + action_type =MLX5HWS_ACTION_TYP_REFORMAT_TNL_L2_TO_L2 ; + hws_pool->decapl2_action = +mlx5hws_action_create_reformat (ctx, action_type,1 , + &reformat_hdr,0 , flags); +if (!hws_pool->decapl2_action) + goto destroy_drop; +return 0 ; + +destroy_drop: +mlx5hws_action_destroy (hws_pool->drop_action); +destroy_push_vlan: +mlx5hws_action_destroy (hws_pool->push_vlan_action); +destroy_pop_vlan: +mlx5hws_action_destroy (hws_pool->pop_vlan_action); +destroy_tag: +mlx5hws_action_destroy (hws_pool->tag_action); +return -ENOSPC ; +} + +static void mlx5_fs_cleanup_hws_actions_pool (struct mlx5_fs_hws_context *fs_ctx) +{ +struct mlx5_fs_hws_actions_pool *hws_pool = &fs_ctx->hws_pool; + +mlx5hws_action_destroy (hws_pool->decapl2_action); +mlx5hws_action_destroy (hws_pool->drop_action); +mlx5hws_action_destroy (hws_pool->push_vlan_action); +mlx5hws_action_destroy (hws_pool->pop_vlan_action); +mlx5hws_action_destroy (hws_pool->tag_action); +} +static int mlx5_cmd_hws_create_ns (struct mlx5_flow_root_namespace *ns) {struct mlx5hws_context_attr hws_ctx_attr = {}; +int err; hws_ctx_attr.queues =min_t (int,num_online_cpus (),MLX5HWS_CTX_MAX_NUM_OF_QUEUES );
@@ -23,11 +74,18 @@ static int mlx5_cmd_hws_create_ns(struct mlx5_flow_root_namespace *ns)mlx5_core_err (ns->dev,"Failed to create hws flow namespace\n" );return -EINVAL ; } + err =mlx5_fs_init_hws_actions_pool (&ns->fs_hws_context); +if (err) { +mlx5_core_err (ns->dev,"Failed to init hws actions pool\n" ); +mlx5hws_context_close (ns->fs_hws_context.hws_ctx); +return err; + }return 0 ; }static int mlx5_cmd_hws_destroy_ns (struct mlx5_flow_root_namespace *ns) { +mlx5_fs_cleanup_hws_actions_pool (&ns->fs_hws_context);return mlx5hws_context_close (ns->fs_hws_context.hws_ctx); }
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +9 -0
@@ -6,8 +6,17 @@#include "mlx5hws.h" +struct mlx5_fs_hws_actions_pool { +struct mlx5hws_action *tag_action; +struct mlx5hws_action *pop_vlan_action; +struct mlx5hws_action *push_vlan_action; +struct mlx5hws_action *drop_action; +struct mlx5hws_action *decapl2_action; +}; +struct mlx5_fs_hws_context {struct mlx5hws_context *hws_ctx; +struct mlx5_fs_hws_actions_pool hws_pool; };struct mlx5_fs_hws_table {
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 5/15 net/mlx5: fs, add HWS packet reformat API function
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add packet reformat alloc and dealloc API functions to provide packet reformat actions for steering rules.
Add HWS action pools for each of the following packet reformat types:
- decapl3: decapsulate l3 tunnel to l2
- encapl2: encapsulate l2 to tunnel l2
- encapl3: encapsulate l2 to tunnel l3
- insert_hdr: insert header
In addition cache remove header action for remove vlan header as this is currently the only use case of remove header action in the driver.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 1 + .../net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + .../ethernet/mellanox/mlx5/core/fs_counters.c | 5 +- .../net/ethernet/mellanox/mlx5/core/fs_pool.c | 5 +- .../net/ethernet/mellanox/mlx5/core/fs_pool.h | 5 +- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 293 +++++++++++++++++- .../mellanox/mlx5/core/steering/hws/fs_hws.h | 12 + .../mlx5/core/steering/hws/fs_hws_pools.c | 238 ++++++++++++++ .../mlx5/core/steering/hws/fs_hws_pools.h | 48 +++ include/linux/mlx5/mlx5_ifc.h | 1 + 10 files changed, 598 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -0
@@ -152,6 +152,7 @@ mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/cmd.o \ steering/hws/debug.o \ steering/hws/vport.o \ steering/hws/bwc_complex.o \ + steering/hws/fs_hws_pools.o \ steering/hws/fs_hws.o #
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +1 -0
@@ -75,6 +75,7 @@ struct mlx5_pkt_reformat {enum mlx5_flow_resource_owner owner;union {struct mlx5_fs_dr_action fs_dr_action; +struct mlx5_fs_hws_action fs_hws_action;u32 id; }; };
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c +3 -2
@@ -449,7 +449,8 @@ static void mlx5_fc_init(struct mlx5_fc *counter, struct mlx5_fc_bulk *bulk, counter->id = id; } -static struct mlx5_fs_bulk *mlx5_fc_bulk_create (struct mlx5_core_dev *dev) +static struct mlx5_fs_bulk *mlx5_fc_bulk_create (struct mlx5_core_dev *dev, +void *pool_ctx) {enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask;struct mlx5_fc_bulk *fc_bulk;
@@ -518,7 +519,7 @@ static const struct mlx5_fs_pool_ops mlx5_fc_pool_ops = {static void mlx5_fc_pool_init (struct mlx5_fs_pool *fc_pool,struct mlx5_core_dev *dev) { -mlx5_fs_pool_init (fc_pool, dev, &mlx5_fc_pool_ops); +mlx5_fs_pool_init (fc_pool, dev, &mlx5_fc_pool_ops,NULL ); }static void mlx5_fc_pool_cleanup (struct mlx5_fs_pool *fc_pool)
drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c +3 -2
@@ -56,11 +56,12 @@ static int mlx5_fs_bulk_release_index(struct mlx5_fs_bulk *fs_bulk, int index) }void mlx5_fs_pool_init (struct mlx5_fs_pool *pool,struct mlx5_core_dev *dev, -const struct mlx5_fs_pool_ops *ops) +const struct mlx5_fs_pool_ops *ops,void *pool_ctx) {WARN_ON_ONCE (!ops || !ops->bulk_destroy || !ops->bulk_create || !ops->update_threshold); pool->dev = dev; + pool->pool_ctx = pool_ctx;mutex_init (&pool->pool_lock);INIT_LIST_HEAD (&pool->fully_used);INIT_LIST_HEAD (&pool->partially_used);
@@ -91,7 +92,7 @@ mlx5_fs_pool_alloc_new_bulk(struct mlx5_fs_pool *fs_pool)struct mlx5_core_dev *dev = fs_pool->dev;struct mlx5_fs_bulk *new_bulk; - new_bulk = fs_pool->ops->bulk_create (dev); + new_bulk = fs_pool->ops->bulk_create (dev, fs_pool->pool_ctx);if (new_bulk) fs_pool->available_units += new_bulk->bulk_len; fs_pool->ops->update_threshold (fs_pool);
drivers/net/ethernet/mellanox/mlx5/core/fs_pool.h +3 -2
@@ -21,7 +21,8 @@ struct mlx5_fs_pool;struct mlx5_fs_pool_ops {int (*bulk_destroy)(struct mlx5_core_dev *dev,struct mlx5_fs_bulk *bulk); -struct mlx5_fs_bulk * (*bulk_create)(struct mlx5_core_dev *dev); +struct mlx5_fs_bulk * (*bulk_create)(struct mlx5_core_dev *dev, +void *pool_ctx);void (*update_threshold)(struct mlx5_fs_pool *pool); };
@@ -44,7 +45,7 @@ void mlx5_fs_bulk_cleanup(struct mlx5_fs_bulk *fs_bulk);int mlx5_fs_bulk_get_free_amount (struct mlx5_fs_bulk *bulk);void mlx5_fs_pool_init (struct mlx5_fs_pool *pool,struct mlx5_core_dev *dev, -const struct mlx5_fs_pool_ops *ops); +const struct mlx5_fs_pool_ops *ops,void *pool_ctx);void mlx5_fs_pool_cleanup (struct mlx5_fs_pool *pool);int mlx5_fs_pool_acquire_index (struct mlx5_fs_pool *fs_pool,struct mlx5_fs_pool_index *pool_index);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +288 -5
350 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +12 -0
@@ -5,6 +5,7 @@#define _MLX5_FS_HWS_#include "mlx5hws.h" +#include "fs_hws_pools.h" struct mlx5_fs_hws_actions_pool {struct mlx5hws_action *tag_action;
@@ -12,6 +13,11 @@ struct mlx5_fs_hws_actions_pool {struct mlx5hws_action *push_vlan_action;struct mlx5hws_action *drop_action;struct mlx5hws_action *decapl2_action; +struct mlx5hws_action *remove_hdr_vlan_action; +struct mlx5_fs_pool insert_hdr_pool; +struct mlx5_fs_pool dl3tnltol2_pool; +struct xarray el2tol3tnl_pools; +struct xarray el2tol2tnl_pools; };struct mlx5_fs_hws_context {
@@ -24,6 +30,12 @@ struct mlx5_fs_hws_table {bool miss_ft_set; }; +struct mlx5_fs_hws_action { +struct mlx5hws_action *hws_action; +struct mlx5_fs_pool *fs_pool; +struct mlx5_fs_hws_pr *pr_data; +}; +struct mlx5_fs_hws_matcher {struct mlx5hws_bwc_matcher *matcher; };
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c new file +238 -0
238 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.h new file +48 -0
48 lines not on this page · raw message
include/linux/mlx5/mlx5_ifc.h +1 -0
@@ -7025,6 +7025,7 @@ struct mlx5_ifc_alloc_packet_reformat_context_out_bits {enum {MLX5_REFORMAT_CONTEXT_ANCHOR_MAC_START =0x1 , +MLX5_REFORMAT_CONTEXT_ANCHOR_VLAN_START =0x2 ,MLX5_REFORMAT_CONTEXT_ANCHOR_IP_START =0x7 ,MLX5_REFORMAT_CONTEXT_ANCHOR_TCP_UDP_START =0x9 , };
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 6/15 net/mlx5: fs, add HWS modify header API function
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add modify header alloc and dealloc API functions to provide modify header actions for steering rules. Use fs hws pools to get actions from shared bulks of modify header actions.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 1 + .../mellanox/mlx5/core/steering/hws/fs_hws.c | 120 +++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 2 + .../mlx5/core/steering/hws/fs_hws_pools.c | 165 ++++++++++++++++++ .../mlx5/core/steering/hws/fs_hws_pools.h | 22 +++ 5 files changed, 310 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +1 -0
@@ -65,6 +65,7 @@ struct mlx5_modify_hdr {enum mlx5_flow_resource_owner owner;union {struct mlx5_fs_dr_action fs_dr_action; +struct mlx5_fs_hws_action fs_hws_action;u32 id; }; };
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +120 -0
150 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +2 -0
@@ -18,6 +18,7 @@ struct mlx5_fs_hws_actions_pool {struct mlx5_fs_pool dl3tnltol2_pool;struct xarray el2tol3tnl_pools;struct xarray el2tol2tnl_pools; +struct xarray mh_pools; };struct mlx5_fs_hws_context {
@@ -34,6 +35,7 @@ struct mlx5_fs_hws_action {struct mlx5hws_action *hws_action;struct mlx5_fs_pool *fs_pool;struct mlx5_fs_hws_pr *pr_data; +struct mlx5_fs_hws_mh *mh_data; };struct mlx5_fs_hws_matcher {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c +165 -0
168 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.h +22 -0
@@ -36,6 +36,19 @@ struct mlx5_fs_hws_pr_pool_ctx {size_t encap_data_size; }; +struct mlx5_fs_hws_mh { +struct mlx5_fs_hws_mh_bulk *bulk; +u32 offset; +u8 *data; +}; + +struct mlx5_fs_hws_mh_bulk { +struct mlx5_fs_bulk fs_bulk; +struct mlx5_fs_pool *mh_pool; +struct mlx5hws_action *hws_action; +struct mlx5_fs_hws_mh mhs_data[]; +}; +int mlx5_fs_hws_pr_pool_init (struct mlx5_fs_pool *pr_pool,struct mlx5_core_dev *dev,size_t encap_data_size,enum mlx5hws_action_type reformat_type);
@@ -45,4 +58,13 @@ struct mlx5_fs_hws_pr *mlx5_fs_hws_pr_pool_acquire_pr(struct mlx5_fs_pool *pr_povoid mlx5_fs_hws_pr_pool_release_pr (struct mlx5_fs_pool *pr_pool,struct mlx5_fs_hws_pr *pr_data);struct mlx5hws_action *mlx5_fs_hws_pr_get_action (struct mlx5_fs_hws_pr *pr_data); +int mlx5_fs_hws_mh_pool_init (struct mlx5_fs_pool *fs_hws_mh_pool, +struct mlx5_core_dev *dev, +struct mlx5hws_action_mh_pattern *pattern); +void mlx5_fs_hws_mh_pool_cleanup (struct mlx5_fs_pool *fs_hws_mh_pool); +struct mlx5_fs_hws_mh *mlx5_fs_hws_mh_pool_acquire_mh (struct mlx5_fs_pool *mh_pool); +void mlx5_fs_hws_mh_pool_release_mh (struct mlx5_fs_pool *mh_pool, +struct mlx5_fs_hws_mh *mh_data); +bool mlx5_fs_hws_mh_pool_match (struct mlx5_fs_pool *mh_pool, +struct mlx5hws_action_mh_pattern *pattern);#endif /* __MLX5_FS_HWS_POOLS_H__ */
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 7/15 net/mlx5: fs, manage flow counters HWS action sharing by refcount
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Multiple flow counters can utilize a single Hardware Steering (HWS) action for Hardware Steering rules. Given that these counter bulks are not exclusively created for Hardware Steering, but also serve purposes such as statistics gathering and other steering modes, it's more efficient to create the HWS action only when it's first needed by a Hardware Steering rule. This approach allows for better resource management through the use of a reference count, rather than automatically creating an HWS action for every bulk of flow counters.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 36 ++++++++++++++ .../ethernet/mellanox/mlx5/core/fs_counters.c | 37 ++++----------- .../mlx5/core/steering/hws/fs_hws_pools.c | 47 +++++++++++++++++++ .../mlx5/core/steering/hws/fs_hws_pools.h | 3 ++ 4 files changed, 94 insertions(+), 29 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +36 -0
@@ -316,6 +316,42 @@ struct mlx5_flow_root_namespace {const struct mlx5_flow_cmds *cmds; }; +enum mlx5_fc_type { +MLX5_FC_TYPE_ACQUIRED =0 , +MLX5_FC_TYPE_LOCAL , +}; + +struct mlx5_fc_cache { +u64 packets; +u64 bytes; +u64 lastuse; +}; + +struct mlx5_fc { +u32 id; +bool aging; +enum mlx5_fc_type type; +struct mlx5_fc_bulk *bulk; +struct mlx5_fc_cache cache; +/* last{packets,bytes} are used for calculating deltas since last reading. */ +u64 lastpackets; +u64 lastbytes; +}; + +struct mlx5_fc_bulk_hws_data { +struct mlx5hws_action *hws_action; +struct mutex lock;/* protects hws_action */ +refcount_t hws_action_refcount; +}; + +struct mlx5_fc_bulk { +struct mlx5_fs_bulk fs_bulk; +u32 base_id; +struct mlx5_fc_bulk_hws_data hws_data; +struct mlx5_fc fcs[]; +}; + +u32 mlx5_fc_get_base_id (struct mlx5_fc *counter);int mlx5_init_fc_stats (struct mlx5_core_dev *dev);void mlx5_cleanup_fc_stats (struct mlx5_core_dev *dev); void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c +8 -29
@@ -44,28 +44,6 @@#define MLX5_FC_POOL_MAX_THRESHOLD BIT(18)#define MLX5_FC_POOL_USED_BUFF_RATIO 10 -enum mlx5_fc_type { -MLX5_FC_TYPE_ACQUIRED =0 , -MLX5_FC_TYPE_LOCAL , -}; - -struct mlx5_fc_cache { -u64 packets; -u64 bytes; -u64 lastuse; -}; - -struct mlx5_fc { -u32 id; -bool aging; -enum mlx5_fc_type type; -struct mlx5_fc_bulk *bulk; -struct mlx5_fc_cache cache; -/* last{packets,bytes} are used for calculating deltas since last reading. */ -u64 lastpackets; -u64 lastbytes; -}; -struct mlx5_fc_stats {struct xarray counters;
@@ -434,13 +412,7 @@ void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev, fc_stats->sampling_interval); } -/* Flow counter bluks */ - -struct mlx5_fc_bulk { -struct mlx5_fs_bulk fs_bulk; -u32 base_id; -struct mlx5_fc fcs[]; -}; +/* Flow counter bulks */ static void mlx5_fc_init (struct mlx5_fc *counter,struct mlx5_fc_bulk *bulk,u32 id)
@@ -449,6 +421,11 @@ static void mlx5_fc_init(struct mlx5_fc *counter, struct mlx5_fc_bulk *bulk, counter->id = id; } +u32 mlx5_fc_get_base_id (struct mlx5_fc *counter) +{ +return counter->bulk->base_id; +} +static struct mlx5_fs_bulk *mlx5_fc_bulk_create (struct mlx5_core_dev *dev,void *pool_ctx) {
@@ -474,6 +451,8 @@ static struct mlx5_fs_bulk *mlx5_fc_bulk_create(struct mlx5_core_dev *dev,for (i =0 ; i < bulk_len; i++)mlx5_fc_init (&fc_bulk->fcs[i], fc_bulk, base_id + i); +refcount_set (&fc_bulk->hws_data.hws_action_refcount,0 ); +mutex_init (&fc_bulk->hws_data.lock);return &fc_bulk->fs_bulk; fs_bulk_cleanup:
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c +47 -0
50 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.h +3 -0
@@ -67,4 +67,7 @@ void mlx5_fs_hws_mh_pool_release_mh(struct mlx5_fs_pool *mh_pool, struct mlx5_fs_hws_mh *mh_data);bool mlx5_fs_hws_mh_pool_match (struct mlx5_fs_pool *mh_pool,struct mlx5hws_action_mh_pattern *pattern); +struct mlx5hws_action *mlx5_fc_get_hws_action (struct mlx5hws_context *ctx, +struct mlx5_fc *counter); +void mlx5_fc_put_hws_action (struct mlx5_fc *counter);#endif /* __MLX5_FS_HWS_POOLS_H__ */
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 8/15 net/mlx5: fs, add dest table cache
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add cache of destination flow table HWS action per HWS table. For each flow table created cache a destination action towards this table. The cached action will be used on the downstream patch whenever a rule requires such action.
--- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 68 ++++++++++++++++++- .../mellanox/mlx5/core/steering/hws/fs_hws.h | 1 + 2 files changed, 66 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +65 -3
@@ -62,6 +62,7 @@ static int mlx5_fs_init_hws_actions_pool(struct mlx5_core_dev *dev,xa_init (&hws_pool->el2tol3tnl_pools);xa_init (&hws_pool->el2tol2tnl_pools);xa_init (&hws_pool->mh_pools); +xa_init (&hws_pool->table_dests);return 0 ; cleanup_insert_hdr:
@@ -87,6 +88,7 @@ static void mlx5_fs_cleanup_hws_actions_pool(struct mlx5_fs_hws_context *fs_ctx)struct mlx5_fs_pool *pool;unsigned long i; +xa_destroy (&hws_pool->table_dests);xa_for_each (&hws_pool->mh_pools, i, pool)mlx5_fs_destroy_mh_pool (pool, &hws_pool->mh_pools, i);xa_destroy (&hws_pool->mh_pools);
@@ -173,6 +175,50 @@ static int mlx5_fs_set_ft_default_miss(struct mlx5_flow_root_namespace *ns,return 0 ; } +static int mlx5_fs_add_flow_table_dest_action (struct mlx5_flow_root_namespace *ns, +struct mlx5_flow_table *ft) +{ +u32 flags =MLX5HWS_ACTION_FLAG_HWS_FDB |MLX5HWS_ACTION_FLAG_SHARED ; +struct mlx5_fs_hws_context *fs_ctx = &ns->fs_hws_context; +struct mlx5hws_action *dest_ft_action; +struct xarray *dests_xa; +int err; + + dest_ft_action =mlx5hws_action_create_dest_table_num (fs_ctx->hws_ctx, + ft->id, flags); +if (!dest_ft_action) { +mlx5_core_err (ns->dev,"Failed creating dest table action\n" ); +return -ENOMEM ; + } + + dests_xa = &fs_ctx->hws_pool.table_dests; + err =xa_insert (dests_xa, ft->id, dest_ft_action,GFP_KERNEL ); +if (err) +mlx5hws_action_destroy (dest_ft_action); +return err; +} + +static int mlx5_fs_del_flow_table_dest_action (struct mlx5_flow_root_namespace *ns, +struct mlx5_flow_table *ft) +{ +struct mlx5_fs_hws_context *fs_ctx = &ns->fs_hws_context; +struct mlx5hws_action *dest_ft_action; +struct xarray *dests_xa; +int err; + + dests_xa = &fs_ctx->hws_pool.table_dests; + dest_ft_action =xa_erase (dests_xa, ft->id); +if (!dest_ft_action) { +mlx5_core_err (ns->dev,"Failed to erase dest ft action\n" ); +return -ENOENT ; + } + + err =mlx5hws_action_destroy (dest_ft_action); +if (err) +mlx5_core_err (ns->dev,"Failed to destroy dest ft action\n" ); +return err; +} + static int mlx5_cmd_hws_create_flow_table(struct mlx5_flow_root_namespace *ns, struct mlx5_flow_table *ft, struct mlx5_flow_table_attr *ft_attr,
@@ -183,9 +229,16 @@ static int mlx5_cmd_hws_create_flow_table(struct mlx5_flow_root_namespace *ns,struct mlx5hws_table *tbl;int err; -if (mlx5_fs_cmd_is_fw_term_table (ft)) -return mlx5_fs_cmd_get_fw_cmds ()->create_flow_table (ns, ft, ft_attr, - next_ft); +if (mlx5_fs_cmd_is_fw_term_table (ft)) { + err =mlx5_fs_cmd_get_fw_cmds ()->create_flow_table (ns, ft, ft_attr, + next_ft); +if (err) +return err; + err =mlx5_fs_add_flow_table_dest_action (ns, ft); +if (err) +mlx5_fs_cmd_get_fw_cmds ()->destroy_flow_table (ns, ft); +return err; + }if (ns->table_type !=FS_FT_FDB ) { mlx5_core_err(ns->dev, "Table type %d not supported for HWS\n",
@@ -212,8 +265,13 @@ static int mlx5_cmd_hws_create_flow_table(struct mlx5_flow_root_namespace *ns, ft->max_fte =INT_MAX ; + err =mlx5_fs_add_flow_table_dest_action (ns, ft); +if (err) + goto clear_ft_miss;return 0 ; +clear_ft_miss: +mlx5_fs_set_ft_default_miss (ns, ft,NULL ); destroy_table:mlx5hws_table_destroy (tbl); ft->fs_hws_table.hws_table =NULL ;
@@ -225,6 +283,10 @@ static int mlx5_cmd_hws_destroy_flow_table(struct mlx5_flow_root_namespace *ns, {int err; + err =mlx5_fs_del_flow_table_dest_action (ns, ft); +if (err) +mlx5_core_err (ns->dev,"Failed to remove dest action (%d)\n" , err); +if (mlx5_fs_cmd_is_fw_term_table (ft))return mlx5_fs_cmd_get_fw_cmds ()->destroy_flow_table (ns, ft);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +1 -0
@@ -19,6 +19,7 @@ struct mlx5_fs_hws_actions_pool {struct xarray el2tol3tnl_pools;struct xarray el2tol2tnl_pools;struct xarray mh_pools; +struct xarray table_dests; };struct mlx5_fs_hws_context {
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 9/15 net/mlx5: fs, add HWS fte API functions
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add create, destroy and update fte API functions for adding, removing and updating flow steering rules in HW Steering mode. Get HWS actions according to required rule, use actions from pool whenever possible.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 5 +- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 549 ++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 13 + 3 files changed, 566 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +4 -1
@@ -254,7 +254,10 @@ struct fs_fte_dup {/* Type of children is mlx5_flow_rule */ struct fs_fte {struct fs_node node; -struct mlx5_fs_dr_rule fs_dr_rule; +union { +struct mlx5_fs_dr_rule fs_dr_rule; +struct mlx5_fs_hws_rule fs_hws_rule; + };u32 val[MLX5_ST_SZ_DW_MATCH_PARAM ];struct fs_fte_action act_dests;struct fs_fte_dup *dup;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +549 -0
561 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +13 -0
@@ -43,6 +43,19 @@ struct mlx5_fs_hws_matcher {struct mlx5hws_bwc_matcher *matcher; }; +struct mlx5_fs_hws_rule_action { +struct mlx5hws_action *action; +union { +struct mlx5_fc *counter; + }; +}; + +struct mlx5_fs_hws_rule { +struct mlx5hws_bwc_rule *bwc_rule; +struct mlx5_fs_hws_rule_action *hws_fs_actions; +int num_fs_actions; +}; +#ifdef CONFIG_MLX5_HW_STEERING const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void );
Signature · 1 line
2.45.0
Re: [PATCH net-next V2 09/15] net/mlx5: fs, add HWS fte API functions
Quoted 10 lines · Tariq Toukan
From: Moshe Shemesh <[email protected]>
Add create, destroy and update fte API functions for adding, removing and updating flow steering rules in HW Steering mode. Get HWS actions according to required rule, use actions from pool whenever possible.
Signed-off-by Moshe Shemesh <[email protected]>Reviewed-by Yevgeny Kliteynik <[email protected]>Reviewed-by Mark Bloch <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Quoted 6 lines
--- .../net/ethernet/mellanox/mlx5/core/fs_core.h | 5 +- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 549 ++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 13 + 3 files changed, 566 insertions(+), 1 deletion(-)
side note: there is an option for git to put .h files before .c files in the diff (and thus in the send email), you can plug a git orderfile:./scripts/git.orderFile
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c static int mlx5_cmd_hws_destroy_flow_group(struct mlx5_flow_root_namespace *ns, · line 593
Quoted 11 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +11
-0+if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_POP ) { + tmp_action =mlx5_fs_get_action_pop_vlan (fs_ctx); +if (!tmp_action) { + err = -ENOMEM ; + goto free_actions; + } + (*ractions)[num_actions++].action = tmp_action; + } + +if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 ) { + tmp_action =mlx5_fs_get_action_pop_vlan (fs_ctx);
It's not clear if this was a typo/ommision of second pop impl, or it is expected to just work (this get_action_pop_vlan() helper returns precomputed action command, that has no link to prev action, so hard to tell).
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (!tmp_action) { + err = -ENOMEM;
I would use -E2BIG for cases like that
Quoted 43 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +43
-0+ goto free_actions; + } + (*ractions)[num_actions++].action = tmp_action; + } + +if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ) { + mh_data = fte_action->modify_hdr->fs_hws_action.mh_data; + (*ractions)[num_actions].modify_header.offset = mh_data->offset; + (*ractions)[num_actions].modify_header.data = mh_data->data; + (*ractions)[num_actions++].action = + fte_action->modify_hdr->fs_hws_action.hws_action; + } + +if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH ) { + tmp_action =mlx5_fs_get_action_push_vlan (fs_ctx); +if (!tmp_action) { + err = -ENOMEM ; + goto free_actions; + } + (*ractions)[num_actions].push_vlan.vlan_hdr = +htonl (mlx5_fs_calc_vlan_hdr (&fte_action->vlan[0 ])); + (*ractions)[num_actions++].action = tmp_action; + } + +if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 ) { + tmp_action =mlx5_fs_get_action_push_vlan (fs_ctx); +if (!tmp_action) { + err = -ENOMEM ; + goto free_actions; + } + (*ractions)[num_actions].push_vlan.vlan_hdr = +htonl (mlx5_fs_calc_vlan_hdr (&fte_action->vlan[1 ])); + (*ractions)[num_actions++].action = tmp_action; + } + +if (delay_encap_set) { + pr_data = fte_action->pkt_reformat->fs_hws_action.pr_data; + (*ractions)[num_actions].reformat.offset = pr_data->offset; + (*ractions)[num_actions].reformat.data = pr_data->data; + (*ractions)[num_actions++].action = + fte_action->pkt_reformat->fs_hws_action.hws_action; + } +
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c static int mlx5_cmd_hws_destroy_flow_group(struct mlx5_flow_root_namespace *ns, · line 648
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +10
-0+if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_COUNT ) { +list_for_each_entry (dst, &fte->node.children, node.list) { +struct mlx5_fc *counter; + +if (dst->dest_attr.type != +MLX5_FLOW_DESTINATION_TYPE_COUNTER ) +continue ; + +if (num_actions ==MLX5_FLOW_CONTEXT_ACTION_MAX ) { + err = -EOPNOTSUPP ;
I get that some combinations are not supported, but this looks rather like "too much requested" (-E2BIG)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c static int mlx5_cmd_hws_destroy_flow_group(struct mlx5_flow_root_namespace *ns, · line 567
Quoted 3 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +3
-0+ goto free_actions; + } +
In general, this function is over 300 lines, it would benefit from some "rule action builder", that will keep count of actions, and would allow you to check (most) erros at the very end
Should be fine to over-alloc *ractions, so it will be safe to fill it without checking for if there is a space for each element, and just decide it's too much, when it's too much for your liking at the very end
Tariq Toukan
maintainerPATCH v2 10/15 net/mlx5: fs, add support for dest vport HWS action
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add support for HW Steering action of vport destination. Add dest vport actions cache. Hold action in cache per vport / vport and vhca_id. Add action to cache on demand and remove on namespace closure to reduce actions creation and destroy.
--- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 63 +++++++++++++++++++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 2 + 2 files changed, 65 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +63 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* Copyright (c) 2025 NVIDIA Corporation & Affiliates */ +#include <linux/mlx5/vport.h> #include <mlx5_core.h> #include <fs_core.h> #include <fs_cmd.h>
@@ -63,6 +64,8 @@ static int mlx5_fs_init_hws_actions_pool(struct mlx5_core_dev *dev,xa_init (&hws_pool->el2tol2tnl_pools);xa_init (&hws_pool->mh_pools);xa_init (&hws_pool->table_dests); +xa_init (&hws_pool->vport_dests); +xa_init (&hws_pool->vport_vhca_dests);return 0 ; cleanup_insert_hdr:
@@ -85,9 +88,16 @@ static int mlx5_fs_init_hws_actions_pool(struct mlx5_core_dev *dev,static void mlx5_fs_cleanup_hws_actions_pool (struct mlx5_fs_hws_context *fs_ctx) {struct mlx5_fs_hws_actions_pool *hws_pool = &fs_ctx->hws_pool; +struct mlx5hws_action *action;struct mlx5_fs_pool *pool;unsigned long i; +xa_for_each (&hws_pool->vport_vhca_dests, i, action) +mlx5hws_action_destroy (action); +xa_destroy (&hws_pool->vport_vhca_dests); +xa_for_each (&hws_pool->vport_dests, i, action) +mlx5hws_action_destroy (action); +xa_destroy (&hws_pool->vport_dests);xa_destroy (&hws_pool->table_dests);xa_for_each (&hws_pool->mh_pools, i, pool)mlx5_fs_destroy_mh_pool (pool, &hws_pool->mh_pools, i);
@@ -387,6 +397,52 @@ mlx5_fs_create_dest_action_table_num(struct mlx5_fs_hws_context *fs_ctx,return mlx5hws_action_create_dest_table_num (ctx, table_num, flags); } +static struct mlx5hws_action * +mlx5_fs_get_dest_action_vport (struct mlx5_fs_hws_context *fs_ctx, +struct mlx5_flow_rule *dst, +bool is_dest_type_uplink) +{ +u32 flags =MLX5HWS_ACTION_FLAG_HWS_FDB |MLX5HWS_ACTION_FLAG_SHARED ; +struct mlx5_flow_destination *dest_attr = &dst->dest_attr; +struct mlx5hws_context *ctx = fs_ctx->hws_ctx; +struct mlx5hws_action *dest; +struct xarray *dests_xa; +bool vhca_id_valid; +unsigned long idx; +u16 vport_num; +int err; + + vhca_id_valid = is_dest_type_uplink || + (dest_attr->vport.flags &MLX5_FLOW_DEST_VPORT_VHCA_ID ); + vport_num = is_dest_type_uplink ?MLX5_VPORT_UPLINK : dest_attr->vport.num; +if (vhca_id_valid) { + dests_xa = &fs_ctx->hws_pool.vport_vhca_dests; + idx = dest_attr->vport.vhca_id <<16 | vport_num; + }else { + dests_xa = &fs_ctx->hws_pool.vport_dests; + idx = vport_num; + } +dest_load: + dest =xa_load (dests_xa, idx); +if (dest) +return dest; + + dest =mlx5hws_action_create_dest_vport (ctx, vport_num, vhca_id_valid, + dest_attr->vport.vhca_id, flags); + + err =xa_insert (dests_xa, idx, dest,GFP_KERNEL ); +if (err) { +mlx5hws_action_destroy (dest); + dest =NULL ; + +if (err == -EBUSY ) +/* xarray entry was already stored by another thread */ + goto dest_load; + } + +return dest; +} +static struct mlx5hws_action *mlx5_fs_create_dest_action_range (struct mlx5hws_context *ctx,struct mlx5_flow_rule *dst)
@@ -695,6 +751,8 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_flow_root_namespace *ns,if (fte_action->action &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) {list_for_each_entry (dst, &fte->node.children, node.list) {struct mlx5_flow_destination *attr = &dst->dest_attr; +bool type_uplink = + attr->type ==MLX5_FLOW_DESTINATION_TYPE_UPLINK ;if (num_fs_actions ==MLX5_FLOW_CONTEXT_ACTION_MAX || num_dest_actions ==MLX5_FLOW_CONTEXT_ACTION_MAX ) {
@@ -721,6 +779,11 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_flow_root_namespace *ns, dest_action =mlx5_fs_create_dest_action_range (ctx, dst); fs_actions[num_fs_actions++].action = dest_action;break ; +case MLX5_FLOW_DESTINATION_TYPE_UPLINK : +case MLX5_FLOW_DESTINATION_TYPE_VPORT : + dest_action =mlx5_fs_get_dest_action_vport (fs_ctx, dst, + type_uplink); +break ;default : err = -EOPNOTSUPP ; goto free_actions;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +2 -0
@@ -20,6 +20,8 @@ struct mlx5_fs_hws_actions_pool {struct xarray el2tol2tnl_pools;struct xarray mh_pools;struct xarray table_dests; +struct xarray vport_vhca_dests; +struct xarray vport_dests; };struct mlx5_fs_hws_context {
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 11/15 net/mlx5: fs, set create match definer to not supported by HWS
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Currently HW Steering does not support the API functions of create and destroy match definer. Return not supported error in case requested.
--- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +14 -0
@@ -1321,6 +1321,18 @@ static void mlx5_cmd_hws_modify_header_dealloc(struct mlx5_flow_root_namespace * modify_hdr->fs_hws_action.mh_data =NULL ; } +static int mlx5_cmd_hws_create_match_definer (struct mlx5_flow_root_namespace *ns, +u16 format_id,u32 *match_mask) +{ +return -EOPNOTSUPP ; +} + +static int mlx5_cmd_hws_destroy_match_definer (struct mlx5_flow_root_namespace *ns, +int definer_id) +{ +return -EOPNOTSUPP ; +} +static const struct mlx5_flow_cmds mlx5_flow_cmds_hws = { .create_flow_table = mlx5_cmd_hws_create_flow_table, .destroy_flow_table = mlx5_cmd_hws_destroy_flow_table,
@@ -1335,6 +1347,8 @@ static const struct mlx5_flow_cmds mlx5_flow_cmds_hws = { .packet_reformat_dealloc = mlx5_cmd_hws_packet_reformat_dealloc, .modify_header_alloc = mlx5_cmd_hws_modify_header_alloc, .modify_header_dealloc = mlx5_cmd_hws_modify_header_dealloc, + .create_match_definer = mlx5_cmd_hws_create_match_definer, + .destroy_match_definer = mlx5_cmd_hws_destroy_match_definer, .create_ns = mlx5_cmd_hws_create_ns, .destroy_ns = mlx5_cmd_hws_destroy_ns, .set_peer = mlx5_cmd_hws_set_peer,
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 12/15 net/mlx5: fs, add HWS get capabilities
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add API function get capabilities to HW Steering flow commands.
--- .../mellanox/mlx5/core/steering/hws/fs_hws.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +12 -0
@@ -1333,6 +1333,17 @@ static int mlx5_cmd_hws_destroy_match_definer(struct mlx5_flow_root_namespace *nreturn -EOPNOTSUPP ; } +static u32 mlx5_cmd_hws_get_capabilities (struct mlx5_flow_root_namespace *ns, +enum fs_flow_table_type ft_type) +{ +if (ft_type !=FS_FT_FDB ) +return 0 ; + +return MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX | +MLX5_FLOW_STEERING_CAP_VLAN_POP_ON_TX | +MLX5_FLOW_STEERING_CAP_MATCH_RANGES ; +} +static const struct mlx5_flow_cmds mlx5_flow_cmds_hws = { .create_flow_table = mlx5_cmd_hws_create_flow_table, .destroy_flow_table = mlx5_cmd_hws_destroy_flow_table,
@@ -1352,6 +1363,7 @@ static const struct mlx5_flow_cmds mlx5_flow_cmds_hws = { .create_ns = mlx5_cmd_hws_create_ns, .destroy_ns = mlx5_cmd_hws_destroy_ns, .set_peer = mlx5_cmd_hws_set_peer, + .get_capabilities = mlx5_cmd_hws_get_capabilities, };const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void )
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 13/15 net/mlx5: fs, add HWS to steering mode options
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add HW Steering mode to mlx5 devlink param of steering mode options.
--- Documentation/networking/devlink/mlx5.rst | 3 ++ .../net/ethernet/mellanox/mlx5/core/fs_core.c | 50 +++++++++++++------ .../mellanox/mlx5/core/steering/hws/fs_hws.c | 5 ++ .../mellanox/mlx5/core/steering/hws/fs_hws.h | 7 +++ 4 files changed, 49 insertions(+), 16 deletions(-)
Documentation/networking/devlink/mlx5.rst +3 -0
@@ -53,6 +53,9 @@ parameters. * ``smfs`` Software managed flow steering. In SMFS mode, the HW steering entities are created and manage through the driver without firmware intervention. + * ``hmfs`` Hardware managed flow steering. In HMFS mode, the driver + is configuring steering rules directly to the HW using Work Queues with + a special new type of WQE (Work Queue Element). SMFS mode is faster and provides better rule insertion rate compared to default DMFS mode.
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +34 -16
91 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +5 -0
@@ -1344,6 +1344,11 @@ static u32 mlx5_cmd_hws_get_capabilities(struct mlx5_flow_root_namespace *ns,MLX5_FLOW_STEERING_CAP_MATCH_RANGES ; } +bool mlx5_fs_hws_is_supported (struct mlx5_core_dev *dev) +{ +return mlx5hws_is_supported (dev); +} +static const struct mlx5_flow_cmds mlx5_flow_cmds_hws = { .create_flow_table = mlx5_cmd_hws_create_flow_table, .destroy_flow_table = mlx5_cmd_hws_destroy_flow_table,
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h +7 -0
@@ -60,10 +60,17 @@ struct mlx5_fs_hws_rule {#ifdef CONFIG_MLX5_HW_STEERING +bool mlx5_fs_hws_is_supported (struct mlx5_core_dev *dev); +const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void );#else +static inline bool mlx5_fs_hws_is_supported (struct mlx5_core_dev *dev) +{ +return false; +} +static inline const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds (void ) {return NULL ;
Signature · 1 line
2.45.0
Tariq Toukan
maintainerPATCH v2 14/15 net/mlx5: HWS, update flow - remove the use of dual RTCs
In reply to Tariq ToukanFrom: Yevgeny Kliteynik <[email protected]>
This patch is the first part of update flow implementation.
Update flow should support rules with single STE (match STE only), as well as rules with multiple STEs (match STE plus action STEs).
Supporting the rules with single STE is straightforward: we just overwrite the STE, which is an atomic operation. Supporting the rules with action STEs is a more complicated case. The existing implementation uses two action RTCs per matcher and alternates between the two for each update request. This implementation was unnecessarily complex and lead to some unhandled edge cases, so the support for rule update with multiple STEs wasn't really functional.
This patch removes this code, and the next patch adds implementation of a different approach.
Note that after applying this patch and before applying the next patch we still have support for update rule with single STE (only match STE w/o action STEs), but update will fail for rules with action STEs.
--- .../mellanox/mlx5/core/steering/hws/debug.c | 10 +- .../mlx5/core/steering/hws/internal.h | 1 - .../mellanox/mlx5/core/steering/hws/matcher.c | 170 +++++++----------- .../mellanox/mlx5/core/steering/hws/matcher.h | 8 +- .../mellanox/mlx5/core/steering/hws/rule.c | 73 ++------ .../mellanox/mlx5/core/steering/hws/rule.h | 3 +- 6 files changed, 81 insertions(+), 184 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/debug.c +4 -6
@@ -148,8 +148,8 @@ static int hws_debug_dump_matcher(struct seq_file *f, struct mlx5hws_matcher *ma matcher->match_ste.rtc_1_id, (int)ste_1_id); - ste = &matcher->action_ste[0 ].ste; - ste_pool = matcher->action_ste[0 ].pool; + ste = &matcher->action_ste.ste; + ste_pool = matcher->action_ste.pool;if (ste_pool) { ste_0_id =mlx5hws_pool_chunk_get_base_id (ste_pool, ste);if (tbl_type ==MLX5HWS_TABLE_TYPE_FDB )
@@ -171,10 +171,8 @@ static int hws_debug_dump_matcher(struct seq_file *f, struct mlx5hws_matcher *mareturn ret;seq_printf (f,",%d,%d,%d,%d,%d,0x%llx,0x%llx\n" , - matcher->action_ste[0 ].rtc_0_id, - (int )ste_0_id, - matcher->action_ste[0 ].rtc_1_id, - (int )ste_1_id, + matcher->action_ste.rtc_0_id, (int )ste_0_id, + matcher->action_ste.rtc_1_id, (int )ste_1_id,0 ,mlx5hws_debug_icm_to_idx (icm_addr_0),mlx5hws_debug_icm_to_idx (icm_addr_1));
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/internal.h +0 -1
@@ -39,7 +39,6 @@ #define mlx5hws_dbg(ctx, arg...) mlx5_core_dbg((ctx)->mdev, ##arg)#define MLX5HWS_TABLE_TYPE_BASE 2 -#define MLX5HWS_ACTION_STE_IDX_ANY 0static inline bool is_mem_zero (const u8 *mem,size_t size) {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c +61 -109
289 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.h +2 -6
@@ -52,15 +52,11 @@ struct mlx5hws_matcher_action_ste {u8 max_stes; }; -struct mlx5hws_matcher_resize_data_node { +struct mlx5hws_matcher_resize_data {struct mlx5hws_pool_chunk stc;u32 rtc_0_id;u32 rtc_1_id;struct mlx5hws_pool *pool; -}; - -struct mlx5hws_matcher_resize_data { -struct mlx5hws_matcher_resize_data_node action_ste[2 ];u8 max_stes;struct list_head list_node; };
@@ -78,7 +74,7 @@ struct mlx5hws_matcher {struct mlx5hws_matcher *col_matcher;struct mlx5hws_matcher *resize_dst;struct mlx5hws_matcher_match_ste match_ste; -struct mlx5hws_matcher_action_ste action_ste[2 ]; +struct mlx5hws_matcher_action_ste action_ste;struct list_head list_node;struct list_head resize_data; };
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c +13 -60
134 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h +1 -2
@@ -42,7 +42,7 @@ struct mlx5hws_rule_match_tag { };struct mlx5hws_rule_resize_info { -struct mlx5hws_pool *action_ste_pool[2 ]; +struct mlx5hws_pool *action_ste_pool;u32 rtc_0;u32 rtc_1;u32 rule_idx;
@@ -62,7 +62,6 @@ struct mlx5hws_rule {u32 rtc_1;/* The RTC into which the STE was inserted */ int action_ste_idx;/* STE array index */ u8 status;/* enum mlx5hws_rule_status */ -u8 action_ste_selector;/* For rule update - which action STE is in use */ u8 pending_wqes;bool skip_delete;/* For complex rules - another rule with same tag * still exists, so don't actually delete this rule.
Signature · 1 line
2.45.0
Re: [PATCH net-next V2 14/15] net/mlx5: HWS, update flow - remove the use of dual RTCs
Quoted 24 lines · Tariq Toukan
From: Yevgeny Kliteynik <[email protected]>
This patch is the first part of update flow implementation.
Update flow should support rules with single STE (match STE only), as well as rules with multiple STEs (match STE plus action STEs).
Supporting the rules with single STE is straightforward: we just overwrite the STE, which is an atomic operation. Supporting the rules with action STEs is a more complicated case. The existing implementation uses two action RTCs per matcher and alternates between the two for each update request. This implementation was unnecessarily complex and lead to some unhandled edge cases, so the support for rule update with multiple STEs wasn't really functional.
This patch removes this code, and the next patch adds implementation of a different approach.
Note that after applying this patch and before applying the next patch we still have support for update rule with single STE (only match STE w/o action STEs), but update will fail for rules with action STEs.
Quoted 4 lines
Signed-off-by Yevgeny Kliteynik <[email protected]>Signed-off-by Vlad Dogaru <[email protected]>Reviewed-by Mark Bloch <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
What is STE, RTC (and STC from your existing code)?
perhaps not worth a repost, but in general it is much welcomed to spell out each non obvious acronym once per series.
Tariq Toukan
maintainerPATCH v2 15/15 net/mlx5: HWS, update flow - support through bigger action RTC
In reply to Tariq ToukanFrom: Yevgeny Kliteynik <[email protected]>
This patch is the second part of update flow implementation.
Instead of using two action RTCs, we use the same RTC which is twice the size of what was required before the update flow support. This way we always allocate STEs from the same RTC (same pool), which means that update is done similar to how create is done. The bigger size allows us to allocate and write new STEs, and later free the old (pre-update) STEs.
Similar to rule creation, STEs are written in reverse order:
- write action STEs, while match STE is still pointing to the old action STEs
- overwrite the match STE with the new one, which now is pointing to the new action STEs
Old action STEs can be freed only once we got completion on the writing of the new match STE. To implement this we added new rule
states: UPDATING/UPDATED. Rule is moved to UPDATING state in the beginning of the update flow. Once all completions are received, rule is moved to UPDATED state. At this point old action STEs are freed and rule goes back to CREATED state.
--- .../mellanox/mlx5/core/steering/hws/matcher.c | 10 ++- .../mellanox/mlx5/core/steering/hws/rule.c | 88 ++++++++++--------- .../mellanox/mlx5/core/steering/hws/rule.h | 15 +++- .../mellanox/mlx5/core/steering/hws/send.c | 20 +++-- 4 files changed, 80 insertions(+), 53 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c +8 -2
@@ -283,8 +283,13 @@ static int hws_matcher_create_rtc(struct mlx5hws_matcher *matcher, rtc_1_id = &action_ste->rtc_1_id; ste_pool = action_ste->pool; ste = &action_ste->ste; +/* Action RTC size calculation: +* log((max number of rules in matcher) * +* (max number of action STEs per rule) * +* (2 to support writing new STEs for update rule)) +*/ ste->order =ilog2 (roundup_pow_of_two (action_ste->max_stes)) + - attr->table.sz_row_log; + attr->table.sz_row_log +1 ; rtc_attr.log_size = ste->order; rtc_attr.log_depth =0 ; rtc_attr.update_index_mode =MLX5_IFC_RTC_STE_UPDATE_MODE_BY_OFFSET ;
@@ -554,8 +559,9 @@ static int hws_matcher_bind_at(struct mlx5hws_matcher *matcher) pool_attr.table_type = tbl->type; pool_attr.pool_type =MLX5HWS_POOL_TYPE_STE ; pool_attr.flags =MLX5HWS_POOL_FLAGS_FOR_STE_ACTION_POOL ; +/* Pool size is similar to action RTC size */ pool_attr.alloc_log_sz =ilog2 (roundup_pow_of_two (action_ste->max_stes)) + - matcher->attr.table.sz_row_log; + matcher->attr.table.sz_row_log +1 ;hws_matcher_set_pool_attr (&pool_attr, matcher); action_ste->pool =mlx5hws_pool_create (ctx, &pool_attr);if (!action_ste->pool) {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c +47 -41
174 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.h +11 -4
@@ -15,6 +15,8 @@ enum mlx5hws_rule_status {MLX5HWS_RULE_STATUS_UNKNOWN ,MLX5HWS_RULE_STATUS_CREATING ,MLX5HWS_RULE_STATUS_CREATED , +MLX5HWS_RULE_STATUS_UPDATING , +MLX5HWS_RULE_STATUS_UPDATED ,MLX5HWS_RULE_STATUS_DELETING ,MLX5HWS_RULE_STATUS_DELETED , MLX5HWS_RULE_STATUS_FAILING,
@@ -41,13 +43,17 @@ struct mlx5hws_rule_match_tag { }; }; +struct mlx5hws_rule_action_ste_info { +struct mlx5hws_pool *pool; +int index;/* STE array index */ +u8 num_stes; +}; +struct mlx5hws_rule_resize_info { -struct mlx5hws_pool *action_ste_pool;u32 rtc_0;u32 rtc_1;u32 rule_idx;u8 state; -u8 max_stes;u8 ctrl_seg[MLX5HWS_WQE_SZ_GTA_CTRL ];/* Ctrl segment of STE: 48 bytes */ u8 data_seg[MLX5HWS_WQE_SZ_GTA_DATA ];/* Data segment of STE: 64 bytes */ };
@@ -58,9 +64,10 @@ struct mlx5hws_rule {struct mlx5hws_rule_match_tag tag;struct mlx5hws_rule_resize_info *resize_info; }; +struct mlx5hws_rule_action_ste_info action_ste; +struct mlx5hws_rule_action_ste_info old_action_ste;u32 rtc_0;/* The RTC into which the STE was inserted */ u32 rtc_1;/* The RTC into which the STE was inserted */ -int action_ste_idx;/* STE array index */ u8 status;/* enum mlx5hws_rule_status */ u8 pending_wqes;bool skip_delete;/* For complex rules - another rule with same tag
@@ -68,7 +75,7 @@ struct mlx5hws_rule {*/ }; -void mlx5hws_rule_free_action_ste (struct mlx5hws_rule *rule); +void mlx5hws_rule_free_action_ste (struct mlx5hws_rule_action_ste_info *action_ste);int mlx5hws_rule_move_hws_remove (struct mlx5hws_rule *rule,void *queue,void *user_data);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c +14 -6
@@ -377,17 +377,25 @@ static void hws_send_engine_update_rule(struct mlx5hws_send_engine *queue, *status =MLX5HWS_FLOW_OP_ERROR ; }else { -/* Increase the status, this only works on good flow as the enum -* is arrange it away creating -> created -> deleting -> deleted +/* Increase the status, this only works on good flow as +* the enum is arranged this way: +* - creating -> created +* - updating -> updated +* - deleting -> deleted */ priv->rule->status++; *status =MLX5HWS_FLOW_OP_SUCCESS ; -/* Rule was deleted now we can safely release action STEs -* and clear resize info -*/ if (priv->rule->status ==MLX5HWS_RULE_STATUS_DELETED ) { -mlx5hws_rule_free_action_ste (priv->rule); +/* Rule was deleted, now we can safely release +* action STEs and clear resize info +*/ +mlx5hws_rule_free_action_ste (&priv->rule->action_ste);mlx5hws_rule_clear_resize_info (priv->rule); + }else if (priv->rule->status ==MLX5HWS_RULE_STATUS_UPDATED ) { +/* Rule was updated, free the old action STEs */ +mlx5hws_rule_free_action_ste (&priv->rule->old_action_ste); +/* Update completed - move the rule back to "created" */ + priv->rule->status =MLX5HWS_RULE_STATUS_CREATED ; } } }
Signature · 1 line
2.45.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Thu, 9 Jan 2025 18:05:31 +0200 you wrote:
Hi,
This patchset by Moshe follows Yevgeny's patchsets [1][2] on subject "HW-Managed Flow Steering in mlx5 driver". As introduced there in HW managed Flow Steering mode (HWS) the driver is configuring steering rules directly to the HW using WQs with a special new type of WQE (Work Queue Element). This way we can reach higher rule insertion/deletion rate with much lower CPU utilization compared to SW Managed Flow Steering (SWS).
[...]
Here is the summary with links:
- [net-next,V2,01/15] net/mlx5: fs, add HWS root namespace functions
https://git.kernel.org/netdev/net-next/c/cbfdefc44194 - [net-next,V2,02/15] net/mlx5: fs, add HWS flow table API functions https://git.kernel.org/netdev/net-next/c/0f3ecf5c57d8 - [net-next,V2,03/15] net/mlx5: fs, add HWS flow group API functions https://git.kernel.org/netdev/net-next/c/4160405f6c4d - [net-next,V2,04/15] net/mlx5: fs, add HWS actions pool https://git.kernel.org/netdev/net-next/c/c7e62a788a98 - [net-next,V2,05/15] net/mlx5: fs, add HWS packet reformat API function https://git.kernel.org/netdev/net-next/c/aecd9d1020e3 - [net-next,V2,06/15] net/mlx5: fs, add HWS modify header API function https://git.kernel.org/netdev/net-next/c/b36315ca69cb - [net-next,V2,07/15] net/mlx5: fs, manage flow counters HWS action sharing by refcount https://git.kernel.org/netdev/net-next/c/b581f4266928 - [net-next,V2,08/15] net/mlx5: fs, add dest table cache https://git.kernel.org/netdev/net-next/c/3fd62e943aeb - [net-next,V2,09/15] net/mlx5: fs, add HWS fte API functions https://git.kernel.org/netdev/net-next/c/2ec6786ad0a6 - [net-next,V2,10/15] net/mlx5: fs, add support for dest vport HWS action https://git.kernel.org/netdev/net-next/c/8e2e08a6d1e0 - [net-next,V2,11/15] net/mlx5: fs, set create match definer to not supported by HWS https://git.kernel.org/netdev/net-next/c/866e50321256 - [net-next,V2,12/15] net/mlx5: fs, add HWS get capabilities https://git.kernel.org/netdev/net-next/c/c09cf80ed299 - [net-next,V2,13/15] net/mlx5: fs, add HWS to steering mode options https://git.kernel.org/netdev/net-next/c/9fc43b5e3933 - [net-next,V2,14/15] net/mlx5: HWS, update flow - remove the use of dual RTCs https://git.kernel.org/netdev/net-next/c/ab6912ff6558 - [net-next,V2,15/15] net/mlx5: HWS, update flow - support through bigger action RTC https://git.kernel.org/netdev/net-next/c/3fc44ca44d7c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html