From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E7EB91BDAF for ; Fri, 21 Dec 2018 19:22:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Dec 2018 10:21:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,382,1539673200"; d="scan'208";a="120775218" Received: from ae13-28.jf.intel.com ([10.166.188.62]) by orsmga001.jf.intel.com with ESMTP; 21 Dec 2018 10:21:39 -0800 From: Jeff Shaw To: dev@dpdk.org Cc: mattias.ronnblom@ericsson.com, stephen@networkplumber.org, jeffrey.b.shaw@intel.com, ferruh.yigit@intel.com Date: Fri, 21 Dec 2018 10:18:08 -0800 Message-Id: <20181221181808.47816-1-jeffrey.b.shaw@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181221181159.47304-1-jeffrey.b.shaw@intel.com> References: <20181221181159.47304-1-jeffrey.b.shaw@intel.com> Subject: [dpdk-dev] [PATCH v3] eal: simplify RTE_PMD_DEBUG_TRACE 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: Fri, 21 Dec 2018 18:22:19 -0000 From: Stephen Hemminger Use rte_log directly, eliminating no longer used rte_pmd_dev_trace function. This removes variable length array which is problem on Windows and other compilers not doing C99. Also, drop unused RTE_PROC_PRIMARY macros. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Shaw --- V3: - Fix checkpatch error: ERROR:SPACING: space required before the open parenthesis '(' V2: - Changed named variable "args..." to use "..." with ##__VA_LIST__. Pasting is necessary to support case where only the format string, with no arguments, is passed. --- lib/librte_eal/common/include/rte_dev.h | 44 +++------------------------------ 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index a9724dc91..d7b3c1576 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -43,54 +43,18 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name, enum rte_dev_event_type event, void *cb_arg); -__attribute__((format(printf, 2, 0))) -static inline void -rte_pmd_debug_trace(const char *func_name, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - { - char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; - - va_end(ap); - - va_start(ap, fmt); - vsnprintf(buffer, sizeof(buffer), fmt, ap); - va_end(ap); - - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", - func_name, buffer); - } -} - /* * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the * RTE_*_RET() macros defined below is compiled in debug mode. */ #if defined(RTE_LIBRTE_EVENTDEV_DEBUG) -#define RTE_PMD_DEBUG_TRACE(...) \ - rte_pmd_debug_trace(__func__, __VA_ARGS__) +#define RTE_PMD_DEBUG_TRACE(fmt, ...) \ + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: " fmt, __func__, \ + ##__VA_ARGS__) #else -#define RTE_PMD_DEBUG_TRACE(...) (void)0 +#define RTE_PMD_DEBUG_TRACE(...) do { } while (0) #endif -/* Macros for checking for restricting functions to primary instance only */ -#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ - return retval; \ - } \ -} while (0) - -#define RTE_PROC_PRIMARY_OR_RET() do { \ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ - return; \ - } \ -} while (0) - /* Macros to check for invalid function pointers */ #define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \ if ((func) == NULL) { \ -- 2.14.3