DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause
@ 2018-01-30  8:48 Gowrishankar
  2018-01-30  8:56 ` Jerin Jacob
  2018-01-30 10:53 ` [dpdk-dev] [PATCH v2] eal/ppc: " Gowrishankar
  0 siblings, 2 replies; 6+ messages in thread
From: Gowrishankar @ 2018-01-30  8:48 UTC (permalink / raw)
  To: dev; +Cc: Olivier Matz, thomas, Gowrishankar Muthukrishnan

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

Calling rte_smp_wmb macro expands into a compound block, which
would break compiling a else clause following it, if that calling
place has been terminated already with ";", as in below code.
This patch adds { } around this macro to allow compiling else too.

Fixes: git show c9fb3c6289 ("ring: move code in a new header file")

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---

Error in compiling source:

In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0,
                 from /tmp/dpdk/lib/librte_ring/rte_ring.c:90:
/tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function ‘update_tail’:
/tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’
  else
  ^~~~
/tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed

 lib/librte_ring/rte_ring_generic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
index 8c3e65b..a668489 100644
--- a/lib/librte_ring/rte_ring_generic.h
+++ b/lib/librte_ring/rte_ring_generic.h
@@ -70,8 +70,9 @@
 update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
 		uint32_t single, uint32_t enqueue)
 {
-	if (enqueue)
+	if (enqueue) {
 		rte_smp_wmb();
+	}
 	else
 		rte_smp_rmb();
 	/*
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause
  2018-01-30  8:48 [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause Gowrishankar
@ 2018-01-30  8:56 ` Jerin Jacob
  2018-01-30  9:09   ` gowrishankar muthukrishnan
  2018-01-30 10:53 ` [dpdk-dev] [PATCH v2] eal/ppc: " Gowrishankar
  1 sibling, 1 reply; 6+ messages in thread
From: Jerin Jacob @ 2018-01-30  8:56 UTC (permalink / raw)
  To: Gowrishankar; +Cc: dev, Olivier Matz, thomas

-----Original Message-----
> Date: Tue, 30 Jan 2018 14:18:46 +0530
> From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
> To: dev@dpdk.org
> CC: Olivier Matz <olivier.matz@6wind.com>, thomas@monjalon.net,
>  Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> Subject: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else
>  clause
> X-Mailer: git-send-email 1.9.1
> 
> From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> 
> Calling rte_smp_wmb macro expands into a compound block, which
> would break compiling a else clause following it, if that calling
> place has been terminated already with ";", as in below code.
> This patch adds { } around this macro to allow compiling else too.
> 
> Fixes: git show c9fb3c6289 ("ring: move code in a new header file")
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> ---
> 
> Error in compiling source:
> 
> In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0,
>                  from /tmp/dpdk/lib/librte_ring/rte_ring.c:90:
> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function ‘update_tail’:
> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’
>   else
>   ^~~~
> /tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed
> 
>  lib/librte_ring/rte_ring_generic.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
> index 8c3e65b..a668489 100644
> --- a/lib/librte_ring/rte_ring_generic.h
> +++ b/lib/librte_ring/rte_ring_generic.h
> @@ -70,8 +70,9 @@
>  update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
>  		uint32_t single, uint32_t enqueue)
>  {
> -	if (enqueue)
> +	if (enqueue) {

Just wondering, Is it because of rte_smp_wmb() implementation of ppc64 is
not just correct?

We had a similar fix for arm64.
http://dpdk.org/browse/dpdk/commit/?id=59a3cae5305816b3739b4197d277f9455af53b9f


>  		rte_smp_wmb();
> +	}
>  	else
>  		rte_smp_rmb();
>  	/*
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause
  2018-01-30  8:56 ` Jerin Jacob
@ 2018-01-30  9:09   ` gowrishankar muthukrishnan
  2018-01-30  9:13     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: gowrishankar muthukrishnan @ 2018-01-30  9:09 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Olivier Matz, thomas

On Tuesday 30 January 2018 02:26 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Tue, 30 Jan 2018 14:18:46 +0530
>> From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
>> To: dev@dpdk.org
>> CC: Olivier Matz <olivier.matz@6wind.com>, thomas@monjalon.net,
>>   Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
>> Subject: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else
>>   clause
>> X-Mailer: git-send-email 1.9.1
>>
>> From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
>>
>> Calling rte_smp_wmb macro expands into a compound block, which
>> would break compiling a else clause following it, if that calling
>> place has been terminated already with ";", as in below code.
>> This patch adds { } around this macro to allow compiling else too.
>>
>> Fixes: git show c9fb3c6289 ("ring: move code in a new header file")
>>
>> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
>> ---
>>
>> Error in compiling source:
>>
>> In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0,
>>                   from /tmp/dpdk/lib/librte_ring/rte_ring.c:90:
>> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function ‘update_tail’:
>> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’
>>    else
>>    ^~~~
>> /tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed
>>
>>   lib/librte_ring/rte_ring_generic.h | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
>> index 8c3e65b..a668489 100644
>> --- a/lib/librte_ring/rte_ring_generic.h
>> +++ b/lib/librte_ring/rte_ring_generic.h
>> @@ -70,8 +70,9 @@
>>   update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
>>   		uint32_t single, uint32_t enqueue)
>>   {
>> -	if (enqueue)
>> +	if (enqueue) {
> Just wondering, Is it because of rte_smp_wmb() implementation of ppc64 is
> not just correct?
>
> We had a similar fix for arm64.
> http://dpdk.org/browse/dpdk/commit/?id=59a3cae5305816b3739b4197d277f9455af53b9f
Thanks Jerin. Yes. Similar fix also works. I did not want to touch 
include/ at this time, as it is called at various places in source.
As same problem is seen in arm64, I think it is ok to go with your 
change. If so, I can send version 2 patch with similar change as you showed.

Thanks,
Gowrishankar

>
>>   		rte_smp_wmb();
>> +	}
>>   	else
>>   		rte_smp_rmb();
>>   	/*
>> -- 
>> 1.9.1
>>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause
  2018-01-30  9:09   ` gowrishankar muthukrishnan
@ 2018-01-30  9:13     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2018-01-30  9:13 UTC (permalink / raw)
  To: gowrishankar muthukrishnan; +Cc: Jerin Jacob, dev, Olivier Matz

30/01/2018 10:09, gowrishankar muthukrishnan:
> On Tuesday 30 January 2018 02:26 PM, Jerin Jacob wrote:
> > -----Original Message-----
> >> Date: Tue, 30 Jan 2018 14:18:46 +0530
> >> From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
> >> To: dev@dpdk.org
> >> CC: Olivier Matz <olivier.matz@6wind.com>, thomas@monjalon.net,
> >>   Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> >> Subject: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else
> >>   clause
> >> X-Mailer: git-send-email 1.9.1
> >>
> >> From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> >>
> >> Calling rte_smp_wmb macro expands into a compound block, which
> >> would break compiling a else clause following it, if that calling
> >> place has been terminated already with ";", as in below code.
> >> This patch adds { } around this macro to allow compiling else too.
> >>
> >> Fixes: git show c9fb3c6289 ("ring: move code in a new header file")
> >>
> >> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> >> ---
> >>
> >> Error in compiling source:
> >>
> >> In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0,
> >>                   from /tmp/dpdk/lib/librte_ring/rte_ring.c:90:
> >> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function ‘update_tail’:
> >> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’
> >>    else
> >>    ^~~~
> >> /tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed
> >>
> >>   lib/librte_ring/rte_ring_generic.h | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
> >> index 8c3e65b..a668489 100644
> >> --- a/lib/librte_ring/rte_ring_generic.h
> >> +++ b/lib/librte_ring/rte_ring_generic.h
> >> @@ -70,8 +70,9 @@
> >>   update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
> >>   		uint32_t single, uint32_t enqueue)
> >>   {
> >> -	if (enqueue)
> >> +	if (enqueue) {
> > Just wondering, Is it because of rte_smp_wmb() implementation of ppc64 is
> > not just correct?
> >
> > We had a similar fix for arm64.
> > http://dpdk.org/browse/dpdk/commit/?id=59a3cae5305816b3739b4197d277f9455af53b9f
> Thanks Jerin. Yes. Similar fix also works. I did not want to touch 
> include/ at this time, as it is called at various places in source.
> As same problem is seen in arm64, I think it is ok to go with your 
> change. If so, I can send version 2 patch with similar change as you showed.

Please send a patch for the fix in atomics.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] eal/ppc: fix compilation error with a broken else clause
  2018-01-30  8:48 [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause Gowrishankar
  2018-01-30  8:56 ` Jerin Jacob
@ 2018-01-30 10:53 ` Gowrishankar
  2018-01-30 13:46   ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Gowrishankar @ 2018-01-30 10:53 UTC (permalink / raw)
  To: dev; +Cc: Chao Zhu, Olivier Matz, thomas, Gowrishankar Muthukrishnan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2136 bytes --]

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

Calling rte_smp_{w/r}mb macro expands into a compound block, which
would break compiling a else clause following it, if that calling
place has been terminated already with ";", as in below code.
This patch adds { } around this macro to allow compiling else too.

Fixes: d23a6bd04d ("eal/ppc: fix memory barrier for IBM POWER")
Fixes: 05c3fd7110 ("eal/ppc: atomic operations for IBM Power")

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---

v2:
  fixed ppc_64 atomic defines for a below error.

In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0,
                 from /tmp/dpdk/lib/librte_ring/rte_ring.c:90:
/tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function ‘update_tail’:
/tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’
  else
  ^~~~
/tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed


 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
index f38618f..39fce7b 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
@@ -64,9 +64,9 @@
  * occur before the STORE operations generated after.
  */
 #ifdef RTE_ARCH_64
-#define	rte_wmb() {asm volatile("lwsync" : : : "memory"); }
+#define	rte_wmb() asm volatile("lwsync" : : : "memory")
 #else
-#define	rte_wmb() {asm volatile("sync" : : : "memory"); }
+#define	rte_wmb() asm volatile("sync" : : : "memory")
 #endif
 
 /**
@@ -76,9 +76,9 @@
  * occur before the LOAD operations generated after.
  */
 #ifdef RTE_ARCH_64
-#define	rte_rmb() {asm volatile("lwsync" : : : "memory"); }
+#define	rte_rmb() asm volatile("lwsync" : : : "memory")
 #else
-#define	rte_rmb() {asm volatile("sync" : : : "memory"); }
+#define	rte_rmb() asm volatile("sync" : : : "memory")
 #endif
 
 #define rte_smp_mb() rte_mb()
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal/ppc: fix compilation error with a broken else clause
  2018-01-30 10:53 ` [dpdk-dev] [PATCH v2] eal/ppc: " Gowrishankar
@ 2018-01-30 13:46   ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2018-01-30 13:46 UTC (permalink / raw)
  To: Gowrishankar; +Cc: dev, Chao Zhu, Olivier Matz

30/01/2018 11:53, Gowrishankar:
> From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
> 
> Calling rte_smp_{w/r}mb macro expands into a compound block, which
> would break compiling a else clause following it, if that calling
> place has been terminated already with ";", as in below code.
> This patch adds { } around this macro to allow compiling else too.
> 
> Fixes: d23a6bd04d ("eal/ppc: fix memory barrier for IBM POWER")
> Fixes: 05c3fd7110 ("eal/ppc: atomic operations for IBM Power")
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-30 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30  8:48 [dpdk-dev] [PATCH] ring: fix compilation error with a broken else clause Gowrishankar
2018-01-30  8:56 ` Jerin Jacob
2018-01-30  9:09   ` gowrishankar muthukrishnan
2018-01-30  9:13     ` Thomas Monjalon
2018-01-30 10:53 ` [dpdk-dev] [PATCH v2] eal/ppc: " Gowrishankar
2018-01-30 13:46   ` Thomas Monjalon

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).