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_gif to atomic_load/store_*.



details:   https://anonhg.NetBSD.org/src/rev/5fc1b24a1c44
branches:  trunk
changeset: 1006942:5fc1b24a1c44
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 01 02:57:45 2020 +0000

description:
Switch if_gif to atomic_load/store_*.

diffstat:

 sys/net/if_gif.c |  9 ++++-----
 sys/net/if_gif.h |  5 ++---
 2 files changed, 6 insertions(+), 8 deletions(-)

diffs (71 lines):

diff -r df59270c0e04 -r 5fc1b24a1c44 sys/net/if_gif.c
--- a/sys/net/if_gif.c  Sat Feb 01 02:54:31 2020 +0000
+++ b/sys/net/if_gif.c  Sat Feb 01 02:57:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.c,v 1.151 2020/01/29 04:18:34 thorpej Exp $     */
+/*     $NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $   */
 /*     $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $    */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.151 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -40,6 +40,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/atomic.h>
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
@@ -1125,7 +1126,6 @@
        if (error)
                goto out;
        psref_target_init(&nvar->gv_psref, gv_psref_class);
-       membar_producer();
        gif_update_variant(sc, nvar);
 
        mutex_exit(&sc->gif_lock);
@@ -1202,7 +1202,6 @@
        nvar->gv_encap_cookie6 = NULL;
        nvar->gv_output = NULL;
        psref_target_init(&nvar->gv_psref, gv_psref_class);
-       membar_producer();
        gif_update_variant(sc, nvar);
 
        mutex_exit(&sc->gif_lock);
@@ -1235,7 +1234,7 @@
 
        KASSERT(mutex_owned(&sc->gif_lock));
 
-       sc->gif_var = nvar;
+       atomic_store_release(&sc->gif_var, nvar);
        pserialize_perform(sc->gif_psz);
        psref_target_destroy(&ovar->gv_psref, gv_psref_class);
 
diff -r df59270c0e04 -r 5fc1b24a1c44 sys/net/if_gif.h
--- a/sys/net/if_gif.h  Sat Feb 01 02:54:31 2020 +0000
+++ b/sys/net/if_gif.h  Sat Feb 01 02:57:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.h,v 1.34 2019/10/30 03:45:59 knakahara Exp $    */
+/*     $NetBSD: if_gif.h,v 1.35 2020/02/01 02:57:45 riastradh Exp $    */
 /*     $KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $ */
 
 /*
@@ -101,9 +101,8 @@
        int s;
 
        s = pserialize_read_enter();
-       var = sc->gif_var;
+       var = atomic_load_consume(&sc->gif_var);
        KASSERT(var != NULL);
-       membar_datadep_consumer();
        psref_acquire(psref, &var->gv_psref, gv_psref_class);
        pserialize_read_exit(s);
 



Home | Main Index | Thread Index | Old Index