From a108d2d6c616d19ab5f102a6d01a1569bf86be6f Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Mon, 11 Jun 2012 06:59:28 +0000 Subject: [PATCH] Revert r233227 and followup commits as it breaks CCMP PN replay detection. This showed up when doing heavy UDP throughput on SMP machines. The problem with this is because the 802.11 sequence number is being allocated separately to the CCMP PN replay number (which is assigned during ieee80211_crypto_encap()). Under significant throughput (200+ MBps) the TX path would be stressed enough that frame TX/retry would force sequence number and PN allocation to be out of order. So once the frames were reordered via 802.11 seqnos, the CCMP PN would be far out of order, causing most frames to be discarded by the receiver. I've fixed this in some local work by being forced to: (a) deal with the issues that lead to the parallel TX causing out of order sequence numbers in the first place; (b) fix all the packet queuing issues which lead to strange (but mostly valid) TX. I'll begin fixing these in a subsequent commit or five. PR: kern/166190 --- sys/dev/ath/if_ath_debug.c | 3 - sys/dev/ath/if_ath_tx.c | 233 ++++++------------------------------- sys/dev/ath/if_ath_tx.h | 2 - sys/dev/ath/if_ath_tx_ht.c | 65 +---------- sys/dev/ath/if_athvar.h | 4 +- 5 files changed, 35 insertions(+), 272 deletions(-) diff --git a/sys/dev/ath/if_ath_debug.c b/sys/dev/ath/if_ath_debug.c index e96013644f12..0b49a06bb703 100644 --- a/sys/dev/ath/if_ath_debug.c +++ b/sys/dev/ath/if_ath_debug.c @@ -144,9 +144,6 @@ ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *first_bf, bf->bf_state.bfs_retries, bf->bf_state.bfs_addedbaw, bf->bf_state.bfs_dobaw); - printf(" SEQNO_ASSIGNED: %d, NEED_SEQNO: %d\n", - bf->bf_state.bfs_seqno_assigned, - bf->bf_state.bfs_need_seqno); printf(" %08x %08x %08x %08x %08x %08x\n", ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c index c188e452939f..cb12dcaa187f 100644 --- a/sys/dev/ath/if_ath_tx.c +++ b/sys/dev/ath/if_ath_tx.c @@ -109,10 +109,10 @@ static int ath_tx_ampdu_pending(struct ath_softc *sc, struct ath_node *an, int tid); static int ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node *an, int tid); +static ieee80211_seq ath_tx_tid_seqno_assign(struct ath_softc *sc, + struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); static int ath_tx_action_frame_override_queue(struct ath_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, int *tid); -static int ath_tx_seqno_required(struct ath_softc *sc, - struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); /* * Whether to use the 11n rate scenario functions or not @@ -1436,7 +1436,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, int ismcast; const struct ieee80211_frame *wh; int is_ampdu, is_ampdu_tx, is_ampdu_pending; - //ieee80211_seq seqno; + ieee80211_seq seqno; uint8_t type, subtype; /* @@ -1488,9 +1488,8 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, is_ampdu_pending = ath_tx_ampdu_pending(sc, ATH_NODE(ni), tid); is_ampdu = is_ampdu_tx | is_ampdu_pending; - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p, tid=%d, ac=%d, is_ampdu=%d\n", - __func__, bf, tid, pri, is_ampdu); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ac=%d, is_ampdu=%d\n", + __func__, tid, pri, is_ampdu); /* * When servicing one or more stations in power-save mode @@ -1506,9 +1505,6 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, /* Do the generic frame setup */ /* XXX should just bzero the bf_state? */ bf->bf_state.bfs_dobaw = 0; - bf->bf_state.bfs_seqno_assigned = 0; - bf->bf_state.bfs_need_seqno = 0; - bf->bf_state.bfs_seqno = -1; /* XXX debugging */ /* A-MPDU TX? Manually set sequence number */ /* Don't do it whilst pending; the net80211 layer still assigns them */ @@ -1521,16 +1517,15 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, * don't get a sequence number from the current * TID and thus mess with the BAW. */ - //seqno = ath_tx_tid_seqno_assign(sc, ni, bf, m0); - if (ath_tx_seqno_required(sc, ni, bf, m0)) { + seqno = ath_tx_tid_seqno_assign(sc, ni, bf, m0); + if (IEEE80211_QOS_HAS_SEQ(wh) && + subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL) { bf->bf_state.bfs_dobaw = 1; - bf->bf_state.bfs_need_seqno = 1; } ATH_TXQ_UNLOCK(txq); } else { /* No AMPDU TX, we've been assigned a sequence number. */ if (IEEE80211_QOS_HAS_SEQ(wh)) { - bf->bf_state.bfs_seqno_assigned = 1; /* XXX we should store the frag+seqno in bfs_seqno */ bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; @@ -1541,7 +1536,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, * If needed, the sequence number has been assigned. * Squirrel it away somewhere easy to get to. */ - //bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; + bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; /* Is ampdu pending? fetch the seqno and print it out */ if (is_ampdu_pending) @@ -1558,10 +1553,6 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, /* At this point m0 could have changed! */ m0 = bf->bf_m; - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: DONE: bf=%p, tid=%d, ac=%d, is_ampdu=%d, dobaw=%d, seqno=%d\n", - __func__, bf, tid, pri, is_ampdu, bf->bf_state.bfs_dobaw, M_SEQNO_GET(m0)); - #if 1 /* * If it's a multicast frame, do a direct-dispatch to the @@ -2043,41 +2034,16 @@ ath_tx_addto_baw(struct ath_softc *sc, struct ath_node *an, if (bf->bf_state.bfs_isretried) return; - /* - * If this occurs we're in a lot of trouble. We should try to - * recover from this without the session hanging? - */ - if (! bf->bf_state.bfs_seqno_assigned) { - device_printf(sc->sc_dev, - "%s: bf=%p, seqno_assigned is 0?!\n", __func__, bf); - return; - } - tap = ath_tx_get_tx_tid(an, tid->tid); if (bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, - "%s: re-added? bf=%p, tid=%d, seqno %d; window %d:%d; " + "%s: re-added? tid=%d, seqno %d; window %d:%d; " "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), + __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), tap->txa_start, tap->txa_wnd, tid->baw_head, tid->baw_tail); - /* - * Verify that the given sequence number is not outside of the - * BAW. Complain loudly if that's the case. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, - SEQNO(bf->bf_state.bfs_seqno))) { - device_printf(sc->sc_dev, - "%s: bf=%p: outside of BAW?? tid=%d, seqno %d; window %d:%d; " - "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), - tap->txa_start, tap->txa_wnd, tid->baw_head, - tid->baw_tail); - - } - /* * ni->ni_txseqs[] is the currently allocated seqno. * the txa state contains the current baw start. @@ -2085,9 +2051,9 @@ ath_tx_addto_baw(struct ath_softc *sc, struct ath_node *an, index = ATH_BA_INDEX(tap->txa_start, SEQNO(bf->bf_state.bfs_seqno)); cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: bf=%p, tid=%d, seqno %d; window %d:%d; index=%d cindex=%d " + "%s: tid=%d, seqno %d; window %d:%d; index=%d cindex=%d " "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), + __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), tap->txa_start, tap->txa_wnd, index, cindex, tid->baw_head, tid->baw_tail); @@ -2190,9 +2156,9 @@ ath_tx_update_baw(struct ath_softc *sc, struct ath_node *an, cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: bf=%p: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, " + "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, " "baw head=%d, tail=%d\n", - __func__, bf, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, + __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, cindex, tid->baw_head, tid->baw_tail); /* @@ -2272,52 +2238,12 @@ ath_tx_tid_unsched(struct ath_softc *sc, struct ath_tid *tid) TAILQ_REMOVE(&txq->axq_tidq, tid, axq_qelem); } -/* - * Return whether a sequence number is actually required. - * - * A sequence number must only be allocated at the time that a frame - * is considered for addition to the BAW/aggregate and being TXed. - * The sequence number must not be allocated before the frame - * is added to the BAW (protected by the same lock instance) - * otherwise a the multi-entrant TX path may result in a later seqno - * being added to the BAW first. The subsequent addition of the - * earlier seqno would then not go into the BAW as it's now outside - * of said BAW. - * - * This routine is used by ath_tx_start() to mark whether the frame - * should get a sequence number before adding it to the BAW. - * - * Then the actual aggregate TX routines will check whether this - * flag is set and if the frame needs to go into the BAW, it'll - * have a sequence number allocated for it. - */ -static int -ath_tx_seqno_required(struct ath_softc *sc, struct ieee80211_node *ni, - struct ath_buf *bf, struct mbuf *m0) -{ - const struct ieee80211_frame *wh; - uint8_t subtype; - - wh = mtod(m0, const struct ieee80211_frame *); - subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; - - /* XXX assert txq lock */ - /* XXX assert ampdu is set */ - - return ((IEEE80211_QOS_HAS_SEQ(wh) && - subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL)); -} - /* * Assign a sequence number manually to the given frame. * * This should only be called for A-MPDU TX frames. - * - * If this is called after the initial frame setup, make sure you've flushed - * the DMA map or you'll risk sending stale data to the NIC. This routine - * updates the actual frame contents with the relevant seqno. */ -int +static ieee80211_seq ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0) { @@ -2330,22 +2256,8 @@ ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni, wh = mtod(m0, struct ieee80211_frame *); pri = M_WME_GETAC(m0); /* honor classification */ tid = WME_AC_TO_TID(pri); - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p, pri=%d, tid=%d, qos has seq=%d\n", - __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); - - if (! bf->bf_state.bfs_need_seqno) { - device_printf(sc->sc_dev, "%s: bf=%p: need_seqno not set?!\n", - __func__, bf); - return -1; - } - /* XXX check for bfs_need_seqno? */ - if (bf->bf_state.bfs_seqno_assigned) { - device_printf(sc->sc_dev, - "%s: bf=%p: seqno already assigned (%d)?!\n", - __func__, bf, SEQNO(bf->bf_state.bfs_seqno)); - return bf->bf_state.bfs_seqno >> IEEE80211_SEQ_SEQ_SHIFT; - } + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pri=%d, tid=%d, qos has seq=%d\n", + __func__, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); /* XXX Is it a control frame? Ignore */ @@ -2373,14 +2285,9 @@ ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni, } *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); M_SEQNO_SET(m0, seqno); - bf->bf_state.bfs_seqno = seqno << IEEE80211_SEQ_SEQ_SHIFT; - bf->bf_state.bfs_seqno_assigned = 1; /* Return so caller can do something with it if needed */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: -> seqno=%d\n", - __func__, - bf, - seqno); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: -> seqno=%d\n", __func__, seqno); return seqno; } @@ -2392,7 +2299,6 @@ ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni, static void ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) { - struct ieee80211_node *ni = &an->an_node; struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid]; struct ath_txq *txq = bf->bf_state.bfs_txq; struct ieee80211_tx_ampdu *tap; @@ -2408,81 +2314,10 @@ ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) return; } - /* - * TODO: If it's _before_ the BAW left edge, complain very loudly. - * This means something (else) has slid the left edge along - * before we got a chance to be TXed. - */ - - /* - * Is there space in this BAW for another frame? - * If not, don't bother trying to schedule it; just - * throw it back on the queue. - * - * If we allocate the sequence number before we add - * it to the BAW, we risk racing with another TX - * thread that gets in a frame into the BAW with - * seqno greater than ours. We'd then fail the - * below check and throw the frame on the tail of - * the queue. The sender would then have a hole. - * - * XXX again, we're protecting ni->ni_txseqs[tid] - * behind this hardware TXQ lock, like the rest of - * the TIDs that map to it. Ugh. - */ - if (bf->bf_state.bfs_dobaw) { - ieee80211_seq seqno; - - /* - * If the sequence number is allocated, use it. - * Otherwise, use the sequence number we WOULD - * allocate. - */ - if (bf->bf_state.bfs_seqno_assigned) - seqno = SEQNO(bf->bf_state.bfs_seqno); - else - seqno = ni->ni_txseqs[bf->bf_state.bfs_tid]; - - /* - * Check whether either the currently allocated - * sequence number _OR_ the to-be allocated - * sequence number is inside the BAW. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, seqno)) { - ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); - ath_tx_tid_sched(sc, tid); - return; - } - if (! bf->bf_state.bfs_seqno_assigned) { - int seqno; - - seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m); - if (seqno < 0) { - device_printf(sc->sc_dev, - "%s: bf=%p, huh, seqno=-1?\n", - __func__, - bf); - /* XXX what can we even do here? */ - } - /* Flush seqno update to RAM */ - /* - * XXX This is required because the dmasetup - * XXX is done early rather than at dispatch - * XXX time. Ew, we should fix this! - */ - bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, - BUS_DMASYNC_PREWRITE); - } - } - /* outside baw? queue */ if (bf->bf_state.bfs_dobaw && (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno)))) { - device_printf(sc->sc_dev, - "%s: bf=%p, shouldn't be outside BAW now?!\n", - __func__, - bf); ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); ath_tx_tid_sched(sc, tid); return; @@ -2539,8 +2374,8 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq, tid = ath_tx_gettid(sc, m0); atid = &an->an_tid[tid]; - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p, pri=%d, tid=%d, qos=%d, seqno=%d\n", - __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh), SEQNO(bf->bf_state.bfs_seqno)); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p, pri=%d, tid=%d, qos=%d\n", + __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); /* Set local packet state, used to queue packets to hardware */ bf->bf_state.bfs_tid = tid; @@ -2556,34 +2391,34 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq, ATH_TXQ_LOCK(txq); if (atid->paused) { /* TID is paused, queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: paused\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); } else if (ath_tx_ampdu_pending(sc, an, tid)) { /* AMPDU pending; queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: pending\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pending\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { /* AMPDU running, attempt direct dispatch if possible */ if (txq->axq_depth < sc->sc_hwq_limit) { - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p: xmit_aggr\n", - __func__, bf); ath_tx_xmit_aggr(sc, an, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: xmit_aggr\n", + __func__); } else { DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p: ampdu; swq'ing\n", - __func__, bf); + "%s: ampdu; swq'ing\n", + __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: xmit_normal\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__); ath_tx_xmit_normal(sc, txq, bf); } else { /* Busy; queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: swq'ing\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: swq'ing\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } @@ -2873,12 +2708,10 @@ ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, if (t == 0) { device_printf(sc->sc_dev, "%s: node %p: bf=%p: addbaw=%d, dobaw=%d, " - "seqno_assign=%d, seqno_required=%d, seqno=%d, retry=%d\n", + "seqno=%d, retry=%d\n", __func__, ni, bf, bf->bf_state.bfs_addedbaw, bf->bf_state.bfs_dobaw, - bf->bf_state.bfs_need_seqno, - bf->bf_state.bfs_seqno_assigned, SEQNO(bf->bf_state.bfs_seqno), bf->bf_state.bfs_retries); device_printf(sc->sc_dev, @@ -2888,11 +2721,11 @@ ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, tid->hwq_depth, tid->bar_wait); device_printf(sc->sc_dev, - "%s: node %p: bf=%p: tid %d: txq_depth=%d, " + "%s: node %p: tid %d: txq_depth=%d, " "txq_aggr_depth=%d, sched=%d, paused=%d, " "hwq_depth=%d, incomp=%d, baw_head=%d, " "baw_tail=%d txa_start=%d, ni_txseqs=%d\n", - __func__, ni, bf, tid->tid, txq->axq_depth, + __func__, ni, tid->tid, txq->axq_depth, txq->axq_aggr_depth, tid->sched, tid->paused, tid->hwq_depth, tid->incomp, tid->baw_head, tid->baw_tail, tap == NULL ? -1 : tap->txa_start, diff --git a/sys/dev/ath/if_ath_tx.h b/sys/dev/ath/if_ath_tx.h index 979a51b128b3..958acf9449e8 100644 --- a/sys/dev/ath/if_ath_tx.h +++ b/sys/dev/ath/if_ath_tx.h @@ -109,8 +109,6 @@ extern void ath_tx_addto_baw(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, struct ath_buf *bf); extern struct ieee80211_tx_ampdu * ath_tx_get_tx_tid(struct ath_node *an, int tid); -extern int ath_tx_tid_seqno_assign(struct ath_softc *sc, - struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); /* TX addba handling */ extern int ath_addba_request(struct ieee80211_node *ni, diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c index a2fc1c00eb94..96a153427d81 100644 --- a/sys/dev/ath/if_ath_tx_ht.c +++ b/sys/dev/ath/if_ath_tx_ht.c @@ -644,7 +644,7 @@ ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, ath_bufhead *bf_q) { - struct ieee80211_node *ni = &an->an_node; + //struct ieee80211_node *ni = &an->an_node; struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL; int nframes = 0; uint16_t aggr_limit = 0, al = 0, bpad = 0, al_delta, h_baw; @@ -750,75 +750,12 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, bf_first->bf_state.bfs_txflags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); - /* - * TODO: If it's _before_ the BAW left edge, complain very - * loudly. - * - * This means something (else) has slid the left edge along - * before we got a chance to be TXed. - */ - - /* - * Check if we have space in the BAW for this frame before - * we add it. - * - * see ath_tx_xmit_aggr() for more info. - */ - if (bf->bf_state.bfs_dobaw) { - ieee80211_seq seqno; - - /* - * If the sequence number is allocated, use it. - * Otherwise, use the sequence number we WOULD - * allocate. - */ - if (bf->bf_state.bfs_seqno_assigned) - seqno = SEQNO(bf->bf_state.bfs_seqno); - else - seqno = ni->ni_txseqs[bf->bf_state.bfs_tid]; - - /* - * Check whether either the currently allocated - * sequence number _OR_ the to-be allocated - * sequence number is inside the BAW. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, - seqno)) { - status = ATH_AGGR_BAW_CLOSED; - break; - } - - /* XXX check for bfs_need_seqno? */ - if (! bf->bf_state.bfs_seqno_assigned) { - int seqno; - seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m); - if (seqno < 0) { - device_printf(sc->sc_dev, - "%s: bf=%p, huh, seqno=-1?\n", - __func__, - bf); - /* XXX what can we even do here? */ - } - /* Flush seqno update to RAM */ - /* - * XXX This is required because the dmasetup - * XXX is done early rather than at dispatch - * XXX time. Ew, we should fix this! - */ - bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, - BUS_DMASYNC_PREWRITE); - } - } - /* * If the packet has a sequence number, do not * step outside of the block-ack window. */ if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno))) { - device_printf(sc->sc_dev, - "%s: bf=%p, seqno=%d, outside?!\n", - __func__, bf, SEQNO(bf->bf_state.bfs_seqno)); status = ATH_AGGR_BAW_CLOSED; break; } diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index e197368178ed..51cfab1d7e24 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -216,9 +216,7 @@ struct ath_buf { bfs_istxfrag:1, /* is fragmented */ bfs_ismrr:1, /* do multi-rate TX retry */ bfs_doprot:1, /* do RTS/CTS based protection */ - bfs_doratelookup:1, /* do rate lookup before each TX */ - bfs_need_seqno:1, /* need to assign a seqno for aggr */ - bfs_seqno_assigned:1; /* seqno has been assigned */ + bfs_doratelookup:1; /* do rate lookup before each TX */ int bfs_nfl; /* next fragment length */