From: Sepherosa Ziehau Date: Wed, 24 Sep 2008 14:26:39 +0000 (+0000) Subject: Add NETISR_FLAG_NOTMPSAFE, which could be used as the last parameter to X-Git-Url: https://gitweb.dragonflybsd.org/~lentferj/dragonfly.git/commitdiff_plain/95af0087668cb63d6558cccf88cabde694ccc10b Add NETISR_FLAG_NOTMPSAFE, which could be used as the last parameter to netisr_register(), more expressive and less error-prone than 0. Suggested-by: hsu@ --- diff --git a/sys/bus/usb/usb_ethersubr.c b/sys/bus/usb/usb_ethersubr.c index 6216b4aac0..e7b05be122 100644 --- a/sys/bus/usb/usb_ethersubr.c +++ b/sys/bus/usb/usb_ethersubr.c @@ -31,7 +31,7 @@ * * * $FreeBSD: src/sys/dev/usb/usb_ethersubr.c,v 1.17 2003/11/14 11:09:45 johan Exp $ - * $DragonFly: src/sys/bus/usb/usb_ethersubr.c,v 1.20 2008/09/23 11:28:49 sephe Exp $ + * $DragonFly: src/sys/bus/usb/usb_ethersubr.c,v 1.21 2008/09/24 14:26:38 sephe Exp $ */ /* @@ -91,7 +91,8 @@ usb_register_netisr(void) { if (netisr_inited == 0) { netisr_inited = 1; - netisr_register(NETISR_USB, cpu0_portfn, usbintr, 0); + netisr_register(NETISR_USB, cpu0_portfn, usbintr, + NETISR_FLAG_NOTMPSAFE); } } diff --git a/sys/net/netisr.h b/sys/net/netisr.h index 1fb3d3be09..025efd04ce 100644 --- a/sys/net/netisr.h +++ b/sys/net/netisr.h @@ -65,7 +65,7 @@ * * @(#)netisr.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/netisr.h,v 1.21.2.5 2002/02/09 23:02:39 luigi Exp $ - * $DragonFly: src/sys/net/netisr.h,v 1.36 2008/09/23 11:28:49 sephe Exp $ + * $DragonFly: src/sys/net/netisr.h,v 1.37 2008/09/24 14:26:38 sephe Exp $ */ #ifndef _NET_NETISR_H_ @@ -206,7 +206,8 @@ struct netisr { uint32_t ni_flags; /* NETISR_FLAG_ */ }; -#define NETISR_FLAG_MPSAFE 0x1 +#define NETISR_FLAG_NOTMPSAFE 0x0 /* ni_handler is not MPSAFE */ +#define NETISR_FLAG_MPSAFE 0x1 /* ni_handler is MPSAFE */ #endif diff --git a/sys/net/ppp/if_ppp.c b/sys/net/ppp/if_ppp.c index 48777f7a8f..3f1bc15a48 100644 --- a/sys/net/ppp/if_ppp.c +++ b/sys/net/ppp/if_ppp.c @@ -70,7 +70,7 @@ */ /* $FreeBSD: src/sys/net/if_ppp.c,v 1.67.2.4 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.40 2008/09/23 11:28:49 sephe Exp $ */ +/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.41 2008/09/24 14:26:38 sephe Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -256,7 +256,7 @@ pppattach(void *dummy) if_attach(&sc->sc_if, NULL); bpfattach(&sc->sc_if, DLT_PPP, PPP_HDRLEN); } - netisr_register(NETISR_PPP, cpu0_portfn, pppintr, 0); + netisr_register(NETISR_PPP, cpu0_portfn, pppintr, NETISR_FLAG_NOTMPSAFE); /* * XXX layering violation - if_ppp can work over any lower level * transport that cares to attach to it. diff --git a/sys/netbt/bt_proto.c b/sys/netbt/bt_proto.c index c6ae1d6147..ea22497a11 100644 --- a/sys/netbt/bt_proto.c +++ b/sys/netbt/bt_proto.c @@ -1,4 +1,4 @@ -/* $DragonFly: src/sys/netbt/bt_proto.c,v 1.5 2008/09/23 11:28:49 sephe Exp $ */ +/* $DragonFly: src/sys/netbt/bt_proto.c,v 1.6 2008/09/24 14:26:39 sephe Exp $ */ /* $OpenBSD: bt_proto.c,v 1.4 2007/06/24 20:55:27 uwe Exp $ */ /* @@ -234,7 +234,8 @@ SYSCTL_INT(_net_bluetooth_sco, OID_AUTO, recvspace, CTLFLAG_RW, &sco_recvspace, static void netisr_netbt_setup(void *dummy __unused) { - netisr_register(NETISR_BLUETOOTH, cpu0_portfn, btintr, 0); + netisr_register(NETISR_BLUETOOTH, cpu0_portfn, btintr, + NETISR_FLAG_NOTMPSAFE); } SYSINIT(netbt_setup, SI_BOOT2_KLD, SI_ORDER_ANY, netisr_netbt_setup, NULL); diff --git a/sys/netgraph/netgraph/ng_base.c b/sys/netgraph/netgraph/ng_base.c index e1ed515748..c5834772bf 100644 --- a/sys/netgraph/netgraph/ng_base.c +++ b/sys/netgraph/netgraph/ng_base.c @@ -38,7 +38,7 @@ * Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.11.2.17 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/netgraph/netgraph/ng_base.c,v 1.27 2008/09/23 11:28:49 sephe Exp $ + * $DragonFly: src/sys/netgraph/netgraph/ng_base.c,v 1.28 2008/09/24 14:26:39 sephe Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -1839,7 +1839,8 @@ ngb_mod_event(module_t mod, int event, void *data) crit_exit(); break; } - netisr_register(NETISR_NETGRAPH, cpu0_portfn, ngintr, 0); + netisr_register(NETISR_NETGRAPH, cpu0_portfn, ngintr, + NETISR_FLAG_NOTMPSAFE); error = 0; crit_exit(); break; diff --git a/sys/netgraph7/ng_base.c b/sys/netgraph7/ng_base.c index 167b91a3a9..204fff5ac0 100644 --- a/sys/netgraph7/ng_base.c +++ b/sys/netgraph7/ng_base.c @@ -39,7 +39,7 @@ * Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.159 2008/04/19 05:30:49 mav Exp $ - * $DragonFly: src/sys/netgraph7/ng_base.c,v 1.3 2008/09/23 11:28:49 sephe Exp $ + * $DragonFly: src/sys/netgraph7/ng_base.c,v 1.4 2008/09/24 14:26:39 sephe Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -3068,7 +3068,8 @@ ngb_mod_event(module_t mod, int event, void *data) ng_qdzone = uma_zcreate("NetGraph data items", sizeof(struct ng_item), NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); uma_zone_set_max(ng_qdzone, maxdata); - netisr_register(NETISR_NETGRAPH, (netisr_t *)ngintr, NULL, 0); + netisr_register(NETISR_NETGRAPH, (netisr_t *)ngintr, NULL, + NETISR_FLAG_NOTMPSAFE); break; case MOD_UNLOAD: /* You can't unload it because an interface may be using it. */ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index a9593c8ac2..2a59291594 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -64,7 +64,7 @@ * * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netinet/if_ether.c,v 1.64.2.23 2003/04/11 07:23:15 fjoe Exp $ - * $DragonFly: src/sys/netinet/if_ether.c,v 1.50 2008/09/23 11:28:49 sephe Exp $ + * $DragonFly: src/sys/netinet/if_ether.c,v 1.51 2008/09/24 14:26:39 sephe Exp $ */ /* @@ -987,7 +987,8 @@ arp_init(void) for (cpu = 0; cpu < ncpus2; cpu++) LIST_INIT(&llinfo_arp_list[cpu]); - netisr_register(NETISR_ARP, cpu0_portfn, arpintr, 0); + netisr_register(NETISR_ARP, cpu0_portfn, arpintr, + NETISR_FLAG_NOTMPSAFE); } SYSINIT(arp, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, arp_init, 0); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 11a09a560b..06b6829821 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -65,7 +65,7 @@ * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.52 2003/03/07 07:01:28 silby Exp $ - * $DragonFly: src/sys/netinet/ip_input.c,v 1.109 2008/09/24 11:14:43 sephe Exp $ + * $DragonFly: src/sys/netinet/ip_input.c,v 1.110 2008/09/24 14:26:39 sephe Exp $ */ #define _IP_VHL @@ -376,7 +376,8 @@ ip_init(void) bzero(&ipstat, sizeof(struct ip_stats)); #endif - netisr_register(NETISR_IP, ip_mport_in, ip_input_handler, 0); + netisr_register(NETISR_IP, ip_mport_in, ip_input_handler, + NETISR_FLAG_NOTMPSAFE); } /* diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 4b84b8679b..ab0b7fa221 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_input.c,v 1.11.2.15 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/ip6_input.c,v 1.37 2008/09/23 11:28:50 sephe Exp $ */ +/* $DragonFly: src/sys/netinet6/ip6_input.c,v 1.38 2008/09/24 14:26:39 sephe Exp $ */ /* $KAME: ip6_input.c,v 1.259 2002/01/21 04:58:09 jinmei Exp $ */ /* @@ -197,7 +197,8 @@ ip6_init(void) "error %d\n", __func__, i); } - netisr_register(NETISR_IPV6, cpu0_portfn, ip6_input, 0); + netisr_register(NETISR_IPV6, cpu0_portfn, ip6_input, + NETISR_FLAG_NOTMPSAFE); scope6_init(); nd6_init(); frag6_init(); diff --git a/sys/netproto/atalk/ddp_usrreq.c b/sys/netproto/atalk/ddp_usrreq.c index c78219c92f..caabf9be7d 100644 --- a/sys/netproto/atalk/ddp_usrreq.c +++ b/sys/netproto/atalk/ddp_usrreq.c @@ -2,7 +2,7 @@ * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. * - * $DragonFly: src/sys/netproto/atalk/ddp_usrreq.c,v 1.13 2008/09/23 11:28:50 sephe Exp $ + * $DragonFly: src/sys/netproto/atalk/ddp_usrreq.c,v 1.14 2008/09/24 14:26:39 sephe Exp $ */ #include @@ -540,9 +540,12 @@ at_setsockaddr(struct socket *so, struct sockaddr **nam) void ddp_init(void) { - netisr_register(NETISR_ATALK1, cpu0_portfn, at1intr, 0); - netisr_register(NETISR_ATALK2, cpu0_portfn, at2intr, 0); - netisr_register(NETISR_AARP, cpu0_portfn, aarpintr, 0); + netisr_register(NETISR_ATALK1, cpu0_portfn, at1intr, + NETISR_FLAG_NOTMPSAFE); + netisr_register(NETISR_ATALK2, cpu0_portfn, at2intr, + NETISR_FLAG_NOTMPSAFE); + netisr_register(NETISR_AARP, cpu0_portfn, aarpintr, + NETISR_FLAG_NOTMPSAFE); } #if 0 diff --git a/sys/netproto/atm/atm_subr.c b/sys/netproto/atm/atm_subr.c index da2c07e653..d3af2ba002 100644 --- a/sys/netproto/atm/atm_subr.c +++ b/sys/netproto/atm/atm_subr.c @@ -24,7 +24,7 @@ * notice must be reproduced on all copies. * * @(#) $FreeBSD: src/sys/netatm/atm_subr.c,v 1.7 2000/02/13 03:31:59 peter Exp $ - * @(#) $DragonFly: src/sys/netproto/atm/atm_subr.c,v 1.22 2008/09/23 11:28:50 sephe Exp $ + * @(#) $DragonFly: src/sys/netproto/atm/atm_subr.c,v 1.23 2008/09/24 14:26:39 sephe Exp $ */ /* @@ -112,7 +112,8 @@ atm_initialize(void) atm_init = 1; atm_intrq.ifq_maxlen = ATM_INTRQ_MAX; - netisr_register(NETISR_ATM, cpu0_portfn, atm_intr, 0); + netisr_register(NETISR_ATM, cpu0_portfn, atm_intr, + NETISR_FLAG_NOTMPSAFE); /* * Initialize subsystems diff --git a/sys/netproto/ipx/ipx_input.c b/sys/netproto/ipx/ipx_input.c index b2d67d8baa..d641e53660 100644 --- a/sys/netproto/ipx/ipx_input.c +++ b/sys/netproto/ipx/ipx_input.c @@ -34,7 +34,7 @@ * @(#)ipx_input.c * * $FreeBSD: src/sys/netipx/ipx_input.c,v 1.22.2.2 2001/02/22 09:44:18 bp Exp $ - * $DragonFly: src/sys/netproto/ipx/ipx_input.c,v 1.19 2008/09/23 11:28:50 sephe Exp $ + * $DragonFly: src/sys/netproto/ipx/ipx_input.c,v 1.20 2008/09/24 14:26:39 sephe Exp $ */ #include @@ -117,7 +117,8 @@ ipx_init(void) ipx_hostmask.sipx_addr.x_net = ipx_broadnet; ipx_hostmask.sipx_addr.x_host = ipx_broadhost; - netisr_register(NETISR_IPX, cpu0_portfn, ipxintr, 0); + netisr_register(NETISR_IPX, cpu0_portfn, ipxintr, + NETISR_FLAG_NOTMPSAFE); } /* diff --git a/sys/netproto/mpls/mpls_input.c b/sys/netproto/mpls/mpls_input.c index ad85cb6041..f72e30cbe6 100644 --- a/sys/netproto/mpls/mpls_input.c +++ b/sys/netproto/mpls/mpls_input.c @@ -28,7 +28,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/netproto/mpls/mpls_input.c,v 1.3 2008/09/23 11:28:50 sephe Exp $ + * $DragonFly: src/sys/netproto/mpls/mpls_input.c,v 1.4 2008/09/24 14:26:39 sephe Exp $ */ #include @@ -76,7 +76,8 @@ mpls_init(void) bzero(&mplsstat, sizeof(struct mpls_stats)); #endif - netisr_register(NETISR_MPLS, mpls_mport, mpls_input_handler, 0); + netisr_register(NETISR_MPLS, mpls_mport, mpls_input_handler, + NETISR_FLAG_NOTMPSAFE); } static void diff --git a/sys/netproto/natm/natm.c b/sys/netproto/natm/natm.c index bf267d3468..e2e9976eb6 100644 --- a/sys/netproto/natm/natm.c +++ b/sys/netproto/natm/natm.c @@ -1,6 +1,6 @@ /* $NetBSD: natm.c,v 1.5 1996/11/09 03:26:26 chuck Exp $ */ /* $FreeBSD: src/sys/netnatm/natm.c,v 1.12 2000/02/13 03:32:03 peter Exp $ */ -/* $DragonFly: src/sys/netproto/natm/natm.c,v 1.30 2008/09/23 11:28:50 sephe Exp $ */ +/* $DragonFly: src/sys/netproto/natm/natm.c,v 1.31 2008/09/24 14:26:39 sephe Exp $ */ /* * @@ -748,7 +748,8 @@ static void natmintr(struct netmsg *); static void netisr_natm_setup(void *dummy __unused) { - netisr_register(NETISR_NATM, cpu0_portfn, natmintr, 0); + netisr_register(NETISR_NATM, cpu0_portfn, natmintr, + NETISR_FLAG_NOTMPSAFE); } SYSINIT(natm_setup, SI_BOOT2_KLD, SI_ORDER_ANY, netisr_natm_setup, NULL); #endif diff --git a/sys/netproto/ns/ns_input.c b/sys/netproto/ns/ns_input.c index 4f20200028..ff9488225f 100644 --- a/sys/netproto/ns/ns_input.c +++ b/sys/netproto/ns/ns_input.c @@ -32,7 +32,7 @@ * * @(#)ns_input.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netns/ns_input.c,v 1.13 2000/02/13 03:32:04 peter Exp $ - * $DragonFly: src/sys/netproto/ns/ns_input.c,v 1.22 2008/09/23 11:28:50 sephe Exp $ + * $DragonFly: src/sys/netproto/ns/ns_input.c,v 1.23 2008/09/24 14:26:39 sephe Exp $ */ #include @@ -96,7 +96,7 @@ ns_init(void) ns_hostmask.sns_len = 12; ns_hostmask.sns_addr.x_net = ns_broadnet; ns_hostmask.sns_addr.x_host = ns_broadhost; - netisr_register(NETISR_NS, cpu0_portfn, nsintr, 0); + netisr_register(NETISR_NS, cpu0_portfn, nsintr, NETISR_FLAG_NOTMPSAFE); } /*