aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-05-29 04:29:10 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-06 07:21:20 -0400
commit4beaf6c2f8af52902bcd55b51f9ff8c8f547d485 (patch)
treee8fcd906805d19ed08d84d2408a760d876e1a8da /drivers/net
parentd0624be65ade709ef1a4220451a474be1ad01af9 (diff)
iwlwifi: s/txq_setup/txq_enable
We need to be able to enable / disable Tx queues in HW dynamically. So this function is no longer related to AGG only. It can do the job for any queue, even AC ones. Change the name to better reflect its role. Also use the new function to configure the AC / CMD queues in tx_start. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h14
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/internal.h7
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c29
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c43
6 files changed, 50 insertions, 50 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index 33603c5a24a8..32a823d7497f 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -665,7 +665,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
665 ret = iwl_sta_rx_agg_stop(priv, sta, tid); 665 ret = iwl_sta_rx_agg_stop(priv, sta, tid);
666 break; 666 break;
667 case IEEE80211_AMPDU_TX_START: 667 case IEEE80211_AMPDU_TX_START:
668 if (!priv->trans->ops->tx_agg_setup) 668 if (!priv->trans->ops->txq_enable)
669 break; 669 break;
670 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) 670 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)
671 break; 671 break;
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index 494a25c2f8aa..7fdbd175c551 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -688,9 +688,8 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
688 688
689 fifo = ctx->ac_to_fifo[tid_to_ac[tid]]; 689 fifo = ctx->ac_to_fifo[tid_to_ac[tid]];
690 690
691 iwl_trans_tx_agg_setup(priv->trans, q, fifo, 691 iwl_trans_txq_enable(priv->trans, q, fifo, sta_priv->sta_id, tid,
692 sta_priv->sta_id, tid, 692 buf_size, ssn);
693 buf_size, ssn);
694 693
695 /* 694 /*
696 * If the limit is 0, then it wasn't initialised yet, 695 * If the limit is 0, then it wasn't initialised yet,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 1fff285b6435..90ef0dc5f275 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -355,7 +355,7 @@ struct iwl_trans;
355 * Must be atomic 355 * Must be atomic
356 * @reclaim: free packet until ssn. Returns a list of freed packets. 356 * @reclaim: free packet until ssn. Returns a list of freed packets.
357 * Must be atomic 357 * Must be atomic
358 * @tx_agg_setup: setup a tx queue for AMPDU - will be called once the HW is 358 * @txq_enable: setup a tx queue for AMPDU - will be called once the HW is
359 * ready and a successful ADDBA response has been received. 359 * ready and a successful ADDBA response has been received.
360 * May sleep 360 * May sleep
361 * @txq_disable: de-configure a Tx queue to send AMPDUs 361 * @txq_disable: de-configure a Tx queue to send AMPDUs
@@ -391,8 +391,8 @@ struct iwl_trans_ops {
391 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, 391 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
392 struct sk_buff_head *skbs); 392 struct sk_buff_head *skbs);
393 393
394 void (*tx_agg_setup)(struct iwl_trans *trans, int queue, int fifo, 394 void (*txq_enable)(struct iwl_trans *trans, int queue, int fifo,
395 int sta_id, int tid, int frame_limit, u16 ssn); 395 int sta_id, int tid, int frame_limit, u16 ssn);
396 void (*txq_disable)(struct iwl_trans *trans, int queue); 396 void (*txq_disable)(struct iwl_trans *trans, int queue);
397 397
398 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); 398 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
@@ -551,16 +551,16 @@ static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue)
551 trans->ops->txq_disable(trans, queue); 551 trans->ops->txq_disable(trans, queue);
552} 552}
553 553
554static inline void iwl_trans_tx_agg_setup(struct iwl_trans *trans, int queue, 554static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
555 int fifo, int sta_id, int tid, 555 int fifo, int sta_id, int tid,
556 int frame_limit, u16 ssn) 556 int frame_limit, u16 ssn)
557{ 557{
558 might_sleep(); 558 might_sleep();
559 559
560 WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, 560 WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
561 "%s bad state = %d", __func__, trans->state); 561 "%s bad state = %d", __func__, trans->state);
562 562
563 trans->ops->tx_agg_setup(trans, queue, fifo, sta_id, tid, 563 trans->ops->txq_enable(trans, queue, fifo, sta_id, tid,
564 frame_limit, ssn); 564 frame_limit, ssn);
565} 565}
566 566
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index f802b5ac4a68..94201c4d6227 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -344,8 +344,11 @@ void iwl_trans_set_wr_ptrs(struct iwl_trans *trans, int txq_id, u32 index);
344void iwl_trans_tx_queue_set_status(struct iwl_trans *trans, 344void iwl_trans_tx_queue_set_status(struct iwl_trans *trans,
345 struct iwl_tx_queue *txq, 345 struct iwl_tx_queue *txq,
346 int tx_fifo_id, bool active); 346 int tx_fifo_id, bool active);
347void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int queue, int fifo, 347void __iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id,
348 int sta_id, int tid, int frame_limit, u16 ssn); 348 int fifo, int sta_id, int tid,
349 int frame_limit, u16 ssn);
350void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
351 int sta_id, int tid, int frame_limit, u16 ssn);
349void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, 352void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
350 enum dma_data_direction dma_dir); 353 enum dma_data_direction dma_dir);
351int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, 354int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 7c7702a48399..0f59e1f2bcac 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1054,33 +1054,12 @@ static void iwl_tx_start(struct iwl_trans *trans)
1054 iwl_write_prph(trans, SCD_DRAM_BASE_ADDR, 1054 iwl_write_prph(trans, SCD_DRAM_BASE_ADDR,
1055 trans_pcie->scd_bc_tbls.dma >> 10); 1055 trans_pcie->scd_bc_tbls.dma >> 10);
1056 1056
1057 iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
1058 SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
1059 iwl_write_prph(trans, SCD_AGGR_SEL, 0);
1060
1061 /* initiate the queues */
1062 for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) {
1063 iwl_trans_set_wr_ptrs(trans, i, 0);
1064 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
1065 SCD_CONTEXT_QUEUE_OFFSET(i), 0);
1066 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
1067 SCD_CONTEXT_QUEUE_OFFSET(i) +
1068 sizeof(u32),
1069 ((SCD_WIN_SIZE <<
1070 SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
1071 SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
1072 ((SCD_FRAME_LIMIT <<
1073 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
1074 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
1075 }
1076
1077 for (i = 0; i < trans_pcie->n_q_to_fifo; i++) { 1057 for (i = 0; i < trans_pcie->n_q_to_fifo; i++) {
1078 int fifo = trans_pcie->setup_q_to_fifo[i]; 1058 int fifo = trans_pcie->setup_q_to_fifo[i];
1079 1059
1080 set_bit(i, trans_pcie->queue_used); 1060 __iwl_trans_pcie_txq_enable(trans, i, fifo, IWL_INVALID_STATION,
1081 1061 IWL_TID_NON_QOS,
1082 iwl_trans_tx_queue_set_status(trans, &trans_pcie->txq[i], 1062 SCD_FRAME_LIMIT, 0);
1083 fifo, true);
1084 } 1063 }
1085 1064
1086 /* Activate all Tx DMA/FIFO channels */ 1065 /* Activate all Tx DMA/FIFO channels */
@@ -2040,7 +2019,7 @@ static const struct iwl_trans_ops trans_ops_pcie = {
2040 .reclaim = iwl_trans_pcie_reclaim, 2019 .reclaim = iwl_trans_pcie_reclaim,
2041 2020
2042 .txq_disable = iwl_trans_pcie_txq_disable, 2021 .txq_disable = iwl_trans_pcie_txq_disable,
2043 .tx_agg_setup = iwl_trans_pcie_tx_agg_setup, 2022 .txq_enable = iwl_trans_pcie_txq_enable,
2044 2023
2045 .dbgfs_register = iwl_trans_pcie_dbgfs_register, 2024 .dbgfs_register = iwl_trans_pcie_dbgfs_register,
2046 2025
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 98ddc802213e..35e82161ca43 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -442,29 +442,34 @@ void iwl_trans_tx_queue_set_status(struct iwl_trans *trans,
442 IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id); 442 IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id);
443} 443}
444 444
445void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int txq_id, int fifo, 445void __iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id,
446 int sta_id, int tid, int frame_limit, u16 ssn) 446 int fifo, int sta_id, int tid,
447 int frame_limit, u16 ssn)
447{ 448{
448 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 449 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
449 unsigned long flags; 450
450 u16 ra_tid = BUILD_RAxTID(sta_id, tid); 451 lockdep_assert_held(&trans_pcie->irq_lock);
451 452
452 if (test_and_set_bit(txq_id, trans_pcie->queue_used)) 453 if (test_and_set_bit(txq_id, trans_pcie->queue_used))
453 WARN_ONCE(1, "queue %d already used - expect issues", txq_id); 454 WARN_ONCE(1, "queue %d already used - expect issues", txq_id);
454 455
455 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
456
457 /* Stop this Tx queue before configuring it */ 456 /* Stop this Tx queue before configuring it */
458 iwlagn_tx_queue_stop_scheduler(trans, txq_id); 457 iwlagn_tx_queue_stop_scheduler(trans, txq_id);
459 458
460 /* Map receiver-address / traffic-ID to this queue */ 459 /* Set this queue as a chain-building queue unless it is CMD queue */
461 iwlagn_tx_queue_set_q2ratid(trans, ra_tid, txq_id); 460 if (txq_id != trans_pcie->cmd_queue)
461 iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id));
462
463 /* If this queue is mapped to a certain station: it is an AGG queue */
464 if (sta_id != IWL_INVALID_STATION) {
465 u16 ra_tid = BUILD_RAxTID(sta_id, tid);
462 466
463 /* Set this queue as a chain-building queue */ 467 /* Map receiver-address / traffic-ID to this queue */
464 iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id)); 468 iwlagn_tx_queue_set_q2ratid(trans, ra_tid, txq_id);
465 469
466 /* enable aggregations for the queue */ 470 /* enable aggregations for the queue */
467 iwl_set_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id)); 471 iwl_set_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id));
472 }
468 473
469 /* Place first TFD at index corresponding to start sequence number. 474 /* Place first TFD at index corresponding to start sequence number.
470 * Assumes that ssn_idx is valid (!= 0xFFF) */ 475 * Assumes that ssn_idx is valid (!= 0xFFF) */
@@ -474,6 +479,8 @@ void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int txq_id, int fifo,
474 479
475 /* Set up Tx window size and frame limit for this queue */ 480 /* Set up Tx window size and frame limit for this queue */
476 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr + 481 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
482 SCD_CONTEXT_QUEUE_OFFSET(txq_id), 0);
483 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
477 SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), 484 SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32),
478 ((frame_limit << SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) & 485 ((frame_limit << SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
479 SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) | 486 SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
@@ -483,6 +490,18 @@ void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int txq_id, int fifo,
483 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ 490 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */
484 iwl_trans_tx_queue_set_status(trans, &trans_pcie->txq[txq_id], 491 iwl_trans_tx_queue_set_status(trans, &trans_pcie->txq[txq_id],
485 fifo, true); 492 fifo, true);
493}
494
495void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
496 int sta_id, int tid, int frame_limit, u16 ssn)
497{
498 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
499 unsigned long flags;
500
501 spin_lock_irqsave(&trans_pcie->irq_lock, flags);
502
503 __iwl_trans_pcie_txq_enable(trans, txq_id, fifo, sta_id,
504 tid, frame_limit, ssn);
486 505
487 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); 506 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
488} 507}