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 C644845C2A; Mon, 4 Nov 2024 03:07:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25AF440B99; Mon, 4 Nov 2024 03:07:14 +0100 (CET) Received: from smtpbgau2.qq.com (smtpbgau2.qq.com [54.206.34.216]) by mails.dpdk.org (Postfix) with ESMTP id E0B7840A7F for ; Mon, 4 Nov 2024 03:07:09 +0100 (CET) X-QQ-mid: bizesmtp91t1730686026t9xlqss9 X-QQ-Originating-IP: ToKNPSa4OWD0g4hRjqo0ygS7pNmYrUqGuxF61KorTsI= Received: from wxdbg.localdomain.com ( [60.186.23.108]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 04 Nov 2024 10:07:06 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7703180126434702021 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Subject: [PATCH v3 07/13] net/txgbe: add Tx descriptor error statistics Date: Mon, 4 Nov 2024 10:30:01 +0800 Message-Id: <20241104023007.782475-8-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241104023007.782475-1-jiawenwu@trustnetic.com> References: <20241028023147.60157-1-jiawenwu@trustnetic.com> <20241104023007.782475-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz8a-1 X-QQ-XMAILINFO: Ngk7ShESHkQuxvIAJqJldfrBpXULt9NRprrjIocvLLwzhJaAEObPH9cQ X1YEEtv9EfX1qsI+NYOjpyZDaAHWpiW5VmyIWJQMkNILWTZX1GIFpMtCG9pKq5Cvzf8j/Cq BUxa49iaed0CnXfoFgHbf0Vd4e8wfSmiLKopY24/ICfc+p8oW2guc2LFSvIsEHLOvlaA3xn iMBC00+7uoXtQM6FsO16raF96yqQyGNUueBU5/Q2v/w5Y8pnMbX2/e6ben9pnYhRQOp7ToW LKSu+E1Wva22w+0VILNApKaOv97l1OwVHuHERHC2l7GZ7HkGYzhWfkhRWYF1DaiEMXTJWDp X5ZVoM6Ta/WVvhnDHsZdOJbirv5BELs0tfBvw9d3CR7zBEWQ1vVLSDMMilpnytV4wOuyAP2 rDrJOjwzB386DK9z0MA6s5srnGl2Y86xZxx6GlW51jjK0qNV+oCcjEOBkL403syd4w795OE 2QCXphI+d96EA9v/240cjSov8GAidW3CrAwXpzztrDCVww2mtdU8qqys3gWMdFI6gFQQreF 6hFYPk0e+da0JyqMVay9KOjq4hTfsE2if6scFsOT4K1mQ3FPm4Zqt092V1vJpKz35eKkDxf e9CfhX/P8cik9gcfnQ6t5meJMPRCVfIRWaVZn5oq+881KBVKauzHMhRRNLc88rXHpO18p1T LBjVGDqPy/3x1mKfF1orCwo2xKK0nKRrHre8DhbexZaSLGJ6j/92hkMtSFwtscui6xnYyWf m8k2NiWqEy46j4Q/NVEYx0mc2nT2SCHwkp2gTnhTHLMoQth1Ph8COt8MxhUDxZV+/N1ol1L tBl51DR//UdHCikAqb94Vd4e4KOizV96BYDKkaZoAO9sTBkpU5WO7fM94FiduVTjFlKCXI3 agZ9+YFzhm/jBtjaTaaB4/E+MDbgqKGuIQQp0yB9O8mr4f22DBGj4rUHvFfSflN55r52HUw H/wXqUX6L7n4cw7TFtc16jv+17bWiZ7yKN5I= X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= X-QQ-RECHKSPAM: 0 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 Count the number of packets not sent due to Tx descriptor error. Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_ethdev.c | 13 +++++++++++++ drivers/net/txgbe/txgbe_rxtx.c | 6 ++++++ drivers/net/txgbe/txgbe_rxtx.h | 1 + 3 files changed, 20 insertions(+) diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index bafa9cf829..a956216abb 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -2344,6 +2344,7 @@ txgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct txgbe_hw_stats *hw_stats = TXGBE_DEV_STATS(dev); struct txgbe_stat_mappings *stat_mappings = TXGBE_DEV_STAT_MAPPINGS(dev); + struct txgbe_tx_queue *txq; uint32_t i, j; txgbe_read_stats_registers(hw, hw_stats); @@ -2398,6 +2399,11 @@ txgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* Tx Errors */ stats->oerrors = 0; + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + stats->oerrors += txq->desc_error; + } + return 0; } @@ -2406,6 +2412,13 @@ txgbe_dev_stats_reset(struct rte_eth_dev *dev) { struct txgbe_hw *hw = TXGBE_DEV_HW(dev); struct txgbe_hw_stats *hw_stats = TXGBE_DEV_STATS(dev); + struct txgbe_tx_queue *txq; + uint32_t i; + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + txq->desc_error = 0; + } /* HW registers are cleared on read */ hw->offset_loaded = 0; diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index 06acbd0881..4e4b78fb43 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -894,6 +894,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_pkt = *tx_pkts++; if (txgbe_check_pkt_err(tx_pkt)) { rte_pktmbuf_free(tx_pkt); + txq->desc_error++; continue; } @@ -2523,6 +2524,7 @@ txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, txgbe_set_tx_function(dev, txq); txq->ops->reset(txq); + txq->desc_error = 0; dev->data->tx_queues[queue_idx] = txq; @@ -4980,6 +4982,10 @@ txgbe_tx_queue_clear_error(void *param) if (!txq->resetting) continue; + /* Increase the count of Tx desc error since + * it causes the queue reset. + */ + txq->desc_error++; txgbe_dev_save_tx_queue(hw, i); /* tx ring reset */ diff --git a/drivers/net/txgbe/txgbe_rxtx.h b/drivers/net/txgbe/txgbe_rxtx.h index e668b60b1e..622a0d3981 100644 --- a/drivers/net/txgbe/txgbe_rxtx.h +++ b/drivers/net/txgbe/txgbe_rxtx.h @@ -412,6 +412,7 @@ struct txgbe_tx_queue { /**< indicates that IPsec TX feature is in use */ #endif const struct rte_memzone *mz; + uint64_t desc_error; bool resetting; }; -- 2.27.0