Tue Jan 24 07:58:58 2017 UTC ()
Restore splnet for if_slowtimo

if_slowtimo (== if_watchdog) still requires splnet for most drivers.

Pointed out by nonaka@


(ozaki-r)
diff -r1.373 -r1.374 src/sys/net/if.c

cvs diff -r1.373 -r1.374 src/sys/net/if.c (expand / switch to unified diff)

--- src/sys/net/if.c 2017/01/23 10:19:03 1.373
+++ src/sys/net/if.c 2017/01/24 07:58:58 1.374
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if.c,v 1.373 2017/01/23 10:19:03 ozaki-r Exp $ */ 1/* $NetBSD: if.c,v 1.374 2017/01/24 07:58:58 ozaki-r Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by William Studenmund and Jason R. Thorpe. 8 * by William Studenmund and Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -80,27 +80,27 @@ @@ -80,27 +80,27 @@
80 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 80 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
81 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 81 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
82 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 82 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
83 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 83 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
84 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 84 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
85 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 85 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
86 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 86 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
87 * SUCH DAMAGE. 87 * SUCH DAMAGE.
88 * 88 *
89 * @(#)if.c 8.5 (Berkeley) 1/9/95 89 * @(#)if.c 8.5 (Berkeley) 1/9/95
90 */ 90 */
91 91
92#include <sys/cdefs.h> 92#include <sys/cdefs.h>
93__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.373 2017/01/23 10:19:03 ozaki-r Exp $"); 93__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.374 2017/01/24 07:58:58 ozaki-r Exp $");
94 94
95#if defined(_KERNEL_OPT) 95#if defined(_KERNEL_OPT)
96#include "opt_inet.h" 96#include "opt_inet.h"
97#include "opt_ipsec.h" 97#include "opt_ipsec.h"
98 98
99#include "opt_atalk.h" 99#include "opt_atalk.h"
100#include "opt_natm.h" 100#include "opt_natm.h"
101#include "opt_wlan.h" 101#include "opt_wlan.h"
102#include "opt_net_mpsafe.h" 102#include "opt_net_mpsafe.h"
103#endif 103#endif
104 104
105#include <sys/param.h> 105#include <sys/param.h>
106#include <sys/mbuf.h> 106#include <sys/mbuf.h>
@@ -2440,27 +2440,27 @@ if_up(struct ifnet *ifp) @@ -2440,27 +2440,27 @@ if_up(struct ifnet *ifp)
2440 * call the appropriate interface routine on expiration. 2440 * call the appropriate interface routine on expiration.
2441 */ 2441 */
2442static void 2442static void
2443if_slowtimo(void *arg) 2443if_slowtimo(void *arg)
2444{ 2444{
2445 void (*slowtimo)(struct ifnet *); 2445 void (*slowtimo)(struct ifnet *);
2446 struct ifnet *ifp = arg; 2446 struct ifnet *ifp = arg;
2447 int s; 2447 int s;
2448 2448
2449 slowtimo = ifp->if_slowtimo; 2449 slowtimo = ifp->if_slowtimo;
2450 if (__predict_false(slowtimo == NULL)) 2450 if (__predict_false(slowtimo == NULL))
2451 return; 2451 return;
2452 2452
2453 s = splsoftnet(); 2453 s = splnet();
2454 if (ifp->if_timer != 0 && --ifp->if_timer == 0) 2454 if (ifp->if_timer != 0 && --ifp->if_timer == 0)
2455 (*slowtimo)(ifp); 2455 (*slowtimo)(ifp);
2456 2456
2457 splx(s); 2457 splx(s);
2458 2458
2459 if (__predict_true(ifp->if_slowtimo != NULL)) 2459 if (__predict_true(ifp->if_slowtimo != NULL))
2460 callout_schedule(ifp->if_slowtimo_ch, hz / IFNET_SLOWHZ); 2460 callout_schedule(ifp->if_slowtimo_ch, hz / IFNET_SLOWHZ);
2461} 2461}
2462 2462
2463/* 2463/*
2464 * Set/clear promiscuous mode on interface ifp based on the truth value 2464 * Set/clear promiscuous mode on interface ifp based on the truth value
2465 * of pswitch. The calls are reference counted so that only the first 2465 * of pswitch. The calls are reference counted so that only the first
2466 * "on" request actually has an effect, as does the final "off" request. 2466 * "on" request actually has an effect, as does the final "off" request.