Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
details: https://anonhg.NetBSD.org/src/rev/114143a0fba0
branches: trunk
changeset: 358251:114143a0fba0
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Dec 19 03:32:35 2017 +0000
description:
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.
diffstat:
sys/dev/ic/dwc_gmac.c | 6 ++++--
sys/net/if_bridge.c | 9 ++++++---
sys/net/if_l2tp.c | 10 +++++++---
sys/net/if_loop.c | 6 ++++--
sys/net/if_tap.c | 9 ++++++---
sys/net/if_vlan.c | 10 +++++++---
sys/netcan/if_canloop.c | 6 ++++--
7 files changed, 38 insertions(+), 18 deletions(-)
diffs (212 lines):
diff -r 3062addceb7a -r 114143a0fba0 sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/dev/ic/dwc_gmac.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.43 2017/11/16 03:07:17 ozaki-r Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.44 2017/12/19 03:32:35 ozaki-r Exp $ */
/*-
* Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.43 2017/11/16 03:07:17 ozaki-r Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.44 2017/12/19 03:32:35 ozaki-r Exp $");
/* #define DWC_GMAC_DEBUG 1 */
@@ -223,7 +223,9 @@
ifp->if_softc = sc;
strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+#ifdef DWCGMAC_MPSAFE
ifp->if_extflags = IFEF_MPSAFE;
+#endif
ifp->if_ioctl = dwc_gmac_ioctl;
ifp->if_start = dwc_gmac_start;
ifp->if_init = dwc_gmac_init;
diff -r 3062addceb7a -r 114143a0fba0 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/net/if_bridge.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bridge.c,v 1.145 2017/12/11 03:29:20 ozaki-r Exp $ */
+/* $NetBSD: if_bridge.c,v 1.146 2017/12/19 03:32:35 ozaki-r Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.145 2017/12/11 03:29:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.146 2017/12/19 03:32:35 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_bridge_ipf.h"
@@ -424,7 +424,10 @@
if_initname(ifp, ifc->ifc_name, unit);
ifp->if_softc = sc;
- ifp->if_extflags = IFEF_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
+ ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
+#ifdef NET_MPSAFE
+ ifp->if_extflags |= IFEF_MPSAFE;
+#endif
ifp->if_mtu = ETHERMTU;
ifp->if_ioctl = bridge_ioctl;
ifp->if_output = bridge_output;
diff -r 3062addceb7a -r 114143a0fba0 sys/net/if_l2tp.c
--- a/sys/net/if_l2tp.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/net/if_l2tp.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_l2tp.c,v 1.16 2017/12/06 08:23:17 knakahara Exp $ */
+/* $NetBSD: if_l2tp.c,v 1.17 2017/12/19 03:32:35 ozaki-r Exp $ */
/*
* Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,10 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.16 2017/12/06 08:23:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.17 2017/12/19 03:32:35 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
+#include "opt_net_mpsafe.h"
#endif
#include <sys/param.h>
@@ -265,7 +266,10 @@
sc->l2tp_ec.ec_if.if_addrlen = 0;
sc->l2tp_ec.ec_if.if_mtu = L2TP_MTU;
sc->l2tp_ec.ec_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST|IFF_SIMPLEX;
- sc->l2tp_ec.ec_if.if_extflags = IFEF_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
+ sc->l2tp_ec.ec_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE;
+#ifdef NET_MPSAFE
+ sc->l2tp_ec.ec_if.if_extflags |= IFEF_MPSAFE;
+#endif
sc->l2tp_ec.ec_if.if_ioctl = l2tp_ioctl;
sc->l2tp_ec.ec_if.if_output = l2tp_output;
sc->l2tp_ec.ec_if.if_type = IFT_L2TP;
diff -r 3062addceb7a -r 114143a0fba0 sys/net/if_loop.c
--- a/sys/net/if_loop.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/net/if_loop.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_loop.c,v 1.100 2017/12/06 07:40:16 ozaki-r Exp $ */
+/* $NetBSD: if_loop.c,v 1.101 2017/12/19 03:32:35 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.100 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.101 2017/12/19 03:32:35 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -183,7 +183,9 @@
ifp->if_mtu = LOMTU;
ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
+#ifdef NET_MPSAFE
ifp->if_extflags = IFEF_MPSAFE;
+#endif
ifp->if_ioctl = loioctl;
ifp->if_output = looutput;
#ifdef ALTQ
diff -r 3062addceb7a -r 114143a0fba0 sys/net/if_tap.c
--- a/sys/net/if_tap.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/net/if_tap.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tap.c,v 1.104 2017/11/30 20:25:55 christos Exp $ */
+/* $NetBSD: if_tap.c,v 1.105 2017/12/19 03:32:35 ozaki-r Exp $ */
/*
* Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.104 2017/11/30 20:25:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.105 2017/12/19 03:32:35 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
@@ -358,7 +358,10 @@
strcpy(ifp->if_xname, device_xname(self));
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_extflags = IFEF_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
+ ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
+#ifdef NET_MPSAFE
+ ifp->if_extflags |= IFEF_MPSAFE;
+#endif
ifp->if_ioctl = tap_ioctl;
ifp->if_start = tap_start;
ifp->if_stop = tap_stop;
diff -r 3062addceb7a -r 114143a0fba0 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/net/if_vlan.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.120 2017/12/15 04:03:46 ozaki-r Exp $ */
+/* $NetBSD: if_vlan.c,v 1.121 2017/12/19 03:32:35 ozaki-r Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,10 +78,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.120 2017/12/15 04:03:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.121 2017/12/19 03:32:35 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
+#include "opt_net_mpsafe.h"
#endif
#include <sys/param.h>
@@ -358,7 +359,10 @@
if_initname(ifp, ifc->ifc_name, unit);
ifp->if_softc = ifv;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_extflags = IFEF_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
+ ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
+#ifdef NET_MPSAFE
+ ifp->if_extflags |= IFEF_MPSAFE;
+#endif
ifp->if_start = vlan_start;
ifp->if_transmit = vlan_transmit;
ifp->if_ioctl = vlan_ioctl;
diff -r 3062addceb7a -r 114143a0fba0 sys/netcan/if_canloop.c
--- a/sys/netcan/if_canloop.c Tue Dec 19 03:31:12 2017 +0000
+++ b/sys/netcan/if_canloop.c Tue Dec 19 03:32:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_canloop.c,v 1.4 2017/12/06 07:40:16 ozaki-r Exp $ */
+/* $NetBSD: if_canloop.c,v 1.5 2017/12/19 03:32:35 ozaki-r Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.4 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.5 2017/12/19 03:32:35 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_can.h"
@@ -112,7 +112,9 @@
if_initname(ifp, ifc->ifc_name, unit);
ifp->if_flags = IFF_LOOPBACK;
+#ifdef NET_MPSAFE
ifp->if_extflags = IFEF_MPSAFE;
+#endif
ifp->if_ioctl = canloop_ioctl;
ifp->if_start = canloop_ifstart;
can_ifattach(ifp);
Home |
Main Index |
Thread Index |
Old Index