summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2019-07-16 11:55:30 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-08-27 10:44:14 +0200
commita9b28a4391b2a3a9f1afc0bf98a2b3a01aed9473 (patch)
treeb6e68dd7320592888665c3319d8a296c93dfd03b
parent18fab3a918301842a07676d8a72de79cfbcf5644 (diff)
downloaddpdk-next-eventdev-a9b28a4391b2a3a9f1afc0bf98a2b3a01aed9473.zip
dpdk-next-eventdev-a9b28a4391b2a3a9f1afc0bf98a2b3a01aed9473.tar.gz
dpdk-next-eventdev-a9b28a4391b2a3a9f1afc0bf98a2b3a01aed9473.tar.xz
net/ark: implement dynamic log type
The generic RTE_LOGTYPE_PMD is a historical relic and should be deprecated. Every driver must register its own logtype. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--drivers/net/ark/ark_ethdev.c9
-rw-r--r--drivers/net/ark/ark_logs.h25
2 files changed, 23 insertions, 11 deletions
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 3435728..4c807f8 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -78,6 +78,8 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
+int ark_logtype;
+
static const char * const valid_arguments[] = {
ARK_PKTGEN_ARG,
ARK_PKTCHKR_ARG,
@@ -1012,3 +1014,10 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ark,
ARK_PKTGEN_ARG "=<filename> "
ARK_PKTCHKR_ARG "=<filename> "
ARK_PKTDIR_ARG "=<bitmap>");
+
+RTE_INIT(ark_init_log)
+{
+ ark_logtype = rte_log_register("pmd.net.ark");
+ if (ark_logtype >= 0)
+ rte_log_set_level(ark_logtype, RTE_LOG_NOTICE);
+}
diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h
index b90e9f0..44aac61 100644
--- a/drivers/net/ark/ark_logs.h
+++ b/drivers/net/ark/ark_logs.h
@@ -26,29 +26,32 @@
#define ARK_SU64X "\n\t%-20s %#20" PRIx64
#define ARK_SPTR "\n\t%-20s %20p"
-
+extern int ark_logtype;
#define PMD_DRV_LOG(level, fmt, args...) \
- RTE_LOG(level, PMD, fmt, ## args)
+ rte_log(RTE_LOG_ ##level, ark_logtype, fmt, ## args)
/* Conditional trace definitions */
-#define ARK_TRACE_ON(level, fmt, ...) \
- RTE_LOG(level, PMD, fmt, ##__VA_ARGS__)
+#define ARK_TRACE_ON(level, fmt, args...) \
+ PMD_DRV_LOG(level, fmt, ## args)
/* This pattern allows compiler check arguments even if disabled */
-#define ARK_TRACE_OFF(level, fmt, ...) \
- do {if (0) RTE_LOG(level, PMD, fmt, ##__VA_ARGS__); } \
- while (0)
-
+#define ARK_TRACE_OFF(level, fmt, args...) \
+ do { \
+ if (0) \
+ PMD_DRV_LOG(level, fmt, ## args); \
+ } while (0)
/* tracing including the function name */
#define ARK_FUNC_ON(level, fmt, args...) \
- RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+ PMD_DRV_LOG(level, "%s(): " fmt, __func__, ## args)
/* tracing including the function name */
#define ARK_FUNC_OFF(level, fmt, args...) \
- do { if (0) RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args); } \
- while (0)
+ do { \
+ if (0) \
+ PMD_DRV_LOG(level, "%s(): " fmt, __func__, ## args); \
+ } while (0)
/* Debug macro for tracing full behavior, function tracing and messages*/