patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Dongdong Liu <liudongdong3@huawei.com>
To: <dev@dpdk.org>, <ferruh.yigit@amd.com>, <thomas@monjalon.net>,
	<andrew.rybchenko@oktetlabs.ru>, <fengchengwen@huawei.com>
Cc: <stable@dpdk.org>, <lihuisong@huawei.com>,
	<liudongdong3@huawei.com>, <yisen.zhuang@huawei.com>,
	<huangdengdui@huawei.com>
Subject: [PATCH v2 5/5] net/hns3: add Tx/Rx descriptor logs
Date: Mon, 22 May 2023 21:17:40 +0800	[thread overview]
Message-ID: <20230522131740.30043-6-liudongdong3@huawei.com> (raw)
In-Reply-To: <20230522131740.30043-1-liudongdong3@huawei.com>

From: Dengdui Huang <huangdengdui@huawei.com>

Add Tx/Rx descriptor logs, controlled by 'RTE_ETHDEV_DEBUG_RX/TX'
compile time flag with 'pmd.net.hns3.rx/tx' log type.

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c |  6 ++++++
 drivers/net/hns3/hns3_logs.h   | 18 ++++++++++++++++++
 drivers/net/hns3/hns3_rxtx.c   |  4 ++++
 drivers/net/hns3/hns3_rxtx.h   | 29 +++++++++++++++++++++++++++++
 4 files changed, 57 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 664226a6ef..07d907d6a1 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -6625,3 +6625,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_hns3,
 		HNS3_DEVARG_MBX_TIME_LIMIT_MS "=<uint16> ");
 RTE_LOG_REGISTER_SUFFIX(hns3_logtype_init, init, NOTICE);
 RTE_LOG_REGISTER_SUFFIX(hns3_logtype_driver, driver, NOTICE);
+#ifdef RTE_ETHDEV_DEBUG_RX
+RTE_LOG_REGISTER_SUFFIX(hns3_logtype_rx, rx, DEBUG);
+#endif
+#ifdef RTE_ETHDEV_DEBUG_TX
+RTE_LOG_REGISTER_SUFFIX(hns3_logtype_tx, tx, DEBUG);
+#endif
diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h
index c880f752ab..47d3a13220 100644
--- a/drivers/net/hns3/hns3_logs.h
+++ b/drivers/net/hns3/hns3_logs.h
@@ -31,4 +31,22 @@ extern int hns3_logtype_driver;
 #define hns3_dbg(hw, fmt, args...) \
 	PMD_DRV_LOG_RAW(hw, RTE_LOG_DEBUG, fmt "\n", ## args)
 
+#ifdef RTE_ETHDEV_DEBUG_RX
+extern int hns3_logtype_rx;
+#define PMD_RX_LOG(hw, level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, hns3_logtype_rx,	"%s %s(): " fmt "\n", \
+		(hw)->data->name, __func__, ## args)
+#else
+#define PMD_RX_LOG(hw, level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_ETHDEV_DEBUG_TX
+extern int hns3_logtype_tx;
+#define PMD_TX_LOG(hw, level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, hns3_logtype_tx,	"%s %s(): " fmt "\n", \
+		(hw)->data->name, __func__, ## args)
+#else
+#define PMD_TX_LOG(hw, level, fmt, args...) do { } while (0)
+#endif
+
 #endif /* HNS3_LOGS_H */
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 8c3355bbde..6468da903e 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2618,6 +2618,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
 		 */
 		rxd = rxdp[(bd_base_info & (1u << HNS3_RXD_VLD_B)) -
 			   (1u << HNS3_RXD_VLD_B)];
+		RX_BD_LOG(&rxq->hns->hw, DEBUG, &rxd);
 
 		nmb = hns3_rx_alloc_buffer(rxq);
 		if (unlikely(nmb == NULL)) {
@@ -4274,6 +4275,8 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				tx_next_use = 0;
 				tx_bak_pkt = txq->sw_ring;
 			}
+			if (m_seg != NULL)
+				TX_BD_LOG(&txq->hns->hw, DEBUG, desc);
 
 			i++;
 		} while (m_seg != NULL);
@@ -4281,6 +4284,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		/* Add end flag for the last Tx Buffer Descriptor */
 		desc->tx.tp_fe_sc_vld_ra_ri |=
 				 rte_cpu_to_le_16(BIT(HNS3_TXD_FE_B));
+		TX_BD_LOG(&txq->hns->hw, DEBUG, desc);
 
 		/* Increment bytes counter */
 		txq->basic_stats.bytes += tx_pkt->pkt_len;
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 7685ac2ea3..b6a6513307 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -553,6 +553,35 @@ struct hns3_tx_queue {
 	bool enabled;           /* indicate if Tx queue has been enabled */
 };
 
+#define RX_BD_LOG(hw, level, rxdp) \
+	PMD_RX_LOG(hw, level, "Rx descriptor: " \
+		"l234_info=%#x pkt_len=%u size=%u rss_hash=%#x fd_id=%u vlan_tag=%u " \
+		"o_dm_vlan_id_fb=%#x ot_vlan_tag=%u bd_base_info=%#x", \
+		rte_le_to_cpu_32((rxdp)->rx.l234_info), \
+		rte_le_to_cpu_16((rxdp)->rx.pkt_len), \
+		rte_le_to_cpu_16((rxdp)->rx.size), \
+		rte_le_to_cpu_32((rxdp)->rx.rss_hash), \
+		rte_le_to_cpu_16((rxdp)->rx.fd_id), \
+		rte_le_to_cpu_16((rxdp)->rx.vlan_tag), \
+		rte_le_to_cpu_16((rxdp)->rx.o_dm_vlan_id_fb), \
+		rte_le_to_cpu_16((rxdp)->rx.ot_vlan_tag), \
+		rte_le_to_cpu_32((rxdp)->rx.bd_base_info))
+
+#define TX_BD_LOG(hw, level, txdp) \
+	PMD_TX_LOG(hw, level, "Tx descriptor: " \
+		"vlan_tag=%u send_size=%u type_cs_vlan_tso_len=%#x outer_vlan_tag=%u " \
+		"tv=%#x ol_type_vlan_len_msec=%#x paylen_fd_dop_ol4cs=%#x " \
+		"tp_fe_sc_vld_ra_ri=%#x ckst_mss=%u", \
+		rte_le_to_cpu_16((txdp)->tx.vlan_tag), \
+		rte_le_to_cpu_16((txdp)->tx.send_size), \
+		rte_le_to_cpu_32((txdp)->tx.type_cs_vlan_tso_len), \
+		rte_le_to_cpu_16((txdp)->tx.outer_vlan_tag), \
+		rte_le_to_cpu_16((txdp)->tx.tv), \
+		rte_le_to_cpu_32((txdp)->tx.ol_type_vlan_len_msec), \
+		rte_le_to_cpu_32((txdp)->tx.paylen_fd_dop_ol4cs), \
+		rte_le_to_cpu_16((txdp)->tx.tp_fe_sc_vld_ra_ri), \
+		rte_le_to_cpu_16((txdp)->tx.ckst_mss))
+
 #define HNS3_GET_TX_QUEUE_PEND_BD_NUM(txq) \
 		((txq)->nb_tx_desc - 1 - (txq)->tx_bd_ready)
 
-- 
2.22.0


  parent reply	other threads:[~2023-05-22 13:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 11:29 [PATCH 0/5] ] net/hns3: add some features and bugfixes Dongdong Liu
2023-05-18 11:29 ` [PATCH 1/5] net/hns3: fix never set MAC flow control Dongdong Liu
2023-05-18 11:29 ` [PATCH 2/5] net/hns3: add flow control autoneg for fiber and backplane port Dongdong Liu
2023-05-18 11:29 ` [PATCH 3/5] net/hns3: fix loop code variable type mismatch Dongdong Liu
2023-05-18 11:29 ` [PATCH 4/5] net/hns3: fix receive multiple firmware reset interrupts Dongdong Liu
2023-05-18 11:29 ` [PATCH 5/5] net/hns3: add Tx/Rx descriptor logs Dongdong Liu
2023-05-22 11:57 ` [PATCH 0/5] ] net/hns3: add some features and bugfixes Ferruh Yigit
2023-05-22 12:13   ` Dongdong Liu
2023-05-22 13:17 ` [PATCH v2 0/5] " Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 1/5] net/hns3: fix never set MAC flow control Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 2/5] net/hns3: add flow control autoneg for fiber port Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 3/5] net/hns3: fix loop code variable type mismatch Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 4/5] net/hns3: fix receive multiple firmware reset interrupts Dongdong Liu
2023-05-22 13:17   ` Dongdong Liu [this message]
2023-05-22 16:15   ` [PATCH v2 0/5] net/hns3: add some features and bugfixes Ferruh Yigit
2023-06-01 10:30     ` Ferruh Yigit
2023-06-01 11:37       ` Dongdong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230522131740.30043-6-liudongdong3@huawei.com \
    --to=liudongdong3@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=huangdengdui@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).