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 8A90BA04AF; Tue, 22 Sep 2020 16:53:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5FEA61DAF5; Tue, 22 Sep 2020 16:53:10 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2AA331DAF4 for ; Tue, 22 Sep 2020 16:53:09 +0200 (CEST) IronPort-SDR: GsU/zhbTRZVthnjt8f8KsMGhHAAQe6W3/pQMCTvgKmul9YheFZsXhHa50e+qh6iSpLj+ncLSo7 hTHHnwHQb3Tw== X-IronPort-AV: E=McAfee;i="6000,8403,9752"; a="222210897" X-IronPort-AV: E=Sophos;i="5.77,291,1596524400"; d="scan'208";a="222210897" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 07:53:06 -0700 IronPort-SDR: ySAJ2QtcBg8BgCj745Z5QqQWQsMipUU0jYBvT96DGhLN2hTpFK14PnAp19DS+odPIT0jWFFMYY E4K/wwpnmlKQ== X-IronPort-AV: E=Sophos;i="5.77,291,1596524400"; d="scan'208";a="454515555" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.227.201]) ([10.213.227.201]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 07:53:05 -0700 To: "Wei Hu (Xavier)" , dev@dpdk.org Cc: xavier.huwei@huawei.com References: <20200818120254.72792-1-huwei013@chinasoftinc.com> <20200919104708.58451-1-xavier_huwei@163.com> <20200919104708.58451-6-xavier_huwei@163.com> From: Ferruh Yigit Message-ID: <6e9c3318-1d89-3a50-9540-dbb80893ad8f@intel.com> Date: Tue, 22 Sep 2020 15:53:04 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200919104708.58451-6-xavier_huwei@163.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 5/6] app/testpmd: fix valid desc id check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 9/19/2020 11:47 AM, Wei Hu (Xavier) wrote: > From: Chengchang Tang > > 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 confiure the queue if nb_rx_desc or 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) > --- > app/test-pmd/config.c | 53 +++++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 43 insertions(+), 10 deletions(-) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 882de2d..b7851c7 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1891,22 +1891,55 @@ tx_queue_id_is_invalid(queueid_t txq_id) > } > > 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) > + struct rte_port *port = &ports[port_id]; > + uint16_t ring_size; > + > + /* > + * 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; > + > + 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 %d (must be < ring_size=%d)\n", > + rxdesc_id, ring_size); > return 1; +1 to fix, but similar comment as previous patch, can 'rte_eth_rx_queue_info_get()' be used to detect the 'ring_size'?