From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 5D4101B946 for ; Fri, 14 Dec 2018 21:50:59 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id w6so3207269pgl.6 for ; Fri, 14 Dec 2018 12:50:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aDW+SxmUG4mliVfUt3ao7pz+OXpa4sxdkKsYCtKdbWc=; b=oWssoH1uEN6iYropXy2MCDQAt04Dw6Cwl5mhLilxZqOimVC9Dt7yZHiFvfKz0zK+us 00h3wZPSxsB2h/Yzs1CYLe6n7Ev7wCTXcQqe/couhrTlZIJwd//y+TNfGXv2nMBrWsSu oljGvatU+/tDT1AfMntcKjlQ8MeLv+x9kjvNscppRMv+LTJN6xDLE3EwUC2XfqLJU1i5 b6hElD/KWzjkA0jbJ41XU9mkzqXlZBnCTM78RCWGXPuJfoMzIeH382JbH6V2fY2NP68v 7zu6as3RV+ix/sXsXrbpcl03DLOJhuLfavo/BxR8P7HdyYjIQKqxdiLw4zHtIUqS5KfA seIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aDW+SxmUG4mliVfUt3ao7pz+OXpa4sxdkKsYCtKdbWc=; b=d413GmpBVjh6FM9RqtOrWXtEL98pQPXUtL8+m0umFGpzm3ZWlacnqHScyN+S5eGetn M7PvZRf4SBx+Kp8SzJiDTssCmKQCwIFQMgo+W5sg+wal2HkZBZwmgvTVD0s+j7cWp8w3 S1poQcxlTjR2Lew7yepgMTFdkOxDERKOoYIN8R0YX2Y/mETSzRjuwu+Xgt7A/YYE/V8c up0tQkcOOFXGTk1bcJRY75zuGauQIewnfCvLgfAt10iIIIjkmx8Wb5+a5cYv4vfkUBDr 6gc+jjTAL3WAbqa83PQVpQIdqRjAE+iSgcwn5qefEeu40zViOYZd7dmqt2XM2JiCeijq vVsw== X-Gm-Message-State: AA+aEWYcqbwReIibmo4ZE7aRFVs9UPzGlNti+wzuTXGoEUygCV4LxGzh Ju94j1KgleqMyJpjMrWcKlq6tg== X-Google-Smtp-Source: AFSGD/XxofIMdaXltW6uTdKRX9Iokk93NJ5utBfLs45etknnlqV+yMPhVkABBX0LoAPb8G36dE0Ipg== X-Received: by 2002:a63:2643:: with SMTP id m64mr3966317pgm.35.1544820658281; Fri, 14 Dec 2018 12:50:58 -0800 (PST) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w136sm9219385pfd.169.2018.12.14.12.50.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 12:50:58 -0800 (PST) Date: Fri, 14 Dec 2018 12:50:55 -0800 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: Jeff Shaw , dev@dpdk.org Message-ID: <20181214125055.1153c38c@xeon-e3> In-Reply-To: <3a573b56-6ea0-812c-4641-830fbd3c59cc@ericsson.com> References: <20181214163827.9403-1-jeffrey.b.shaw@intel.com> <20181214190713.GB9964@ae13-28.jf.intel.com> <3a573b56-6ea0-812c-4641-830fbd3c59cc@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH] 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, 14 Dec 2018 20:50:59 -0000 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. Reported-by: Jeff Shaw Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/include/rte_dev.h | 43 ++----------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index a9724dc9181c..e496da440028 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -43,54 +43,17 @@ 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, args...) \ + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s():" fmt, __func__, ## 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.19.2