Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:56:44 UTC 2022

Modified Files:
        src/sys/dev/usb: usbnet.c

Log Message:
usbnet: On if_stop, abort xfers before resetting hardware.

uno_stop is supposed to have exclusive access to the hardware; this
ensures that any concurrent uno_rx_loop has completed before we enter
uno_stop.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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.90 src/sys/dev/usb/usbnet.c:1.91
--- src/sys/dev/usb/usbnet.c:1.90	Thu Mar  3 05:56:28 2022
+++ src/sys/dev/usb/usbnet.c	Thu Mar  3 05:56:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.90 2022/03/03 05:56:28 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.91 2022/03/03 05:56:44 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.90 2022/03/03 05:56:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.91 2022/03/03 05:56:44 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1130,6 +1130,9 @@ usbnet_stop(struct usbnet *un, struct if
 	usb_rem_task_wait(un->un_udev, &unp->unp_ticktask, USB_TASKQ_DRIVER,
 	    &unp->unp_core_lock);
 
+	/* Stop transfers. */
+	usbnet_ep_stop_pipes(un);
+
 	/*
 	 * Now that the software is quiescent, ask the driver to stop
 	 * the hardware.  The driver's uno_stop routine now has
@@ -1143,9 +1146,6 @@ usbnet_stop(struct usbnet *un, struct if
 	if (!usbnet_isdying(un))
 		uno_stop(un, ifp, disable);
 
-	/* Stop transfers. */
-	usbnet_ep_stop_pipes(un);
-
 	/* Free RX/TX resources. */
 	usbnet_rx_list_fini(un);
 	usbnet_tx_list_fini(un);

Reply via email to