Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/npf npf: Eliminate __HAVE_ATOMIC_AS_MEMBAR condition...
details: https://anonhg.NetBSD.org/src/rev/ad91d79f48b1
branches: trunk
changeset: 373681:ad91d79f48b1
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Feb 24 11:03:01 2023 +0000
description:
npf: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html
Requested by rmind@:
https://github.com/rmind/npf/pull/127#issuecomment-1399573125
diffstat:
sys/net/npf/npf_nat.c | 6 +-----
sys/net/npf/npf_rproc.c | 7 ++-----
sys/net/npf/npf_tableset.c | 6 +-----
3 files changed, 4 insertions(+), 15 deletions(-)
diffs (84 lines):
diff -r bee8e23c61e6 -r ad91d79f48b1 sys/net/npf/npf_nat.c
--- a/sys/net/npf/npf_nat.c Fri Feb 24 11:02:45 2023 +0000
+++ b/sys/net/npf/npf_nat.c Fri Feb 24 11:03:01 2023 +0000
@@ -67,7 +67,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.52 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.53 2023/02/24 11:03:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -279,15 +279,11 @@
{
KASSERT(atomic_load_relaxed(&np->n_refcnt) > 0);
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_release();
-#endif
if (atomic_dec_uint_nv(&np->n_refcnt) != 0) {
return;
}
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_acquire();
-#endif
KASSERT(LIST_EMPTY(&np->n_nat_list));
mutex_destroy(&np->n_lock);
kmem_free(np, sizeof(npf_natpolicy_t));
diff -r bee8e23c61e6 -r ad91d79f48b1 sys/net/npf/npf_rproc.c
--- a/sys/net/npf/npf_rproc.c Fri Feb 24 11:02:45 2023 +0000
+++ b/sys/net/npf/npf_rproc.c Fri Feb 24 11:03:01 2023 +0000
@@ -33,7 +33,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_rproc.c,v 1.22 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_rproc.c,v 1.23 2023/02/24 11:03:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -330,15 +330,12 @@
{
KASSERT(atomic_load_relaxed(&rp->rp_refcnt) > 0);
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_release();
-#endif
if (atomic_dec_uint_nv(&rp->rp_refcnt) != 0) {
return;
}
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_acquire();
-#endif
+
/* XXXintr */
for (unsigned i = 0; i < rp->rp_ext_count; i++) {
npf_ext_t *ext = rp->rp_ext[i];
diff -r bee8e23c61e6 -r ad91d79f48b1 sys/net/npf/npf_tableset.c
--- a/sys/net/npf/npf_tableset.c Fri Feb 24 11:02:45 2023 +0000
+++ b/sys/net/npf/npf_tableset.c Fri Feb 24 11:03:01 2023 +0000
@@ -46,7 +46,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.41 2023/01/23 13:40:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.42 2023/02/24 11:03:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -160,14 +160,10 @@
if (t == NULL)
continue;
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_release();
-#endif
if (atomic_dec_uint_nv(&t->t_refcnt) > 0)
continue;
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
membar_acquire();
-#endif
npf_table_destroy(t);
}
kmem_free(ts, NPF_TABLESET_SIZE(ts->ts_nitems));
Home |
Main Index |
Thread Index |
Old Index