@@ -38,6 +38,8 @@ device drivers and their description must be added to the following table:
- A limited capacity of physical ports that the switch ASIC can support
* - ``io_eq_size``
- Control the size of I/O completion EQs
+ * - ``event_eq_size``
+ - Control the size of the asynchronous control events EQ
example usage
-------------
@@ -8,6 +8,7 @@
enum mlx5_devlink_resource_id {
MLX5_DL_RES_COMP_EQ = 1,
+ MLX5_DL_RES_ASYNC_EQ,
__MLX5_ID_RES_MAX,
MLX5_ID_RES_MAX = __MLX5_ID_RES_MAX - 1,
@@ -7,6 +7,7 @@
enum {
MLX5_EQ_MIN_SIZE = 64,
MLX5_EQ_MAX_SIZE = 4096,
+ MLX5_NUM_ASYNC_EQE = 4096,
MLX5_COMP_EQ_SIZE = 1024,
};
@@ -22,13 +23,35 @@ static int comp_eq_res_register(struct mlx5_core_dev *dev)
DEVLINK_RESOURCE_ID_PARENT_TOP, &comp_eq_size);
}
+static int async_eq_res_register(struct mlx5_core_dev *dev)
+{
+ struct devlink_resource_size_params async_eq_size;
+ struct devlink *devlink = priv_to_devlink(dev);
+
+ devlink_resource_size_params_init(&async_eq_size, MLX5_EQ_MIN_SIZE,
+ MLX5_EQ_MAX_SIZE, 1, DEVLINK_RESOURCE_UNIT_ENTRY);
+ return devlink_resource_register(devlink, DEVLINK_RESOURCE_GENERIC_NAME_EVENT_EQ,
+ MLX5_NUM_ASYNC_EQE, MLX5_DL_RES_ASYNC_EQ,
+ DEVLINK_RESOURCE_ID_PARENT_TOP,
+ &async_eq_size);
+}
+
void mlx5_devlink_res_register(struct mlx5_core_dev *dev)
{
int err;
err = comp_eq_res_register(dev);
if (err)
- mlx5_core_err(dev, "Failed to register resources, err = %d\n", err);
+ goto err_msg;
+
+ err = async_eq_res_register(dev);
+ if (err)
+ goto err;
+ return;
+err:
+ devlink_resources_unregister(priv_to_devlink(dev), NULL);
+err_msg:
+ mlx5_core_err(dev, "Failed to register resources, err = %d\n", err);
}
void mlx5_devlink_res_unregister(struct mlx5_core_dev *dev)
@@ -38,6 +61,7 @@ void mlx5_devlink_res_unregister(struct mlx5_core_dev *dev)
static const size_t default_vals[MLX5_ID_RES_MAX + 1] = {
[MLX5_DL_RES_COMP_EQ] = MLX5_COMP_EQ_SIZE,
+ [MLX5_DL_RES_ASYNC_EQ] = MLX5_NUM_ASYNC_EQE,
};
size_t mlx5_devlink_res_size(struct mlx5_core_dev *dev, enum mlx5_devlink_resource_id id)
@@ -647,7 +647,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 = mlx5_devlink_res_size(dev, MLX5_DL_RES_ASYNC_EQ),
};
gather_async_events_mask(dev, param.mask);
@@ -5,7 +5,6 @@
#define MLX5_CORE_EQ_H
#define MLX5_NUM_CMD_EQE (32)
-#define MLX5_NUM_ASYNC_EQE (0x1000)
#define MLX5_NUM_SPARE_EQE (0x80)
struct mlx5_eq;
@@ -365,6 +365,7 @@ typedef u64 devlink_resource_occ_get_t(void *priv);
#define DEVLINK_RESOURCE_GENERIC_NAME_PORTS "physical_ports"
#define DEVLINK_RESOURCE_GENERIC_NAME_IO_EQ "io_eq_size"
+#define DEVLINK_RESOURCE_GENERIC_NAME_EVENT_EQ "event_eq_size"
#define __DEVLINK_PARAM_MAX_STRING_VALUE 32
enum devlink_param_type {