summaryrefslogtreecommitdiffstats
path: root/sys/netnatm/natm_proto.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-07-18 16:55:46 +0000
committerrwatson <rwatson@FreeBSD.org>2005-07-18 16:55:46 +0000
commite11e852d543aa406f0dcc3d72a625f42369d800c (patch)
tree00048222471599cfa918cd1294924cfab8eb7d6b /sys/netnatm/natm_proto.c
parent32252b633fbaaf2e3a098f36c1c7846a7bedeb0c (diff)
downloadFreeBSD-src-e11e852d543aa406f0dcc3d72a625f42369d800c.zip
FreeBSD-src-e11e852d543aa406f0dcc3d72a625f42369d800c.tar.gz
Lock down netnatm and mark as MPSAFE:
- Introduce a subsystem mutex, natm_mtx, manipulated with accessor macros NATM_LOCK_INIT(), NATM_LOCK(), NATM_UNLOCK(), NATM_LOCK_ASSERT(). It protects the consistency of pcb-related data structures. Finer grained locking is possible, but should be done in the context of specific measurements (as very little work is done in netnatm -- most is in the ATM device driver or socket layer, so there's probably not much contention). - Remove GIANT_REQUIRED, mark as NETISR_MPSAFE, remove NET_NEEDS_GIANT("netnatm"). - Conditionally acquire Giant when entering network interfaces for ifp->if_ioctl() using IFF_LOCKGIANT(ifp)/IFF_UNLOCKGIANT(ifp) in order to coexist with non-MPSAFE atm ifnet drivers.. - De-spl. MFC after: 2 weeks Reviewed by: harti, bms (various versions)
Diffstat (limited to 'sys/netnatm/natm_proto.c')
-rw-r--r--sys/netnatm/natm_proto.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c
index 7e3ec35..235ccc0 100644
--- a/sys/netnatm/natm_proto.c
+++ b/sys/netnatm/natm_proto.c
@@ -56,8 +56,6 @@ extern struct domain natmdomain;
static void natm_init(void);
-NET_NEEDS_GIANT("netnatm");
-
static struct protosw natmsw[] = {
{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED,
0, 0, 0, 0,
@@ -123,8 +121,9 @@ natm_init(void)
LIST_INIT(&natm_pcbs);
bzero(&natmintrq, sizeof(natmintrq));
natmintrq.ifq_maxlen = natmqmaxlen;
+ NATM_LOCK_INIT();
mtx_init(&natmintrq.ifq_mtx, "natm_inq", NULL, MTX_DEF);
- netisr_register(NETISR_NATM, natmintr, &natmintrq, 0);
+ netisr_register(NETISR_NATM, natmintr, &natmintrq, NETISR_MPSAFE);
}
#if defined(__FreeBSD__)
OpenPOWER on IntegriCloud