diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c index 2f22372..ebdc7d4 100644 --- a/sys/dev/netif/ath/ath/if_ath.c +++ b/sys/dev/netif/ath/ath/if_ath.c @@ -1730,14 +1730,23 @@ static struct ath_buf * _ath_getbuf_locked(struct ath_softc *sc) { struct ath_buf *bf; - + int tries = 0; +start: bf = STAILQ_FIRST(&sc->sc_txbuf); - if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) - STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list); - else - bf = NULL; + if (bf != NULL) { + if ((bf->bf_flags & ATH_BUF_BUSY) == 0) { + STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list); + kprintf("ath: making orphan xmit buffer\n"); + if (++tries == 4) + return (NULL); + goto start; + } else { + STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list); + } + } + if (bf == NULL) { - kprintf("ath: ran out of descriptors\n"); + kprintf("ath: ran out of xmit buffers\n"); DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %s\n", __func__, STAILQ_FIRST(&sc->sc_txbuf) == NULL ? "out of xmit buffers" : "xmit buffer busy");