All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, thomas@monjalon.net,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2] eal: provide per lcore macros for MSVC
Date: Tue, 11 Jul 2023 08:52:27 -0700	[thread overview]
Message-ID: <1689090747-5331-2-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1689090747-5331-1-git-send-email-roretzla@linux.microsoft.com>

Provide per lcore macros that use __declspec(thread) and uses C23
typeof.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_per_lcore.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h
index eaedf0c..2b846f9 100644
--- a/lib/eal/include/rte_per_lcore.h
+++ b/lib/eal/include/rte_per_lcore.h
@@ -24,19 +24,27 @@
 
 #include <pthread.h>
 
+#ifdef RTE_TOOLCHAIN_MSVC
 /**
  * Macro to define a per lcore variable "var" of type "type", don't
  * use keywords like "static" or "volatile" in type, just prefix the
  * whole macro.
  */
 #define RTE_DEFINE_PER_LCORE(type, name)			\
-	__thread __typeof__(type) per_lcore_##name
+	__declspec(thread) typeof(type) per_lcore_##name
 
 /**
  * Macro to declare an extern per lcore variable "var" of type "type"
  */
 #define RTE_DECLARE_PER_LCORE(type, name)			\
+	extern __declspec(thread) typeof(type) per_lcore_##name
+#else
+#define RTE_DEFINE_PER_LCORE(type, name)			\
+	__thread __typeof__(type) per_lcore_##name
+
+#define RTE_DECLARE_PER_LCORE(type, name)			\
 	extern __thread __typeof__(type) per_lcore_##name
+#endif
 
 /**
  * Read/write the per-lcore variable value
-- 
1.8.3.1


  reply	other threads:[~2023-07-11 15:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 21:29 [PATCH] provide Windows/MSVC lcore macros Tyler Retzlaff
2023-07-10 21:29 ` [PATCH] eal: provide per lcore macros for MSVC Tyler Retzlaff
2023-07-11  6:25   ` Thomas Monjalon
2023-07-11 15:52 ` [PATCH v2] provide Windows/MSVC lcore macros Tyler Retzlaff
2023-07-11 15:52   ` Tyler Retzlaff [this message]
2023-07-11 16:09     ` [PATCH v2] eal: provide per lcore macros for MSVC Stephen Hemminger
2023-08-25  8:49       ` David Marchand
2023-08-31 11:57     ` Thomas Monjalon
2023-08-31 23:08       ` Tyler Retzlaff
2023-09-21  9:36         ` Thomas Monjalon
2023-09-21 15:45           ` Tyler Retzlaff

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=1689090747-5331-2-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.