DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, xiao.w.wang@intel.com, jingjing.wu@intel.com,
	beilei.xing@intel.com, jia.guo@intel.com, qiming.yang@intel.com,
	haiyue.wang@intel.com, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/8] ether: refine debug compile option
Date: Fri, 12 Mar 2021 20:12:16 +0800	[thread overview]
Message-ID: <20210312121223.2028029-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20210312121223.2028029-1-qi.z.zhang@intel.com>

PMDs use RTE_LIBRTE_<PMD_NAME>_DEBUG_RX|TX as compile option to wrap
data path debug code. As .config has been removed since the meson build,
It is not friendly for new DPDK users to notice those debug options.

The patch introduces below compile options for specific Rx/Tx data path
debug, so PMD can choose to reuse them to avoid maintain their own.

- RTE_LIBRTE_ETHDEV_DEBUG_RX
- RTE_LIBRTE_ETHDEV_DEBUG_TX

Also, all the compile options are documented on the overview page, so
users can easily find them.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/nics/overview.rst   | 20 ++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h | 16 ++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index 20cd52b097..20cf54ef32 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -32,3 +32,23 @@ More details about features can be found in :doc:`features`.
 
    Features marked with "P" are partially supported. Refer to the appropriate
    NIC guide in the following sections for details.
+
+The ethdev layer support below compile options for debug purpose:
+
+- ``RTE_LIBRTE_ETHDEV_DEBUG`` (default **disabled**)
+
+  Compile with debug code on data path.
+
+- ``RTE_LIBRTE_ETHDEV_DEBUG_RX`` (default **disabled**)
+
+  Compile with debug code on Rx data path.
+
+- ``RTE_LIBRTE_ETHDEV_DEBUG_TX`` (default **disabled**)
+
+  Compile with debug code on Tx data path.
+
+.. Note::
+
+   The lib_ethdev use above options to wrap debug code to trace invalid parameters on
+   data path APIs, so performance downgrade is expected when enable those options.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 059a061072..e4352c0c32 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4877,7 +4877,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 	uint16_t nb_rx;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_RX)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 
@@ -5011,11 +5011,11 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 	struct rte_eth_dev *dev;
 	void *rxq;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_RX)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 #endif
 	dev = &rte_eth_devices[port_id];
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_RX)
 	if (queue_id >= dev->data->nb_rx_queues)
 		return -ENODEV;
 #endif
@@ -5068,11 +5068,11 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 	struct rte_eth_dev *dev;
 	void *txq;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_TX)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 #endif
 	dev = &rte_eth_devices[port_id];
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_TX)
 	if (queue_id >= dev->data->nb_tx_queues)
 		return -ENODEV;
 #endif
@@ -5154,7 +5154,7 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_TX)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 
@@ -5252,7 +5252,7 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_TX)
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
 		rte_errno = ENODEV;
@@ -5262,7 +5262,7 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
 
 	dev = &rte_eth_devices[port_id];
 
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || defined(RTE_LIBRTE_ETHDEV_DEBUG_TX)
 	if (queue_id >= dev->data->nb_tx_queues) {
 		RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
 		rte_errno = EINVAL;
-- 
2.26.2


  reply	other threads:[~2021-03-12 12:08 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 12:16 [dpdk-dev] [PATCH 0/8] " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 1/8] " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 2/8] net/fm10k: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 3/8] net/e1000: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 4/8] net/i40e: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 5/8] net/iavf: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 6/8] net/ice: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 7/8] net/ixgbe: " Qi Zhang
2021-03-10 12:16 ` [dpdk-dev] [PATCH 8/8] net/igc: " Qi Zhang
2021-03-10 12:35 ` [dpdk-dev] [PATCH 0/8] ether: " Ferruh Yigit
2021-03-12 12:12 ` [dpdk-dev] [PATCH v2 " Qi Zhang
2021-03-12 12:12   ` Qi Zhang [this message]
2021-03-16 13:05     ` [dpdk-dev] [PATCH v2 1/8] " Ferruh Yigit
2021-03-16 13:39       ` Thomas Monjalon
2021-03-16 14:12         ` Bruce Richardson
2021-03-16 23:29           ` Zhang, Qi Z
2021-03-16 16:37         ` Ferruh Yigit
2021-03-22 17:24           ` Ferruh Yigit
2021-03-23  8:43             ` Zhang, Qi Z
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 2/8] net/fm10k: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 3/8] net/e1000: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 4/8] net/i40e: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 5/8] net/iavf: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 6/8] net/ice: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 7/8] net/ixgbe: " Qi Zhang
2021-03-12 12:12   ` [dpdk-dev] [PATCH v2 8/8] net/igc: " Qi Zhang
2021-03-17 11:15 ` [dpdk-dev] [PATCH v3 0/9] ether: refine debug build option Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 1/9] " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 2/9] net: replace " Qi Zhang
2021-03-17 21:47     ` Ferruh Yigit
2021-03-17 22:00       ` Thomas Monjalon
2021-03-18  0:58         ` Zhang, Qi Z
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 3/9] net/fm10k: refine debug " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 4/9] net/e1000: " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 5/9] net/i40e: " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 6/9] net/iavf: " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 7/9] net/ice: " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 8/9] net/ixgbe: " Qi Zhang
2021-03-17 11:15   ` [dpdk-dev] [PATCH v3 9/9] net/igc: " Qi Zhang
2021-03-18  1:42 ` [dpdk-dev] [PATCH v4 0/8] ether: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 1/8] " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 2/8] net/fm10k: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 3/8] net/e1000: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 4/8] net/i40e: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 5/8] net/iavf: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 6/8] net/ice: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 7/8] net/ixgbe: " Qi Zhang
2021-03-18  1:42   ` [dpdk-dev] [PATCH v4 8/8] net/igc: " Qi Zhang
2021-03-23 11:07 ` [dpdk-dev] [PATCH v5 0/8] ether: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 1/8] " Qi Zhang
2021-03-23 14:44     ` Ferruh Yigit
2021-03-23 21:14     ` Thomas Monjalon
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 2/8] net/fm10k: " Qi Zhang
2021-03-23 14:45     ` Ferruh Yigit
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 3/8] net/e1000: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 4/8] net/i40e: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 5/8] net/iavf: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 6/8] net/ice: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 7/8] net/ixgbe: " Qi Zhang
2021-03-23 11:07   ` [dpdk-dev] [PATCH v5 8/8] net/igc: " Qi Zhang
2021-03-24 19:27     ` Ferruh Yigit
2021-03-24 20:31       ` David Marchand
2021-03-25 15:43         ` Ferruh Yigit
2021-03-30 14:06           ` Ferruh Yigit
2021-03-23 11:08   ` [dpdk-dev] [PATCH v5 0/8] ether: " Zhang, Qi Z
2021-03-23 14:47   ` Ferruh Yigit
2021-03-31  9:52 ` [dpdk-dev] [PATCH v6 " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 1/8] " Qi Zhang
2021-04-01 14:30     ` Ferruh Yigit
2021-05-05 11:45       ` Ferruh Yigit
2021-05-05 12:21         ` Michał Krawczyk
2021-05-05 14:38           ` Ferruh Yigit
2021-05-06 11:09             ` [dpdk-dev] [EXT] " Rasesh Mody
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 2/8] net/fm10k: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 3/8] net/e1000: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 4/8] net/i40e: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 5/8] net/iavf: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 6/8] net/ice: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 7/8] net/ixgbe: " Qi Zhang
2021-03-31  9:52   ` [dpdk-dev] [PATCH v6 8/8] net/igc: " Qi Zhang
2021-04-01 14:11   ` [dpdk-dev] [PATCH v6 0/8] ether: " Ferruh Yigit

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=20210312121223.2028029-2-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=haiyue.wang@intel.com \
    --cc=jia.guo@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=xiao.w.wang@intel.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).