Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/mlx5: Let user configure event_eq_size param

Event 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

Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

authored by

Shay Drory and committed by
Saeed Mahameed
57ca7678 0b5705eb

+25 -1
+3
Documentation/networking/devlink/mlx5.rst
··· 20 20 * - ``io_eq_size`` 21 21 - driverinit 22 22 - The range is between 64 and 4096. 23 + * - ``event_eq_size`` 24 + - driverinit 25 + - The range is between 64 and 4096. 23 26 24 27 The ``mlx5`` driver also implements the following driver-specific 25 28 parameters.
+7
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 579 579 mlx5_devlink_enable_remote_dev_reset_set, NULL), 580 580 DEVLINK_PARAM_GENERIC(IO_EQ_SIZE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), 581 581 NULL, NULL, mlx5_devlink_eq_depth_validate), 582 + DEVLINK_PARAM_GENERIC(EVENT_EQ_SIZE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), 583 + NULL, NULL, mlx5_devlink_eq_depth_validate), 582 584 }; 583 585 584 586 static void mlx5_devlink_set_params_init_values(struct devlink *devlink) ··· 623 621 value.vu32 = MLX5_COMP_EQ_SIZE; 624 622 devlink_param_driverinit_value_set(devlink, 625 623 DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE, 624 + value); 625 + 626 + value.vu32 = MLX5_NUM_ASYNC_EQE; 627 + devlink_param_driverinit_value_set(devlink, 628 + DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, 626 629 value); 627 630 } 628 631
+15 -1
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 623 623 name, err); 624 624 } 625 625 626 + static u16 async_eq_depth_devlink_param_get(struct mlx5_core_dev *dev) 627 + { 628 + struct devlink *devlink = priv_to_devlink(dev); 629 + union devlink_param_value val; 630 + int err; 631 + 632 + err = devlink_param_driverinit_value_get(devlink, 633 + DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, 634 + &val); 635 + if (!err) 636 + return val.vu32; 637 + mlx5_core_dbg(dev, "Failed to get param. using default. err = %d\n", err); 638 + return MLX5_NUM_ASYNC_EQE; 639 + } 626 640 static int create_async_eqs(struct mlx5_core_dev *dev) 627 641 { 628 642 struct mlx5_eq_table *table = dev->priv.eq_table; ··· 661 647 662 648 param = (struct mlx5_eq_param) { 663 649 .irq_index = MLX5_IRQ_EQ_CTRL, 664 - .nent = MLX5_NUM_ASYNC_EQE, 650 + .nent = async_eq_depth_devlink_param_get(dev), 665 651 }; 666 652 667 653 gather_async_events_mask(dev, param.mask);