Message ID | 1428428419-25145-1-git-send-email-thomas.monjalon@6wind.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7641A379E; Tue, 7 Apr 2015 19:41:09 +0200 (CEST) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id C0FC33796 for <dev@dpdk.org>; Tue, 7 Apr 2015 19:41:07 +0200 (CEST) Received: by wiaa2 with SMTP id a2so28131982wia.0 for <dev@dpdk.org>; Tue, 07 Apr 2015 10:41:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Pph2lso9plpKJaffNr9vijF3W/pcQO+Zq0HuaZUSdFI=; b=iloJEnoQNIM99GqoS/EBky+oXZj2uNmQchCfXcAxUpdWmyAWHNhPn4v9pkB8cncCvs X4Ey49l6CADzTZtyOWGEkJUaMsrIQk8lC10rs/8FzpqLlzVrTSDFKWba7NdONG/pueNM uS4/Kw21FGv7pTWgN5XGKZAw94a5+aSaQceiDlS86YzcCn/Wo9Fn39nc54mtnqzQ01Xk XiPJr8b7d83HZrrmUIGdl8bBWF43rvRGE8O0nutHE16VUqqp0jtIJZOu423qDJP4qvuC RSBgc+q0YooU0RZv9vB4vluEN53XlNMg+8EqBUgWwOhW/WgYWaStAqqHX78UH976MoDn P0rw== X-Gm-Message-State: ALoCoQlEoy+o9s5H6H1LI37JM3XdwutlP39tWqU6jW4qHhnzMlSpEGFlPf31nEIEbR6q1s8DOrLo X-Received: by 10.180.109.169 with SMTP id ht9mr6804845wib.86.1428428467672; Tue, 07 Apr 2015 10:41:07 -0700 (PDT) Received: from XPS13.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id m4sm11897417wjb.25.2015.04.07.10.41.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Apr 2015 10:41:06 -0700 (PDT) From: Thomas Monjalon <thomas.monjalon@6wind.com> To: ssujith@cisco.com Date: Tue, 7 Apr 2015 19:40:19 +0200 Message-Id: <1428428419-25145-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.2.2 Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH] enic: disable debug traces X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Thomas Monjalon
April 7, 2015, 5:40 p.m. UTC
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@6wind.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_pmd_enic/enic_ethdev.c | 4 ++++
3 files changed, 6 insertions(+)
Comments
On 07/04/15 11:10 pm, "Thomas Monjalon" <thomas.monjalon@6wind.com> 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@6wind.com> >--- > 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@cisco.com> >
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@6wind.com> > --- > 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
On Thu, 9 Apr 2015 10:32:24 +0200 Adrien Mazarguil <adrien.mazarguil@6wind.com> 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
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@6wind.com> 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.
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@6wind.com> [...] > > --- 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.
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