Skip to content

Commit 04d1ff1

Browse files
committed
Merge branch 'devlink-mlx5-add-new-parameters-for-link-management-and-sriov-eswitch-configurations'
Saeed Mahameed says: ==================== devlink, mlx5: Add new parameters for link management and SRIOV/eSwitch configurations [part] This patch series introduces several devlink parameters improving device configuration capabilities, link management, and SRIOV/eSwitch, by adding NV config boot time parameters. Implement the following parameters: a) total_vfs Parameter: ----------------------- Adds support for managing the number of VFs (total_vfs) and enabling SR-IOV (enable_sriov for mlx5) through devlink. These additions enhance user control over virtualization features directly from standard kernel interfaces without relying on additional external tools. total_vfs functionality is critical for environments that require flexible num VF configuration. b) CQE Compression Type: ------------------------ Introduces a new devlink parameter, cqe_compress_type, to configure the rate of CQE compression based on PCIe bus conditions. This setting provides a balance between compression efficiency and overall NIC performance under different traffic loads. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b90c7ca + a4c4961 commit 04d1ff1

File tree

10 files changed

+658
-4
lines changed

10 files changed

+658
-4
lines changed

Documentation/networking/devlink/devlink-params.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,8 @@ own name.
143143
* - ``clock_id``
144144
- u64
145145
- Clock ID used by the device for registering DPLL devices and pins.
146+
* - ``total_vfs``
147+
- u32
148+
- The max number of Virtual Functions (VFs) exposed by the PF.
149+
after reboot/pci reset, 'sriov_totalvfs' entry under the device's sysfs
150+
directory will report this value.

Documentation/networking/devlink/mlx5.rst

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,53 @@ Parameters
1515
* - Name
1616
- Mode
1717
- Validation
18+
- Notes
1819
* - ``enable_roce``
1920
- driverinit
20-
- Type: Boolean
21-
22-
If the device supports RoCE disablement, RoCE enablement state controls
21+
- Boolean
22+
- If the device supports RoCE disablement, RoCE enablement state controls
2323
device support for RoCE capability. Otherwise, the control occurs in the
2424
driver stack. When RoCE is disabled at the driver level, only raw
2525
ethernet QPs are supported.
2626
* - ``io_eq_size``
2727
- driverinit
2828
- The range is between 64 and 4096.
29+
-
2930
* - ``event_eq_size``
3031
- driverinit
3132
- The range is between 64 and 4096.
33+
-
3234
* - ``max_macs``
3335
- driverinit
3436
- The range is between 1 and 2^31. Only power of 2 values are supported.
37+
-
38+
* - ``enable_sriov``
39+
- permanent
40+
- Boolean
41+
- Applies to each physical function (PF) independently, if the device
42+
supports it. Otherwise, it applies symmetrically to all PFs.
43+
* - ``total_vfs``
44+
- permanent
45+
- The range is between 1 and a device-specific max.
46+
- Applies to each physical function (PF) independently, if the device
47+
supports it. Otherwise, it applies symmetrically to all PFs.
48+
49+
Note: permanent parameters such as ``enable_sriov`` and ``total_vfs`` require FW reset to take effect
50+
51+
.. code-block:: bash
52+
53+
# setup parameters
54+
devlink dev param set pci/0000:01:00.0 name enable_sriov value true cmode permanent
55+
devlink dev param set pci/0000:01:00.0 name total_vfs value 8 cmode permanent
56+
57+
# Fw reset
58+
devlink dev reload pci/0000:01:00.0 action fw_activate
59+
60+
# for PCI related config such as sriov PCI reset/rescan is required:
61+
echo 1 >/sys/bus/pci/devices/0000:01:00.0/remove
62+
echo 1 >/sys/bus/pci/rescan
63+
grep ^ /sys/bus/pci/devices/0000:01:00.0/sriov_*
64+
3565
3666
The ``mlx5`` driver also implements the following driver-specific
3767
parameters.
@@ -117,6 +147,16 @@ parameters.
117147
- driverinit
118148
- Control the size (in packets) of the hairpin queues.
119149

150+
* - ``cqe_compress_type``
151+
- string
152+
- permanent
153+
- Configure which mechanism/algorithm should be used by the NIC that will
154+
affect the rate (aggressiveness) of compressed CQEs depending on PCIe bus
155+
conditions and other internal NIC factors. This mode affects all queues
156+
that enable compression.
157+
* ``balanced`` : Merges fewer CQEs, resulting in a moderate compression ratio but maintaining a balance between bandwidth savings and performance
158+
* ``aggressive`` : Merges more CQEs into a single entry, achieving a higher compression rate and maximizing performance, particularly under high traffic loads
159+
120160
The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD``
121161

122162
Info versions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
1717
fs_counters.o fs_ft_pool.o rl.o lag/debugfs.o lag/lag.o dev.o events.o wq.o lib/gid.o \
1818
lib/devcom.o lib/pci_vsc.o lib/dm.o lib/fs_ttc.o diag/fs_tracepoint.o \
1919
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o diag/reporter_vnic.o \
20-
fw_reset.o qos.o lib/tout.o lib/aso.o wc.o fs_pool.o
20+
fw_reset.o qos.o lib/tout.o lib/aso.o wc.o fs_pool.o lib/nv_param.o
2121

2222
#
2323
# Netdev basic

drivers/net/ethernet/mellanox/mlx5/core/devlink.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "esw/qos.h"
1111
#include "sf/dev/dev.h"
1212
#include "sf/sf.h"
13+
#include "lib/nv_param.h"
1314

1415
static int mlx5_devlink_flash_update(struct devlink *devlink,
1516
struct devlink_flash_update_params *params,
@@ -895,8 +896,14 @@ int mlx5_devlink_params_register(struct devlink *devlink)
895896
if (err)
896897
goto max_uc_list_err;
897898

899+
err = mlx5_nv_param_register_dl_params(devlink);
900+
if (err)
901+
goto nv_param_err;
902+
898903
return 0;
899904

905+
nv_param_err:
906+
mlx5_devlink_max_uc_list_params_unregister(devlink);
900907
max_uc_list_err:
901908
mlx5_devlink_auxdev_params_unregister(devlink);
902909
auxdev_reg_err:
@@ -907,6 +914,7 @@ int mlx5_devlink_params_register(struct devlink *devlink)
907914

908915
void mlx5_devlink_params_unregister(struct devlink *devlink)
909916
{
917+
mlx5_nv_param_unregister_dl_params(devlink);
910918
mlx5_devlink_max_uc_list_params_unregister(devlink);
911919
mlx5_devlink_auxdev_params_unregister(devlink);
912920
devl_params_unregister(devlink, mlx5_devlink_params,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum mlx5_devlink_param_id {
2222
MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT,
2323
MLX5_DEVLINK_PARAM_ID_HAIRPIN_NUM_QUEUES,
2424
MLX5_DEVLINK_PARAM_ID_HAIRPIN_QUEUE_SIZE,
25+
MLX5_DEVLINK_PARAM_ID_CQE_COMPRESSION_TYPE
2526
};
2627

2728
struct mlx5_trap_ctx {

0 commit comments

Comments
 (0)