From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0701D1B16C for ; Thu, 25 Jan 2018 10:46:34 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 01:46:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,411,1511856000"; d="scan'208";a="12935911" Received: from silpixa00398672.ir.intel.com ([10.237.223.111]) by orsmga008.jf.intel.com with ESMTP; 25 Jan 2018 01:46:32 -0800 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren , jerin.jacob@caviumnetworks.com Date: Thu, 25 Jan 2018 09:46:22 +0000 Message-Id: <1516873582-169644-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] event/sw: add dynamic logging support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jan 2018 09:46:35 -0000 This commit enables dynamic logging with the SW pmd. The string "pmd.event.sw" is used to change the verbosity of the logging output, as per the newly defined log naming. Signed-off-by: Harry van Haaren --- @Maintainer: Cc: jerin.jacob@caviumnetworks.com This patch is not required for 18.02 --- config/common_base | 1 - drivers/event/sw/sw_evdev.c | 12 ++++++++++++ drivers/event/sw/sw_evdev.h | 21 +-------------------- drivers/event/sw/sw_evdev_log.h | 23 +++++++++++++++++++++++ 4 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 drivers/event/sw/sw_evdev_log.h diff --git a/config/common_base b/config/common_base index 170a389..0bf87aa 100644 --- a/config/common_base +++ b/config/common_base @@ -585,7 +585,6 @@ CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV_DEBUG=n # Compile PMD for software event device # CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV=y -CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV_DEBUG=n # # Compile PMD for octeontx sso event device diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index f9daf4f..6672fd8 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -929,3 +929,15 @@ static struct rte_vdev_driver evdev_sw_pmd_drv = { RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_SW_PMD, evdev_sw_pmd_drv); RTE_PMD_REGISTER_PARAM_STRING(event_sw, NUMA_NODE_ARG "= " SCHED_QUANTA_ARG "=" CREDIT_QUANTA_ARG "="); + +/* declared extern in header, for access from other .c files */ +int eventdev_sw_log_level; + +RTE_INIT(evdev_sw_init_log); +static void +evdev_sw_init_log(void) +{ + eventdev_sw_log_level = rte_log_register("pmd.event.sw"); + if (eventdev_sw_log_level >= 0) + rte_log_set_level(eventdev_sw_log_level, RTE_LOG_NOTICE); +} diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 7498707..d90b96d 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -5,6 +5,7 @@ #ifndef _SW_EVDEV_H_ #define _SW_EVDEV_H_ +#include "sw_evdev_log.h" #include #include #include @@ -64,26 +65,6 @@ static const uint8_t sw_qe_flag_map[] = { QE_FLAG_VALID | QE_FLAG_COMPLETE | QE_FLAG_NOT_EOP, }; -#ifdef RTE_LIBRTE_PMD_EVDEV_SW_DEBUG -#define SW_LOG_INFO(fmt, args...) \ - RTE_LOG(INFO, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) - -#define SW_LOG_DBG(fmt, args...) \ - RTE_LOG(DEBUG, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) -#else -#define SW_LOG_INFO(fmt, args...) -#define SW_LOG_DBG(fmt, args...) -#endif - -#define SW_LOG_ERR(fmt, args...) \ - RTE_LOG(ERR, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) - /* Records basic event stats at a given point. Used in port and qid structs */ struct sw_point_stats { uint64_t rx_pkts; diff --git a/drivers/event/sw/sw_evdev_log.h b/drivers/event/sw/sw_evdev_log.h new file mode 100644 index 0000000..f76825a --- /dev/null +++ b/drivers/event/sw/sw_evdev_log.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#ifndef _SW_EVDEV_LOG_H_ +#define _SW_EVDEV_LOG_H_ + +extern int eventdev_sw_log_level; + +#define SW_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, eventdev_sw_log_level, "%s" fmt "\n", \ + __func__, ##args) + +#define SW_LOG_INFO(fmt, args...) \ + SW_LOG_IMPL(INFO, fmt, ## args) + +#define SW_LOG_DBG(fmt, args...) \ + SW_LOG_IMPL(DEBUG, fmt, ## args) + +#define SW_LOG_ERR(fmt, args...) \ + SW_LOG_IMPL(ERR, fmt, ## args) + +#endif /* _SW_EVDEV_LOG_H_ */ -- 2.7.4