summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-03 05:54:03 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-03 05:54:03 +0000
commit17992c7093a080e1a6713bb7497f045031875ec5 (patch)
tree39ffe5464bcfff9a1749f2911253b914032fa124 /sys/dev
parent89bee60cb51441c706cf99b74a960509e6711db2 (diff)
usbnet drivers: Assert IFNET_LOCKED in if ioctl routines.
These only happen either during the transition up or down (init or stop), or while that transition is excluded (ioctl). This may be called from ioctl or from init, which both hold the ifnet lock. XXX smsc_setoe_locked should maybe trigger reinit because the rx loop behaves differently depending on whether checksumming is enabled. XXX mue_sethwcsum_locked needs to exclude mcast updates.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_axen.c6
-rw-r--r--sys/dev/usb/if_mue.c8
-rw-r--r--sys/dev/usb/if_smsc.c6
3 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 6c3ff3edde9..d3436014fbd 100644
--- a/sys/dev/usb/if_axen.c
+++ b/sys/dev/usb/if_axen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axen.c,v 1.85 2022/03/03 05:53:33 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.86 2022/03/03 05:54:03 riastradh Exp $ */
/* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.85 2022/03/03 05:53:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.86 2022/03/03 05:54:03 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -516,7 +516,7 @@ axen_setoe_locked(struct usbnet *un)
uint64_t enabled = ifp->if_capenable;
uint8_t val;
- usbnet_isowned_core(un);
+ KASSERT(IFNET_LOCKED(ifp));
val = AXEN_RXCOE_OFF;
if (enabled & IFCAP_CSUM_IPv4_Rx)
diff --git a/sys/dev/usb/if_mue.c b/sys/dev/usb/if_mue.c
index 37a4d35687d..72b57a14b2f 100644
--- a/sys/dev/usb/if_mue.c
+++ b/sys/dev/usb/if_mue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mue.c,v 1.74 2022/03/03 05:53:33 riastradh Exp $ */
+/* $NetBSD: if_mue.c,v 1.75 2022/03/03 05:54:03 riastradh Exp $ */
/* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */
/*
@@ -20,7 +20,7 @@
/* Driver for Microchip LAN7500/LAN7800 chipsets. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.74 2022/03/03 05:53:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.75 2022/03/03 05:54:03 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1091,6 +1091,8 @@ mue_sethwcsum_locked(struct usbnet *un)
struct ifnet * const ifp = usbnet_ifp(un);
uint32_t reg, val;
+ KASSERT(IFNET_LOCKED(ifp));
+
reg = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL;
val = mue_csr_read(un, reg);
@@ -1123,6 +1125,8 @@ mue_setmtu_locked(struct usbnet *un)
struct ifnet * const ifp = usbnet_ifp(un);
uint32_t val;
+ KASSERT(IFNET_LOCKED(ifp));
+
/* Set the maximum frame size. */
MUE_CLRBIT(un, MUE_MAC_RX, MUE_MAC_RX_RXEN);
val = mue_csr_read(un, MUE_MAC_RX);
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index dff94287104..e89d2a9bfd3 100644
--- a/sys/dev/usb/if_smsc.c
+++ b/sys/dev/usb/if_smsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_smsc.c,v 1.84 2022/03/03 05:53:33 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.85 2022/03/03 05:54:03 riastradh Exp $ */
/* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.84 2022/03/03 05:53:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.85 2022/03/03 05:54:03 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -473,7 +473,7 @@ smsc_setoe_locked(struct usbnet *un)
uint32_t val;
int err;
- usbnet_isowned_core(un);
+ KASSERT(IFNET_LOCKED(ifp));
err = smsc_readreg(un, SMSC_COE_CTRL, &val);
if (err != 0) {