Module Name: src
Committed By: riastradh
Date: Thu Mar 3 05:46:58 UTC 2022
Modified Files:
src/sys/dev/usb: usbnet.c
Log Message:
usbnet: Set and clear IFF_RUNNING slightly earlier and later.
- Set IFF_RUNNING before any calls to usbnet_rxeof are possible.
- Don't clear IFF_RUNNING until all transfers have been aborted.
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/usbnet.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.45 src/sys/dev/usb/usbnet.c:1.46
--- src/sys/dev/usb/usbnet.c:1.45 Thu Mar 3 05:46:50 2022
+++ src/sys/dev/usb/usbnet.c Thu Mar 3 05:46:58 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.45 2022/03/03 05:46:50 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.46 2022/03/03 05:46:58 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.45 2022/03/03 05:46:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.46 2022/03/03 05:46:58 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -850,9 +850,6 @@ usbnet_init_rx_tx(struct usbnet * const
goto out;
}
- /* Start up the receive pipe(s). */
- usbnet_rx_start_pipes(un);
-
/* Indicate we are up and running. */
#if 0
/* XXX if_mcast_op() can call this without ifnet locked */
@@ -860,6 +857,9 @@ usbnet_init_rx_tx(struct usbnet * const
#endif
ifp->if_flags |= IFF_RUNNING;
+ /* Start up the receive pipe(s). */
+ usbnet_rx_start_pipes(un);
+
callout_schedule(&unp->unp_stat_ch, hz);
out:
@@ -1126,14 +1126,6 @@ usbnet_stop(struct usbnet *un, struct if
uno_stop(un, ifp, disable);
- /*
- * XXXSMP Would like to
- * KASSERT(IFNET_LOCKED(ifp))
- * here but the locking order is:
- * ifnet -> core_lock -> rxlock -> txlock
- * and core_lock is already held.
- */
- ifp->if_flags &= ~IFF_RUNNING;
unp->unp_timer = 0;
callout_halt(&unp->unp_stat_ch, &unp->unp_core_lock);
@@ -1150,6 +1142,15 @@ usbnet_stop(struct usbnet *un, struct if
/* Close pipes. */
usbnet_ep_close_pipes(un);
+ /*
+ * XXXSMP Would like to
+ * KASSERT(IFNET_LOCKED(ifp))
+ * here but the locking order is:
+ * ifnet -> core_lock -> rxlock -> txlock
+ * and core_lock is already held.
+ */
+ ifp->if_flags &= ~IFF_RUNNING;
+
usbnet_unbusy(un);
}