raw/ifpga: modify log output.

Message ID 1552556863-35966-1-git-send-email-andy.pei@intel.com
State New
Delegated to: Ferruh Yigit
Headers show
Series
  • raw/ifpga: modify log output.
Related show

Checks

Context Check Description
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Pei, Andy March 14, 2019, 9:47 a.m.
print function name in IFPGA_RAWDEV_PMD_FUNC_TRACE.
The original code just print ">>", no other useful infomation is
printed.
A new line goes after every IFPGA log.

Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: rosen.xu@intel.com
Cc: andy.pei@intel.com
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Xu, Rosen March 19, 2019, 3:09 a.m. | #1
Hi,

This macro IFPGA_RAWDEV_PMD_FUNC_TRACE is very useful for developer.
To enable this macro, pls follow these guides:
1. enable gcc debug mode such as options: EXTRA_CFLAGS='-O0 -g'
2. add this option in testpmd startup: --log-level=driver.raw.init,8

> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, March 14, 2019 17:48
> To: dev@dpdk.org
> Cc: Pei, Andy <andy.pei@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] raw/ifpga: modify log output.
> 
> print function name in IFPGA_RAWDEV_PMD_FUNC_TRACE.
> The original code just print ">>", no other useful infomation is printed.
> A new line goes after every IFPGA log.
> 
> Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: rosen.xu@intel.com
> Cc: andy.pei@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> index c7759b8..52fca63 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> @@ -8,10 +8,11 @@
>  extern int ifpga_rawdev_logtype;
> 
>  #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
> -	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
> +	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt "\n",
> \
>  		##args)
> 
> -#define IFPGA_RAWDEV_PMD_FUNC_TRACE()
> IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
> +#define IFPGA_RAWDEV_PMD_FUNC_TRACE() \
> +	IFPGA_RAWDEV_PMD_LOG(DEBUG, "%s()", __func__)
> 
>  #define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
>  	IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)
> --
> 1.8.3.1
Pei, Andy March 19, 2019, 7:56 a.m. | #2
Hi, Rosen:

Yes.
Original code just print "ifpga:>>".
After the patch, function name will be printed out ,like "ifpga:XXXX()", and every log info will goes in a new line.

-----Original Message-----
From: Xu, Rosen 
Sent: Tuesday, March 19, 2019 11:09 AM
To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
Cc: stable@dpdk.org
Subject: RE: [PATCH] raw/ifpga: modify log output.

Hi,

This macro IFPGA_RAWDEV_PMD_FUNC_TRACE is very useful for developer.
To enable this macro, pls follow these guides:
1. enable gcc debug mode such as options: EXTRA_CFLAGS='-O0 -g'
2. add this option in testpmd startup: --log-level=driver.raw.init,8

> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, March 14, 2019 17:48
> To: dev@dpdk.org
> Cc: Pei, Andy <andy.pei@intel.com>; Xu, Rosen <rosen.xu@intel.com>; 
> stable@dpdk.org
> Subject: [PATCH] raw/ifpga: modify log output.
> 
> print function name in IFPGA_RAWDEV_PMD_FUNC_TRACE.
> The original code just print ">>", no other useful infomation is printed.
> A new line goes after every IFPGA log.
> 
> Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: rosen.xu@intel.com
> Cc: andy.pei@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> index c7759b8..52fca63 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> @@ -8,10 +8,11 @@
>  extern int ifpga_rawdev_logtype;
> 
>  #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
> -	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
> +	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt "\n",
> \
>  		##args)
> 
> -#define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, 
> ">>")
> +#define IFPGA_RAWDEV_PMD_FUNC_TRACE() \
> +	IFPGA_RAWDEV_PMD_LOG(DEBUG, "%s()", __func__)
> 
>  #define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
>  	IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)
> --
> 1.8.3.1
Xu, Rosen March 19, 2019, 10:40 a.m. | #3
Hi Andy,

Get your point, and my reply is online.

> -----Original Message-----
> From: Pei, Andy
> Sent: Tuesday, March 19, 2019 15:56
> To: Xu, Rosen <rosen.xu@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] raw/ifpga: modify log output.
> 
> Hi, Rosen:
> 
> Yes.
> Original code just print "ifpga:>>".
> After the patch, function name will be printed out ,like "ifpga:XXXX()", and
> every log info will goes in a new line.
> 
> -----Original Message-----
> From: Xu, Rosen
> Sent: Tuesday, March 19, 2019 11:09 AM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] raw/ifpga: modify log output.
> 
> Hi,
> 
> This macro IFPGA_RAWDEV_PMD_FUNC_TRACE is very useful for developer.
> To enable this macro, pls follow these guides:
> 1. enable gcc debug mode such as options: EXTRA_CFLAGS='-O0 -g'
> 2. add this option in testpmd startup: --log-level=driver.raw.init,8
> 
> > -----Original Message-----
> > From: Pei, Andy
> > Sent: Thursday, March 14, 2019 17:48
> > To: dev@dpdk.org
> > Cc: Pei, Andy <andy.pei@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] raw/ifpga: modify log output.
> >
> > print function name in IFPGA_RAWDEV_PMD_FUNC_TRACE.
> > The original code just print ">>", no other useful infomation is printed.
> > A new line goes after every IFPGA log.
> >
> > Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
> > Cc: rosen.xu@intel.com
> > Cc: andy.pei@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  drivers/raw/ifpga_rawdev/ifpga_rawdev.h | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> > b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> > index c7759b8..52fca63 100644
> > --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> > +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
> > @@ -8,10 +8,11 @@
> >  extern int ifpga_rawdev_logtype;
> >
> >  #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
> > -	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
> > +	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt "\n",
> > \
> >  		##args)

What about add '__func__' to macro ' IFPGA_RAWDEV_PMD_LOG'?
#define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
				__func__, ##args)

> > -#define IFPGA_RAWDEV_PMD_FUNC_TRACE()
> IFPGA_RAWDEV_PMD_LOG(DEBUG,
> > ">>")
> > +#define IFPGA_RAWDEV_PMD_FUNC_TRACE() \
> > +	IFPGA_RAWDEV_PMD_LOG(DEBUG, "%s()", __func__)
> >
> >  #define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
> >  	IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)
> > --
> > 1.8.3.1

Patch

diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
index c7759b8..52fca63 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h
@@ -8,10 +8,11 @@ 
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt "\n", \
 		##args)
 
-#define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
+#define IFPGA_RAWDEV_PMD_FUNC_TRACE() \
+	IFPGA_RAWDEV_PMD_LOG(DEBUG, "%s()", __func__)
 
 #define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
 	IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)