DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Declan Doherty <declan.doherty@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public
Date: Tue, 10 Nov 2015 10:32:26 +0000	[thread overview]
Message-ID: <20151110103226.GB29836@bricha3-MOBL3> (raw)
In-Reply-To: <1447101259-18972-3-git-send-email-declan.doherty@intel.com>

On Mon, Nov 09, 2015 at 08:34:11PM +0000, Declan Doherty wrote:
> Move the function pointer and port id checking macros to rte_ethdev and
> rte_dev header files, so that they can be used in the static inline
> functions there. Also replace the RTE_LOG call within
> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>

Thanks, Declan. I'll rebase my other patchset that was very similar to this on
top of this patch and your previous one.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  lib/librte_eal/common/include/rte_dev.h | 52 +++++++++++++++++++++++++++++++
>  lib/librte_ether/rte_ethdev.c           | 54 ---------------------------------
>  lib/librte_ether/rte_ethdev.h           | 26 ++++++++++++++++
>  3 files changed, 78 insertions(+), 54 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index f601d21..fd09b3d 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -46,8 +46,60 @@
>  extern "C" {
>  #endif
>  
> +#include <stdio.h>
>  #include <sys/queue.h>
>  
> +#include <rte_log.h>
> +
> +__attribute__((format(printf, 2, 0)))
> +static inline void
> +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
> +{
> +	va_list ap;
> +
> +	va_start(ap, fmt);
> +	char buffer[vsnprintf(NULL, 0, fmt, ap)];
> +
> +	va_end(ap);
> +
> +	va_start(ap, fmt);
> +	vsnprintf(buffer, sizeof(buffer), fmt, ap);
> +	va_end(ap);
> +
> +	rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
> +}
> +
> +/* Macros for checking for restricting functions to primary instance only */
> +#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> +		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> +		return retval; \
> +	} \
> +} while (0)
> +
> +#define RTE_PROC_PRIMARY_OR_RET() do { \
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> +		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> +		return; \
> +	} \
> +} while (0)
> +
> +/* Macros to check for invalid function pointers */
> +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> +	if ((func) == NULL) { \
> +		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> +		return retval; \
> +	} \
> +} while (0)
> +
> +#define RTE_FUNC_PTR_OR_RET(func) do { \
> +	if ((func) == NULL) { \
> +		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> +		return; \
> +	} \
> +} while (0)
> +
> +
>  /** Double linked list of device drivers. */
>  TAILQ_HEAD(rte_driver_list, rte_driver);
>  
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 7387f65..d3c8aba 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -69,60 +69,6 @@
>  #include "rte_ether.h"
>  #include "rte_ethdev.h"
>  
> -#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...) do {do { \
> -		RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
> -	} while (0)
> -#else
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> -#endif
> -
> -/* Macros for checking for restricting functions to primary instance only */
> -#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> -	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> -		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> -		return (retval); \
> -	} \
> -} while (0)
> -
> -#define RTE_PROC_PRIMARY_OR_RET() do { \
> -	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> -		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> -		return; \
> -	} \
> -} while (0)
> -
> -/* Macros to check for invalid function pointers in dev_ops structure */
> -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> -	if ((func) == NULL) { \
> -		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> -		return (retval); \
> -	} \
> -} while (0)
> -
> -#define RTE_FUNC_PTR_OR_RET(func) do { \
> -	if ((func) == NULL) { \
> -		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> -		return; \
> -	} \
> -} while (0)
> -
> -/* Macros to check for valid port */
> -#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
> -	if (!rte_eth_dev_is_valid_port(port_id)) {  \
> -		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> -		return retval; \
> -	} \
> -} while (0)
> -
> -#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
> -	if (!rte_eth_dev_is_valid_port(port_id)) { \
> -		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> -		return; \
> -	} \
> -} while (0)
> -
> -
>  static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
>  struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
>  static struct rte_eth_dev_data *rte_eth_dev_data;
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 48a540d..9b07a0b 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -172,6 +172,8 @@ extern "C" {
>  
>  #include <stdint.h>
>  
> +#include <rte_dev.h>
> +
>  /* Use this macro to check if LRO API is supported */
>  #define RTE_ETHDEV_HAS_LRO_SUPPORT
>  
> @@ -931,6 +933,30 @@ struct rte_eth_dev_callback;
>  /** @internal Structure to keep track of registered callbacks */
>  TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
>  
> +
> +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> +#define RTE_PMD_DEBUG_TRACE(...) \
> +	rte_pmd_debug_trace(__func__, __VA_ARGS__)
> +#else
> +#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> +#endif
> +
> +
> +/* Macros to check for valid port */
> +#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
> +	if (!rte_eth_dev_is_valid_port(port_id)) { \
> +		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> +		return retval; \
> +	} \
> +} while (0)
> +
> +#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
> +	if (!rte_eth_dev_is_valid_port(port_id)) { \
> +		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> +		return; \
> +	} \
> +} while (0)
> +
>  /*
>   * Definitions of all functions exported by an Ethernet driver through the
>   * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
> -- 
> 2.4.3
> 

  reply	other threads:[~2015-11-10 10:32 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 23:01 [dpdk-dev] [PATCH 0/6] Crypto API and device framework Declan Doherty
2015-10-02 23:01 ` [dpdk-dev] [PATCH 1/6] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-10-21  9:24   ` Thomas Monjalon
2015-10-21 11:16     ` Declan Doherty
2015-10-02 23:01 ` [dpdk-dev] [PATCH 2/6] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-10-02 23:01 ` [dpdk-dev] [PATCH 3/6] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-10-02 23:01 ` [dpdk-dev] [PATCH 4/6] docs: add getting started guides for multi-buffer pmd and qat pmd Declan Doherty
2015-10-21 11:34   ` Thomas Monjalon
2015-10-02 23:01 ` [dpdk-dev] [PATCH 5/6] app/test: add cryptodev unit and performance tests Declan Doherty
2015-10-02 23:01 ` [dpdk-dev] [PATCH 6/6] l2fwd-crypto: crypto Declan Doherty
2015-10-21  9:11 ` [dpdk-dev] [PATCH 0/6] Crypto API and device framework Declan Doherty
2015-10-30 12:59 ` [dpdk-dev] [PATCH v2 " Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 1/6] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 2/6] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 3/6] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 4/6] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 5/6] app/test: add cryptodev unit and performance tests Declan Doherty
2015-10-30 12:59   ` [dpdk-dev] [PATCH v2 6/6] l2fwd-crypto: crypto Declan Doherty
2015-10-30 16:08   ` [dpdk-dev] [PATCH v3 0/6] Crypto API and device framework Declan Doherty
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 1/6] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 2/6] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-10-30 16:34       ` Ananyev, Konstantin
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 3/6] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 4/6] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 5/6] app/test: add cryptodev unit and performance tests Declan Doherty
2015-10-30 16:08     ` [dpdk-dev] [PATCH v3 6/6] l2fwd-crypto: crypto Declan Doherty
2015-11-03 17:45     ` [dpdk-dev] [PATCH v4 0/6] Crypto API and device framework Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 1/6] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 2/6] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 3/6] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 4/6] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 5/6] app/test: add cryptodev unit and performance tests Declan Doherty
2015-11-03 17:45       ` [dpdk-dev] [PATCH v4 6/6] l2fwd-crypto: crypto Declan Doherty
2015-11-03 21:20       ` [dpdk-dev] [PATCH v4 0/6] Crypto API and device framework Sergio Gonzalez Monroy
2015-11-09 20:34       ` [dpdk-dev] [PATCH v5 00/10] " Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 01/10] ethdev: rename macros to have RTE_ prefix Declan Doherty
2015-11-10 10:30           ` Bruce Richardson
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public Declan Doherty
2015-11-10 10:32           ` Bruce Richardson [this message]
2015-11-10 15:50           ` Adrien Mazarguil
2015-11-10 17:00             ` Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 03/10] eal: add __rte_packed /__rte_aligned macros Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 04/10] mbuf: add new marcos to get the physical address of data Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 06/10] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 09/10] app/test: add cryptodev unit and performance tests Declan Doherty
2015-11-09 20:34         ` [dpdk-dev] [PATCH v5 10/10] l2fwd-crypto: crypto Declan Doherty
2015-11-10 17:32         ` [dpdk-dev] [PATCH v6 00/10] Crypto API and device framework Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 01/10] ethdev: rename macros to have RTE_ prefix Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 02/10] ethdev: make error checking macros public Declan Doherty
2015-11-10 17:38             ` Adrien Mazarguil
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 03/10] eal: add __rte_packed /__rte_aligned macros Declan Doherty
2015-11-13 15:35             ` Thomas Monjalon
2015-11-13 15:41               ` Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 04/10] mbuf: add new marcos to get the physical address of data Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-11-13 15:44             ` Thomas Monjalon
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 06/10] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-11-13 15:59             ` Thomas Monjalon
2015-11-13 16:11             ` Thomas Monjalon
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-11-13 16:00             ` Thomas Monjalon
2015-11-13 16:25               ` Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 09/10] app/test: add cryptodev unit and performance tests Declan Doherty
2015-11-10 17:32           ` [dpdk-dev] [PATCH v6 10/10] l2fwd-crypto: crypto Declan Doherty
2015-11-13 16:03             ` Thomas Monjalon
2015-11-13 18:58           ` [dpdk-dev] [PATCH v7 00/10] Crypto API and device framework Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 01/10] ethdev: rename macros to have RTE_ prefix Declan Doherty
2015-11-17 14:44               ` Declan Doherty
2015-11-17 15:39                 ` Thomas Monjalon
2015-11-17 16:04               ` [dpdk-dev] [PATCH v7.1 " Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 02/10] ethdev: make error checking macros public Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 03/10] eal: add __rte_packed /__rte_aligned macros Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 04/10] mbuf: add new marcos to get the physical address of data Declan Doherty
2015-11-25  0:25               ` Thomas Monjalon
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-11-25  0:32               ` Thomas Monjalon
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-11-20 15:27               ` Olivier MATZ
2015-11-20 17:26                 ` Declan Doherty
2015-11-23  9:10                   ` Olivier MATZ
2015-11-23 11:52                     ` Ananyev, Konstantin
2015-11-23 12:16                       ` Declan Doherty
2015-11-23 13:08                         ` Olivier MATZ
2015-11-23 14:17                           ` Thomas Monjalon
2015-11-23 14:46                             ` Thomas Monjalon
2015-11-23 15:47                               ` Declan Doherty
2015-11-23 14:33                           ` Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-11-25  1:00               ` Thomas Monjalon
2015-11-25  9:16                 ` Mcnamara, John
2015-11-25 10:34               ` Thomas Monjalon
2015-11-25 10:49                 ` Thomas Monjalon
2015-11-25 10:59                   ` Declan Doherty
2015-11-25 12:01               ` Mcnamara, John
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-11-25 10:32               ` Thomas Monjalon
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 09/10] app/test: add cryptodev unit and performance tests Declan Doherty
2015-11-13 18:58             ` [dpdk-dev] [PATCH v7 10/10] l2fwd-crypto: crypto Declan Doherty
2015-11-25  1:03               ` Thomas Monjalon
2015-11-25 13:25             ` [dpdk-dev] [PATCH v8 00/10] Crypto API and device framework Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 01/10] ethdev: rename macros to have RTE_ prefix Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 02/10] ethdev: make error checking macros public Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 03/10] eal: add __rte_packed /__rte_aligned macros Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 04/10] mbuf: add new marcos to get the physical address of data Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 06/10] mbuf_offload: library to support attaching offloads to a mbuf Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 09/10] app/test: add cryptodev unit and performance tests Declan Doherty
2015-11-25 13:25               ` [dpdk-dev] [PATCH v8 10/10] l2fwd-crypto: crypto Declan Doherty
2015-11-25 17:44               ` [dpdk-dev] [PATCH v8 00/10] Crypto API and device framework Thomas Monjalon

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=20151110103226.GB29836@bricha3-MOBL3 \
    --to=bruce.richardson@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    /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).