DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] lib/ethdev: replace full barrier with relaxed barrier
@ 2020-10-02  0:07 Honnappa Nagarahalli
  2020-10-02  0:07 ` [dpdk-dev] [PATCH 2/2] lib/ethdev: fix memory ordering for call back functions Honnappa Nagarahalli
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Honnappa Nagarahalli @ 2020-10-02  0:07 UTC (permalink / raw)
  To: dev, honnappa.nagarahalli, phil.yang, thomas, arybchenko, ferruh.yigit
  Cc: abhinandan.gujjar, nd

From: Phil Yang <phil.yang@arm.com>

While registering the call back functions full write barrier
can be replaced with one-way write barrier.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/librte_ethdev/rte_ethdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 7858ad5f1..59a41c07f 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -26,7 +26,6 @@
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_mempool.h>
@@ -4527,8 +4526,12 @@ rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
 	rte_spinlock_lock(&rte_eth_rx_cb_lock);
 	/* Add the callbacks at first position */
 	cb->next = rte_eth_devices[port_id].post_rx_burst_cbs[queue_id];
-	rte_smp_wmb();
-	rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
+	/* Stores to cb->fn, cb->param and cb->next should complete before
+	 * cb is visible to data plane threads.
+	 */
+	__atomic_store_n(
+		&rte_eth_devices[port_id].post_rx_burst_cbs[queue_id],
+		cb, __ATOMIC_RELEASE);
 	rte_spinlock_unlock(&rte_eth_rx_cb_lock);
 
 	return cb;
-- 
2.17.1


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

end of thread, other threads:[~2020-10-14 16:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02  0:07 [dpdk-dev] [PATCH 1/2] lib/ethdev: replace full barrier with relaxed barrier Honnappa Nagarahalli
2020-10-02  0:07 ` [dpdk-dev] [PATCH 2/2] lib/ethdev: fix memory ordering for call back functions Honnappa Nagarahalli
2020-10-09  2:34   ` Phil Yang
2020-10-13 10:32   ` Ferruh Yigit
2020-10-13 15:25     ` Honnappa Nagarahalli
2020-10-13 14:25   ` Ananyev, Konstantin
2020-10-13 10:30 ` [dpdk-dev] [PATCH 1/2] lib/ethdev: replace full barrier with relaxed barrier Ferruh Yigit
2020-10-13 14:24 ` Ananyev, Konstantin
2020-10-13 16:25 ` [dpdk-dev] [PATCH v2 " Honnappa Nagarahalli
2020-10-13 16:25   ` [dpdk-dev] [PATCH v2 2/2] lib/ethdev: fix memory ordering for call back functions Honnappa Nagarahalli
2020-10-14 16:36   ` [dpdk-dev] [PATCH v2 1/2] lib/ethdev: replace full barrier with relaxed barrier Ferruh Yigit

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