Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci aq(4): Don't schedule tick callout on interrupt ...



details:   https://anonhg.NetBSD.org/src/rev/23ea1fb7a722
branches:  trunk
changeset: 370632:23ea1fb7a722
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Sep 22 05:50:52 2022 +0000

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

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

diffstat:

 sys/dev/pci/if_aq.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r c2db90798181 -r 23ea1fb7a722 sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Thu Sep 22 03:31:04 2022 +0000
+++ b/sys/dev/pci/if_aq.c       Thu Sep 22 05:50:52 2022 +0000
@@ -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_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 @@
 
        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++;



Home | Main Index | Thread Index | Old Index