Module Name:    src
Committed By:   riastradh
Date:           Thu Sep 22 05:50:52 UTC 2022

Modified Files:
        src/sys/dev/pci: if_aq.c

Log Message:
aq(4): Don't schedule tick callout on interrupt if stopping.

Make sure to take the lock around access to sc_detect_linkstat too.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/if_aq.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/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.33 src/sys/dev/pci/if_aq.c:1.34
--- src/sys/dev/pci/if_aq.c:1.33	Fri Sep 16 03:55:53 2022
+++ src/sys/dev/pci/if_aq.c	Thu Sep 22 05:50:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.33 2022/09/16 03:55:53 skrll Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.34 2022/09/22 05:50:52 riastradh Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.33 2022/09/16 03:55:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.34 2022/09/22 05:50:52 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -3976,8 +3976,11 @@ aq_legacy_intr(void *arg)
 	AQ_WRITE_REG(sc, AQ_INTR_STATUS_CLR_REG, 0xffffffff);
 
 	if (status & __BIT(sc->sc_linkstat_irq)) {
+		AQ_LOCK(sc);
 		sc->sc_detect_linkstat = true;
-		callout_schedule(&sc->sc_tick_ch, 0);
+		if (!sc->sc_stopping)
+			callout_schedule(&sc->sc_tick_ch, 0);
+		AQ_UNLOCK(sc);
 		nintr++;
 	}
 
@@ -4029,8 +4032,11 @@ aq_link_intr(void *arg)
 
 	status = AQ_READ_REG(sc, AQ_INTR_STATUS_REG);
 	if (status & __BIT(sc->sc_linkstat_irq)) {
+		AQ_LOCK(sc);
 		sc->sc_detect_linkstat = true;
-		callout_schedule(&sc->sc_tick_ch, 0);
+		if (!sc->sc_stopping)
+			callout_schedule(&sc->sc_tick_ch, 0);
+		AQ_UNLOCK(sc);
 		AQ_WRITE_REG(sc, AQ_INTR_STATUS_CLR_REG,
 		    __BIT(sc->sc_linkstat_irq));
 		nintr++;

Reply via email to