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 7D8E3A0561; Thu, 18 Mar 2021 02:39:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0724A140FDA; Thu, 18 Mar 2021 02:38:58 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 84449140FD9 for ; Thu, 18 Mar 2021 02:38:56 +0100 (CET) IronPort-SDR: /nlMbpwa2q6EnDlrF0Dfsqs350ggWg1JVO5YYgMjpiN8QhGJ52DCpPTsORWUYjQ4QJTFBPImJn L86SWCcZld3Q== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="253591029" X-IronPort-AV: E=Sophos;i="5.81,257,1610438400"; d="scan'208";a="253591029" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 18:38:55 -0700 IronPort-SDR: jLnh1/dbS1+gGULaFlXqOOdzHz46xpDZ2u9gloWS46zZfgKLvpPXwSxCIfWFXRhdKb5rJ1PuLr Ribb4gUet3MA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,257,1610438400"; d="scan'208";a="602471423" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga006.fm.intel.com with ESMTP; 17 Mar 2021 18:38:51 -0700 From: Qi Zhang To: ferruh.yigit@intel.com Cc: dev@dpdk.org, thomas@monjalon.net, bruce.richardson@intel.com, 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 Date: Thu, 18 Mar 2021 09:42:27 +0800 Message-Id: <20210318014234.2255366-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210318014234.2255366-1-qi.z.zhang@intel.com> References: <20210310121626.2019863-1-qi.z.zhang@intel.com> <20210318014234.2255366-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 1/8] ether: refine debug build option 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 Sender: "dev" PMDs use RTE_LIBRTE__DEBUG_RX|TX as build 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 build options for data path debug, so PMD can choose to reuse them to avoid maintain their own. - RTE_ETHDEV_DEBUG - RTE_ETHDEV_DEBUG_RX - RTE_ETHDEV_DEBUG_TX All the build options are documented at programming guide "3.1 Driver Option", so users can easily find them. The original undocumented RTE_LIBRTE_ETHDEV_DEBUG will alias to RTE_ETHDEV_DEBUG for backward compatibility. Signed-off-by: Qi Zhang --- doc/guides/nics/build_and_test.rst | 20 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 21 +++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/build_and_test.rst b/doc/guides/nics/build_and_test.rst index e83dd4628c..4d7f10f6b0 100644 --- a/doc/guides/nics/build_and_test.rst +++ b/doc/guides/nics/build_and_test.rst @@ -26,6 +26,26 @@ This will also build testpmd. Detailed instructions are available in the :doc:`meson build guide <../prog_guide/build-sdk-meson>`. +The ethdev layer supports below compile options for debug purpose: + +- ``RTE_ETHDEV_DEBUG`` (default **disabled**) + + Build with debug code on Rx and Tx path. + +- ``RTE_ETHDEV_DEBUG_RX`` (default **disabled**) + + Build with debug code on Rx path. + +- ``RTE_ETHDEV_DEBUG_TX`` (default **disabled**) + + Build with debug code on Tx path. + +.. Note:: + + The ethdev library use above options to wrap debug code to trace invalid parameters + on data path APIs, so performance downgrade is expected when enabling those options. + Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path. + Running testpmd in Linux ------------------------ diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 059a061072..7a65d99ff4 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -148,6 +148,11 @@ extern "C" { /* Use this macro to check if LRO API is supported */ #define RTE_ETHDEV_HAS_LRO_SUPPORT +/* Alias RTE_LIBRTE_ETHDEV_DEBUG to RTE_ETHDEV_DEBUG for backward compatibility. */ +#ifdef RTE_LIBRTE_ETHDEV_DEBUG +#define RTE_ETHDEV_DEBUG +#endif + #include #include #include @@ -4877,7 +4882,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_ETHDEV_DEBUG) || defined(RTE_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 +5016,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_ETHDEV_DEBUG) || defined(RTE_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_ETHDEV_DEBUG) || defined(RTE_ETHDEV_DEBUG_RX) if (queue_id >= dev->data->nb_rx_queues) return -ENODEV; #endif @@ -5068,11 +5073,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_ETHDEV_DEBUG) || defined(RTE_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_ETHDEV_DEBUG) || defined(RTE_ETHDEV_DEBUG_TX) if (queue_id >= dev->data->nb_tx_queues) return -ENODEV; #endif @@ -5154,7 +5159,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_ETHDEV_DEBUG) || defined(RTE_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 +5257,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_ETHDEV_DEBUG) || defined(RTE_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 +5267,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_ETHDEV_DEBUG) || defined(RTE_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