From 40625500ace1a348152f2894016a88feae6e9c6c Mon Sep 17 00:00:00 2001 From: Rongwei Liu Date: Mon, 22 Jan 2024 09:44:05 +0200 Subject: [PATCH] net/mlx5: fix stats query crash in secondary process [ upstream commit d312cab568ecdc8411cb3dc896e7d5020836399b ] The "outer_of_buffer" counter is owned by the primary process devx object and it is pointer by pointer in mlx5_priv structure. Actually, there are 4 levels' pointers in this piece of code. The secondary process can't access this part directly since it belongs to another process's heap. Return ENOTSUP as a workaround. Fixes: 750e48c7d8c3 ("common/mlx5: add DevX commands for queue counters") Signed-off-by: Rongwei Liu Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 85eda47f7d..1e1de4b547 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2895,9 +2895,15 @@ mlx5_os_read_dev_stat(struct mlx5_priv *priv, const char *ctr_name, if (priv->sh) { if (priv->q_counters != NULL && - strcmp(ctr_name, "out_of_buffer") == 0) + strcmp(ctr_name, "out_of_buffer") == 0) { + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + DRV_LOG(WARNING, "Devx out_of_buffer counter is not supported in the secondary process"); + rte_errno = ENOTSUP; + return 1; + } return mlx5_devx_cmd_queue_counter_query (priv->q_counters, 0, (uint32_t *)stat); + } MKSTR(path, "%s/ports/%d/hw_counters/%s", priv->sh->ibdev_path, priv->dev_port,