DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: dev@dpdk.org
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH 4/5] ring: rename local variables for Windows compatibility
Date: Thu, 16 Sep 2021 00:40:51 +0300	[thread overview]
Message-ID: <20210915214052.143098-5-dmitry.kozliuk@gmail.com> (raw)
In-Reply-To: <20210915214052.143098-1-dmitry.kozliuk@gmail.com>

Windows SDK headers define `max` macro which breaks the definitions
of `max` variable inside inline functions. Rename the variables
to allow inclusion of both DPDK and Windows headers in the same file.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/ring/rte_ring_c11_pvt.h      | 8 ++++----
 lib/ring/rte_ring_generic_pvt.h  | 8 ++++----
 lib/ring/rte_ring_rts_elem_pvt.h | 6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/ring/rte_ring_c11_pvt.h b/lib/ring/rte_ring_c11_pvt.h
index 37e0b2afd6..ec6be12154 100644
--- a/lib/ring/rte_ring_c11_pvt.h
+++ b/lib/ring/rte_ring_c11_pvt.h
@@ -58,13 +58,13 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
 {
 	const uint32_t capacity = r->capacity;
 	uint32_t cons_tail;
-	unsigned int max = n;
+	unsigned int maximum = n;
 	int success;
 
 	*old_head = __atomic_load_n(&r->prod.head, __ATOMIC_RELAXED);
 	do {
 		/* Reset n to the initial burst count */
-		n = max;
+		n = maximum;
 
 		/* Ensure the head is read before tail */
 		__atomic_thread_fence(__ATOMIC_ACQUIRE);
@@ -132,7 +132,7 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
 		uint32_t *old_head, uint32_t *new_head,
 		uint32_t *entries)
 {
-	unsigned int max = n;
+	unsigned int maximum = n;
 	uint32_t prod_tail;
 	int success;
 
@@ -140,7 +140,7 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
 	*old_head = __atomic_load_n(&r->cons.head, __ATOMIC_RELAXED);
 	do {
 		/* Restore n as it may change every loop */
-		n = max;
+		n = maximum;
 
 		/* Ensure the head is read before tail */
 		__atomic_thread_fence(__ATOMIC_ACQUIRE);
diff --git a/lib/ring/rte_ring_generic_pvt.h b/lib/ring/rte_ring_generic_pvt.h
index c95ad7e12c..beb3140e78 100644
--- a/lib/ring/rte_ring_generic_pvt.h
+++ b/lib/ring/rte_ring_generic_pvt.h
@@ -58,12 +58,12 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
 		uint32_t *free_entries)
 {
 	const uint32_t capacity = r->capacity;
-	unsigned int max = n;
+	unsigned int maximum = n;
 	int success;
 
 	do {
 		/* Reset n to the initial burst count */
-		n = max;
+		n = maximum;
 
 		*old_head = r->prod.head;
 
@@ -127,13 +127,13 @@ __rte_ring_move_cons_head(struct rte_ring *r, unsigned int is_sc,
 		uint32_t *old_head, uint32_t *new_head,
 		uint32_t *entries)
 {
-	unsigned int max = n;
+	unsigned int maximum = n;
 	int success;
 
 	/* move cons.head atomically */
 	do {
 		/* Restore n as it may change every loop */
-		n = max;
+		n = maximum;
 
 		*old_head = r->cons.head;
 
diff --git a/lib/ring/rte_ring_rts_elem_pvt.h b/lib/ring/rte_ring_rts_elem_pvt.h
index 7164213ee0..6241f28dc0 100644
--- a/lib/ring/rte_ring_rts_elem_pvt.h
+++ b/lib/ring/rte_ring_rts_elem_pvt.h
@@ -53,11 +53,11 @@ static __rte_always_inline void
 __rte_ring_rts_head_wait(const struct rte_ring_rts_headtail *ht,
 	union __rte_ring_rts_poscnt *h)
 {
-	uint32_t max;
+	uint32_t maximum;
 
-	max = ht->htd_max;
+	maximum = ht->htd_max;
 
-	while (h->val.pos - ht->tail.val.pos > max) {
+	while (h->val.pos - ht->tail.val.pos > maximum) {
 		rte_pause();
 		h->raw = __atomic_load_n(&ht->head.raw, __ATOMIC_ACQUIRE);
 	}
-- 
2.29.3


  parent reply	other threads:[~2021-09-15 21:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 21:40 [dpdk-dev] [PATCH 0/5] lib: Windows compatibility renaming Dmitry Kozlyuk
2021-09-15 21:40 ` [dpdk-dev] [PATCH 1/5] compressdev: rename fields for Windows compatibility Dmitry Kozlyuk
2021-09-23 17:06   ` Thomas Monjalon
2021-09-15 21:40 ` [dpdk-dev] [PATCH 2/5] cryptodev: " Dmitry Kozlyuk
2021-09-15 21:40 ` [dpdk-dev] [PATCH 3/5] table: rename local variable " Dmitry Kozlyuk
2021-09-15 21:40 ` Dmitry Kozlyuk [this message]
2021-09-15 22:31   ` [dpdk-dev] [PATCH 4/5] ring: rename local variables " Honnappa Nagarahalli
2021-09-15 21:40 ` [dpdk-dev] [PATCH 5/5] net: rename Ethernet header fields Dmitry Kozlyuk
2021-10-01 16:33 ` [dpdk-dev] [PATCH v2 0/2] net: Windows compatibility renaming Dmitry Kozlyuk
2021-10-01 16:33   ` [dpdk-dev] [PATCH v2 1/2] net: rename Ethernet header fields Dmitry Kozlyuk
2021-10-06 16:30     ` Thomas Monjalon
2021-10-01 16:33   ` [dpdk-dev] [PATCH v2 2/2] doc: remove unneeded deprecations Dmitry Kozlyuk
2021-10-07 22:07   ` [dpdk-dev] [PATCH v3 0/2] net: Windows compatibility renaming Dmitry Kozlyuk
2021-10-07 22:07     ` [dpdk-dev] [PATCH v3 1/2] net: rename Ethernet header fields Dmitry Kozlyuk
2021-10-08 12:54       ` Thomas Monjalon
2021-10-07 22:07     ` [dpdk-dev] [PATCH v3 2/2] doc: remove unneeded deprecations Dmitry Kozlyuk
2021-10-08 12:59     ` [dpdk-dev] [PATCH v3 0/2] net: Windows compatibility renaming Thomas Monjalon

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=20210915214052.143098-5-dmitry.kozliuk@gmail.com \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=konstantin.ananyev@intel.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).