DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>,
	nd <nd@arm.com>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH 4/5] ring: rename local variables for Windows compatibility
Date: Wed, 15 Sep 2021 22:31:53 +0000	[thread overview]
Message-ID: <DBAPR08MB581469E4DA881EBC767B22CC98DB9@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20210915214052.143098-5-dmitry.kozliuk@gmail.com>

<snip>

> 
> 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.
Minor comment, typically we include the error message in the commit log. In this case, even though it is obvious, it does not hurt to include it.

> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.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


  reply	other threads:[~2021-09-15 22:32 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 ` [dpdk-dev] [PATCH 4/5] ring: rename local variables " Dmitry Kozlyuk
2021-09-15 22:31   ` Honnappa Nagarahalli [this message]
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=DBAPR08MB581469E4DA881EBC767B22CC98DB9@DBAPR08MB5814.eurprd08.prod.outlook.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=nd@arm.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).