aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-08-01 05:58:47 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-09-03 15:49:01 -0400
commitfea7795f1c976513a3262284c4001606075abf5c (patch)
treec3dfa1340ab3a8800a254c36c3371f4dcc755b01
parent680073b78a5ac2b559bb7315528aa9f95e57ae24 (diff)
iwlwifi: trans: refactor txq_enable arguments
Instead of having all arguments passed to the function, add a struct to hold them and only pass some directly. This will make future work in this area cleaner. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h21
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/internal.h4
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c13
3 files changed, 26 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 656371a668da..c198dde339c6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -401,6 +401,13 @@ struct iwl_trans_dump_data {
401 401
402struct iwl_trans; 402struct iwl_trans;
403 403
404struct iwl_trans_txq_scd_cfg {
405 u8 fifo;
406 s8 sta_id;
407 u8 tid;
408 int frame_limit;
409};
410
404/** 411/**
405 * struct iwl_trans_ops - transport specific operations 412 * struct iwl_trans_ops - transport specific operations
406 * 413 *
@@ -492,8 +499,8 @@ struct iwl_trans_ops {
492 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, 499 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
493 struct sk_buff_head *skbs); 500 struct sk_buff_head *skbs);
494 501
495 void (*txq_enable)(struct iwl_trans *trans, int queue, int fifo, 502 void (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
496 int sta_id, int tid, int frame_limit, u16 ssn); 503 const struct iwl_trans_txq_scd_cfg *cfg);
497 void (*txq_disable)(struct iwl_trans *trans, int queue); 504 void (*txq_disable)(struct iwl_trans *trans, int queue);
498 505
499 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); 506 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
@@ -775,13 +782,19 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
775 int fifo, int sta_id, int tid, 782 int fifo, int sta_id, int tid,
776 int frame_limit, u16 ssn) 783 int frame_limit, u16 ssn)
777{ 784{
785 struct iwl_trans_txq_scd_cfg cfg = {
786 .fifo = fifo,
787 .sta_id = sta_id,
788 .tid = tid,
789 .frame_limit = frame_limit,
790 };
791
778 might_sleep(); 792 might_sleep();
779 793
780 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) 794 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
781 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); 795 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
782 796
783 trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, 797 trans->ops->txq_enable(trans, queue, ssn, &cfg);
784 frame_limit, ssn);
785} 798}
786 799
787static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, 800static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index 78f72c34438a..5760405a9cad 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -364,8 +364,8 @@ int iwl_pcie_tx_init(struct iwl_trans *trans);
364void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr); 364void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr);
365int iwl_pcie_tx_stop(struct iwl_trans *trans); 365int iwl_pcie_tx_stop(struct iwl_trans *trans);
366void iwl_pcie_tx_free(struct iwl_trans *trans); 366void iwl_pcie_tx_free(struct iwl_trans *trans);
367void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, 367void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int queue, u16 ssn,
368 int sta_id, int tid, int frame_limit, u16 ssn); 368 const struct iwl_trans_txq_scd_cfg *cfg);
369void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue); 369void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue);
370int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, 370int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
371 struct iwl_device_cmd *dev_cmd, int txq_id); 371 struct iwl_device_cmd *dev_cmd, int txq_id);
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 84c3a0115c4d..5c95386c72bf 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1066,10 +1066,11 @@ static int iwl_pcie_txq_set_ratid_map(struct iwl_trans *trans, u16 ra_tid,
1066 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 1066 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
1067#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 1067#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
1068 1068
1069void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, 1069void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, u16 ssn,
1070 int sta_id, int tid, int frame_limit, u16 ssn) 1070 const struct iwl_trans_txq_scd_cfg *cfg)
1071{ 1071{
1072 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1072 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1073 u8 frame_limit = cfg->frame_limit;
1073 1074
1074 if (test_and_set_bit(txq_id, trans_pcie->queue_used)) 1075 if (test_and_set_bit(txq_id, trans_pcie->queue_used))
1075 WARN_ONCE(1, "queue %d already used - expect issues", txq_id); 1076 WARN_ONCE(1, "queue %d already used - expect issues", txq_id);
@@ -1082,8 +1083,8 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
1082 iwl_scd_txq_set_chain(trans, txq_id); 1083 iwl_scd_txq_set_chain(trans, txq_id);
1083 1084
1084 /* If this queue is mapped to a certain station: it is an AGG queue */ 1085 /* If this queue is mapped to a certain station: it is an AGG queue */
1085 if (sta_id >= 0) { 1086 if (cfg->sta_id >= 0) {
1086 u16 ra_tid = BUILD_RAxTID(sta_id, tid); 1087 u16 ra_tid = BUILD_RAxTID(cfg->sta_id, cfg->tid);
1087 1088
1088 /* Map receiver-address / traffic-ID to this queue */ 1089 /* Map receiver-address / traffic-ID to this queue */
1089 iwl_pcie_txq_set_ratid_map(trans, ra_tid, txq_id); 1090 iwl_pcie_txq_set_ratid_map(trans, ra_tid, txq_id);
@@ -1124,12 +1125,12 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
1124 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ 1125 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */
1125 iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id), 1126 iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id),
1126 (1 << SCD_QUEUE_STTS_REG_POS_ACTIVE) | 1127 (1 << SCD_QUEUE_STTS_REG_POS_ACTIVE) |
1127 (fifo << SCD_QUEUE_STTS_REG_POS_TXF) | 1128 (cfg->fifo << SCD_QUEUE_STTS_REG_POS_TXF) |
1128 (1 << SCD_QUEUE_STTS_REG_POS_WSL) | 1129 (1 << SCD_QUEUE_STTS_REG_POS_WSL) |
1129 SCD_QUEUE_STTS_REG_MSK); 1130 SCD_QUEUE_STTS_REG_MSK);
1130 trans_pcie->txq[txq_id].active = true; 1131 trans_pcie->txq[txq_id].active = true;
1131 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d on FIFO %d WrPtr: %d\n", 1132 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d on FIFO %d WrPtr: %d\n",
1132 txq_id, fifo, ssn & 0xff); 1133 txq_id, cfg->fifo, ssn & 0xff);
1133} 1134}
1134 1135
1135void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id) 1136void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id)