summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-09-08 03:16:28 +0000
committeradrian <adrian@FreeBSD.org>2014-09-08 03:16:28 +0000
commitfeffa4327838f3f49d72e0e9921cb91cad7a3155 (patch)
treed815d4799e3042c6722bb34bdf1b75247b544ac1
parent5216ab22802e5d267564a06ae7d1a4eb046b2ed0 (diff)
downloadFreeBSD-src-feffa4327838f3f49d72e0e9921cb91cad7a3155.zip
FreeBSD-src-feffa4327838f3f49d72e0e9921cb91cad7a3155.tar.gz
(more) correctly account TX completion status for A-MPDU session frames.
The rules turn out to be: * for non-aggregation session TX queues - it's either sent or not sent. * for aggregation session TX queues - if nframes=1, then the status reflects the completed transmission. * however, for nframes > 1, then this is just a status reflecting what the initial transmission did. The compressed BA (immediate or delayed) may not have yet been received, so the actual frame status is in the compressed BA updates. Whilst here, I fiddled with debugging and formatting a bit. There's also RTS attempts (what the atheros chips call "short retries") which weren't being logged and they aren't yet being used in the rate control statistics updates. For now, at least log them. TODO: * This still isn't 100% correct! So I have to tinker with this some more. (The failures aren't always failures..) * Extend the rate control API in net80211 so it can take both short and long retry counts. Tested: * Intel 5100, STA mode
-rw-r--r--sys/dev/iwn/if_iwn.c79
1 files changed, 53 insertions, 26 deletions
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 34a4321..a0f64db 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -3125,6 +3125,7 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
KASSERT(ni != NULL, ("no node"));
KASSERT(m != NULL, ("no mbuf"));
+ DPRINTF(sc, IWN_DEBUG_XMIT, "%s: freeing m=%p\n", __func__, m);
ieee80211_tx_complete(ni, m, 1);
txq->queued--;
@@ -3151,9 +3152,11 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
return;
/*
- * XXX does this correctly process an almost empty bitmap?
- * (since it bails out when it sees an empty bitmap, but there
- * may be failed bits there..)
+ * Walk the bitmap and calculate how many successful and failed
+ * attempts are made.
+ *
+ * Yes, the rate control code doesn't know these are A-MPDU
+ * subframes and that it's okay to fail some of these.
*/
ni = tap->txa_ni;
bitmap = (le64toh(ba->bitmap) >> shift) & wn->agg[tid].bitmap;
@@ -3172,7 +3175,8 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
bitmap >>= 1;
}
- DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT, "->%s: end; %d ok; %d err\n",__func__, tx_ok, tx_err);
+ DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT,
+ "->%s: end; %d ok; %d err\n",__func__, tx_ok, tx_err);
}
@@ -3423,9 +3427,12 @@ iwn4965_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
ring = &sc->txq[qid];
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: "
- "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n",
- __func__, desc->qid, desc->idx, stat->ackfailcnt,
- stat->btkillcnt, stat->rate, le16toh(stat->duration),
+ "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n",
+ __func__, desc->qid, desc->idx,
+ stat->rtsfailcnt,
+ stat->ackfailcnt,
+ stat->btkillcnt,
+ stat->rate, le16toh(stat->duration),
le32toh(stat->status));
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
@@ -3450,9 +3457,12 @@ iwn5000_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
ring = &sc->txq[qid];
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: "
- "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n",
- __func__, desc->qid, desc->idx, stat->ackfailcnt,
- stat->btkillcnt, stat->rate, le16toh(stat->duration),
+ "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n",
+ __func__, desc->qid, desc->idx,
+ stat->rtsfailcnt,
+ stat->ackfailcnt,
+ stat->btkillcnt,
+ stat->rate, le16toh(stat->duration),
le32toh(stat->status));
#ifdef notyet
@@ -3595,6 +3605,8 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
uint8_t tid;
int bit, i, lastidx, *res, seqno, shift, start;
+ /* XXX TODO: status is le16 field! Grr */
+
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
DPRINTF(sc, IWN_DEBUG_XMIT, "%s: nframes=%d, status=0x%08x\n",
__func__,
@@ -3606,6 +3618,18 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
wn = (void *)tap->txa_ni;
ni = tap->txa_ni;
+ /*
+ * XXX TODO: ACK and RTS failures would be nice here!
+ */
+
+ /*
+ * A-MPDU single frame status - if we failed to transmit it
+ * in A-MPDU, then it may be a permanent failure.
+ *
+ * XXX TODO: check what the Linux iwlwifi driver does here;
+ * there's some permanent and temporary failures that may be
+ * handled differently.
+ */
if (nframes == 1) {
if ((*status & 0xff) != 1 && (*status & 0xff) != 2) {
#ifdef NOT_YET
@@ -3616,24 +3640,26 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
* notification is pushed up to the rate control
* layer.
*/
- ieee80211_ratectl_tx_complete(ni->ni_vap, ni,
- IEEE80211_RATECTL_TX_FAILURE, &nframes, NULL);
+ ieee80211_ratectl_tx_complete(ni->ni_vap,
+ ni,
+ IEEE80211_RATECTL_TX_FAILURE,
+ &ackfailcnt,
+ NULL);
+ } else {
+ /*
+ * If nframes=1, then we won't be getting a BA for
+ * this frame. Ensure that we correctly update the
+ * rate control code with how many retries were
+ * needed to send it.
+ */
+ ieee80211_ratectl_tx_complete(ni->ni_vap,
+ ni,
+ IEEE80211_RATECTL_TX_SUCCESS,
+ &ackfailcnt,
+ NULL);
}
}
- /*
- * We succeeded with some frames, so let's update how many
- * retries were needed for this frame.
- *
- * XXX we can't yet pass tx_complete tx_cnt and success_cnt,
- * le sigh.
- */
- ieee80211_ratectl_tx_complete(ni->ni_vap,
- ni,
- IEEE80211_RATECTL_TX_SUCCESS,
- &ackfailcnt,
- NULL);
-
bitmap = 0;
start = idx;
for (i = 0; i < nframes; i++) {
@@ -3671,6 +3697,7 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
ssn = tap->txa_start & 0xfff;
}
+ /* This is going nframes DWORDS into the descriptor? */
seqno = le32toh(*(status + nframes)) & 0xfff;
for (lastidx = (seqno & 0xff); ring->read != lastidx;) {
data = &ring->data[ring->read];
@@ -3684,7 +3711,7 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes,
KASSERT(ni != NULL, ("no node"));
KASSERT(m != NULL, ("no mbuf"));
-
+ DPRINTF(sc, IWN_DEBUG_XMIT, "%s: freeing m=%p\n", __func__, m);
ieee80211_tx_complete(ni, m, 1);
ring->queued--;
OpenPOWER on IntegriCloud