From patchwork Fri Sep 8 11:28:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131268 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF1AD42547; Fri, 8 Sep 2023 13:32:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 882D540395; Fri, 8 Sep 2023 13:32:19 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id EDEF040042 for ; Fri, 8 Sep 2023 13:32:14 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4x2lxLzMl6J; Fri, 8 Sep 2023 19:28:49 +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:11 +0800 From: Jie Hai To: , Selwin Sebastian , Thomas Monjalon , Lijun Ou , Chengwen Feng , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 01/36] net/axgbe: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:26 +0800 Message-ID: <20230908112901.1169869-2-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 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/axgbe/axgbe_ethdev.c | 7 +++++++ drivers/net/axgbe/axgbe_rxtx.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 48714eebe699..f378fd570e3a 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -352,6 +352,7 @@ static int axgbe_dev_start(struct rte_eth_dev *dev) { struct axgbe_port *pdata = dev->data->dev_private; + uint16_t i; int ret; dev->dev_ops = &axgbe_eth_dev_ops; @@ -388,6 +389,12 @@ axgbe_dev_start(struct rte_eth_dev *dev) axgbe_set_rx_function(dev); axgbe_set_tx_function(dev); + + 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; } diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index 625a92109baf..a9ff291cef3d 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -1124,6 +1124,7 @@ void axgbe_dev_clear_queues(struct rte_eth_dev *dev) axgbe_rx_queue_release(rxq); dev->data->rx_queues[i] = NULL; } + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } for (i = 0; i < dev->data->nb_tx_queues; i++) { @@ -1133,6 +1134,7 @@ void axgbe_dev_clear_queues(struct rte_eth_dev *dev) axgbe_tx_queue_release(txq); dev->data->tx_queues[i] = NULL; } + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } From patchwork Fri Sep 8 11:28:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131266 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE3ED42547; Fri, 8 Sep 2023 13:32:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEF40402E2; Fri, 8 Sep 2023 13:32:16 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 77B8840285 for ; Fri, 8 Sep 2023 13:32:14 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4Z6LtLzNn0S; Fri, 8 Sep 2023 19:28:30 +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:11 +0800 From: Jie Hai To: , "John W. Linville" , Chengwen Feng , Lijun Ou , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon CC: , Subject: [PATCH 02/36] net/af_packet: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:27 +0800 Message-ID: <20230908112901.1169869-3-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 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/af_packet/rte_eth_af_packet.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index c13a0942aa1d..397a32db5886 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -313,7 +313,14 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) static int eth_dev_start(struct rte_eth_dev *dev) { + struct pmd_internals *internals = dev->data->dev_private; + uint16_t i; + dev->data->dev_link.link_status = RTE_ETH_LINK_UP; + for (i = 0; i < internals->nb_queues; i++) { + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + } return 0; } @@ -341,6 +348,8 @@ eth_dev_stop(struct rte_eth_dev *dev) internals->rx_queue[i].sockfd = -1; internals->tx_queue[i].sockfd = -1; + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; From patchwork Fri Sep 8 11:28:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131267 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5812042547; Fri, 8 Sep 2023 13:32:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4314E402EA; Fri, 8 Sep 2023 13:32:18 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 98909402AF for ; Fri, 8 Sep 2023 13:32:14 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4y4FJDzMl6S; Fri, 8 Sep 2023 19:28:50 +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:12 +0800 From: Jie Hai To: , Ciara Loftus , Qi Zhang , Chengwen Feng , Thomas Monjalon , Lijun Ou , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 03/36] net/af_xdp: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:28 +0800 Message-ID: <20230908112901.1169869-4-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 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/af_xdp/rte_eth_af_xdp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index c7786cc53a5e..0cc51223ba32 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -694,7 +694,13 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) static int eth_dev_start(struct rte_eth_dev *dev) { + uint16_t i; + dev->data->dev_link.link_status = RTE_ETH_LINK_UP; + for (i = 0; i < dev->data->nb_rx_queues; i++) { + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + } return 0; } @@ -703,7 +709,14 @@ eth_dev_start(struct rte_eth_dev *dev) static int eth_dev_stop(struct rte_eth_dev *dev) { + uint16_t i; + dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; + for (i = 0; i < dev->data->nb_rx_queues; i++) { + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + } + return 0; } From patchwork Fri Sep 8 11:28:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131270 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3494A42547; Fri, 8 Sep 2023 13:32:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E39D440689; Fri, 8 Sep 2023 13:32:21 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id A8B8F402BD for ; Fri, 8 Sep 2023 13:32:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5n22K2zVkdp; Fri, 8 Sep 2023 19:29:33 +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:12 +0800 From: Jie Hai To: , Steven Webster , Matt Peters , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Chengwen Feng , Lijun Ou , Ferruh Yigit CC: , Subject: [PATCH 04/36] net/avp: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:29 +0800 Message-ID: <20230908112901.1169869-5-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 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/avp/avp_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index b2a08f563542..53d9e38c939b 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -2036,6 +2036,7 @@ static int avp_dev_start(struct rte_eth_dev *eth_dev) { struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + uint16_t i; int ret; rte_spinlock_lock(&avp->lock); @@ -2056,6 +2057,11 @@ avp_dev_start(struct rte_eth_dev *eth_dev) /* remember current link state */ avp->flags |= AVP_F_LINKUP; + for (i = 0; i < avp->num_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < avp->num_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + ret = 0; unlock: @@ -2067,6 +2073,7 @@ static int avp_dev_stop(struct rte_eth_dev *eth_dev) { struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + uint16_t i; int ret; rte_spinlock_lock(&avp->lock); @@ -2086,6 +2093,11 @@ avp_dev_stop(struct rte_eth_dev *eth_dev) ret); } + for (i = 0; i < avp->num_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < avp->num_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + unlock: rte_spinlock_unlock(&avp->lock); return ret; From patchwork Fri Sep 8 11:28:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131269 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7538E42547; Fri, 8 Sep 2023 13:32:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBBBD40649; Fri, 8 Sep 2023 13:32:20 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7FCF740042 for ; Fri, 8 Sep 2023 13:32:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6k6p7zzrSTP; Fri, 8 Sep 2023 19:30:22 +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:13 +0800 From: Jie Hai To: , Julien Aube , Chengwen Feng , Lijun Ou , Ferruh Yigit , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 05/36] net/bnx2x: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:30 +0800 Message-ID: <20230908112901.1169869-6-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 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/bnx2x/bnx2x_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 4448cf2de2d7..1327cbe912ae 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -211,6 +211,7 @@ bnx2x_dev_start(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; int ret = 0; + uint16_t i; PMD_INIT_FUNC_TRACE(sc); @@ -244,6 +245,11 @@ bnx2x_dev_start(struct rte_eth_dev *dev) bnx2x_print_device_info(sc); + for (i = 0; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + return ret; } @@ -252,6 +258,7 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; int ret = 0; + uint16_t i; PMD_INIT_FUNC_TRACE(sc); @@ -277,6 +284,11 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) return ret; } + for (i = 0; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131271 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3877242545; Fri, 8 Sep 2023 13:33:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D8F84069F; Fri, 8 Sep 2023 13:32:23 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id BBBB4402DA for ; Fri, 8 Sep 2023 13:32:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv501xxJzMlD0; Fri, 8 Sep 2023 19:28:52 +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:14 +0800 From: Jie Hai To: , Ajit Khaparde , Somnath Kotur , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Thomas Monjalon , Chengwen Feng CC: , Subject: [PATCH 06/36] net/bnxt: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:31 +0800 Message-ID: <20230908112901.1169869-7-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 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/bnxt/bnxt_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ee1552452a11..7120d54d382e 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1507,6 +1507,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); struct rte_intr_handle *intr_handle = pci_dev->intr_handle; struct rte_eth_link link; + uint16_t i; int ret; eth_dev->data->dev_started = 0; @@ -1567,6 +1568,11 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) eth_dev->data->scattered_rx = 0; + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131273 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E0B842545; Fri, 8 Sep 2023 13:33:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F8D5406FF; Fri, 8 Sep 2023 13:32:25 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id CA0D8402DA for ; Fri, 8 Sep 2023 13:32:16 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv506FVLzMlDv; Fri, 8 Sep 2023 19:28:52 +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:14 +0800 From: Jie Hai To: , Chas Williams , "Min Hu (Connor)" , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Ferruh Yigit , Chengwen Feng CC: , Subject: [PATCH 07/36] net/bonding: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:32 +0800 Message-ID: <20230908112901.1169869-8-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 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/bonding/rte_eth_bond_pmd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 73205f78f4e2..ede953c06301 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2089,6 +2089,11 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) internals->mode == BONDING_MODE_ALB) bond_tlb_enable(internals); + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; out_err: @@ -2174,6 +2179,11 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) deactivate_slave(eth_dev, slave_id); } + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131272 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FA2D42545; Fri, 8 Sep 2023 13:33:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23CE5406B8; Fri, 8 Sep 2023 13:32:24 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id D6BD4402DC for ; Fri, 8 Sep 2023 13:32:16 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv513DJwzMlGQ; Fri, 8 Sep 2023 19:28:53 +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:15 +0800 From: Jie Hai To: , Rahul Lakkireddy , Ferruh Yigit , Chengwen Feng , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Thomas Monjalon CC: , Subject: [PATCH 08/36] net/cxgbe: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:33 +0800 Message-ID: <20230908112901.1169869-9-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 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/cxgbe/cxgbe_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 45bbeaef0ceb..8cc3d9f257a0 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -414,6 +414,7 @@ int cxgbe_dev_stop(struct rte_eth_dev *eth_dev) { struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; + uint16_t i; CXGBE_FUNC_TRACE(); @@ -429,6 +430,11 @@ int cxgbe_dev_stop(struct rte_eth_dev *eth_dev) t4_sge_eth_clear_queues(pi); eth_dev->data->scattered_rx = 0; + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131275 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8941B42547; Fri, 8 Sep 2023 13:33:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A06FE40A73; Fri, 8 Sep 2023 13:32:27 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id A8522402DC for ; Fri, 8 Sep 2023 13:32:17 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5r1TlVzVkfm; Fri, 8 Sep 2023 19:29:36 +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:15 +0800 From: Jie Hai To: , Hemant Agrawal , Sachin Saxena , Lijun Ou , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Chengwen Feng CC: , Subject: [PATCH 09/36] net/dpaa: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:34 +0800 Message-ID: <20230908112901.1169869-10-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 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 Acked-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index a6c86113d125..ef4c06db6a4d 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -399,6 +399,7 @@ static void dpaa_interrupt_handler(void *param) static int dpaa_eth_dev_start(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + uint16_t i; PMD_INIT_FUNC_TRACE(); @@ -413,12 +414,18 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) fman_if_enable_rx(dev->process_private); + 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; } static int dpaa_eth_dev_stop(struct rte_eth_dev *dev) { struct fman_if *fif = dev->process_private; + uint16_t i; PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; @@ -427,6 +434,11 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev) fman_if_disable_rx(fif); dev->tx_pkt_burst = dpaa_eth_tx_drop_all; + 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; } From patchwork Fri Sep 8 11:28:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131274 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CD3342545; Fri, 8 Sep 2023 13:33:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 939AF40A6F; Fri, 8 Sep 2023 13:32:26 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 32327402E7 for ; Fri, 8 Sep 2023 13:32:18 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4H38FQztS4H; Fri, 8 Sep 2023 19:28:15 +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:16 +0800 From: Jie Hai To: , Hemant Agrawal , Sachin Saxena , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Chengwen Feng , Ferruh Yigit , Lijun Ou CC: , Subject: [PATCH 10/36] net/dpaa2: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:35 +0800 Message-ID: <20230908112901.1169869-11-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 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 Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 679f33ae1a08..8e610b6bba30 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1278,6 +1278,11 @@ dpaa2_dev_start(struct rte_eth_dev *dev) if (priv->en_ordered) dev->tx_pkt_burst = dpaa2_dev_tx_ordered; + 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; } @@ -1295,6 +1300,7 @@ dpaa2_dev_stop(struct rte_eth_dev *dev) struct rte_device *rdev = dev->device; struct rte_intr_handle *intr_handle; struct rte_dpaa2_device *dpaa2_dev; + uint16_t i; dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device); intr_handle = dpaa2_dev->intr_handle; @@ -1329,6 +1335,11 @@ dpaa2_dev_stop(struct rte_eth_dev *dev) memset(&link, 0, sizeof(link)); rte_eth_linkstatus_set(dev, &link); + 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; } From patchwork Fri Sep 8 11:28:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131281 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36E4842547; Fri, 8 Sep 2023 13:34:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 262C440E36; Fri, 8 Sep 2023 13:32:35 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 0FAA740691 for ; Fri, 8 Sep 2023 13:32:22 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4h1RRHzNn8M; Fri, 8 Sep 2023 19:28:36 +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: , Simei Su , Wenjun Wu , Chengwen Feng , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Thomas Monjalon , Ferruh Yigit CC: , Subject: [PATCH 11/36] net/e1000: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:36 +0800 Message-ID: <20230908112901.1169869-12-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 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/e1000/em_rxtx.c | 8 ++++++++ drivers/net/e1000/igb_rxtx.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index cb5ce2307b3b..df5fbb782361 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -1576,6 +1576,8 @@ em_dev_clear_queues(struct rte_eth_dev *dev) em_tx_queue_release_mbufs(txq); em_reset_tx_queue(txq); } + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -1584,6 +1586,8 @@ em_dev_clear_queues(struct rte_eth_dev *dev) em_rx_queue_release_mbufs(rxq); em_reset_rx_queue(rxq); } + + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } @@ -1812,6 +1816,8 @@ eth_em_rx_init(struct rte_eth_dev *dev) rxdctl |= E1000_RXDCTL_GRAN; E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + /* * Due to EM devices not having any sort of hardware * limit for packet length, jumbo frame of any size @@ -1946,6 +1952,8 @@ eth_em_tx_init(struct rte_eth_dev *dev) txdctl |= (txq->wthresh & 0x3F) << 16; txdctl |= E1000_TXDCTL_GRAN; E1000_WRITE_REG(hw, E1000_TXDCTL(i), txdctl); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } /* Program the Transmit Control Register. */ diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 61c6394310b3..448c4b7d9d0f 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -2745,6 +2745,8 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev) else rxdctl |= ((rxq->wthresh & 0x1F) << 16); E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); + + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { @@ -2816,6 +2818,8 @@ eth_igbvf_tx_init(struct rte_eth_dev *dev) txdctl |= ((txq->wthresh & 0x1F) << 16); txdctl |= E1000_TXDCTL_QUEUE_ENABLE; E1000_WRITE_REG(hw, E1000_TXDCTL(i), txdctl); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } } From patchwork Fri Sep 8 11:28:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131277 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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; } From patchwork Fri Sep 8 11:28:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131276 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F2F942547; Fri, 8 Sep 2023 13:33:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 282D040C35; Fri, 8 Sep 2023 13:32:29 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 1F5CA40633 for ; Fri, 8 Sep 2023 13:32:20 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5447gdzMl6B; Fri, 8 Sep 2023 19:28:56 +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:18 +0800 From: Jie Hai To: , Gagandeep Singh , Sachin Saxena , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Ferruh Yigit , Chengwen Feng , Lijun Ou CC: , Subject: [PATCH 13/36] net/enetc: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:38 +0800 Message-ID: <20230908112901.1169869-14-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 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/enetc/enetc_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 1b4337bc488c..c9352f074683 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -17,6 +17,7 @@ enetc_dev_start(struct rte_eth_dev *dev) ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct enetc_hw *enetc_hw = &hw->hw; uint32_t val; + uint16_t i; PMD_INIT_FUNC_TRACE(); if (hw->device_id == ENETC_DEV_ID_VF) @@ -45,6 +46,11 @@ enetc_dev_start(struct rte_eth_dev *dev) ENETC_PM0_IFM_XGMII); } + 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; } @@ -55,6 +61,7 @@ enetc_dev_stop(struct rte_eth_dev *dev) ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct enetc_hw *enetc_hw = &hw->hw; uint32_t val; + uint16_t i; PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; @@ -69,6 +76,11 @@ enetc_dev_stop(struct rte_eth_dev *dev) enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG, val & (~(ENETC_PM0_TX_EN | ENETC_PM0_RX_EN))); + 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; } From patchwork Fri Sep 8 11:28:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131279 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EAC142547; Fri, 8 Sep 2023 13:34:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3D4340DF6; Fri, 8 Sep 2023 13:32:32 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 56A554067E for ; Fri, 8 Sep 2023 13:32:21 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv550ZQtzMl6J; Fri, 8 Sep 2023 19:28:57 +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:18 +0800 From: Jie Hai To: , John Daley , Hyong Youb Kim , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Ferruh Yigit , Chengwen Feng CC: , Subject: [PATCH 14/36] net/enic: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:39 +0800 Message-ID: <20230908112901.1169869-15-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 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/enic/enic_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index cdf091559196..a487256fa154 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -368,6 +368,7 @@ static int enicpmd_dev_stop(struct rte_eth_dev *eth_dev) { struct rte_eth_link link; struct enic *enic = pmd_priv(eth_dev); + uint16_t i; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -378,6 +379,11 @@ static int enicpmd_dev_stop(struct rte_eth_dev *eth_dev) memset(&link, 0, sizeof(link)); rte_eth_linkstatus_set(eth_dev, &link); + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131282 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C26742547; Fri, 8 Sep 2023 13:34:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EFF540EA5; Fri, 8 Sep 2023 13:32:36 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id BD74A40691 for ; Fri, 8 Sep 2023 13:32:23 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5552cvzMlDv; Fri, 8 Sep 2023 19:28:57 +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:19 +0800 From: Jie Hai To: , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Thomas Monjalon , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Chengwen Feng CC: , Subject: [PATCH 15/36] net/hinic: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:40 +0800 Message-ID: <20230908112901.1169869-16-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 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/hinic/hinic_pmd_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 7aa5e7d8e929..adc9f75c81aa 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -980,6 +980,7 @@ static int hinic_dev_start(struct rte_eth_dev *dev) int rc; char *name; struct hinic_nic_dev *nic_dev; + uint16_t i; nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); name = dev->data->name; @@ -1047,6 +1048,11 @@ static int hinic_dev_start(struct rte_eth_dev *dev) rte_bit_relaxed_set32(HINIC_DEV_START, &nic_dev->dev_status); + 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; en_port_fail: @@ -1169,6 +1175,7 @@ static int hinic_dev_stop(struct rte_eth_dev *dev) uint16_t port_id; struct hinic_nic_dev *nic_dev; struct rte_eth_link link; + uint16_t i; nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); name = dev->data->name; @@ -1215,6 +1222,11 @@ static int hinic_dev_stop(struct rte_eth_dev *dev) hinic_free_all_rx_mbuf(dev); hinic_free_all_tx_mbuf(dev); + 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; } From patchwork Fri Sep 8 11:28:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131278 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 642AE42547; Fri, 8 Sep 2023 13:33:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8514740DD8; Fri, 8 Sep 2023 13:32:31 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 230E740693 for ; Fri, 8 Sep 2023 13:32:22 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6t2TZcz1M9Hc; Fri, 8 Sep 2023 19:30:30 +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:20 +0800 From: Jie Hai To: , Rosen Xu , Ferruh Yigit , Lijun Ou , Chengwen Feng , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon CC: , Subject: [PATCH 16/36] net/ipn3ke: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:41 +0800 Message-ID: <20230908112901.1169869-17-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 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 Reviewed-by: Rosen Xu --- drivers/net/ipn3ke/ipn3ke_representor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index c82f8b533370..d904d3f251e3 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -120,6 +120,7 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) uint64_t base_mac; uint32_t val; char attr_name[IPN3KE_RAWDEV_ATTR_LEN_MAX]; + uint16_t i; rawdev = hw->rawdev; @@ -190,6 +191,11 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) ipn3ke_rpst_link_update(dev, 0); + 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; } @@ -198,6 +204,7 @@ ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev); + uint16_t i; if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) { /* Disable the TX path */ @@ -207,6 +214,11 @@ ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev) ipn3ke_xmac_rx_disable(hw, rpst->port_id, 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; } From patchwork Fri Sep 8 11:28:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131280 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE72E42547; Fri, 8 Sep 2023 13:34:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AD7640E2D; Fri, 8 Sep 2023 13:32:34 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 1A6B1406B4 for ; Fri, 8 Sep 2023 13:32:23 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv566KbgzMl7T; Fri, 8 Sep 2023 19:28:58 +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:20 +0800 From: Jie Hai To: , Jakub Grajciar , Chengwen Feng , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Lijun Ou CC: , Subject: [PATCH 17/36] net/memif: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:42 +0800 Message-ID: <20230908112901.1169869-18-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 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/memif/rte_eth_memif.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 6a8ff5b4eb65..636c8a4af345 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1358,6 +1358,7 @@ memif_dev_start(struct rte_eth_dev *dev) { struct pmd_internals *pmd = dev->data->dev_private; int ret = 0; + uint16_t i; switch (pmd->role) { case MEMIF_ROLE_CLIENT: @@ -1372,13 +1373,28 @@ memif_dev_start(struct rte_eth_dev *dev) break; } + if (ret == 0) { + 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 ret; } static int memif_dev_stop(struct rte_eth_dev *dev) { + uint16_t i; + memif_disconnect(dev); + + 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; } From patchwork Fri Sep 8 11:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131289 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 467C042547; Fri, 8 Sep 2023 13:35:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA721410FC; Fri, 8 Sep 2023 13:32:43 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 60EE140633 for ; Fri, 8 Sep 2023 13:32:27 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4m38GPzNmlD; Fri, 8 Sep 2023 19:28:40 +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:21 +0800 From: Jie Hai To: , Long Li , Chengwen Feng , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Lijun Ou , Ferruh Yigit CC: , Subject: [PATCH 18/36] net/mana: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:43 +0800 Message-ID: <20230908112901.1169869-19-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 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/mana/rx.c | 3 +++ drivers/net/mana/tx.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c index 14d908580185..9da7133005a4 100644 --- a/drivers/net/mana/rx.c +++ b/drivers/net/mana/rx.c @@ -190,6 +190,8 @@ mana_stop_rx_queues(struct rte_eth_dev *dev) memset(&rxq->gdma_rq, 0, sizeof(rxq->gdma_rq)); memset(&rxq->gdma_cq, 0, sizeof(rxq->gdma_cq)); + + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } return 0; } @@ -252,6 +254,7 @@ mana_start_rx_queues(struct rte_eth_dev *dev) } ind_tbl[i] = rxq->wq; + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } struct ibv_rwq_ind_table_init_attr ind_table_attr = { diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index 11ba2ee1ac58..fb474e73ec1f 100644 --- a/drivers/net/mana/tx.c +++ b/drivers/net/mana/tx.c @@ -51,6 +51,8 @@ mana_stop_tx_queues(struct rte_eth_dev *dev) memset(&txq->gdma_sq, 0, sizeof(txq->gdma_sq)); memset(&txq->gdma_cq, 0, sizeof(txq->gdma_cq)); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } return 0; @@ -142,6 +144,8 @@ mana_start_tx_queues(struct rte_eth_dev *dev) txq->gdma_cq.id, txq->gdma_cq.buffer, txq->gdma_cq.count, txq->gdma_cq.size, txq->gdma_cq.head); + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } return 0; From patchwork Fri Sep 8 11:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131290 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EEC5E42547; Fri, 8 Sep 2023 13:35:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 161FF41148; Fri, 8 Sep 2023 13:32:45 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 34B3040A7A for ; Fri, 8 Sep 2023 13:32:28 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4N690tztS4H; Fri, 8 Sep 2023 19:28:20 +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:21 +0800 From: Jie Hai To: , Matan Azrad , Viacheslav Ovsiienko , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Chengwen Feng , Lijun Ou , Ferruh Yigit CC: , Subject: [PATCH 19/36] net/mlx4: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:44 +0800 Message-ID: <20230908112901.1169869-20-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 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/mlx4/mlx4.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index a54016f4a235..1389b606ccb1 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -292,6 +292,7 @@ mlx4_dev_start(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; + uint16_t i; int ret; if (priv->started) @@ -327,6 +328,12 @@ mlx4_dev_start(struct rte_eth_dev *dev) dev->rx_pkt_burst = mlx4_rx_burst; /* Enable datapath on secondary process. */ mlx4_mp_req_start_rxtx(dev); + + 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: mlx4_dev_stop(dev); @@ -345,6 +352,7 @@ static int mlx4_dev_stop(struct rte_eth_dev *dev) { struct mlx4_priv *priv = dev->data->dev_private; + uint16_t i; if (!priv->started) return 0; @@ -359,6 +367,11 @@ mlx4_dev_stop(struct rte_eth_dev *dev) mlx4_rxq_intr_disable(priv); mlx4_rss_deinit(priv); + 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; } From patchwork Fri Sep 8 11:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131285 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D40C642547; Fri, 8 Sep 2023 13:34:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3AC240EE2; Fri, 8 Sep 2023 13:32:39 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 28FCE409FA for ; Fri, 8 Sep 2023 13:32:25 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6v6bcBzrSbN; Fri, 8 Sep 2023 19:30:31 +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:22 +0800 From: Jie Hai To: , Zyta Szpak , Liron Himi , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Chengwen Feng , Ferruh Yigit CC: , Subject: [PATCH 20/36] net/mvneta: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:45 +0800 Message-ID: <20230908112901.1169869-21-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 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/mvneta/mvneta_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index d7953ac7cbac..ad27b3e663ec 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -376,6 +376,10 @@ mvneta_dev_start(struct rte_eth_dev *dev) goto out; } + /* start rx queues */ + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + /* start tx queues */ for (i = 0; i < dev->data->nb_tx_queues; i++) dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; @@ -412,6 +416,14 @@ mvneta_dev_stop(struct rte_eth_dev *dev) priv->ppio = NULL; + /* stop rx queues */ + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + + /* stop tx queues */ + for (i = 0; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131283 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FE5842547; Fri, 8 Sep 2023 13:34:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 608EA40ED2; Fri, 8 Sep 2023 13:32:37 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id BDAE6406FF for ; Fri, 8 Sep 2023 13:32:24 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6x1hBzz1M9HG; Fri, 8 Sep 2023 19:30:33 +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:23 +0800 From: Jie Hai To: , Liron Himi , Ferruh Yigit , Chengwen Feng , Lijun Ou , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 21/36] net/mvpp2: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:46 +0800 Message-ID: <20230908112901.1169869-22-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 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/mvpp2/mrvl_ethdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 89c83f1c1f82..79d5afe2b3c5 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -951,6 +951,9 @@ mrvl_dev_start(struct rte_eth_dev *dev) goto out; } + for (i = 0; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + mrvl_flow_init(dev); mrvl_mtr_init(dev); mrvl_set_tx_function(dev); @@ -1076,6 +1079,13 @@ mrvl_flush_bpool(struct rte_eth_dev *dev) static int mrvl_dev_stop(struct rte_eth_dev *dev) { + uint16_t i; + + 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 mrvl_dev_set_link_down(dev); } From patchwork Fri Sep 8 11:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131284 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E935E42547; Fri, 8 Sep 2023 13:34:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D41640ED9; Fri, 8 Sep 2023 13:32:38 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 4A6BB40691 for ; Fri, 8 Sep 2023 13:32:25 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv595gB5zMl6B; Fri, 8 Sep 2023 19:29:01 +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:23 +0800 From: Jie Hai To: , Long Li , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Ferruh Yigit , Thomas Monjalon , Chengwen Feng CC: , Subject: [PATCH 22/36] net/netvsc: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:47 +0800 Message-ID: <20230908112901.1169869-23-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 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/netvsc/hn_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index d0bbc0a4c0c0..f778e3c64649 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -990,6 +990,7 @@ static int hn_dev_start(struct rte_eth_dev *dev) { struct hn_data *hv = dev->data->dev_private; + uint16_t i; int error; PMD_INIT_FUNC_TRACE(); @@ -1017,6 +1018,11 @@ hn_dev_start(struct rte_eth_dev *dev) if (error == 0) hn_dev_link_update(dev, 0); + 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 error; } @@ -1024,10 +1030,16 @@ static int hn_dev_stop(struct rte_eth_dev *dev) { struct hn_data *hv = dev->data->dev_private; + uint16_t i; PMD_INIT_FUNC_TRACE(); 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; + rte_dev_event_callback_unregister(NULL, netvsc_hotadd_callback, hv); hn_rndis_set_rxfilter(hv, 0); return hn_vf_stop(dev); From patchwork Fri Sep 8 11:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131286 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E34E42547; Fri, 8 Sep 2023 13:34:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9D4940F35; Fri, 8 Sep 2023 13:32:40 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 1D71040A6D for ; Fri, 8 Sep 2023 13:32:26 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4q2yLTzNmqx; Fri, 8 Sep 2023 19:28:43 +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:24 +0800 From: Jie Hai To: , Chaoyong He , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= , Chengwen Feng , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Ferruh Yigit CC: , Subject: [PATCH 23/36] net/nfp: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:48 +0800 Message-ID: <20230908112901.1169869-24-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 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 Acked-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.c | 8 ++++++++ drivers/net/nfp/flower/nfp_flower_representor.c | 12 ++++++++++++ drivers/net/nfp/nfp_common.c | 2 ++ drivers/net/nfp/nfp_ethdev.c | 6 ++++++ drivers/net/nfp/nfp_ethdev_vf.c | 6 ++++++ 5 files changed, 34 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 77dab864f319..eb7b40a6eb25 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -85,6 +85,7 @@ int nfp_flower_pf_start(struct rte_eth_dev *dev) { int ret; + uint16_t i; uint32_t new_ctrl; uint32_t update = 0; struct nfp_net_hw *hw; @@ -137,6 +138,11 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) return -EIO; } + 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; } @@ -159,11 +165,13 @@ nfp_flower_pf_stop(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { this_tx_q = dev->data->tx_queues[i]; nfp_net_reset_tx_queue(this_tx_q); + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } for (i = 0; i < dev->data->nb_rx_queues; i++) { this_rx_q = dev->data->rx_queues[i]; nfp_net_reset_rx_queue(this_rx_q); + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } if (rte_eal_process_type() == RTE_PROC_PRIMARY) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 5f94d20f1b0c..3f97bc9f8a39 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -303,6 +303,7 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev) { struct nfp_flower_representor *repr; struct nfp_app_fw_flower *app_fw_flower; + uint16_t i; repr = dev->data->dev_private; app_fw_flower = repr->app_fw_flower; @@ -314,6 +315,11 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev) nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, true); + 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; } @@ -322,6 +328,7 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev) { struct nfp_flower_representor *repr; struct nfp_app_fw_flower *app_fw_flower; + uint16_t i; repr = dev->data->dev_private; app_fw_flower = repr->app_fw_flower; @@ -333,6 +340,11 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev) repr->nfp_idx, 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; } diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 5092e5869de4..c0d4708f2b3e 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -1927,6 +1927,7 @@ nfp_net_stop_rx_queue(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { this_rx_q = dev->data->rx_queues[i]; nfp_net_reset_rx_queue(this_rx_q); + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } @@ -1952,6 +1953,7 @@ nfp_net_stop_tx_queue(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { this_tx_q = dev->data->tx_queues[i]; nfp_net_reset_tx_queue(this_tx_q); + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index e3ff3d80873d..bdfd5530c55f 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -65,6 +65,7 @@ nfp_net_start(struct rte_eth_dev *dev) struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; uint32_t intr_vector; + uint16_t i; int ret; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -176,6 +177,11 @@ nfp_net_start(struct rte_eth_dev *dev) hw->ctrl = new_ctrl; + 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; error: diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index eaf815d06da5..3e8aeef51ab4 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -39,6 +39,7 @@ nfp_netvf_start(struct rte_eth_dev *dev) struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; uint32_t intr_vector; + uint16_t i; int ret; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -115,6 +116,11 @@ nfp_netvf_start(struct rte_eth_dev *dev) hw->ctrl = new_ctrl; + 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; error: From patchwork Fri Sep 8 11:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131287 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A7DE42547; Fri, 8 Sep 2023 13:35:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B19BD410DD; Fri, 8 Sep 2023 13:32:41 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id A44F140A71 for ; Fri, 8 Sep 2023 13:32:26 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6z0NvPz1M9Hc; Fri, 8 Sep 2023 19:30:35 +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:24 +0800 From: Jie Hai To: , Jiawen Wu , Thomas Monjalon , Ferruh Yigit , Chengwen Feng , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 24/36] net/ngbe: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:49 +0800 Message-ID: <20230908112901.1169869-25-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 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/ngbe/ngbe_rxtx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c index f31906cc2fe3..ec353a30b1de 100644 --- a/drivers/net/ngbe/ngbe_rxtx.c +++ b/drivers/net/ngbe/ngbe_rxtx.c @@ -2415,6 +2415,7 @@ ngbe_dev_clear_queues(struct rte_eth_dev *dev) if (txq != NULL) { txq->ops->release_mbufs(txq); txq->ops->reset(txq); + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } @@ -2424,6 +2425,7 @@ ngbe_dev_clear_queues(struct rte_eth_dev *dev) if (rxq != NULL) { ngbe_rx_queue_release_mbufs(rxq); ngbe_reset_rx_queue(adapter, rxq); + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } } From patchwork Fri Sep 8 11:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131288 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4AF4842547; Fri, 8 Sep 2023 13:35:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3B7C410F2; Fri, 8 Sep 2023 13:32:42 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 0E92E40A6D for ; Fri, 8 Sep 2023 13:32:27 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv6z4Qvcz1M9Hh; Fri, 8 Sep 2023 19:30:35 +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:25 +0800 From: Jie Hai To: , Tetsuya Mukawa , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Chengwen Feng , Lijun Ou , Ferruh Yigit CC: , Subject: [PATCH 25/36] net/null: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:50 +0800 Message-ID: <20230908112901.1169869-26-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 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/null/rte_eth_null.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 31081af79752..d742bc415c8c 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -192,21 +192,36 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused) static int eth_dev_start(struct rte_eth_dev *dev) { + uint16_t i; + if (dev == NULL) return -EINVAL; dev->data->dev_link.link_status = RTE_ETH_LINK_UP; + + 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; } static int eth_dev_stop(struct rte_eth_dev *dev) { + uint16_t i; + if (dev == NULL) return 0; dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; + 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; } From patchwork Fri Sep 8 11:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131293 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77D6942547; Fri, 8 Sep 2023 13:35:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 171014161A; Fri, 8 Sep 2023 13:32:48 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 8BA6040A7F for ; Fri, 8 Sep 2023 13:32:29 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4s0vvvzNmt4; Fri, 8 Sep 2023 19:28:45 +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:25 +0800 From: Jie Hai To: , Vamsi Attunuru , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Chengwen Feng , Lijun Ou CC: , Subject: [PATCH 26/36] net/octeon_ep: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:51 +0800 Message-ID: <20230908112901.1169869-27-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 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/octeon_ep/otx_ep_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c index 57b965ad0670..970372bbd791 100644 --- a/drivers/net/octeon_ep/otx_ep_ethdev.c +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c @@ -156,6 +156,11 @@ otx_ep_dev_start(struct rte_eth_dev *eth_dev) otx_ep_dev_link_update(eth_dev, 0); otx_ep_info("dev started\n"); + for (q = 0; q < eth_dev->data->nb_rx_queues; q++) + eth_dev->data->rx_queue_state[q] = RTE_ETH_QUEUE_STATE_STARTED; + for (q = 0; q < eth_dev->data->nb_tx_queues; q++) + eth_dev->data->tx_queue_state[q] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; } @@ -164,9 +169,15 @@ static int otx_ep_dev_stop(struct rte_eth_dev *eth_dev) { struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev); + uint16_t i; otx_epvf->fn_list.disable_io_queues(otx_epvf); + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } From patchwork Fri Sep 8 11:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131291 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E738042547; Fri, 8 Sep 2023 13:35:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 197EE41157; Fri, 8 Sep 2023 13:32:46 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4B0D540A80 for ; Fri, 8 Sep 2023 13:32:28 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv4T3p3ZztS57; Fri, 8 Sep 2023 19:28:25 +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:26 +0800 From: Jie Hai To: , Harman Kalra , Chengwen Feng , Lijun Ou , Thomas Monjalon , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 27/36] net/octeontx: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:52 +0800 Message-ID: <20230908112901.1169869-28-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 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/octeontx/octeontx_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index a6ae51a42c4e..2a8378a33ea2 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -732,6 +732,11 @@ octeontx_dev_start(struct rte_eth_dev *dev) } /* Success */ + 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 ret; pki_port_stop_error: @@ -746,6 +751,7 @@ static int octeontx_dev_stop(struct rte_eth_dev *dev) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); + uint16_t i; int ret; PMD_INIT_FUNC_TRACE(); @@ -772,6 +778,11 @@ octeontx_dev_stop(struct rte_eth_dev *dev) return ret; } + 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; } From patchwork Fri Sep 8 11:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131292 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2664842547; Fri, 8 Sep 2023 13:35:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18B554113C; Fri, 8 Sep 2023 13:32:47 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id C175F40A8A for ; Fri, 8 Sep 2023 13:32:28 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv7048q3zrSVB; Fri, 8 Sep 2023 19:30:36 +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:27 +0800 From: Jie Hai To: , Gagandeep Singh , Chengwen Feng , Thomas Monjalon , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou CC: , Subject: [PATCH 28/36] net/pfe: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:53 +0800 Message-ID: <20230908112901.1169869-29-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 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/pfe/pfe_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index 0352a5795096..551f3cf193e3 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -241,6 +241,7 @@ pfe_eth_open(struct rte_eth_dev *dev) struct pfe_eth_priv_s *priv = dev->data->dev_private; struct hif_client_s *client; struct hif_shm *hif_shm; + uint16_t i; int rc; /* Register client driver with HIF */ @@ -318,6 +319,10 @@ pfe_eth_open(struct rte_eth_dev *dev) PFE_PMD_INFO("PFE INTERRUPT Mode enabled"); } + 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; err0: return rc; @@ -361,6 +366,7 @@ static int pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/) { struct pfe_eth_priv_s *priv = dev->data->dev_private; + uint16_t i; dev->data->dev_started = 0; @@ -370,6 +376,11 @@ pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/) dev->rx_pkt_burst = rte_eth_pkt_burst_dummy; dev->tx_pkt_burst = rte_eth_pkt_burst_dummy; + 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; } From patchwork Fri Sep 8 11:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131294 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0818942547; Fri, 8 Sep 2023 13:36:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24C01427DA; Fri, 8 Sep 2023 13:32:49 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 14C3640DCA for ; Fri, 8 Sep 2023 13:32:30 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5F6F90zMl6B; Fri, 8 Sep 2023 19:29:05 +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:27 +0800 From: Jie Hai To: , Bruce Richardson , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Ferruh Yigit , Lijun Ou , Chengwen Feng , Thomas Monjalon CC: , Subject: [PATCH 29/36] net/ring: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:54 +0800 Message-ID: <20230908112901.1169869-30-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 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/ring/rte_eth_ring.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index c43dccea7ffe..48953dd7a059 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -113,15 +113,30 @@ eth_dev_start(struct rte_eth_dev *dev) static int eth_dev_stop(struct rte_eth_dev *dev) { + uint16_t i; + dev->data->dev_started = 0; dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; + + 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; } static int eth_dev_set_link_down(struct rte_eth_dev *dev) { + uint16_t i; + dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; + + 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; } From patchwork Fri Sep 8 11:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131296 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F58442547; Fri, 8 Sep 2023 13:36:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CB2A427E3; Fri, 8 Sep 2023 13:32:51 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id B46E440DFB for ; Fri, 8 Sep 2023 13:32:32 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rhv644PP0zVkbf; Fri, 8 Sep 2023 19:29:48 +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:28 +0800 From: Jie Hai To: , Andrew Rybchenko , Thomas Monjalon , Lijun Ou , Chengwen Feng , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 30/36] net/sfc: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:55 +0800 Message-ID: <20230908112901.1169869-31-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 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/sfc/sfc_repr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c index 6c7727d56980..278e37477530 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -263,6 +263,7 @@ static int sfc_repr_dev_start(struct rte_eth_dev *dev) { struct sfc_repr *sr = sfc_repr_by_eth_dev(dev); + uint16_t i; int ret; sfcr_info(sr, "entry"); @@ -274,6 +275,11 @@ sfc_repr_dev_start(struct rte_eth_dev *dev) if (ret != 0) goto fail_start; + 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; + sfcr_info(sr, "done"); return 0; @@ -338,6 +344,7 @@ static int sfc_repr_dev_stop(struct rte_eth_dev *dev) { struct sfc_repr *sr = sfc_repr_by_eth_dev(dev); + uint16_t i; int ret; sfcr_info(sr, "entry"); @@ -352,6 +359,11 @@ sfc_repr_dev_stop(struct rte_eth_dev *dev) sfc_repr_unlock(sr); + 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; + sfcr_info(sr, "done"); return 0; From patchwork Fri Sep 8 11:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131297 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 47FD542547; Fri, 8 Sep 2023 13:36:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB91F4281D; Fri, 8 Sep 2023 13:32:52 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 5551140DFD for ; Fri, 8 Sep 2023 13:32:33 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv730Fqvz1M9Hk; Fri, 8 Sep 2023 19:30:39 +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:28 +0800 From: Jie Hai To: , Cristian Dumitrescu , Lijun Ou , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Thomas Monjalon , Ferruh Yigit , Chengwen Feng CC: , Subject: [PATCH 31/36] net/softnic: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:56 +0800 Message-ID: <20230908112901.1169869-32-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 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 Acked-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index bcf6664460a1..1b90cf7a21ee 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -134,6 +134,7 @@ pmd_dev_start(struct rte_eth_dev *dev) { struct pmd_internals *p = dev->data->dev_private; int status; + uint16_t i; /* Firmware */ status = softnic_cli_script_process(p, @@ -146,6 +147,11 @@ pmd_dev_start(struct rte_eth_dev *dev) /* Link UP */ dev->data->dev_link.link_status = RTE_ETH_LINK_UP; + 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; } @@ -153,6 +159,7 @@ static int pmd_dev_stop(struct rte_eth_dev *dev) { struct pmd_internals *p = dev->data->dev_private; + uint16_t i; /* Link DOWN */ dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; @@ -163,6 +170,11 @@ pmd_dev_stop(struct rte_eth_dev *dev) softnic_softnic_swq_free_keep_rxq_txq(p); softnic_mempool_free(p); + 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; } From patchwork Fri Sep 8 11:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131298 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45A9642547; Fri, 8 Sep 2023 13:36:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 093E242D28; Fri, 8 Sep 2023 13:32:54 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id B688A40E0F for ; Fri, 8 Sep 2023 13:32:33 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rhv5H4QY4zMl6J; Fri, 8 Sep 2023 19:29:07 +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:29 +0800 From: Jie Hai To: , Jiawen Wu , Jian Wang , Ferruh Yigit , Chengwen Feng , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Thomas Monjalon CC: , Subject: [PATCH 32/36] net/txgbe: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:57 +0800 Message-ID: <20230908112901.1169869-33-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 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/txgbe/txgbe_rxtx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index 427f8b82ac80..f4be2bb91c78 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -2805,6 +2805,8 @@ txgbe_dev_clear_queues(struct rte_eth_dev *dev) txq->ops->release_mbufs(txq); txq->ops->reset(txq); } + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -2814,6 +2816,8 @@ txgbe_dev_clear_queues(struct rte_eth_dev *dev) txgbe_rx_queue_release_mbufs(rxq); txgbe_reset_rx_queue(adapter, rxq); } + + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; } } @@ -5004,6 +5008,8 @@ txgbevf_dev_rxtx_start(struct rte_eth_dev *dev) } while (--poll_ms && !(txdctl & TXGBE_TXCFG_ENA)); if (!poll_ms) PMD_INIT_LOG(ERR, "Could not enable Tx Queue %d", i); + else + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; } for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; @@ -5018,6 +5024,8 @@ txgbevf_dev_rxtx_start(struct rte_eth_dev *dev) } while (--poll_ms && !(rxdctl & TXGBE_RXCFG_ENA)); if (!poll_ms) PMD_INIT_LOG(ERR, "Could not enable Rx Queue %d", i); + else + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; rte_wmb(); wr32(hw, TXGBE_RXWP(i), rxq->nb_rx_desc - 1); } From patchwork Fri Sep 8 11:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131300 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1215A42547; Fri, 8 Sep 2023 13:36:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CD0E42D66; Fri, 8 Sep 2023 13:32:56 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 8496440E01 for ; Fri, 8 Sep 2023 13:32:33 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv741VGfz1M9HG; Fri, 8 Sep 2023 19:30:40 +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:29 +0800 From: Jie Hai To: , Maxime Coquelin , Chenbo Xia , Lijun Ou , Thomas Monjalon , Chengwen Feng , Ferruh Yigit , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com> CC: , Subject: [PATCH 33/36] net/vhost: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:58 +0800 Message-ID: <20230908112901.1169869-34-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 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/vhost/rte_eth_vhost.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 8d37ec977545..d53b8c2cd1fc 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1135,6 +1135,7 @@ eth_dev_start(struct rte_eth_dev *eth_dev) { struct pmd_internal *internal = eth_dev->data->dev_private; struct rte_eth_conf *dev_conf = ð_dev->data->dev_conf; + uint16_t i; eth_vhost_uninstall_intr(eth_dev); if (dev_conf->intr_conf.rxq && eth_vhost_install_intr(eth_dev) < 0) { @@ -1150,6 +1151,11 @@ eth_dev_start(struct rte_eth_dev *eth_dev) rte_atomic32_set(&internal->started, 1); update_queuing_status(eth_dev, false); + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; } @@ -1157,11 +1163,17 @@ static int eth_dev_stop(struct rte_eth_dev *dev) { struct pmd_internal *internal = dev->data->dev_private; + uint16_t i; dev->data->dev_started = 0; rte_atomic32_set(&internal->started, 0); update_queuing_status(dev, true); + 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; } From patchwork Fri Sep 8 11:28:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131295 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71DFD42547; Fri, 8 Sep 2023 13:36:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49F9F427E0; Fri, 8 Sep 2023 13:32:50 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 49986402E9 for ; Fri, 8 Sep 2023 13:32:32 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv745l3Gz1M9Hm; Fri, 8 Sep 2023 19:30:40 +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:30 +0800 From: Jie Hai To: , Maxime Coquelin , Chenbo Xia , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Ferruh Yigit , Chengwen Feng , Thomas Monjalon CC: , Subject: [PATCH 34/36] net/virtio: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:28:59 +0800 Message-ID: <20230908112901.1169869-35-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 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/virtio/virtio_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 2c23f1c00e25..3ab56ef769c9 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -2417,6 +2417,11 @@ virtio_dev_start(struct rte_eth_dev *dev) set_rxtx_funcs(dev); hw->started = 1; + 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; + /* Initialize Link state */ virtio_dev_link_update(dev, 0); @@ -2506,6 +2511,7 @@ virtio_dev_stop(struct rte_eth_dev *dev) struct virtio_hw *hw = dev->data->dev_private; struct rte_eth_link link; struct rte_eth_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf; + uint16_t i; PMD_INIT_LOG(DEBUG, "stop"); dev->data->dev_started = 0; @@ -2533,6 +2539,11 @@ virtio_dev_stop(struct rte_eth_dev *dev) out_unlock: rte_spinlock_unlock(&hw->state_lock); + 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; } From patchwork Fri Sep 8 11:29:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131299 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4344042547; Fri, 8 Sep 2023 13:36:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EE5442D2E; Fri, 8 Sep 2023 13:32:55 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 8B8A540E03 for ; Fri, 8 Sep 2023 13:32:33 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rhv744KxqzrSVB; Fri, 8 Sep 2023 19:30:40 +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:31 +0800 From: Jie Hai To: , Jochen Behrens , Ferruh Yigit , Thomas Monjalon , Konstantin Ananyev <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>, Lijun Ou , Chengwen Feng CC: , Subject: [PATCH 35/36] net/vmxnet3: fix Rx and Tx queue state Date: Fri, 8 Sep 2023 19:29:00 +0800 Message-ID: <20230908112901.1169869-36-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 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/vmxnet3/vmxnet3_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 76e80e302519..e49191718aea 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -1048,6 +1048,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev) { int ret; struct vmxnet3_hw *hw = dev->data->dev_private; + uint16_t i; PMD_INIT_FUNC_TRACE(); @@ -1151,6 +1152,11 @@ vmxnet3_dev_start(struct rte_eth_dev *dev) */ __vmxnet3_dev_link_update(dev, 0); + 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 VMXNET3_SUCCESS; } @@ -1163,6 +1169,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev) struct rte_eth_link link; struct vmxnet3_hw *hw = dev->data->dev_private; struct rte_intr_handle *intr_handle = dev->intr_handle; + uint16_t i; int ret; PMD_INIT_FUNC_TRACE(); @@ -1218,6 +1225,11 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev) hw->adapter_stopped = 1; 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; } From patchwork Fri Sep 8 11:29:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 131301 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7001842547; Fri, 8 Sep 2023 13:37:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3661C42D6A; Fri, 8 Sep 2023 13:32:57 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 24BD840E36 for ; Fri, 8 Sep 2023 13:32:34 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rhv756X7gz1M9Hn; Fri, 8 Sep 2023 19:30:41 +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:31 +0800 From: Jie Hai To: , Aman Singh , Yuying Zhang , Anatoly Burakov , Matan Azrad , Dmitry Kozlyuk CC: , Subject: [PATCH 36/36] app/testpmd: fix primary process not polling all queues Date: Fri, 8 Sep 2023 19:29:01 +0800 Message-ID: <20230908112901.1169869-37-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 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 Here's how the problem arises. step1: Start the app. dpdk-testpmd -a 0000:35:00.0 -l 0-3 -- -i --rxq=10 --txq=10 step2: Perform the following steps and send traffic. As expected, queue 7 does not send or receive packets, and other queues do. port 0 rxq 7 stop port 0 txq 7 stop set fwd mac start step3: Perform the following steps and send traffic. All queues are expected to send and receive packets normally, but that's not the case for queue 7. stop port stop all port start all start show port xstats all In fact, only the value of rx_q7_packets for queue 7 is not zero, which means queue 7 is enabled for the driver but is not involved in packet receiving and forwarding by software. If we check queue state by command 'show rxq info 0 7' and 'show txq info 0 7', we see queue 7 is started as other queues are. Rx queue state: started Tx queue state: started The queue 7 is started but cannot forward. That's the problem. We know that each stream has a read-only "disabled" field that control if this stream should be used to forward. This field depends on testpmd local queue state, please see commit 3c4426db54fc ("app/testpmd: do not poll stopped queues"). DPDK framework maintains ethdev queue state that drivers reported, which indicates the real state of queues. There are commands that update these two kind queue state such as 'port X rxq|txq start|stop'. But these operations take effect only in one stop-start round. In the following stop-start round, the preceding operations do not take effect anymore. However, only the ethdev queue state is updated, causing the testpmd and ethdev state information to diverge and causing unexpected side effects as above problem. There was a similar problem for the secondary process, please see commit 5028f207a4fa ("app/testpmd: fix secondary process packet forwarding"). This patch applies its workaround with some difference to the primary process. Not all PMDs implement rte_eth_rx_queue_info_get and rte_eth_tx_queue_info_get, however they may support deferred_start with primary process. To not break their behavior, retain the original testpmd local queue state for those PMDs. Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") Cc: stable@dpdk.org Signed-off-by: Jie Hai Acked-by: Ferruh Yigit --- app/test-pmd/testpmd.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 938ca035d4f8..079ef3392014 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2424,6 +2424,13 @@ update_rx_queue_state(uint16_t port_id, uint16_t queue_id) ports[port_id].rxq[queue_id].state = rx_qinfo.queue_state; } else if (rc == -ENOTSUP) { + /* + * Do not change the rxq state for primary process + * to ensure that the PMDs do not implement + * rte_eth_rx_queue_info_get can forward as before. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + return; /* * Set the rxq state to RTE_ETH_QUEUE_STATE_STARTED * to ensure that the PMDs do not implement @@ -2449,6 +2456,13 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) ports[port_id].txq[queue_id].state = tx_qinfo.queue_state; } else if (rc == -ENOTSUP) { + /* + * Do not change the txq state for primary process + * to ensure that the PMDs do not implement + * rte_eth_tx_queue_info_get can forward as before. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + return; /* * Set the txq state to RTE_ETH_QUEUE_STATE_STARTED * to ensure that the PMDs do not implement @@ -2463,12 +2477,15 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) } static void -update_queue_state(void) +update_queue_state(portid_t pid) { portid_t pi; queueid_t qi; RTE_ETH_FOREACH_DEV(pi) { + if (pid != pi && pid != (portid_t)RTE_PORT_ALL) + continue; + for (qi = 0; qi < nb_rxq; qi++) update_rx_queue_state(pi, qi); for (qi = 0; qi < nb_txq; qi++) @@ -2516,8 +2533,7 @@ start_packet_forwarding(int with_tx_first) return; if (stream_init != NULL) { - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(RTE_PORT_ALL); for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) stream_init(fwd_streams[i]); } @@ -3280,8 +3296,7 @@ start_port(portid_t pid) pl[cfg_pi++] = pi; } - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(pi); if (at_least_one_port_successfully_started && !no_link_check) check_all_ports_link_status(RTE_PORT_ALL);