* [dpdk-dev] [PATCH] net/mlx4: use dynamic log type
@ 2019-05-21 21:27 Stephen Hemminger
2019-05-24 14:08 ` Ferruh Yigit
2019-05-24 16:03 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2019-05-21 21:27 UTC (permalink / raw)
To: matan, shahafs; +Cc: dev, Stephen Hemminger, Stephen Hemminger
This driver should use dynamic log level not RTE_LOGTYPE_PMD.
Other drivers were converted back in 18.02.
This is really a bug, all other drivers use dynamic log levels
by now.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/mlx4/mlx4.c | 8 ++++++++
drivers/net/mlx4/mlx4_utils.h | 6 ++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index fe559c040706..e532dc53738f 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -60,6 +60,9 @@ static rte_spinlock_t mlx4_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
/* Process local data for secondary processes. */
static struct mlx4_local_data mlx4_local_data;
+/** Driver-specific log messages type. */
+int mlx4_logtype;
+
/** Configuration structure for device arguments. */
struct mlx4_conf {
struct {
@@ -1272,6 +1275,11 @@ mlx4_glue_init(void)
*/
RTE_INIT(rte_mlx4_pmd_init)
{
+ /* Initialize driver log type. */
+ mlx4_logtype = rte_log_register("pmd.net.mlx4");
+ if (mlx4_logtype >= 0)
+ rte_log_set_level(mlx4_logtype, RTE_LOG_NOTICE);
+
/*
* MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
* want to get success errno value in case of calling them
diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index 86abb3b7e376..9d3d2a4e32a1 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -15,6 +15,8 @@
#include "mlx4.h"
+extern int mlx4_logtype;
+
#ifndef NDEBUG
/*
@@ -35,7 +37,7 @@ pmd_drv_log_basename(const char *s)
}
#define PMD_DRV_LOG(level, ...) \
- RTE_LOG(level, PMD, \
+ RTE_LOG(level, mlx4_logtype, \
RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
pmd_drv_log_basename(__FILE__), \
__LINE__, \
@@ -52,7 +54,7 @@ pmd_drv_log_basename(const char *s)
*/
#define PMD_DRV_LOG(level, ...) \
- RTE_LOG(level, PMD, \
+ RTE_LOG(level, mlx4_logtype, \
RTE_FMT(MLX4_DRIVER_NAME ": " \
RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
RTE_FMT_TAIL(__VA_ARGS__,)))
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx4: use dynamic log type
2019-05-21 21:27 [dpdk-dev] [PATCH] net/mlx4: use dynamic log type Stephen Hemminger
@ 2019-05-24 14:08 ` Ferruh Yigit
2019-05-24 16:03 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
1 sibling, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2019-05-24 14:08 UTC (permalink / raw)
To: Stephen Hemminger, matan, shahafs; +Cc: dev, Stephen Hemminger
On 5/21/2019 10:27 PM, Stephen Hemminger wrote:
> This driver should use dynamic log level not RTE_LOGTYPE_PMD.
> Other drivers were converted back in 18.02.
>
> This is really a bug, all other drivers use dynamic log levels
> by now.
+1, we should switch it to dynamic log much earlier
Matan, Shahaf,
This patch will have problem with "RTE_LOG" usage, need to use rte_log() I
guess, can you (or Stephen, whoever can work on it) please send a new version?
Thanks,
ferruh
>
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> ---
> drivers/net/mlx4/mlx4.c | 8 ++++++++
> drivers/net/mlx4/mlx4_utils.h | 6 ++++--
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index fe559c040706..e532dc53738f 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -60,6 +60,9 @@ static rte_spinlock_t mlx4_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
> /* Process local data for secondary processes. */
> static struct mlx4_local_data mlx4_local_data;
>
> +/** Driver-specific log messages type. */
> +int mlx4_logtype;
> +
> /** Configuration structure for device arguments. */
> struct mlx4_conf {
> struct {
> @@ -1272,6 +1275,11 @@ mlx4_glue_init(void)
> */
> RTE_INIT(rte_mlx4_pmd_init)
> {
> + /* Initialize driver log type. */
> + mlx4_logtype = rte_log_register("pmd.net.mlx4");
> + if (mlx4_logtype >= 0)
> + rte_log_set_level(mlx4_logtype, RTE_LOG_NOTICE);
> +
> /*
> * MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
> * want to get success errno value in case of calling them
> diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
> index 86abb3b7e376..9d3d2a4e32a1 100644
> --- a/drivers/net/mlx4/mlx4_utils.h
> +++ b/drivers/net/mlx4/mlx4_utils.h
> @@ -15,6 +15,8 @@
>
> #include "mlx4.h"
>
> +extern int mlx4_logtype;
> +
> #ifndef NDEBUG
>
> /*
> @@ -35,7 +37,7 @@ pmd_drv_log_basename(const char *s)
> }
>
> #define PMD_DRV_LOG(level, ...) \
> - RTE_LOG(level, PMD, \
> + RTE_LOG(level, mlx4_logtype, \
> RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> pmd_drv_log_basename(__FILE__), \
> __LINE__, \
> @@ -52,7 +54,7 @@ pmd_drv_log_basename(const char *s)
> */
>
> #define PMD_DRV_LOG(level, ...) \
> - RTE_LOG(level, PMD, \
> + RTE_LOG(level, mlx4_logtype, \
> RTE_FMT(MLX4_DRIVER_NAME ": " \
> RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
> RTE_FMT_TAIL(__VA_ARGS__,)))
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx4: use dynamic log type
2019-05-21 21:27 [dpdk-dev] [PATCH] net/mlx4: use dynamic log type Stephen Hemminger
2019-05-24 14:08 ` Ferruh Yigit
@ 2019-05-24 16:03 ` Stephen Hemminger
2019-05-24 17:13 ` Ferruh Yigit
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2019-05-24 16:03 UTC (permalink / raw)
To: matan, shahafs; +Cc: dev, Stephen Hemminger
From: Stephen Hemminger <sthemmin@microsoft.com>
This driver should use dynamic log level not RTE_LOGTYPE_PMD.
Other drivers were converted back in 18.02.
This is really a bug, all other drivers use dynamic log levels
by now.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
v2 - use rte_log and fix debug logs
drivers/net/mlx4/mlx4.c | 8 ++++++++
drivers/net/mlx4/mlx4_utils.h | 6 ++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index fe559c040706..e532dc53738f 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -60,6 +60,9 @@ static rte_spinlock_t mlx4_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
/* Process local data for secondary processes. */
static struct mlx4_local_data mlx4_local_data;
+/** Driver-specific log messages type. */
+int mlx4_logtype;
+
/** Configuration structure for device arguments. */
struct mlx4_conf {
struct {
@@ -1272,6 +1275,11 @@ mlx4_glue_init(void)
*/
RTE_INIT(rte_mlx4_pmd_init)
{
+ /* Initialize driver log type. */
+ mlx4_logtype = rte_log_register("pmd.net.mlx4");
+ if (mlx4_logtype >= 0)
+ rte_log_set_level(mlx4_logtype, RTE_LOG_NOTICE);
+
/*
* MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
* want to get success errno value in case of calling them
diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index 86abb3b7e376..a49190252fe1 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -15,6 +15,8 @@
#include "mlx4.h"
+extern int mlx4_logtype;
+
#ifndef NDEBUG
/*
@@ -35,7 +37,7 @@ pmd_drv_log_basename(const char *s)
}
#define PMD_DRV_LOG(level, ...) \
- RTE_LOG(level, PMD, \
+ rte_log(RTE_LOG_ ## level, mlx4_logtype, \
RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
pmd_drv_log_basename(__FILE__), \
__LINE__, \
@@ -52,7 +54,7 @@ pmd_drv_log_basename(const char *s)
*/
#define PMD_DRV_LOG(level, ...) \
- RTE_LOG(level, PMD, \
+ rte_log(RTE_LOG_ ## level, mlx4_logtype, \
RTE_FMT(MLX4_DRIVER_NAME ": " \
RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
RTE_FMT_TAIL(__VA_ARGS__,)))
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx4: use dynamic log type
2019-05-24 16:03 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
@ 2019-05-24 17:13 ` Ferruh Yigit
2019-05-26 19:24 ` Shahaf Shuler
0 siblings, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2019-05-24 17:13 UTC (permalink / raw)
To: Stephen Hemminger, matan, shahafs; +Cc: dev, Stephen Hemminger
On 5/24/2019 5:03 PM, Stephen Hemminger wrote:
> From: Stephen Hemminger <sthemmin@microsoft.com>
>
> This driver should use dynamic log level not RTE_LOGTYPE_PMD.
> Other drivers were converted back in 18.02.
>
> This is really a bug, all other drivers use dynamic log levels
> by now.
>
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx4: use dynamic log type
2019-05-24 17:13 ` Ferruh Yigit
@ 2019-05-26 19:24 ` Shahaf Shuler
0 siblings, 0 replies; 5+ messages in thread
From: Shahaf Shuler @ 2019-05-26 19:24 UTC (permalink / raw)
To: Ferruh Yigit, Stephen Hemminger, Matan Azrad; +Cc: dev, Stephen Hemminger
Friday, May 24, 2019 8:13 PM, Ferruh Yigit:
> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx4: use dynamic log type
>
> On 5/24/2019 5:03 PM, Stephen Hemminger wrote:
> > From: Stephen Hemminger <sthemmin@microsoft.com>
> >
> > This driver should use dynamic log level not RTE_LOGTYPE_PMD.
> > Other drivers were converted back in 18.02.
> >
> > This is really a bug, all other drivers use dynamic log levels by now.
> >
> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-26 19:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 21:27 [dpdk-dev] [PATCH] net/mlx4: use dynamic log type Stephen Hemminger
2019-05-24 14:08 ` Ferruh Yigit
2019-05-24 16:03 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-05-24 17:13 ` Ferruh Yigit
2019-05-26 19:24 ` Shahaf Shuler
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).