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 974CA42547; Fri, 8 Sep 2023 13:33:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 465B940DCD; Fri, 8 Sep 2023 13:32:30 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 2598740285 for ; Fri, 8 Sep 2023 13:32:21 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6q6YVRz1M9GX; Fri, 8 Sep 2023 19:30:27 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 8 Sep 2023 19:32:17 +0800 From: Jie Hai To: , Michal Krawczyk , Shai Brandes , Evgeny Schemeilin , Igor Chauskin , Ron Beider , Ferruh Yigit , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Chengwen Feng CC: , Subject: [PATCH 12/36] net/ena: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:37 +0800 Message-ID: <20230908112901.1169869-13-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230908112901.1169869-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected 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 The DPDK framework reports the queue state, which is stored in dev->data->tx_queue_state and dev->data->rx_queue_state. The state is maintained by the driver. Users may determine whether a queue participates in packet forwarding based on the state. Therefore, the driver needs to modify the queue state in time according to the actual situation. Fixes: 9ad9ff476cac ("ethdev: add queue state in queried queue information") Cc: stable@dpdk.org Signed-off-by: Jie Hai --- drivers/net/ena/ena_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index efcb163027c8..7345e480f880 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1171,6 +1171,7 @@ static int ena_start(struct rte_eth_dev *dev) struct ena_adapter *adapter = dev->data->dev_private; uint64_t ticks; int rc = 0; + uint16_t i; /* Cannot allocate memory in secondary process */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { @@ -1208,6 +1209,11 @@ static int ena_start(struct rte_eth_dev *dev) ++adapter->dev_stats.dev_start; adapter->state = ENA_ADAPTER_STATE_RUNNING; + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; err_rss_init: @@ -1223,6 +1229,7 @@ static int ena_stop(struct rte_eth_dev *dev) struct ena_com_dev *ena_dev = &adapter->ena_dev; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + uint16_t i; int rc; /* Cannot free memory in secondary process */ @@ -1254,6 +1261,11 @@ static int ena_stop(struct rte_eth_dev *dev) adapter->state = ENA_ADAPTER_STATE_STOPPED; dev->data->dev_started = 0; + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } -- 2.30.0