DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v3 02/19] net/xsc: add log macro
@ 2024-09-18  6:09 WanRenyong
  2024-09-18  8:56 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: WanRenyong @ 2024-09-18  6:09 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, WanRenyong

Add log macro to print runtime messages and trace functions.

Signed-off-by: WanRenyong <wanry@yunsilicon.com>

---

v3:
* use RTE_LOG_LINE_PREFIX instead of rte_log
---
 drivers/net/xsc/xsc_ethdev.c | 11 +++++++++
 drivers/net/xsc/xsc_log.h    | 46 ++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 drivers/net/xsc/xsc_log.h

diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 0e48cb76fa..58ceaa3940 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -1,3 +1,14 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2024 Yunsilicon Technology Co., Ltd.
  */
+
+#include "xsc_log.h"
+
+RTE_LOG_REGISTER_SUFFIX(xsc_logtype_init, init, NOTICE);
+RTE_LOG_REGISTER_SUFFIX(xsc_logtype_driver, driver, NOTICE);
+#ifdef RTE_ETHDEV_DEBUG_RX
+RTE_LOG_REGISTER_SUFFIX(xsc_logtype_rx, rx, DEBUG);
+#endif
+#ifdef RTE_ETHDEV_DEBUG_TX
+RTE_LOG_REGISTER_SUFFIX(xsc_logtype_tx, tx, DEBUG);
+#endif
diff --git a/drivers/net/xsc/xsc_log.h b/drivers/net/xsc/xsc_log.h
new file mode 100644
index 0000000000..99a88fcd1b
--- /dev/null
+++ b/drivers/net/xsc/xsc_log.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2024 Yunsilicon Technology Co., Ltd.
+ */
+
+#ifndef _XSC_LOG_H_
+#define _XSC_LOG_H_
+
+#include <rte_log.h>
+
+extern int xsc_logtype_init;
+extern int xsc_logtype_driver;
+#define RTE_LOGTYPE_XSC_INIT xsc_logtype_init
+#define RTE_LOGTYPE_XSC_DRV xsc_logtype_driver
+
+
+#define PMD_INIT_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, XSC_INIT, "%s(): ", __func__, __VA_ARGS__)
+
+
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+
+#ifdef RTE_ETHDEV_DEBUG_RX
+extern int xsc_logtype_rx;
+#define RTE_LOGTYPE_XSC_RX xsc_logtype_rx
+#define PMD_RX_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, XSC_RX, "%s(): ", __func__, __VA_ARGS__)
+#else
+#define PMD_RX_LOG(level, ...) do { } while (0)
+#endif
+
+#ifdef RTE_ETHDEV_DEBUG_TX
+extern int xsc_logtype_tx;
+#define RTE_LOGTYPE_XSC_TX xsc_logtype_tx
+#define PMD_TX_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, XSC_TX, "%s(): ", __func__, __VA_ARGS__)
+#else
+#define PMD_TX_LOG(level, ...) do { } while (0)
+#endif
+
+#define PMD_DRV_LOG_RAW(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, XSC_DRV, "%s(): ", __func__, __VA_ARGS__)
+
+#define PMD_DRV_LOG(level, ...) \
+	PMD_DRV_LOG_RAW(level, __VA_ARGS__)
+
+#endif /* _XSC_LOG_H_ */
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 02/19] net/xsc: add log macro
  2024-09-18  6:09 [PATCH v3 02/19] net/xsc: add log macro WanRenyong
@ 2024-09-18  8:56 ` David Marchand
  2024-09-18  9:28   ` WanRenyong
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2024-09-18  8:56 UTC (permalink / raw)
  To: WanRenyong; +Cc: dev, ferruh.yigit

On Wed, Sep 18, 2024 at 8:10 AM WanRenyong <wanry@yunsilicon.com> wrote:
>
> Add log macro to print runtime messages and trace functions.
>
> Signed-off-by: WanRenyong <wanry@yunsilicon.com>
>
> ---
>
> v3:
> * use RTE_LOG_LINE_PREFIX instead of rte_log
> ---
>  drivers/net/xsc/xsc_ethdev.c | 11 +++++++++
>  drivers/net/xsc/xsc_log.h    | 46 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 57 insertions(+)
>  create mode 100644 drivers/net/xsc/xsc_log.h
>
> diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
> index 0e48cb76fa..58ceaa3940 100644
> --- a/drivers/net/xsc/xsc_ethdev.c
> +++ b/drivers/net/xsc/xsc_ethdev.c
> @@ -1,3 +1,14 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
>   * Copyright 2024 Yunsilicon Technology Co., Ltd.
>   */
> +
> +#include "xsc_log.h"
> +
> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_init, init, NOTICE);
> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_driver, driver, NOTICE);
> +#ifdef RTE_ETHDEV_DEBUG_RX
> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_rx, rx, DEBUG);
> +#endif
> +#ifdef RTE_ETHDEV_DEBUG_TX
> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_tx, tx, DEBUG);
> +#endif
> diff --git a/drivers/net/xsc/xsc_log.h b/drivers/net/xsc/xsc_log.h
> new file mode 100644
> index 0000000000..99a88fcd1b
> --- /dev/null
> +++ b/drivers/net/xsc/xsc_log.h
> @@ -0,0 +1,46 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2024 Yunsilicon Technology Co., Ltd.
> + */
> +
> +#ifndef _XSC_LOG_H_
> +#define _XSC_LOG_H_
> +
> +#include <rte_log.h>
> +
> +extern int xsc_logtype_init;
> +extern int xsc_logtype_driver;
> +#define RTE_LOGTYPE_XSC_INIT xsc_logtype_init
> +#define RTE_LOGTYPE_XSC_DRV xsc_logtype_driver
> +
> +
> +#define PMD_INIT_LOG(level, ...) \
> +       RTE_LOG_LINE_PREFIX(level, XSC_INIT, "%s(): ", __func__, __VA_ARGS__)

Thank you for converting to RTE_LOG_LINE!

> +
> +
> +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
> +
> +#ifdef RTE_ETHDEV_DEBUG_RX
> +extern int xsc_logtype_rx;
> +#define RTE_LOGTYPE_XSC_RX xsc_logtype_rx
> +#define PMD_RX_LOG(level, ...) \
> +       RTE_LOG_LINE_PREFIX(level, XSC_RX, "%s(): ", __func__, __VA_ARGS__)
> +#else
> +#define PMD_RX_LOG(level, ...) do { } while (0)
> +#endif
> +
> +#ifdef RTE_ETHDEV_DEBUG_TX
> +extern int xsc_logtype_tx;
> +#define RTE_LOGTYPE_XSC_TX xsc_logtype_tx
> +#define PMD_TX_LOG(level, ...) \
> +       RTE_LOG_LINE_PREFIX(level, XSC_TX, "%s(): ", __func__, __VA_ARGS__)
> +#else
> +#define PMD_TX_LOG(level, ...) do { } while (0)
> +#endif

I don't see any code calling those macros in the series, so I would
remove them for now.
You can introduce them in the future when needed.


> +
> +#define PMD_DRV_LOG_RAW(level, ...) \
> +       RTE_LOG_LINE_PREFIX(level, XSC_DRV, "%s(): ", __func__, __VA_ARGS__)
> +
> +#define PMD_DRV_LOG(level, ...) \
> +       PMD_DRV_LOG_RAW(level, __VA_ARGS__)

The PMD_DRV_LOG_RAW macro seems unused and can be removed =>
PMD_DRV_LOG() directly calls RTE_LOG_LINE_PREFIX().


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 02/19] net/xsc: add log macro
  2024-09-18  8:56 ` David Marchand
@ 2024-09-18  9:28   ` WanRenyong
  0 siblings, 0 replies; 3+ messages in thread
From: WanRenyong @ 2024-09-18  9:28 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, ferruh.yigit

On 2024/9/18 16:56, David Marchand wrote:
> On Wed, Sep 18, 2024 at 8:10 AM WanRenyong <wanry@yunsilicon.com> wrote:
>> Add log macro to print runtime messages and trace functions.
>>
>> Signed-off-by: WanRenyong <wanry@yunsilicon.com>
>>
>> ---
>>
>> v3:
>> * use RTE_LOG_LINE_PREFIX instead of rte_log
>> ---
>>   drivers/net/xsc/xsc_ethdev.c | 11 +++++++++
>>   drivers/net/xsc/xsc_log.h    | 46 ++++++++++++++++++++++++++++++++++++
>>   2 files changed, 57 insertions(+)
>>   create mode 100644 drivers/net/xsc/xsc_log.h
>>
>> diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
>> index 0e48cb76fa..58ceaa3940 100644
>> --- a/drivers/net/xsc/xsc_ethdev.c
>> +++ b/drivers/net/xsc/xsc_ethdev.c
>> @@ -1,3 +1,14 @@
>>   /* SPDX-License-Identifier: BSD-3-Clause
>>    * Copyright 2024 Yunsilicon Technology Co., Ltd.
>>    */
>> +
>> +#include "xsc_log.h"
>> +
>> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_init, init, NOTICE);
>> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_driver, driver, NOTICE);
>> +#ifdef RTE_ETHDEV_DEBUG_RX
>> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_rx, rx, DEBUG);
>> +#endif
>> +#ifdef RTE_ETHDEV_DEBUG_TX
>> +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_tx, tx, DEBUG);
>> +#endif
>> diff --git a/drivers/net/xsc/xsc_log.h b/drivers/net/xsc/xsc_log.h
>> new file mode 100644
>> index 0000000000..99a88fcd1b
>> --- /dev/null
>> +++ b/drivers/net/xsc/xsc_log.h
>> @@ -0,0 +1,46 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright 2024 Yunsilicon Technology Co., Ltd.
>> + */
>> +
>> +#ifndef _XSC_LOG_H_
>> +#define _XSC_LOG_H_
>> +
>> +#include <rte_log.h>
>> +
>> +extern int xsc_logtype_init;
>> +extern int xsc_logtype_driver;
>> +#define RTE_LOGTYPE_XSC_INIT xsc_logtype_init
>> +#define RTE_LOGTYPE_XSC_DRV xsc_logtype_driver
>> +
>> +
>> +#define PMD_INIT_LOG(level, ...) \
>> +       RTE_LOG_LINE_PREFIX(level, XSC_INIT, "%s(): ", __func__, __VA_ARGS__)
> Thank you for converting to RTE_LOG_LINE!
>
>> +
>> +
>> +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
>> +
>> +#ifdef RTE_ETHDEV_DEBUG_RX
>> +extern int xsc_logtype_rx;
>> +#define RTE_LOGTYPE_XSC_RX xsc_logtype_rx
>> +#define PMD_RX_LOG(level, ...) \
>> +       RTE_LOG_LINE_PREFIX(level, XSC_RX, "%s(): ", __func__, __VA_ARGS__)
>> +#else
>> +#define PMD_RX_LOG(level, ...) do { } while (0)
>> +#endif
>> +
>> +#ifdef RTE_ETHDEV_DEBUG_TX
>> +extern int xsc_logtype_tx;
>> +#define RTE_LOGTYPE_XSC_TX xsc_logtype_tx
>> +#define PMD_TX_LOG(level, ...) \
>> +       RTE_LOG_LINE_PREFIX(level, XSC_TX, "%s(): ", __func__, __VA_ARGS__)
>> +#else
>> +#define PMD_TX_LOG(level, ...) do { } while (0)
>> +#endif
> I don't see any code calling those macros in the series, so I would
> remove them for now.
> You can introduce them in the future when needed.
>
>
>> +
>> +#define PMD_DRV_LOG_RAW(level, ...) \
>> +       RTE_LOG_LINE_PREFIX(level, XSC_DRV, "%s(): ", __func__, __VA_ARGS__)
>> +
>> +#define PMD_DRV_LOG(level, ...) \
>> +       PMD_DRV_LOG_RAW(level, __VA_ARGS__)
> The PMD_DRV_LOG_RAW macro seems unused and can be removed =>
> PMD_DRV_LOG() directly calls RTE_LOG_LINE_PREFIX().
>
>
Hello, David,

Thanks for review, all you mentioned above will be fixed in the next 
version.

-- 
Thanks,
WanRenyong

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-18  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18  6:09 [PATCH v3 02/19] net/xsc: add log macro WanRenyong
2024-09-18  8:56 ` David Marchand
2024-09-18  9:28   ` WanRenyong

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).