Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net ifnet(9): Make sure to use if_timer and if_watchdog ...



details:   https://anonhg.NetBSD.org/src/rev/b448764d7628
branches:  trunk
changeset: 369510:b448764d7628
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 20 15:11:27 2022 +0000

description:
ifnet(9): Make sure to use if_timer and if_watchdog at IPL_NET.

diffstat:

 sys/net/if.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (50 lines):

diff -r 300ab8943b7a -r b448764d7628 sys/net/if.c
--- a/sys/net/if.c      Sat Aug 20 14:17:36 2022 +0000
+++ b/sys/net/if.c      Sat Aug 20 15:11:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.516 2022/08/20 14:05:22 riastradh Exp $       */
+/*     $NetBSD: if.c,v 1.517 2022/08/20 15:11:27 riastradh 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.516 2022/08/20 14:05:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.517 2022/08/20 15:11:27 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2691,11 +2691,14 @@
 if_slowtimo_countdown(struct ifnet *ifp)
 {
        bool fire = false;
-
-       KERNEL_LOCK(1, NULL); /* for ifp->ifp_timer */
+       int s;
+
+       s = splnet();
+       KERNEL_LOCK(1, NULL);
        if (ifp->if_timer != 0 && --ifp->if_timer == 0)
                fire = true;
        KERNEL_UNLOCK_ONE(NULL);
+       splx(s);
 
        return fire;
 }
@@ -2727,10 +2730,13 @@
        struct if_slowtimo_data *isd =
            container_of(work, struct if_slowtimo_data, isd_work);
        struct ifnet *ifp = isd->isd_ifp;
-
+       int s;
+
+       s = splnet();
        KERNEL_LOCK(1, NULL);
        (*ifp->if_slowtimo)(ifp);
        KERNEL_UNLOCK_ONE(NULL);
+       splx(s);
 
        mutex_enter(&isd->isd_lock);
        if (isd->isd_trigger) {



Home | Main Index | Thread Index | Old Index