-/* $OpenBSD: if_iwx.c,v 1.122 2021/11/22 10:47:55 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.123 2021/11/22 10:54:36 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
bus_dmamap_sync(sc->sc_dmat, data->map, 0, IWX_RBUF_SIZE,
BUS_DMASYNC_POSTREAD);
- sc->sc_tx_timer = 0;
-
/* Sanity checks. */
if (sizeof(*tx_resp) > len)
return;
tx_resp->frame_count * sizeof(tx_resp->status) > len)
return;
+ sc->sc_tx_timer[qid] = 0;
+
if (tx_resp->frame_count > 1) /* A-MPDU */
return;
idx = le16toh(ba_tfd->tfd_index);
if (idx >= IWX_TX_RING_COUNT)
continue;
- sc->sc_tx_timer = 0;
+ sc->sc_tx_timer[qid] = 0;
iwx_txq_advance(sc, ring, idx);
iwx_clear_oactive(sc, ring);
}
sc->qfullmsk |= 1 << ring->qid;
}
+ if (ic->ic_if.if_flags & IFF_UP)
+ sc->sc_tx_timer[ring->qid] = 15;
+
return 0;
}
continue;
}
- if (ifp->if_flags & IFF_UP) {
- sc->sc_tx_timer = 15;
+ if (ifp->if_flags & IFF_UP)
ifp->if_timer = 1;
- }
}
return;
struct iwx_rxba_data *rxba = &sc->sc_rxba_data[i];
iwx_clear_reorder_buffer(sc, rxba);
}
- ifp->if_timer = sc->sc_tx_timer = 0;
+ memset(sc->sc_tx_timer, 0, sizeof(sc->sc_tx_timer));
+ ifp->if_timer = 0;
splx(s);
}
iwx_watchdog(struct ifnet *ifp)
{
struct iwx_softc *sc = ifp->if_softc;
+ int i;
ifp->if_timer = 0;
- if (sc->sc_tx_timer > 0) {
- if (--sc->sc_tx_timer == 0) {
- printf("%s: device timeout\n", DEVNAME(sc));
- if (ifp->if_flags & IFF_DEBUG) {
- iwx_nic_error(sc);
- iwx_dump_driver_status(sc);
+
+ /*
+ * We maintain a separate timer for each Tx queue because
+ * Tx aggregation queues can get "stuck" while other queues
+ * keep working. The Linux driver uses a similar workaround.
+ */
+ for (i = 0; i < nitems(sc->sc_tx_timer); i++) {
+ if (sc->sc_tx_timer[i] > 0) {
+ if (--sc->sc_tx_timer[i] == 0) {
+ printf("%s: device timeout\n", DEVNAME(sc));
+ if (ifp->if_flags & IFF_DEBUG) {
+ iwx_nic_error(sc);
+ iwx_dump_driver_status(sc);
+ }
+ if ((sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0)
+ task_add(systq, &sc->init_task);
+ ifp->if_oerrors++;
+ return;
}
- if ((sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0)
- task_add(systq, &sc->init_task);
- ifp->if_oerrors++;
- return;
+ ifp->if_timer = 1;
}
- ifp->if_timer = 1;
}
ieee80211_watchdog(ifp);