Source-Changes-HG archive

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

[src/trunk]: src/sys/net Switch if_vlan to atomic_load/store_*.



details:   https://anonhg.NetBSD.org/src/rev/8a49e128ef49
branches:  trunk
changeset: 744416:8a49e128ef49
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 01 02:58:15 2020 +0000

description:
Switch if_vlan to atomic_load/store_*.

Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
vlan_lookup_tag_psref.

diffstat:

 sys/net/if_vlan.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (51 lines):

diff -r ee07fcae8c8d -r 8a49e128ef49 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Sat Feb 01 02:58:05 2020 +0000
+++ b/sys/net/if_vlan.c Sat Feb 01 02:58:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $    */
+/*     $NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $  */
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -780,12 +780,11 @@
        int s;
 
        s = pserialize_read_enter();
-       mib = sc->ifv_mib;
+       mib = atomic_load_consume(&sc->ifv_mib);
        if (mib == NULL) {
                pserialize_read_exit(s);
                return NULL;
        }
-       membar_datadep_consumer();
        psref_acquire(psref, &mib->ifvm_psref, ifvm_psref_class);
        pserialize_read_exit(s);
 
@@ -812,7 +811,7 @@
        s = pserialize_read_enter();
        PSLIST_READER_FOREACH(sc, &ifv_hash.lists[idx], struct ifvlan,
            ifv_hash) {
-               struct ifvlan_linkmib *mib = sc->ifv_mib;
+               struct ifvlan_linkmib *mib = atomic_load_consume(&sc->ifv_mib);
                if (mib == NULL)
                        continue;
                if (mib->ifvm_tag != tag)
@@ -835,8 +834,7 @@
 
        KASSERT(mutex_owned(&ifv->ifv_lock));
 
-       membar_producer();
-       ifv->ifv_mib = nmib;
+       atomic_store_release(&ifv->ifv_mib, nmib);
 
        pserialize_perform(ifv->ifv_psz);
        psref_target_destroy(&omib->ifvm_psref, ifvm_psref_class);



Home | Main Index | Thread Index | Old Index