iwl-tx.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
  4. *
  5. * Portions of this file are derived from the ipw3945 project, as well
  6. * as portions of the ieee80211 subsystem header files.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of version 2 of the GNU General Public License as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  20. *
  21. * The full GNU General Public License is included in this distribution in the
  22. * file called LICENSE.
  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/etherdevice.h>
  30. #include <linux/sched.h>
  31. #include <linux/slab.h>
  32. #include <net/mac80211.h>
  33. #include "iwl-eeprom.h"
  34. #include "iwl-agn.h"
  35. #include "iwl-dev.h"
  36. #include "iwl-core.h"
  37. #include "iwl-sta.h"
  38. #include "iwl-io.h"
  39. #include "iwl-helpers.h"
  40. /**
  41. * iwl_txq_update_write_ptr - Send new write index to hardware
  42. */
  43. void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
  44. {
  45. u32 reg = 0;
  46. int txq_id = txq->q.id;
  47. if (txq->need_update == 0)
  48. return;
  49. if (priv->cfg->base_params->shadow_reg_enable) {
  50. /* shadow register enabled */
  51. iwl_write32(priv, HBUS_TARG_WRPTR,
  52. txq->q.write_ptr | (txq_id << 8));
  53. } else {
  54. /* if we're trying to save power */
  55. if (test_bit(STATUS_POWER_PMI, &priv->status)) {
  56. /* wake up nic if it's powered down ...
  57. * uCode will wake up, and interrupt us again, so next
  58. * time we'll skip this part. */
  59. reg = iwl_read32(priv, CSR_UCODE_DRV_GP1);
  60. if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
  61. IWL_DEBUG_INFO(priv,
  62. "Tx queue %d requesting wakeup,"
  63. " GP1 = 0x%x\n", txq_id, reg);
  64. iwl_set_bit(priv, CSR_GP_CNTRL,
  65. CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
  66. return;
  67. }
  68. iwl_write_direct32(priv, HBUS_TARG_WRPTR,
  69. txq->q.write_ptr | (txq_id << 8));
  70. /*
  71. * else not in power-save mode,
  72. * uCode will never sleep when we're
  73. * trying to tx (during RFKILL, we're not trying to tx).
  74. */
  75. } else
  76. iwl_write32(priv, HBUS_TARG_WRPTR,
  77. txq->q.write_ptr | (txq_id << 8));
  78. }
  79. txq->need_update = 0;
  80. }
  81. static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
  82. {
  83. struct iwl_tfd_tb *tb = &tfd->tbs[idx];
  84. dma_addr_t addr = get_unaligned_le32(&tb->lo);
  85. if (sizeof(dma_addr_t) > sizeof(u32))
  86. addr |=
  87. ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16;
  88. return addr;
  89. }
  90. static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)
  91. {
  92. struct iwl_tfd_tb *tb = &tfd->tbs[idx];
  93. return le16_to_cpu(tb->hi_n_len) >> 4;
  94. }
  95. static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
  96. dma_addr_t addr, u16 len)
  97. {
  98. struct iwl_tfd_tb *tb = &tfd->tbs[idx];
  99. u16 hi_n_len = len << 4;
  100. put_unaligned_le32(addr, &tb->lo);
  101. if (sizeof(dma_addr_t) > sizeof(u32))
  102. hi_n_len |= ((addr >> 16) >> 16) & 0xF;
  103. tb->hi_n_len = cpu_to_le16(hi_n_len);
  104. tfd->num_tbs = idx + 1;
  105. }
  106. static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
  107. {
  108. return tfd->num_tbs & 0x1f;
  109. }
  110. static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
  111. struct iwl_tfd *tfd, enum dma_data_direction dma_dir)
  112. {
  113. int i;
  114. int num_tbs;
  115. /* Sanity check on number of chunks */
  116. num_tbs = iwl_tfd_get_num_tbs(tfd);
  117. if (num_tbs >= IWL_NUM_OF_TBS) {
  118. IWL_ERR(priv, "Too many chunks: %i\n", num_tbs);
  119. /* @todo issue fatal error, it is quite serious situation */
  120. return;
  121. }
  122. /* Unmap tx_cmd */
  123. if (num_tbs)
  124. dma_unmap_single(priv->bus.dev,
  125. dma_unmap_addr(meta, mapping),
  126. dma_unmap_len(meta, len),
  127. DMA_BIDIRECTIONAL);
  128. /* Unmap chunks, if any. */
  129. for (i = 1; i < num_tbs; i++)
  130. dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i),
  131. iwl_tfd_tb_get_len(tfd, i), dma_dir);
  132. }
  133. /**
  134. * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
  135. * @priv - driver private data
  136. * @txq - tx queue
  137. * @index - the index of the TFD to be freed
  138. *
  139. * Does NOT advance any TFD circular buffer read/write indexes
  140. * Does NOT free the TFD itself (which is within circular buffer)
  141. */
  142. void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq,
  143. int index)
  144. {
  145. struct iwl_tfd *tfd_tmp = txq->tfds;
  146. iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index],
  147. DMA_TO_DEVICE);
  148. /* free SKB */
  149. if (txq->txb) {
  150. struct sk_buff *skb;
  151. skb = txq->txb[index].skb;
  152. /* can be called from irqs-disabled context */
  153. if (skb) {
  154. dev_kfree_skb_any(skb);
  155. txq->txb[index].skb = NULL;
  156. }
  157. }
  158. }
  159. int iwlagn_txq_attach_buf_to_tfd(struct iwl_priv *priv,
  160. struct iwl_tx_queue *txq,
  161. dma_addr_t addr, u16 len,
  162. u8 reset)
  163. {
  164. struct iwl_queue *q;
  165. struct iwl_tfd *tfd, *tfd_tmp;
  166. u32 num_tbs;
  167. q = &txq->q;
  168. tfd_tmp = txq->tfds;
  169. tfd = &tfd_tmp[q->write_ptr];
  170. if (reset)
  171. memset(tfd, 0, sizeof(*tfd));
  172. num_tbs = iwl_tfd_get_num_tbs(tfd);
  173. /* Each TFD can point to a maximum 20 Tx buffers */
  174. if (num_tbs >= IWL_NUM_OF_TBS) {
  175. IWL_ERR(priv, "Error can not send more than %d chunks\n",
  176. IWL_NUM_OF_TBS);
  177. return -EINVAL;
  178. }
  179. if (WARN_ON(addr & ~DMA_BIT_MASK(36)))
  180. return -EINVAL;
  181. if (unlikely(addr & ~IWL_TX_DMA_MASK))
  182. IWL_ERR(priv, "Unaligned address = %llx\n",
  183. (unsigned long long)addr);
  184. iwl_tfd_set_tb(tfd, num_tbs, addr, len);
  185. return 0;
  186. }
  187. /*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
  188. * DMA services
  189. *
  190. * Theory of operation
  191. *
  192. * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer
  193. * of buffer descriptors, each of which points to one or more data buffers for
  194. * the device to read from or fill. Driver and device exchange status of each
  195. * queue via "read" and "write" pointers. Driver keeps minimum of 2 empty
  196. * entries in each circular buffer, to protect against confusing empty and full
  197. * queue states.
  198. *
  199. * The device reads or writes the data in the queues via the device's several
  200. * DMA/FIFO channels. Each queue is mapped to a single DMA channel.
  201. *
  202. * For Tx queue, there are low mark and high mark limits. If, after queuing
  203. * the packet for Tx, free space become < low mark, Tx queue stopped. When
  204. * reclaiming packets (on 'tx done IRQ), if free space become > high mark,
  205. * Tx queue resumed.
  206. *
  207. ***************************************************/
  208. int iwl_queue_space(const struct iwl_queue *q)
  209. {
  210. int s = q->read_ptr - q->write_ptr;
  211. if (q->read_ptr > q->write_ptr)
  212. s -= q->n_bd;
  213. if (s <= 0)
  214. s += q->n_window;
  215. /* keep some reserve to not confuse empty and full situations */
  216. s -= 2;
  217. if (s < 0)
  218. s = 0;
  219. return s;
  220. }
  221. /**
  222. * iwl_queue_init - Initialize queue's high/low-water and read/write indexes
  223. */
  224. int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
  225. int count, int slots_num, u32 id)
  226. {
  227. q->n_bd = count;
  228. q->n_window = slots_num;
  229. q->id = id;
  230. /* count must be power-of-two size, otherwise iwl_queue_inc_wrap
  231. * and iwl_queue_dec_wrap are broken. */
  232. if (WARN_ON(!is_power_of_2(count)))
  233. return -EINVAL;
  234. /* slots_num must be power-of-two size, otherwise
  235. * get_cmd_index is broken. */
  236. if (WARN_ON(!is_power_of_2(slots_num)))
  237. return -EINVAL;
  238. q->low_mark = q->n_window / 4;
  239. if (q->low_mark < 4)
  240. q->low_mark = 4;
  241. q->high_mark = q->n_window / 8;
  242. if (q->high_mark < 2)
  243. q->high_mark = 2;
  244. q->write_ptr = q->read_ptr = 0;
  245. return 0;
  246. }
  247. /*************** HOST COMMAND QUEUE FUNCTIONS *****/
  248. /**
  249. * iwl_enqueue_hcmd - enqueue a uCode command
  250. * @priv: device private data point
  251. * @cmd: a point to the ucode command structure
  252. *
  253. * The function returns < 0 values to indicate the operation is
  254. * failed. On success, it turns the index (> 0) of command in the
  255. * command queue.
  256. */
  257. int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
  258. {
  259. struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];
  260. struct iwl_queue *q = &txq->q;
  261. struct iwl_device_cmd *out_cmd;
  262. struct iwl_cmd_meta *out_meta;
  263. dma_addr_t phys_addr;
  264. unsigned long flags;
  265. u32 idx;
  266. u16 copy_size, cmd_size;
  267. bool is_ct_kill = false;
  268. bool had_nocopy = false;
  269. int i;
  270. u8 *cmd_dest;
  271. #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
  272. const void *trace_bufs[IWL_MAX_CMD_TFDS + 1] = {};
  273. int trace_lens[IWL_MAX_CMD_TFDS + 1] = {};
  274. int trace_idx;
  275. #endif
  276. if (test_bit(STATUS_FW_ERROR, &priv->status)) {
  277. IWL_WARN(priv, "fw recovery, no hcmd send\n");
  278. return -EIO;
  279. }
  280. if ((priv->ucode_owner == IWL_OWNERSHIP_TM) &&
  281. !(cmd->flags & CMD_ON_DEMAND)) {
  282. IWL_DEBUG_HC(priv, "tm own the uCode, no regular hcmd send\n");
  283. return -EIO;
  284. }
  285. copy_size = sizeof(out_cmd->hdr);
  286. cmd_size = sizeof(out_cmd->hdr);
  287. /* need one for the header if the first is NOCOPY */
  288. BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1);
  289. for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {
  290. if (!cmd->len[i])
  291. continue;
  292. if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) {
  293. had_nocopy = true;
  294. } else {
  295. /* NOCOPY must not be followed by normal! */
  296. if (WARN_ON(had_nocopy))
  297. return -EINVAL;
  298. copy_size += cmd->len[i];
  299. }
  300. cmd_size += cmd->len[i];
  301. }
  302. /*
  303. * If any of the command structures end up being larger than
  304. * the TFD_MAX_PAYLOAD_SIZE and they aren't dynamically
  305. * allocated into separate TFDs, then we will need to
  306. * increase the size of the buffers.
  307. */
  308. if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE))
  309. return -EINVAL;
  310. if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
  311. IWL_WARN(priv, "Not sending command - %s KILL\n",
  312. iwl_is_rfkill(priv) ? "RF" : "CT");
  313. return -EIO;
  314. }
  315. spin_lock_irqsave(&priv->hcmd_lock, flags);
  316. if (iwl_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
  317. spin_unlock_irqrestore(&priv->hcmd_lock, flags);
  318. IWL_ERR(priv, "No space in command queue\n");
  319. is_ct_kill = iwl_check_for_ct_kill(priv);
  320. if (!is_ct_kill) {
  321. IWL_ERR(priv, "Restarting adapter due to queue full\n");
  322. iwlagn_fw_error(priv, false);
  323. }
  324. return -ENOSPC;
  325. }
  326. idx = get_cmd_index(q, q->write_ptr);
  327. out_cmd = txq->cmd[idx];
  328. out_meta = &txq->meta[idx];
  329. memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */
  330. if (cmd->flags & CMD_WANT_SKB)
  331. out_meta->source = cmd;
  332. if (cmd->flags & CMD_ASYNC)
  333. out_meta->callback = cmd->callback;
  334. /* set up the header */
  335. out_cmd->hdr.cmd = cmd->id;
  336. out_cmd->hdr.flags = 0;
  337. out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) |
  338. INDEX_TO_SEQ(q->write_ptr));
  339. /* and copy the data that needs to be copied */
  340. cmd_dest = &out_cmd->cmd.payload[0];
  341. for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {
  342. if (!cmd->len[i])
  343. continue;
  344. if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)
  345. break;
  346. memcpy(cmd_dest, cmd->data[i], cmd->len[i]);
  347. cmd_dest += cmd->len[i];
  348. }
  349. IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "
  350. "%d bytes at %d[%d]:%d\n",
  351. get_cmd_string(out_cmd->hdr.cmd),
  352. out_cmd->hdr.cmd,
  353. le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
  354. q->write_ptr, idx, priv->cmd_queue);
  355. phys_addr = dma_map_single(priv->bus.dev, &out_cmd->hdr, copy_size,
  356. DMA_BIDIRECTIONAL);
  357. if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) {
  358. idx = -ENOMEM;
  359. goto out;
  360. }
  361. dma_unmap_addr_set(out_meta, mapping, phys_addr);
  362. dma_unmap_len_set(out_meta, len, copy_size);
  363. iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr, copy_size, 1);
  364. #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
  365. trace_bufs[0] = &out_cmd->hdr;
  366. trace_lens[0] = copy_size;
  367. trace_idx = 1;
  368. #endif
  369. for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {
  370. if (!cmd->len[i])
  371. continue;
  372. if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
  373. continue;
  374. phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i],
  375. cmd->len[i], DMA_BIDIRECTIONAL);
  376. if (dma_mapping_error(priv->bus.dev, phys_addr)) {
  377. iwlagn_unmap_tfd(priv, out_meta,
  378. &txq->tfds[q->write_ptr],
  379. DMA_BIDIRECTIONAL);
  380. idx = -ENOMEM;
  381. goto out;
  382. }
  383. iwlagn_txq_attach_buf_to_tfd(priv, txq, phys_addr,
  384. cmd->len[i], 0);
  385. #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
  386. trace_bufs[trace_idx] = cmd->data[i];
  387. trace_lens[trace_idx] = cmd->len[i];
  388. trace_idx++;
  389. #endif
  390. }
  391. out_meta->flags = cmd->flags;
  392. txq->need_update = 1;
  393. /* check that tracing gets all possible blocks */
  394. BUILD_BUG_ON(IWL_MAX_CMD_TFDS + 1 != 3);
  395. #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
  396. trace_iwlwifi_dev_hcmd(priv, cmd->flags,
  397. trace_bufs[0], trace_lens[0],
  398. trace_bufs[1], trace_lens[1],
  399. trace_bufs[2], trace_lens[2]);
  400. #endif
  401. /* Increment and update queue's write index */
  402. q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
  403. iwl_txq_update_write_ptr(priv, txq);
  404. out:
  405. spin_unlock_irqrestore(&priv->hcmd_lock, flags);
  406. return idx;
  407. }
  408. /**
  409. * iwl_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd
  410. *
  411. * When FW advances 'R' index, all entries between old and new 'R' index
  412. * need to be reclaimed. As result, some free space forms. If there is
  413. * enough free space (> low mark), wake the stack that feeds us.
  414. */
  415. static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
  416. {
  417. struct iwl_tx_queue *txq = &priv->txq[txq_id];
  418. struct iwl_queue *q = &txq->q;
  419. int nfreed = 0;
  420. if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
  421. IWL_ERR(priv, "%s: Read index for DMA queue txq id (%d), "
  422. "index %d is out of range [0-%d] %d %d.\n", __func__,
  423. txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr);
  424. return;
  425. }
  426. for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
  427. q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
  428. if (nfreed++ > 0) {
  429. IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx,
  430. q->write_ptr, q->read_ptr);
  431. iwlagn_fw_error(priv, false);
  432. }
  433. }
  434. }
  435. /**
  436. * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
  437. * @rxb: Rx buffer to reclaim
  438. *
  439. * If an Rx buffer has an async callback associated with it the callback
  440. * will be executed. The attached skb (if present) will only be freed
  441. * if the callback returns 1
  442. */
  443. void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
  444. {
  445. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  446. u16 sequence = le16_to_cpu(pkt->hdr.sequence);
  447. int txq_id = SEQ_TO_QUEUE(sequence);
  448. int index = SEQ_TO_INDEX(sequence);
  449. int cmd_index;
  450. struct iwl_device_cmd *cmd;
  451. struct iwl_cmd_meta *meta;
  452. struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];
  453. unsigned long flags;
  454. /* If a Tx command is being handled and it isn't in the actual
  455. * command queue then there a command routing bug has been introduced
  456. * in the queue management code. */
  457. if (WARN(txq_id != priv->cmd_queue,
  458. "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
  459. txq_id, priv->cmd_queue, sequence,
  460. priv->txq[priv->cmd_queue].q.read_ptr,
  461. priv->txq[priv->cmd_queue].q.write_ptr)) {
  462. iwl_print_hex_error(priv, pkt, 32);
  463. return;
  464. }
  465. cmd_index = get_cmd_index(&txq->q, index);
  466. cmd = txq->cmd[cmd_index];
  467. meta = &txq->meta[cmd_index];
  468. iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], DMA_BIDIRECTIONAL);
  469. /* Input error checking is done when commands are added to queue. */
  470. if (meta->flags & CMD_WANT_SKB) {
  471. meta->source->reply_page = (unsigned long)rxb_addr(rxb);
  472. rxb->page = NULL;
  473. } else if (meta->callback)
  474. meta->callback(priv, cmd, pkt);
  475. spin_lock_irqsave(&priv->hcmd_lock, flags);
  476. iwl_hcmd_queue_reclaim(priv, txq_id, index);
  477. if (!(meta->flags & CMD_ASYNC)) {
  478. clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
  479. IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n",
  480. get_cmd_string(cmd->hdr.cmd));
  481. wake_up_interruptible(&priv->wait_command_queue);
  482. }
  483. meta->flags = 0;
  484. spin_unlock_irqrestore(&priv->hcmd_lock, flags);
  485. }