Skip to contentSkip to conversation

eal: fix link status issue on ppc_64

PATCH In review David Christensen 2 participants 6 messages Oct 14, 2019 – Oct 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix link status issue on ppc_64

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, only the link speed was passed to the application, not the link state, link duplex, on link autoneg properties.

Fixes ff2863570f ("eal: introduce atomic exchange operation")
---
 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h +1 -1
index b13a80de4..7e3e13118 100644
@@ -401,7 +401,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
+	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
 }
 
 #endif
Signature · 1 line
2.18.1
#1 lore raw

Hello David,

Quoted 6 lines · David Christensen

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, only the link speed was passed to the application, not the link state, link duplex, on link autoneg properties.

Good catch.
The first impact is the link status, but you can imagine applications calling this, so I would prefer a title like "eal/ppc: fix 64bits exchange operation".
WDYT ?

rte_atomic64_exchange has no unit test.
This kind of problem could (should?) have been caught in unit tests. Maybe something to add later.

Quoted 26 lines
Fixes ff2863570f ("eal: introduce atomic exchange operation")
---
 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h +1 -2
index b13a80de4..7e3e13118 100644
@@ -401,7 +401,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-       return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
+       return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
 }
 
 #endif
--

2.18.1

Signature · 1 line
David Marchand
#2 lore raw
Quoted 7 lines
Quoted 6 lines

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, only the link speed was passed to the application, not the link state, link duplex, on link autoneg properties.

Quoted 5 lines

Good catch.
The first impact is the link status, but you can imagine applications calling this, so I would prefer a title like "eal/ppc: fix 64bits exchange operation".
WDYT ?

Sure, I can do that as a v2.

Quoted 5 lines

rte_atomic64_exchange has no unit test.
This kind of problem could (should?) have been caught in unit tests. Maybe something to add later.

I was surprised too. I'll look at adding a change to the rte_atomic.c test application.

Dave

#3 lore raw

PATCH v2 1/1 eal/ppc: fix 64 bit atomic exchange operation

In reply to David Christensen

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, applications that used rte_eth_link_get_nowait() would only receive the link speed, they would not receive the link state, link duplex, or link autoneg properties.

Fixes ff2863570f ("eal: introduce atomic exchange operation")

---
v2:
* Modified the subject line to better describe the change

 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h +1 -1
index b13a80de4..7e3e13118 100644
@@ -401,7 +401,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
+	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
 }
 
 #endif
Signature · 1 line
2.18.1
Reviewed-by on v2 1/1
#4 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] eal/ppc: fix 64 bit atomic exchange operation

Quoted 9 lines · David Christensen

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, applications that used rte_eth_link_get_nowait() would only receive the link speed, they would not receive the link state, link duplex, or link autoneg properties.

Fixes ff2863570f ("eal: introduce atomic exchange operation")

Fixes sha1 is usually on 12 digits (from the contributing guide). Will fix when applying.

Quoted 3 lines

Thanks.

Signature · 1 line
David Marchand
#5 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] eal/ppc: fix 64 bit atomic exchange operation

Quoted 13 lines · David Marchand
Quoted 9 lines · David Christensen

The rte_atomic64_exchange operation for ppc_64 incorrectly linked back to a 32 bit generic operation (__atomic_exchange_4) rather than the 64 bit generic operation (__atomic_exchange_8). As a result, applications that used rte_eth_link_get_nowait() would only receive the link speed, they would not receive the link state, link duplex, or link autoneg properties.

Fixes ff2863570f ("eal: introduce atomic exchange operation")
Quoted 8 lines

Fixes sha1 is usually on 12 digits (from the contributing guide). Will fix when applying.

Quoted 3 lines

Applied, thanks.

--
David Marchand