@@ -179,3 +179,43 @@ RTE_PMD_REGISTER_PCI(net_r8169, rte_r8169_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_r8169, pci_id_r8169_map);
RTE_PMD_REGISTER_KMOD_DEP(net_r8169, "* igb_uio | uio_pci_generic | vfio-pci");
+int r8169_logtype_init;
+int r8169_logtype_driver;
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_RX
+int r8169_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX
+int r8169_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX_FREE
+int r8169_logtype_tx_free;
+#endif
+
+RTE_INIT(r8169_init_log)
+{
+ r8169_logtype_init = rte_log_register("pmd.net.r8169.init");
+ if (r8169_logtype_init >= 0)
+ rte_log_set_level(r8169_logtype_init, RTE_LOG_NOTICE);
+ r8169_logtype_driver = rte_log_register("pmd.net.r8169.driver");
+ if (r8169_logtype_driver >= 0)
+ rte_log_set_level(r8169_logtype_driver, RTE_LOG_NOTICE);
+#ifdef RTE_LIBRTE_R8169_DEBUG_RX
+ r8169_logtype_rx = rte_log_register("pmd.net.r8169.rx");
+ if (r8169_logtype_rx >= 0)
+ rte_log_set_level(r8169_logtype_rx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX
+ r8169_logtype_tx = rte_log_register("pmd.net.r8169.tx");
+ if (r8169_logtype_tx >= 0)
+ rte_log_set_level(r8169_logtype_tx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX_FREE
+ r8169_logtype_tx_free = rte_log_register("pmd.net.r8169.tx_free");
+ if (r8169_logtype_tx_free >= 0)
+ rte_log_set_level(r8169_logtype_tx_free, RTE_LOG_DEBUG);
+#endif
+}
+
new file mode 100644
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Realtek Corporation. All rights reserved
+ */
+
+#ifndef _R8169_LOGS_H_
+#define _R8169_LOGS_H_
+
+#include <rte_log.h>
+
+extern int r8169_logtype_init;
+#define PMD_INIT_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, r8169_logtype_init, \
+ "%s(): " fmt "\n", __func__, ##args)
+
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_RX
+extern int r8169_logtype_rx;
+#define PMD_RX_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, r8169_logtype_rx, \
+ "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX
+extern int r8169_logtype_tx;
+#define PMD_TX_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, r8169_logtype_tx, \
+ "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_R8169_DEBUG_TX_FREE
+extern int r8169_logtype_tx_free;
+#define PMD_TX_FREE_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, r8169_logtype_tx_free, \
+ "%s(): " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+extern int r8169_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, r8169_logtype_driver, "%s(): " fmt, \
+ __func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+ PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+
+#endif /* _R8169_LOGS_H_ */
+