Skip to content

Commit 0844fa5

Browse files
shayshyiSaeed Mahameed
authored andcommitted
net/mlx5: Let user configure io_eq_size param
Currently, 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 Signed-off-by: Shay Drory <[email protected]> Reviewed-by: Moshe Shemesh <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 4740238 commit 0844fa5

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

Documentation/networking/devlink/mlx5.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ Parameters
1414

1515
* - Name
1616
- Mode
17+
- Validation
1718
* - ``enable_roce``
1819
- driverinit
20+
* - ``io_eq_size``
21+
- driverinit
22+
- The range is between 64 and 4096.
1923

2024
The ``mlx5`` driver also implements the following driver-specific
2125
parameters.

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,13 @@ static int mlx5_devlink_enable_remote_dev_reset_get(struct devlink *devlink, u32
546546
return 0;
547547
}
548548

549+
static int mlx5_devlink_eq_depth_validate(struct devlink *devlink, u32 id,
550+
union devlink_param_value val,
551+
struct netlink_ext_ack *extack)
552+
{
553+
return (val.vu16 >= 64 && val.vu16 <= 4096) ? 0 : -EINVAL;
554+
}
555+
549556
static const struct devlink_param mlx5_devlink_params[] = {
550557
DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,
551558
"flow_steering_mode", DEVLINK_PARAM_TYPE_STRING,
@@ -570,6 +577,8 @@ static const struct devlink_param mlx5_devlink_params[] = {
570577
DEVLINK_PARAM_GENERIC(ENABLE_REMOTE_DEV_RESET, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
571578
mlx5_devlink_enable_remote_dev_reset_get,
572579
mlx5_devlink_enable_remote_dev_reset_set, NULL),
580+
DEVLINK_PARAM_GENERIC(IO_EQ_SIZE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
581+
NULL, NULL, mlx5_devlink_eq_depth_validate),
573582
};
574583

575584
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)
608617
value);
609618
}
610619
#endif
620+
621+
value.vu32 = MLX5_COMP_EQ_SIZE;
622+
devlink_param_driverinit_value_set(devlink,
623+
DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE,
624+
value);
611625
}
612626

613627
static const struct devlink_param enable_eth_param =

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "lib/clock.h"
2020
#include "diag/fw_tracer.h"
2121
#include "mlx5_irq.h"
22+
#include "devlink.h"
2223

2324
enum {
2425
MLX5_EQE_OWNER_INIT_VAL = 0x1,
@@ -796,6 +797,21 @@ static void destroy_comp_eqs(struct mlx5_core_dev *dev)
796797
}
797798
}
798799

800+
static u16 comp_eq_depth_devlink_param_get(struct mlx5_core_dev *dev)
801+
{
802+
struct devlink *devlink = priv_to_devlink(dev);
803+
union devlink_param_value val;
804+
int err;
805+
806+
err = devlink_param_driverinit_value_get(devlink,
807+
DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE,
808+
&val);
809+
if (!err)
810+
return val.vu32;
811+
mlx5_core_dbg(dev, "Failed to get param. using default. err = %d\n", err);
812+
return MLX5_COMP_EQ_SIZE;
813+
}
814+
799815
static int create_comp_eqs(struct mlx5_core_dev *dev)
800816
{
801817
struct mlx5_eq_table *table = dev->priv.eq_table;
@@ -807,7 +823,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)
807823

808824
INIT_LIST_HEAD(&table->comp_eqs_list);
809825
ncomp_eqs = table->num_comp_eqs;
810-
nent = MLX5_COMP_EQ_SIZE;
826+
nent = comp_eq_depth_devlink_param_get(dev);
811827
for (i = 0; i < ncomp_eqs; i++) {
812828
struct mlx5_eq_param param = {};
813829
int vecidx = i;

0 commit comments

Comments
 (0)