Lines Matching refs:ampdu

23 #include "ampdu.h"
27 /* max number of mpdus in an ampdu */
29 /* max number of mpdus in an ampdu to a legacy */
39 /* max dur of tx ampdu (in msec) */
53 #define FFPLD_TX_MAX_UNFL 200 /* default value of the average number of ampdu
59 #define FFPLD_MAX_AMPDU_CNT 5000 /* maximum number of ampdu we
65 /* max allowed number of mpdus in an ampdu (2 streams) */
70 /* max possible overhead per mpdu in the ampdu; 3 is for roundup if needed */
81 * some counters might be redundant with the ones in wlc or ampdu structures.
86 * mcs2ampdu_table: per-mcs max # of mpdus in an ampdu
89 * accum_txampdu: num of tx ampdu since we modified pld params
90 * prev_txampdu: previous reading of tx ampdu
107 * ini_enable: per-tid initiator enable/disable of ampdu
115 * max_pdu: max pdus allowed in ampdu
116 * dur: max duration of an ampdu (in msec)
117 * rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes
119 * max_txlen: max size of ampdu per mcs, bw and sgi
146 static void brcms_c_scb_ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur)
154 ampdu->max_txlen[mcs][0][0] = (rate * dur) >> 3;
157 ampdu->max_txlen[mcs][1][0] = (rate * dur) >> 3;
160 ampdu->max_txlen[mcs][0][1] = (rate * dur) >> 3;
163 ampdu->max_txlen[mcs][1][1] = (rate * dur) >> 3;
167 static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu)
169 if (BRCMS_PHY_11N_CAP(ampdu->wlc->band))
175 static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on)
177 struct brcms_c_info *wlc = ampdu->wlc;
188 if (!brcms_c_ampdu_cap(ampdu)) {
189 brcms_err(core, "wl%d: device not ampdu capable\n",
199 static void brcms_c_ffpld_init(struct ampdu_info *ampdu)
205 fifo = (ampdu->fifo_tb + j);
219 struct ampdu_info *ampdu;
222 ampdu = kzalloc(sizeof(*ampdu), GFP_ATOMIC);
223 if (!ampdu)
226 ampdu->wlc = wlc;
229 ampdu->ini_enable[i] = true;
230 /* Disable ampdu for VO by default */
231 ampdu->ini_enable[PRIO_8021D_VO] = false;
232 ampdu->ini_enable[PRIO_8021D_NC] = false;
234 /* Disable ampdu for BK by default since not enough fifo space */
235 ampdu->ini_enable[PRIO_8021D_NONE] = false;
236 ampdu->ini_enable[PRIO_8021D_BK] = false;
238 ampdu->ba_tx_wsize = AMPDU_TX_BA_DEF_WSIZE;
239 ampdu->ba_rx_wsize = AMPDU_RX_BA_DEF_WSIZE;
240 ampdu->mpdu_density = AMPDU_DEF_MPDU_DENSITY;
241 ampdu->max_pdu = AUTO;
242 ampdu->dur = AMPDU_MAX_DUR;
244 ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD;
246 * bump max ampdu rcv size to 64k for all 11n
250 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_32K;
252 ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_64K;
253 ampdu->retry_limit = AMPDU_DEF_RETRY_LIMIT;
254 ampdu->rr_retry_limit = AMPDU_DEF_RR_RETRY_LIMIT;
257 ampdu->retry_limit_tid[i] = ampdu->retry_limit;
258 ampdu->rr_retry_limit_tid[i] = ampdu->rr_retry_limit;
261 brcms_c_scb_ampdu_update_max_txlen(ampdu, ampdu->dur);
262 ampdu->mfbr = false;
263 /* try to set ampdu to the default value */
264 brcms_c_ampdu_set(ampdu, wlc->pub->_ampdu);
266 ampdu->tx_max_funl = FFPLD_TX_MAX_UNFL;
267 brcms_c_ffpld_init(ampdu);
269 return ampdu;
272 void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
274 kfree(ampdu);
277 static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
287 if (ampdu->fifo_tb[i].ampdu_pld_size > FFPLD_PLD_INCR)
292 if (ampdu->max_pdu != AUTO)
293 scb_ampdu->max_pdu = (u8) ampdu->max_pdu;
303 ampdu->fifo_tb[TX_AC_BE_FIFO].
307 static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu)
309 brcms_c_scb_ampdu_update_config(ampdu, &ampdu->wlc->pri_scb);
312 static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
317 struct brcms_fifo_info *fifo = (ampdu->fifo_tb + f);
346 * decrease maximum ampdu size for each mcs till underflows stop
352 struct ampdu_info *ampdu = wlc->ampdu;
357 struct brcms_fifo_info *fifo = (ampdu->fifo_tb + fid);
373 if (!ampdu->tx_max_funl)
380 if ((TXFIFO_SIZE_UNIT * (u32) xmtfifo_sz) <= ampdu->ffpld_rsvd)
383 max_pld_size = TXFIFO_SIZE_UNIT * xmtfifo_sz - ampdu->ffpld_rsvd;
412 brcms_c_scb_ampdu_update_config_all(ampdu);
432 /* decrease ampdu size */
441 brcms_c_ffpld_calc_mcs2ampdu_table(ampdu, fid);
444 brcms_c_scb_ampdu_update_config_all(ampdu);
456 struct ampdu_info *ampdu = wlc->ampdu;
460 if (!ampdu->ini_enable[tid]) {
489 struct ampdu_info *ampdu = wlc->ampdu;
541 if (txrate[0].count <= ampdu->rr_retry_limit_tid[tid]) {
552 struct brcms_fifo_info *f = &ampdu->fifo_tb[fifo];
568 ampdu->max_txlen[mcs][is40][sgi]);
597 struct ampdu_info *ampdu = wlc->ampdu;
632 f = &ampdu->fifo_tb[fifo];
717 /* mark plcp to indicate ampdu */
802 brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
807 struct brcms_c_info *wlc = ampdu->wlc;
832 retry_limit = ampdu->retry_limit_tid[tid];
878 * try tuning pre-loading or ampdu size
889 "%s: ampdu tx phy error (0x%x)\n",
978 /* break out if last packet of ampdu */
991 brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
994 struct brcms_c_info *wlc = ampdu->wlc;
1019 brcms_c_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2);
1031 /* break out if last packet of ampdu */
1055 return wlc->ampdu->ini_enable[tid];
1058 void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
1060 struct brcms_c_info *wlc = ampdu->wlc;
1066 if ((ampdu->rx_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) ==
1077 * callback function that helps invalidating ampdu packets in a DMA queue
1090 * When a remote party is no longer available for ampdu communication, any
1091 * pending tx ampdu packets in the driver have to be flushed.