DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal/arm64: fix memory barrier macros
@ 2018-01-15 23:59 Thomas Monjalon
  2018-01-16  0:21 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Monjalon @ 2018-01-15 23:59 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev

The macros dsb and dmb are defined as an instruction block with braces.
As a consequence, when it is used in if/else without brace:
	if (cond)
		rte_mb();
	else
		statement;
the added semicolon is parsed outside of if/else,
so the "else" cannot match the "if":
	if (cond) {
		asm volatile("dsb sy" : : : "memory");
	}
	;
	else
		statement

The solution is either to use the "do { } while (0)" construct,
or simply remove the braces because there is only one statement.

Fixes: 84733fd0d75e ("eal/arm64: fix memory barrier definition")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/include/arch/arm/rte_atomic_64.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
index b6bbd0b32..b012dfa74 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
@@ -15,8 +15,8 @@ extern "C" {
 
 #include "generic/rte_atomic.h"
 
-#define dsb(opt)  { asm volatile("dsb " #opt : : : "memory"); }
-#define dmb(opt)  { asm volatile("dmb " #opt : : : "memory"); }
+#define dsb(opt)  asm volatile("dsb " #opt : : : "memory")
+#define dmb(opt)  asm volatile("dmb " #opt : : : "memory")
 
 #define rte_mb() dsb(sy)
 
-- 
2.15.1

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

end of thread, other threads:[~2018-01-16  0:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 23:59 [dpdk-dev] [PATCH] eal/arm64: fix memory barrier macros Thomas Monjalon
2018-01-16  0:21 ` 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).