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 8963A4265A; Thu, 28 Sep 2023 21:30:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 611A74025F; Thu, 28 Sep 2023 21:30:57 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2074.outbound.protection.outlook.com [40.107.223.74]) by mails.dpdk.org (Postfix) with ESMTP id 6A47C4021E for ; Thu, 28 Sep 2023 21:30:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n4EMEHJ7HJ1juSyjfRbDvkuYdL3uZvJT2TVWx4OS4oV2H1N2GsIU4jEwU2+ZQXbYR2olfU88y28y+YM4euI7gIqTvZN9gOI6K9vjJkmX4za+gImDPIeFtDm1li6Z+Noec5qbmE6hluOVec6JtnaKAUq68UVBLgweoB0moIW8x2AVORY1pZs+hgPwjGT1qLR7ObS2y27X8flUU+GfEi+eQ6XcqoX7JdpG7KXZQt+/9AhzkNoZtJDZTgbrWnV0RPzXt/YTAjTtc8uqXtYU0UAHw1Im1ijGT33fkTmGbSurDCwqacun8TJkOiIasHaHKcTXIAaY7P26JrluswRJ8lt67Q== 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=E9iER1atfDyoGwI1drxWhwPwcV/nqrfUXQ43LtJGHws=; b=N4q6LCiFNFQGA6aknQY045ztQbaFI3QdCnX2aP9Vz86hsN5bF+rMrpm0TTL/mpwFITG+KTPSGZp7WfrTUhn6fDulS5PLSh7Noa6c+deY6LGllh7nPgIvD8sIJ7khxxYqWu/YDvlzuiAeb3mM/6G0IglMYY45r09BAZK8At81CzJN/b0xgU/V7etNe7wjm3JqEIodgaEMNiHzOjJyJjFo0ImKFnLeK+8TfyZXKbBgBlWC9JL2Qu3aBGteognJ1kFugX0Sc86Jaua5QQauLe1Njp4UGFpCZ2b/NhHWCMtwM8WBXogtqNdGlr2Q9FY/A+rwArrUaC0k7N7thXn0T87x+A== 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=E9iER1atfDyoGwI1drxWhwPwcV/nqrfUXQ43LtJGHws=; b=AHFIUsfCdDvIGk53u42BZEelFo0Ut+Rx3koWVtiyIpHemJp3T9QJvkt11kjNQKyXaYCH4ZZS9mjnhTIPmX9nKDzKBL1KLUA9dlIa2vWa7PGiXLIwOJVVGoI2Gyo3zHoqQeNu8vYKKFQfEvzTJA+Lyy6QlXqfHNTuAcs6QlnpL6s= 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 CO6PR12MB5441.namprd12.prod.outlook.com (2603:10b6:303:13b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28; Thu, 28 Sep 2023 19:30:49 +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.6838.024; Thu, 28 Sep 2023 19:30:49 +0000 Message-ID: <76f7da64-a425-4d31-8f8f-f5041402d3b4@amd.com> Date: Thu, 28 Sep 2023 20:30:42 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] ethdev: clarify device queue state after start and stop Content-Language: en-US To: "lihuisong (C)" , Thomas Monjalon , Andrew Rybchenko Cc: dev@dpdk.org, David Marchand , Jie Hai , Song Jiale , Yuan Peng , Raslan Darawsheh , Qiming Yang References: <20230721160422.3848154-1-ferruh.yigit@amd.com> <8b056404-5cdf-3a6c-0c21-9813a0141814@huawei.com> 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 aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCg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gD9EgGIbItv3qWTq29dihLYpzd6dqB708k7 4RBz9051oLaFVGkguFw/tXmA17nx+c2uR5jx8wb4j68umG2X++0dSta5eHAVhmtXvrqPW6Ku 3FQ= In-Reply-To: <8b056404-5cdf-3a6c-0c21-9813a0141814@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0065.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::29) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CO6PR12MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: 553cd6aa-a3aa-495a-d4a5-08dbc0596b94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zZjhkARSEkF3K0xRn68vDUpd1vxE1TXFNUUc+bjhinnCIBlEEpSpopwB69d9qx82U6ioKvMG8u9oQ7lg6zSBgptjKW9NdUSzAeDjwyPTbfv1T/J7eV/aobVjujet+FmlwfewxiPaJ6L17WhiIgBWCFLygxCgvGwTkfILx3P3DcY2pZm13tTKfsQ2w9RxnkMFYLMbpM3j4R0l0EVYob6mm9OFcRtdGdMOd3JZv7esDw+aH/GGE0UKlaqxvNWDs6TF5RyJvOVUehqjdWjVaTKdzkzCSj34GvJsCOoOyl0/ofFpA3BSxHieEJwsGAdDU6uW426/VeY+rDuyzy2eJ3AZGyZJ6IdZqR+P1kcGRrrLi+R11H+oLSPX0PioAFQWSXqUgXw/vCg3eDn801xmPWuarM8v9vCphp46Zo4lYjbHfasr1igVGjcoSw3Ix4YAPDOVTHwXSuQH50xlcuzoCnBqFsHIUaEymmDpIYLmGB4RKIHc+XL7piwbO1Mb07T+323UghVAtqfetRBVaVjFsGvmT+QOxWiaocehkZYQ8vTDwPANdx4hYXQwlqG3/9EIzp7wzI+PJVZN2l/ert1QcJxRZeb/Ij0/y7CMCwlK0lizum4G8WiNUXQsKJM3q6CHgXzwfKL+BhnqtwttuZO7If6hdg== 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)(366004)(396003)(346002)(136003)(39860400002)(230922051799003)(1800799009)(451199024)(186009)(64100799003)(38100700002)(66946007)(44832011)(478600001)(54906003)(66556008)(6666004)(66476007)(316002)(110136005)(2616005)(6512007)(26005)(6486002)(53546011)(6506007)(4326008)(31686004)(5660300002)(8936002)(41300700001)(7416002)(8676002)(83380400001)(31696002)(36756003)(2906002)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OTR0ejdMKzF2T1NjMUFJK3RIQXVTQklrZ1lEbkE2SkdpQUlkL0xaNnJyT0tX?= =?utf-8?B?dGpqOGdJRkZqR2FDaHpqalEySG5kcmNNOEdCTExPQW5qZFo2aTFDVGViMkt6?= =?utf-8?B?bFJuOU1MR1pCdlNFZncvTVhzZ3NySkY3bUtIbEtjcjJMdUd6LzJzbVNVZ2lZ?= =?utf-8?B?dGNPeEJUS1E4OFdmS2llbTJsT0VQZC91Mjh1dEYzYWdacVcxQm1xbGYrWU90?= =?utf-8?B?eHd5WjZqU3pJMmlEZXZHeks4SzdWR0hYQXZ3anZQRzRPQ2VoV2pwTVJxblhx?= =?utf-8?B?dUdIb0lFNllIckFpYnZsemJkZVNQby9oYm52ZFUrM0tVLzJPUHNWR2dwN1FL?= =?utf-8?B?bHNrY3p2K3Mza3FsRjJyaGxkQ3gxcWJMdVN2QmZvOGZEQllYckFQZFpyRkVk?= =?utf-8?B?MzI4YmtZWWEzOFhOcTFIbXh2UURrWnkxbU5sMXdqQ1Zs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xdUV3Qm5HS0N2RjFyVDNsejJ2QkUwZk9z?= =?utf-8?B?ZTVkZVlwK0Y4aU0wdUZGcVV4MEdiK3puMmoweFU1NkcxOUdNQ2xXS1BCVU0v?= =?utf-8?B?b0hGTU1nZW1GYXlaeDFHRis3N0NGaTBOemM3WitSazhmTzc0NlpiK2tCYmEy?= =?utf-8?B?RWFSZVFybUw5cDhmRU55SHIraFdkTUVmdXVyNE9COWR5UTNvbzhiekFhN25G?= =?utf-8?B?anRKZ0hvRnQwTXhTS0QrNzQyaXVuZkQ1ditCQTRzU0hqbGNWWTJVcEtVMG1G?= =?utf-8?B?Q2I2dUVvZS9LRjVuL2lLM3hPdU93QUJrenIyNHRjL091WldiQ0RYRUZlaDlr?= =?utf-8?B?Uk5YbHloVitBZno1TDRvbnNnYVNCSGkraU16ZVBza0gxdE1NN3hSR0taN1BV?= =?utf-8?B?ZTZWa1RVYkVIclhsMkZacXJqbm5FZi9YNG9VMUh4RC9INTFDVDkyMHdLTjZL?= =?utf-8?B?NituYVdZQTA0c1g1V0Zwdmh0TkM1cjBFa054OUlMS2lUdVN2S1N1OVdJZ0hy?= =?utf-8?B?cCtNR1VuUGZkNTgyUFE1T3NKZWk2TE5idmhtQTF0VDU5UVVTYjVVQzRhaGcz?= =?utf-8?B?OG03ZVlSN2d6SUpmZm01UFA2WnBqcVJuVXlGUXlkZGZNK0ZobTAwRUVZWWhO?= =?utf-8?B?SHVkS0VnSjJ4eUNXNnZsVmRDbU9icm5ucE1jT09TSDJJQ2lMdmtvZmhrNGJa?= =?utf-8?B?dkNobFdlTVV5dnowaURjdDQ4MWMwd3Y5TXpHOFN1aXd4Y3c5SC9lRko3a3B0?= =?utf-8?Q?v5z2HNlDBNBt5bbIJCF4H9yaD?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 553cd6aa-a3aa-495a-d4a5-08dbc0596b94 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 19:30:49.5213 (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: eqsLbJn3hzpz1iHgFQ9LXB2d/StV4+GdqARq6SY1qLccEd4CbIkpyXn/J6dQ0n9I X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5441 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 7/24/2023 2:43 AM, lihuisong (C) wrote: > > 在 2023/7/22 0:04, Ferruh Yigit 写道: >> 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. >> >> 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 >> --- >>   app/test/meson.build       |   2 + >>   app/test/test_ethdev_api.c | 169 +++++++++++++++++++++++++++++++++++++ >>   lib/ethdev/rte_ethdev.h    |   5 ++ >>   3 files changed, 176 insertions(+) >>   create mode 100644 app/test/test_ethdev_api.c >> >> diff --git a/app/test/meson.build b/app/test/meson.build >> index b89cf0368fb5..8e409cf59c35 100644 >> --- a/app/test/meson.build >> +++ b/app/test/meson.build >> @@ -49,6 +49,7 @@ test_sources = files( >>           'test_efd_perf.c', >>           'test_errno.c', >>           'test_ethdev_link.c', >> +        'test_ethdev_api.c', >>           'test_event_crypto_adapter.c', >>           'test_event_eth_rx_adapter.c', >>           'test_event_ring.c', >> @@ -187,6 +188,7 @@ fast_tests = [ >>           ['eal_fs_autotest', true, true], >>           ['errno_autotest', true, true], >>           ['ethdev_link_status', true, true], >> +        ['ethdev_api', true, true], >>           ['event_ring_autotest', true, true], >>           ['fib_autotest', true, true], >>           ['fib6_autotest', true, true], >> diff --git a/app/test/test_ethdev_api.c b/app/test/test_ethdev_api.c >> new file mode 100644 >> index 000000000000..1b4569396dda >> --- /dev/null >> +++ b/app/test/test_ethdev_api.c >> @@ -0,0 +1,169 @@ >> +/* 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_rxconf rx_conf;*/ >> +    /*struct rte_eth_txconf tx_conf;*/ >> +    struct rte_eth_conf eth_conf; >> +    uint16_t port_id; >> +    int ret; >> + >> +    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(dev_info)); > +1 need to modify. > ack >> +        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 */ >> +        /*memset(&rx_conf, 0, sizeof(rx_conf));*/ > What's here for? > will remove >> +        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 */ >> +        /*memset(&tx_conf, 0, sizeof(tx_conf));*/ >> +        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); > dev_info_get() seems an useless code here. > Because NUM_RXQ and NUM_TXQ can be used directly in following codes. > Yes, it can be used as NUM_RXQ and NUM_TXQ, but I think it is better for testing to get this from the device, as it can be more close the what application does. >> + >> +        /* 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); >> +            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); >> +            TEST_ASSERT(ret == 0, >> +                "Port(%u), queue(%u) failed to get TxQ info.\n", >> +                port_id, queue_id); > Some drivers don't support this API. So it should be ok for these drivers. > True, will skip if ret is '-ENOTSUP' >> + >> +            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); >> +            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); >> +            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); >> +        } >> + >> + >> +        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); >> +            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); >> +            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), >> +        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); >> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h >> index 3d44979b44f7..8f2e0f158cc4 100644 >> --- a/lib/ethdev/rte_ethdev.h >> +++ b/lib/ethdev/rte_ethdev.h >> @@ -2788,6 +2788,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 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. >>    * >> @@ -2804,6 +2807,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