Skip to content

Commit 474bb1a

Browse files
committed
Merge tag 'mlx5-updates-2024-09-02' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2024-08-29 HW-Managed Flow Steering in mlx5 driver Yevgeny Kliteynik says: ======================= 1. Overview ----------- ConnectX devices support packet matching, modification, and redirection. This functionality is referred as Flow Steering. To configure a steering rule, the rule is written to the device-owned memory. This memory is accessed and cached by the device when processing a packet. The first implementation of Flow Steering was done in FW, and it is referred in the mlx5 driver as Device-Managed Flow Steering (DMFS). Later we introduced SW-managed Flow Steering (SWS or SMFS), where the driver is writing directly to the device's configuration memory (ICM) through RC QP using RDMA operations (RDMA-read and RDAM-write), thus achieving higher rates of rule insertion/deletion. Now we introduce a new flow steering implementation: HW-Managed Flow Steering (HWS or HMFS). In this new approach, the driver is configuring steering rules directly to the HW using the WQs with a special new type of WQE. This way we can reach higher rule insertion/deletion rate with much lower CPU utilization compared to SWS. The key benefits of HWS as opposed to SWS: + HW manages the steering decision tree - HW calculates CRC for each entry - HW handles tree hash collisions - HW & FW manage objects refcount + HW keeps cache coherency: - HW provides tree access locking and synchronization - HW provides notification on completion + Insertion rate isn’t affected by background traffic - Dedicated HW components that handle insertion 2. Performance -------------- Measuring Connection Tracking with simple IPv4 flows w/o NAT, we are able to get ~5 times more flows offloaded per second using HWS. 3. Configuration ---------------- The enablement of HWS mode in eswitch manager is done using the same devlink param that is already used for switching between FW-managed steering and SW-managed steering modes: # devlink dev param set pci/<PCI_ID> name flow_steering_mode cmod runtime value hmfs 4. Upstream Submission ---------------------- HWS support consists of 3 main components: + Steering: - The lower layer that exposes HWS API to upper layers and implements all the management of flow steering building blocks + FS-Core - Implementation of fs_hws layer to enable fs_core to use HWS instead of FW or SW steering - Create HW steering action pools to utilize the ability of HWS to share steering actions among different rules - Add support for configuring HWS mode through devlink command, similar to configuring SWS mode + Connection Tracking - Implementation of CT support for HW steering - Hooks up the CT ops for the new steering mode and uses the HWS API to implement connection tracking. Because of the large number of patches, we need to perform the submission in several separate patch series. This series is the first submission that lays the ground work for the next submissions, where an actual user of HWS will be added. 5. Patches in this series ------------------------- This patch series contains implementation of the first bullet from above. ======================= * tag 'mlx5-updates-2024-09-02' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5: HWS, added API and enabled HWS support net/mlx5: HWS, added send engine and context handling net/mlx5: HWS, added debug dump and internal headers net/mlx5: HWS, added backward-compatible API handling net/mlx5: HWS, added memory management handling net/mlx5: HWS, added vport handling net/mlx5: HWS, added modify header pattern and args handling net/mlx5: HWS, added FW commands handling net/mlx5: HWS, added matchers functionality net/mlx5: HWS, added definers handling net/mlx5: HWS, added rules handling net/mlx5: HWS, added tables handling net/mlx5: HWS, added actions handling net/mlx5: Added missing definitions in preparation for HW Steering net/mlx5: Added missing mlx5_ifc definition for HW Steering ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents ea40354 + 510f9f6 commit 474bb1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+17285
-36
lines changed

Documentation/networking/device_drivers/ethernet/mellanox/mlx5/kconfig.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ Enabling the driver and kconfig options
130130

131131
| Build support for software-managed steering in the NIC.
132132
133+
**CONFIG_MLX5_HW_STEERING=(y/n)**
134+
135+
| Build support for hardware-managed steering in the NIC.
133136
134137
**CONFIG_MLX5_TC_CT=(y/n)**
135138

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ config MLX5_SW_STEERING
172172
help
173173
Build support for software-managed steering in the NIC.
174174

175+
config MLX5_HW_STEERING
176+
bool "Mellanox Technologies hardware-managed steering"
177+
depends on MLX5_CORE_EN && MLX5_ESWITCH
178+
default y
179+
help
180+
Build support for Hardware-Managed Flow Steering (HMFS) in the NIC.
181+
HMFS is a new approach to managing steering rules where STEs are
182+
written to ICM by HW (as opposed to SW in software-managed steering),
183+
which allows higher rate of rule insertion.
184+
175185
config MLX5_SF
176186
bool "Mellanox Technologies subfunction device support using auxiliary device"
177187
depends on MLX5_CORE && MLX5_CORE_EN

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,27 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
119119
steering/dr_action.o steering/fs_dr.o \
120120
steering/dr_definer.o steering/dr_ptrn.o \
121121
steering/dr_arg.o steering/dr_dbg.o lib/smfs.o
122+
123+
#
124+
# HW Steering
125+
#
126+
mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/mlx5hws_cmd.o \
127+
steering/hws/mlx5hws_context.o \
128+
steering/hws/mlx5hws_pat_arg.o \
129+
steering/hws/mlx5hws_buddy.o \
130+
steering/hws/mlx5hws_pool.o \
131+
steering/hws/mlx5hws_table.o \
132+
steering/hws/mlx5hws_action.o \
133+
steering/hws/mlx5hws_rule.o \
134+
steering/hws/mlx5hws_matcher.o \
135+
steering/hws/mlx5hws_send.o \
136+
steering/hws/mlx5hws_definer.o \
137+
steering/hws/mlx5hws_bwc.o \
138+
steering/hws/mlx5hws_debug.o \
139+
steering/hws/mlx5hws_vport.o \
140+
steering/hws/mlx5hws_bwc_complex.o
141+
142+
122143
#
123144
# SF device
124145
#

drivers/net/ethernet/mellanox/mlx5/core/fs_core.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ enum fs_flow_table_type {
110110
FS_FT_RDMA_RX = 0X7,
111111
FS_FT_RDMA_TX = 0X8,
112112
FS_FT_PORT_SEL = 0X9,
113-
FS_FT_MAX_TYPE = FS_FT_PORT_SEL,
113+
FS_FT_FDB_RX = 0xa,
114+
FS_FT_FDB_TX = 0xb,
115+
FS_FT_MAX_TYPE = FS_FT_FDB_TX,
114116
};
115117

116118
enum fs_flow_table_op_mod {
@@ -368,7 +370,9 @@ struct mlx5_flow_root_namespace *find_root(struct fs_node *node);
368370
(type == FS_FT_RDMA_RX) ? MLX5_CAP_FLOWTABLE_RDMA_RX(mdev, cap) : \
369371
(type == FS_FT_RDMA_TX) ? MLX5_CAP_FLOWTABLE_RDMA_TX(mdev, cap) : \
370372
(type == FS_FT_PORT_SEL) ? MLX5_CAP_FLOWTABLE_PORT_SELECTION(mdev, cap) : \
371-
(BUILD_BUG_ON_ZERO(FS_FT_PORT_SEL != FS_FT_MAX_TYPE))\
373+
(type == FS_FT_FDB_RX) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \
374+
(type == FS_FT_FDB_TX) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \
375+
(BUILD_BUG_ON_ZERO(FS_FT_FDB_TX != FS_FT_MAX_TYPE))\
372376
)
373377

374378
#endif

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ int mlx5dr_cmd_query_flow_table(struct mlx5_core_dev *dev,
251251
output->level = MLX5_GET(query_flow_table_out, out, flow_table_context.level);
252252

253253
output->sw_owner_icm_root_1 = MLX5_GET64(query_flow_table_out, out,
254-
flow_table_context.sw_owner_icm_root_1);
254+
flow_table_context.sws.sw_owner_icm_root_1);
255255
output->sw_owner_icm_root_0 = MLX5_GET64(query_flow_table_out, out,
256-
flow_table_context.sw_owner_icm_root_0);
256+
flow_table_context.sws.sw_owner_icm_root_0);
257257

258258
return 0;
259259
}
@@ -480,15 +480,15 @@ int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,
480480
*/
481481
if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_RX) {
482482
MLX5_SET64(flow_table_context, ft_mdev,
483-
sw_owner_icm_root_0, attr->icm_addr_rx);
483+
sws.sw_owner_icm_root_0, attr->icm_addr_rx);
484484
} else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_TX) {
485485
MLX5_SET64(flow_table_context, ft_mdev,
486-
sw_owner_icm_root_0, attr->icm_addr_tx);
486+
sws.sw_owner_icm_root_0, attr->icm_addr_tx);
487487
} else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_FDB) {
488488
MLX5_SET64(flow_table_context, ft_mdev,
489-
sw_owner_icm_root_0, attr->icm_addr_rx);
489+
sws.sw_owner_icm_root_0, attr->icm_addr_rx);
490490
MLX5_SET64(flow_table_context, ft_mdev,
491-
sw_owner_icm_root_1, attr->icm_addr_tx);
491+
sws.sw_owner_icm_root_1, attr->icm_addr_tx);
492492
}
493493
}
494494

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
subdir-ccflags-y += -I$(src)/..

0 commit comments

Comments
 (0)