Module Name: src
Committed By: riastradh
Date: Sat Feb 1 02:57:45 UTC 2020
Modified Files:
src/sys/net: if_gif.c if_gif.h
Log Message:
Switch if_gif to atomic_load/store_*.
To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/net/if_gif.c
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_gif.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.151 src/sys/net/if_gif.c:1.152
--- src/sys/net/if_gif.c:1.151 Wed Jan 29 04:18:34 2020
+++ src/sys/net/if_gif.c Sat Feb 1 02:57:45 2020
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1
#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 @@ gif_set_tunnel(struct ifnet *ifp, struct
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 @@ gif_delete_tunnel(struct ifnet *ifp)
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 @@ gif_update_variant(struct gif_softc *sc,
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);
Index: src/sys/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.34 src/sys/net/if_gif.h:1.35
--- src/sys/net/if_gif.h:1.34 Wed Oct 30 03:45:59 2019
+++ src/sys/net/if_gif.h Sat Feb 1 02:57:45 2020
@@ -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 @@ gif_getref_variant(struct gif_softc *sc,
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);