From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D85745C9B for ; Tue, 12 Nov 2024 23:08:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97F3640673; Tue, 12 Nov 2024 23:08:47 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 915A14064C for ; Tue, 12 Nov 2024 23:08:45 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-431481433bdso54584395e9.3 for ; Tue, 12 Nov 2024 14:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731449325; x=1732054125; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3AFtNswpZQRGq/wuNzEa6BuL0SJmGr2Fh2FH9kvPPv8=; b=Dc8MFpIaPoh7YyJveO+upWstRP+HKUpnXdeDBhoYE/HvmW+1b+Gyn7dzyyfKmk0M6i CETHsDlvKU5kZ8jcU994yd1s4/3uzzv3Gwd6dPp8bEkz+At2x42FbULgg8fzYGqKti54 ZZ+EaeFxfcUnE5nnYF+Rc5pgb/JgGnrGIyMc0pGpt/hnABGTq4aFMUVYfMIJ0e5SiHLz 2N1cOHSHcJH6aCWNiQ66hmdSbMa/lGp43ER0mKdNs8CcfH5etpzstELsaPRM3GCCFqsw x7grxegxzD4Dyo3RutfSBgVUpbROfQXK59I4acIK/T092JZGhsgXYOidNo12/a3a4CuE oxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731449325; x=1732054125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3AFtNswpZQRGq/wuNzEa6BuL0SJmGr2Fh2FH9kvPPv8=; b=QUIetw1H5+nR/m7hJJ7S+p++t409a1d9tSAId5cnYxJ2xAJ1F6gLUrtWgEm9X2TTkY DTOHtDWL6+ybzyzhx1J8/PkFLEbyOSWvvdThsKBLekWadck++V3TMMVK4JeM9p2zq4Yk ka3VJwarSrNM/OILuzBmSyjQAQyvyJtwpYKLXICl2TERI1zvfkf0bzbeHH+0tTqg0sNQ b4dm+PQpCdSffxr7H231aaL+fWV+vlJg57cEekJAJUWaW6DvhK9BsOiu0/2AceVkUHiR Sb2VHsFHaItIFMtNGsrsrryF+O+yw1P00D+NFbSgi4tY4ZEwFtPt6Qes8xrhZHvVG6hn KowQ== X-Forwarded-Encrypted: i=1; AJvYcCVbNpshAS6m2gfMAJE96Rdh0eNqK+VEpbI9JjOtHwu4jMACog9843vNBRtuLyWRVbKAGxn/ntc=@dpdk.org X-Gm-Message-State: AOJu0Yy0Ha6d7Qdi3nUysA2Hw0IBa79+9zinh73P3FkSZMTCoyY3jbRY d9oocTp7enF8kbTHNo4lFoYAjHUTOPdU91eDgIpR77uSaXVIzhPQdVofzA== X-Google-Smtp-Source: AGHT+IFrxiAfUR+TFeKFqB44V+GZB9COiKj2em+AQk+v0R0xZsVowXEC6WMCJFx3a5Cz+D04pfaAIA== X-Received: by 2002:a05:600c:5008:b0:42c:b9c7:f54b with SMTP id 5b1f17b1804b1-432d4ab926bmr6944725e9.16.1731449324945; Tue, 12 Nov 2024 14:08:44 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:e89d:e9a1:da72:2f9d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432d48bb442sm5056695e9.1.2024.11.12.14.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 14:08:43 -0800 (PST) From: luca.boccassi@gmail.com To: Igor Gutorov Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix reported Rx/Tx descriptor limits' has been queued to stable release 22.11.7 Date: Tue, 12 Nov 2024 22:07:24 +0000 Message-ID: <20241112220754.666489-14-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112220754.666489-1-luca.boccassi@gmail.com> References: <20241023211704.1216956-79-luca.boccassi@gmail.com> <20241112220754.666489-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/14/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/93dc1a00f680ab6256721fc88c294c1af82b9938 Thanks. Luca Boccassi --- >From 93dc1a00f680ab6256721fc88c294c1af82b9938 Mon Sep 17 00:00:00 2001 From: Igor Gutorov Date: Wed, 7 Aug 2024 23:44:05 +0300 Subject: [PATCH] net/mlx5: fix reported Rx/Tx descriptor limits [ upstream commit 4c3d7961d9002bb715a8ee76bcf464d633316d4c ] Currently, `rte_eth_dev_info.rx_desc_lim.nb_max` as well as `rte_eth_dev_info.tx_desc_lim.nb_max` shows 65535 as the limit, which results in a few problems: * It is not the actual Rx/Tx queue limit * Allocating an Rx queue and passing `rx_desc_lim.nb_max` results in an integer overflow and 0 ring size: ``` rte_eth_rx_queue_setup(0, 0, rx_desc_lim.nb_max, 0, NULL, mb_pool); ``` Which overflows ring size and generates the following log: ``` mlx5_net: port 0 increased number of descriptors in Rx queue 0 to the next power of two (0) ``` The same holds for allocating a Tx queue. Fixes: e60fbd5b24fc ("mlx5: add device configure/start/stop") Signed-off-by: Igor Gutorov Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_devx_cmds.c | 1 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 4 ++++ drivers/net/mlx5/mlx5_rxq.c | 8 ++++++++ drivers/net/mlx5/mlx5_txq.c | 8 ++++++++ 5 files changed, 22 insertions(+) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 9a0fc3501d..6740bb5222 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -953,6 +953,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->log_max_qp = MLX5_GET(cmd_hca_cap, hcattr, log_max_qp); attr->log_max_cq_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_cq_sz); attr->log_max_qp_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_qp_sz); + attr->log_max_wq_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_wq_sz); attr->log_max_mrw_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_mrw_sz); attr->log_max_pd = MLX5_GET(cmd_hca_cap, hcattr, log_max_pd); attr->log_max_srq = MLX5_GET(cmd_hca_cap, hcattr, log_max_srq); diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index c94b9eac06..49356aec37 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -245,6 +245,7 @@ struct mlx5_hca_attr { struct mlx5_hca_vdpa_attr vdpa; struct mlx5_hca_flow_attr flow; struct mlx5_hca_flex_attr flex; + uint8_t log_max_wq_sz; int log_max_qp_sz; int log_max_cq_sz; int log_max_qp; diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index df7cd241a2..08c6b18975 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -351,6 +351,10 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK; mlx5_set_default_params(dev, info); mlx5_set_txlimit_params(dev, info); + info->rx_desc_lim.nb_max = + 1 << priv->sh->cdev->config.hca_attr.log_max_wq_sz; + info->tx_desc_lim.nb_max = + 1 << priv->sh->cdev->config.hca_attr.log_max_wq_sz; if (priv->sh->cdev->config.hca_attr.mem_rq_rmp && priv->obj_ops.rxq_obj_new == devx_obj_ops.rxq_obj_new) info->dev_capa |= RTE_ETH_DEV_CAPA_RXQ_SHARE; diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 2f5c705660..98a670fae8 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -652,6 +652,14 @@ mlx5_rx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc, struct mlx5_rxq_priv *rxq; bool empty; + if (*desc > 1 << priv->sh->cdev->config.hca_attr.log_max_wq_sz) { + DRV_LOG(ERR, + "port %u number of descriptors requested for Rx queue" + " %u is more than supported", + dev->data->port_id, idx); + rte_errno = EINVAL; + return -EINVAL; + } if (!rte_is_power_of_2(*desc)) { *desc = 1 << log2above(*desc); DRV_LOG(WARNING, diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 46badcd0cc..cdc9755fe0 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -332,6 +332,14 @@ mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc) { struct mlx5_priv *priv = dev->data->dev_private; + if (*desc > 1 << priv->sh->cdev->config.hca_attr.log_max_wq_sz) { + DRV_LOG(ERR, + "port %u number of descriptors requested for Tx queue" + " %u is more than supported", + dev->data->port_id, idx); + rte_errno = EINVAL; + return -EINVAL; + } if (*desc <= MLX5_TX_COMP_THRESH) { DRV_LOG(WARNING, "port %u number of descriptors requested for Tx queue" -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-12 22:06:59.149114292 +0000 +++ 0014-net-mlx5-fix-reported-Rx-Tx-descriptor-limits.patch 2024-11-12 22:06:58.659307077 +0000 @@ -1 +1 @@ -From 4c3d7961d9002bb715a8ee76bcf464d633316d4c Mon Sep 17 00:00:00 2001 +From 93dc1a00f680ab6256721fc88c294c1af82b9938 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4c3d7961d9002bb715a8ee76bcf464d633316d4c ] + @@ -26 +27,0 @@ -Cc: stable@dpdk.org @@ -39 +40 @@ -index 9710dcedd3..a75f011750 100644 +index 9a0fc3501d..6740bb5222 100644 @@ -42 +43 @@ -@@ -1027,6 +1027,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, +@@ -953,6 +953,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, @@ -51 +52 @@ -index 6cf7999c46..2ad9e5414f 100644 +index c94b9eac06..49356aec37 100644 @@ -54 +55,2 @@ -@@ -267,6 +267,7 @@ struct mlx5_hca_attr { +@@ -245,6 +245,7 @@ struct mlx5_hca_attr { + struct mlx5_hca_vdpa_attr vdpa; @@ -57 +58,0 @@ - struct mlx5_hca_crypto_mmo_attr crypto_mmo; @@ -63 +64 @@ -index 6f24d649e0..7708a0b808 100644 +index df7cd241a2..08c6b18975 100644 @@ -66 +67 @@ -@@ -359,6 +359,10 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) +@@ -351,6 +351,10 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) @@ -78 +79 @@ -index c6655b7db4..5eac224b76 100644 +index 2f5c705660..98a670fae8 100644 @@ -81 +82 @@ -@@ -655,6 +655,14 @@ mlx5_rx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc, +@@ -652,6 +652,14 @@ mlx5_rx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc, @@ -97 +98 @@ -index f05534e168..3e93517323 100644 +index 46badcd0cc..cdc9755fe0 100644 @@ -100 +101 @@ -@@ -333,6 +333,14 @@ mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc) +@@ -332,6 +332,14 @@ mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc)