summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_iwm.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2017-05-08 14:27:29 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2017-05-08 14:27:29 +0000
commitf8ada8ed7e37bd3b43cc882fa9cb6275aa527a75 (patch)
treee6144b3c21fe2318eaa5992e772a01acb2d9325e /sys/dev/pci/if_iwm.c
parentb0abc5bbd96e8872485706555953806f102543b6 (diff)
In iwm_send_cmd(), look at the generation counter instead of the STOPPED flag
to determine whether the interface was reset while we were sleeping. The flag will be set if the interface is still down when the task wakes up, but the interface could already be up again in which case the flag will be cleared. ok mpi@ kettenis@
Diffstat (limited to 'sys/dev/pci/if_iwm.c')
-rw-r--r--sys/dev/pci/if_iwm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 4762ded3f97..d3231b88361 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.180 2017/05/08 12:41:23 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.181 2017/05/08 14:27:28 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -3630,6 +3630,7 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
int group_id;
size_t hdrlen, datasz;
uint8_t *data;
+ int generation = sc->sc_generation;
code = hcmd->id;
async = hcmd->flags & IWM_CMD_ASYNC;
@@ -3651,7 +3652,7 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
* Is the hardware still available? (after e.g. above wait).
*/
s = splnet();
- if (sc->sc_flags & IWM_FLAG_STOPPED) {
+ if (generation != sc->sc_generation) {
err = ENXIO;
goto out;
}
@@ -3764,7 +3765,6 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, ring->qid << 8 | ring->cur);
if (!async) {
- int generation = sc->sc_generation;
err = tsleep(desc, PCATCH, "iwmcmd", hz);
if (err == 0) {
/* if hardware is no longer up, return error */