net/mlx5: Memory optimizations
Subsystems (6)
v3 cover net/mlx5: Memory optimizations
This series provides knobs which will enable users to minimize memory consumption of mlx5 Functions (PF/VF/SF). mlx5 exposes two new generic devlink params for EQ size configuration and uses devlink generic param max_macs.
Patches summary:
- Patch-1 Introduce log_max_current_uc_list_wr_supported bit
- Patches-2-3 Provides I/O EQ size param which enables to save up to 128KB.
- Patches-4-5 Provides event EQ size param which enables to save up to 512KB.
- Patch-6 Clarify max_macs param.
- Patch-7 Provides max_macs param which enables to save up to 70KB
In total, this series can save up to 700KB per Function.
---
changelog:v2->v3:
- change type of EQ size param to u32 per Jiri suggestion.
- separate ifc changes to new patchv1->v2:
- convert io_eq_size and event_eq_size from devlink_resources to generic devlink_params
Shay Drory (7):
net/mlx5: Introduce log_max_current_uc_list_wr_supported bit
devlink: Add new "io_eq_size" generic device param net/mlx5: Let user configure io_eq_size param
devlink: Add new "event_eq_size" generic device param net/mlx5: Let user configure event_eq_size param
devlink: Clarifies max_macs generic devlink param net/mlx5: Let user configure max_macs generic param
.../networking/devlink/devlink-params.rst | 12 ++- Documentation/networking/devlink/mlx5.rst | 10 +++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 88 +++++++++++++++++++ drivers/net/ethernet/mellanox/mlx5/core/eq.c | 34 ++++++- .../net/ethernet/mellanox/mlx5/core/main.c | 21 +++++ include/linux/mlx5/mlx5_ifc.h | 2 +- include/net/devlink.h | 8 ++ net/core/devlink.c | 10 +++ 8 files changed, 180 insertions(+), 5 deletions(-)
Signature · 1 line
2.21.3
PATCH v3 1/7 net/mlx5: Introduce log_max_current_uc_list_wr_supported bit
Downstream patch will use this bit in order to know whether the device supports changing of max_uc_list.
--- include/linux/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mlx5/mlx5_ifc.h +1 -1
@@ -1621,7 +1621,7 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 ext_stride_num_range[0x1 ];u8 roce_rw_supported[0x1 ]; -u8 reserved_at_3a2[0x1 ]; +u8 log_max_current_uc_list_wr_supported[0x1 ];u8 log_max_stride_sz_rq[0x5 ];u8 reserved_at_3a8[0x3 ];u8 log_min_stride_sz_rq[0x5 ];
Signature · 1 line
2.21.3
PATCH v3 2/7 devlink: Add new "io_eq_size" generic device param
In reply to Shay DroryAdd new device generic parameter to determine the size of the I/O completion EQs.
For example, to reduce I/O EQ size to 64, execute:
$ devlink dev param set pci/0000:06:00.0 \
name io_eq_size value 64 cmode driverinit
$ devlink dev reload pci/0000:06:00.0--- Documentation/networking/devlink/devlink-params.rst | 3 +++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 12 insertions(+)
Documentation/networking/devlink/devlink-params.rst +3 -0
@@ -129,3 +129,6 @@ own name. will NACK any attempt of other host to reset the device. This parameter is useful for setups where a device is shared by different hosts, such as multi-host setup. + * - ``io_eq_size`` + - u16 + - Control the size of I/O completion EQs.
include/net/devlink.h +4 -0
@@ -459,6 +459,7 @@ enum devlink_param_generic_id {DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA ,DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET ,DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP , +DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE ,/* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -511,6 +512,9 @@ enum devlink_param_generic_id {#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME "enable_iwarp"#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE DEVLINK_PARAM_TYPE_BOOL +#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME "io_eq_size" +#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC (_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
net/core/devlink.c +5 -0
@@ -4466,6 +4466,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME, .type = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE, + .name = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME, + .type = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE, + }, };static int devlink_param_generic_verify (const struct devlink_param *param)
Signature · 1 line
2.21.3
Jiri Pirko
maintainerRe: [PATCH net-next v3 2/7] devlink: Add new "io_eq_size" generic device param
Quoted 21 lines · Wed, Dec 08, 2021 at 03:17:17PM CET, [email protected] wrote:
Add new device generic parameter to determine the size of the I/O completion EQs.
For example, to reduce I/O EQ size to 64, execute:
$ devlink dev param set pci/0000:06:00.0 \ name io_eq_size value 64 cmode driverinit $ devlink dev reload pci/0000:06:00.0Signed-off-by Shay Drory <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>---
Documentation/networking/devlink/devlink-params.rst | 3 +++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 12 insertions(+)Documentation/networking/devlink/devlink-params.rst +0
-0
Documentation/networking/devlink/devlink-params.rst own name. · line 133
Quoted 5 lines
Documentation/networking/devlink/devlink-params.rst +2
-0@@ -129,3 +129,6 @@ own name. will NACK any attempt of other host to reset the device. This parameter is useful for setups where a device is shared by different hosts, such as multi-host setup. + * - ``io_eq_size`` + - u16
You missed this.
Quoted 42 lines
Documentation/networking/devlink/devlink-params.rst +1
-0+ - Control the size of I/O completion EQs.include/net/devlink.h +4
-0@@ -459,6 +459,7 @@ enum devlink_param_generic_id {DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA ,DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET ,DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP , +DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE ,/* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,@@ -511,6 +512,9 @@ enum devlink_param_generic_id {#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME "enable_iwarp"#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE DEVLINK_PARAM_TYPE_BOOL +#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME "io_eq_size" +#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC (_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \net/core/devlink.c +5
-0@@ -4466,6 +4466,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME, .type = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE, + .name = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME, + .type = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE, + }, };static int devlink_param_generic_verify (const struct devlink_param *param)Signature · 1 line
2.21.3
PATCH v3 3/7 net/mlx5: Let user configure io_eq_size param
In reply to Shay DroryCurrently, each I/O EQ is taking 128KB of memory. This size is not needed in all use cases, and is critical with large scale. Hence, allow user to configure the size of I/O EQs.
For example, to reduce I/O EQ size to 64, execute:
$ devlink dev param set pci/0000:00:0b.0 name io_eq_size value 64 \
cmode driverinit
$ devlink dev reload pci/0000:00:0b.0--- Documentation/networking/devlink/mlx5.rst | 4 ++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 14 ++++++++++++++ drivers/net/ethernet/mellanox/mlx5/core/eq.c | 18 +++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-)
Documentation/networking/devlink/mlx5.rst +4 -0
@@ -14,8 +14,12 @@ Parameters * - Name - Mode + - Validation * - ``enable_roce`` - driverinit + * - ``io_eq_size`` + - driverinit + - The range is between 64 and 4096. The ``mlx5`` driver also implements the following driver-specific parameters.
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +14 -0
@@ -546,6 +546,13 @@ static int mlx5_devlink_enable_remote_dev_reset_get(struct devlink *devlink, u32return 0 ; } +static int mlx5_devlink_eq_depth_validate (struct devlink *devlink,u32 id, +union devlink_param_value val, +struct netlink_ext_ack *extack) +{ +return (val.vu16 >=64 && val.vu16 <=4096 ) ?0 : -EINVAL ; +} +static const struct devlink_param mlx5_devlink_params[] = { DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE, "flow_steering_mode", DEVLINK_PARAM_TYPE_STRING,
@@ -570,6 +577,8 @@ static const struct devlink_param mlx5_devlink_params[] = {DEVLINK_PARAM_GENERIC (ENABLE_REMOTE_DEV_RESET ,BIT (DEVLINK_PARAM_CMODE_RUNTIME ), mlx5_devlink_enable_remote_dev_reset_get, mlx5_devlink_enable_remote_dev_reset_set,NULL ), +DEVLINK_PARAM_GENERIC (IO_EQ_SIZE ,BIT (DEVLINK_PARAM_CMODE_DRIVERINIT ), + NULL, NULL, mlx5_devlink_eq_depth_validate), };static void mlx5_devlink_set_params_init_values (struct devlink *devlink)
@@ -608,6 +617,11 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) value); }#endif + + value.vu32 =MLX5_COMP_EQ_SIZE ; +devlink_param_driverinit_value_set (devlink, +DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE , + value); } static const struct devlink_param enable_eth_param =
drivers/net/ethernet/mellanox/mlx5/core/eq.c +17 -1
@@ -19,6 +19,7 @@#include "lib/clock.h" #include "diag/fw_tracer.h" #include "mlx5_irq.h" +#include "devlink.h" enum {MLX5_EQE_OWNER_INIT_VAL =0x1 ,
@@ -796,6 +797,21 @@ static void destroy_comp_eqs(struct mlx5_core_dev *dev) } } +static u16 comp_eq_depth_devlink_param_get (struct mlx5_core_dev *dev) +{ +struct devlink *devlink =priv_to_devlink (dev); +union devlink_param_value val; +int err; + + err =devlink_param_driverinit_value_get (devlink, +DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE , + &val); +if (!err) +return val.vu32; +mlx5_core_dbg (dev,"Failed to get param. using default. err = %d\n" , err); +return MLX5_COMP_EQ_SIZE ; +} +static int create_comp_eqs (struct mlx5_core_dev *dev) {struct mlx5_eq_table *table = dev->priv.eq_table;
@@ -807,7 +823,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)INIT_LIST_HEAD (&table->comp_eqs_list); ncomp_eqs = table->num_comp_eqs; - nent =MLX5_COMP_EQ_SIZE ; + nent =comp_eq_depth_devlink_param_get (dev);for (i =0 ; i < ncomp_eqs; i++) {struct mlx5_eq_param param = {};int vecidx = i;
Signature · 1 line
2.21.3
PATCH v3 4/7 devlink: Add new "event_eq_size" generic device param
In reply to Shay DroryAdd new device generic parameter to determine the size of the asynchronous control events EQ.
For example, to reduce event EQ size to 64, execute:
$ devlink dev param set pci/0000:06:00.0 \
name event_eq_size value 64 cmode driverinit
$ devlink dev reload pci/0000:06:00.0--- Documentation/networking/devlink/devlink-params.rst | 3 +++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 12 insertions(+)
Documentation/networking/devlink/devlink-params.rst +3 -0
@@ -132,3 +132,6 @@ own name. * - ``io_eq_size`` - u16 - Control the size of I/O completion EQs. + * - ``event_eq_size`` + - u16 + - Control the size of asynchronous control events EQ.
include/net/devlink.h +4 -0
@@ -460,6 +460,7 @@ enum devlink_param_generic_id {DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET ,DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP ,DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE , +DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE ,/* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -515,6 +516,9 @@ enum devlink_param_generic_id {#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME "io_eq_size"#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME "event_eq_size" +#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC (_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
net/core/devlink.c +5 -0
@@ -4471,6 +4471,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME, .type = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, + .name = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME, + .type = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE, + }, };static int devlink_param_generic_verify (const struct devlink_param *param)
Signature · 1 line
2.21.3
Jiri Pirko
maintainerRe: [PATCH net-next v3 4/7] devlink: Add new "event_eq_size" generic device param
Quoted 21 lines · Wed, Dec 08, 2021 at 03:17:19PM CET, [email protected] wrote:
Add new device generic parameter to determine the size of the asynchronous control events EQ.
For example, to reduce event EQ size to 64, execute:
$ devlink dev param set pci/0000:06:00.0 \ name event_eq_size value 64 cmode driverinit $ devlink dev reload pci/0000:06:00.0Signed-off-by Shay Drory <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>---
Documentation/networking/devlink/devlink-params.rst | 3 +++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 12 insertions(+)Documentation/networking/devlink/devlink-params.rst +0
-0
Documentation/networking/devlink/devlink-params.rst own name. · line 136
Quoted 5 lines
Documentation/networking/devlink/devlink-params.rst +2
-0@@ -132,3 +132,6 @@ own name. * - ``io_eq_size`` - u16 - Control the size of I/O completion EQs. + * - ``event_eq_size`` + - u16
And this.
Quoted 42 lines
Documentation/networking/devlink/devlink-params.rst +1
-0+ - Control the size of asynchronous control events EQ.include/net/devlink.h +4
-0@@ -460,6 +460,7 @@ enum devlink_param_generic_id {DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET ,DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP ,DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE , +DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE ,/* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,@@ -515,6 +516,9 @@ enum devlink_param_generic_id {#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME "io_eq_size"#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME "event_eq_size" +#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC (_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \net/core/devlink.c +5
-0@@ -4471,6 +4471,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME, .type = DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, + .name = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME, + .type = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE, + }, };static int devlink_param_generic_verify (const struct devlink_param *param)Signature · 1 line
2.21.3
PATCH v3 5/7 net/mlx5: Let user configure event_eq_size param
In reply to Shay DroryEvent EQ is an EQ which received the notification of almost all the events generated by the NIC.
Currently, each event EQ is taking 512KB of memory. This size is not needed in most use cases, and is critical with large scale. Hence, allow user to configure the size of the event EQ.
For example to reduce event EQ size to 64, execute::
$ devlink dev param set pci/0000:00:0b.0 name event_eq_size value 64 \
cmode driverinit
$ devlink dev reload pci/0000:00:0b.0--- Documentation/networking/devlink/mlx5.rst | 3 +++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 7 +++++++ drivers/net/ethernet/mellanox/mlx5/core/eq.c | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-)
Documentation/networking/devlink/mlx5.rst +3 -0
@@ -20,6 +20,9 @@ Parameters * - ``io_eq_size`` - driverinit - The range is between 64 and 4096. + * - ``event_eq_size`` + - driverinit + - The range is between 64 and 4096. The ``mlx5`` driver also implements the following driver-specific parameters.
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +7 -0
@@ -579,6 +579,8 @@ static const struct devlink_param mlx5_devlink_params[] = { mlx5_devlink_enable_remote_dev_reset_set, NULL),DEVLINK_PARAM_GENERIC (IO_EQ_SIZE ,BIT (DEVLINK_PARAM_CMODE_DRIVERINIT ),NULL ,NULL ,mlx5_devlink_eq_depth_validate ), +DEVLINK_PARAM_GENERIC (EVENT_EQ_SIZE ,BIT (DEVLINK_PARAM_CMODE_DRIVERINIT ), + NULL, NULL, mlx5_devlink_eq_depth_validate), };static void mlx5_devlink_set_params_init_values (struct devlink *devlink)
@@ -622,6 +624,11 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE , value); + + value.vu32 =MLX5_NUM_ASYNC_EQE ; +devlink_param_driverinit_value_set (devlink, +DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE , + value); } static const struct devlink_param enable_eth_param =
drivers/net/ethernet/mellanox/mlx5/core/eq.c +15 -1
@@ -623,6 +623,20 @@ static void cleanup_async_eq(struct mlx5_core_dev *dev, name, err); } +static u16 async_eq_depth_devlink_param_get (struct mlx5_core_dev *dev) +{ +struct devlink *devlink =priv_to_devlink (dev); +union devlink_param_value val; +int err; + + err =devlink_param_driverinit_value_get (devlink, +DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE , + &val); +if (!err) +return val.vu32; +mlx5_core_dbg (dev,"Failed to get param. using default. err = %d\n" , err); +return MLX5_NUM_ASYNC_EQE ; +}static int create_async_eqs (struct mlx5_core_dev *dev) {struct mlx5_eq_table *table = dev->priv.eq_table;
@@ -647,7 +661,7 @@ static int create_async_eqs(struct mlx5_core_dev *dev) param = (struct mlx5_eq_param ) { .irq_index =MLX5_IRQ_EQ_CTRL , - .nent =MLX5_NUM_ASYNC_EQE , + .nent =async_eq_depth_devlink_param_get (dev), };gather_async_events_mask (dev, param.mask);
Signature · 1 line
2.21.3
PATCH v3 6/7 devlink: Clarifies max_macs generic devlink param
In reply to Shay DroryThe generic param max_macs documentation isn't clear. Replace it with a more descriptive documentation
--- Documentation/networking/devlink/devlink-params.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/networking/devlink/devlink-params.rst +4 -2
@@ -118,8 +118,10 @@ own name. errors. * - ``max_macs`` - u32 - - Specifies the maximum number of MAC addresses per ethernet port of - this device. + - Typically macvlan, vlan net devices mac are also programmed in their + parent netdevice's Function rx filter. This parameter limit the + maximum number of unicast mac address filters to receive traffic from + per ethernet port of this device. * - ``region_snapshot_enable`` - Boolean - Enable capture of ``devlink-region`` snapshots.
Signature · 1 line
2.21.3
PATCH v3 7/7 net/mlx5: Let user configure max_macs generic param
In reply to Shay DroryCurrently, max_macs is taking 70Kbytes of memory per function. This size is not needed in all use cases, and is critical with large scale. Hence, allow user to configure the number of max_macs.
For example, to reduce the number of max_macs to 1, execute::
$ devlink dev param set pci/0000:00:0b.0 name max_macs value 1 \
cmode driverinit
$ devlink dev reload pci/0000:00:0b.0--- Documentation/networking/devlink/mlx5.rst | 3 + .../net/ethernet/mellanox/mlx5/core/devlink.c | 67 +++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/main.c | 21 ++++++ 3 files changed, 91 insertions(+)
Documentation/networking/devlink/mlx5.rst +3 -0
@@ -23,6 +23,9 @@ Parameters * - ``event_eq_size`` - driverinit - The range is between 64 and 4096. + * - ``max_macs`` + - driverinit + - The range is between 1 and 2^31. Only power of 2 values are supported. The ``mlx5`` driver also implements the following driver-specific parameters.
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +67 -0
91 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +21 -0
@@ -484,10 +484,26 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev, void *set_ctx)return set_caps (dev, set_ctx,MLX5_SET_HCA_CAP_OP_MOD_ODP ); } +static int max_uc_list_get_devlink_param (struct mlx5_core_dev *dev) +{ +struct devlink *devlink =priv_to_devlink (dev); +union devlink_param_value val; +int err; + + err =devlink_param_driverinit_value_get (devlink, +DEVLINK_PARAM_GENERIC_ID_MAX_MACS , + &val); +if (!err) +return val.vu32; +mlx5_core_dbg (dev,"Failed to get param. err = %d\n" , err); +return err; +} +static int handle_hca_cap (struct mlx5_core_dev *dev,void *set_ctx) {struct mlx5_profile *prof = &dev->profile;void *set_hca_cap; +int max_uc_list;int err; err =mlx5_core_get_caps (dev,MLX5_CAP_GENERAL );
@@ -561,6 +577,11 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)if (MLX5_CAP_GEN (dev, roce_rw_supported))MLX5_SET (cmd_hca_cap, set_hca_cap, roce,mlx5_is_roce_init_enabled (dev)); + max_uc_list =max_uc_list_get_devlink_param (dev); +if (max_uc_list >0 ) +MLX5_SET (cmd_hca_cap, set_hca_cap, log_max_current_uc_list, +ilog2 (max_uc_list)); +return set_caps (dev, set_ctx,MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE ); }
Signature · 1 line
2.21.3
Saeed Mahameed
maintainerQuoted 16 lines · Shay Drory
This series provides knobs which will enable users to minimize memory consumption of mlx5 Functions (PF/VF/SF). mlx5 exposes two new generic devlink params for EQ size configuration and uses devlink generic param
max_macs.Patches summary:
- Patch-1 Introducelog_max_current_uc_list_wr_supportedbit
- Patches-2-3 Provides I/O EQ size param which enables to save up to 128KB.
- Patches-4-5 Provides event EQ size param which enables to save up to 512KB.
- Patch-6 Clarifymax_macsparam.
- Patch-7 Providesmax_macsparam which enables to save up to 70KBIn total, this series can save up to 700KB per Function.
Quoted 8 lines
---
changelog:v2->v3:
- change type of EQ size param to u32 per Jiri suggestion.
- separate ifc changes to new patchv1->v2:
- convertio_eq_sizeandevent_eq_sizefromdevlink_resourcesto genericdevlink_params
Jakub are ok with this version ?
I would like to take it to my trees.
Jakub Kicinski
maintainerQuoted 15 lines · On Mon, 13 Dec 2021 23:06:26 +0000 Saeed Mahameed wrote:
Quoted 14 lines · Shay Drory
This series provides knobs which will enable users to minimize memory consumption of mlx5 Functions (PF/VF/SF). mlx5 exposes two new generic devlink params for EQ size configuration and uses devlink generic param
max_macs.Patches summary:
- Patch-1 Introducelog_max_current_uc_list_wr_supportedbit
- Patches-2-3 Provides I/O EQ size param which enables to save up to 128KB.
- Patches-4-5 Provides event EQ size param which enables to save up to 512KB.
- Patch-6 Clarifymax_macsparam.
- Patch-7 Providesmax_macsparam which enables to save up to 70KB
Quoted 4 lines
Quoted 1 line
In total, this series can save up to 700KB per Function.
Jakub are ok with this version ?
I would like to take it to my trees.
Yup, go for it. Sorry I didn't ack - I was going to apply it today but Dave reminded me that you probably want to take it thru your tree.
Saeed Mahameed
maintainerQuoted 17 lines · Jakub Kicinski
Quoted 16 lines · On Mon, 13 Dec 2021 23:06:26 +0000 Saeed Mahameed wrote:
Quoted 15 lines · Shay Drory
This series provides knobs which will enable users to minimize memory consumption of mlx5 Functions (PF/VF/SF). mlx5 exposes two new generic devlink params for EQ size configuration and uses devlink generic param
max_macs.Patches summary:
- Patch-1 Introducelog_max_current_uc_list_wr_supportedbit
- Patches-2-3 Provides I/O EQ size param which enables to save up to 128KB.
- Patches-4-5 Provides event EQ size param which enables to save up to 512KB.
- Patch-6 Clarifymax_macsparam.
- Patch-7 Providesmax_macsparam which enables to save up to 70KB
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
In total, this series can save up to 700KB per Function.
Jakub are ok with this version ?
I would like to take it to my trees.Yup, go for it. Sorry I didn't ack - I was going to apply it today but
Dave reminded me that you probably want to take it thru your tree.
Thanks ! applied. Will be sent in future PRs.
First patch needs to go to mlx5-next shared branch with rdma. So this will be sent in two separate PRs.