@@ -1,4 +1,4 @@
-/* $NetBSD: npf_os.c,v 1.5 2017/01/03 00:58:05 rmind Exp $ */
+/* $NetBSD: npf_os.c,v 1.6 2017/01/27 17:25:34 ryo Exp $ */
/*-
* Copyright (c) 2009-2016 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.5 2017/01/03 00:58:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.6 2017/01/27 17:25:34 ryo Exp $");
#ifdef _KERNEL_OPT
#include "pf.h"
@@ -65,6 +65,7 @@
#ifdef _KERNEL
#ifndef _MODULE
#include "opt_modular.h"
+#include "opt_net_mpsafe.h"
#endif
#include "ioconf.h"
#endif
@@ -396,8 +397,10 @@
npf_t *npf = npf_getkernctx();
int error = 0;
+#ifndef NET_MPSAFE
mutex_enter(softnet_lock);
KERNEL_LOCK(1, NULL);
+#endif
/* Init: interface re-config and attach/detach hook. */
if (!npf_ph_if) {
@@ -452,8 +455,10 @@
npf_ifaddr_syncall(npf);
pfil_registered = true;
out:
+#ifndef NET_MPSAFE
KERNEL_UNLOCK_ONE(NULL);
mutex_exit(softnet_lock);
+#endif
return error;
}
@@ -466,8 +471,10 @@
{
npf_t *npf = npf_getkernctx();
+#ifndef NET_MPSAFE
mutex_enter(softnet_lock);
KERNEL_LOCK(1, NULL);
+#endif
if (fini && npf_ph_if) {
(void)pfil_remove_ihook(npf_ifhook, NULL,
@@ -485,8 +492,10 @@
}
pfil_registered = false;
+#ifndef NET_MPSAFE
KERNEL_UNLOCK_ONE(NULL);
mutex_exit(softnet_lock);
+#endif
}
bool