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 1161342C08; Fri, 2 Jun 2023 00:13:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92E06406B8; Fri, 2 Jun 2023 00:13:46 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by mails.dpdk.org (Postfix) with ESMTP id F2F9740693 for ; Fri, 2 Jun 2023 00:13:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WAScBLBt2/3qzrjEQSdwb5v4q7pnmWTI0eB3W8nr3CfQBRhXDowLZzRe9tcpxF8iNDHk6J/LU9u05BABR5PdeKhUrVzGK8E0n7DGZ/WF2YnMqTS7hiwf2Jpzaqftzp6yKLV3Wu49e1UAefFU+RGPVeDNaUp3qYyhsgS0ZkNmXCUEiDxDW5iMtq3l+xdBuHTkZbXRusBygXsuPrOOIpXsCMoSkkuy1nnoKZ8WER4khIscwHn25iOT4wCEDJcC4vHvgYTMxTyqSa/5swq/uJ6nMkQpP+gjvhlK2xknUahXHUBNOFDnSyAZzKWnZ6yYT0Y+1ae9ZOKD0dbJpcloKxHsiw== 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=F/4PlilBSjLqF2xDOdphfL5uDPPW8kL1i4qKQM02dRU=; b=jNN+4i65UGHj8M5BNwndNCzA6rjjZ7PQrFgUZNSUYXqhfXat6KvIWeXOPh5K4QHNbT55PLbFXwHz1dONSvP4o5eLU7i6sJtIzjPh7GNwGEoOnL8jfm1rXcG6oy2GLdXiKIKbRnSgtysUXVp/yA4QiZ0J3uxnKqHhUg2vRhLCm2rJVOow6geK/LHR0BX6ROjZQyCunVTRZwYj3pqULJrF0xII/BO1QqjiGWxpoGNBZOYK0F/38sWFitK5TAbIgRJ3rbEG7D5sP6hB8PVlbZ/zay5lAl/7Hemo6c4WA+EarGs8qXiUE6XA4rE3LOHd7/nxW4wMyfnjp6wHem06UUOQIw== 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=F/4PlilBSjLqF2xDOdphfL5uDPPW8kL1i4qKQM02dRU=; b=WaAkuRvqCrgrocAbFyzYjwBG+PDaVW57JyJjJZCK7I9F3JWPJIfxt0/jUOONt2gTIGPbB233FpjxCRi+c+TQ8UaHmJFjPbLEyXcJgZMFaOdZebQDc50gZunZq27MDQt6VTpeap9x/oQ5xWkwRgzV2wvKP1EfehizKnOUwcLfnAI= 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 CY8PR12MB9036.namprd12.prod.outlook.com (2603:10b6:930:78::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 22:13:42 +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; Thu, 1 Jun 2023 22:13:42 +0000 Message-ID: Date: Thu, 1 Jun 2023 23:13:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v2 1/2] ethdev: add API to check queue ID validity Content-Language: en-US From: Ferruh Yigit 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0104.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::19) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CY8PR12MB9036:EE_ X-MS-Office365-Filtering-Correlation-Id: 95e22c30-5b91-48e1-a4e1-08db62ed75b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aPV1mX+h4MKFOmn01N89ObfWrF3gnxaFNQGTLNfLzmCpeR+/bixWNjvxC3ahtk6YFenZCQfq5M75KzVTn3bY5eeITedePgYsw70aFlbY61Zz9Wl7O58H/GCtFkI2FcWs2LzrGw+Pj4vZczAfuFltPsx8qV4aBZIw0HfQEqucxwSLRnrdL2HbnqpSrF8uU493GabqKOboaXbzvR8GMRzPKgd3j4Z2W19S8r+2763pcbdcJ2VBmpv0t01iMmPkVeOJuA+4UISzCyh4pzlAsaXCkF/93uJGL3XWPEI0BJvQx1hznr0lSGMUxlSX5xD7XxY9vKd6tkOhGQq1xovnDHxh5icATqxpWnk7qeN9qiXYdowWxR8+xfBH7LV+g1sWQX8mLbE+GdPvo/CcQh0M3YEyLfnTKliretuw1oF/htpgAGpjaat56NjqlbxmPzyn6EzWyYvvyxsT5n5T0Yq2FmTJT7TyMDrMd1L6yukmZPdBm+DsXSB+CLkgxxyfK8LRPML0XE5HdIXaSt12jySE4YYSkGIK9aoi5t21aTaPDPjIQes6Zes/wMDM4PsRpsjuojIpLctPzoVZtHZPphk//fZuxSPRilDmsPPoBkC4IUcteDIPXpFaW74chlqIgDPmIXYw2jG50/s37OwWry7EMqZauA== 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)(39860400002)(366004)(376002)(346002)(136003)(451199021)(478600001)(36756003)(53546011)(2616005)(26005)(6512007)(6506007)(186003)(83380400001)(6486002)(6666004)(41300700001)(38100700002)(4326008)(66476007)(66946007)(66556008)(316002)(44832011)(7416002)(86362001)(31696002)(2906002)(5660300002)(8936002)(31686004)(8676002)(110136005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QjFteklES3oybERmR1A2QW5BcDgrWVJORzBVMG44SVB5bVVTSnZoK3RiQXhm?= =?utf-8?B?bUt6Uk5Ba3YzVGVEV1J5MWpNNTZ2YzZDeVF2OTFWNC84T2N5MFoxMkxuVk9k?= =?utf-8?B?ZGswZlBOTkR2aXVXeUdEU1huYWc1ZGZUVUhFQk14a2VObFQyZGY3bUdKdFNZ?= =?utf-8?B?NUtkS3c2bHJoVnp3Y1ZUUXF2RTlSL09mUmJTNzVHYTdDekV6RHk2Sk00WXNL?= =?utf-8?B?NGtPK2RCZVBoZVRtQUEwT2R5dU1aMjh6cm50Z2p1VFp3NXpRVWVQa2x0U2oz?= =?utf-8?B?K280TFU3UnhSRHNVeUdpOTJQejRE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semZQ?= =?utf-8?Q?lvS0+9bpDfYSSeKoDlYK4nacR?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95e22c30-5b91-48e1-a4e1-08db62ed75b8 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 22:13:42.7067 (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: BHYlyeGux44v/azf6lYb2mi+xn3XYVt4mldRBaDmYapsAmbxC5Z6hBdZKXSKDZQF X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB9036 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/31/2023 5:31 PM, Ferruh Yigit wrote: > 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. > Hi Dengdui, It looks like there is no better suggestion, lets not block this patch more and continue with 'rte_eth_dev_is_valid_rxq()' & 'rte_eth_dev_is_valid_txq()' API names. Can you please send a v4, with changes in v3 but API names as above, and more description in the API documentation for what 'valid' means? >>> >>> 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] >> >