Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/npf Don't hold softnet_lock if NET_MPSAFE.
details: https://anonhg.NetBSD.org/src/rev/72964a683d7c
branches: trunk
changeset: 821191:72964a683d7c
user: ryo <ryo%NetBSD.org@localhost>
date: Fri Jan 27 17:25:34 2017 +0000
description:
Don't hold softnet_lock if NET_MPSAFE.
Some functions lock softnet_lock while waiting in pserialize_perform() in pfil_add_hook().
(e.g. key_timehandler(), etc)
diffstat:
sys/net/npf/npf_os.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (70 lines):
diff -r 54d93ac01f12 -r 72964a683d7c sys/net/npf/npf_os.c
--- a/sys/net/npf/npf_os.c Fri Jan 27 17:21:51 2017 +0000
+++ b/sys/net/npf/npf_os.c Fri Jan 27 17:25:34 2017 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index