Changeset 3620

Show
Ignore:
Timestamp:
05/07/08 20:33:15 (4 months ago)
Author:
mentor
Message:

Remove axq_link, for benoit.

The last descriptor is now implicit in the structure and meta-data of the buffers; axq_link does not need to be maintained separately.
Add macros to to return the last buffer, descriptor, and link them as necessary.
Make the queue moving macro implicitly link descriptors, and remove the explicit descriptor linking in this case.

ath_node_move_data is still desperately in need of a review; it is used in XR.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/trunk/ath/if_ath.c

    r3619 r3620  
    21192119                                                            BUS_DMA_TODEVICE); 
    21202120 
    2121                                         if (uapsd_xmit_q->axq_link) { 
    2122                                                *uapsd_xmit_q->axq_link = 
    2123                                                         ath_ds_link_swap(STAILQ_FIRST(&an->an_uapsd_q)->bf_daddr); 
    2124                                         } 
    2125                                         /* below leaves an_uapsd_q NULL */ 
     2121   
     2122                                        ATH_TXQ_LINK_DESC(uapsd_xmit_q, 
     2123                                                        STAILQ_FIRST( 
     2124                                                       &an->an_uapsd_q)); 
     2125                                        /* Below leaves an_uapsd_q NULL. */ 
    21262126                                        STAILQ_CONCAT(&uapsd_xmit_q->axq_q, 
    21272127                                                      &an->an_uapsd_q); 
    2128                                         uapsd_xmit_q->axq_link = 
    2129                                                 &last_desc->ds_link; 
    21302128                                        ath_hal_puttxbuf(sc->sc_ah, 
    21312129                                                uapsd_xmit_q->axq_qnum, 
     
    29182916 
    29192917        DPRINTF(sc, ATH_DEBUG_WATCHDOG, "txq:%p : axq_qnum:%u axq_depth:%d " 
    2920                         "axq_link:%p TXDP:%08x\n", 
    2921                         txq, txq->axq_qnum, txq->axq_depth, txq->axq_link, 
     2918                        "TXDP:%08x\n", 
     2919                        txq, txq->axq_qnum, txq->axq_depth,  
    29222920                        ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum)); 
    29232921 
     
    29822980        if (ath_cac_running_dbgmsg(sc)) 
    29832981                return; 
    2984         /* 
    2985          * Insert the frame on the outbound list and 
    2986          * pass it on to the hardware. 
    2987          */ 
     2982 
     2983        /* Insert the frame on the outbound list and 
     2984         * pass it on to the hardware. */ 
    29882985        ATH_TXQ_LOCK_IRQ(txq); 
    29892986        if (ni && ni->ni_vap && txq == &ATH_VAP(ni->ni_vap)->av_mcastq) { 
    2990                 /* 
    2991                  * The CAB queue is started from the SWBA handler since 
    2992                  * frames only go out on DTIM and to avoid possible races. 
    2993                  */ 
     2987                /* The CAB queue is started from the SWBA handler since 
     2988                 * frames only go out on DTIM and to avoid possible races. */ 
    29942989                ath_hal_intrset(ah, sc->sc_imask & ~HAL_INT_SWBA); 
    2995                 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); 
    2996                 DPRINTF(sc, ATH_DEBUG_TX_PROC, "MC txq [%d] depth = %d\n",  
    2997                                 txq->axq_qnum, txq->axq_depth); 
    2998                 if (txq->axq_link != NULL) { 
    2999                         *txq->axq_link = ath_ds_link_swap(bf->bf_daddr); 
    3000                         DPRINTF(sc, ATH_DEBUG_XMIT, "link[%u](%p)=%08llx (%p)\n", 
    3001                                 txq->axq_qnum, txq->axq_link, 
    3002                                 (u_int64_t)bf->bf_daddr, bf->bf_desc); 
    3003                 } 
    3004                 txq->axq_link = &ds->ds_link; 
     2990 
     2991                ATH_TXQ_LINK_DESC(txq, bf); 
     2992                ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);  
     2993                DPRINTF(sc, ATH_DEBUG_XMIT,  
     2994                                "link[%u]=%08llx (%p)\n", 
     2995                                txq->axq_qnum,  
     2996                                (u_int64_t)bf->bf_daddr, bf->bf_desc); 
     2997 
    30052998                /* We do not start tx on this queue as it will be done as 
    3006                 "CAB" data at DTIM intervals. */ 
     2999                * "CAB" data at DTIM intervals. */ 
    30073000                ath_hal_intrset(ah, sc->sc_imask); 
    30083001        } else { 
     3002                ATH_TXQ_LINK_DESC(txq, bf); 
     3003                if (!STAILQ_FIRST(&txq->axq_q)) { 
     3004                        u_int32_t txdp; 
     3005 
     3006                        ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); 
     3007                        DPRINTF(sc, ATH_DEBUG_XMIT, "TXDP[%u] = %08llx (%p)\n", 
     3008                                txq->axq_qnum, (u_int64_t)bf->bf_daddr, 
     3009                                bf->bf_desc); 
     3010                        txdp = ath_hal_gettxbuf(ah, txq->axq_qnum); 
     3011                        if (txdp != bf->bf_daddr) { 
     3012                                DPRINTF(sc, ATH_DEBUG_WATCHDOG, 
     3013                                                "TXQ%d: BUG TXDP:%08x instead " 
     3014                                                "of %08llx\n", 
     3015                                                txq->axq_qnum, txdp, 
     3016                                                (u_int64_t)bf->bf_daddr); 
     3017                        } 
     3018                } 
    30093019                ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); 
     3020                 
    30103021                DPRINTF(sc, ATH_DEBUG_TX_PROC, "UC txq [%d] depth = %d\n",  
    30113022                                txq->axq_qnum, txq->axq_depth); 
    3012                 if (txq->axq_link == NULL) { 
    3013                         u_int32_t txdp; 
    3014  
    3015                         ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); 
    3016                         DPRINTF(sc, ATH_DEBUG_XMIT, "TXDP[%u] = %08llx (%p)\n", 
    3017                                 txq->axq_qnum, (u_int64_t)bf->bf_daddr, bf->bf_desc); 
    3018                         txdp = ath_hal_gettxbuf(ah, txq->axq_qnum); 
    3019                         if (txdp != bf->bf_daddr) { 
    3020                           DPRINTF(sc, ATH_DEBUG_WATCHDOG, 
    3021                                   "TXQ%d: BUG TXDP:%08x instead of %08llx\n", 
    3022                                   txq->axq_qnum, txdp, 
    3023                                   (u_int64_t)bf->bf_daddr); 
    3024                         } 
    3025                 } else { 
    3026                         *txq->axq_link = ath_ds_link_swap(bf->bf_daddr); 
    3027                         DPRINTF(sc, ATH_DEBUG_XMIT, "link[%u] (%p)=%08llx (%p)\n", 
    3028                                 txq->axq_qnum, txq->axq_link, 
     3023                DPRINTF(sc, ATH_DEBUG_XMIT, 
     3024                                "link[%u] (%08x)=%08llx (%p)\n", 
     3025                                txq->axq_qnum,  
     3026                                ATH_TXQ_LAST_DESC(txq)->ds_link, 
    30293027                                (u_int64_t)bf->bf_daddr, bf->bf_desc); 
    3030                 } 
    3031                 txq->axq_link = &ds->ds_link; 
     3028 
    30323029                ath_hal_txstart(ah, txq->axq_qnum); 
    30333030                sc->sc_dev->trans_start = jiffies; 
     
    50815078        curlen = skb->len; 
    50825079        DPRINTF(sc, ATH_DEBUG_BEACON, 
    5083                 "Updating beacon - mcast pending=%d.\n", avp->av_mcastq.axq_depth); 
    5084         if (ieee80211_beacon_update(SKB_NI(bf->bf_skb), &avp->av_boff, skb, !!avp->av_mcastq.axq_depth, &is_dtim)) { 
     5080                "Updating beacon - mcast pending=%d.\n", 
     5081                avp->av_mcastq.axq_depth); 
     5082        if (ieee80211_beacon_update(SKB_NI(bf->bf_skb), &avp->av_boff, skb, 
     5083                                !!STAILQ_FIRST(&avp->av_mcastq.axq_q), 
     5084                                &is_dtim)) { 
    50855085                bus_unmap_single(sc->sc_bdev, 
    50865086                        bf->bf_skbaddr, curlen, BUS_DMA_TODEVICE); 
     
    51025102        tim_bitctl = ((struct ieee80211_tim_ie *)avp->av_boff.bo_tim)->tim_bitctl; 
    51035103        if ((tim_bitctl & BITCTL_BUFD_MCAST) &&  
    5104             (avp->av_mcastq.axq_depth) &&  
    5105             (sc->sc_cabq->axq_depth) && 
     5104            STAILQ_FIRST(&avp->av_mcastq.axq_q) &&  
     5105            STAILQ_FIRST(&sc->sc_cabq->axq_q) && 
    51065106            (sc->sc_nvaps > 1) &&  
    51075107            (sc->sc_stagbeacons)) { 
     
    51095109                DPRINTF(sc, ATH_DEBUG_BEACON, 
    51105110                        "Drained previous cabq transmit traffic to make room for next VAP.\n"); 
    5111         } else if ((sc->sc_cabq->axq_depth) && 
    5112                 ATH_TXQ_SETUP(sc, sc->sc_cabq->axq_qnum) && 
    5113                  (!txqactive(sc->sc_ah,  sc->sc_cabq->axq_qnum))) { 
    5114                        DPRINTF(sc,  
    5115                                ATH_DEBUG_BEACON, 
    5116                                "Draining %d stalled CABQ transmit buffers.\n", 
    5117                                sc->sc_cabq->axq_depth); 
    5118                        ath_tx_draintxq(sc, sc->sc_cabq); 
     5111        } else if (STAILQ_FIRST(&sc->sc_cabq->axq_q) && 
     5112                       ATH_TXQ_SETUP(sc, sc->sc_cabq->axq_qnum) && 
     5113                       !txqactive(sc->sc_ah,  sc->sc_cabq->axq_qnum)) { 
     5114                DPRINTF(sc,  
     5115                        ATH_DEBUG_BEACON, 
     5116                        "Draining %d stalled CABQ transmit buffers.\n", 
     5117                        sc->sc_cabq->axq_depth); 
     5118                ath_tx_draintxq(sc, sc->sc_cabq); 
    51195119        } else { 
    51205120                DPRINTF(sc, ATH_DEBUG_BEACON, 
     
    51535153                bfmcast = STAILQ_FIRST(&avp->av_mcastq.axq_q); 
    51545154                if (bfmcast != NULL) { 
     5155                        struct ath_buf *tbf; 
    51555156                        DPRINTF(sc, ATH_DEBUG_BEACON, 
    51565157                                "Multicast pending.  " 
    51575158                                "Linking CABQ to avp->av_mcastq.axq_q.\n"); 
    5158                         /* link the descriptors */ 
    5159                         if (cabq->axq_link == NULL) { 
     5159 
     5160                        /* Set the MORE_DATA bit for each packet except the 
     5161                         * last one */ 
     5162                        STAILQ_FOREACH(tbf, &avp->av_mcastq.axq_q, bf_list) { 
     5163                                if (tbf != STAILQ_LAST(&avp->av_mcastq.axq_q,  
     5164                                                        ath_buf, bf_list)) 
     5165                                        ((struct ieee80211_frame *) 
     5166                                         tbf->bf_skb->data)->i_fc[1] |=  
     5167                                                IEEE80211_FC1_MORE_DATA; 
     5168                        } 
     5169 
     5170                        /* Append the private VAP mcast list to the cabq. */ 
     5171                        ATH_TXQ_MOVE_Q(&avp->av_mcastq, cabq); 
     5172                        if (!STAILQ_FIRST(&cabq->axq_q)) 
    51605173                                ath_hal_puttxbuf(ah, cabq->axq_qnum, 
    51615174                                                 bfmcast->bf_daddr); 
    5162                         } else { 
    5163                                 *cabq->axq_link = ath_ds_link_swap(bfmcast->bf_daddr); 
    5164                         } 
    5165                         /* Set the MORE_DATA bit for each packet except the last one */ 
    5166                         STAILQ_FOREACH(bfmcast, &avp->av_mcastq.axq_q, bf_list) { 
    5167                                 if (bfmcast != STAILQ_LAST(&avp->av_mcastq.axq_q,  
    5168                                                         ath_buf, bf_list)) 
    5169                                         ((struct ieee80211_frame *) 
    5170                                          bfmcast->bf_skb->data)->i_fc[1] |=  
    5171                                                 IEEE80211_FC1_MORE_DATA; 
    5172                         } 
    5173  
    5174                         /* append the private VAP mcast list to the cabq */ 
    5175                         ATH_TXQ_MOVE_MCASTQ(&avp->av_mcastq, cabq); 
    51765175                } 
    51775176                else { 
     
    51835182 
    51845183                /* NB: gated by beacon so safe to start here */ 
    5185                 if (cabq->axq_depth > 0) { 
     5184                if (STAILQ_FIRST(&cabq->axq_q)) { 
    51865185                        DPRINTF(sc, ATH_DEBUG_BEACON, 
    51875186                                "Checking CABQ - CABQ being started.\n"); 
     
    52865285                                                needmark)) != NULL) { 
    52875286                                        if (bflink != NULL) 
    5288                                                 *bflink = ath_ds_link_swap(bf->bf_daddr); 
    5289                                         else /* For the first bf, save bf_addr for later */ 
     5287                                                *bflink = ath_ds_link_swap( 
     5288                                                                bf->bf_daddr); 
     5289                                        else 
     5290                                                /* For the first bf, save  
     5291                                                 * bf_addr for later */ 
    52905292                                                bfaddr = bf->bf_daddr; 
    52915293 
     
    59745976                memset(&tmp_q, 0, sizeof(tmp_q)); 
    59755977                STAILQ_INIT(&tmp_q.axq_q); 
    5976                 /* 
    5977                  * collect all the data towards the node 
    5978                  * in to the tmp_q. 
    5979                  */ 
     5978                 
     5979                /* Collect all the data towards the node 
     5980                 * in to the tmp_q. */ 
    59805981                index = WME_AC_VO; 
    59815982                while (index >= WME_AC_BE && txq != sc->sc_ac2q[index]) { 
     
    59855986                        ath_hal_stoptxdma(ah, txq->axq_qnum); 
    59865987                        bf = prev = STAILQ_FIRST(&txq->axq_q); 
    5987                         /* 
    5988                          * skip all the buffers that are done 
    5989                          * until the first one that is in progress 
    5990                          */ 
     5988                         
     5989                        /* Skip all the buffers that are done 
     5990                         * until the first one that is in progress. */ 
    59915991                        while (bf) { 
    59925992#ifdef ATH_SUPERG_FF 
     
    60036003                        } 
    60046004 
    6005                         /* save the pointer to the last buf that's done */ 
     6005                        /* Save the pointer to the last buf that's done. */ 
    60066006                        if (prev == bf) 
    60076007                                bf_tmp = NULL; 
     
    60286028                                                                bf, bf_list); 
    60296029                                                bf = STAILQ_NEXT(prev, bf_list); 
    6030                                                 /* 
    6031                                                  * after deleting the node 
    6032                                                  * link the descriptors 
    6033                                                  */ 
     6030                                                /* After deleting the node 
     6031                                                 * link the descriptors. */ 
    60346032#ifdef ATH_SUPERG_FF 
    6035                                                 ds = &prev->bf_desc[prev->bf_numdescff]; 
     6033                                                ds = &prev->bf_desc 
     6034                                                        [prev->bf_numdescff]; 
    60366035#else 
    6037                                                 /* NB: last descriptor */ 
     6036                                                /* NB: last descriptor. */ 
    60386037                                                ds = prev->bf_desc; 
    60396038#endif 
    6040                                                 ds->ds_link = ath_ds_link_swap(bf->bf_daddr); 
     6039                                                ds->ds_link = ath_ds_link_swap( 
     6040                                                                bf->bf_daddr); 
    60416041                                        } 
    60426042                                } else { 
     
    60456045                                } 
    60466046                        } 
    6047                         /* 
    6048                          * if the last buf was deleted. 
    6049                          * set the pointer to the last descriptor. 
    6050                          */ 
     6047 
     6048                        /* If the last buf. was deleted. 
     6049                         * set the pointer to the last descriptor. */ 
    60516050                        bf = STAILQ_FIRST(&txq->axq_q); 
    60526051                        if (bf) { 
     
    60656064                                                                ah, ds, ts 
    60666065                                                                ); 
    6067                                                 if (status == HAL_EINPROGRESS) 
    6068                                                         txq->axq_link =  
    6069                                                                 &ds->ds_link; 
    6070                                                 else 
    6071                                                         txq->axq_link = NULL; 
    60726066                                        } 
    60736067                                } 
    6074                         } else 
    6075                                 txq->axq_link = NULL; 
     6068                        } 
    60766069 
    60776070                        ATH_TXQ_UNLOCK_IRQ(txq); 
    60786071 
    6079                         /* 
    6080                          * restart the DMA from the first 
    6081                          * buffer that was not DMA'd. 
    6082                          */ 
     6072                        /* Restart the DMA from the first 
     6073                         * buffer that was not DMA'd. */ 
    60836074                        if (bf_tmp) 
    60846075                                bf = STAILQ_NEXT(bf_tmp, bf_list); 
     
    60916082                        } 
    60926083                } 
    6093                 /* 
    6094                  * queue them on to the XR txqueue. 
    6095                  * can not directly put them on to the XR txq. since the 
    6096                  * skb data size may be greater than the XR fragmentation 
    6097                  * threshold size. 
    6098                  */ 
     6084                 
     6085                /* Queue them on to the XR txqueue. 
     6086                 * Can not directly put them on to the XR txq, since the 
     6087                 * SKB data size may be greater than the XR fragmentation 
     6088                 * threshold size. */ 
    60996089                bf  = STAILQ_FIRST(&tmp_q.axq_q); 
    61006090                index = 0; 
     
    61136103                                "moved %d buffers from NORMAL to XR\n", index); 
    61146104        } else { 
    6115                 struct ath_txq wme_tmp_qs[WME_AC_VO+1]; 
     6105                struct ath_txq wme_tmp_qs[WME_AC_VO + 1]; 
    61166106                struct ath_txq *wmeq = NULL, *prevq; 
    61176107                struct ieee80211_frame *wh; 
     
    61196109                unsigned int count = 0; 
    61206110 
    6121                 /* 
    6122                  * move data from XR txq to Normal txqs. 
    6123                  */ 
     6111                /* Move data from XR txq to Normal txqs. */ 
    61246112                DPRINTF(sc, ATH_DEBUG_XMIT_PROC,  
    61256113                                "move buffers from XR to NORMAL\n"); 
     
    61326120                ath_hal_stoptxdma(ah, txq->axq_qnum); 
    61336121                bf = prev = STAILQ_FIRST(&txq->axq_q); 
    6134                 /* 
    6135                  * skip all the buffers that are done 
    6136                  * until the first one that is in progress 
    6137                  */ 
     6122                /* Skip all the buffers that are done 
     6123                 * until the first one that is in progress. */ 
    61386124                while (bf) { 
    61396125#ifdef ATH_SUPERG_FF 
     
    61496135                        bf = STAILQ_NEXT(bf, bf_list); 
    61506136                } 
    6151                 /* 
    6152                  * save the pointer to the last buf that's 
    6153                  * done 
    6154                  */ 
     6137                 
     6138                /* Save the pointer to the last buf that's done. */ 
    61556139                if (prev == bf) 
    61566140                        bf_tmp1 = NULL; 
    61576141                else 
    61586142                        bf_tmp1 = prev; 
    6159                 /* 
    6160                  * collect all the data in to four temp SW queues. 
    6161                  */ 
     6143 
     6144                /* Collect all the data in to four temp SW queues. */ 
    61626145                while (bf) { 
    61636146                        if (ni == ATH_BUF_NI(bf)) { 
     
    61776160                                wh = (struct ieee80211_frame *)skb->data; 
    61786161                                if (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS) { 
    6179                                         /* XXX validate skb->priority, remove  
     6162                                        /* XXX: Validate skb->priority, remove  
    61806163                                         * mask */ 
    61816164                                        wmeq = &wme_tmp_qs[skb->priority & 0x3]; 
    61826165                                } else 
    61836166                                        wmeq = &wme_tmp_qs[WME_AC_BE]; 
     6167                                ATH_TXQ_LINK_DESC(wmeq, bf_tmp); 
    61846168                                STAILQ_INSERT_TAIL(&wmeq->axq_q, bf_tmp, bf_list); 
    6185                                 ds = bf_tmp->bf_desc; 
    6186                                 /* 
    6187                                  * link the descriptors 
    6188                                  */ 
    6189                                 if (wmeq->axq_link != NULL) { 
    6190                                         *wmeq->axq_link =  
    6191                                                 ath_ds_link_swap(bf_tmp->bf_daddr); 
    6192                                         DPRINTF(sc, ATH_DEBUG_XMIT,  
    6193                                                         "link[%u](%p)=%08llx (%p)\n", 
    6194                                                         wmeq->axq_qnum, wmeq->axq_link, 
    6195                                                         (u_int64_t)bf_tmp->bf_daddr,  
    6196                                                         bf_tmp->bf_desc); 
    6197                                 } 
    6198                                 wmeq->axq_link = &ds->ds_link; 
    6199                                 /* 
    6200                                  * update the rate information 
    6201                                  */ 
     6169                                DPRINTF(sc, ATH_DEBUG_XMIT,  
     6170                                                "link[%u]=%08llx (%p)\n", 
     6171                                                wmeq->axq_qnum,  
     6172                                                (u_int64_t)bf_tmp->bf_daddr,  
     6173                                                bf_tmp->bf_desc); 
     6174 
     6175                                /* Update the rate information. (?) */ 
    62026176                        } else { 
    62036177                                prev = bf; 
     
    62196193                                        ds = prev->bf_desc; 
    62206194#endif 
    6221                                         ts = &bf->bf_dsstatus.ds_txstat; 
    6222                                         status = ath_hal_txprocdesc(ah, ds, ts); 
    6223                                         if (status == HAL_EINPROGRESS) 
    6224                                                 txq->axq_link = &ds->ds_link; 
    6225                                         else 
    6226                                                 txq->axq_link = NULL; 
    62276195                                } 
    62286196                        } 
    6229                 } else { 
    6230                         /* 
    6231                          * if the list is empty reset the pointer. 
    6232                          */ 
    6233                         txq->axq_link = NULL; 
    62346197                } 
    62356198                ATH_TXQ_UNLOCK_IRQ(txq); 
    62366199 
    6237                 /* 
    6238                  * restart the DMA from the first 
    6239                  * buffer that was not DMA'd. 
    6240                  */ 
     6200                /* Restart the DMA from the first buffer that was not DMA'd. */ 
    62416201                if (bf_tmp1) 
    62426202                        bf = STAILQ_NEXT(bf_tmp1, bf_list); 
     
    62626222                                wmeq = &wme_tmp_qs[index]; 
    62636223                                bf = STAILQ_FIRST(&wmeq->axq_q); 
    6264                                 if (bf) { 
     6224                                if (bf) 
    62656225                                        ATH_TXQ_MOVE_Q(wmeq, txq); 
    6266                                         if (txq->axq_link != NULL) { 
    6267                                                 *(txq->axq_link) =  
    6268                                                         ath_ds_link_swap(bf->bf_daddr); 
    6269                                         } 
    6270                                 } 
    62716226                                index--; 
    62726227                        } 
     
    70356990                txq->axq_qnum = qnum; 
    70366991        } 
    7037         txq->axq_link = NULL; 
    70386992        STAILQ_INIT(&txq->axq_q); 
    70396993        ATH_TXQ_LOCK_INIT(txq); 
     
    70597013        unsigned int pollsperrate, pos; 
    70607014        struct sk_buff *skb = NULL; 
    7061         struct ath_buf *bf, *head = NULL; 
     7015        struct ath_buf *bf = NULL, *head = NULL; 
    70627016        struct ieee80211com *ic = vap->iv_ic; 
    70637017        struct ath_softc *sc = ic->ic_dev->priv; 
     
    70697023        u_int type; 
    70707024        struct ath_txq *txq = &sc->sc_grpplq; 
    7071         struct ath_desc *ds = NULL; 
    70727025        int rates[XR_NUM_RATES]; 
    70737026        u_int8_t ratestr[16], numpollstr[16]; 
     
    72077160                        ATH_TXBUF_UNLOCK_IRQ(sc); 
    72087161 
    7209                         bf->bf_skbaddr = bus_map_single(sc->sc_bdev, 
    7210                                 skb->data, skb->len, BUS_DMA_TODEVICE); 
    72117162                        bf->bf_skb = skb; 
    7212                         ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); 
    7213                         ds = bf->bf_desc
    7214                         ds->ds_data = bf->bf_skbaddr; 
    7215                         if (i == pollcount && amode == (HAL_ANTENNA_MAX_MODE - 1)) { 
     7163                        bf->bf_desc->ds_data = bus_map_single(sc->sc_bdev, 
     7164                               skb->data, skb->len, BUS_DMA_TODEVICE);
     7165 
     7166                        if ((i == pollcount) && (amode == (HAL_ANTENNA_MAX_MODE - 1))) { 
    72167167                                type = HAL_PKT_TYPE_NORMAL; 
    72177168                                flags |= (HAL_TXDESC_CLRDMASK | HAL_TXDESC_VEOL); 
     
    72207171                                type = HAL_PKT_TYPE_GRP_POLL; 
    72217172                        } 
    7222                         if (i == 0 && amode == HAL_ANTENNA_FIXED_A) { 
     7173                        if ((i == 0) && (amode == HAL_ANTENNA_FIXED_A)) { 
    72237174                                flags |= HAL_TXDESC_CLRDMASK; 
    72247175                                head = bf; 
    72257176                        } 
    7226                         ath_hal_setuptxdesc(ah, ds, 
     7177 
     7178                        ath_hal_setuptxdesc(ah, bf->bf_desc, 
    72277179                                skb->len + IEEE80211_CRC_LEN,   /* frame length */ 
    72287180                                sizeof(struct ieee80211_frame), /* header length */ 
     
    72397191                                ATH_COMP_PROC_NO_COMP_NO_CCS    /* comp scheme */ 
    72407192                                ); 
    7241                         ath_hal_filltxdesc(ah, ds
     7193                        ath_hal_filltxdesc(ah, bf->bf_desc
    72427194                                roundup(skb->len, 4),   /* buffer length */ 
    72437195                                AH_TRUE,                /* first segment */ 
    72447196                                AH_TRUE,                /* last segment */ 
    7245                                 ds                    /* first descriptor */ 
     7197                                bf->bf_desc           /* first descriptor */ 
    72467198                                ); 
    7247                         /* NB: The desc swap function becomes void, 
    7248                          * if descriptor swapping is not enabled */ 
    7249                         ath_desc_swap(ds); 
    7250                         if (txq->axq_link) { 
    7251                                 *txq->axq_link = ath_ds_link_swap(bf->bf_daddr); 
    7252                         } 
    7253                         txq->axq_link = &ds->ds_link; 
     7199 
     7200                        ath_desc_swap(bf->bf_desc); 
     7201                        ATH_TXQ_LINK_DESC(txq, bf); 
     7202                        ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); 
     7203 
    72547204                        pollsperrate++; 
    72557205                        if (pollsperrate > rates[rtindex]) { 
     
    72607210        } 
    72617211        /* make it circular */ 
    7262         ds->ds_link = ath_ds_link_swap(head->bf_daddr); 
     7212        bf->bf_desc->ds_link = ath_ds_link_swap(head->bf_daddr); 
    72637213        /* start the queue */ 
    72647214        ath_hal_puttxbuf(ah, txq->axq_qnum, head->bf_daddr); 
     
    74017351 
    74027352                txq->axq_qnum = qnum; 
    7403                 txq->axq_link = NULL; 
    74047353                STAILQ_INIT(&txq->axq_q); 
    74057354                ATH_TXQ_LOCK_INIT(txq); 
     
    76187567ath_tx_uapsdqueue(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) 
    76197568{ 
    7620         struct ath_buf *lastbuf; 
    7621  
    7622         /* case the delivery queue just sent and can move overflow q over */ 
     7569        struct ath_buf *tbf; 
     7570 
     7571        /* Case the delivery queue just sent and can move overflow q over. */ 
    76237572        if (an->an_uapsd_qdepth == 0 && an->an_uapsd_overflowqdepth != 0) { 
    76247573                DPRINTF(sc, ATH_DEBUG_UAPSD, 
     
    76297578        } 
    76307579 
    7631         /* most common case - room on delivery q */ 
     7580        /* Most common case - room on delivery q. */ 
    76327581        if (an->an_uapsd_qdepth < an->an_node.ni_uapsd_maxsp) { 
    7633                 /* add to delivery q */ 
    7634                 if ((lastbuf = STAILQ_LAST(&an->an_uapsd_q, ath_buf, bf_list))) { 
    7635                         lastbuf->bf_desc->ds_link = ath_ds_link_swap(bf->bf_daddr); 
    7636                 } 
     7582                /* Add to delivery q. */ 
     7583                ATH_STQ_LINK_DESC(&an->an_uapsd_q, bf); 
    76377584                STAILQ_INSERT_TAIL(&an->an_uapsd_q, bf, bf_list); 
    76387585                an->an_uapsd_qdepth++; 
     7586 
    76397587                DPRINTF(sc, ATH_DEBUG_UAPSD, 
    76407588                                "Added AC %d frame to delivery queue, " 
     
    76447592        } 
    76457593 
    7646         /* check if need to make room on overflow queue */ 
    7647         if (an->an_uapsd_overflowqdepth == an->an_node.ni_uapsd_maxsp) { 
    7648                 /* 
    7649                  *  pop oldest from delivery queue and cleanup 
    7650                  */ 
    7651                 lastbuf = STAILQ_FIRST(&an->an_uapsd_q); 
    7652                 STAILQ_REMOVE_HEAD(&an->an_uapsd_q, bf_list); 
    7653                 ath_return_txbuf(sc, &lastbuf); 
    7654  
    7655                 /* 
    7656                  *  move oldest from overflow to delivery 
    7657                  */ 
    7658                 lastbuf = STAILQ_FIRST(&an->an_uapsd_overflowq); 
    7659                 STAILQ_REMOVE_HEAD(&an->an_uapsd_overflowq, bf_list); 
    7660                 an->an_uapsd_overflowqdepth--; 
    7661                 STAILQ_INSERT_TAIL(&an->an_uapsd_q, lastbuf, bf_list); 
    7662                 DPRINTF(sc, ATH_DEBUG_UAPSD, 
    7663                         "Delivery and overflow queues full.  Dropped oldest.\n"); 
    7664         } 
    7665  
    7666         /* add to overflow q */ 
    7667         if ((lastbuf = STAILQ_LAST(&an->an_uapsd_overflowq, ath_buf, bf_list))) { 
    7668                 lastbuf->bf_desc->ds_link = ath_ds_link_swap(bf->bf_daddr); 
    7669         } 
     7594        /* Check if need to make room on overflow queue. */ 
     7595        if (an->an_uapsd_overflowqdepth == an->an_node.ni_uapsd_maxsp) { 
     7596                /*  Pop oldest from delivery queue and cleanup. */ 
     7597                tbf = STAILQ_FIRST(&an->an_uapsd_q); 
     7598                STAILQ_REMOVE_HEAD(&an->an_uapsd_q, bf_list); 
     7599                ath_return_txbuf(sc, &tbf); 
     7600   
     7601                /* Move oldest from overflow to delivery. */ 
     7602                tbf = STAILQ_FIRST(&an->an_uapsd_overflowq); 
     7603                STAILQ_REMOVE_HEAD(&an->an_uapsd_overflowq, bf_list); 
     7604                an->an_uapsd_overflowqdepth--; 
     7605                STAILQ_INSERT_TAIL(&an->an_uapsd_q, tbf, bf_list); 
     7606                DPRINTF(sc, ATH_DEBUG_UAPSD, 
     7607                        "Delivery and overflow queues full.  Dropped oldest.\n"); 
     7608        } 
     7609   
     7610        /* Add to overflow q/ */ 
     7611        ATH_STQ_LINK_DESC(&an->an_uapsd_overflowq, bf); 
    76707612        STAILQ_INSERT_TAIL(&an->an_uapsd_overflowq, bf, bf_list); 
    76717613        an->an_uapsd_overflowqdepth++; 
     
    79527894         * We use the private mcast queue for that. 
    79537895         */ 
    7954         if (ismcast && (vap->iv_ps_sta || avp->av_mcastq.axq_depth)) { 
     7896        if (ismcast && (vap->iv_ps_sta || STAILQ_FIRST(&avp->av_mcastq.axq_q))) { 
    79557897                txq = &avp->av_mcastq; 
    7956                 /* XXX? more bit in 802.11 frame header */ 
     7898                /* XXX: More bit in 802.11 frame header? */ 
    79577899        } 
    79587900 
     
    79647906                sc->sc_stats.ast_tx_noack++; 
    79657907                try0 = ATH_TXMAXTRY;    /* turn off multi-rate retry for multicast traffic */ 
    7966         } else if (pktlen > vap->iv_rtsthreshold) { 
     7908        } else if (pktlen > vap->iv_rtsthreshold) { 
    79677909#ifdef ATH_SUPERG_FF 
    79687910                /* we could refine to only check that the frame of interest 
     
    82928234        int uapsdq = 0; 
    82938235 
    8294         DPRINTF(sc, ATH_DEBUG_TX_PROC, "TX queue: %d (0x%x), link: %p\n",  
     8236        DPRINTF(sc, ATH_DEBUG_TX_PROC, "TX queue: %d (0x%x), link: %08x\n",  
    82958237                txq->axq_qnum, ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), 
    8296                 txq->axq_link); 
     8238                ATH_TXQ_LAST_DESC(txq)->ds_link); 
    82978239 
    82988240        if (txq == sc->sc_uapsdq) { 
     
    85028444#ifdef ATH_SUPERG_FF 
    85038445        /* flush ff staging queue if buffer low */ 
    8504         if (txq->axq_depth <= sc->sc_fftxqmin - 1) { 
     8446        if (txq->axq_depth <= sc->sc_fftxqmin - 1) 
    85058447                /* NB: consider only flushing a preset number based on age. */ 
    85068448                ath_ffstageq_flush(sc, txq, ath_ff_neverflushtestdone); 
    8507         } 
     8449 
    85088450#else 
    85098451        ; 
     
    85548496                ath_tx_processq(sc, &sc->sc_txq[3]); 
    85558497        if (ATH_TXQ_SETUP(sc, sc->sc_cabq->axq_qnum) 
    8556             && sc->sc_cabq->axq_depth) { 
     8498            && STAILQ_FIRST(&sc->sc_cabq->axq_q)) { 
    85578499                DPRINTF(sc, ATH_DEBUG_BEACON, 
    85588500                        "Processing CABQ... it is active in HAL.\n"); 
     
    86008542                        DPRINTF(sc, ATH_DEBUG_BEACON, 
    86018543                                "NOT processing CABQ... it is %s.\n", 
    8602                                 sc->sc_cabq->axq_depth ? "not setup" : "empty"); 
     8544                              &n