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 E428142BF6; Wed, 31 May 2023 18:31:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA37540A89; Wed, 31 May 2023 18:31:21 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) by mails.dpdk.org (Postfix) with ESMTP id 6813E40A82 for ; Wed, 31 May 2023 18:31:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JgvRFeE+qaNjgilV8FRalGw3fXYvjiPkxqkBz/8F9F1oE0ChpSNW+aBXAT54LCB2MTQxGpoR/LNmQweMa0I7npRJfzasS+tzb7A8oT6jSmfx7aijNjpu/DG0sNgKyhYD51lIp969JcvpU38X3yLFdCy16jN7sA3gu1/4Vzqm5nhFsh8Njzk49kq6GY48Ek81mVCuOGy0h/bSS7cj4xuUeGIUtypHDto9frJ5NlAHc5xuXM0DMZYUj+NSgqc49WCSBIHr/C9Kw7UMEUlJmc0ka5AdenR+BF/CNsEKPpgnPJ6LwAoU9GHYUfucfR+3SVoVLSQ0AiQrYHMRy0/BOZhYZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mq4SH5uXOrKo78gRr0WG3fHHyy4Uv8KN2ZXU3A1SwAI=; b=GxX9QbETSwybjDfc7dGjiGsqkp0ilk9dRCXSCFXoneNTpH3h+Z0a5Hi7WBZT9yi752pcLLPCCv+1aFQC3CKwzUcUNmcU2QbwAdaritASGOBMbYab4VUT8k6l4YDZbMkzmh3cRlN5uSA/Y8DDEmyHss+6Tt68LOOQ+D0ryzVVg/Zz9epdfZp2jMsDO+W9s6ZYf0LOztW2GxBFRY/YTLEUHIfPm4bWE2itnvIDVgB8Z6BqiNR9+aybAeTNSpErfy/D0Rd9YeBx+8I6GW5fC4hmpqpto96ljXheMNtQFfd2R1uSWgnTTlQaxEU5EzJ1PnMgb3TKsSpJG/9XQAw6T7A1qA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mq4SH5uXOrKo78gRr0WG3fHHyy4Uv8KN2ZXU3A1SwAI=; b=0iotK8Elb0/VyWjGknLnyA14llu+MG4DfBZn/d05sGHqiek31hwqGrEOZUmAJBLdjr4uSP0axUpDsfj5YQsQK+GkftuFBhYEzfRTWU+SrNFaAk/tcoNWhBKoL/UsnvMzWw+vvcXzrblQ3zjGowdXHADBsc9sEm9otav9uyXqdio= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BL3PR12MB6452.namprd12.prod.outlook.com (2603:10b6:208:3bb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Wed, 31 May 2023 16:31:18 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6433.022; Wed, 31 May 2023 16:31:18 +0000 Message-ID: Date: Wed, 31 May 2023 17:31:10 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Content-Language: en-US To: Andrew Rybchenko , Dengdui Huang , dev@dpdk.org Cc: 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: Ferruh Yigit Subject: Re: [PATCH v2 1/2] ethdev: add API to check queue ID validity In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0092.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::7) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL3PR12MB6452:EE_ X-MS-Office365-Filtering-Correlation-Id: 338340e4-86d4-4748-fbdb-08db61f47588 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AJQy1c8Ns5Djth8fIataWrwMtTEoz/3F7IBy/hZQ9KZ5akEX7Vh+NbJzm1C8E6vUPmMaIAgHtOt0pj8eMS27IOWrhFAgHqKdzFXeUFW7B3WCNqZJvmBXCgF1nIcEJFjOiANCtC7HMCDR4CKR/itLKr0CLxOZMC7QIt47CL9tg9wA802yMvWlRYnYOl7Fkx+N+f7ppgCPV6MYhb96E3J8UBmgRFm4L9tFhPwu8B8mlkA4YqRErIIw6YZ3xQ/WEibUhh/409KtdKVZKgsASHbPQfgMMAE5RWatlo1gxo+5EOtAVDN4m4l0QjVL111OPqdsIAzNOOZ00O085ZTplbA37Xk+As7YZ2F1E0b56B3zEzBT2d511psnQUg+9xbSSw+qN5DIExmgMM3TwFm44H42pTWmlM/mvpEW383I3W60jMC63BY115A/vi7iWJH0ahSN9JmIoLeNsmh83BJpVgtZM6ReDEdAMNVrU7lLsi3H5NsXuaN2Ni5eoCyCNRHMmpIU2LteNxUl73ZGNx4KjzMNUbQnWAe8CQao+104SjcCE+Y7lxuXvnERvuALhA8tLecxQT5XF0XXA1Li3rMhzvVSHrrqQOs9JBifYFF4zZerUjzxK1wWd2JSzd9aTQjEC2QvWUK12JQTqSiKFi0BxCX0JQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(346002)(39860400002)(376002)(366004)(451199021)(478600001)(31686004)(44832011)(110136005)(66556008)(66476007)(66946007)(41300700001)(38100700002)(6486002)(8676002)(7416002)(8936002)(86362001)(5660300002)(31696002)(26005)(2906002)(53546011)(186003)(6512007)(6506007)(83380400001)(6666004)(4326008)(316002)(2616005)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V3NJejE5SThkZ0dHRWh1RHpEOE45d3lBQW8yU0V4MXhLaVlaTzFNZDNtM2NU?= =?utf-8?B?d2VNbFkrVm14ajVRalV4YkhvL3kxbEpYbW13MDluekJHRkJRU0hES1BrT2RQ?= =?utf-8?B?cGZnWUQwcWNSdkc2NmdaT0x6NkVOVzJTWkJ2QVQyaU1zUDkzZUlZNmV5RkxG?= =?utf-8?B?TlhUVFFzN09mc2Vpd0pudzloc1JvZWxrNE1nYWd1K2kxSDNJYXlTOHI0aDl6?= =?utf-8?B?eW00VTQ2dUdvYTlMUFYvQkVqSHdRMm1lRVkrMUtVRURBaEFRdDhoNWpHZ01V?= =?utf-8?B?SGU3bjFTTjJyVE1KMXdNUk9qNn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NWStFTjNsZ3I2?= =?utf-8?Q?qr2CvOnPBnxT9+79JzEUbnDXs?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 338340e4-86d4-4748-fbdb-08db61f47588 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2023 16:31:17.9148 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xDs4RPbGVAGUElkT4U8JSSKoon0cSxkJBRmZ+a9Kw4w8ul7PFC0JbO7q6ttutLwF X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6452 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/2023 2:58 PM, Andrew Rybchenko wrote: > 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. > I understand the concern 'valid' keyword, but we already have an API as 'rte_eth_dev_is_valid_port()', which does similar checks, so 'rte_eth_dev_is_valid_rxq()' & 'rte_eth_dev_is_valid_txq()' looks consistent with it. v3 has API names, 'rte_eth_dev_rxq_avail()' & 'rte_eth_dev_txq_avail()', I am not sure about these naming too, it feels like queues are valid but it maybe in available and not available states. @Andrew, do you have any suggestion on the API naming? If not I am for going with rte_eth_dev_is_valid_rxq()' & 'rte_eth_dev_is_valid_txq()' mainly because of existing 'rte_eth_dev_is_valid_port()' API. Perhaps we can elaborate what 'valid' means in API documentation to help users. >> >> 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] >