DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Cc: Jeff Shaw <jeffrey.b.shaw@intel.com>, dev@dpdk.org
Subject: [dpdk-dev] [PATCH] eal: simplify RTE_PMD_DEBUG_TRACE
Date: Fri, 14 Dec 2018 12:50:55 -0800	[thread overview]
Message-ID: <20181214125055.1153c38c@xeon-e3> (raw)
In-Reply-To: <3a573b56-6ea0-812c-4641-830fbd3c59cc@ericsson.com>

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 <jeffrey.b.shaw@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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

  reply	other threads:[~2018-12-14 20:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 16:38 [dpdk-dev] [PATCH] eal: remove variable length array Jeff Shaw
2018-12-14 18:36 ` Stephen Hemminger
2018-12-14 18:59   ` Jeff Shaw
2018-12-14 19:17     ` Jeff Shaw
2018-12-14 18:36 ` Mattias Rönnblom
2018-12-14 19:07   ` Jeff Shaw
2018-12-14 20:28     ` Mattias Rönnblom
2018-12-14 20:50       ` Stephen Hemminger [this message]
2018-12-14 21:20         ` [dpdk-dev] [PATCH] eal: simplify RTE_PMD_DEBUG_TRACE Jeff Shaw
2018-12-14 21:57           ` Stephen Hemminger
2018-12-21 16:17           ` Ferruh Yigit
2018-12-21 18:11         ` [dpdk-dev] [PATCH v2] " Jeff Shaw
2018-12-21 18:18           ` [dpdk-dev] [PATCH v3] " Jeff Shaw
2018-12-22  0:37             ` Ferruh Yigit
2018-12-19 21:45       ` [dpdk-dev] [PATCH] eal: remove variable length array Thomas Monjalon
2018-12-20 10:53         ` Mattias Rönnblom
2018-12-20 11:03           ` Thomas Monjalon
2018-12-14 20:40 ` [dpdk-dev] [PATCH v2] " Jeff Shaw
2018-12-15 14:26   ` Wiles, Keith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181214125055.1153c38c@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=jeffrey.b.shaw@intel.com \
    --cc=mattias.ronnblom@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).