From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8288E48922; Mon, 13 Oct 2025 09:00:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AA6A402CB; Mon, 13 Oct 2025 09:00:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 59E6E40431 for ; Mon, 13 Oct 2025 09:00:05 +0200 (CEST) Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59D0OJw3030274 for ; Mon, 13 Oct 2025 00:00:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=m HgP1NRBUP0DYBxFpnzwg9DQn9VKoQRox+8yQ4EEl/8=; b=FqJuKYO99bVsfFojS oMwqCX5DgClIOPolOqak/HggVr7earq58+SSWbB4HdrHwLGtxb/JeAf65/zKI5YP tiJl4jrwnvSO1v7+QDYWrCix1343OVHqbnawljdvv2STOmDU5Dqz0ifmpSUaWpFZ Ervd0aIAL7y3wtixAlOByCOMytloikcAgFEza1A7Oc/RrfO0r+rkO5k7Qu9Sre6w xWyRlsq5K3V0Z9JuNrs42d49I9+y9nEdB/jp9AB+ZwFZhGyne+Ly/QncTDPYazR7 9EVqnw1kn6tBF5o1TGF/5Qn7i5Uc+O+aHUjML4ziCUliU9MQyP0XD1aZ/cziUsn+ 4ClMg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 49r8069fea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 13 Oct 2025 00:00:04 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Mon, 13 Oct 2025 00:00:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Mon, 13 Oct 2025 00:00:15 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 014903F70C0; Mon, 13 Oct 2025 00:00:00 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Subject: [PATCH v2 03/19] net/cnxk: disable CQ when SQ stopped Date: Mon, 13 Oct 2025 12:29:33 +0530 Message-ID: <20251013065949.200414-3-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251013065949.200414-1-ndabilpuram@marvell.com> References: <20250901073036.1381560-1-ndabilpuram@marvell.com> <20251013065949.200414-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Authority-Analysis: v=2.4 cv=Y8n1cxeN c=1 sm=1 tr=0 ts=68eca374 cx=c_pps a=gIfcoYsirJbf48DBMSPrZA==:117 a=gIfcoYsirJbf48DBMSPrZA==:17 a=x6icFKpwvdMA:10 a=M5GUcnROAAAA:8 a=j0D0reGXZnfTH6MTHhMA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-ORIG-GUID: Xh6Cj2jpo0J60q5bB7rkJW1b1BAEKXfb X-Proofpoint-GUID: Xh6Cj2jpo0J60q5bB7rkJW1b1BAEKXfb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEyMDA0MCBTYWx0ZWRfX0qHu6pFKJsnq tRfcJGVJmUbsNRV2anLO2I3VBSHjS+bJD+TlwL2FauKFkQ5jZG455J1kLeI8BUU8EZPx5nuWAWf VFmdnZWprMMLb6LIeZ037D3nc6cPYmwr8vmxndBi1jno6vUxKi+kptVtI+4TzQEPiwgBlPpjrUx 61C4AHwCwY88PFWmrRH5vqHwvX4AE/hCQMgzHRha5PvKtngdmoxXn5ZOrG4gAEFFF1HpqyQWwhM 63VGRgD8IHOkBlEXbPoHOGha9yH3VSrrzvU+cwvvNT6GOMLlzTvoDNTaeZP4X3UfoQAQljZxGct ByrWhQpuqWAEX+NNj56FzLkgj+z38FJJsRJn7gSkj/qcjD+3Xntemt7Zjh2vCCVIkSXNvsC2Uh+ 0GaTryaZT0822G2Pz1THxby7v7eieA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-13_03,2025-10-06_01,2025-03-28_01 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 From: Satha Rao Drain all CQ buffers and close CQ when SQ enabled completion is about to stop. Signed-off-by: Satha Rao --- drivers/net/cnxk/cn10k_ethdev.c | 16 ++++++++-------- drivers/net/cnxk/cn20k_ethdev.c | 11 ++++++----- drivers/net/cnxk/cnxk_ethdev.c | 11 ++++++++++- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 9c1621dbfa..23a2341c8b 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -198,21 +198,21 @@ cn10k_nix_tx_compl_setup(struct cnxk_eth_dev *dev, static void cn10k_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid) { + struct cn10k_eth_txq *txq = eth_dev->data->tx_queues[qid]; struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); struct roc_nix *nix = &dev->nix; - struct cn10k_eth_txq *txq; - cnxk_nix_tx_queue_release(eth_dev, qid); - txq = eth_dev->data->tx_queues[qid]; - - if (nix->tx_compl_ena) + if (nix->tx_compl_ena) { + /* First process all CQ entries */ + handle_tx_completion_pkts(txq, 0); plt_free(txq->tx_compl.ptr); + } + cnxk_nix_tx_queue_release(eth_dev, qid); } static int -cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid, - uint16_t nb_desc, unsigned int socket, - const struct rte_eth_txconf *tx_conf) +cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid, uint16_t nb_desc, + unsigned int socket, const struct rte_eth_txconf *tx_conf) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); struct roc_nix *nix = &dev->nix; diff --git a/drivers/net/cnxk/cn20k_ethdev.c b/drivers/net/cnxk/cn20k_ethdev.c index 376e334588..a7ef1dd386 100644 --- a/drivers/net/cnxk/cn20k_ethdev.c +++ b/drivers/net/cnxk/cn20k_ethdev.c @@ -192,15 +192,16 @@ cn20k_nix_tx_compl_setup(struct cnxk_eth_dev *dev, struct cn20k_eth_txq *txq, st static void cn20k_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid) { + struct cn20k_eth_txq *txq = eth_dev->data->tx_queues[qid]; struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); struct roc_nix *nix = &dev->nix; - struct cn20k_eth_txq *txq; - cnxk_nix_tx_queue_release(eth_dev, qid); - txq = eth_dev->data->tx_queues[qid]; - - if (nix->tx_compl_ena) + if (nix->tx_compl_ena) { + /* First process all CQ entries */ + handle_tx_completion_pkts(txq, 0); plt_free(txq->tx_compl.ptr); + } + cnxk_nix_tx_queue_release(eth_dev, qid); } static int diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index bfef06ae4a..4550fca3b5 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -570,6 +570,7 @@ cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid) struct cnxk_eth_txq_sp *txq_sp; struct cnxk_eth_dev *dev; struct roc_nix_sq *sq; + struct roc_nix_cq *cq; int rc; if (!txq) @@ -578,11 +579,19 @@ cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid) txq_sp = cnxk_eth_txq_to_sp(txq); dev = txq_sp->dev; + sq = &dev->sqs[qid]; plt_nix_dbg("Releasing txq %u", qid); + if (dev->nix.tx_compl_ena) { + /* Cleanup ROC CQ */ + cq = &dev->cqs[sq->cqid]; + rc = roc_nix_cq_fini(cq); + if (rc) + plt_err("Failed to cleanup cq, rc=%d", rc); + } + /* Cleanup ROC SQ */ - sq = &dev->sqs[qid]; rc = roc_nix_sq_fini(sq); if (rc) plt_err("Failed to cleanup sq, rc=%d", rc); -- 2.34.1