--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#include <rte_log.h>
+
+#include "otx2_common.h"
+
+/**
+ * @internal
+ */
+int otx2_logtype_base;
+/**
+ * @internal
+ */
+int otx2_logtype_mbox;
+/**
+ * @internal
+ */
+int otx2_logtype_npa;
+/**
+ * @internal
+ */
+int otx2_logtype_nix;
+/**
+ * @internal
+ */
+int otx2_logtype_npc;
+/**
+ * @internal
+ */
+int otx2_logtype_tm;
+/**
+ * @internal
+ */
+int otx2_logtype_sso;
+/**
+ * @internal
+ */
+int otx2_logtype_tim;
+/**
+ * @internal
+ */
+int otx2_logtype_dpi;
+
+RTE_INIT(otx2_log_init);
+static void
+otx2_log_init(void)
+{
+ otx2_logtype_base = rte_log_register("pmd.octeontx2.base");
+ if (otx2_logtype_base >= 0)
+ rte_log_set_level(otx2_logtype_base, RTE_LOG_NOTICE);
+
+ otx2_logtype_mbox = rte_log_register("pmd.octeontx2.mbox");
+ if (otx2_logtype_mbox >= 0)
+ rte_log_set_level(otx2_logtype_mbox, RTE_LOG_NOTICE);
+
+ otx2_logtype_npa = rte_log_register("pmd.mempool.octeontx2");
+ if (otx2_logtype_npa >= 0)
+ rte_log_set_level(otx2_logtype_npa, RTE_LOG_NOTICE);
+
+ otx2_logtype_nix = rte_log_register("pmd.net.octeontx2");
+ if (otx2_logtype_nix >= 0)
+ rte_log_set_level(otx2_logtype_nix, RTE_LOG_NOTICE);
+
+ otx2_logtype_npc = rte_log_register("pmd.net.octeontx2.flow");
+ if (otx2_logtype_npc >= 0)
+ rte_log_set_level(otx2_logtype_npc, RTE_LOG_NOTICE);
+
+ otx2_logtype_tm = rte_log_register("pmd.net.octeontx2.tm");
+ if (otx2_logtype_tm >= 0)
+ rte_log_set_level(otx2_logtype_tm, RTE_LOG_NOTICE);
+
+ otx2_logtype_sso = rte_log_register("pmd.event.octeontx2");
+ if (otx2_logtype_sso >= 0)
+ rte_log_set_level(otx2_logtype_sso, RTE_LOG_NOTICE);
+
+ otx2_logtype_tim = rte_log_register("pmd.event.octeontx2.timer");
+ if (otx2_logtype_tim >= 0)
+ rte_log_set_level(otx2_logtype_tim, RTE_LOG_NOTICE);
+
+ otx2_logtype_dpi = rte_log_register("pmd.raw.octeontx2.dpi");
+ if (otx2_logtype_dpi >= 0)
+ rte_log_set_level(otx2_logtype_dpi, RTE_LOG_NOTICE);
+}
#define __hot __attribute__((hot))
#endif
+/* Log */
+extern int otx2_logtype_base;
+extern int otx2_logtype_mbox;
+extern int otx2_logtype_npa;
+extern int otx2_logtype_nix;
+extern int otx2_logtype_sso;
+extern int otx2_logtype_npc;
+extern int otx2_logtype_tm;
+extern int otx2_logtype_tim;
+extern int otx2_logtype_dpi;
+
+#define OTX2_CLNRM "\x1b[0m"
+#define OTX2_CLRED "\x1b[31m"
+
+#define otx2_err(fmt, args...) \
+ RTE_LOG(ERR, PMD, ""OTX2_CLRED"%s():%u " fmt OTX2_CLNRM"\n", \
+ __func__, __LINE__, ## args)
+
+#define otx2_info(fmt, args...) \
+ RTE_LOG(INFO, PMD, fmt"\n", ## args)
+
+#define otx2_dbg(subsystem, fmt, args...) \
+ rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem, \
+ "[%s] %s():%u " fmt "\n", \
+ #subsystem, __func__, __LINE__, ##args)
+
+#define otx2_base_dbg(fmt, ...) otx2_dbg(base, fmt, ##__VA_ARGS__)
+#define otx2_mbox_dbg(fmt, ...) otx2_dbg(mbox, fmt, ##__VA_ARGS__)
+#define otx2_npa_dbg(fmt, ...) otx2_dbg(npa, fmt, ##__VA_ARGS__)
+#define otx2_nix_dbg(fmt, ...) otx2_dbg(nix, fmt, ##__VA_ARGS__)
+#define otx2_sso_dbg(fmt, ...) otx2_dbg(sso, fmt, ##__VA_ARGS__)
+#define otx2_npc_dbg(fmt, ...) otx2_dbg(npc, fmt, ##__VA_ARGS__)
+#define otx2_tm_dbg(fmt, ...) otx2_dbg(tm, fmt, ##__VA_ARGS__)
+#define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
+#define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
+
/* IO Access */
#define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
#define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))