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 5ED2D42B71; Mon, 22 May 2023 15:58:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D42BF40EE7; Mon, 22 May 2023 15:58:54 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id A8B2240EE5 for ; Mon, 22 May 2023 15:58:53 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 00E9050; Mon, 22 May 2023 16:58:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 00E9050 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1684763933; bh=XUhBnhrdJQFjOy2pTy+UL4DVBHuIfFmgvt2ytQ8QpBU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=rUx1zhff0r580vvzpOYaeNSz07IZFZGiQq/SP9FdiWiIim9EYznk0bRoRqDkSvflm N75xDgDEiAphi++sLGiLJAtg8sJclJb2ZVxJgzYhLqkBnc5qZ6lxPh4csu1kTSbNKx 7SnDZJTYSA0WWh1O7e/wrD8IuwfZqKetPd1pSH5Q= Message-ID: Date: Mon, 22 May 2023 16:58:52 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 1/2] ethdev: add API to check queue ID validity Content-Language: en-US To: Dengdui Huang , dev@dpdk.org Cc: ferruh.yigit@amd.com, stephen@networkplumber.org, thomas@monjalon.net, aman.deep.singh@intel.com, yuying.zhang@intel.com, anatoly.burakov@intel.com, lihuisong@huawei.com, liuyonglong@huawei.com, liudongdong3@huawei.com References: <20230516110021.1801443-1-huangdengdui@huawei.com> <20230522130947.345390-1-huangdengdui@huawei.com> <20230522130947.345390-2-huangdengdui@huawei.com> From: Andrew Rybchenko Organization: OKTET Labs In-Reply-To: <20230522130947.345390-2-huangdengdui@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 5/22/23 16:09, Dengdui Huang wrote: > The API rte_eth_dev_is_valid_rxq/txq checks > the port ID validity and then the Rx/Tx queue ID is valid. What is valid Tx/Rx queue? It depends on on caller expectations. Some functions are satisfied with just check vs configured number of queues. Some require the queue to be setup. May be some should require the queue to be started. So, I suggest to avoid term "valid" and be more precise here and API naming. > > Signed-off-by: Dengdui Huang > --- > doc/guides/rel_notes/release_23_07.rst | 5 ++++ > lib/ethdev/rte_ethdev.c | 30 +++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 36 ++++++++++++++++++++++++++ > lib/ethdev/version.map | 4 +++ > 4 files changed, 75 insertions(+) > > diff --git a/doc/guides/rel_notes/release_23_07.rst b/doc/guides/rel_notes/release_23_07.rst > index a9b1293689..19e645156f 100644 > --- a/doc/guides/rel_notes/release_23_07.rst > +++ b/doc/guides/rel_notes/release_23_07.rst > @@ -56,6 +56,11 @@ New Features > ======================================================= > > > +* **Added ethdev Rx/Tx queue id check API.** > + > + Added ethdev Rx/Tx queue id check API which provides functions id -> ID > + for check if Rx/Tx queue id is valid. id -> ID > + It should be two empty lines here and just one above. > Removed Items > ------------- > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 4d03255683..3d85218127 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -407,6 +407,36 @@ rte_eth_dev_is_valid_port(uint16_t port_id) > return is_valid; > } > > +int > +rte_eth_dev_is_valid_rxq(uint16_t port_id, uint16_t queue_id) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev = &rte_eth_devices[port_id]; > + > + if (queue_id >= dev->data->nb_rx_queues || > + dev->data->rx_queues[queue_id] == NULL) We already have internal eth_dev_validate_tx_queue(). Shouldn't it be used here? Also, some functions check that queues array is not NULL. If the the is excessive after queue number check, it should be consistent everywhere and corresponding check of the array pointer vs NULL should be removed in a separate cleanup patch. If the check is required in some corner cases (I hope no), it should be here as well. > + return -EINVAL; > + > + return 0; > +} [snip]