Module Name:    src
Committed By:   riastradh
Date:           Thu Nov  2 13:49:49 UTC 2023

Modified Files:
        src/sys/dev/ic: dwc_eqos.c dwc_eqos_var.h

Log Message:
eqos(4): Don't touch if_flags in tx path.

Can't touch this without IFNET_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/dwc_eqos.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/dwc_eqos_var.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/ic/dwc_eqos.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.30 src/sys/dev/ic/dwc_eqos.c:1.31
--- src/sys/dev/ic/dwc_eqos.c:1.30	Thu Nov  2 13:49:37 2023
+++ src/sys/dev/ic/dwc_eqos.c	Thu Nov  2 13:49:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill <jmcne...@invisible.ca>
@@ -38,7 +38,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.30 2023/11/02 13:49:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.31 2023/11/02 13:49:49 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -698,6 +698,9 @@ eqos_init_locked(struct eqos_softc *sc)
 	/* Enable interrupts */
 	eqos_enable_intr(sc);
 
+	EQOS_ASSERT_TXLOCKED(sc);
+	sc->sc_txrunning = true;
+
 	sc->sc_running = true;
 	ifp->if_flags |= IFF_RUNNING;
 
@@ -731,6 +734,10 @@ eqos_stop_locked(struct eqos_softc *sc, 
 
 	EQOS_ASSERT_LOCKED(sc);
 
+	EQOS_TXLOCK(sc);
+	sc->sc_txrunning = false;
+	EQOS_TXUNLOCK(sc);
+
 	sc->sc_running = false;
 	callout_halt(&sc->sc_stat_ch, &sc->sc_lock);
 
@@ -1010,7 +1017,7 @@ eqos_start_locked(struct eqos_softc *sc)
 
 	EQOS_ASSERT_TXLOCKED(sc);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
+	if (!sc->sc_txrunning)
 		return;
 
 	for (cnt = 0, start = sc->sc_tx.cur; ; cnt++) {

Index: src/sys/dev/ic/dwc_eqos_var.h
diff -u src/sys/dev/ic/dwc_eqos_var.h:1.7 src/sys/dev/ic/dwc_eqos_var.h:1.8
--- src/sys/dev/ic/dwc_eqos_var.h:1.7	Thu Nov  2 13:49:37 2023
+++ src/sys/dev/ic/dwc_eqos_var.h	Thu Nov  2 13:49:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_var.h,v 1.7 2023/11/02 13:49:37 riastradh Exp $ */
+/* $NetBSD: dwc_eqos_var.h,v 1.8 2023/11/02 13:49:49 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill <jmcne...@invisible.ca>
@@ -71,6 +71,7 @@ struct eqos_softc {
 	kmutex_t		sc_lock;
 	kmutex_t		sc_txlock;
 	bool			sc_running;
+	bool			sc_txrunning;
 
 	struct eqos_ring	sc_tx;
 	struct eqos_ring	sc_rx;

Reply via email to