aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h9
7 files changed, 56 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 60f1dc640c94..1e6b5e41a72b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1236,6 +1236,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1236 */ 1236 */
1237 trans_cfg.op_mode = op_mode; 1237 trans_cfg.op_mode = op_mode;
1238 1238
1239 if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
1240 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1241 trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
1242 } else {
1243 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1244 trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
1245 }
1246
1239 /* Configure transport layer */ 1247 /* Configure transport layer */
1240 iwl_trans_configure(trans(priv), &trans_cfg); 1248 iwl_trans_configure(trans(priv), &trans_cfg);
1241 1249
@@ -1336,14 +1344,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1336 priv->new_scan_threshold_behaviour = 1344 priv->new_scan_threshold_behaviour =
1337 !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); 1345 !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
1338 1346
1339 if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
1340 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1341 priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
1342 } else {
1343 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1344 priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
1345 }
1346
1347 priv->phy_calib_chain_noise_reset_cmd = 1347 priv->phy_calib_chain_noise_reset_cmd =
1348 fw->ucode_capa.standard_phy_calibration_size; 1348 fw->ucode_capa.standard_phy_calibration_size;
1349 priv->phy_calib_chain_noise_gain_cmd = 1349 priv->phy_calib_chain_noise_gain_cmd =
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 45409fcfbbd7..0d957ca3d6c6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -368,7 +368,6 @@ struct iwl_cfg {
368/** 368/**
369 * struct iwl_shared - shared fields for all the layers of the driver 369 * struct iwl_shared - shared fields for all the layers of the driver
370 * 370 *
371 * @cmd_queue: command queue number
372 * @status: STATUS_* 371 * @status: STATUS_*
373 * @wowlan: are we running wowlan uCode 372 * @wowlan: are we running wowlan uCode
374 * @valid_contexts: microcode/device supports multiple contexts 373 * @valid_contexts: microcode/device supports multiple contexts
@@ -385,7 +384,6 @@ struct iwl_cfg {
385 * @device_pointers: pointers to ucode event tables 384 * @device_pointers: pointers to ucode event tables
386 */ 385 */
387struct iwl_shared { 386struct iwl_shared {
388 u8 cmd_queue;
389 unsigned long status; 387 unsigned long status;
390 u8 valid_contexts; 388 u8 valid_contexts;
391 389
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index c0e68097fcb5..67965599bb30 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -248,6 +248,7 @@ struct iwl_tx_queue {
248 * @ucode_write_complete: indicates that the ucode has been copied. 248 * @ucode_write_complete: indicates that the ucode has been copied.
249 * @ucode_write_waitq: wait queue for uCode load 249 * @ucode_write_waitq: wait queue for uCode load
250 * @status - transport specific status flags 250 * @status - transport specific status flags
251 * @cmd_queue - command queue number
251 */ 252 */
252struct iwl_trans_pcie { 253struct iwl_trans_pcie {
253 struct iwl_rx_queue rxq; 254 struct iwl_rx_queue rxq;
@@ -289,6 +290,7 @@ struct iwl_trans_pcie {
289 bool ucode_write_complete; 290 bool ucode_write_complete;
290 wait_queue_head_t ucode_write_waitq; 291 wait_queue_head_t ucode_write_waitq;
291 unsigned long status; 292 unsigned long status;
293 u8 cmd_queue;
292}; 294};
293 295
294#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \ 296#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 32820913a2fd..a5547a155b95 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -361,7 +361,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
361{ 361{
362 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 362 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
363 struct iwl_rx_queue *rxq = &trans_pcie->rxq; 363 struct iwl_rx_queue *rxq = &trans_pcie->rxq;
364 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue]; 364 struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
365 struct iwl_device_cmd *cmd; 365 struct iwl_device_cmd *cmd;
366 unsigned long flags; 366 unsigned long flags;
367 int len, err; 367 int len, err;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index 73febc9726cb..2b1df0092aee 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -397,7 +397,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
397 397
398 WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); 398 WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
399 399
400 if (txq_id != trans->shrd->cmd_queue) 400 if (txq_id != trans_pcie->cmd_queue)
401 sta_id = tx_cmd->sta_id; 401 sta_id = tx_cmd->sta_id;
402 402
403 bc_ent = cpu_to_le16(1 | (sta_id << 12)); 403 bc_ent = cpu_to_le16(1 | (sta_id << 12));
@@ -664,7 +664,7 @@ int iwl_trans_pcie_tx_agg_disable(struct iwl_trans *trans, int sta_id, int tid)
664static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) 664static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
665{ 665{
666 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 666 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
667 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue]; 667 struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
668 struct iwl_queue *q = &txq->q; 668 struct iwl_queue *q = &txq->q;
669 struct iwl_device_cmd *out_cmd; 669 struct iwl_device_cmd *out_cmd;
670 struct iwl_cmd_meta *out_meta; 670 struct iwl_cmd_meta *out_meta;
@@ -737,7 +737,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
737 out_cmd->hdr.cmd = cmd->id; 737 out_cmd->hdr.cmd = cmd->id;
738 out_cmd->hdr.flags = 0; 738 out_cmd->hdr.flags = 0;
739 out_cmd->hdr.sequence = 739 out_cmd->hdr.sequence =
740 cpu_to_le16(QUEUE_TO_SEQ(trans->shrd->cmd_queue) | 740 cpu_to_le16(QUEUE_TO_SEQ(trans_pcie->cmd_queue) |
741 INDEX_TO_SEQ(q->write_ptr)); 741 INDEX_TO_SEQ(q->write_ptr));
742 742
743 /* and copy the data that needs to be copied */ 743 /* and copy the data that needs to be copied */
@@ -757,7 +757,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
757 get_cmd_string(out_cmd->hdr.cmd), 757 get_cmd_string(out_cmd->hdr.cmd),
758 out_cmd->hdr.cmd, 758 out_cmd->hdr.cmd,
759 le16_to_cpu(out_cmd->hdr.sequence), cmd_size, 759 le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
760 q->write_ptr, idx, trans->shrd->cmd_queue); 760 q->write_ptr, idx, trans_pcie->cmd_queue);
761 761
762 phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, 762 phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
763 DMA_BIDIRECTIONAL); 763 DMA_BIDIRECTIONAL);
@@ -881,16 +881,16 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
881 struct iwl_device_cmd *cmd; 881 struct iwl_device_cmd *cmd;
882 struct iwl_cmd_meta *meta; 882 struct iwl_cmd_meta *meta;
883 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 883 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
884 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue]; 884 struct iwl_tx_queue *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
885 885
886 /* If a Tx command is being handled and it isn't in the actual 886 /* If a Tx command is being handled and it isn't in the actual
887 * command queue then there a command routing bug has been introduced 887 * command queue then there a command routing bug has been introduced
888 * in the queue management code. */ 888 * in the queue management code. */
889 if (WARN(txq_id != trans->shrd->cmd_queue, 889 if (WARN(txq_id != trans_pcie->cmd_queue,
890 "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", 890 "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
891 txq_id, trans->shrd->cmd_queue, sequence, 891 txq_id, trans_pcie->cmd_queue, sequence,
892 trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr, 892 trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
893 trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) { 893 trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
894 iwl_print_hex_error(trans, pkt, 32); 894 iwl_print_hex_error(trans, pkt, 32);
895 return; 895 return;
896 } 896 }
@@ -997,7 +997,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
997 if (!ret) { 997 if (!ret) {
998 if (test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status)) { 998 if (test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status)) {
999 struct iwl_tx_queue *txq = 999 struct iwl_tx_queue *txq =
1000 &trans_pcie->txq[trans->shrd->cmd_queue]; 1000 &trans_pcie->txq[trans_pcie->cmd_queue];
1001 struct iwl_queue *q = &txq->q; 1001 struct iwl_queue *q = &txq->q;
1002 1002
1003 IWL_ERR(trans, 1003 IWL_ERR(trans,
@@ -1034,7 +1034,7 @@ cancel:
1034 * in later, it will possibly set an invalid 1034 * in later, it will possibly set an invalid
1035 * address (cmd->meta.source). 1035 * address (cmd->meta.source).
1036 */ 1036 */
1037 trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &= 1037 trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &=
1038 ~CMD_WANT_SKB; 1038 ~CMD_WANT_SKB;
1039 } 1039 }
1040 1040
@@ -1065,7 +1065,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
1065 int freed = 0; 1065 int freed = 0;
1066 1066
1067 /* This function is not meant to release cmd queue*/ 1067 /* This function is not meant to release cmd queue*/
1068 if (WARN_ON(txq_id == trans->shrd->cmd_queue)) 1068 if (WARN_ON(txq_id == trans_pcie->cmd_queue))
1069 return 0; 1069 return 0;
1070 1070
1071 lockdep_assert_held(&txq->lock); 1071 lockdep_assert_held(&txq->lock);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 6172651d7e25..8170133d8173 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -78,6 +78,10 @@
78 78
79#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) 79#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
80 80
81#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
82 (((1<<cfg(trans)->base_params->num_of_queues) - 1) &\
83 (~(1<<(trans_pcie)->cmd_queue)))
84
81static int iwl_trans_rx_alloc(struct iwl_trans *trans) 85static int iwl_trans_rx_alloc(struct iwl_trans *trans)
82{ 86{
83 struct iwl_trans_pcie *trans_pcie = 87 struct iwl_trans_pcie *trans_pcie =
@@ -301,6 +305,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
301{ 305{
302 size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; 306 size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
303 int i; 307 int i;
308 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
304 309
305 if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds)) 310 if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds))
306 return -EINVAL; 311 return -EINVAL;
@@ -313,7 +318,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
313 if (!txq->meta || !txq->cmd) 318 if (!txq->meta || !txq->cmd)
314 goto error; 319 goto error;
315 320
316 if (txq_id == trans->shrd->cmd_queue) 321 if (txq_id == trans_pcie->cmd_queue)
317 for (i = 0; i < slots_num; i++) { 322 for (i = 0; i < slots_num; i++) {
318 txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd), 323 txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd),
319 GFP_KERNEL); 324 GFP_KERNEL);
@@ -324,7 +329,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
324 /* Alloc driver data array and TFD circular buffer */ 329 /* Alloc driver data array and TFD circular buffer */
325 /* Driver private data, only for Tx (not command) queues, 330 /* Driver private data, only for Tx (not command) queues,
326 * not shared with device. */ 331 * not shared with device. */
327 if (txq_id != trans->shrd->cmd_queue) { 332 if (txq_id != trans_pcie->cmd_queue) {
328 txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]), 333 txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]),
329 GFP_KERNEL); 334 GFP_KERNEL);
330 if (!txq->skbs) { 335 if (!txq->skbs) {
@@ -352,7 +357,7 @@ error:
352 txq->skbs = NULL; 357 txq->skbs = NULL;
353 /* since txq->cmd has been zeroed, 358 /* since txq->cmd has been zeroed,
354 * all non allocated cmd[i] will be NULL */ 359 * all non allocated cmd[i] will be NULL */
355 if (txq->cmd && txq_id == trans->shrd->cmd_queue) 360 if (txq->cmd && txq_id == trans_pcie->cmd_queue)
356 for (i = 0; i < slots_num; i++) 361 for (i = 0; i < slots_num; i++)
357 kfree(txq->cmd[i]); 362 kfree(txq->cmd[i]);
358 kfree(txq->meta); 363 kfree(txq->meta);
@@ -418,7 +423,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
418 /* In the command queue, all the TBs are mapped as BIDI 423 /* In the command queue, all the TBs are mapped as BIDI
419 * so unmap them as such. 424 * so unmap them as such.
420 */ 425 */
421 if (txq_id == trans->shrd->cmd_queue) 426 if (txq_id == trans_pcie->cmd_queue)
422 dma_dir = DMA_BIDIRECTIONAL; 427 dma_dir = DMA_BIDIRECTIONAL;
423 else 428 else
424 dma_dir = DMA_TO_DEVICE; 429 dma_dir = DMA_TO_DEVICE;
@@ -454,7 +459,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
454 459
455 /* De-alloc array of command/tx buffers */ 460 /* De-alloc array of command/tx buffers */
456 461
457 if (txq_id == trans->shrd->cmd_queue) 462 if (txq_id == trans_pcie->cmd_queue)
458 for (i = 0; i < txq->q.n_window; i++) 463 for (i = 0; i < txq->q.n_window; i++)
459 kfree(txq->cmd[i]); 464 kfree(txq->cmd[i]);
460 465
@@ -551,7 +556,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
551 556
552 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 557 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
553 for (txq_id = 0; txq_id < hw_params(trans).max_txq_num; txq_id++) { 558 for (txq_id = 0; txq_id < hw_params(trans).max_txq_num; txq_id++) {
554 slots_num = (txq_id == trans->shrd->cmd_queue) ? 559 slots_num = (txq_id == trans->cmd_queue) ?
555 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 560 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
556 ret = iwl_trans_txq_alloc(trans, &trans_pcie->txq[txq_id], 561 ret = iwl_trans_txq_alloc(trans, &trans_pcie->txq[txq_id],
557 slots_num, txq_id); 562 slots_num, txq_id);
@@ -596,7 +601,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
596 601
597 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 602 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
598 for (txq_id = 0; txq_id < hw_params(trans).max_txq_num; txq_id++) { 603 for (txq_id = 0; txq_id < hw_params(trans).max_txq_num; txq_id++) {
599 slots_num = (txq_id == trans->shrd->cmd_queue) ? 604 slots_num = (txq_id == trans->cmd_queue) ?
600 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 605 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
601 ret = iwl_trans_txq_init(trans, &trans_pcie->txq[txq_id], 606 ret = iwl_trans_txq_init(trans, &trans_pcie->txq[txq_id],
602 slots_num, txq_id); 607 slots_num, txq_id);
@@ -1130,7 +1135,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
1130 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); 1135 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
1131 1136
1132 iwl_write_prph(trans, SCD_QUEUECHAIN_SEL, 1137 iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
1133 SCD_QUEUECHAIN_SEL_ALL(trans)); 1138 SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
1134 iwl_write_prph(trans, SCD_AGGR_SEL, 0); 1139 iwl_write_prph(trans, SCD_AGGR_SEL, 0);
1135 1140
1136 /* initiate the queues */ 1141 /* initiate the queues */
@@ -1162,7 +1167,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
1162 else 1167 else
1163 queue_to_fifo = iwlagn_default_queue_to_tx_fifo; 1168 queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
1164 1169
1165 iwl_trans_set_wr_ptrs(trans, trans->shrd->cmd_queue, 0); 1170 iwl_trans_set_wr_ptrs(trans, trans_pcie->cmd_queue, 0);
1166 1171
1167 /* make sure all queue are not stopped */ 1172 /* make sure all queue are not stopped */
1168 memset(&trans_pcie->queue_stopped[0], 0, 1173 memset(&trans_pcie->queue_stopped[0], 0,
@@ -1613,6 +1618,14 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
1613 return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); 1618 return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
1614} 1619}
1615 1620
1621static void iwl_trans_pcie_configure(struct iwl_trans *trans,
1622 const struct iwl_trans_config *trans_cfg)
1623{
1624 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1625
1626 trans_pcie->cmd_queue = trans_cfg->cmd_queue;
1627}
1628
1616static void iwl_trans_pcie_free(struct iwl_trans *trans) 1629static void iwl_trans_pcie_free(struct iwl_trans *trans)
1617{ 1630{
1618 struct iwl_trans_pcie *trans_pcie = 1631 struct iwl_trans_pcie *trans_pcie =
@@ -1673,7 +1686,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
1673 1686
1674 /* waiting for all the tx frames complete might take a while */ 1687 /* waiting for all the tx frames complete might take a while */
1675 for (cnt = 0; cnt < hw_params(trans).max_txq_num; cnt++) { 1688 for (cnt = 0; cnt < hw_params(trans).max_txq_num; cnt++) {
1676 if (cnt == trans->shrd->cmd_queue) 1689 if (cnt == trans->cmd_queue)
1677 continue; 1690 continue;
1678 txq = &trans_pcie->txq[cnt]; 1691 txq = &trans_pcie->txq[cnt];
1679 q = &txq->q; 1692 q = &txq->q;
@@ -2202,6 +2215,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
2202 .write8 = iwl_trans_pcie_write8, 2215 .write8 = iwl_trans_pcie_write8,
2203 .write32 = iwl_trans_pcie_write32, 2216 .write32 = iwl_trans_pcie_write32,
2204 .read32 = iwl_trans_pcie_read32, 2217 .read32 = iwl_trans_pcie_read32,
2218 .configure = iwl_trans_pcie_configure,
2205}; 2219};
2206 2220
2207struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, 2221struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index b6fd42779624..a40c2726c190 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -279,9 +279,12 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
279 * 279 *
280 * @op_mode: pointer to the upper layer. 280 * @op_mode: pointer to the upper layer.
281 * Must be set before any other call. 281 * Must be set before any other call.
282 * @cmd_queue: the index of the command queue.
283 * Must be set before start_fw.
282 */ 284 */
283struct iwl_trans_config { 285struct iwl_trans_config {
284 struct iwl_op_mode *op_mode; 286 struct iwl_op_mode *op_mode;
287 u8 cmd_queue;
285}; 288};
286 289
287/** 290/**
@@ -331,6 +334,8 @@ struct iwl_trans_config {
331 * @write8: write a u8 to a register at offset ofs from the BAR 334 * @write8: write a u8 to a register at offset ofs from the BAR
332 * @write32: write a u32 to a register at offset ofs from the BAR 335 * @write32: write a u32 to a register at offset ofs from the BAR
333 * @read32: read a u32 register at offset ofs from the BAR 336 * @read32: read a u32 register at offset ofs from the BAR
337 * @configure: configure parameters required by the transport layer from
338 * the op_mode.
334 */ 339 */
335struct iwl_trans_ops { 340struct iwl_trans_ops {
336 341
@@ -370,6 +375,8 @@ struct iwl_trans_ops {
370 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); 375 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
371 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); 376 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
372 u32 (*read32)(struct iwl_trans *trans, u32 ofs); 377 u32 (*read32)(struct iwl_trans *trans, u32 ofs);
378 void (*configure)(struct iwl_trans *trans,
379 const struct iwl_trans_config *trans_cfg);
373}; 380};
374 381
375/** 382/**
@@ -425,6 +432,8 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
425 * more 432 * more
426 */ 433 */
427 trans->op_mode = trans_cfg->op_mode; 434 trans->op_mode = trans_cfg->op_mode;
435
436 trans->ops->configure(trans, trans_cfg);
428} 437}
429 438
430static inline int iwl_trans_start_hw(struct iwl_trans *trans) 439static inline int iwl_trans_start_hw(struct iwl_trans *trans)