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 A5EC745C2A; Mon, 4 Nov 2024 03:07:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DC8A40B9B; Mon, 4 Nov 2024 03:07:15 +0100 (CET) Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) by mails.dpdk.org (Postfix) with ESMTP id 66ADB40B8C for ; Mon, 4 Nov 2024 03:07:12 +0100 (CET) X-QQ-mid: bizesmtp91t1730686030ts32ie2v X-QQ-Originating-IP: A6wV01IvnRzxFvU7QCRgRZaRMLCvH/2DjPYCcFggjXQ= Received: from wxdbg.localdomain.com ( [60.186.23.108]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 04 Nov 2024 10:07:09 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 2134030159480825671 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Subject: [PATCH v3 09/13] net/ngbe: add Tx descriptor error statistics Date: Mon, 4 Nov 2024 10:30:03 +0800 Message-Id: <20241104023007.782475-10-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: NKv2G1wnhDBnpJadz4t8rTaccL3xnyJNDPYfjSIew0OTuya8Dls/pjxY 3av5sBsapttYi8Rf51B+UiXYWSdoAuaFALJq8VvZHu9WD+e/fX9sXs58oTEN/VpB8+um4wk gGh+XWvD7YS2h0Ab1x/l4M7POOKTIoLgWeoG27LZbkYVZHoBBO91dnPIwxR/ubDaGv9VRcr EA5b6nL2eeWUUtRgncEJBj/d3bZ5b4/QHxeGjiI2N8CIt49ltY2UmsP6GOWa7fKffpBJMXj nis5eEo7jQ0T2BpizgCfwVuginwMSvgKBoD9coWVcUZ6pXowk6H+QJYTW0hz72uVgjc6iPQ F0Xfsb+MBL5p9Vknwo1mOcVyI/s8mVnUk13jJ3vrluNa4sKVGwqmce6Fz8vJOH2/5+/irf1 p9nb2KN+x3xPwGUURl5LskZ8nyu5ia6Aq/67A7Y3tpSocelYmFeDuD1L01+ZkcTTgDJ0+4M TdJVeG61uosMmAAohqGFb8S2wHHJILoIw6+rPOh4+0GGFOMXx3HyXeJ9TVyA9fjOvv6qLE0 MXHqhjAbdbmbnTSci0MR4B+1geWMI32ueLrnX67t1tFtOq0gCwOOqRcYGfcez3oGzHsX5eO hTBrSfAOXFSf810BqJAattQvqWIH5G7c972Yhoehp1XbXnSfBRreHWKbHS8c7zAM+LehtyZ VpaOQa5yoPzhimkXFntxmcedNUpjdPcA+1MpyuO7RLffM/C3DmxswDEXv8KuGaFHtw9B5cv /7Rjrn0GLrN5PM1bLxRyPpbmHY/r7IUmYamZvYR/EOhl/to6eAoxbgiG8/GEc6w/TvmBlrx 0T7GOtyyn12A9lYpcd6twVrxWy83FUMCNgGF7yG1nKZEGgEKMRiDj7LmmQgbfOArNSxfmuu B+ObmbCC7kW9D1XhfBvE3etfuRgIJwjAq61T5eK+RqSk2p+Iqu/QA5vWt9dWoVFyW3xO9iO g3QpQz+WG0VVIrGSElDSXU93PcxtzfWAAlST3ID25lvIA1g== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= 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/ngbe/ngbe_ethdev.c | 13 +++++++++++++ drivers/net/ngbe/ngbe_rxtx.c | 2 ++ drivers/net/ngbe/ngbe_rxtx.h | 1 + 3 files changed, 16 insertions(+) diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index 6c45ffaad3..353d17acc8 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -1507,6 +1507,7 @@ ngbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev); struct ngbe_stat_mappings *stat_mappings = NGBE_DEV_STAT_MAPPINGS(dev); + struct ngbe_tx_queue *txq; uint32_t i, j; ngbe_read_stats_registers(hw, hw_stats); @@ -1559,6 +1560,11 @@ ngbe_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; } @@ -1567,6 +1573,13 @@ ngbe_dev_stats_reset(struct rte_eth_dev *dev) { struct ngbe_hw *hw = ngbe_dev_hw(dev); struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev); + struct ngbe_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/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c index 25a314f10a..8d31d47de9 100644 --- a/drivers/net/ngbe/ngbe_rxtx.c +++ b/drivers/net/ngbe/ngbe_rxtx.c @@ -629,6 +629,7 @@ ngbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_pkt = *tx_pkts++; if (ngbe_check_pkt_err(tx_pkt)) { rte_pktmbuf_free(tx_pkt); + txq->desc_error++; continue; } @@ -2100,6 +2101,7 @@ ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev, ngbe_set_tx_function(dev, txq); txq->ops->reset(txq); + txq->desc_error = 0; dev->data->tx_queues[queue_idx] = txq; diff --git a/drivers/net/ngbe/ngbe_rxtx.h b/drivers/net/ngbe/ngbe_rxtx.h index 7574db32d8..8534ec123a 100644 --- a/drivers/net/ngbe/ngbe_rxtx.h +++ b/drivers/net/ngbe/ngbe_rxtx.h @@ -375,6 +375,7 @@ struct ngbe_tx_queue { const struct ngbe_txq_ops *ops; /**< txq ops */ const struct rte_memzone *mz; + uint64_t desc_error; }; struct ngbe_txq_ops { -- 2.27.0