diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 97257ea2e03f..e8c1ba26ba0c 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.205 2014/11/28 08:29:00 ozaki-r Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.206 2015/04/03 07:55:18 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.205 2014/11/28 08:29:00 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.206 2015/04/03 07:55:18 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_atalk.h" @@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.205 2014/11/28 08:29:00 ozaki-r E #include "opt_mpls.h" #include "opt_gateway.h" #include "opt_pppoe.h" +#include "opt_net_mpsafe.h" #include "vlan.h" #include "pppoe.h" #include "bridge.h" @@ -214,7 +215,9 @@ ether_output(struct ifnet * const ifp0, struct mbuf * const m0, struct at_ifaddr *aa; #endif /* NETATALK */ +#ifndef NET_MPSAFE KASSERT(KERNEL_LOCKED_P()); +#endif #ifdef MBUFTRACE m_claimm(m, ifp->if_mowner); diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index b9f1e4869f4e..a71589089a4b 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_loop.c,v 1.80 2014/06/07 11:00:29 rmind Exp $ */ +/* $NetBSD: if_loop.c,v 1.81 2015/04/03 07:55:18 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,14 +65,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.80 2014/06/07 11:00:29 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.81 2015/04/03 07:55:18 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_atalk.h" #include "opt_ipx.h" #include "opt_mbuftrace.h" #include "opt_mpls.h" - +#include "opt_net_mpsafe.h" #include #include @@ -218,7 +218,9 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, size_t pktlen; MCLAIM(m, ifp->if_mowner); +#ifndef NET_MPSAFE KASSERT(KERNEL_LOCKED_P()); +#endif if ((m->m_flags & M_PKTHDR) == 0) panic("looutput: no header mbuf"); diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index aebcb277eccb..0c8846b53ccd 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.235 2015/03/31 08:44:43 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.236 2015/04/03 07:55:18 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,11 +91,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.235 2015/03/31 08:44:43 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.236 2015/04/03 07:55:18 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" #include "opt_mrouting.h" +#include "opt_net_mpsafe.h" #include #include @@ -557,9 +558,13 @@ sendit: if (__predict_true( (m->m_pkthdr.csum_flags & M_CSUM_TSOv4) == 0 || (ifp->if_capenable & IFCAP_TSOv4) != 0)) { +#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); +#endif error = (*ifp->if_output)(ifp, m, sa, rt); +#ifndef NET_MPSAFE KERNEL_UNLOCK_ONE(NULL); +#endif } else { error = ip_tso_output(ifp, m, sa, rt); } @@ -627,11 +632,15 @@ sendit: } else { KASSERT((m->m_pkthdr.csum_flags & (M_CSUM_UDPv4 | M_CSUM_TCPv4)) == 0); +#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); +#endif error = (*ifp->if_output)(ifp, m, (m->m_flags & M_MCAST) ? sintocsa(rdst) : sintocsa(dst), rt); +#ifndef NET_MPSAFE KERNEL_UNLOCK_ONE(NULL); +#endif } } if (error == 0) { @@ -1722,7 +1731,11 @@ 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 (void)looutput(ifp, copym, sintocsa(dst), NULL); +#ifndef NET_MPSAFE KERNEL_UNLOCK_ONE(NULL); +#endif }