[v2,1/4] net/mlx4: enable debug logs dynamically
Checks
Commit Message
The macro DEBUG was doing nothing if not compiled with
RTE_LIBRTE_MLX4_DEBUG.
As it is not used in the data path, it can be always enabled at
compilation time. Then it can be enabled at runtime with:
--log-level pmd.net.mlx4:debug
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/mlx4/mlx4_utils.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
From: Thomas Monjalon
> The macro DEBUG was doing nothing if not compiled with
> RTE_LIBRTE_MLX4_DEBUG.
>
> As it is not used in the data path, it can be always enabled at compilation time.
> Then it can be enabled at runtime with:
> --log-level pmd.net.mlx4:debug
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@nvidia.com>
On 3/9/2021 9:48 AM, Thomas Monjalon wrote:
> The macro DEBUG was doing nothing if not compiled with
> RTE_LIBRTE_MLX4_DEBUG.
>
> As it is not used in the data path, it can be always enabled at
> compilation time. Then it can be enabled at runtime with:
> --log-level pmd.net.mlx4:debug
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
+1 to change, but why 'RTE_LIBRTE_MLX4_DEBUG' exists at first place?
It seems is is used both for data and control path, can you extend the patch for:
1- Remove #ifdef from control path
2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
3- Remove 'RTE_LIBRTE_MLX4_DEBUG' completely, if not removed document it in the
driver documentation as supported config file
17/03/2021 18:29, Ferruh Yigit:
> On 3/9/2021 9:48 AM, Thomas Monjalon wrote:
> > The macro DEBUG was doing nothing if not compiled with
> > RTE_LIBRTE_MLX4_DEBUG.
> >
> > As it is not used in the data path, it can be always enabled at
> > compilation time. Then it can be enabled at runtime with:
> > --log-level pmd.net.mlx4:debug
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
> +1 to change, but why 'RTE_LIBRTE_MLX4_DEBUG' exists at first place?
>
> It seems is is used both for data and control path, can you extend the patch for:
> 1- Remove #ifdef from control path
> 2- Replace with 'RTE_ETHDEV_DEBUG_RX' & 'RTE_ETHDEV_DEBUG_TX' for data path,
> please see: https://patches.dpdk.org/project/dpdk/list/?series=15738
> 3- Remove 'RTE_LIBRTE_MLX4_DEBUG' completely, if not removed document it in the
> driver documentation as supported config file
To me using ETHDEV config macro in PMDs is new,
and I think it is out of scope for this patch.
But yes I agree it would be a nice improvement.
Matan, please could you do this change during next month?
@@ -52,14 +52,13 @@ pmd_drv_log_basename(const char *s)
__LINE__, \
__func__, \
RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
#define MLX4_ASSERT(exp) RTE_VERIFY(exp)
#define claim_zero(...) MLX4_ASSERT((__VA_ARGS__) == 0)
#else /* RTE_LIBRTE_MLX4_DEBUG */
/*
- * Like MLX4_ASSERT(), DEBUG() becomes a no-op and claim_zero() does not perform
+ * Like MLX4_ASSERT(), claim_zero() does not perform
* any check when debugging is disabled.
*/
@@ -68,12 +67,12 @@ pmd_drv_log_basename(const char *s)
RTE_FMT(MLX4_DRIVER_NAME ": " \
RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
RTE_FMT_TAIL(__VA_ARGS__,)))
-#define DEBUG(...) (void)0
#define MLX4_ASSERT(exp) RTE_ASSERT(exp)
#define claim_zero(...) (__VA_ARGS__)
#endif /* RTE_LIBRTE_MLX4_DEBUG */
+#define DEBUG(...) PMD_DRV_LOG(DEBUG, __VA_ARGS__)
#define INFO(...) PMD_DRV_LOG(INFO, __VA_ARGS__)
#define WARN(...) PMD_DRV_LOG(WARNING, __VA_ARGS__)
#define ERROR(...) PMD_DRV_LOG(ERR, __VA_ARGS__)