From patchwork Thu Sep 28 07:42: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: 132080 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 168014265D; Thu, 28 Sep 2023 09:46:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB20E4029D; Thu, 28 Sep 2023 09:46:21 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 4F10240273 for ; Thu, 28 Sep 2023 09:46:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rx58D3Rf9z15NRL; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:12 +0800 From: Jie Hai To: , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Subject: [PATCH v2 1/8] lib/ethdev: update Rx and Tx queue status Date: Thu, 28 Sep 2023 15:42:58 +0800 Message-ID: <20230928074305.2991100-2-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 status, which is stored in 'dev->data->tx_queue_state' and 'dev->data->rx_queue_state'.The state is currently maintained by the drivers. Users may determine whether a queue participates in packet forwarding based on the state. However, not all drivers correctly report the queue status. This may cause forwarding problems. Since it is difficult to modify the queue status of all drivers, we consider updating the queue status at the framework level. Some drivers support queues for hairpin, leaving status updating for such queues to the drivers. Some drivers support 'deferred_start'. Assume that all drivers that support 'deferred_start' can obtain the configuration through 'rte_eth_tx_queue_info_get' and 'rte_eth_rx_queue_info_get'. So we can directly update the queue status in 'rte_eth_dev_start' and 'rte_eth_dev_stop'. Signed-off-by: Jie Hai --- lib/ethdev/rte_ethdev.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 0840d2b5942a..e3aaa71eba9e 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1641,6 +1641,9 @@ rte_eth_dev_start(uint16_t port_id) struct rte_eth_dev_info dev_info; int diag; int ret, ret_stop; + uint16_t i; + struct rte_eth_rxq_info rxq_info; + struct rte_eth_txq_info txq_info; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; @@ -1697,6 +1700,30 @@ rte_eth_dev_start(uint16_t port_id) (*dev->dev_ops->link_update)(dev, 0); } + for (i = 0; i < dev->data->nb_rx_queues; i++) { + if (rte_eth_dev_is_rx_hairpin_queue(dev, i)) + continue; + + memset(&rxq_info, 0, sizeof(rxq_info)); + ret = rte_eth_rx_queue_info_get(port_id, i, &rxq_info); + if (ret == 0 && rxq_info.conf.rx_deferred_start != 0) + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + else + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + } + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + if (rte_eth_dev_is_tx_hairpin_queue(dev, i)) + continue; + + memset(&txq_info, 0, sizeof(txq_info)); + ret = rte_eth_tx_queue_info_get(port_id, i, &txq_info); + if (ret == 0 && txq_info.conf.tx_deferred_start != 0) + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + else + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + } + /* expose selection of PMD fast-path functions */ eth_dev_fp_ops_setup(rte_eth_fp_ops + port_id, dev); @@ -1708,6 +1735,7 @@ int rte_eth_dev_stop(uint16_t port_id) { struct rte_eth_dev *dev; + uint16_t i; int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); @@ -1731,6 +1759,18 @@ rte_eth_dev_stop(uint16_t port_id) dev->data->dev_started = 0; rte_ethdev_trace_stop(port_id, ret); + for (i = 0; i < dev->data->nb_rx_queues; i++) { + if (rte_eth_dev_is_rx_hairpin_queue(dev, i)) + continue; + dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + } + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + if (rte_eth_dev_is_tx_hairpin_queue(dev, i)) + continue; + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + } + return ret; } From patchwork Thu Sep 28 07:42: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: 132081 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 955944265D; Thu, 28 Sep 2023 09:46:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F6CC406B8; Thu, 28 Sep 2023 09:46:23 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7AF0F402CC for ; Thu, 28 Sep 2023 09:46:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rx56R0vBLzNmXk for ; Thu, 28 Sep 2023 15:42:23 +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; Thu, 28 Sep 2023 15:46:12 +0800 From: Jie Hai To: , Yuying Zhang , Beilei Xing CC: , Subject: [PATCH v2 2/8] net/cpfl: support getting queue information Date: Thu, 28 Sep 2023 15:42:59 +0800 Message-ID: <20230928074305.2991100-3-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds support for querying Rx/Tx queue information. Signed-off-by: Jie Hai --- drivers/net/cpfl/cpfl_ethdev.c | 2 ++ drivers/net/cpfl/cpfl_rxtx.c | 26 ++++++++++++++++++++++++++ drivers/net/cpfl/cpfl_rxtx.h | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index c4ca9343c3e0..05604f99ed44 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1291,6 +1291,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = { .tx_queue_stop = cpfl_tx_queue_stop, .rx_queue_release = cpfl_dev_rx_queue_release, .tx_queue_release = cpfl_dev_tx_queue_release, + .rxq_info_get = cpfl_dev_rxq_info_get, + .txq_info_get = cpfl_dev_txq_info_get, .mtu_set = cpfl_dev_mtu_set, .dev_supported_ptypes_get = cpfl_dev_supported_ptypes_get, .stats_get = cpfl_dev_stats_get, diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c index 2ef6871a8509..7636162b332a 100644 --- a/drivers/net/cpfl/cpfl_rxtx.c +++ b/drivers/net/cpfl/cpfl_rxtx.c @@ -1606,3 +1606,29 @@ cpfl_set_tx_function(struct rte_eth_dev *dev) } #endif /* RTE_ARCH_X86 */ } + +void +cpfl_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct cpfl_rx_queue *cpfl_rxq; + + cpfl_rxq = dev->data->rx_queues[rx_queue_id]; + qinfo->nb_desc = cpfl_rxq->base.nb_rx_desc; + qinfo->conf.rx_free_thresh = cpfl_rxq->base.nb_rx_desc; + qinfo->conf.rx_free_thresh = cpfl_rxq->base.rx_free_thresh; + qinfo->conf.rx_deferred_start = cpfl_rxq->base.rx_deferred_start; +} + +void +cpfl_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct cpfl_tx_queue *cpfl_txq; + + cpfl_txq = dev->data->tx_queues[tx_queue_id]; + qinfo->nb_desc = cpfl_txq->base.nb_tx_desc; + qinfo->conf.tx_rs_thresh = cpfl_txq->base.rs_thresh; + qinfo->conf.tx_free_thresh = cpfl_txq->base.free_thresh; + qinfo->conf.tx_deferred_start = cpfl_txq->base.tx_deferred_start; +} diff --git a/drivers/net/cpfl/cpfl_rxtx.h b/drivers/net/cpfl/cpfl_rxtx.h index aacd087b56cd..1ec14ed24cd6 100644 --- a/drivers/net/cpfl/cpfl_rxtx.h +++ b/drivers/net/cpfl/cpfl_rxtx.h @@ -102,6 +102,10 @@ int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid); void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid); +void cpfl_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo); +void cpfl_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_txq_info *qinfo); void cpfl_set_rx_function(struct rte_eth_dev *dev); void cpfl_set_tx_function(struct rte_eth_dev *dev); int cpfl_rx_hairpin_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, From patchwork Thu Sep 28 07:43: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: 132082 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 A595F4265D; Thu, 28 Sep 2023 09:46:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7158240A72; Thu, 28 Sep 2023 09:46:24 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 0E61440273 for ; Thu, 28 Sep 2023 09:46:16 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rx58F2tdFz15NRl; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:13 +0800 From: Jie Hai To: , Gagandeep Singh , Sachin Saxena CC: , Subject: [PATCH v2 3/8] net/enetc: save deferred start configuratin for queues Date: Thu, 28 Sep 2023 15:43:00 +0800 Message-ID: <20230928074305.2991100-4-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds new fields to 'struct enetc_bdr' to save the configuratin of Rx and Tx deferred start. Signed-off-by: Jie Hai --- drivers/net/enetc/enetc.h | 2 ++ drivers/net/enetc/enetc_ethdev.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h index 7163633bcedf..170854cd1649 100644 --- a/drivers/net/enetc/enetc.h +++ b/drivers/net/enetc/enetc.h @@ -74,6 +74,8 @@ struct enetc_bdr { }; struct rte_mempool *mb_pool; /* mbuf pool to populate RX ring. */ struct rte_eth_dev *ndev; + bool rx_deferred_start; + bool tx_deferred_start; }; /* diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 1b4337bc488c..444792b7f77e 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -326,9 +326,11 @@ enetc_tx_queue_setup(struct rte_eth_dev *dev, ENETC_TBMR, ENETC_TBMR_EN); dev->data->tx_queue_state[tx_ring->index] = RTE_ETH_QUEUE_STATE_STARTED; + tx_ring->tx_deferred_start = false; } else { dev->data->tx_queue_state[tx_ring->index] = RTE_ETH_QUEUE_STATE_STOPPED; + tx_ring->tx_deferred_start = true; } return 0; @@ -473,9 +475,11 @@ enetc_rx_queue_setup(struct rte_eth_dev *dev, ENETC_RBMR_EN); dev->data->rx_queue_state[rx_ring->index] = RTE_ETH_QUEUE_STATE_STARTED; + rx_ring->rx_deferred_start = false; } else { dev->data->rx_queue_state[rx_ring->index] = RTE_ETH_QUEUE_STATE_STOPPED; + rx_ring->rx_deferred_start = true; } rx_ring->crc_len = (uint8_t)((rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? From patchwork Thu Sep 28 07:43: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: 132079 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 9DF2F4265D; Thu, 28 Sep 2023 09:46:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A71CE40273; Thu, 28 Sep 2023 09:46:17 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 72A4E40296 for ; Thu, 28 Sep 2023 09:46:15 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rx58F6TKQz15NS9; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:13 +0800 From: Jie Hai To: , Gagandeep Singh , Sachin Saxena CC: , Subject: [PATCH v2 4/8] net/enetc: support getting queue information Date: Thu, 28 Sep 2023 15:43:01 +0800 Message-ID: <20230928074305.2991100-5-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds support for querying Rx/Tx queue information. Signed-off-by: Jie Hai --- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 444792b7f77e..07ee07c4d5d8 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -828,6 +828,26 @@ enetc_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) return 0; } +static void +enetc_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct enetc_bdr *rx_ring; + + rx_ring = dev->data->rx_queues[queue_id]; + qinfo->conf.rx_deferred_start = rx_ring->rx_deferred_start; +} + +static void +enetc_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct enetc_bdr *tx_ring; + + tx_ring = dev->data->tx_queues[queue_id]; + qinfo->conf.tx_deferred_start = tx_ring->tx_deferred_start; +} + /* * The set of PCI devices this driver supports */ @@ -856,10 +876,12 @@ static const struct eth_dev_ops enetc_ops = { .rx_queue_start = enetc_rx_queue_start, .rx_queue_stop = enetc_rx_queue_stop, .rx_queue_release = enetc_rx_queue_release, + .rxq_info_get = enetc_rxq_info_get, .tx_queue_setup = enetc_tx_queue_setup, .tx_queue_start = enetc_tx_queue_start, .tx_queue_stop = enetc_tx_queue_stop, .tx_queue_release = enetc_tx_queue_release, + .txq_info_get = enetc_txq_info_get, .dev_supported_ptypes_get = enetc_supported_ptypes_get, }; From patchwork Thu Sep 28 07:43:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 132084 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 274B64265D; Thu, 28 Sep 2023 09:46:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3424740A80; Thu, 28 Sep 2023 09:46:27 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 2961740296 for ; Thu, 28 Sep 2023 09:46:16 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rx58G2DTWz15NS7; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:14 +0800 From: Jie Hai To: , Gaetan Rivet CC: , Subject: [PATCH v2 5/8] net/failsafe: support getting queue information Date: Thu, 28 Sep 2023 15:43:02 +0800 Message-ID: <20230928074305.2991100-6-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds support for querying Rx/Tx queue information. Signed-off-by: Jie Hai --- drivers/net/failsafe/failsafe_ops.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 35649b6244a5..e84dbae5563c 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1565,6 +1565,28 @@ fs_rss_hash_update(struct rte_eth_dev *dev, return 0; } +static void +fs_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct rxq *rxq; + + rxq = dev->data->rx_queues[rx_queue_id]; + qinfo->nb_desc = rxq->info.nb_desc; + qinfo->conf.rx_deferred_start = rxq->info.conf.rx_deferred_start; +} + +static void +fs_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct txq *txq; + + txq = dev->data->tx_queues[tx_queue_id]; + qinfo->nb_desc = txq->info.nb_desc; + qinfo->conf.tx_deferred_start = txq->info.conf.tx_deferred_start; +} + static int fs_flow_ops_get(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_ops **ops) @@ -1604,6 +1626,8 @@ const struct eth_dev_ops failsafe_ops = { .tx_queue_release = fs_tx_queue_release, .rx_queue_intr_enable = fs_rx_intr_enable, .rx_queue_intr_disable = fs_rx_intr_disable, + .rxq_info_get = fs_rxq_info_get, + .txq_info_get = fs_txq_info_get, .flow_ctrl_get = fs_flow_ctrl_get, .flow_ctrl_set = fs_flow_ctrl_set, .mac_addr_remove = fs_mac_addr_remove, From patchwork Thu Sep 28 07:43:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 132085 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 9EE234265D; Thu, 28 Sep 2023 09:46:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 730F140A8A; Thu, 28 Sep 2023 09:46:28 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 247F040273 for ; Thu, 28 Sep 2023 09:46:17 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rx58F6mLzzrSpC for ; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:14 +0800 From: Jie Hai To: , Qi Zhang , Xiao Wang CC: , Subject: [PATCH v2 6/8] net/fm10k: support getting queue information Date: Thu, 28 Sep 2023 15:43:03 +0800 Message-ID: <20230928074305.2991100-7-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds support for querying Rx/Tx queue information. Signed-off-by: Jie Hai --- drivers/net/fm10k/fm10k_ethdev.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 4d3c4c10cfa4..e12177b7cdba 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2835,6 +2835,32 @@ fm10k_dev_close(struct rte_eth_dev *dev) return ret; } + +static void +fm10k_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct fm10k_rx_queue *rxq; + + rxq = dev->data->rx_queues[rx_queue_id]; + qinfo->nb_desc = rxq->nb_desc; + qinfo->conf.rx_drop_en = rxq->drop_en; + qinfo->conf.rx_deferred_start = rxq->rx_deferred_start; +} + +static void +fm10k_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct fm10k_tx_queue *txq; + + txq = dev->data->tx_queues[tx_queue_id]; + qinfo->nb_desc = txq->nb_desc; + qinfo->conf.tx_rs_thresh = txq->rs_thresh; + qinfo->conf.tx_free_thresh = txq->free_thresh; + qinfo->conf.tx_deferred_start = txq->tx_deferred_start; +} + static const struct eth_dev_ops fm10k_eth_dev_ops = { .dev_configure = fm10k_dev_configure, .dev_start = fm10k_dev_start, @@ -2866,6 +2892,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .tx_queue_release = fm10k_tx_queue_release, .rx_queue_intr_enable = fm10k_dev_rx_queue_intr_enable, .rx_queue_intr_disable = fm10k_dev_rx_queue_intr_disable, + .rxq_info_get = fm10k_dev_rxq_info_get, + .txq_info_get = fm10k_dev_txq_info_get, .reta_update = fm10k_reta_update, .reta_query = fm10k_reta_query, .rss_hash_update = fm10k_rss_hash_update, From patchwork Thu Sep 28 07:43:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 132083 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 9843C4265D; Thu, 28 Sep 2023 09:46:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0662540A79; Thu, 28 Sep 2023 09:46: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 8AE9740273 for ; Thu, 28 Sep 2023 09:46:16 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rx58G2lCMzrSwG for ; Thu, 28 Sep 2023 15:43: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; Thu, 28 Sep 2023 15:46:15 +0800 From: Jie Hai To: , Jingjing Wu , Beilei Xing CC: , Subject: [PATCH v2 7/8] net/idpf: support getting queue information Date: Thu, 28 Sep 2023 15:43:04 +0800 Message-ID: <20230928074305.2991100-8-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 This patch adds support for querying Rx/Tx queue information. Signed-off-by: Jie Hai --- drivers/net/idpf/idpf_ethdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 3af7cf0bb7e0..c3819e4a863c 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -835,6 +835,26 @@ idpf_dev_close(struct rte_eth_dev *dev) return 0; } +static void +idpf_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct idpf_rx_queue *rxq; + + rxq = dev->data->rx_queues[rx_queue_id]; + qinfo->conf.rx_deferred_start = rxq->rx_deferred_start; +} + +static void +idpf_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct idpf_tx_queue *txq; + + txq = dev->data->tx_queues[tx_queue_id]; + qinfo->conf.tx_deferred_start = txq->tx_deferred_start; +} + static const struct eth_dev_ops idpf_eth_dev_ops = { .dev_configure = idpf_dev_configure, .dev_close = idpf_dev_close, @@ -850,6 +870,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = { .tx_queue_stop = idpf_tx_queue_stop, .rx_queue_release = idpf_dev_rx_queue_release, .tx_queue_release = idpf_dev_tx_queue_release, + .rxq_info_get = idpf_rxq_info_get, + .txq_info_get = idpf_txq_info_get, .mtu_set = idpf_dev_mtu_set, .dev_supported_ptypes_get = idpf_dev_supported_ptypes_get, .stats_get = idpf_dev_stats_get, From patchwork Thu Sep 28 07:43:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 132086 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 D28754265D; Thu, 28 Sep 2023 09:46:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B55BA40DDB; Thu, 28 Sep 2023 09:46:29 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 549F2402F0 for ; Thu, 28 Sep 2023 09:46:17 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rx56T5yjHzNnp5; Thu, 28 Sep 2023 15:42: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; Thu, 28 Sep 2023 15:46:15 +0800 From: Jie Hai To: , Aman Singh , Yuying Zhang , Anatoly Burakov , Dmitry Kozlyuk , Matan Azrad CC: , Subject: [PATCH v2 8/8] app/testpmd: fix primary process not polling all queues Date: Thu, 28 Sep 2023 15:43:05 +0800 Message-ID: <20230928074305.2991100-9-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230928074305.2991100-1-haijie1@huawei.com> References: <20230908112901.1169869-1-haijie1@huawei.com> <20230928074305.2991100-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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);