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 05FE643154; Fri, 13 Oct 2023 13:36:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8536C402D4; Fri, 13 Oct 2023 13:36:18 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 26905402D3 for ; Fri, 13 Oct 2023 13:36:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jOsyg1OeG15iJNNjErNwQoYissuIqemQCm+PbwSdV62WYupfItt2ZrKrA5D+q4QlCAQN926YLXTe62Y0eyPvF7lybayHxSm/zYmTL0pdTAIBHBMkGwPVAzhV6RuI5rXjUtBHYrhEzr+nqWnOYnJFGDL4w8iuKuCB9IFxXRLQluRUcQbEhuf/w5YrfmPBJtd6p+RafrREzjW3Y4gu0MhOyNJQ8stDUFjvlq7Rb86kJaHYHLYOFCy04v2QBtlvpnPnTG+JrlWk37CPzIMs8VE4GNyo8/NF9QOVjdIz1m5+J1fchRy4zIc0B3BOMzhPa6fi74Y09culjdRDoew036U/4A== 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=s3lMcshMGeUZBWyoYaWlMZBb3KOIicI9fcNjp6SIPrI=; b=Gnm4pzQRiNmgooclxqc3oMac0/LDMKQVgUrMPbvpYCsije9iFrwx/BfPNq3fRjsrjY8NmX6L2GL9QbUNjToqJQ6iaKOa3iA+15fPmA7fMVImOAv4cOiS3JJtspjJvecF36bsqDg04RuCVwgD93eh731Q4NzO6pRxmYOxMbOaZUSMHMwzqWflo6PY5SRo9/d7aBBJamvIdgkk9QhYr8RLN9Hn4pZrXInOSRFz2HkELiVY+5pFn8RQHfY2j+fYNcJTXMILNWWeOvAoDH4QUHrcK3B4vYwz9bs/tZmCMfQoslef6MpRlrZWdxFpEWse1oTwnDM8E5y/eHND+tnwBPqxjQ== 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=s3lMcshMGeUZBWyoYaWlMZBb3KOIicI9fcNjp6SIPrI=; b=w6yXSMEY2w7ItW3oN43/2EfjEkw6a/BqIWE1Lpc68w6T2nYwlylq0rKU6mVI+so+/Bm74s+dswNGAye/11KDiVaZHy3LkoZFOwvc+ajqY/w62J1/hsI0lrj/zXDpLMnnEJ3W2EYogNszM9zaMwxX/ni0zeiBt8qAvxSOglXPbeE= 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 SA3PR12MB8438.namprd12.prod.outlook.com (2603:10b6:806:2f6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 11:36:12 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::102f:c69b:d3e5:7fe8]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::102f:c69b:d3e5:7fe8%4]) with mapi id 15.20.6863.032; Fri, 13 Oct 2023 11:36:12 +0000 Message-ID: Date: Fri, 13 Oct 2023 12:36:04 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ethdev: clarify device queue state after start and stop References: <20230721160422.3848154-1-ferruh.yigit@amd.com> <20230928205930.2619353-1-ferruh.yigit@amd.com> Content-Language: en-US To: David Marchand Cc: Thomas Monjalon , Andrew Rybchenko , dev@dpdk.org, Jie Hai , Song Jiale , Yuan Peng , Raslan Darawsheh , Qiming Yang , Ivan Malov , Huisong Li From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRT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VGkguFw/tXmA17nx+c2uR5jx8wb4j68umG2X++0dSta5eHAVhmtXvrqPW6Ku 3FQ= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0431.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a0::35) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA3PR12MB8438:EE_ X-MS-Office365-Filtering-Correlation-Id: b4b8a90c-b0e9-4f61-526c-08dbcbe09a15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x5CoEhGu+UMIJf+LLpxViD/Yb/IkuKO+Ti6CQcCqMs96B5hQgFsAzGJN/xHiMuqq/P7pNMCCeYEgVHpA6ubd+3b1/IHxaPjL5cAv3I3/72YK1UE+zww5/ngR+VvzbChrW79TfR9GGIxaRO5dXKvUgUvvHtGLHo/5hEqlIlPKzbI06pYe4pkWtszNCFXFnJudi1DHnl/semJhoAhDUlLdqYAVow+mLh3JWtoqRBu5YVZkIf0Y3qmwPQsslZ4QDvRHXRsBNXZAFqMBjzaUEtLsgq/FkUOu2/qN2+MDaJOe5nnsgVVXA12OKqIUyitFqnbFC/RuH50teTxlYh8lgJ1uLwimQPHtpa98qhtgFsXdsF7WG+YBMH2vvwR8oiwzkYyxlofQAbXujEOGkob0mg3eCo0jVxy6Nyljw50BL9IRGEIvYuFM9kn8o4ODxm3ggvd12a3OXnYLQV5DS0+vfve8wlf17FueGurfxEULXJerojQ420cqzzAlmv0KxYkuHrZGoRS1ukpWf3fHgyEQtb/GzNzGTy7j1P6aworn7zsJ2BS45MbKjkCvGtisWiivEtVbw399uBSX2QBmIdwil6IqSBylY56cLge4o3FP5o9GvnIqHKEyUC9FH99IejeSLMOghgtE6idsMQSnICcz+Fx2eg== 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:(13230031)(376002)(39860400002)(346002)(136003)(366004)(396003)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(478600001)(316002)(6916009)(6512007)(6506007)(6666004)(6486002)(53546011)(54906003)(66556008)(66476007)(66946007)(31686004)(4326008)(41300700001)(44832011)(8936002)(8676002)(38100700002)(26005)(2616005)(7416002)(2906002)(5660300002)(36756003)(31696002)(83380400001)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NEZ6T2Q4RnBVS1ozTTBOR21xcHJKdGI4dlg1YzUvdHZpN215NWl3bnNYOGZa?= =?utf-8?B?WGlxQ003NlloelJtMTV5VUc1MWJOWHZjYU1QeWMzdUdPWTJ3THRLNmdBelJv?= =?utf-8?B?ck5iOFdKVXJpb0RuRXlTcWwvY284VHM1S0o3VkU4RjVjMG94OEJFUmxtT3hG?= =?utf-8?B?RHFKVGt4YUc2ZWxpdWtxTC9RMGltWjdwb1NxZUxocEZIemwvV2hncXk4eVN4?= =?utf-8?B?aVcrbjlYQ3pTZnZESnZEdzBnOG04YWZrRDBrSjNTVy9pTXE2anNBaDBldHlR?= =?utf-8?B?ejh0TFdSRVpDdFRjMFNVWlhjeUo2cGpjb0oxOWdQb3VRRXk3eTdRNTN3ZGlK?= =?utf-8?B?bWNhMU1rbGhnWWVPT0Y1Z1ZzczZ5Y2NnSm5tTGJFSjVCcGJtMjdYei9xZGxP?= =?utf-8?B?dzZoREZSVDNBQ0t3SzFJbEZxR0pqUzJkYTBHc0NpK2JNWWFwWTZlcFJPOHRV?= =?utf-8?B?MUcwcGN1c0lIMkV5SFI4bXBiU0JVbHhHQjFaTm5xZmM3enNBRl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W5CQ01WQTZQbm9ibUhxUjBUZzVLTVp3MWpx?= =?utf-8?B?Tlc0ZE53N09MQU5jcHJIY1VyRGZQZURNNnZXZjNJcStpNnV1UFI1dGw2cEpx?= =?utf-8?B?aGNCWUtFcVZoc2xpRkFhcjZVaEc3aCtXYXdQUkdTbzJMQ3kzeTNVNmRXWTFR?= =?utf-8?B?R0tmUmFJNzVHeXllVkZYT3ppcUkrNGd5R2JuODYxOHFtblJVaGdaeXBHOTBw?= =?utf-8?B?NmNIakE4ZksvZEpPZTNBN1ZFTEdGNGh5VTlNd3p3a1dPRkVlbkNSZTFmTGVt?= =?utf-8?B?M29uNTZlN3dhR3dnamp4emJVTWxRbTROQjJBVGx1S1FxWjlvMFFiTHVFL3Vu?= =?utf-8?B?NDlxM3JWUXdEV1B3RDBDc1pMKzN0RWRNeThsV3dYdmJ2aTdKTVdnUHR5QVJU?= =?utf-8?B?a1AxMWpTWGx6WWFIV3BXS2lEckZCWDJHemVEK2tsNlM4bkhpaGNOVm5uZWEr?= =?utf-8?B?eERuWGRzclJwdEpma3NGWGtzZnhtTFU4OTRwK0EvRGdnRlJHa29iQi9RcFJM?= =?utf-8?B?eWpxNEgzZ2thQk1Gdzh0OThlOTZ1OUxFZU4xRndEUjN6K08yYmxZWlE2dm1H?= =?utf-8?B?eGtJcFZnc210SmF1bSs2d055a0RBYnJYMFU2QS91SytoMXV6S1dKejZGK3Jz?= =?utf-8?B?dmI2cVlXNkh0YnBQc0JmOWVTcUZJcW1IeFZ6aDFudUtwZmUyVDl3TEZMQm1p?= =?utf-8?Q?v90o2wzwzMtJB0RdIHorGMEf+?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4b8a90c-b0e9-4f61-526c-08dbcbe09a15 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 11:36:12.4662 (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: 8XspNBhjKzulR017h9PaRuuNmmCg+/Bniv++3lMhiBXBG8bbsnaF39UpC9qzQLQ7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8438 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 10/12/2023 10:33 AM, David Marchand wrote: > Hello Ferruh, > > On Thu, Sep 28, 2023 at 10:59 PM Ferruh Yigit wrote: >> >> Drivers start/stop device queues on port start/stop, but not all drivers >> update queue state accordingly. >> >> This becomes more visible if a specific queue stopped explicitly and >> port stopped/started later, in this case although all queues are >> started, the state of that specific queue is stopped and it is >> misleading. >> >> Misrepresentation of queue state became a defect with commit [1] that >> does forwarding decision based on queue state and commit [2] that gets >> up to date queue state from ethdev/device before forwarding. >> >> [1] >> commit 3c4426db54fc ("app/testpmd: do not poll stopped queues") >> >> [2] >> commit 5028f207a4fa ("app/testpmd: fix secondary process packet forwarding") >> >> This patch documents that status of all queues of a device should be >> `RTE_ETH_QUEUE_STATE_STOPPED` after port stop and their status should >> be`RTE_ETH_QUEUE_STATE_STARTED` after port start. >> >> Also an unit test added to verify drivers. >> >> Signed-off-by: Ferruh Yigit >> --- >> Cc: Jie Hai >> Cc: Song Jiale >> Cc: Yuan Peng >> Cc: Raslan Darawsheh >> Cc: Qiming Yang >> Cc: Ivan Malov >> Cc: Huisong Li >> >> v1: >> * fix memset >> * remove commented out code >> * update unit test to skip queue state if >> rte_eth_[rt]x_queue_info_get() is not supported >> --- >> app/test/meson.build | 1 + >> app/test/test_ethdev_api.c | 184 +++++++++++++++++++++++++++++++++++++ >> lib/ethdev/rte_ethdev.h | 5 + >> 3 files changed, 190 insertions(+) >> create mode 100644 app/test/test_ethdev_api.c >> >> diff --git a/app/test/meson.build b/app/test/meson.build >> index 05bae9216dbc..05bbe84868f6 100644 >> --- a/app/test/meson.build >> +++ b/app/test/meson.build >> @@ -65,6 +65,7 @@ source_file_deps = { >> 'test_efd_perf.c': ['efd', 'hash'], >> 'test_errno.c': [], >> 'test_ethdev_link.c': ['ethdev'], >> + 'test_ethdev_api.c': ['ethdev'], > > Nit: aphabetical sort > ack >> 'test_event_crypto_adapter.c': ['cryptodev', 'eventdev', 'bus_vdev'], >> 'test_event_eth_rx_adapter.c': ['ethdev', 'eventdev', 'bus_vdev'], >> 'test_event_eth_tx_adapter.c': ['bus_vdev', 'ethdev', 'net_ring', 'eventdev'], >> diff --git a/app/test/test_ethdev_api.c b/app/test/test_ethdev_api.c >> new file mode 100644 >> index 000000000000..68239f82ff33 >> --- /dev/null >> +++ b/app/test/test_ethdev_api.c >> @@ -0,0 +1,184 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright (C) 2023, Advanced Micro Devices, Inc. >> + */ >> + >> +#include >> +#include >> + >> +#include >> +#include "test.h" >> + >> +#define NUM_RXQ 2 >> +#define NUM_TXQ 2 >> +#define NUM_RXD 512 >> +#define NUM_TXD 512 >> +#define NUM_MBUF 1024 >> +#define MBUF_CACHE_SIZE 256 >> + >> +static int32_t >> +ethdev_api_queue_status(void) >> +{ >> + struct rte_eth_dev_info dev_info; >> + struct rte_eth_rxq_info rx_qinfo; >> + struct rte_eth_txq_info tx_qinfo; >> + struct rte_mempool *mbuf_pool; >> + struct rte_eth_conf eth_conf; >> + uint16_t port_id; >> + int ret; >> + > > Should we return TEST_SKIPPED if no ethdev port is present? > It seems more valid to me than returning TEST_SUCCESS. > +1 to TEST_SKIPPED > >> + mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUF, MBUF_CACHE_SIZE, 0, >> + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); >> + >> + RTE_ETH_FOREACH_DEV(port_id) { >> + memset(ð_conf, 0, sizeof(eth_conf)); >> + ret = rte_eth_dev_configure(port_id, NUM_RXQ, NUM_TXQ, ð_conf); >> + TEST_ASSERT(ret == 0, >> + "Port(%u) failed to configure.\n", port_id); >> + >> + /* RxQ setup */ >> + for (uint16_t queue_id = 0; queue_id < NUM_RXQ; queue_id++) { >> + ret = rte_eth_rx_queue_setup(port_id, queue_id, NUM_RXD, >> + rte_socket_id(), NULL, mbuf_pool); >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to setup RxQ.\n", >> + port_id, queue_id); >> + } >> + >> + /* TxQ setup */ >> + for (uint16_t queue_id = 0; queue_id < NUM_TXQ; queue_id++) { >> + ret = rte_eth_tx_queue_setup(port_id, queue_id, NUM_TXD, >> + rte_socket_id(), NULL); >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to setup TxQ.\n", >> + port_id, queue_id); >> + } >> + >> + ret = rte_eth_dev_info_get(port_id, &dev_info); >> + TEST_ASSERT(ret == 0, >> + "Port(%u) failed to get dev info.\n", port_id); >> + >> + /* Initial RxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_rx_queues; queue_id++) { >> + ret = rte_eth_rx_queue_info_get(port_id, queue_id, &rx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get RxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(rx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED, >> + "Wrong initial Rx queue(%u) state(%d)\n", >> + queue_id, rx_qinfo.queue_state); >> + } >> + >> + /* Initial TxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_tx_queues; queue_id++) { >> + ret = rte_eth_tx_queue_info_get(port_id, queue_id, &tx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get TxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(tx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED, >> + "Wrong initial Tx queue(%u) state(%d)\n", >> + queue_id, tx_qinfo.queue_state); >> + } >> + >> + >> + ret = rte_eth_dev_start(port_id); >> + TEST_ASSERT(ret == 0, >> + "Port(%u) failed to start.\n", port_id); >> + >> + /* Started RxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_rx_queues; queue_id++) { >> + ret = rte_eth_rx_queue_info_get(port_id, queue_id, &rx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get RxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(rx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STARTED, >> + "Wrong started Rx queue(%u) state(%d)\n", >> + queue_id, rx_qinfo.queue_state); >> + } >> + >> + /* Started TxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_tx_queues; queue_id++) { >> + ret = rte_eth_tx_queue_info_get(port_id, queue_id, &tx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get TxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(tx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STARTED, >> + "Wrong started Tx queue(%u) state(%d)\n", >> + queue_id, tx_qinfo.queue_state); >> + } >> + >> + > > Nit: I would remove one of those empty lines. > ack >> + ret = rte_eth_dev_stop(port_id); >> + TEST_ASSERT(ret == 0, >> + "Port(%u) failed to stop.\n", port_id); >> + >> + /* Stopped RxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_rx_queues; queue_id++) { >> + ret = rte_eth_rx_queue_info_get(port_id, queue_id, &rx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get RxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(rx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED, >> + "Wrong stopped Rx queue(%u) state(%d)\n", >> + queue_id, rx_qinfo.queue_state); >> + } >> + >> + /* Stopped TxQ */ >> + for (uint16_t queue_id = 0; queue_id < dev_info.nb_tx_queues; queue_id++) { >> + ret = rte_eth_tx_queue_info_get(port_id, queue_id, &tx_qinfo); >> + if (ret == -ENOTSUP) >> + continue; >> + >> + TEST_ASSERT(ret == 0, >> + "Port(%u), queue(%u) failed to get TxQ info.\n", >> + port_id, queue_id); >> + >> + TEST_ASSERT(tx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED, >> + "Wrong stopped Tx queue(%u) state(%d)\n", >> + queue_id, tx_qinfo.queue_state); >> + } >> + } >> + >> + return TEST_SUCCESS; >> +} >> + >> +static struct unit_test_suite ethdev_api_testsuite = { >> + .suite_name = "ethdev API tests", >> + .setup = NULL, >> + .teardown = NULL, >> + .unit_test_cases = { >> + TEST_CASE(ethdev_api_queue_status), >> + /* TODO: Add deferred_start queue status test */ >> + TEST_CASES_END() /**< NULL terminate unit test array */ >> + } >> +}; >> + >> +static int >> +test_ethdev_api(void) >> +{ >> + rte_log_set_global_level(RTE_LOG_DEBUG); >> + rte_log_set_level(RTE_LOGTYPE_EAL, RTE_LOG_DEBUG); >> + >> + return unit_test_suite_runner(ðdev_api_testsuite); >> +} >> + >> +REGISTER_TEST_COMMAND(ethdev_api, test_ethdev_api); > > REGISTER_FAST_TEST or REGISTER_DRIVER_TEST. > This is not driver test, and not ready enough to add fast test, we need to be sure all drivers updates queue state properly, so for now I think better to keep macro as it is. > >> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h >> index 8542257721c9..6441fe049b06 100644 >> --- a/lib/ethdev/rte_ethdev.h >> +++ b/lib/ethdev/rte_ethdev.h >> @@ -2812,6 +2812,9 @@ int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id); >> * Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before >> * PMD port start callback function is invoked. >> * >> + * All device queues (except form deferred start queues) status should be >> + * `RTE_ETH_QUEUE_STATE_STARTED` after start. >> + * >> * On success, all basic functions exported by the Ethernet API (link status, >> * receive/transmit, and so on) can be invoked. >> * >> @@ -2828,6 +2831,8 @@ int rte_eth_dev_start(uint16_t port_id); >> * Stop an Ethernet device. The device can be restarted with a call to >> * rte_eth_dev_start() >> * >> + * All device queues status should be `RTE_ETH_QUEUE_STATE_STOPPED` after stop. >> + * >> * @param port_id >> * The port identifier of the Ethernet device. >> * @return >> -- >> 2.34.1 >> > > The rest lgtm. > > Thanks for review, will send a new version soon