Module Name: src
Committed By: mrg
Date: Mon Sep 9 07:20:16 UTC 2019
Modified Files:
src/sys/dev/usb: usbnet.c usbnet.h
Log Message:
document usbnet_private locking. minor knf.
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/usbnet.h
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.27 src/sys/dev/usb/usbnet.c:1.28
--- src/sys/dev/usb/usbnet.c:1.27 Sun Sep 8 19:00:33 2019
+++ src/sys/dev/usb/usbnet.c Mon Sep 9 07:20:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.27 2019/09/08 19:00:33 mrg Exp $ */
+/* $NetBSD: usbnet.c,v 1.28 2019/09/09 07:20:16 mrg Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.27 2019/09/08 19:00:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.28 2019/09/09 07:20:16 mrg Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -59,6 +59,11 @@ struct usbnet_private {
* - unp_rxlock protects the rx path and its data
* - unp_txlock protects the tx path and its data
* - unp_detachcv handles detach vs open references
+ *
+ * the lock ordering is:
+ * ifnet lock -> unp_lock -> unp_rxlock -> unp_txlock
+ * unp_lock -> unp_miilock
+ * and unp_lock may be dropped after taking unp_miilock.
*/
kmutex_t unp_lock;
kmutex_t unp_miilock;
Index: src/sys/dev/usb/usbnet.h
diff -u src/sys/dev/usb/usbnet.h:1.14 src/sys/dev/usb/usbnet.h:1.15
--- src/sys/dev/usb/usbnet.h:1.14 Fri Aug 23 04:32:57 2019
+++ src/sys/dev/usb/usbnet.h Mon Sep 9 07:20:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.h,v 1.14 2019/08/23 04:32:57 mrg Exp $ */
+/* $NetBSD: usbnet.h,v 1.15 2019/09/09 07:20:16 mrg Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -343,7 +343,8 @@ void usbnet_input(struct usbnet * const,
/* autoconf */
void usbnet_attach(struct usbnet *un, const char *);
-void usbnet_attach_ifp(struct usbnet *, unsigned, unsigned, const struct usbnet_mii *);
+void usbnet_attach_ifp(struct usbnet *, unsigned, unsigned,
+ const struct usbnet_mii *);
int usbnet_detach(device_t, int);
int usbnet_activate(device_t, devact_t);