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 C89A7A04B1 for ; Thu, 5 Nov 2020 13:41:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C184BC7FA; Thu, 5 Nov 2020 13:41:34 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id E91C6C7F0 for ; Thu, 5 Nov 2020 13:41:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604580091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sCcC0bIHWmQ7vr3LY5LPeRlQOh9jaE+8bsIQckTcQsc=; b=AwJdS6cwObK4AHTw74N+AnUdz+S4yQN2S+h2ivl+VlacDKrR/h/O1ITfDoWySrspZincXA Mm8C7GZXSYAoCzGUj108Auxf2Z0kWLRBVR6rBhxl2V9PzgwS2QDiaQrjpaE87lo7YOM6Hq v9jJbQkc5wuVl0tUBet2amm+QXqLNok= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-kx5-svZlOJq9kv5gbLBS5A-1; Thu, 05 Nov 2020 07:41:28 -0500 X-MC-Unique: kx5-svZlOJq9kv5gbLBS5A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 670895719F; Thu, 5 Nov 2020 12:41:27 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42B195C5DE; Thu, 5 Nov 2020 12:41:26 +0000 (UTC) From: Kevin Traynor To: Chengchang Tang Cc: Wei Hu , Ferruh Yigit , dpdk stable Date: Thu, 5 Nov 2020 12:39:40 +0000 Message-Id: <20201105124015.306404-33-ktraynor@redhat.com> In-Reply-To: <20201105124015.306404-1-ktraynor@redhat.com> References: <20201105124015.306404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'app/testpmd: fix descriptor id check' has been queued to LTS release 18.11.11 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 LTS release 18.11.11 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/10/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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/ec1022d0c2daa63a53a6e8c77dd893c338cd16d4 Thanks. Kevin. --- >From ec1022d0c2daa63a53a6e8c77dd893c338cd16d4 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 8636c02423..bce37a423f 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1515,4 +1515,36 @@ tx_queue_id_is_invalid(queueid_t txq_id) } +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) @@ -1548,20 +1580,36 @@ 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; } @@ -1680,9 +1728,5 @@ 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); @@ -1697,9 +1741,5 @@ 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); -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-05 12:38:54.898471150 +0000 +++ 0033-app-testpmd-fix-descriptor-id-check.patch 2020-11-05 12:38:54.232896013 +0000 @@ -1 +1 @@ -From 25340d5342a1f0c34c7e9c1fb8c2becc7e70fa31 Mon Sep 17 00:00:00 2001 +From ec1022d0c2daa63a53a6e8c77dd893c338cd16d4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 25340d5342a1f0c34c7e9c1fb8c2becc7e70fa31 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -29 +30 @@ -index 8f63b4ea40..0b655368b8 100644 +index 8636c02423..bce37a423f 100644 @@ -32 +33 @@ -@@ -2010,4 +2010,36 @@ tx_queue_id_is_invalid(queueid_t txq_id) +@@ -1515,4 +1515,36 @@ tx_queue_id_is_invalid(queueid_t txq_id) @@ -69 +70 @@ -@@ -2043,20 +2075,36 @@ get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) +@@ -1548,20 +1580,36 @@ get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size) @@ -114 +115 @@ -@@ -2179,9 +2227,5 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id) +@@ -1680,9 +1728,5 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id) @@ -125 +126 @@ -@@ -2196,9 +2240,5 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id) +@@ -1697,9 +1741,5 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id)