Changeset 3620
- Timestamp:
- 05/07/08 20:33:15 (4 months ago)
- Files:
-
- madwifi/trunk/ath/if_ath.c (modified) (41 diffs)
- madwifi/trunk/ath/if_athvar.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/trunk/ath/if_ath.c
r3619 r3620 2119 2119 BUS_DMA_TODEVICE); 2120 2120 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. */ 2126 2126 STAILQ_CONCAT(&uapsd_xmit_q->axq_q, 2127 2127 &an->an_uapsd_q); 2128 uapsd_xmit_q->axq_link =2129 &last_desc->ds_link;2130 2128 ath_hal_puttxbuf(sc->sc_ah, 2131 2129 uapsd_xmit_q->axq_qnum, … … 2918 2916 2919 2917 DPRINTF(sc, ATH_DEBUG_WATCHDOG, "txq:%p : axq_qnum:%u axq_depth:%d " 2920 " axq_link:%pTXDP:%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, 2922 2920 ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum)); 2923 2921 … … 2982 2980 if (ath_cac_running_dbgmsg(sc)) 2983 2981 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. */ 2988 2985 ATH_TXQ_LOCK_IRQ(txq); 2989 2986 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. */ 2994 2989 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 3005 2998 /* 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. */ 3007 3000 ath_hal_intrset(ah, sc->sc_imask); 3008 3001 } 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 } 3009 3019 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); 3020 3010 3021 DPRINTF(sc, ATH_DEBUG_TX_PROC, "UC txq [%d] depth = %d\n", 3011 3022 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, 3029 3027 (u_int64_t)bf->bf_daddr, bf->bf_desc); 3030 } 3031 txq->axq_link = &ds->ds_link; 3028 3032 3029 ath_hal_txstart(ah, txq->axq_qnum); 3033 3030 sc->sc_dev->trans_start = jiffies; … … 5081 5078 curlen = skb->len; 5082 5079 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)) { 5085 5085 bus_unmap_single(sc->sc_bdev, 5086 5086 bf->bf_skbaddr, curlen, BUS_DMA_TODEVICE); … … 5102 5102 tim_bitctl = ((struct ieee80211_tim_ie *)avp->av_boff.bo_tim)->tim_bitctl; 5103 5103 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) && 5106 5106 (sc->sc_nvaps > 1) && 5107 5107 (sc->sc_stagbeacons)) { … … 5109 5109 DPRINTF(sc, ATH_DEBUG_BEACON, 5110 5110 "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); 5119 5119 } else { 5120 5120 DPRINTF(sc, ATH_DEBUG_BEACON, … … 5153 5153 bfmcast = STAILQ_FIRST(&avp->av_mcastq.axq_q); 5154 5154 if (bfmcast != NULL) { 5155 struct ath_buf *tbf; 5155 5156 DPRINTF(sc, ATH_DEBUG_BEACON, 5156 5157 "Multicast pending. " 5157 5158 "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)) 5160 5173 ath_hal_puttxbuf(ah, cabq->axq_qnum, 5161 5174 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);5176 5175 } 5177 5176 else { … … 5183 5182 5184 5183 /* NB: gated by beacon so safe to start here */ 5185 if ( cabq->axq_depth > 0) {5184 if (STAILQ_FIRST(&cabq->axq_q)) { 5186 5185 DPRINTF(sc, ATH_DEBUG_BEACON, 5187 5186 "Checking CABQ - CABQ being started.\n"); … … 5286 5285 needmark)) != NULL) { 5287 5286 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 */ 5290 5292 bfaddr = bf->bf_daddr; 5291 5293 … … 5974 5976 memset(&tmp_q, 0, sizeof(tmp_q)); 5975 5977 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. */ 5980 5981 index = WME_AC_VO; 5981 5982 while (index >= WME_AC_BE && txq != sc->sc_ac2q[index]) { … … 5985 5986 ath_hal_stoptxdma(ah, txq->axq_qnum); 5986 5987 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. */ 5991 5991 while (bf) { 5992 5992 #ifdef ATH_SUPERG_FF … … 6003 6003 } 6004 6004 6005 /* save the pointer to the last buf that's done*/6005 /* Save the pointer to the last buf that's done. */ 6006 6006 if (prev == bf) 6007 6007 bf_tmp = NULL; … … 6028 6028 bf, bf_list); 6029 6029 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. */ 6034 6032 #ifdef ATH_SUPERG_FF 6035 ds = &prev->bf_desc[prev->bf_numdescff]; 6033 ds = &prev->bf_desc 6034 [prev->bf_numdescff]; 6036 6035 #else 6037 /* NB: last descriptor */6036 /* NB: last descriptor. */ 6038 6037 ds = prev->bf_desc; 6039 6038 #endif 6040 ds->ds_link = ath_ds_link_swap(bf->bf_daddr); 6039 ds->ds_link = ath_ds_link_swap( 6040 bf->bf_daddr); 6041 6041 } 6042 6042 } else { … … 6045 6045 } 6046 6046 } 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. */ 6051 6050 bf = STAILQ_FIRST(&txq->axq_q); 6052 6051 if (bf) { … … 6065 6064 ah, ds, ts 6066 6065 ); 6067 if (status == HAL_EINPROGRESS)6068 txq->axq_link =6069 &ds->ds_link;6070 else6071 txq->axq_link = NULL;6072 6066 } 6073 6067 } 6074 } else 6075 txq->axq_link = NULL; 6068 } 6076 6069 6077 6070 ATH_TXQ_UNLOCK_IRQ(txq); 6078 6071 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. */ 6083 6074 if (bf_tmp) 6084 6075 bf = STAILQ_NEXT(bf_tmp, bf_list); … … 6091 6082 } 6092 6083 } 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. */ 6099 6089 bf = STAILQ_FIRST(&tmp_q.axq_q); 6100 6090 index = 0; … … 6113 6103 "moved %d buffers from NORMAL to XR\n", index); 6114 6104 } else { 6115 struct ath_txq wme_tmp_qs[WME_AC_VO +1];6105 struct ath_txq wme_tmp_qs[WME_AC_VO + 1]; 6116 6106 struct ath_txq *wmeq = NULL, *prevq; 6117 6107 struct ieee80211_frame *wh; … … 6119 6109 unsigned int count = 0; 6120 6110 6121 /* 6122 * move data from XR txq to Normal txqs. 6123 */ 6111 /* Move data from XR txq to Normal txqs. */ 6124 6112 DPRINTF(sc, ATH_DEBUG_XMIT_PROC, 6125 6113 "move buffers from XR to NORMAL\n"); … … 6132 6120 ath_hal_stoptxdma(ah, txq->axq_qnum); 6133 6121 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. */ 6138 6124 while (bf) { 6139 6125 #ifdef ATH_SUPERG_FF … … 6149 6135 bf = STAILQ_NEXT(bf, bf_list); 6150 6136 } 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. */ 6155 6139 if (prev == bf) 6156 6140 bf_tmp1 = NULL; 6157 6141 else 6158 6142 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. */ 6162 6145 while (bf) { 6163 6146 if (ni == ATH_BUF_NI(bf)) { … … 6177 6160 wh = (struct ieee80211_frame *)skb->data; 6178 6161 if (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS) { 6179 /* XXX validate skb->priority, remove6162 /* XXX: Validate skb->priority, remove 6180 6163 * mask */ 6181 6164 wmeq = &wme_tmp_qs[skb->priority & 0x3]; 6182 6165 } else 6183 6166 wmeq = &wme_tmp_qs[WME_AC_BE]; 6167 ATH_TXQ_LINK_DESC(wmeq, bf_tmp); 6184 6168 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. (?) */ 6202 6176 } else { 6203 6177 prev = bf; … … 6219 6193 ds = prev->bf_desc; 6220 6194 #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 else6226 txq->axq_link = NULL;6227 6195 } 6228 6196 } 6229 } else {6230 /*6231 * if the list is empty reset the pointer.6232 */6233 txq->axq_link = NULL;6234 6197 } 6235 6198 ATH_TXQ_UNLOCK_IRQ(txq); 6236 6199 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. */ 6241 6201 if (bf_tmp1) 6242 6202 bf = STAILQ_NEXT(bf_tmp1, bf_list); … … 6262 6222 wmeq = &wme_tmp_qs[index]; 6263 6223 bf = STAILQ_FIRST(&wmeq->axq_q); 6264 if (bf) {6224 if (bf) 6265 6225 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 }6271 6226 index--; 6272 6227 } … … 7035 6990 txq->axq_qnum = qnum; 7036 6991 } 7037 txq->axq_link = NULL;7038 6992 STAILQ_INIT(&txq->axq_q); 7039 6993 ATH_TXQ_LOCK_INIT(txq); … … 7059 7013 unsigned int pollsperrate, pos; 7060 7014 struct sk_buff *skb = NULL; 7061 struct ath_buf *bf , *head = NULL;7015 struct ath_buf *bf = NULL, *head = NULL; 7062 7016 struct ieee80211com *ic = vap->iv_ic; 7063 7017 struct ath_softc *sc = ic->ic_dev->priv; … … 7069 7023 u_int type; 7070 7024 struct ath_txq *txq = &sc->sc_grpplq; 7071 struct ath_desc *ds = NULL;7072 7025 int rates[XR_NUM_RATES]; 7073 7026 u_int8_t ratestr[16], numpollstr[16]; … … 7207 7160 ATH_TXBUF_UNLOCK_IRQ(sc); 7208 7161 7209 bf->bf_skbaddr = bus_map_single(sc->sc_bdev,7210 skb->data, skb->len, BUS_DMA_TODEVICE);7211 7162 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))) { 7216 7167 type = HAL_PKT_TYPE_NORMAL; 7217 7168 flags |= (HAL_TXDESC_CLRDMASK | HAL_TXDESC_VEOL); … … 7220 7171 type = HAL_PKT_TYPE_GRP_POLL; 7221 7172 } 7222 if ( i == 0 && amode == HAL_ANTENNA_FIXED_A) {7173 if ((i == 0) && (amode == HAL_ANTENNA_FIXED_A)) { 7223 7174 flags |= HAL_TXDESC_CLRDMASK; 7224 7175 head = bf; 7225 7176 } 7226 ath_hal_setuptxdesc(ah, ds, 7177 7178 ath_hal_setuptxdesc(ah, bf->bf_desc, 7227 7179 skb->len + IEEE80211_CRC_LEN, /* frame length */ 7228 7180 sizeof(struct ieee80211_frame), /* header length */ … … 7239 7191 ATH_COMP_PROC_NO_COMP_NO_CCS /* comp scheme */ 7240 7192 ); 7241 ath_hal_filltxdesc(ah, ds,7193 ath_hal_filltxdesc(ah, bf->bf_desc, 7242 7194 roundup(skb->len, 4), /* buffer length */ 7243 7195 AH_TRUE, /* first segment */ 7244 7196 AH_TRUE, /* last segment */ 7245 ds/* first descriptor */7197 bf->bf_desc /* first descriptor */ 7246 7198 ); 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 7254 7204 pollsperrate++; 7255 7205 if (pollsperrate > rates[rtindex]) { … … 7260 7210 } 7261 7211 /* 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); 7263 7213 /* start the queue */ 7264 7214 ath_hal_puttxbuf(ah, txq->axq_qnum, head->bf_daddr); … … 7401 7351 7402 7352 txq->axq_qnum = qnum; 7403 txq->axq_link = NULL;7404 7353 STAILQ_INIT(&txq->axq_q); 7405 7354 ATH_TXQ_LOCK_INIT(txq); … … 7618 7567 ath_tx_uapsdqueue(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) 7619 7568 { 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. */ 7623 7572 if (an->an_uapsd_qdepth == 0 && an->an_uapsd_overflowqdepth != 0) { 7624 7573 DPRINTF(sc, ATH_DEBUG_UAPSD, … … 7629 7578 } 7630 7579 7631 /* most common case - room on delivery q*/7580 /* Most common case - room on delivery q. */ 7632 7581 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); 7637 7584 STAILQ_INSERT_TAIL(&an->an_uapsd_q, bf, bf_list); 7638 7585 an->an_uapsd_qdepth++; 7586 7639 7587 DPRINTF(sc, ATH_DEBUG_UAPSD, 7640 7588 "Added AC %d frame to delivery queue, " … … 7644 7592 } 7645 7593 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); 7670 7612 STAILQ_INSERT_TAIL(&an->an_uapsd_overflowq, bf, bf_list); 7671 7613 an->an_uapsd_overflowqdepth++; … … 7952 7894 * We use the private mcast queue for that. 7953 7895 */ 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))) { 7955 7897 txq = &avp->av_mcastq; 7956 /* XXX ? more bit in 802.11 frame header*/7898 /* XXX: More bit in 802.11 frame header? */ 7957 7899 } 7958 7900 … … 7964 7906 sc->sc_stats.ast_tx_noack++; 7965 7907 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) { 7967 7909 #ifdef ATH_SUPERG_FF 7968 7910 /* we could refine to only check that the frame of interest … … 8292 8234 int uapsdq = 0; 8293 8235 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", 8295 8237 txq->axq_qnum, ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), 8296 txq->axq_link);8238 ATH_TXQ_LAST_DESC(txq)->ds_link); 8297 8239 8298 8240 if (txq == sc->sc_uapsdq) { … … 8502 8444 #ifdef ATH_SUPERG_FF 8503 8445 /* 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) 8505 8447 /* NB: consider only flushing a preset number based on age. */ 8506 8448 ath_ffstageq_flush(sc, txq, ath_ff_neverflushtestdone); 8507 } 8449 8508 8450 #else 8509 8451 ; … … 8554 8496 ath_tx_processq(sc, &sc->sc_txq[3]); 8555 8497 if (ATH_TXQ_SETUP(sc, sc->sc_cabq->axq_qnum) 8556 && sc->sc_cabq->axq_depth) {8498 && STAILQ_FIRST(&sc->sc_cabq->axq_q)) { 8557 8499 DPRINTF(sc, ATH_DEBUG_BEACON, 8558 8500 "Processing CABQ... it is active in HAL.\n"); … … 8600 8542 DPRINTF(sc, ATH_DEBUG_BEACON, 8601 8543 "NOT processing CABQ... it is %s.\n", 8602 sc->sc_cabq->axq_depth? "not setup" : "empty");8544 &n
