* [dpdk-stable] [PATCH] eal: fix debug macro redefinition
@ 2017-05-18 9:40 Adrien Mazarguil
2017-05-18 14:59 ` Yuanhan Liu
0 siblings, 1 reply; 2+ messages in thread
From: Adrien Mazarguil @ 2017-05-18 9:40 UTC (permalink / raw)
To: stable
[ backported from upstream commit 37aa3a47a296dc17caca1f637afaf4d8f3a065bc ]
The RTE_FUNC_*_RET() and RTE_PROC_*_RET() macro definitions in rte_dev.h
require RTE_PMD_DEBUG_TRACE(). This macro is defined as needed by users of
rte_dev.h since its value depends on their own debug settings.
It may be defined multiple times as a result when including files from
various components simultaneously. Worse, these redefinitions may be
inconsistent. This causes the following compilation errors:
In file included from /tmp/check-includes.sh.13890.c:27:0:
build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
redefined [-Werror]
[...]
In file included from build/include/rte_ethdev_pci.h:39:0,
from /tmp/check-includes.sh.13890.c:13:
build/include/rte_ethdev.h:1042:0: note: this is the location of the
previous definition
[...]
In file included from /tmp/check-includes.sh.13890.c:83:0:
build/include/rte_cryptodev_pmd.h:65:0: error: "RTE_PMD_DEBUG_TRACE"
redefined [-Werror]
[...]
In file included from /tmp/check-includes.sh.13890.c:27:0:
build/include/rte_eventdev_pmd.h:58:0: note: this is the location of
the previous definition
[...]
This commit moves the RTE_PMD_DEBUG_TRACE() definition to rte_dev.h where
it is enabled consistently depending on global configuration settings and
removes redundant definitions.
Also when disabled, RTE_PMD_DEBUG_TRACE() is now defined as (void)0 to
avoid empty statements warnings if used outside { } blocks.
Fixes: b974e4a40cb5 ("ethdev: make error checking macros public")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev_pmd.h | 8 --------
lib/librte_eal/common/include/rte_dev.h | 14 ++++++++++++++
lib/librte_ether/rte_ethdev.h | 9 ---------
3 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c6a5794..e82dcf0 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -57,14 +57,6 @@ extern "C" {
#include "rte_crypto.h"
#include "rte_cryptodev.h"
-
-#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
- rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
struct rte_cryptodev_session {
RTE_STD_C11
struct {
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 8840380..dcf33d0 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -49,6 +49,7 @@ extern "C" {
#include <stdio.h>
#include <sys/queue.h>
+#include <rte_config.h>
#include <rte_log.h>
__attribute__((format(printf, 2, 0)))
@@ -70,6 +71,19 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
}
+/*
+ * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the
+ * RTE_*_RET() macros defined below is compiled in debug mode.
+ */
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || \
+ defined(RTE_LIBRTE_CRYPTODEV_DEBUG) || \
+ defined(RTE_LIBRTE_EVENTDEV_DEBUG)
+#define RTE_PMD_DEBUG_TRACE(...) \
+ rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(...) (void)0
+#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) { \
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..11ec1fa 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1001,15 +1001,6 @@ 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(...)
-#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)) { \
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-stable] [PATCH] eal: fix debug macro redefinition
2017-05-18 9:40 [dpdk-stable] [PATCH] eal: fix debug macro redefinition Adrien Mazarguil
@ 2017-05-18 14:59 ` Yuanhan Liu
0 siblings, 0 replies; 2+ messages in thread
From: Yuanhan Liu @ 2017-05-18 14:59 UTC (permalink / raw)
To: Adrien Mazarguil; +Cc: stable
On Thu, May 18, 2017 at 11:40:46AM +0200, Adrien Mazarguil wrote:
> [ backported from upstream commit 37aa3a47a296dc17caca1f637afaf4d8f3a065bc ]
Applied to dpdk-stable/16.11.
Thanks!
--yliu
>
> The RTE_FUNC_*_RET() and RTE_PROC_*_RET() macro definitions in rte_dev.h
> require RTE_PMD_DEBUG_TRACE(). This macro is defined as needed by users of
> rte_dev.h since its value depends on their own debug settings.
>
> It may be defined multiple times as a result when including files from
> various components simultaneously. Worse, these redefinitions may be
> inconsistent. This causes the following compilation errors:
>
> In file included from /tmp/check-includes.sh.13890.c:27:0:
> build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
> redefined [-Werror]
> [...]
> In file included from build/include/rte_ethdev_pci.h:39:0,
> from /tmp/check-includes.sh.13890.c:13:
> build/include/rte_ethdev.h:1042:0: note: this is the location of the
> previous definition
> [...]
> In file included from /tmp/check-includes.sh.13890.c:83:0:
> build/include/rte_cryptodev_pmd.h:65:0: error: "RTE_PMD_DEBUG_TRACE"
> redefined [-Werror]
> [...]
> In file included from /tmp/check-includes.sh.13890.c:27:0:
> build/include/rte_eventdev_pmd.h:58:0: note: this is the location of
> the previous definition
> [...]
>
> This commit moves the RTE_PMD_DEBUG_TRACE() definition to rte_dev.h where
> it is enabled consistently depending on global configuration settings and
> removes redundant definitions.
>
> Also when disabled, RTE_PMD_DEBUG_TRACE() is now defined as (void)0 to
> avoid empty statements warnings if used outside { } blocks.
>
> Fixes: b974e4a40cb5 ("ethdev: make error checking macros public")
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> ---
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 8 --------
> lib/librte_eal/common/include/rte_dev.h | 14 ++++++++++++++
> lib/librte_ether/rte_ethdev.h | 9 ---------
> 3 files changed, 14 insertions(+), 17 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index c6a5794..e82dcf0 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -57,14 +57,6 @@ extern "C" {
> #include "rte_crypto.h"
> #include "rte_cryptodev.h"
>
> -
> -#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
> -#define RTE_PMD_DEBUG_TRACE(...) \
> - rte_pmd_debug_trace(__func__, __VA_ARGS__)
> -#else
> -#define RTE_PMD_DEBUG_TRACE(...)
> -#endif
> -
> struct rte_cryptodev_session {
> RTE_STD_C11
> struct {
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index 8840380..dcf33d0 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -49,6 +49,7 @@ extern "C" {
> #include <stdio.h>
> #include <sys/queue.h>
>
> +#include <rte_config.h>
> #include <rte_log.h>
>
> __attribute__((format(printf, 2, 0)))
> @@ -70,6 +71,19 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
> rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
> }
>
> +/*
> + * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the
> + * RTE_*_RET() macros defined below is compiled in debug mode.
> + */
> +#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || \
> + defined(RTE_LIBRTE_CRYPTODEV_DEBUG) || \
> + defined(RTE_LIBRTE_EVENTDEV_DEBUG)
> +#define RTE_PMD_DEBUG_TRACE(...) \
> + rte_pmd_debug_trace(__func__, __VA_ARGS__)
> +#else
> +#define RTE_PMD_DEBUG_TRACE(...) (void)0
> +#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) { \
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 9678179..11ec1fa 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1001,15 +1001,6 @@ 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(...)
> -#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)) { \
> --
> 2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-18 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 9:40 [dpdk-stable] [PATCH] eal: fix debug macro redefinition Adrien Mazarguil
2017-05-18 14:59 ` Yuanhan Liu
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).