]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
wpi(4): fix possible race between TX/RX threads.
authoradrian <adrian@FreeBSD.org>
Sun, 11 Oct 2015 01:56:46 +0000 (01:56 +0000)
committeradrian <adrian@FreeBSD.org>
Sun, 11 Oct 2015 01:56:46 +0000 (01:56 +0000)
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by: <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3766

sys/dev/wpi/if_wpi.c

index 44077f06a5765cede68f717ea78bbb6d371cd1cf..716b62d36ddfd6521514b2f0892a3e10be2581e7 100644 (file)
@@ -1093,6 +1093,7 @@ wpi_update_rx_ring_ps(struct wpi_softc *sc)
                return;
        }
 
+       WPI_TXQ_LOCK(sc);
        WPI_SETBITS(sc, WPI_GP_CNTRL, WPI_GP_CNTRL_MAC_ACCESS_REQ);
        if (WPI_READ(sc, WPI_GP_CNTRL) & WPI_GP_CNTRL_SLEEP) {
                DPRINTF(sc, WPI_DEBUG_PWRSAVE, "%s: wakeup request\n",
@@ -1102,6 +1103,7 @@ wpi_update_rx_ring_ps(struct wpi_softc *sc)
                wpi_update_rx_ring(sc);
                WPI_CLRBITS(sc, WPI_GP_CNTRL, WPI_GP_CNTRL_MAC_ACCESS_REQ);
        }
+       WPI_TXQ_UNLOCK(sc);
 }
 
 static void