* [PATCH] enic: disable debug traces @ 2015-04-07 17:40 Thomas Monjalon [not found] ` <1428428419-25145-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Thomas Monjalon @ 2015-04-07 17:40 UTC (permalink / raw) To: ssujith-FYB4Gu1CFyUAvxtiuMwx3w; +Cc: dev-VfR2kkLFssw The function name is printed in each enic_ethdev function. Disable it by default with a new build option. Signed-off-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> --- config/common_bsdapp | 1 + config/common_linuxapp | 1 + lib/librte_pmd_enic/enic_ethdev.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index a8ba484..c2374c0 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -214,6 +214,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 # Compile burst-oriented Cisco ENIC PMD driver # CONFIG_RTE_LIBRTE_ENIC_PMD=y +CONFIG_RTE_LIBRTE_ENIC_DEBUG=n # # Compile burst-oriented VIRTIO PMD driver diff --git a/config/common_linuxapp b/config/common_linuxapp index 0b25f34..0078dc9 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -211,6 +211,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 # Compile burst-oriented Cisco ENIC PMD driver # CONFIG_RTE_LIBRTE_ENIC_PMD=y +CONFIG_RTE_LIBRTE_ENIC_DEBUG=n # # Compile burst-oriented VIRTIO PMD driver diff --git a/lib/librte_pmd_enic/enic_ethdev.c b/lib/librte_pmd_enic/enic_ethdev.c index 4950ede..18fadfb 100644 --- a/lib/librte_pmd_enic/enic_ethdev.c +++ b/lib/librte_pmd_enic/enic_ethdev.c @@ -48,8 +48,12 @@ #include "vnic_enet.h" #include "enic.h" +#ifdef RTE_LIBRTE_ENIC_DEBUG #define ENICPMD_FUNC_TRACE() \ RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) +#else +#define ENICPMD_FUNC_TRACE() do {} while (0) +#endif /* * The set of PCI devices this driver supports -- 2.2.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1428428419-25145-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] enic: disable debug traces [not found] ` <1428428419-25145-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2015-04-08 3:29 ` Sujith Sankar (ssujith) 2015-04-09 8:32 ` Adrien Mazarguil 1 sibling, 0 replies; 6+ messages in thread From: Sujith Sankar (ssujith) @ 2015-04-08 3:29 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev-VfR2kkLFssw@public.gmane.org On 07/04/15 11:10 pm, "Thomas Monjalon" <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> wrote: >The function name is printed in each enic_ethdev function. >Disable it by default with a new build option. > >Signed-off-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> >--- > config/common_bsdapp | 1 + > config/common_linuxapp | 1 + > lib/librte_pmd_enic/enic_ethdev.c | 4 ++++ > 3 files changed, 6 insertions(+) > >diff --git a/config/common_bsdapp b/config/common_bsdapp >index a8ba484..c2374c0 100644 >--- a/config/common_bsdapp >+++ b/config/common_bsdapp >@@ -214,6 +214,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 > # Compile burst-oriented Cisco ENIC PMD driver > # > CONFIG_RTE_LIBRTE_ENIC_PMD=y >+CONFIG_RTE_LIBRTE_ENIC_DEBUG=n > > # > # Compile burst-oriented VIRTIO PMD driver >diff --git a/config/common_linuxapp b/config/common_linuxapp >index 0b25f34..0078dc9 100644 >--- a/config/common_linuxapp >+++ b/config/common_linuxapp >@@ -211,6 +211,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 > # Compile burst-oriented Cisco ENIC PMD driver > # > CONFIG_RTE_LIBRTE_ENIC_PMD=y >+CONFIG_RTE_LIBRTE_ENIC_DEBUG=n > > # > # Compile burst-oriented VIRTIO PMD driver >diff --git a/lib/librte_pmd_enic/enic_ethdev.c >b/lib/librte_pmd_enic/enic_ethdev.c >index 4950ede..18fadfb 100644 >--- a/lib/librte_pmd_enic/enic_ethdev.c >+++ b/lib/librte_pmd_enic/enic_ethdev.c >@@ -48,8 +48,12 @@ > #include "vnic_enet.h" > #include "enic.h" > >+#ifdef RTE_LIBRTE_ENIC_DEBUG > #define ENICPMD_FUNC_TRACE() \ > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) >+#else >+#define ENICPMD_FUNC_TRACE() do {} while (0) >+#endif > > /* > * The set of PCI devices this driver supports >-- >2.2.2 > Acked-by: Sujith Sankar <ssujith-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] enic: disable debug traces [not found] ` <1428428419-25145-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 2015-04-08 3:29 ` Sujith Sankar (ssujith) @ 2015-04-09 8:32 ` Adrien Mazarguil [not found] ` <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Adrien Mazarguil @ 2015-04-09 8:32 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev-VfR2kkLFssw On Tue, Apr 07, 2015 at 07:40:19PM +0200, Thomas Monjalon wrote: > The function name is printed in each enic_ethdev function. > Disable it by default with a new build option. > > Signed-off-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > --- > config/common_bsdapp | 1 + > config/common_linuxapp | 1 + > lib/librte_pmd_enic/enic_ethdev.c | 4 ++++ > 3 files changed, 6 insertions(+) > > diff --git a/config/common_bsdapp b/config/common_bsdapp > index a8ba484..c2374c0 100644 > --- a/config/common_bsdapp > +++ b/config/common_bsdapp > @@ -214,6 +214,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 > # Compile burst-oriented Cisco ENIC PMD driver > # > CONFIG_RTE_LIBRTE_ENIC_PMD=y > +CONFIG_RTE_LIBRTE_ENIC_DEBUG=n > > # > # Compile burst-oriented VIRTIO PMD driver > diff --git a/config/common_linuxapp b/config/common_linuxapp > index 0b25f34..0078dc9 100644 > --- a/config/common_linuxapp > +++ b/config/common_linuxapp > @@ -211,6 +211,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1 > # Compile burst-oriented Cisco ENIC PMD driver > # > CONFIG_RTE_LIBRTE_ENIC_PMD=y > +CONFIG_RTE_LIBRTE_ENIC_DEBUG=n > > # > # Compile burst-oriented VIRTIO PMD driver > diff --git a/lib/librte_pmd_enic/enic_ethdev.c b/lib/librte_pmd_enic/enic_ethdev.c > index 4950ede..18fadfb 100644 > --- a/lib/librte_pmd_enic/enic_ethdev.c > +++ b/lib/librte_pmd_enic/enic_ethdev.c > @@ -48,8 +48,12 @@ > #include "vnic_enet.h" > #include "enic.h" > > +#ifdef RTE_LIBRTE_ENIC_DEBUG > #define ENICPMD_FUNC_TRACE() \ > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) > +#else > +#define ENICPMD_FUNC_TRACE() do {} while (0) How about defining it as (void)0 instead of an empty do/while block? Doing so will prevent warnings if this macro happens to be used in an expression. RTE_LOG() supports it. > +#endif > > /* > * The set of PCI devices this driver supports > -- > 2.2.2 -- Adrien Mazarguil 6WIND ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] enic: disable debug traces [not found] ` <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2015-04-09 16:28 ` Stephen Hemminger 2015-04-13 10:32 ` Adrien Mazarguil 2015-04-13 20:12 ` Thomas Monjalon 1 sibling, 1 reply; 6+ messages in thread From: Stephen Hemminger @ 2015-04-09 16:28 UTC (permalink / raw) To: Adrien Mazarguil; +Cc: dev-VfR2kkLFssw On Thu, 9 Apr 2015 10:32:24 +0200 Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> wrote: > > > > +#ifdef RTE_LIBRTE_ENIC_DEBUG > > #define ENICPMD_FUNC_TRACE() \ > > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) > > +#else > > +#define ENICPMD_FUNC_TRACE() do {} while (0) > > How about defining it as (void)0 instead of an empty do/while block? > > Doing so will prevent warnings if this macro happens to be used in an > expression. RTE_LOG() supports it. I kind of like the Linux printk trick since it then preserves the format checking even if compiled out. /* * Dummy printk for disabled debugging statements to use whilst maintaining * gcc's format and side-effect checking. */ static inline __printf(1, 2) int no_printk(const char *fmt, ...) { return 0; } /* pr_devel() should produce zero code unless DEBUG is defined */ #ifdef DEBUG #define pr_devel(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_devel(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] enic: disable debug traces 2015-04-09 16:28 ` Stephen Hemminger @ 2015-04-13 10:32 ` Adrien Mazarguil 0 siblings, 0 replies; 6+ messages in thread From: Adrien Mazarguil @ 2015-04-13 10:32 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev-VfR2kkLFssw On Thu, Apr 09, 2015 at 09:28:53AM -0700, Stephen Hemminger wrote: > On Thu, 9 Apr 2015 10:32:24 +0200 > Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > +#ifdef RTE_LIBRTE_ENIC_DEBUG > > > #define ENICPMD_FUNC_TRACE() \ > > > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) > > > +#else > > > +#define ENICPMD_FUNC_TRACE() do {} while (0) > > > > How about defining it as (void)0 instead of an empty do/while block? > > > > Doing so will prevent warnings if this macro happens to be used in an > > expression. RTE_LOG() supports it. > > I kind of like the Linux printk trick since it then preserves the format checking > even if compiled out. > > /* > * Dummy printk for disabled debugging statements to use whilst maintaining > * gcc's format and side-effect checking. > */ > static inline __printf(1, 2) > int no_printk(const char *fmt, ...) > { > return 0; > } > > /* pr_devel() should produce zero code unless DEBUG is defined */ > #ifdef DEBUG > #define pr_devel(fmt, ...) \ > printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) > #else > #define pr_devel(fmt, ...) \ > no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) > #endif My only concern with this is that it cannot be done in a ISO C compliant manner easily. While "__printf()" can be defined to nothing when dealing with compilers that do not support extensions, ", ## __VAR_ARGS__" will most likely fail with -pedantic. -- Adrien Mazarguil 6WIND ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] enic: disable debug traces [not found] ` <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 2015-04-09 16:28 ` Stephen Hemminger @ 2015-04-13 20:12 ` Thomas Monjalon 1 sibling, 0 replies; 6+ messages in thread From: Thomas Monjalon @ 2015-04-13 20:12 UTC (permalink / raw) To: Adrien Mazarguil, ssujith-FYB4Gu1CFyUAvxtiuMwx3w; +Cc: dev-VfR2kkLFssw 2015-04-09 10:32, Adrien Mazarguil: > On Tue, Apr 07, 2015 at 07:40:19PM +0200, Thomas Monjalon wrote: > > The function name is printed in each enic_ethdev function. > > Disable it by default with a new build option. > > > > Signed-off-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> [...] > > --- a/lib/librte_pmd_enic/enic_ethdev.c > > +++ b/lib/librte_pmd_enic/enic_ethdev.c > > @@ -48,8 +48,12 @@ > > #include "vnic_enet.h" > > #include "enic.h" > > > > +#ifdef RTE_LIBRTE_ENIC_DEBUG > > #define ENICPMD_FUNC_TRACE() \ > > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) > > +#else > > +#define ENICPMD_FUNC_TRACE() do {} while (0) > > How about defining it as (void)0 instead of an empty do/while block? > > Doing so will prevent warnings if this macro happens to be used in an > expression. RTE_LOG() supports it. Applied with Adrien's suggestion. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-13 20:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-07 17:40 [PATCH] enic: disable debug traces Thomas Monjalon [not found] ` <1428428419-25145-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 2015-04-08 3:29 ` Sujith Sankar (ssujith) 2015-04-09 8:32 ` Adrien Mazarguil [not found] ` <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 2015-04-09 16:28 ` Stephen Hemminger 2015-04-13 10:32 ` Adrien Mazarguil 2015-04-13 20:12 ` Thomas Monjalon
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).