aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sv-open.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c35
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c24
10 files changed, 64 insertions, 58 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index bb6605b51956..8edb3f89b22d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -102,12 +102,12 @@ static int iwlagn_txq_agg_enable(struct iwl_priv *priv, int txq_id, int sta_id,
102{ 102{
103 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) || 103 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) ||
104 (IWLAGN_FIRST_AMPDU_QUEUE + 104 (IWLAGN_FIRST_AMPDU_QUEUE +
105 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { 105 hw_params(priv).num_ampdu_queues <= txq_id)) {
106 IWL_WARN(priv, 106 IWL_WARN(priv,
107 "queue number out of range: %d, must be %d to %d\n", 107 "queue number out of range: %d, must be %d to %d\n",
108 txq_id, IWLAGN_FIRST_AMPDU_QUEUE, 108 txq_id, IWLAGN_FIRST_AMPDU_QUEUE,
109 IWLAGN_FIRST_AMPDU_QUEUE + 109 IWLAGN_FIRST_AMPDU_QUEUE +
110 priv->cfg->base_params->num_of_ampdu_queues - 1); 110 hw_params(priv).num_ampdu_queues - 1);
111 return -EINVAL; 111 return -EINVAL;
112 } 112 }
113 113
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 1cf36783c1c3..65a6db5e9a2d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3207,6 +3207,13 @@ static int iwl_set_hw_params(struct iwl_priv *priv)
3207 if (iwlagn_mod_params.disable_11n) 3207 if (iwlagn_mod_params.disable_11n)
3208 priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE; 3208 priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
3209 3209
3210 hw_params(priv).num_ampdu_queues =
3211 priv->cfg->base_params->num_of_ampdu_queues;
3212 hw_params(priv).shadow_reg_enable =
3213 priv->cfg->base_params->shadow_reg_enable;
3214 hw_params(priv).sku =
3215 priv->cfg->sku;
3216
3210 /* Device-specific setup */ 3217 /* Device-specific setup */
3211 return priv->cfg->lib->set_hw_params(priv); 3218 return priv->cfg->lib->set_hw_params(priv);
3212} 3219}
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 6a6aba052782..413340498997 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1056,10 +1056,6 @@ struct iwl_testmode_trace {
1056}; 1056};
1057#endif 1057#endif
1058 1058
1059/* uCode ownership */
1060#define IWL_OWNERSHIP_DRIVER 0
1061#define IWL_OWNERSHIP_TM 1
1062
1063struct iwl_priv { 1059struct iwl_priv {
1064 1060
1065 /*data shared among all the driver's layers */ 1061 /*data shared among all the driver's layers */
@@ -1147,9 +1143,6 @@ struct iwl_priv {
1147 u32 ucode_ver; /* version of ucode, copy of 1143 u32 ucode_ver; /* version of ucode, copy of
1148 iwl_ucode.ver */ 1144 iwl_ucode.ver */
1149 1145
1150 /* uCode owner: default: IWL_OWNERSHIP_DRIVER */
1151 u8 ucode_owner;
1152
1153 struct fw_img ucode_rt; 1146 struct fw_img ucode_rt;
1154 struct fw_img ucode_init; 1147 struct fw_img ucode_init;
1155 struct fw_img ucode_wowlan; 1148 struct fw_img ucode_wowlan;
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 2c91a48b8010..62cd781192b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -215,7 +215,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
215 else 215 else
216 cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; 216 cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
217 217
218 if (priv->cfg->base_params->shadow_reg_enable) 218 if (hw_params(priv).shadow_reg_enable)
219 cmd->flags |= IWL_POWER_SHADOW_REG_ENA; 219 cmd->flags |= IWL_POWER_SHADOW_REG_ENA;
220 else 220 else
221 cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; 221 cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA;
@@ -301,7 +301,7 @@ static void iwl_power_fill_sleep_cmd(struct iwl_priv *priv,
301 if (priv->power_data.bus_pm) 301 if (priv->power_data.bus_pm)
302 cmd->flags |= IWL_POWER_PCI_PM_MSK; 302 cmd->flags |= IWL_POWER_PCI_PM_MSK;
303 303
304 if (priv->cfg->base_params->shadow_reg_enable) 304 if (hw_params(priv).shadow_reg_enable)
305 cmd->flags |= IWL_POWER_SHADOW_REG_ENA; 305 cmd->flags |= IWL_POWER_SHADOW_REG_ENA;
306 else 306 else
307 cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; 307 cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA;
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index bb61c13d4998..db606a6857c2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -133,36 +133,41 @@ struct iwl_mod_params {
133/** 133/**
134 * struct iwl_hw_params 134 * struct iwl_hw_params
135 * @max_txq_num: Max # Tx queues supported 135 * @max_txq_num: Max # Tx queues supported
136 * @num_ampdu_queues: num of ampdu queues
136 * @tx/rx_chains_num: Number of TX/RX chains 137 * @tx/rx_chains_num: Number of TX/RX chains
137 * @valid_tx/rx_ant: usable antennas 138 * @valid_tx/rx_ant: usable antennas
138 * @rx_page_order: Rx buffer page order
139 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
140 * @max_stations: 139 * @max_stations:
141 * @ht40_channel: is 40MHz width possible in band 2.4 140 * @ht40_channel: is 40MHz width possible in band 2.4
141 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
142 * @sku:
143 * @rx_page_order: Rx buffer page order
144 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
142 * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) 145 * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
143 * @sw_crypto: 0 for hw, 1 for sw 146 * @sw_crypto: 0 for hw, 1 for sw
144 * @max_xxx_size: for ucode uses 147 * @max_xxx_size: for ucode uses
145 * @ct_kill_threshold: temperature threshold 148 * @ct_kill_threshold: temperature threshold
146 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
147 * @calib_init_cfg: setup initial calibrations for the hw 149 * @calib_init_cfg: setup initial calibrations for the hw
148 * @calib_rt_cfg: setup runtime calibrations for the hw 150 * @calib_rt_cfg: setup runtime calibrations for the hw
149 * @struct iwl_sensitivity_ranges: range of sensitivity values 151 * @struct iwl_sensitivity_ranges: range of sensitivity values
150 */ 152 */
151struct iwl_hw_params { 153struct iwl_hw_params {
152 u8 max_txq_num; 154 u8 max_txq_num;
155 u8 num_ampdu_queues;
153 u8 tx_chains_num; 156 u8 tx_chains_num;
154 u8 rx_chains_num; 157 u8 rx_chains_num;
155 u8 valid_tx_ant; 158 u8 valid_tx_ant;
156 u8 valid_rx_ant; 159 u8 valid_rx_ant;
157 u32 rx_page_order;
158 u8 max_stations; 160 u8 max_stations;
159 u8 ht40_channel; 161 u8 ht40_channel;
162 bool shadow_reg_enable;
163 u16 beacon_time_tsf_bits;
164 u16 sku;
165 u32 rx_page_order;
160 u32 max_inst_size; 166 u32 max_inst_size;
161 u32 max_data_size; 167 u32 max_data_size;
162 u32 ct_kill_threshold; /* value in hw-dependent units */ 168 u32 ct_kill_threshold; /* value in hw-dependent units */
163 u32 ct_kill_exit_threshold; /* value in hw-dependent units */ 169 u32 ct_kill_exit_threshold; /* value in hw-dependent units */
164 /* for 1000, 6000 series and up */ 170 /* for 1000, 6000 series and up */
165 u16 beacon_time_tsf_bits;
166 u32 calib_init_cfg; 171 u32 calib_init_cfg;
167 u32 calib_rt_cfg; 172 u32 calib_rt_cfg;
168 const struct iwl_sensitivity_ranges *sens; 173 const struct iwl_sensitivity_ranges *sens;
@@ -201,6 +206,7 @@ struct iwl_tid_data {
201 * 206 *
202 * @dbg_level_dev: dbg level set per device. Prevails on 207 * @dbg_level_dev: dbg level set per device. Prevails on
203 * iwlagn_mod_params.debug_level if set (!= 0) 208 * iwlagn_mod_params.debug_level if set (!= 0)
209 * @ucode_owner: IWL_OWNERSHIP_*
204 * @cmd_queue: command queue number 210 * @cmd_queue: command queue number
205 * @status: STATUS_* 211 * @status: STATUS_*
206 * @bus: pointer to the bus layer data 212 * @bus: pointer to the bus layer data
@@ -217,6 +223,9 @@ struct iwl_shared {
217 u32 dbg_level_dev; 223 u32 dbg_level_dev;
218#endif /* CONFIG_IWLWIFI_DEBUG */ 224#endif /* CONFIG_IWLWIFI_DEBUG */
219 225
226#define IWL_OWNERSHIP_DRIVER 0
227#define IWL_OWNERSHIP_TM 1
228 u8 ucode_owner;
220 u8 cmd_queue; 229 u8 cmd_queue;
221 unsigned long status; 230 unsigned long status;
222 bool wowlan; 231 bool wowlan;
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index b53d77b131d5..848fc18befc2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -612,7 +612,7 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
612 612
613 owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]); 613 owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]);
614 if ((owner == IWL_OWNERSHIP_DRIVER) || (owner == IWL_OWNERSHIP_TM)) 614 if ((owner == IWL_OWNERSHIP_DRIVER) || (owner == IWL_OWNERSHIP_TM))
615 priv->ucode_owner = owner; 615 priv->shrd->ucode_owner = owner;
616 else { 616 else {
617 IWL_DEBUG_INFO(priv, "Invalid owner\n"); 617 IWL_DEBUG_INFO(priv, "Invalid owner\n");
618 return -EINVAL; 618 return -EINVAL;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index bd6e64026a06..269d9e3188b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -162,7 +162,8 @@ irqreturn_t iwl_isr_ict(int irq, void *data);
162/***************************************************** 162/*****************************************************
163* TX / HCMD 163* TX / HCMD
164******************************************************/ 164******************************************************/
165void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); 165void iwl_txq_update_write_ptr(struct iwl_trans *trans,
166 struct iwl_tx_queue *txq);
166int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans, 167int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans,
167 struct iwl_tx_queue *txq, 168 struct iwl_tx_queue *txq,
168 dma_addr_t addr, u16 len, u8 reset); 169 dma_addr_t addr, u16 len, u8 reset);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index 5cff771af92f..a0699c0ef4f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -130,7 +130,6 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
130void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans, 130void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,
131 struct iwl_rx_queue *q) 131 struct iwl_rx_queue *q)
132{ 132{
133 struct iwl_priv *priv = priv(trans);
134 unsigned long flags; 133 unsigned long flags;
135 u32 reg; 134 u32 reg;
136 135
@@ -139,34 +138,34 @@ void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,
139 if (q->need_update == 0) 138 if (q->need_update == 0)
140 goto exit_unlock; 139 goto exit_unlock;
141 140
142 if (priv->cfg->base_params->shadow_reg_enable) { 141 if (hw_params(trans).shadow_reg_enable) {
143 /* shadow register enabled */ 142 /* shadow register enabled */
144 /* Device expects a multiple of 8 */ 143 /* Device expects a multiple of 8 */
145 q->write_actual = (q->write & ~0x7); 144 q->write_actual = (q->write & ~0x7);
146 iwl_write32(bus(priv), FH_RSCSR_CHNL0_WPTR, q->write_actual); 145 iwl_write32(bus(trans), FH_RSCSR_CHNL0_WPTR, q->write_actual);
147 } else { 146 } else {
148 /* If power-saving is in use, make sure device is awake */ 147 /* If power-saving is in use, make sure device is awake */
149 if (test_bit(STATUS_POWER_PMI, &trans->shrd->status)) { 148 if (test_bit(STATUS_POWER_PMI, &trans->shrd->status)) {
150 reg = iwl_read32(bus(priv), CSR_UCODE_DRV_GP1); 149 reg = iwl_read32(bus(trans), CSR_UCODE_DRV_GP1);
151 150
152 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 151 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
153 IWL_DEBUG_INFO(trans, 152 IWL_DEBUG_INFO(trans,
154 "Rx queue requesting wakeup," 153 "Rx queue requesting wakeup,"
155 " GP1 = 0x%x\n", reg); 154 " GP1 = 0x%x\n", reg);
156 iwl_set_bit(bus(priv), CSR_GP_CNTRL, 155 iwl_set_bit(bus(trans), CSR_GP_CNTRL,
157 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 156 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
158 goto exit_unlock; 157 goto exit_unlock;
159 } 158 }
160 159
161 q->write_actual = (q->write & ~0x7); 160 q->write_actual = (q->write & ~0x7);
162 iwl_write_direct32(bus(priv), FH_RSCSR_CHNL0_WPTR, 161 iwl_write_direct32(bus(trans), FH_RSCSR_CHNL0_WPTR,
163 q->write_actual); 162 q->write_actual);
164 163
165 /* Else device is assumed to be awake */ 164 /* Else device is assumed to be awake */
166 } else { 165 } else {
167 /* Device expects a multiple of 8 */ 166 /* Device expects a multiple of 8 */
168 q->write_actual = (q->write & ~0x7); 167 q->write_actual = (q->write & ~0x7);
169 iwl_write_direct32(bus(priv), FH_RSCSR_CHNL0_WPTR, 168 iwl_write_direct32(bus(trans), FH_RSCSR_CHNL0_WPTR,
170 q->write_actual); 169 q->write_actual);
171 } 170 }
172 } 171 }
@@ -1032,7 +1031,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
1032 IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); 1031 IWL_DEBUG_ISR(trans, "Wakeup interrupt\n");
1033 iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq); 1032 iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq);
1034 for (i = 0; i < hw_params(trans).max_txq_num; i++) 1033 for (i = 0; i < hw_params(trans).max_txq_num; i++)
1035 iwl_txq_update_write_ptr(priv(trans), 1034 iwl_txq_update_write_ptr(trans,
1036 &priv(trans)->txq[i]); 1035 &priv(trans)->txq[i]);
1037 1036
1038 isr_stats->wakeup++; 1037 isr_stats->wakeup++;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index 9f4ffebfa56d..8c18a7545afd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -86,7 +86,7 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
86/** 86/**
87 * iwl_txq_update_write_ptr - Send new write index to hardware 87 * iwl_txq_update_write_ptr - Send new write index to hardware
88 */ 88 */
89void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) 89void iwl_txq_update_write_ptr(struct iwl_trans *trans, struct iwl_tx_queue *txq)
90{ 90{
91 u32 reg = 0; 91 u32 reg = 0;
92 int txq_id = txq->q.id; 92 int txq_id = txq->q.id;
@@ -94,28 +94,28 @@ void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
94 if (txq->need_update == 0) 94 if (txq->need_update == 0)
95 return; 95 return;
96 96
97 if (priv->cfg->base_params->shadow_reg_enable) { 97 if (hw_params(trans).shadow_reg_enable) {
98 /* shadow register enabled */ 98 /* shadow register enabled */
99 iwl_write32(bus(priv), HBUS_TARG_WRPTR, 99 iwl_write32(bus(trans), HBUS_TARG_WRPTR,
100 txq->q.write_ptr | (txq_id << 8)); 100 txq->q.write_ptr | (txq_id << 8));
101 } else { 101 } else {
102 /* if we're trying to save power */ 102 /* if we're trying to save power */
103 if (test_bit(STATUS_POWER_PMI, &priv->shrd->status)) { 103 if (test_bit(STATUS_POWER_PMI, &trans->shrd->status)) {
104 /* wake up nic if it's powered down ... 104 /* wake up nic if it's powered down ...
105 * uCode will wake up, and interrupt us again, so next 105 * uCode will wake up, and interrupt us again, so next
106 * time we'll skip this part. */ 106 * time we'll skip this part. */
107 reg = iwl_read32(bus(priv), CSR_UCODE_DRV_GP1); 107 reg = iwl_read32(bus(trans), CSR_UCODE_DRV_GP1);
108 108
109 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 109 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
110 IWL_DEBUG_INFO(priv, 110 IWL_DEBUG_INFO(trans,
111 "Tx queue %d requesting wakeup," 111 "Tx queue %d requesting wakeup,"
112 " GP1 = 0x%x\n", txq_id, reg); 112 " GP1 = 0x%x\n", txq_id, reg);
113 iwl_set_bit(bus(priv), CSR_GP_CNTRL, 113 iwl_set_bit(bus(trans), CSR_GP_CNTRL,
114 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 114 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
115 return; 115 return;
116 } 116 }
117 117
118 iwl_write_direct32(bus(priv), HBUS_TARG_WRPTR, 118 iwl_write_direct32(bus(trans), HBUS_TARG_WRPTR,
119 txq->q.write_ptr | (txq_id << 8)); 119 txq->q.write_ptr | (txq_id << 8));
120 120
121 /* 121 /*
@@ -124,7 +124,7 @@ void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
124 * trying to tx (during RFKILL, we're not trying to tx). 124 * trying to tx (during RFKILL, we're not trying to tx).
125 */ 125 */
126 } else 126 } else
127 iwl_write32(bus(priv), HBUS_TARG_WRPTR, 127 iwl_write32(bus(trans), HBUS_TARG_WRPTR,
128 txq->q.write_ptr | (txq_id << 8)); 128 txq->q.write_ptr | (txq_id << 8));
129 } 129 }
130 txq->need_update = 0; 130 txq->need_update = 0;
@@ -498,12 +498,12 @@ int iwl_trans_pcie_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
498 struct iwl_trans *trans = trans(priv); 498 struct iwl_trans *trans = trans(priv);
499 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) || 499 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) ||
500 (IWLAGN_FIRST_AMPDU_QUEUE + 500 (IWLAGN_FIRST_AMPDU_QUEUE +
501 priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { 501 hw_params(priv).num_ampdu_queues <= txq_id)) {
502 IWL_ERR(priv, 502 IWL_ERR(priv,
503 "queue number out of range: %d, must be %d to %d\n", 503 "queue number out of range: %d, must be %d to %d\n",
504 txq_id, IWLAGN_FIRST_AMPDU_QUEUE, 504 txq_id, IWLAGN_FIRST_AMPDU_QUEUE,
505 IWLAGN_FIRST_AMPDU_QUEUE + 505 IWLAGN_FIRST_AMPDU_QUEUE +
506 priv->cfg->base_params->num_of_ampdu_queues - 1); 506 hw_params(priv).num_ampdu_queues - 1);
507 return -EINVAL; 507 return -EINVAL;
508 } 508 }
509 509
@@ -536,8 +536,7 @@ int iwl_trans_pcie_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
536 */ 536 */
537static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) 537static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
538{ 538{
539 struct iwl_priv *priv = priv(trans); 539 struct iwl_tx_queue *txq = &priv(trans)->txq[trans->shrd->cmd_queue];
540 struct iwl_tx_queue *txq = &priv->txq[priv->shrd->cmd_queue];
541 struct iwl_queue *q = &txq->q; 540 struct iwl_queue *q = &txq->q;
542 struct iwl_device_cmd *out_cmd; 541 struct iwl_device_cmd *out_cmd;
543 struct iwl_cmd_meta *out_meta; 542 struct iwl_cmd_meta *out_meta;
@@ -560,7 +559,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
560 return -EIO; 559 return -EIO;
561 } 560 }
562 561
563 if ((priv->ucode_owner == IWL_OWNERSHIP_TM) && 562 if ((trans->shrd->ucode_owner == IWL_OWNERSHIP_TM) &&
564 !(cmd->flags & CMD_ON_DEMAND)) { 563 !(cmd->flags & CMD_ON_DEMAND)) {
565 IWL_DEBUG_HC(trans, "tm own the uCode, no regular hcmd send\n"); 564 IWL_DEBUG_HC(trans, "tm own the uCode, no regular hcmd send\n");
566 return -EIO; 565 return -EIO;
@@ -607,10 +606,10 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
607 spin_unlock_irqrestore(&trans->hcmd_lock, flags); 606 spin_unlock_irqrestore(&trans->hcmd_lock, flags);
608 607
609 IWL_ERR(trans, "No space in command queue\n"); 608 IWL_ERR(trans, "No space in command queue\n");
610 is_ct_kill = iwl_check_for_ct_kill(priv); 609 is_ct_kill = iwl_check_for_ct_kill(priv(trans));
611 if (!is_ct_kill) { 610 if (!is_ct_kill) {
612 IWL_ERR(trans, "Restarting adapter queue is full\n"); 611 IWL_ERR(trans, "Restarting adapter queue is full\n");
613 iwlagn_fw_error(priv, false); 612 iwlagn_fw_error(priv(trans), false);
614 } 613 }
615 return -ENOSPC; 614 return -ENOSPC;
616 } 615 }
@@ -702,7 +701,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
702 /* check that tracing gets all possible blocks */ 701 /* check that tracing gets all possible blocks */
703 BUILD_BUG_ON(IWL_MAX_CMD_TFDS + 1 != 3); 702 BUILD_BUG_ON(IWL_MAX_CMD_TFDS + 1 != 3);
704#ifdef CONFIG_IWLWIFI_DEVICE_TRACING 703#ifdef CONFIG_IWLWIFI_DEVICE_TRACING
705 trace_iwlwifi_dev_hcmd(priv, cmd->flags, 704 trace_iwlwifi_dev_hcmd(priv(trans), cmd->flags,
706 trace_bufs[0], trace_lens[0], 705 trace_bufs[0], trace_lens[0],
707 trace_bufs[1], trace_lens[1], 706 trace_bufs[1], trace_lens[1],
708 trace_bufs[2], trace_lens[2]); 707 trace_bufs[2], trace_lens[2]);
@@ -710,7 +709,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
710 709
711 /* Increment and update queue's write index */ 710 /* Increment and update queue's write index */
712 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 711 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
713 iwl_txq_update_write_ptr(priv, txq); 712 iwl_txq_update_write_ptr(trans, txq);
714 713
715 out: 714 out:
716 spin_unlock_irqrestore(&trans->hcmd_lock, flags); 715 spin_unlock_irqrestore(&trans->hcmd_lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index a18ed425c24c..ac401b805c69 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -138,13 +138,12 @@ static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans)
138 } 138 }
139} 139}
140 140
141static void iwl_trans_rx_hw_init(struct iwl_priv *priv, 141static void iwl_trans_rx_hw_init(struct iwl_trans *trans,
142 struct iwl_rx_queue *rxq) 142 struct iwl_rx_queue *rxq)
143{ 143{
144 u32 rb_size; 144 u32 rb_size;
145 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ 145 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */
146 u32 rb_timeout = 0; /* FIXME: RX_RB_TIMEOUT for all devices? */ 146 u32 rb_timeout = 0; /* FIXME: RX_RB_TIMEOUT for all devices? */
147 struct iwl_trans *trans = trans(priv);
148 147
149 rb_timeout = RX_RB_TIMEOUT; 148 rb_timeout = RX_RB_TIMEOUT;
150 149
@@ -221,7 +220,7 @@ static int iwl_rx_init(struct iwl_trans *trans)
221 220
222 iwlagn_rx_replenish(trans); 221 iwlagn_rx_replenish(trans);
223 222
224 iwl_trans_rx_hw_init(priv(trans), rxq); 223 iwl_trans_rx_hw_init(trans, rxq);
225 224
226 spin_lock_irqsave(&trans->shrd->lock, flags); 225 spin_lock_irqsave(&trans->shrd->lock, flags);
227 rxq->need_update = 1; 226 rxq->need_update = 1;
@@ -509,7 +508,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
509 struct iwl_trans_pcie *trans_pcie = 508 struct iwl_trans_pcie *trans_pcie =
510 IWL_TRANS_GET_PCIE_TRANS(trans); 509 IWL_TRANS_GET_PCIE_TRANS(trans);
511 510
512 u16 scd_bc_tbls_size = priv->cfg->base_params->num_of_queues * 511 u16 scd_bc_tbls_size = hw_params(trans).max_txq_num *
513 sizeof(struct iwlagn_scd_bc_tbl); 512 sizeof(struct iwlagn_scd_bc_tbl);
514 513
515 /*It is not allowed to alloc twice, so warn when this happens. 514 /*It is not allowed to alloc twice, so warn when this happens.
@@ -534,7 +533,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
534 } 533 }
535 534
536 priv->txq = kzalloc(sizeof(struct iwl_tx_queue) * 535 priv->txq = kzalloc(sizeof(struct iwl_tx_queue) *
537 priv->cfg->base_params->num_of_queues, GFP_KERNEL); 536 hw_params(trans).max_txq_num, GFP_KERNEL);
538 if (!priv->txq) { 537 if (!priv->txq) {
539 IWL_ERR(trans, "Not enough memory for txq\n"); 538 IWL_ERR(trans, "Not enough memory for txq\n");
540 ret = ENOMEM; 539 ret = ENOMEM;
@@ -652,7 +651,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
652 if (iwl_tx_init(trans)) 651 if (iwl_tx_init(trans))
653 return -ENOMEM; 652 return -ENOMEM;
654 653
655 if (priv->cfg->base_params->shadow_reg_enable) { 654 if (hw_params(trans).shadow_reg_enable) {
656 /* enable shadow regs in HW */ 655 /* enable shadow regs in HW */
657 iwl_set_bit(bus(trans), CSR_MAC_SHADOW_REG_CTRL, 656 iwl_set_bit(bus(trans), CSR_MAC_SHADOW_REG_CTRL,
658 0x800FFFFF); 657 0x800FFFFF);
@@ -717,9 +716,9 @@ static int iwl_trans_pcie_start_device(struct iwl_trans *trans)
717 int ret; 716 int ret;
718 struct iwl_priv *priv = priv(trans); 717 struct iwl_priv *priv = priv(trans);
719 718
720 priv->ucode_owner = IWL_OWNERSHIP_DRIVER; 719 priv->shrd->ucode_owner = IWL_OWNERSHIP_DRIVER;
721 720
722 if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) && 721 if ((hw_params(priv).sku & EEPROM_SKU_CAP_AMT_ENABLE) &&
723 iwl_trans_pcie_prepare_card_hw(trans)) { 722 iwl_trans_pcie_prepare_card_hw(trans)) {
724 IWL_WARN(trans, "Exit HW not ready\n"); 723 IWL_WARN(trans, "Exit HW not ready\n");
725 return -EIO; 724 return -EIO;
@@ -1131,7 +1130,7 @@ static int iwl_trans_pcie_tx(struct iwl_priv *priv, struct sk_buff *skb,
1131 1130
1132 /* Tell device the write index *just past* this latest filled TFD */ 1131 /* Tell device the write index *just past* this latest filled TFD */
1133 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1132 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
1134 iwl_txq_update_write_ptr(priv, txq); 1133 iwl_txq_update_write_ptr(trans(priv), txq);
1135 1134
1136 /* 1135 /*
1137 * At this point the frame is "transmitted" successfully 1136 * At this point the frame is "transmitted" successfully
@@ -1142,7 +1141,7 @@ static int iwl_trans_pcie_tx(struct iwl_priv *priv, struct sk_buff *skb,
1142 if (iwl_queue_space(q) < q->high_mark) { 1141 if (iwl_queue_space(q) < q->high_mark) {
1143 if (wait_write_ptr) { 1142 if (wait_write_ptr) {
1144 txq->need_update = 1; 1143 txq->need_update = 1;
1145 iwl_txq_update_write_ptr(priv, txq); 1144 iwl_txq_update_write_ptr(trans(priv), txq);
1146 } else { 1145 } else {
1147 iwl_stop_queue(priv, txq); 1146 iwl_stop_queue(priv, txq);
1148 } 1147 }
@@ -1366,7 +1365,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
1366 struct iwl_rx_queue *rxq = &trans_pcie->rxq; 1365 struct iwl_rx_queue *rxq = &trans_pcie->rxq;
1367 char *buf; 1366 char *buf;
1368 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + 1367 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
1369 (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; 1368 (hw_params(trans).max_txq_num * 32 * 8) + 400;
1370 const u8 *ptr; 1369 const u8 *ptr;
1371 ssize_t ret; 1370 ssize_t ret;
1372 1371
@@ -1468,8 +1467,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1468 int pos = 0; 1467 int pos = 0;
1469 int cnt; 1468 int cnt;
1470 int ret; 1469 int ret;
1471 const size_t bufsz = sizeof(char) * 64 * 1470 const size_t bufsz = sizeof(char) * 64 * hw_params(trans).max_txq_num;
1472 priv->cfg->base_params->num_of_queues;
1473 1471
1474 if (!priv->txq) { 1472 if (!priv->txq) {
1475 IWL_ERR(priv, "txq not ready\n"); 1473 IWL_ERR(priv, "txq not ready\n");