iwl-agn-tx.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  1. /******************************************************************************
  2. *
  3. * GPL LICENSE SUMMARY
  4. *
  5. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of version 2 of the GNU General Public License as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  19. * USA
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <ilw@linux.intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. *****************************************************************************/
  29. #include <linux/kernel.h>
  30. #include <linux/module.h>
  31. #include <linux/init.h>
  32. #include <linux/sched.h>
  33. #include <linux/ieee80211.h>
  34. #include "iwl-dev.h"
  35. #include "iwl-core.h"
  36. #include "iwl-sta.h"
  37. #include "iwl-io.h"
  38. #include "iwl-helpers.h"
  39. #include "iwl-agn-hw.h"
  40. #include "iwl-agn.h"
  41. #include "iwl-trans.h"
  42. static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
  43. struct ieee80211_tx_info *info,
  44. __le16 fc, __le32 *tx_flags)
  45. {
  46. if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
  47. info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
  48. info->flags & IEEE80211_TX_CTL_AMPDU)
  49. *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
  50. }
  51. /*
  52. * handle build REPLY_TX command notification.
  53. */
  54. static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
  55. struct sk_buff *skb,
  56. struct iwl_tx_cmd *tx_cmd,
  57. struct ieee80211_tx_info *info,
  58. struct ieee80211_hdr *hdr, u8 sta_id)
  59. {
  60. __le16 fc = hdr->frame_control;
  61. __le32 tx_flags = tx_cmd->tx_flags;
  62. tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
  63. if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
  64. tx_flags |= TX_CMD_FLG_ACK_MSK;
  65. else
  66. tx_flags &= ~TX_CMD_FLG_ACK_MSK;
  67. if (ieee80211_is_probe_resp(fc))
  68. tx_flags |= TX_CMD_FLG_TSF_MSK;
  69. else if (ieee80211_is_back_req(fc))
  70. tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK;
  71. else if (info->band == IEEE80211_BAND_2GHZ &&
  72. priv->cfg->bt_params &&
  73. priv->cfg->bt_params->advanced_bt_coexist &&
  74. (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) ||
  75. ieee80211_is_reassoc_req(fc) ||
  76. skb->protocol == cpu_to_be16(ETH_P_PAE)))
  77. tx_flags |= TX_CMD_FLG_IGNORE_BT;
  78. tx_cmd->sta_id = sta_id;
  79. if (ieee80211_has_morefrags(fc))
  80. tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
  81. if (ieee80211_is_data_qos(fc)) {
  82. u8 *qc = ieee80211_get_qos_ctl(hdr);
  83. tx_cmd->tid_tspec = qc[0] & 0xf;
  84. tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
  85. } else {
  86. tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
  87. }
  88. iwlagn_tx_cmd_protection(priv, info, fc, &tx_flags);
  89. tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
  90. if (ieee80211_is_mgmt(fc)) {
  91. if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
  92. tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(3);
  93. else
  94. tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(2);
  95. } else {
  96. tx_cmd->timeout.pm_frame_timeout = 0;
  97. }
  98. tx_cmd->driver_txop = 0;
  99. tx_cmd->tx_flags = tx_flags;
  100. tx_cmd->next_frame_len = 0;
  101. }
  102. #define RTS_DFAULT_RETRY_LIMIT 60
  103. static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
  104. struct iwl_tx_cmd *tx_cmd,
  105. struct ieee80211_tx_info *info,
  106. __le16 fc)
  107. {
  108. u32 rate_flags;
  109. int rate_idx;
  110. u8 rts_retry_limit;
  111. u8 data_retry_limit;
  112. u8 rate_plcp;
  113. /* Set retry limit on DATA packets and Probe Responses*/
  114. if (ieee80211_is_probe_resp(fc))
  115. data_retry_limit = 3;
  116. else
  117. data_retry_limit = IWLAGN_DEFAULT_TX_RETRY;
  118. tx_cmd->data_retry_limit = data_retry_limit;
  119. /* Set retry limit on RTS packets */
  120. rts_retry_limit = RTS_DFAULT_RETRY_LIMIT;
  121. if (data_retry_limit < rts_retry_limit)
  122. rts_retry_limit = data_retry_limit;
  123. tx_cmd->rts_retry_limit = rts_retry_limit;
  124. /* DATA packets will use the uCode station table for rate/antenna
  125. * selection */
  126. if (ieee80211_is_data(fc)) {
  127. tx_cmd->initial_rate_index = 0;
  128. tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
  129. #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
  130. if (priv->tm_fixed_rate) {
  131. /*
  132. * rate overwrite by testmode
  133. * we not only send lq command to change rate
  134. * we also re-enforce per data pkt base.
  135. */
  136. tx_cmd->tx_flags &= ~TX_CMD_FLG_STA_RATE_MSK;
  137. memcpy(&tx_cmd->rate_n_flags, &priv->tm_fixed_rate,
  138. sizeof(tx_cmd->rate_n_flags));
  139. }
  140. #endif
  141. return;
  142. }
  143. /**
  144. * If the current TX rate stored in mac80211 has the MCS bit set, it's
  145. * not really a TX rate. Thus, we use the lowest supported rate for
  146. * this band. Also use the lowest supported rate if the stored rate
  147. * index is invalid.
  148. */
  149. rate_idx = info->control.rates[0].idx;
  150. if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS ||
  151. (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY))
  152. rate_idx = rate_lowest_index(&priv->bands[info->band],
  153. info->control.sta);
  154. /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
  155. if (info->band == IEEE80211_BAND_5GHZ)
  156. rate_idx += IWL_FIRST_OFDM_RATE;
  157. /* Get PLCP rate for tx_cmd->rate_n_flags */
  158. rate_plcp = iwl_rates[rate_idx].plcp;
  159. /* Zero out flags for this packet */
  160. rate_flags = 0;
  161. /* Set CCK flag as needed */
  162. if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
  163. rate_flags |= RATE_MCS_CCK_MSK;
  164. /* Set up antennas */
  165. if (priv->cfg->bt_params &&
  166. priv->cfg->bt_params->advanced_bt_coexist &&
  167. priv->bt_full_concurrent) {
  168. /* operated as 1x1 in full concurrency mode */
  169. priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
  170. first_antenna(hw_params(priv).valid_tx_ant));
  171. } else
  172. priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
  173. hw_params(priv).valid_tx_ant);
  174. rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
  175. /* Set the rate in the TX cmd */
  176. tx_cmd->rate_n_flags = iwl_hw_set_rate_n_flags(rate_plcp, rate_flags);
  177. }
  178. static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
  179. struct ieee80211_tx_info *info,
  180. struct iwl_tx_cmd *tx_cmd,
  181. struct sk_buff *skb_frag,
  182. int sta_id)
  183. {
  184. struct ieee80211_key_conf *keyconf = info->control.hw_key;
  185. switch (keyconf->cipher) {
  186. case WLAN_CIPHER_SUITE_CCMP:
  187. tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
  188. memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
  189. if (info->flags & IEEE80211_TX_CTL_AMPDU)
  190. tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK;
  191. IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
  192. break;
  193. case WLAN_CIPHER_SUITE_TKIP:
  194. tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
  195. ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key);
  196. IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n");
  197. break;
  198. case WLAN_CIPHER_SUITE_WEP104:
  199. tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
  200. /* fall through */
  201. case WLAN_CIPHER_SUITE_WEP40:
  202. tx_cmd->sec_ctl |= (TX_CMD_SEC_WEP |
  203. (keyconf->keyidx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT);
  204. memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);
  205. IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
  206. "with key %d\n", keyconf->keyidx);
  207. break;
  208. default:
  209. IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher);
  210. break;
  211. }
  212. }
  213. /*
  214. * start REPLY_TX command process
  215. */
  216. int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
  217. {
  218. struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  219. struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  220. struct iwl_station_priv *sta_priv = NULL;
  221. struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
  222. struct iwl_device_cmd *dev_cmd = NULL;
  223. struct iwl_tx_cmd *tx_cmd;
  224. __le16 fc;
  225. u8 hdr_len;
  226. u16 len;
  227. u8 sta_id;
  228. unsigned long flags;
  229. bool is_agg = false;
  230. if (info->control.vif)
  231. ctx = iwl_rxon_ctx_from_vif(info->control.vif);
  232. spin_lock_irqsave(&priv->shrd->lock, flags);
  233. if (iwl_is_rfkill(priv->shrd)) {
  234. IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
  235. goto drop_unlock_priv;
  236. }
  237. fc = hdr->frame_control;
  238. #ifdef CONFIG_IWLWIFI_DEBUG
  239. if (ieee80211_is_auth(fc))
  240. IWL_DEBUG_TX(priv, "Sending AUTH frame\n");
  241. else if (ieee80211_is_assoc_req(fc))
  242. IWL_DEBUG_TX(priv, "Sending ASSOC frame\n");
  243. else if (ieee80211_is_reassoc_req(fc))
  244. IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");
  245. #endif
  246. hdr_len = ieee80211_hdrlen(fc);
  247. /* For management frames use broadcast id to do not break aggregation */
  248. if (!ieee80211_is_data(fc))
  249. sta_id = ctx->bcast_sta_id;
  250. else {
  251. /* Find index into station table for destination station */
  252. sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta);
  253. if (sta_id == IWL_INVALID_STATION) {
  254. IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
  255. hdr->addr1);
  256. goto drop_unlock_priv;
  257. }
  258. }
  259. IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
  260. if (info->control.sta)
  261. sta_priv = (void *)info->control.sta->drv_priv;
  262. if (sta_priv && sta_priv->asleep &&
  263. (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)) {
  264. /*
  265. * This sends an asynchronous command to the device,
  266. * but we can rely on it being processed before the
  267. * next frame is processed -- and the next frame to
  268. * this station is the one that will consume this
  269. * counter.
  270. * For now set the counter to just 1 since we do not
  271. * support uAPSD yet.
  272. */
  273. iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
  274. }
  275. /* irqs already disabled/saved above when locking priv->shrd->lock */
  276. spin_lock(&priv->shrd->sta_lock);
  277. dev_cmd = kmem_cache_alloc(priv->tx_cmd_pool, GFP_ATOMIC);
  278. if (unlikely(!dev_cmd))
  279. goto drop_unlock_sta;
  280. memset(dev_cmd, 0, sizeof(*dev_cmd));
  281. tx_cmd = &dev_cmd->cmd.tx;
  282. /* Copy MAC header from skb into command buffer */
  283. memcpy(tx_cmd->hdr, hdr, hdr_len);
  284. /* Total # bytes to be transmitted */
  285. len = (u16)skb->len;
  286. tx_cmd->len = cpu_to_le16(len);
  287. if (info->control.hw_key)
  288. iwlagn_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
  289. /* TODO need this for burst mode later on */
  290. iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id);
  291. iwl_dbg_log_tx_data_frame(priv, len, hdr);
  292. iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc);
  293. iwl_update_stats(priv, true, fc, len);
  294. info->driver_data[0] = ctx;
  295. info->driver_data[1] = dev_cmd;
  296. if (iwl_trans_tx(trans(priv), skb, dev_cmd, ctx->ctxid, sta_id))
  297. goto drop_unlock_sta;
  298. spin_unlock(&priv->shrd->sta_lock);
  299. spin_unlock_irqrestore(&priv->shrd->lock, flags);
  300. /*
  301. * Avoid atomic ops if it isn't an associated client.
  302. * Also, if this is a packet for aggregation, don't
  303. * increase the counter because the ucode will stop
  304. * aggregation queues when their respective station
  305. * goes to sleep.
  306. */
  307. if (sta_priv && sta_priv->client && !is_agg)
  308. atomic_inc(&sta_priv->pending_frames);
  309. return 0;
  310. drop_unlock_sta:
  311. if (dev_cmd)
  312. kmem_cache_free(priv->tx_cmd_pool, dev_cmd);
  313. spin_unlock(&priv->shrd->sta_lock);
  314. drop_unlock_priv:
  315. spin_unlock_irqrestore(&priv->shrd->lock, flags);
  316. return -1;
  317. }
  318. int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
  319. struct ieee80211_sta *sta, u16 tid, u16 *ssn)
  320. {
  321. struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
  322. int sta_id;
  323. int ret;
  324. IWL_DEBUG_HT(priv, "TX AGG request on ra = %pM tid = %d\n",
  325. sta->addr, tid);
  326. sta_id = iwl_sta_id(sta);
  327. if (sta_id == IWL_INVALID_STATION) {
  328. IWL_ERR(priv, "Start AGG on invalid station\n");
  329. return -ENXIO;
  330. }
  331. if (unlikely(tid >= IWL_MAX_TID_COUNT))
  332. return -EINVAL;
  333. if (priv->shrd->tid_data[sta_id][tid].agg.state != IWL_AGG_OFF) {
  334. IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
  335. return -ENXIO;
  336. }
  337. ret = iwl_sta_tx_modify_enable_tid(priv, sta_id, tid);
  338. if (ret)
  339. return ret;
  340. ret = iwl_trans_tx_agg_alloc(trans(priv), vif_priv->ctx->ctxid, sta_id,
  341. tid, ssn);
  342. return ret;
  343. }
  344. int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
  345. struct ieee80211_sta *sta, u16 tid)
  346. {
  347. int txq_id, sta_id, ssn;
  348. struct iwl_tid_data *tid_data;
  349. int write_ptr, read_ptr;
  350. unsigned long flags;
  351. sta_id = iwl_sta_id(sta);
  352. if (sta_id == IWL_INVALID_STATION) {
  353. IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
  354. return -ENXIO;
  355. }
  356. spin_lock_irqsave(&priv->shrd->sta_lock, flags);
  357. tid_data = &priv->shrd->tid_data[sta_id][tid];
  358. ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
  359. txq_id = tid_data->agg.txq_id;
  360. switch (priv->shrd->tid_data[sta_id][tid].agg.state) {
  361. case IWL_EMPTYING_HW_QUEUE_ADDBA:
  362. /*
  363. * This can happen if the peer stops aggregation
  364. * again before we've had a chance to drain the
  365. * queue we selected previously, i.e. before the
  366. * session was really started completely.
  367. */
  368. IWL_DEBUG_HT(priv, "AGG stop before setup done\n");
  369. goto turn_off;
  370. case IWL_AGG_ON:
  371. break;
  372. default:
  373. IWL_WARN(priv, "Stopping AGG while state not ON or starting\n");
  374. }
  375. write_ptr = priv->txq[txq_id].q.write_ptr;
  376. read_ptr = priv->txq[txq_id].q.read_ptr;
  377. /* The queue is not empty */
  378. if (write_ptr != read_ptr) {
  379. IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n");
  380. priv->shrd->tid_data[sta_id][tid].agg.state =
  381. IWL_EMPTYING_HW_QUEUE_DELBA;
  382. spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
  383. return 0;
  384. }
  385. IWL_DEBUG_HT(priv, "HW queue is empty\n");
  386. turn_off:
  387. priv->shrd->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF;
  388. /* do not restore/save irqs */
  389. spin_unlock(&priv->shrd->sta_lock);
  390. spin_lock(&priv->shrd->lock);
  391. /*
  392. * the only reason this call can fail is queue number out of range,
  393. * which can happen if uCode is reloaded and all the station
  394. * information are lost. if it is outside the range, there is no need
  395. * to deactivate the uCode queue, just return "success" to allow
  396. * mac80211 to clean up it own data.
  397. */
  398. iwl_trans_txq_agg_disable(trans(priv), txq_id);
  399. spin_unlock_irqrestore(&priv->shrd->lock, flags);
  400. ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
  401. return 0;
  402. }
  403. static void iwlagn_non_agg_tx_status(struct iwl_priv *priv,
  404. struct iwl_rxon_context *ctx,
  405. const u8 *addr1)
  406. {
  407. struct ieee80211_sta *sta;
  408. struct iwl_station_priv *sta_priv;
  409. rcu_read_lock();
  410. sta = ieee80211_find_sta(ctx->vif, addr1);
  411. if (sta) {
  412. sta_priv = (void *)sta->drv_priv;
  413. /* avoid atomic ops if this isn't a client */
  414. if (sta_priv->client &&
  415. atomic_dec_return(&sta_priv->pending_frames) == 0)
  416. ieee80211_sta_block_awake(priv->hw, sta, false);
  417. }
  418. rcu_read_unlock();
  419. }
  420. /**
  421. * translate ucode response to mac80211 tx status control values
  422. */
  423. static void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
  424. struct ieee80211_tx_info *info)
  425. {
  426. struct ieee80211_tx_rate *r = &info->control.rates[0];
  427. info->antenna_sel_tx =
  428. ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
  429. if (rate_n_flags & RATE_MCS_HT_MSK)
  430. r->flags |= IEEE80211_TX_RC_MCS;
  431. if (rate_n_flags & RATE_MCS_GF_MSK)
  432. r->flags |= IEEE80211_TX_RC_GREEN_FIELD;
  433. if (rate_n_flags & RATE_MCS_HT40_MSK)
  434. r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  435. if (rate_n_flags & RATE_MCS_DUP_MSK)
  436. r->flags |= IEEE80211_TX_RC_DUP_DATA;
  437. if (rate_n_flags & RATE_MCS_SGI_MSK)
  438. r->flags |= IEEE80211_TX_RC_SHORT_GI;
  439. r->idx = iwlagn_hwrate_to_mac80211_idx(rate_n_flags, info->band);
  440. }
  441. #ifdef CONFIG_IWLWIFI_DEBUG
  442. const char *iwl_get_tx_fail_reason(u32 status)
  443. {
  444. #define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x
  445. #define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x
  446. switch (status & TX_STATUS_MSK) {
  447. case TX_STATUS_SUCCESS:
  448. return "SUCCESS";
  449. TX_STATUS_POSTPONE(DELAY);
  450. TX_STATUS_POSTPONE(FEW_BYTES);
  451. TX_STATUS_POSTPONE(BT_PRIO);
  452. TX_STATUS_POSTPONE(QUIET_PERIOD);
  453. TX_STATUS_POSTPONE(CALC_TTAK);
  454. TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY);
  455. TX_STATUS_FAIL(SHORT_LIMIT);
  456. TX_STATUS_FAIL(LONG_LIMIT);
  457. TX_STATUS_FAIL(FIFO_UNDERRUN);
  458. TX_STATUS_FAIL(DRAIN_FLOW);
  459. TX_STATUS_FAIL(RFKILL_FLUSH);
  460. TX_STATUS_FAIL(LIFE_EXPIRE);
  461. TX_STATUS_FAIL(DEST_PS);
  462. TX_STATUS_FAIL(HOST_ABORTED);
  463. TX_STATUS_FAIL(BT_RETRY);
  464. TX_STATUS_FAIL(STA_INVALID);
  465. TX_STATUS_FAIL(FRAG_DROPPED);
  466. TX_STATUS_FAIL(TID_DISABLE);
  467. TX_STATUS_FAIL(FIFO_FLUSHED);
  468. TX_STATUS_FAIL(INSUFFICIENT_CF_POLL);
  469. TX_STATUS_FAIL(PASSIVE_NO_RX);
  470. TX_STATUS_FAIL(NO_BEACON_ON_RADAR);
  471. }
  472. return "UNKNOWN";
  473. #undef TX_STATUS_FAIL
  474. #undef TX_STATUS_POSTPONE
  475. }
  476. #endif /* CONFIG_IWLWIFI_DEBUG */
  477. static void iwlagn_count_agg_tx_err_status(struct iwl_priv *priv, u16 status)
  478. {
  479. status &= AGG_TX_STATUS_MSK;
  480. switch (status) {
  481. case AGG_TX_STATE_UNDERRUN_MSK:
  482. priv->reply_agg_tx_stats.underrun++;
  483. break;
  484. case AGG_TX_STATE_BT_PRIO_MSK:
  485. priv->reply_agg_tx_stats.bt_prio++;
  486. break;
  487. case AGG_TX_STATE_FEW_BYTES_MSK:
  488. priv->reply_agg_tx_stats.few_bytes++;
  489. break;
  490. case AGG_TX_STATE_ABORT_MSK:
  491. priv->reply_agg_tx_stats.abort++;
  492. break;
  493. case AGG_TX_STATE_LAST_SENT_TTL_MSK:
  494. priv->reply_agg_tx_stats.last_sent_ttl++;
  495. break;
  496. case AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK:
  497. priv->reply_agg_tx_stats.last_sent_try++;
  498. break;
  499. case AGG_TX_STATE_LAST_SENT_BT_KILL_MSK:
  500. priv->reply_agg_tx_stats.last_sent_bt_kill++;
  501. break;
  502. case AGG_TX_STATE_SCD_QUERY_MSK:
  503. priv->reply_agg_tx_stats.scd_query++;
  504. break;
  505. case AGG_TX_STATE_TEST_BAD_CRC32_MSK:
  506. priv->reply_agg_tx_stats.bad_crc32++;
  507. break;
  508. case AGG_TX_STATE_RESPONSE_MSK:
  509. priv->reply_agg_tx_stats.response++;
  510. break;
  511. case AGG_TX_STATE_DUMP_TX_MSK:
  512. priv->reply_agg_tx_stats.dump_tx++;
  513. break;
  514. case AGG_TX_STATE_DELAY_TX_MSK:
  515. priv->reply_agg_tx_stats.delay_tx++;
  516. break;
  517. default:
  518. priv->reply_agg_tx_stats.unknown++;
  519. break;
  520. }
  521. }
  522. static void iwl_rx_reply_tx_agg(struct iwl_priv *priv,
  523. struct iwlagn_tx_resp *tx_resp)
  524. {
  525. struct agg_tx_status *frame_status = &tx_resp->status;
  526. int tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >>
  527. IWLAGN_TX_RES_TID_POS;
  528. int sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
  529. IWLAGN_TX_RES_RA_POS;
  530. struct iwl_ht_agg *agg = &priv->shrd->tid_data[sta_id][tid].agg;
  531. u32 status = le16_to_cpu(tx_resp->status.status);
  532. int i;
  533. if (agg->wait_for_ba)
  534. IWL_DEBUG_TX_REPLY(priv,
  535. "got tx response w/o block-ack\n");
  536. agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
  537. agg->wait_for_ba = (tx_resp->frame_count > 1);
  538. /*
  539. * If the BT kill count is non-zero, we'll get this
  540. * notification again.
  541. */
  542. if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 &&
  543. priv->cfg->bt_params &&
  544. priv->cfg->bt_params->advanced_bt_coexist) {
  545. IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n");
  546. }
  547. /* Construct bit-map of pending frames within Tx window */
  548. for (i = 0; i < tx_resp->frame_count; i++) {
  549. u16 fstatus = le16_to_cpu(frame_status[i].status);
  550. if (status & AGG_TX_STATUS_MSK)
  551. iwlagn_count_agg_tx_err_status(priv, fstatus);
  552. if (status & (AGG_TX_STATE_FEW_BYTES_MSK |
  553. AGG_TX_STATE_ABORT_MSK))
  554. continue;
  555. IWL_DEBUG_TX_REPLY(priv, "status %s (0x%08x), "
  556. "try-count (0x%08x)\n",
  557. iwl_get_agg_tx_fail_reason(fstatus),
  558. fstatus & AGG_TX_STATUS_MSK,
  559. fstatus & AGG_TX_TRY_MSK);
  560. }
  561. }
  562. #ifdef CONFIG_IWLWIFI_DEBUG
  563. #define AGG_TX_STATE_FAIL(x) case AGG_TX_STATE_ ## x: return #x
  564. const char *iwl_get_agg_tx_fail_reason(u16 status)
  565. {
  566. status &= AGG_TX_STATUS_MSK;
  567. switch (status) {
  568. case AGG_TX_STATE_TRANSMITTED:
  569. return "SUCCESS";
  570. AGG_TX_STATE_FAIL(UNDERRUN_MSK);
  571. AGG_TX_STATE_FAIL(BT_PRIO_MSK);
  572. AGG_TX_STATE_FAIL(FEW_BYTES_MSK);
  573. AGG_TX_STATE_FAIL(ABORT_MSK);
  574. AGG_TX_STATE_FAIL(LAST_SENT_TTL_MSK);
  575. AGG_TX_STATE_FAIL(LAST_SENT_TRY_CNT_MSK);
  576. AGG_TX_STATE_FAIL(LAST_SENT_BT_KILL_MSK);
  577. AGG_TX_STATE_FAIL(SCD_QUERY_MSK);
  578. AGG_TX_STATE_FAIL(TEST_BAD_CRC32_MSK);
  579. AGG_TX_STATE_FAIL(RESPONSE_MSK);
  580. AGG_TX_STATE_FAIL(DUMP_TX_MSK);
  581. AGG_TX_STATE_FAIL(DELAY_TX_MSK);
  582. }
  583. return "UNKNOWN";
  584. }
  585. #endif /* CONFIG_IWLWIFI_DEBUG */
  586. static inline u32 iwlagn_get_scd_ssn(struct iwlagn_tx_resp *tx_resp)
  587. {
  588. return le32_to_cpup((__le32 *)&tx_resp->status +
  589. tx_resp->frame_count) & MAX_SN;
  590. }
  591. static void iwlagn_count_tx_err_status(struct iwl_priv *priv, u16 status)
  592. {
  593. status &= TX_STATUS_MSK;
  594. switch (status) {
  595. case TX_STATUS_POSTPONE_DELAY:
  596. priv->reply_tx_stats.pp_delay++;
  597. break;
  598. case TX_STATUS_POSTPONE_FEW_BYTES:
  599. priv->reply_tx_stats.pp_few_bytes++;
  600. break;
  601. case TX_STATUS_POSTPONE_BT_PRIO:
  602. priv->reply_tx_stats.pp_bt_prio++;
  603. break;
  604. case TX_STATUS_POSTPONE_QUIET_PERIOD:
  605. priv->reply_tx_stats.pp_quiet_period++;
  606. break;
  607. case TX_STATUS_POSTPONE_CALC_TTAK:
  608. priv->reply_tx_stats.pp_calc_ttak++;
  609. break;
  610. case TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
  611. priv->reply_tx_stats.int_crossed_retry++;
  612. break;
  613. case TX_STATUS_FAIL_SHORT_LIMIT:
  614. priv->reply_tx_stats.short_limit++;
  615. break;
  616. case TX_STATUS_FAIL_LONG_LIMIT:
  617. priv->reply_tx_stats.long_limit++;
  618. break;
  619. case TX_STATUS_FAIL_FIFO_UNDERRUN:
  620. priv->reply_tx_stats.fifo_underrun++;
  621. break;
  622. case TX_STATUS_FAIL_DRAIN_FLOW:
  623. priv->reply_tx_stats.drain_flow++;
  624. break;
  625. case TX_STATUS_FAIL_RFKILL_FLUSH:
  626. priv->reply_tx_stats.rfkill_flush++;
  627. break;
  628. case TX_STATUS_FAIL_LIFE_EXPIRE:
  629. priv->reply_tx_stats.life_expire++;
  630. break;
  631. case TX_STATUS_FAIL_DEST_PS:
  632. priv->reply_tx_stats.dest_ps++;
  633. break;
  634. case TX_STATUS_FAIL_HOST_ABORTED:
  635. priv->reply_tx_stats.host_abort++;
  636. break;
  637. case TX_STATUS_FAIL_BT_RETRY:
  638. priv->reply_tx_stats.bt_retry++;
  639. break;
  640. case TX_STATUS_FAIL_STA_INVALID:
  641. priv->reply_tx_stats.sta_invalid++;
  642. break;
  643. case TX_STATUS_FAIL_FRAG_DROPPED:
  644. priv->reply_tx_stats.frag_drop++;
  645. break;
  646. case TX_STATUS_FAIL_TID_DISABLE:
  647. priv->reply_tx_stats.tid_disable++;
  648. break;
  649. case TX_STATUS_FAIL_FIFO_FLUSHED:
  650. priv->reply_tx_stats.fifo_flush++;
  651. break;
  652. case TX_STATUS_FAIL_INSUFFICIENT_CF_POLL:
  653. priv->reply_tx_stats.insuff_cf_poll++;
  654. break;
  655. case TX_STATUS_FAIL_PASSIVE_NO_RX:
  656. priv->reply_tx_stats.fail_hw_drop++;
  657. break;
  658. case TX_STATUS_FAIL_NO_BEACON_ON_RADAR:
  659. priv->reply_tx_stats.sta_color_mismatch++;
  660. break;
  661. default:
  662. priv->reply_tx_stats.unknown++;
  663. break;
  664. }
  665. }
  666. static void iwlagn_set_tx_status(struct iwl_priv *priv,
  667. struct ieee80211_tx_info *info,
  668. struct iwlagn_tx_resp *tx_resp,
  669. bool is_agg)
  670. {
  671. u16 status = le16_to_cpu(tx_resp->status.status);
  672. info->status.rates[0].count = tx_resp->failure_frame + 1;
  673. if (is_agg)
  674. info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  675. info->flags |= iwl_tx_status_to_mac80211(status);
  676. iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
  677. info);
  678. if (!iwl_is_tx_success(status))
  679. iwlagn_count_tx_err_status(priv, status);
  680. }
  681. static void iwl_check_abort_status(struct iwl_priv *priv,
  682. u8 frame_count, u32 status)
  683. {
  684. if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
  685. IWL_ERR(priv, "Tx flush command to flush out all frames\n");
  686. if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
  687. queue_work(priv->shrd->workqueue, &priv->tx_flush);
  688. }
  689. }
  690. void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
  691. {
  692. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  693. u16 sequence = le16_to_cpu(pkt->hdr.sequence);
  694. int txq_id = SEQ_TO_QUEUE(sequence);
  695. int cmd_index = SEQ_TO_INDEX(sequence);
  696. struct iwl_tx_queue *txq = &priv->txq[txq_id];
  697. struct iwlagn_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
  698. struct ieee80211_hdr *hdr;
  699. u32 status = le16_to_cpu(tx_resp->status.status);
  700. u32 ssn = iwlagn_get_scd_ssn(tx_resp);
  701. int tid;
  702. int sta_id;
  703. int freed;
  704. struct ieee80211_tx_info *info;
  705. unsigned long flags;
  706. struct sk_buff_head skbs;
  707. struct sk_buff *skb;
  708. struct iwl_rxon_context *ctx;
  709. if ((cmd_index >= txq->q.n_bd) ||
  710. (iwl_queue_used(&txq->q, cmd_index) == 0)) {
  711. IWL_ERR(priv, "%s: Read index for DMA queue txq_id (%d) "
  712. "cmd_index %d is out of range [0-%d] %d %d\n",
  713. __func__, txq_id, cmd_index, txq->q.n_bd,
  714. txq->q.write_ptr, txq->q.read_ptr);
  715. return;
  716. }
  717. txq->time_stamp = jiffies;
  718. tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >>
  719. IWLAGN_TX_RES_TID_POS;
  720. sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
  721. IWLAGN_TX_RES_RA_POS;
  722. spin_lock_irqsave(&priv->shrd->sta_lock, flags);
  723. if (txq->sched_retry)
  724. iwl_rx_reply_tx_agg(priv, tx_resp);
  725. if (tx_resp->frame_count == 1) {
  726. bool is_agg = (txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
  727. __skb_queue_head_init(&skbs);
  728. /*we can free until ssn % q.n_bd not inclusive */
  729. iwl_trans_reclaim(trans(priv), sta_id, tid, txq_id,
  730. ssn, status, &skbs);
  731. freed = 0;
  732. while (!skb_queue_empty(&skbs)) {
  733. skb = __skb_dequeue(&skbs);
  734. hdr = (struct ieee80211_hdr *)skb->data;
  735. if (!ieee80211_is_data_qos(hdr->frame_control))
  736. priv->last_seq_ctl = tx_resp->seq_ctl;
  737. info = IEEE80211_SKB_CB(skb);
  738. ctx = info->driver_data[0];
  739. kmem_cache_free(priv->tx_cmd_pool,
  740. (info->driver_data[1]));
  741. memset(&info->status, 0, sizeof(info->status));
  742. if (status == TX_STATUS_FAIL_PASSIVE_NO_RX &&
  743. iwl_is_associated_ctx(ctx) && ctx->vif &&
  744. ctx->vif->type == NL80211_IFTYPE_STATION) {
  745. ctx->last_tx_rejected = true;
  746. iwl_stop_queue(priv, &priv->txq[txq_id]);
  747. IWL_DEBUG_TX_REPLY(priv,
  748. "TXQ %d status %s (0x%08x) "
  749. "rate_n_flags 0x%x retries %d\n",
  750. txq_id,
  751. iwl_get_tx_fail_reason(status),
  752. status,
  753. le32_to_cpu(tx_resp->rate_n_flags),
  754. tx_resp->failure_frame);
  755. IWL_DEBUG_TX_REPLY(priv,
  756. "FrameCnt = %d, idx=%d\n",
  757. tx_resp->frame_count, cmd_index);
  758. }
  759. /* check if BAR is needed */
  760. if (is_agg && !iwl_is_tx_success(status))
  761. info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
  762. iwlagn_set_tx_status(priv, IEEE80211_SKB_CB(skb),
  763. tx_resp, is_agg);
  764. if (!is_agg)
  765. iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1);
  766. ieee80211_tx_status_irqsafe(priv->hw, skb);
  767. freed++;
  768. }
  769. WARN_ON(!is_agg && freed != 1);
  770. }
  771. iwl_check_abort_status(priv, tx_resp->frame_count, status);
  772. spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
  773. }
  774. /**
  775. * iwlagn_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA
  776. *
  777. * Handles block-acknowledge notification from device, which reports success
  778. * of frames sent via aggregation.
  779. */
  780. void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
  781. struct iwl_rx_mem_buffer *rxb)
  782. {
  783. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  784. struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
  785. struct iwl_tx_queue *txq = NULL;
  786. struct iwl_ht_agg *agg;
  787. struct sk_buff_head reclaimed_skbs;
  788. struct ieee80211_tx_info *info;
  789. struct ieee80211_hdr *hdr;
  790. struct sk_buff *skb;
  791. unsigned long flags;
  792. int index;
  793. int sta_id;
  794. int tid;
  795. int freed;
  796. /* "flow" corresponds to Tx queue */
  797. u16 scd_flow = le16_to_cpu(ba_resp->scd_flow);
  798. /* "ssn" is start of block-ack Tx window, corresponds to index
  799. * (in Tx queue's circular buffer) of first TFD/frame in window */
  800. u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
  801. if (scd_flow >= hw_params(priv).max_txq_num) {
  802. IWL_ERR(priv,
  803. "BUG_ON scd_flow is bigger than number of queues\n");
  804. return;
  805. }
  806. txq = &priv->txq[scd_flow];
  807. sta_id = ba_resp->sta_id;
  808. tid = ba_resp->tid;
  809. agg = &priv->shrd->tid_data[sta_id][tid].agg;
  810. /* Find index of block-ack window */
  811. index = ba_resp_scd_ssn & (txq->q.n_bd - 1);
  812. spin_lock_irqsave(&priv->shrd->sta_lock, flags);
  813. if (unlikely(agg->txq_id != scd_flow)) {
  814. /*
  815. * FIXME: this is a uCode bug which need to be addressed,
  816. * log the information and return for now!
  817. * since it is possible happen very often and in order
  818. * not to fill the syslog, don't enable the logging by default
  819. */
  820. IWL_DEBUG_TX_REPLY(priv,
  821. "BA scd_flow %d does not match txq_id %d\n",
  822. scd_flow, agg->txq_id);
  823. spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
  824. return;
  825. }
  826. if (unlikely(!agg->wait_for_ba)) {
  827. if (unlikely(ba_resp->bitmap))
  828. IWL_ERR(priv, "Received BA when not expected\n");
  829. spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
  830. return;
  831. }
  832. IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
  833. "sta_id = %d\n",
  834. agg->wait_for_ba,
  835. (u8 *) &ba_resp->sta_addr_lo32,
  836. ba_resp->sta_id);
  837. IWL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx, "
  838. "scd_flow = %d, scd_ssn = %d\n",
  839. ba_resp->tid,
  840. ba_resp->seq_ctl,
  841. (unsigned long long)le64_to_cpu(ba_resp->bitmap),
  842. ba_resp->scd_flow,
  843. ba_resp->scd_ssn);
  844. /* Mark that the expected block-ack response arrived */
  845. agg->wait_for_ba = 0;
  846. /* Sanity check values reported by uCode */
  847. if (ba_resp->txed_2_done > ba_resp->txed) {
  848. IWL_DEBUG_TX_REPLY(priv,
  849. "bogus sent(%d) and ack(%d) count\n",
  850. ba_resp->txed, ba_resp->txed_2_done);
  851. /*
  852. * set txed_2_done = txed,
  853. * so it won't impact rate scale
  854. */
  855. ba_resp->txed = ba_resp->txed_2_done;
  856. }
  857. IWL_DEBUG_HT(priv, "agg frames sent:%d, acked:%d\n",
  858. ba_resp->txed, ba_resp->txed_2_done);
  859. __skb_queue_head_init(&reclaimed_skbs);
  860. /* Release all TFDs before the SSN, i.e. all TFDs in front of
  861. * block-ack window (we assume that they've been successfully
  862. * transmitted ... if not, it's too late anyway). */
  863. iwl_trans_reclaim(trans(priv), sta_id, tid, scd_flow, ba_resp_scd_ssn,
  864. 0, &reclaimed_skbs);
  865. freed = 0;
  866. while (!skb_queue_empty(&reclaimed_skbs)) {
  867. skb = __skb_dequeue(&reclaimed_skbs);
  868. hdr = (struct ieee80211_hdr *)skb->data;
  869. if (ieee80211_is_data_qos(hdr->frame_control))
  870. freed++;
  871. else
  872. WARN_ON_ONCE(1);
  873. if (freed == 0) {
  874. /* this is the first skb we deliver in this batch */
  875. /* put the rate scaling data there */
  876. info = IEEE80211_SKB_CB(skb);
  877. memset(&info->status, 0, sizeof(info->status));
  878. info->flags |= IEEE80211_TX_STAT_ACK;
  879. info->flags |= IEEE80211_TX_STAT_AMPDU;
  880. info->status.ampdu_ack_len = ba_resp->txed_2_done;
  881. info->status.ampdu_len = ba_resp->txed;
  882. iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags,
  883. info);
  884. }
  885. info = IEEE80211_SKB_CB(skb);
  886. kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
  887. ieee80211_tx_status_irqsafe(priv->hw, skb);
  888. }
  889. spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
  890. }