[dpdk-dev,1/2] enic: replace use of printf with log

Message ID 1423927979-13607-1-git-send-email-shemming@brocade.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Stephen Hemminger Feb. 14, 2015, 3:32 p.m. UTC
Device driver should log via DPDK log, not to printf which is
sends to /dev/null in a daemon application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
  

Comments

Neil Horman Feb. 14, 2015, 4:28 p.m. UTC | #1
On Sat, Feb 14, 2015 at 10:32:58AM -0500, Stephen Hemminger wrote:
> Device driver should log via DPDK log, not to printf which is
> sends to /dev/null in a daemon application.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h
> index b1af838..c3ab76e 100644
> --- a/lib/librte_pmd_enic/enic_compat.h
> +++ b/lib/librte_pmd_enic/enic_compat.h
> @@ -75,10 +75,13 @@
>  #define kzalloc(size, flags) calloc(1, size)
>  #define kfree(x) free(x)
>  
> -#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
> -#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
> -#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
> -#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
> +#define dev_printk(level, fmt, args...)	\
> +	RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
> +
> +#define dev_err(x, args...) dev_printk(ERR, args)
> +#define dev_info(x, args...) dev_printk(INFO,  args)
> +#define dev_warning(x, args...) dev_printk(WARNING, args)
> +#define dev_debug(x, args...) dev_printk(DEBUG, args)
>  
>  #define __le16 u16
>  #define __le32 u32
> -- 
> 2.1.4
> 
> 
Series
Acked-by: Neil Horman <nhorman@tuxdriver.com>
  
David Marchand Feb. 23, 2015, 4:43 p.m. UTC | #2
On Sat, Feb 14, 2015 at 5:28 PM, Neil Horman <nhorman@tuxdriver.com> wrote:

> On Sat, Feb 14, 2015 at 10:32:58AM -0500, Stephen Hemminger wrote:
> > Device driver should log via DPDK log, not to printf which is
> > sends to /dev/null in a daemon application.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/librte_pmd_enic/enic_compat.h
> b/lib/librte_pmd_enic/enic_compat.h
> > index b1af838..c3ab76e 100644
> > --- a/lib/librte_pmd_enic/enic_compat.h
> > +++ b/lib/librte_pmd_enic/enic_compat.h
> > @@ -75,10 +75,13 @@
> >  #define kzalloc(size, flags) calloc(1, size)
> >  #define kfree(x) free(x)
> >
> > -#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
> > -#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
> > -#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
> > -#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
> > +#define dev_printk(level, fmt, args...)      \
> > +     RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
> > +
> > +#define dev_err(x, args...) dev_printk(ERR, args)
> > +#define dev_info(x, args...) dev_printk(INFO,  args)
> > +#define dev_warning(x, args...) dev_printk(WARNING, args)
> > +#define dev_debug(x, args...) dev_printk(DEBUG, args)
> >
> >  #define __le16 u16
> >  #define __le32 u32
> > --
> > 2.1.4
> >
> >
> Series
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
>

Use of rte_log would be better for init messages, but since the driver
makes no difference, this looks good enough to me.
Thanks Stephen.

Acked-by: David Marchand <david.marchand@6wind.com>
  
Thomas Monjalon Feb. 24, 2015, 2:37 a.m. UTC | #3
> > > Device driver should log via DPDK log, not to printf which is
> > > sends to /dev/null in a daemon application.
> > >
> > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > 
> > Series
> > Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 
> Use of rte_log would be better for init messages, but since the driver
> makes no difference, this looks good enough to me.
> Thanks Stephen.
> 
> Acked-by: David Marchand <david.marchand@6wind.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h
index b1af838..c3ab76e 100644
--- a/lib/librte_pmd_enic/enic_compat.h
+++ b/lib/librte_pmd_enic/enic_compat.h
@@ -75,10 +75,13 @@ 
 #define kzalloc(size, flags) calloc(1, size)
 #define kfree(x) free(x)
 
-#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
-#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
-#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
-#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
+#define dev_printk(level, fmt, args...)	\
+	RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
+
+#define dev_err(x, args...) dev_printk(ERR, args)
+#define dev_info(x, args...) dev_printk(INFO,  args)
+#define dev_warning(x, args...) dev_printk(WARNING, args)
+#define dev_debug(x, args...) dev_printk(DEBUG, args)
 
 #define __le16 u16
 #define __le32 u32