Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Use atomic_load/store_* in ena(4), not questiona...



details:   https://anonhg.NetBSD.org/src/rev/26d4b2744970
branches:  trunk
changeset: 744409:26d4b2744970
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 01 02:32:40 2020 +0000

description:
Use atomic_load/store_* in ena(4), not questionable membar_sync.

diffstat:

 sys/dev/pci/if_ena.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 54cfc1a0b6ad -r 26d4b2744970 sys/dev/pci/if_ena.c
--- a/sys/dev/pci/if_ena.c      Sat Feb 01 02:23:23 2020 +0000
+++ b/sys/dev/pci/if_ena.c      Sat Feb 01 02:32:40 2020 +0000
@@ -31,7 +31,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.19 2019/12/02 03:06:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.20 2020/02/01 02:32:40 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3349,7 +3349,6 @@
 {
        struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
        struct ena_admin_aenq_keep_alive_desc *desc;
-       sbintime_t stime;
        uint64_t rx_drops;
 
        desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
@@ -3358,8 +3357,7 @@
        counter_u64_zero(adapter->hw_stats.rx_drops);
        counter_u64_add(adapter->hw_stats.rx_drops, rx_drops);
 
-       stime = getsbinuptime();
-       (void) atomic_swap_64(&adapter->keep_alive_timestamp, stime);
+       atomic_store_release(&adapter->keep_alive_timestamp, getsbinuptime());
 }
 
 /* Check for keep alive expiration */
@@ -3373,9 +3371,7 @@
        if (likely(adapter->keep_alive_timeout == 0))
                return;
 
-       /* FreeBSD uses atomic_load_acq_64() in place of the membar + read */
-       membar_sync();
-       timestamp = adapter->keep_alive_timestamp;
+       timestamp = atomic_load_acquire(&adapter->keep_alive_timestamp);
 
        time = getsbinuptime() - timestamp;
        if (unlikely(time > adapter->keep_alive_timeout)) {



Home | Main Index | Thread Index | Old Index