Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..." scattered all over the source code and makes it easy to identify remaining KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE. No functional change
This commit is contained in:
parent
a4c07a26ac
commit
cead3b8854
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bpf.c,v 1.218 2017/10/25 08:12:40 maya Exp $ */
|
||||
/* $NetBSD: bpf.c,v 1.219 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.218 2017/10/25 08:12:40 maya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.219 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_bpf.h"
|
||||
|
@ -484,13 +484,9 @@ bpf_detachd(struct bpf_d *d)
|
|||
* the interface was configured down, so only panic
|
||||
* if we don't get an unexpected error.
|
||||
*/
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = ifpromisc(bp->bif_ifp, 0);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
#ifdef DIAGNOSTIC
|
||||
if (error)
|
||||
printf("%s: ifpromisc failed: %d", __func__, error);
|
||||
|
@ -1022,13 +1018,9 @@ bpf_ioctl(struct file *fp, u_long cmd, void *addr)
|
|||
break;
|
||||
}
|
||||
if (d->bd_promisc == 0) {
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = ifpromisc(d->bd_bif->bif_ifp, 1);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
if (error == 0)
|
||||
d->bd_promisc = 1;
|
||||
}
|
||||
|
@ -2249,13 +2241,9 @@ bpf_setdlt(struct bpf_d *d, u_int dlt)
|
|||
bpf_attachd(d, bp);
|
||||
reset_d(d);
|
||||
if (opromisc) {
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = ifpromisc(bp->bif_ifp, 1);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
if (error)
|
||||
printf("%s: bpf_setdlt: ifpromisc failed (%d)\n",
|
||||
bp->bif_ifp->if_xname, error);
|
||||
|
|
14
sys/net/if.c
14
sys/net/if.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.c,v 1.396 2017/10/23 09:21:20 msaitoh Exp $ */
|
||||
/* $NetBSD: if.c,v 1.397 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -90,7 +90,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.396 2017/10/23 09:21:20 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.397 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_inet.h"
|
||||
|
@ -2331,10 +2331,7 @@ if_link_state_change_si(void *arg)
|
|||
int s;
|
||||
uint8_t state;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
s = splnet();
|
||||
|
||||
/* Pop a link state change from the queue and process it. */
|
||||
|
@ -2346,10 +2343,7 @@ if_link_state_change_si(void *arg)
|
|||
softint_schedule(ifp->if_link_si);
|
||||
|
||||
splx(s);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
42
sys/net/if.h
42
sys/net/if.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.h,v 1.242 2017/11/16 03:07:18 ozaki-r Exp $ */
|
||||
/* $NetBSD: if.h,v 1.243 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -440,6 +440,46 @@ if_is_link_state_changeable(struct ifnet *ifp)
|
|||
|
||||
return ((ifp->if_extflags & IFEF_NO_LINK_STATE_CHANGE) == 0);
|
||||
}
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
#endif
|
||||
|
||||
/* XXX explore a better place to define */
|
||||
#ifdef NET_MPSAFE
|
||||
|
||||
#define KERNEL_LOCK_UNLESS_NET_MPSAFE() do { } while (0)
|
||||
#define KERNEL_UNLOCK_UNLESS_NET_MPSAFE() do { } while (0)
|
||||
|
||||
#define SOFTNET_LOCK_UNLESS_NET_MPSAFE() do { } while (0)
|
||||
#define SOFTNET_UNLOCK_UNLESS_NET_MPSAFE() do { } while (0)
|
||||
|
||||
#else /* NET_MPSAFE */
|
||||
|
||||
#define KERNEL_LOCK_UNLESS_NET_MPSAFE() \
|
||||
do { KERNEL_LOCK(1, NULL); } while (0)
|
||||
#define KERNEL_UNLOCK_UNLESS_NET_MPSAFE() \
|
||||
do { KERNEL_UNLOCK_ONE(NULL); } while (0)
|
||||
|
||||
#define SOFTNET_LOCK_UNLESS_NET_MPSAFE() \
|
||||
do { mutex_enter(softnet_lock); } while (0)
|
||||
#define SOFTNET_UNLOCK_UNLESS_NET_MPSAFE() \
|
||||
do { mutex_exit(softnet_lock); } while (0)
|
||||
|
||||
#endif /* NET_MPSAFE */
|
||||
|
||||
#define SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE() \
|
||||
do { \
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE(); \
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE(); \
|
||||
} while (0)
|
||||
|
||||
#define SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE() \
|
||||
do { \
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE(); \
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE(); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#define IFFBITS \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_loop.c,v 1.98 2017/11/16 03:07:18 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_loop.c,v 1.99 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.98 2017/11/16 03:07:18 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.99 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -247,9 +247,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||
|
||||
MCLAIM(m, ifp->if_mowner);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("looutput: no header mbuf");
|
||||
|
@ -375,9 +373,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||
schednetisr(isr);
|
||||
splx(s);
|
||||
out:
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_pppoe.c,v 1.131 2017/11/16 03:07:18 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.131 2017/11/16 03:07:18 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "pppoe.h"
|
||||
|
@ -477,9 +477,7 @@ pppoeintr(void)
|
|||
struct mbuf *m;
|
||||
int disc_done, data_done;
|
||||
|
||||
#ifndef PPPOE_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
do {
|
||||
disc_done = 0;
|
||||
|
@ -502,9 +500,8 @@ pppoeintr(void)
|
|||
pppoe_data_input(m);
|
||||
}
|
||||
} while (disc_done || data_done);
|
||||
#ifndef PPPOE_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/* analyze and handle a single received packet while not in session state */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: npf_os.c,v 1.7 2017/07/20 23:37:56 pgoyette Exp $ */
|
||||
/* $NetBSD: npf_os.c,v 1.8 2017/11/17 07:37:12 ozaki-r 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.7 2017/07/20 23:37:56 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.8 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "pf.h"
|
||||
|
@ -397,10 +397,7 @@ npf_pfil_register(bool init)
|
|||
npf_t *npf = npf_getkernctx();
|
||||
int error = 0;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
/* Init: interface re-config and attach/detach hook. */
|
||||
if (!npf_ph_if) {
|
||||
|
@ -455,10 +452,7 @@ npf_pfil_register(bool init)
|
|||
npf_ifaddr_syncall(npf);
|
||||
pfil_registered = true;
|
||||
out:
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -471,10 +465,7 @@ npf_pfil_unregister(bool fini)
|
|||
{
|
||||
npf_t *npf = npf_getkernctx();
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
if (fini && npf_ph_if) {
|
||||
(void)pfil_remove_ihook(npf_ifhook, NULL,
|
||||
|
@ -492,10 +483,7 @@ npf_pfil_unregister(bool fini)
|
|||
}
|
||||
pfil_registered = false;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rtsock.c,v 1.229 2017/09/25 01:57:54 ozaki-r Exp $ */
|
||||
/* $NetBSD: rtsock.c,v 1.230 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.229 2017/09/25 01:57:54 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.230 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -2038,10 +2038,7 @@ COMPATNAME(route_intr)(void *cookie)
|
|||
struct route_info * const ri = &COMPATNAME(route_info);
|
||||
struct mbuf *m;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
for (;;) {
|
||||
IFQ_LOCK(&ri->ri_intrq);
|
||||
IF_DEQUEUE(&ri->ri_intrq, m);
|
||||
|
@ -2057,10 +2054,7 @@ COMPATNAME(route_intr)(void *cookie)
|
|||
mutex_exit(rt_so_mtx);
|
||||
#endif
|
||||
}
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_arp.c,v 1.254 2017/11/10 07:24:28 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_arp.c,v 1.255 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -68,7 +68,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.254 2017/11/10 07:24:28 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.255 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ddb.h"
|
||||
|
@ -920,10 +920,7 @@ arpintr(void)
|
|||
int s;
|
||||
int arplen;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
for (;;) {
|
||||
struct ifnet *rcvif;
|
||||
|
||||
|
@ -980,12 +977,8 @@ free:
|
|||
m_freem(m);
|
||||
}
|
||||
out:
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#else
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
return; /* XXX gcc */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1689,10 +1682,7 @@ arp_dad_timer(struct ifaddr *ifa)
|
|||
char ipbuf[INET_ADDRSTRLEN];
|
||||
bool need_free = false;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&arp_dad_lock);
|
||||
|
||||
/* Sanity check */
|
||||
|
@ -1783,10 +1773,7 @@ done:
|
|||
ifafree(ifa);
|
||||
}
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: igmp.c,v 1.64 2017/01/24 07:09:24 ozaki-r Exp $ */
|
||||
/* $NetBSD: igmp.c,v 1.65 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64 2017/01/24 07:09:24 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.65 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_mrouting.h"
|
||||
|
@ -542,10 +542,8 @@ igmp_fasttimo(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
/* XXX: Needed for ip_output(). */
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
in_multi_lock(RW_WRITER);
|
||||
igmp_timers_on = false;
|
||||
|
@ -569,9 +567,7 @@ igmp_fasttimo(void)
|
|||
inm = in_next_multi(&step);
|
||||
}
|
||||
in_multi_unlock();
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in.c,v 1.209 2017/11/10 07:24:28 ozaki-r Exp $ */
|
||||
/* $NetBSD: in.c,v 1.210 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -91,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.209 2017/11/10 07:24:28 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.210 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#include "arp.h"
|
||||
|
||||
|
@ -751,13 +751,9 @@ in_control(struct socket *so, u_long cmd, void *data, struct ifnet *ifp)
|
|||
{
|
||||
int error;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = in_control0(so, cmd, data, ifp);
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_flow.c,v 1.80 2017/02/07 02:38:08 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip_flow.c,v 1.81 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.80 2017/02/07 02:38:08 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.81 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
|
@ -482,10 +482,7 @@ ipflow_slowtimo_work(struct work *wk, void *arg)
|
|||
/* We can allow enqueuing another work at this point */
|
||||
atomic_swap_uint(&ipflow_work_enqueued, 0);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&ipflow_lock);
|
||||
for (ipf = TAILQ_FIRST(&ipflowlist); ipf != NULL; ipf = next_ipf) {
|
||||
next_ipf = TAILQ_NEXT(ipf, ipf_list);
|
||||
|
@ -505,10 +502,7 @@ ipflow_slowtimo_work(struct work *wk, void *arg)
|
|||
}
|
||||
}
|
||||
mutex_exit(&ipflow_lock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -529,9 +523,7 @@ ipflow_create(struct route *ro, struct mbuf *m)
|
|||
struct ipflow *ipf;
|
||||
size_t hash;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&ipflow_lock);
|
||||
|
||||
/*
|
||||
|
@ -582,9 +574,7 @@ ipflow_create(struct route *ro, struct mbuf *m)
|
|||
|
||||
out:
|
||||
mutex_exit(&ipflow_lock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -622,19 +612,13 @@ sysctl_net_inet_ip_maxflows(SYSCTLFN_ARGS)
|
|||
if (error || newp == NULL)
|
||||
return (error);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&ipflow_lock);
|
||||
|
||||
ipflow_reap(false);
|
||||
|
||||
mutex_exit(&ipflow_lock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -656,15 +640,9 @@ sysctl_net_inet_ip_hashsize(SYSCTLFN_ARGS)
|
|||
/*
|
||||
* Can only fail due to malloc()
|
||||
*/
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = ipflow_invalidate_all(tmp);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
} else {
|
||||
/*
|
||||
* EINVAL if not a power of 2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_input.c,v 1.361 2017/09/27 10:05:04 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.362 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -91,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.361 2017/09/27 10:05:04 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.362 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -426,15 +426,11 @@ ipintr(void *arg __unused)
|
|||
|
||||
KASSERT(cpu_softintr_p());
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
while ((m = pktq_dequeue(ip_pktq)) != NULL) {
|
||||
ip_input(m);
|
||||
}
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -842,17 +838,11 @@ void
|
|||
ip_slowtimo(void)
|
||||
{
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
ip_reass_slowtimo();
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_output.c,v 1.284 2017/08/10 04:31:58 ryo Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.285 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -91,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.284 2017/08/10 04:31:58 ryo Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.285 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -2072,13 +2072,9 @@ ip_mloopback(struct ifnet *ifp, struct mbuf *m, const struct sockaddr_in *dst)
|
|||
|
||||
ip->ip_sum = 0;
|
||||
ip->ip_sum = in_cksum(copym, ip->ip_hl << 2);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
(void)looutput(ifp, copym, sintocsa(dst), NULL);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: frag6.c,v 1.60 2017/01/24 07:09:25 ozaki-r Exp $ */
|
||||
/* $NetBSD: frag6.c,v 1.61 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.60 2017/01/24 07:09:25 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.61 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
|
@ -597,20 +597,14 @@ void
|
|||
frag6_fasttimo(void)
|
||||
{
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
if (frag6_drainwanted) {
|
||||
frag6_drain();
|
||||
frag6_drainwanted = 0;
|
||||
}
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -623,10 +617,7 @@ frag6_slowtimo(void)
|
|||
{
|
||||
struct ip6q *q6;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
mutex_enter(&frag6_lock);
|
||||
q6 = ip6q.ip6q_next;
|
||||
|
@ -653,10 +644,7 @@ frag6_slowtimo(void)
|
|||
}
|
||||
mutex_exit(&frag6_lock);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
#if 0
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6.c,v 1.250 2017/11/10 07:24:28 ozaki-r Exp $ */
|
||||
/* $NetBSD: in6.c,v 1.251 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.250 2017/11/10 07:24:28 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.251 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -767,13 +767,9 @@ in6_control(struct socket *so, u_long cmd, void *data, struct ifnet *ifp)
|
|||
}
|
||||
|
||||
s = splsoftnet();
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = in6_control1(so , cmd, data, ifp);
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
|
@ -2709,13 +2705,9 @@ in6_domifdetach(struct ifnet *ifp, void *aux)
|
|||
|
||||
lltable_free(ext->lltable);
|
||||
ext->lltable = NULL;
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
nd6_ifdetach(ifp, ext);
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
free(ext->in6_ifstat, M_IFADDR);
|
||||
free(ext->icmp6_ifstat, M_IFADDR);
|
||||
scope6_ifdetach(ext->scope6_id);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_flow.c,v 1.34 2017/01/11 13:08:29 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.34 2017/01/11 13:08:29 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
|
@ -519,10 +519,7 @@ ip6flow_slowtimo_work(struct work *wk, void *arg)
|
|||
/* We can allow enqueuing another work at this point */
|
||||
atomic_swap_uint(&ip6flow_work_enqueued, 0);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&ip6flow_lock);
|
||||
|
||||
for (ip6f = TAILQ_FIRST(&ip6flowlist); ip6f != NULL; ip6f = next_ip6f) {
|
||||
|
@ -542,10 +539,7 @@ ip6flow_slowtimo_work(struct work *wk, void *arg)
|
|||
}
|
||||
|
||||
mutex_exit(&ip6flow_lock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -572,9 +566,7 @@ ip6flow_create(struct route *ro, struct mbuf *m)
|
|||
|
||||
ip6 = mtod(m, const struct ip6_hdr *);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&ip6flow_lock);
|
||||
|
||||
/*
|
||||
|
@ -636,9 +628,7 @@ ip6flow_create(struct route *ro, struct mbuf *m)
|
|||
|
||||
out:
|
||||
mutex_exit(&ip6flow_lock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -681,17 +671,11 @@ sysctl_net_inet6_ip6_maxflows(SYSCTLFN_ARGS)
|
|||
if (error || newp == NULL)
|
||||
return (error);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
ip6flow_reap(0);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -713,15 +697,9 @@ sysctl_net_inet6_ip6_hashsize(SYSCTLFN_ARGS)
|
|||
/*
|
||||
* Can only fail due to malloc()
|
||||
*/
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
error = ip6flow_invalidate_all(tmp);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
} else {
|
||||
/*
|
||||
* EINVAL if not a power of 2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_input.c,v 1.182 2017/09/27 10:05:05 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip6_input.c,v 1.183 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.182 2017/09/27 10:05:05 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.183 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_gateway.h"
|
||||
|
@ -222,9 +222,7 @@ ip6intr(void *arg __unused)
|
|||
{
|
||||
struct mbuf *m;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_LOCK_UNLESS_NET_MPSAFE();
|
||||
while ((m = pktq_dequeue(ip6_pktq)) != NULL) {
|
||||
struct psref psref;
|
||||
struct ifnet *rcvif = m_get_rcvif_psref(m, &psref);
|
||||
|
@ -244,9 +242,7 @@ ip6intr(void *arg __unused)
|
|||
ip6_input(m, rcvif);
|
||||
m_put_rcvif_psref(rcvif, &psref);
|
||||
}
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mld6.c,v 1.89 2017/05/13 20:13:26 kardel Exp $ */
|
||||
/* $NetBSD: mld6.c,v 1.90 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -102,7 +102,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.89 2017/05/13 20:13:26 kardel Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.90 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -242,10 +242,7 @@ mld_timeo(void *arg)
|
|||
|
||||
KASSERT(in6m->in6m_refcount > 0);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
rw_enter(&in6_multilock, RW_WRITER);
|
||||
if (in6m->in6m_timer == IN6M_TIMER_UNDEF)
|
||||
goto out;
|
||||
|
@ -263,12 +260,7 @@ mld_timeo(void *arg)
|
|||
|
||||
out:
|
||||
rw_exit(&in6_multilock);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
static u_long
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.239 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.239 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_net_mpsafe.h"
|
||||
|
@ -450,10 +450,7 @@ nd6_llinfo_timer(void *arg)
|
|||
bool send_ns = false;
|
||||
const struct in6_addr *daddr6 = NULL;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
LLE_WLOCK(ln);
|
||||
if ((ln->la_flags & LLE_LINKED) == 0)
|
||||
goto out;
|
||||
|
@ -569,10 +566,7 @@ nd6_llinfo_timer(void *arg)
|
|||
out:
|
||||
if (ln != NULL)
|
||||
LLE_FREE_LOCKED(ln);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -590,10 +584,7 @@ nd6_timer_work(struct work *wk, void *arg)
|
|||
callout_reset(&nd6_timer_ch, nd6_prune * hz,
|
||||
nd6_timer, NULL);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
/* expire default router list */
|
||||
|
||||
|
@ -717,10 +708,7 @@ nd6_timer_work(struct work *wk, void *arg)
|
|||
}
|
||||
ND6_UNLOCK();
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2228,10 +2216,7 @@ nd6_slowtimo(void *ignored_arg)
|
|||
struct ifnet *ifp;
|
||||
int s;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
|
||||
nd6_slowtimo, NULL);
|
||||
|
||||
|
@ -2252,10 +2237,7 @@ nd6_slowtimo(void *ignored_arg)
|
|||
}
|
||||
pserialize_read_exit(s);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6_nbr.c,v 1.138 2017/03/14 04:25:10 ozaki-r Exp $ */
|
||||
/* $NetBSD: nd6_nbr.c,v 1.139 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.138 2017/03/14 04:25:10 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.139 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -1228,10 +1228,7 @@ nd6_dad_timer(struct ifaddr *ifa)
|
|||
char ip6buf[INET6_ADDRSTRLEN];
|
||||
bool need_free = false;
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
mutex_enter(softnet_lock);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
mutex_enter(&nd6_dad_lock);
|
||||
|
||||
/* Sanity check */
|
||||
|
@ -1327,10 +1324,7 @@ done:
|
|||
if (duplicate)
|
||||
nd6_dad_duplicated(ifa);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
mutex_exit(softnet_lock);
|
||||
#endif
|
||||
SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ipsec_output.c,v 1.64 2017/10/03 08:56:52 ozaki-r Exp $ */
|
||||
/* $NetBSD: ipsec_output.c,v 1.65 2017/11/17 07:37:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.64 2017/10/03 08:56:52 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.65 2017/11/17 07:37:12 ozaki-r Exp $");
|
||||
|
||||
/*
|
||||
* IPsec output processing.
|
||||
|
@ -117,9 +117,7 @@ ipsec_reinject_ipstack(struct mbuf *m, int af)
|
|||
|
||||
KASSERT(af == AF_INET || af == AF_INET6);
|
||||
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_LOCK(1, NULL);
|
||||
#endif
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
ro = percpu_getref(ipsec_rtcache_percpu);
|
||||
switch (af) {
|
||||
#ifdef INET
|
||||
|
@ -139,9 +137,7 @@ ipsec_reinject_ipstack(struct mbuf *m, int af)
|
|||
#endif
|
||||
}
|
||||
percpu_putref(ipsec_rtcache_percpu);
|
||||
#ifndef NET_MPSAFE
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
#endif
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue