Skip to content

Commit 4bd2bfb

Browse files
author
riastradh
committed
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@: rmind/npf#127 (comment)
1 parent 98b4941 commit 4bd2bfb

3 files changed

Lines changed: 4 additions & 15 deletions

File tree

sys/net/npf/npf_nat.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
#ifdef _KERNEL
6969
#include <sys/cdefs.h>
70-
__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.52 2022/04/09 23:38:33 riastradh Exp $");
70+
__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.53 2023/02/24 11:03:01 riastradh Exp $");
7171

7272
#include <sys/param.h>
7373
#include <sys/types.h>
@@ -279,15 +279,11 @@ npf_natpolicy_release(npf_natpolicy_t *np)
279279
{
280280
KASSERT(atomic_load_relaxed(&np->n_refcnt) > 0);
281281

282-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
283282
membar_release();
284-
#endif
285283
if (atomic_dec_uint_nv(&np->n_refcnt) != 0) {
286284
return;
287285
}
288-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
289286
membar_acquire();
290-
#endif
291287
KASSERT(LIST_EMPTY(&np->n_nat_list));
292288
mutex_destroy(&np->n_lock);
293289
kmem_free(np, sizeof(npf_natpolicy_t));

sys/net/npf/npf_rproc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#ifdef _KERNEL
3535
#include <sys/cdefs.h>
36-
__KERNEL_RCSID(0, "$NetBSD: npf_rproc.c,v 1.22 2022/04/09 23:38:33 riastradh Exp $");
36+
__KERNEL_RCSID(0, "$NetBSD: npf_rproc.c,v 1.23 2023/02/24 11:03:01 riastradh Exp $");
3737

3838
#include <sys/param.h>
3939
#include <sys/types.h>
@@ -330,15 +330,12 @@ npf_rproc_release(npf_rproc_t *rp)
330330
{
331331
KASSERT(atomic_load_relaxed(&rp->rp_refcnt) > 0);
332332

333-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
334333
membar_release();
335-
#endif
336334
if (atomic_dec_uint_nv(&rp->rp_refcnt) != 0) {
337335
return;
338336
}
339-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
340337
membar_acquire();
341-
#endif
338+
342339
/* XXXintr */
343340
for (unsigned i = 0; i < rp->rp_ext_count; i++) {
344341
npf_ext_t *ext = rp->rp_ext[i];

sys/net/npf/npf_tableset.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#ifdef _KERNEL
4848
#include <sys/cdefs.h>
49-
__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.41 2023/01/23 13:40:04 riastradh Exp $");
49+
__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.42 2023/02/24 11:03:01 riastradh Exp $");
5050

5151
#include <sys/param.h>
5252
#include <sys/types.h>
@@ -160,14 +160,10 @@ npf_tableset_destroy(npf_tableset_t *ts)
160160

161161
if (t == NULL)
162162
continue;
163-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
164163
membar_release();
165-
#endif
166164
if (atomic_dec_uint_nv(&t->t_refcnt) > 0)
167165
continue;
168-
#ifndef __HAVE_ATOMIC_AS_MEMBAR
169166
membar_acquire();
170-
#endif
171167
npf_table_destroy(t);
172168
}
173169
kmem_free(ts, NPF_TABLESET_SIZE(ts->ts_nitems));

0 commit comments

Comments
 (0)