From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ACECCA04DD for ; Wed, 28 Oct 2020 11:50:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A6B5FCA0C; Wed, 28 Oct 2020 11:50:52 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by dpdk.org (Postfix) with ESMTP id 216A7C9F0 for ; Wed, 28 Oct 2020 11:50:49 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id d3so4299234wma.4 for ; Wed, 28 Oct 2020 03:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TMf6LbPGTXjnlzbt9UP75ENY+rz4v1AcPk7M40lsmOY=; b=AnN+kTCJB3iL51srWL41NojsIaP2O2pGqhIlNdCWBhJ/unBA4i2ykDMCQQ+RF4xBqb NfIParXJJZNaacAFGjpWeGQkCDMDn8nuwDAXtmJRlzNiOOEAcsu34YjjdpleUiIJZ4YM iR1pnYd8A13K/7g5X4ReLRyiaDExCeLZ0Nq2UUaadigij6c8jnrE45lGgXCJ27UiCDHQ fP95UdBmHii/WZszUljhTWEfmTYkpxQqdkMZ7DZPPXi2qGDZZtnSyFpyW1D7TEs4NHic pVqCQyiFC0vodGNrJMZldUWVcQTG0kEoKMu/AcCPH7fzQtVbmQWl548RTD8/yzO6+XdV OURw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TMf6LbPGTXjnlzbt9UP75ENY+rz4v1AcPk7M40lsmOY=; b=E23U3O0LoIHdXHsukPYVwSUw+XyCJTOqOKkFef2VoW+E4iNVl49UfhFhFE+F2+NmTk 3yeIyXSCy2/wyVrktRG7qin0t8nZmKOTPEgFKVRZUH9PhRIGutgLkOo1srONZJi+YMWZ 0lkVyJ5EN+GAlubxrlclQWczk+xHXiDR/OQGvPZYeorRNVZa7n3RCgUG03IhEyvejuIN 0+LhATyBtNSeVVSwc+vL6bGMsX+Aw/G7zYotQ66hDQglos1vhLYiVaD540ZrR0xRi5iK PkapFY/j0up0PIjNm9/aOjo4oeHE7ZyEsEVc0/xCM+w0ThXC2d/8pjXmuz76gt4HYwNx 6jhA== X-Gm-Message-State: AOAM5322LV4JztSbtxcQBusCjEQab/dQ5/u4Wscc1b5PO/PGtPFTdfdW dquA0Rs+kiiqiWu/eAR+NYs= X-Google-Smtp-Source: ABdhPJxbyekSLvPtTC82BQY7tFeri9phP9FGrpR3mV5THVIIvWF80hffA0V5QD6POxjXC7Q6Dgz80g== X-Received: by 2002:a7b:c04a:: with SMTP id u10mr7959313wmc.83.1603882248845; Wed, 28 Oct 2020 03:50:48 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id h7sm6463119wrt.45.2020.10.28.03.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:50:48 -0700 (PDT) From: luca.boccassi@gmail.com To: Chengchang Tang Cc: Wei Hu , Ferruh Yigit , dpdk stable Date: Wed, 28 Oct 2020 10:44:08 +0000 Message-Id: <20201028104606.3504127-89-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/testpmd: fix descriptor id check' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. 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. Thanks. Luca Boccassi --- >From 33eb75df240a7343f0279d6b7b8fab6b1e0345ce Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Fri, 25 Sep 2020 20:47:18 +0800 Subject: [PATCH] app/testpmd: fix descriptor id check [ upstream commit 25340d5342a1f0c34c7e9c1fb8c2becc7e70fa31 ] The number of desc is a per queue configuration. But in the check function, nb_txd & nb_rxd are used to check whether the desc_id is valid. nb_txd & nb_rxd are the global configuration of number of desc. If the queue configuration is changed by cmdline liks: "port config xx txq xx ring_size xxx", the real value will be changed. This patch use the real value to check whether the desc_id is valid. And if these are not configured by user. It will use the default value to check it, since the rte_eth_rx_queue_setup & rte_eth_tx_queue_setup will use a default value to configure the queue if nb_rx_desc or nb_tx_desc is zero. Fixes: af75078fece3 ("first public release") Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) Reviewed-by: Ferruh Yigit --- app/test-pmd/config.c | 76 +++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 67bc18de91..e1c7143586 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1684,6 +1684,38 @@ tx_queue_id_is_invalid(queueid_t txq_id) return 1; } +static int +get_rx_ring_size(portid_t port_id, queueid_t rxq_id, uint16_t *ring_size) +{ + struct rte_port *port = &ports[port_id]; + struct rte_eth_rxq_info rx_qinfo; + int ret; + + ret = rte_eth_rx_queue_info_get(port_id, rxq_id, &rx_qinfo); + if (ret == 0) { + *ring_size = rx_qinfo.nb_desc; + return ret; + } + + if (ret != -ENOTSUP) + return ret; + /* + * If the rte_eth_rx_queue_info_get is not support for this PMD, + * ring_size stored in testpmd will be used for validity verification. + * When configure the rxq by rte_eth_rx_queue_setup with nb_rx_desc + * being 0, it will use a default value provided by PMDs to setup this + * rxq. If the default value is 0, it will use the + * RTE_ETH_DEV_FALLBACK_RX_RINGSIZE to setup this rxq. + */ + if (port->nb_rx_desc[rxq_id]) + *ring_size = port->nb_rx_desc[rxq_id]; + else if (port->dev_info.default_rxportconf.ring_size) + *ring_size = port->dev_info.default_rxportconf.ring_size; + else + *ring_size = RTE_ETH_DEV_FALLBACK_RX_RINGSIZE; + return 0; +} + static int get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) { @@ -1717,22 +1749,38 @@ get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) } static int -rx_desc_id_is_invalid(uint16_t rxdesc_id) +rx_desc_id_is_invalid(portid_t port_id, queueid_t rxq_id, uint16_t rxdesc_id) { - if (rxdesc_id < nb_rxd) + uint16_t ring_size; + int ret; + + ret = get_rx_ring_size(port_id, rxq_id, &ring_size); + if (ret) + return 1; + + if (rxdesc_id < ring_size) return 0; - printf("Invalid RX descriptor %d (must be < nb_rxd=%d)\n", - rxdesc_id, nb_rxd); + + printf("Invalid RX descriptor %u (must be < ring_size=%u)\n", + rxdesc_id, ring_size); return 1; } static int -tx_desc_id_is_invalid(uint16_t txdesc_id) +tx_desc_id_is_invalid(portid_t port_id, queueid_t txq_id, uint16_t txdesc_id) { - if (txdesc_id < nb_txd) + uint16_t ring_size; + int ret; + + ret = get_tx_ring_size(port_id, txq_id, &ring_size); + if (ret) + return 1; + + if (txdesc_id < ring_size) return 0; - printf("Invalid TX descriptor %d (must be < nb_txd=%d)\n", - txdesc_id, nb_txd); + + printf("Invalid TX descriptor %u (must be < ring_size=%u)\n", + txdesc_id, ring_size); return 1; } @@ -1853,11 +1901,7 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id) { const struct rte_memzone *rx_mz; - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (rx_queue_id_is_invalid(rxq_id)) - return; - if (rx_desc_id_is_invalid(rxd_id)) + if (rx_desc_id_is_invalid(port_id, rxq_id, rxd_id)) return; rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id); if (rx_mz == NULL) @@ -1870,11 +1914,7 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id) { const struct rte_memzone *tx_mz; - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - if (tx_queue_id_is_invalid(txq_id)) - return; - if (tx_desc_id_is_invalid(txd_id)) + if (tx_desc_id_is_invalid(port_id, txq_id, txd_id)) return; tx_mz = ring_dma_zone_lookup("tx_ring", port_id, txq_id); if (tx_mz == NULL) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.546103677 +0000 +++ 0089-app-testpmd-fix-descriptor-id-check.patch 2020-10-28 10:35:11.632831908 +0000 @@ -1,8 +1,10 @@ -From 25340d5342a1f0c34c7e9c1fb8c2becc7e70fa31 Mon Sep 17 00:00:00 2001 +From 33eb75df240a7343f0279d6b7b8fab6b1e0345ce Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Fri, 25 Sep 2020 20:47:18 +0800 Subject: [PATCH] app/testpmd: fix descriptor id check +[ upstream commit 25340d5342a1f0c34c7e9c1fb8c2becc7e70fa31 ] + The number of desc is a per queue configuration. But in the check function, nb_txd & nb_rxd are used to check whether the desc_id is valid. nb_txd & nb_rxd are the global configuration of number of desc. @@ -16,7 +18,6 @@ nb_tx_desc is zero. Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) @@ -26,10 +27,10 @@ 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index 8f63b4ea40..0b655368b8 100644 +index 67bc18de91..e1c7143586 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c -@@ -2009,6 +2009,38 @@ tx_queue_id_is_invalid(queueid_t txq_id) +@@ -1684,6 +1684,38 @@ tx_queue_id_is_invalid(queueid_t txq_id) return 1; } @@ -68,7 +69,7 @@ static int get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) { -@@ -2042,22 +2074,38 @@ get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) +@@ -1717,22 +1749,38 @@ get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) } static int @@ -115,7 +116,7 @@ return 1; } -@@ -2178,11 +2226,7 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id) +@@ -1853,11 +1901,7 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id) { const struct rte_memzone *rx_mz; @@ -128,7 +129,7 @@ return; rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id); if (rx_mz == NULL) -@@ -2195,11 +2239,7 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id) +@@ -1870,11 +1914,7 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id) { const struct rte_memzone *tx_mz;