aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:10:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:25:32 -0400
commite6bb4c9c00892c488f3218ea317dc6a71674faf4 (patch)
tree3afe043aee2c5e73978259393b8242baf2acd886 /drivers/net/wireless/iwlwifi
parentf39c95e8d7a152b409977687a999356f0e54bde6 (diff)
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what transport to use. So now, the bus layer gives the upper layer a pointer to the iwl_trans_ops struct that it wants to use. The upper layer then, allocates the desired transport layer using iwl_trans_ops->alloc function. As a result of this, priv->trans, no longer exists, priv holds a pointer to iwl_shared, which holds a pointer to iwl_trans. This required to change all the calls to the transport layer from upper layer. While we were at it, trans_X inlines have been renamed to iwl_trans_X to avoid confusions, which of course required to rename the functions inside the transport layer because of conflicts in names. So the static API functions inside the transport layer implementation have been renamed to iwl_trans_pcie_X. Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is confusing since the registration doesn't mean to request IRQ, so I added a handler for that. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c51
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-bus.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sv-open.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c125
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h83
24 files changed, 226 insertions, 170 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index feefb5b0987c..6048b3b8cd6a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -315,7 +315,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
315 return -EFAULT; 315 return -EFAULT;
316 } 316 }
317 317
318 return trans_send_cmd(&priv->trans, &hcmd); 318 return iwl_trans_send_cmd(trans(priv), &hcmd);
319} 319}
320 320
321static struct iwl_lib_ops iwl5000_lib = { 321static struct iwl_lib_ops iwl5000_lib = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index e7be968b1784..9487d9b550ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -256,7 +256,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
256 return -EFAULT; 256 return -EFAULT;
257 } 257 }
258 258
259 return trans_send_cmd(&priv->trans, &hcmd); 259 return iwl_trans_send_cmd(trans(priv), &hcmd);
260} 260}
261 261
262static struct iwl_lib_ops iwl6000_lib = { 262static struct iwl_lib_ops iwl6000_lib = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index fb6da14bef4e..b725f6970dee 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -98,7 +98,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
98 hcmd.len[0] = priv->calib_results[i].buf_len; 98 hcmd.len[0] = priv->calib_results[i].buf_len;
99 hcmd.data[0] = priv->calib_results[i].buf; 99 hcmd.data[0] = priv->calib_results[i].buf;
100 hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 100 hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
101 ret = trans_send_cmd(&priv->trans, &hcmd); 101 ret = iwl_trans_send_cmd(trans(priv), &hcmd);
102 if (ret) { 102 if (ret) {
103 IWL_ERR(priv, "Error %d iteration %d\n", 103 IWL_ERR(priv, "Error %d iteration %d\n",
104 ret, i); 104 ret, i);
@@ -484,7 +484,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
484 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), 484 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
485 sizeof(u16)*HD_TABLE_SIZE); 485 sizeof(u16)*HD_TABLE_SIZE);
486 486
487 return trans_send_cmd(&priv->trans, &cmd_out); 487 return iwl_trans_send_cmd(trans(priv), &cmd_out);
488} 488}
489 489
490/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ 490/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
@@ -573,7 +573,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
573 &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]), 573 &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
574 sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES); 574 sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);
575 575
576 return trans_send_cmd(&priv->trans, &cmd_out); 576 return iwl_trans_send_cmd(trans(priv), &cmd_out);
577} 577}
578 578
579void iwl_init_sensitivity(struct iwl_priv *priv) 579void iwl_init_sensitivity(struct iwl_priv *priv)
@@ -918,7 +918,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
918 priv->phy_calib_chain_noise_gain_cmd); 918 priv->phy_calib_chain_noise_gain_cmd);
919 cmd.delta_gain_1 = data->delta_gain_code[1]; 919 cmd.delta_gain_1 = data->delta_gain_code[1];
920 cmd.delta_gain_2 = data->delta_gain_code[2]; 920 cmd.delta_gain_2 = data->delta_gain_code[2];
921 trans_send_cmd_pdu(&priv->trans, REPLY_PHY_CALIBRATION_CMD, 921 iwl_trans_send_cmd_pdu(trans(priv), REPLY_PHY_CALIBRATION_CMD,
922 CMD_ASYNC, sizeof(cmd), &cmd); 922 CMD_ASYNC, sizeof(cmd), &cmd);
923 923
924 data->radio_write = 1; 924 data->radio_write = 1;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index bf2ba98e767a..82fb55bc0b28 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -526,7 +526,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
526 else 526 else
527 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; 527 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
528 528
529 return trans_send_cmd_pdu(&priv->trans, tx_ant_cfg_cmd, CMD_SYNC, 529 return iwl_trans_send_cmd_pdu(trans(priv), tx_ant_cfg_cmd, CMD_SYNC,
530 sizeof(tx_power_cmd), &tx_power_cmd); 530 sizeof(tx_power_cmd), &tx_power_cmd);
531} 531}
532 532
@@ -1054,7 +1054,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
1054 if (ret) 1054 if (ret)
1055 return ret; 1055 return ret;
1056 1056
1057 ret = trans_send_cmd(&priv->trans, &cmd); 1057 ret = iwl_trans_send_cmd(trans(priv), &cmd);
1058 if (ret) { 1058 if (ret) {
1059 clear_bit(STATUS_SCAN_HW, &priv->shrd->status); 1059 clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
1060 iwlagn_set_pan_params(priv); 1060 iwlagn_set_pan_params(priv);
@@ -1160,7 +1160,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
1160 flush_cmd.fifo_control); 1160 flush_cmd.fifo_control);
1161 flush_cmd.flush_control = cpu_to_le16(flush_control); 1161 flush_cmd.flush_control = cpu_to_le16(flush_control);
1162 1162
1163 return trans_send_cmd(&priv->trans, &cmd); 1163 return iwl_trans_send_cmd(trans(priv), &cmd);
1164} 1164}
1165 1165
1166void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) 1166void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
@@ -1354,12 +1354,12 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
1354 if (priv->cfg->bt_params->bt_session_2) { 1354 if (priv->cfg->bt_params->bt_session_2) {
1355 memcpy(&bt_cmd_2000.basic, &basic, 1355 memcpy(&bt_cmd_2000.basic, &basic,
1356 sizeof(basic)); 1356 sizeof(basic));
1357 ret = trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG, 1357 ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
1358 CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000); 1358 CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
1359 } else { 1359 } else {
1360 memcpy(&bt_cmd_6000.basic, &basic, 1360 memcpy(&bt_cmd_6000.basic, &basic,
1361 sizeof(basic)); 1361 sizeof(basic));
1362 ret = trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG, 1362 ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
1363 CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000); 1363 CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
1364 } 1364 }
1365 if (ret) 1365 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index f0292fe9b4e6..991977e2e1b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -41,7 +41,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv,
41 int ret; 41 int ret;
42 42
43 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 43 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
44 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, 44 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd,
45 CMD_SYNC, sizeof(*send), send); 45 CMD_SYNC, sizeof(*send), send);
46 46
47 send->filter_flags = old_filter; 47 send->filter_flags = old_filter;
@@ -67,7 +67,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
67 67
68 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 68 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
69 send->dev_type = RXON_DEV_TYPE_P2P; 69 send->dev_type = RXON_DEV_TYPE_P2P;
70 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, 70 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd,
71 CMD_SYNC, sizeof(*send), send); 71 CMD_SYNC, sizeof(*send), send);
72 72
73 send->filter_flags = old_filter; 73 send->filter_flags = old_filter;
@@ -93,7 +93,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv,
93 int ret; 93 int ret;
94 94
95 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 95 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
96 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC, 96 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd, CMD_SYNC,
97 sizeof(*send), send); 97 sizeof(*send), send);
98 98
99 send->filter_flags = old_filter; 99 send->filter_flags = old_filter;
@@ -122,7 +122,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
122 ctx->qos_data.qos_active, 122 ctx->qos_data.qos_active,
123 ctx->qos_data.def_qos_parm.qos_flags); 123 ctx->qos_data.def_qos_parm.qos_flags);
124 124
125 ret = trans_send_cmd_pdu(&priv->trans, ctx->qos_cmd, CMD_SYNC, 125 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->qos_cmd, CMD_SYNC,
126 sizeof(struct iwl_qosparam_cmd), 126 sizeof(struct iwl_qosparam_cmd),
127 &ctx->qos_data.def_qos_parm); 127 &ctx->qos_data.def_qos_parm);
128 if (ret) 128 if (ret)
@@ -181,7 +181,7 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
181 ctx->staging.ofdm_ht_triple_stream_basic_rates; 181 ctx->staging.ofdm_ht_triple_stream_basic_rates;
182 rxon_assoc.acquisition_data = ctx->staging.acquisition_data; 182 rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
183 183
184 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_assoc_cmd, 184 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_assoc_cmd,
185 CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc); 185 CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc);
186 return ret; 186 return ret;
187} 187}
@@ -267,7 +267,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
267 * Associated RXON doesn't clear the station table in uCode, 267 * Associated RXON doesn't clear the station table in uCode,
268 * so we don't need to restore stations etc. after this. 268 * so we don't need to restore stations etc. after this.
269 */ 269 */
270 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC, 270 ret = iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_cmd, CMD_SYNC,
271 sizeof(struct iwl_rxon_cmd), &ctx->staging); 271 sizeof(struct iwl_rxon_cmd), &ctx->staging);
272 if (ret) { 272 if (ret) {
273 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); 273 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
@@ -388,7 +388,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
388 cmd.slots[0].width = cpu_to_le16(slot0); 388 cmd.slots[0].width = cpu_to_le16(slot0);
389 cmd.slots[1].width = cpu_to_le16(slot1); 389 cmd.slots[1].width = cpu_to_le16(slot1);
390 390
391 ret = trans_send_cmd_pdu(&priv->trans, REPLY_WIPAN_PARAMS, CMD_SYNC, 391 ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WIPAN_PARAMS, CMD_SYNC,
392 sizeof(cmd), &cmd); 392 sizeof(cmd), &cmd);
393 if (ret) 393 if (ret)
394 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); 394 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
@@ -771,7 +771,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
771 memset(&cmd, 0, sizeof(cmd)); 771 memset(&cmd, 0, sizeof(cmd));
772 iwl_set_calib_hdr(&cmd.hdr, 772 iwl_set_calib_hdr(&cmd.hdr,
773 priv->phy_calib_chain_noise_reset_cmd); 773 priv->phy_calib_chain_noise_reset_cmd);
774 ret = trans_send_cmd_pdu(&priv->trans, 774 ret = iwl_trans_send_cmd_pdu(trans(priv),
775 REPLY_PHY_CALIBRATION_CMD, 775 REPLY_PHY_CALIBRATION_CMD,
776 CMD_SYNC, sizeof(cmd), &cmd); 776 CMD_SYNC, sizeof(cmd), &cmd);
777 if (ret) 777 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 4b13bb9df999..4d02c328c377 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -189,7 +189,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
189 cmd.len[0] = cmd_size; 189 cmd.len[0] = cmd_size;
190 190
191 if (not_empty || send_if_empty) 191 if (not_empty || send_if_empty)
192 return trans_send_cmd(&priv->trans, &cmd); 192 return iwl_trans_send_cmd(trans(priv), &cmd);
193 else 193 else
194 return 0; 194 return 0;
195} 195}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index d0d77106da9a..0e9deb7b64d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -429,7 +429,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
429 } 429 }
430 } 430 }
431 431
432 tx_cmd = trans_get_tx_cmd(&priv->trans, txq_id); 432 tx_cmd = iwl_trans_get_tx_cmd(trans(priv), txq_id);
433 if (unlikely(!tx_cmd)) 433 if (unlikely(!tx_cmd))
434 goto drop_unlock_sta; 434 goto drop_unlock_sta;
435 435
@@ -451,7 +451,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
451 451
452 iwl_update_stats(priv, true, fc, len); 452 iwl_update_stats(priv, true, fc, len);
453 453
454 if (trans_tx(&priv->trans, skb, tx_cmd, txq_id, fc, is_agg, ctx)) 454 if (iwl_trans_tx(trans(priv), skb, tx_cmd, txq_id, fc, is_agg, ctx))
455 goto drop_unlock_sta; 455 goto drop_unlock_sta;
456 456
457 if (ieee80211_is_data_qos(fc)) { 457 if (ieee80211_is_data_qos(fc)) {
@@ -629,7 +629,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
629 * to deactivate the uCode queue, just return "success" to allow 629 * to deactivate the uCode queue, just return "success" to allow
630 * mac80211 to clean up it own data. 630 * mac80211 to clean up it own data.
631 */ 631 */
632 trans_txq_agg_disable(&priv->trans, txq_id, ssn, tx_fifo_id); 632 iwl_trans_txq_agg_disable(trans(priv), txq_id, ssn, tx_fifo_id);
633 spin_unlock_irqrestore(&priv->shrd->lock, flags); 633 spin_unlock_irqrestore(&priv->shrd->lock, flags);
634 634
635 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 635 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
@@ -658,7 +658,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
658 u16 ssn = SEQ_TO_SN(tid_data->seq_number); 658 u16 ssn = SEQ_TO_SN(tid_data->seq_number);
659 int tx_fifo = get_fifo_from_tid(ctx, tid); 659 int tx_fifo = get_fifo_from_tid(ctx, tid);
660 IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n"); 660 IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n");
661 trans_txq_agg_disable(&priv->trans, txq_id, 661 iwl_trans_txq_agg_disable(trans(priv), txq_id,
662 ssn, tx_fifo); 662 ssn, tx_fifo);
663 tid_data->agg.state = IWL_AGG_OFF; 663 tid_data->agg.state = IWL_AGG_OFF;
664 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 664 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 3717a88cf45e..a094b66541b1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -193,7 +193,7 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv)
193 calib_cfg_cmd.ucd_calib_cfg.flags = 193 calib_cfg_cmd.ucd_calib_cfg.flags =
194 IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK; 194 IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK;
195 195
196 return trans_send_cmd(&priv->trans, &cmd); 196 return iwl_trans_send_cmd(trans(priv), &cmd);
197} 197}
198 198
199void iwlagn_rx_calib_result(struct iwl_priv *priv, 199void iwlagn_rx_calib_result(struct iwl_priv *priv,
@@ -291,7 +291,7 @@ static int iwlagn_send_wimax_coex(struct iwl_priv *priv)
291 /* coexistence is disabled */ 291 /* coexistence is disabled */
292 memset(&coex_cmd, 0, sizeof(coex_cmd)); 292 memset(&coex_cmd, 0, sizeof(coex_cmd));
293 } 293 }
294 return trans_send_cmd_pdu(&priv->trans, 294 return iwl_trans_send_cmd_pdu(trans(priv),
295 COEX_PRIORITY_TABLE_CMD, CMD_SYNC, 295 COEX_PRIORITY_TABLE_CMD, CMD_SYNC,
296 sizeof(coex_cmd), &coex_cmd); 296 sizeof(coex_cmd), &coex_cmd);
297} 297}
@@ -324,7 +324,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv)
324 324
325 memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl, 325 memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl,
326 sizeof(iwlagn_bt_prio_tbl)); 326 sizeof(iwlagn_bt_prio_tbl));
327 if (trans_send_cmd_pdu(&priv->trans, 327 if (iwl_trans_send_cmd_pdu(trans(priv),
328 REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, 328 REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC,
329 sizeof(prio_tbl_cmd), &prio_tbl_cmd)) 329 sizeof(prio_tbl_cmd), &prio_tbl_cmd))
330 IWL_ERR(priv, "failed to send BT prio tbl command\n"); 330 IWL_ERR(priv, "failed to send BT prio tbl command\n");
@@ -337,7 +337,7 @@ int iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)
337 337
338 env_cmd.action = action; 338 env_cmd.action = action;
339 env_cmd.type = type; 339 env_cmd.type = type;
340 ret = trans_send_cmd_pdu(&priv->trans, 340 ret = iwl_trans_send_cmd_pdu(trans(priv),
341 REPLY_BT_COEX_PROT_ENV, CMD_SYNC, 341 REPLY_BT_COEX_PROT_ENV, CMD_SYNC,
342 sizeof(env_cmd), &env_cmd); 342 sizeof(env_cmd), &env_cmd);
343 if (ret) 343 if (ret)
@@ -350,7 +350,7 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)
350{ 350{
351 int ret; 351 int ret;
352 352
353 trans_tx_start(&priv->trans); 353 iwl_trans_tx_start(trans(priv));
354 354
355 ret = iwlagn_send_wimax_coex(priv); 355 ret = iwlagn_send_wimax_coex(priv);
356 if (ret) 356 if (ret)
@@ -478,7 +478,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
478 int ret; 478 int ret;
479 enum iwlagn_ucode_type old_type; 479 enum iwlagn_ucode_type old_type;
480 480
481 ret = trans_start_device(&priv->trans); 481 ret = iwl_trans_start_device(trans(priv));
482 if (ret) 482 if (ret)
483 return ret; 483 return ret;
484 484
@@ -495,7 +495,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
495 return ret; 495 return ret;
496 } 496 }
497 497
498 trans_kick_nic(&priv->trans); 498 iwl_trans_kick_nic(trans(priv));
499 499
500 /* 500 /*
501 * Some things may run in the background now, but we 501 * Some things may run in the background now, but we
@@ -580,6 +580,6 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
580 iwlagn_remove_notification(priv, &calib_wait); 580 iwlagn_remove_notification(priv, &calib_wait);
581 out: 581 out:
582 /* Whatever happened, stop the device */ 582 /* Whatever happened, stop the device */
583 trans_stop_device(&priv->trans); 583 iwl_trans_stop_device(trans(priv));
584 return ret; 584 return ret;
585} 585}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index cab3f63f4e4e..fcbc3b1d0584 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -200,7 +200,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
200 cmd.data[1] = priv->beacon_skb->data; 200 cmd.data[1] = priv->beacon_skb->data;
201 cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY; 201 cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY;
202 202
203 return trans_send_cmd(&priv->trans, &cmd); 203 return iwl_trans_send_cmd(trans(priv), &cmd);
204} 204}
205 205
206static void iwl_bg_beacon_update(struct work_struct *work) 206static void iwl_bg_beacon_update(struct work_struct *work)
@@ -1685,7 +1685,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1685 adv_cmd.critical_temperature_exit = 1685 adv_cmd.critical_temperature_exit =
1686 cpu_to_le32(hw_params(priv).ct_kill_exit_threshold); 1686 cpu_to_le32(hw_params(priv).ct_kill_exit_threshold);
1687 1687
1688 ret = trans_send_cmd_pdu(&priv->trans, 1688 ret = iwl_trans_send_cmd_pdu(trans(priv),
1689 REPLY_CT_KILL_CONFIG_CMD, 1689 REPLY_CT_KILL_CONFIG_CMD,
1690 CMD_SYNC, sizeof(adv_cmd), &adv_cmd); 1690 CMD_SYNC, sizeof(adv_cmd), &adv_cmd);
1691 if (ret) 1691 if (ret)
@@ -1700,7 +1700,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1700 cmd.critical_temperature_R = 1700 cmd.critical_temperature_R =
1701 cpu_to_le32(hw_params(priv).ct_kill_threshold); 1701 cpu_to_le32(hw_params(priv).ct_kill_threshold);
1702 1702
1703 ret = trans_send_cmd_pdu(&priv->trans, 1703 ret = iwl_trans_send_cmd_pdu(trans(priv),
1704 REPLY_CT_KILL_CONFIG_CMD, 1704 REPLY_CT_KILL_CONFIG_CMD,
1705 CMD_SYNC, sizeof(cmd), &cmd); 1705 CMD_SYNC, sizeof(cmd), &cmd);
1706 if (ret) 1706 if (ret)
@@ -1726,7 +1726,7 @@ static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
1726 calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL; 1726 calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
1727 calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg); 1727 calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg);
1728 1728
1729 return trans_send_cmd(&priv->trans, &cmd); 1729 return iwl_trans_send_cmd(trans(priv), &cmd);
1730} 1730}
1731 1731
1732 1732
@@ -1738,7 +1738,7 @@ static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
1738 1738
1739 if (IWL_UCODE_API(priv->ucode_ver) > 1) { 1739 if (IWL_UCODE_API(priv->ucode_ver) > 1) {
1740 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); 1740 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
1741 return trans_send_cmd_pdu(&priv->trans, 1741 return iwl_trans_send_cmd_pdu(trans(priv),
1742 TX_ANT_CONFIGURATION_CMD, 1742 TX_ANT_CONFIGURATION_CMD,
1743 CMD_SYNC, 1743 CMD_SYNC,
1744 sizeof(struct iwl_tx_ant_config_cmd), 1744 sizeof(struct iwl_tx_ant_config_cmd),
@@ -1912,7 +1912,7 @@ static void __iwl_down(struct iwl_priv *priv)
1912 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) << 1912 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) <<
1913 STATUS_EXIT_PENDING; 1913 STATUS_EXIT_PENDING;
1914 1914
1915 trans_stop_device(&priv->trans); 1915 iwl_trans_stop_device(trans(priv));
1916 1916
1917 dev_kfree_skb(priv->beacon_skb); 1917 dev_kfree_skb(priv->beacon_skb);
1918 priv->beacon_skb = NULL; 1918 priv->beacon_skb = NULL;
@@ -2336,7 +2336,7 @@ static int iwlagn_send_patterns(struct iwl_priv *priv,
2336 } 2336 }
2337 2337
2338 cmd.data[0] = pattern_cmd; 2338 cmd.data[0] = pattern_cmd;
2339 err = trans_send_cmd(&priv->trans, &cmd); 2339 err = iwl_trans_send_cmd(trans(priv), &cmd);
2340 kfree(pattern_cmd); 2340 kfree(pattern_cmd);
2341 return err; 2341 return err;
2342} 2342}
@@ -2591,7 +2591,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
2591 2591
2592 memcpy(&rxon, &ctx->active, sizeof(rxon)); 2592 memcpy(&rxon, &ctx->active, sizeof(rxon));
2593 2593
2594 trans_stop_device(&priv->trans); 2594 iwl_trans_stop_device(trans(priv));
2595 2595
2596 priv->wowlan = true; 2596 priv->wowlan = true;
2597 2597
@@ -2643,13 +2643,13 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
2643 .len[0] = sizeof(*key_data.rsc_tsc), 2643 .len[0] = sizeof(*key_data.rsc_tsc),
2644 }; 2644 };
2645 2645
2646 ret = trans_send_cmd(&priv->trans, &rsc_tsc_cmd); 2646 ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd);
2647 if (ret) 2647 if (ret)
2648 goto error; 2648 goto error;
2649 } 2649 }
2650 2650
2651 if (key_data.use_tkip) { 2651 if (key_data.use_tkip) {
2652 ret = trans_send_cmd_pdu(&priv->trans, 2652 ret = iwl_trans_send_cmd_pdu(trans(priv),
2653 REPLY_WOWLAN_TKIP_PARAMS, 2653 REPLY_WOWLAN_TKIP_PARAMS,
2654 CMD_SYNC, sizeof(tkip_cmd), 2654 CMD_SYNC, sizeof(tkip_cmd),
2655 &tkip_cmd); 2655 &tkip_cmd);
@@ -2665,7 +2665,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
2665 kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); 2665 kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN);
2666 kek_kck_cmd.replay_ctr = priv->replay_ctr; 2666 kek_kck_cmd.replay_ctr = priv->replay_ctr;
2667 2667
2668 ret = trans_send_cmd_pdu(&priv->trans, 2668 ret = iwl_trans_send_cmd_pdu(trans(priv),
2669 REPLY_WOWLAN_KEK_KCK_MATERIAL, 2669 REPLY_WOWLAN_KEK_KCK_MATERIAL,
2670 CMD_SYNC, sizeof(kek_kck_cmd), 2670 CMD_SYNC, sizeof(kek_kck_cmd),
2671 &kek_kck_cmd); 2671 &kek_kck_cmd);
@@ -2674,7 +2674,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
2674 } 2674 }
2675 } 2675 }
2676 2676
2677 ret = trans_send_cmd_pdu(&priv->trans, REPLY_WOWLAN_WAKEUP_FILTER, 2677 ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WOWLAN_WAKEUP_FILTER,
2678 CMD_SYNC, sizeof(wakeup_filter_cmd), 2678 CMD_SYNC, sizeof(wakeup_filter_cmd),
2679 &wakeup_filter_cmd); 2679 &wakeup_filter_cmd);
2680 if (ret) 2680 if (ret)
@@ -2943,7 +2943,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
2943 case IEEE80211_AMPDU_TX_OPERATIONAL: 2943 case IEEE80211_AMPDU_TX_OPERATIONAL:
2944 buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); 2944 buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
2945 2945
2946 trans_txq_agg_setup(&priv->trans, iwl_sta_id(sta), tid, 2946 iwl_trans_txq_agg_setup(trans(priv), iwl_sta_id(sta), tid,
2947 buf_size); 2947 buf_size);
2948 2948
2949 /* 2949 /*
@@ -3590,7 +3590,8 @@ out:
3590 return hw; 3590 return hw;
3591} 3591}
3592 3592
3593int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg) 3593int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
3594 struct iwl_cfg *cfg)
3594{ 3595{
3595 int err = 0; 3596 int err = 0;
3596 struct iwl_priv *priv; 3597 struct iwl_priv *priv;
@@ -3614,6 +3615,12 @@ int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg)
3614 priv->shrd->priv = priv; 3615 priv->shrd->priv = priv;
3615 bus_set_drv_data(priv->bus, priv->shrd); 3616 bus_set_drv_data(priv->bus, priv->shrd);
3616 3617
3618 priv->shrd->trans = trans_ops->alloc(priv->shrd);
3619 if (priv->shrd->trans == NULL) {
3620 err = -ENOMEM;
3621 goto out_free_traffic_mem;
3622 }
3623
3617 /* At this point both hw and priv are allocated. */ 3624 /* At this point both hw and priv are allocated. */
3618 3625
3619 SET_IEEE80211_DEV(hw, priv->bus->dev); 3626 SET_IEEE80211_DEV(hw, priv->bus->dev);
@@ -3656,11 +3663,11 @@ int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg)
3656 IWL_INFO(priv, "Detected %s, REV=0x%X\n", 3663 IWL_INFO(priv, "Detected %s, REV=0x%X\n",
3657 priv->cfg->name, hw_rev); 3664 priv->cfg->name, hw_rev);
3658 3665
3659 err = iwl_trans_register(&priv->trans, priv); 3666 err = iwl_trans_request_irq(trans(priv));
3660 if (err) 3667 if (err)
3661 goto out_free_traffic_mem; 3668 goto out_free_trans;
3662 3669
3663 if (trans_prepare_card_hw(&priv->trans)) { 3670 if (iwl_trans_prepare_card_hw(trans(priv))) {
3664 err = -EIO; 3671 err = -EIO;
3665 IWL_WARN(priv, "Failed, HW not ready\n"); 3672 IWL_WARN(priv, "Failed, HW not ready\n");
3666 goto out_free_trans; 3673 goto out_free_trans;
@@ -3754,7 +3761,7 @@ out_destroy_workqueue:
3754out_free_eeprom: 3761out_free_eeprom:
3755 iwl_eeprom_free(priv); 3762 iwl_eeprom_free(priv);
3756out_free_trans: 3763out_free_trans:
3757 trans_free(&priv->trans); 3764 iwl_trans_free(trans(priv));
3758out_free_traffic_mem: 3765out_free_traffic_mem:
3759 iwl_free_traffic_mem(priv); 3766 iwl_free_traffic_mem(priv);
3760 ieee80211_free_hw(priv->hw); 3767 ieee80211_free_hw(priv->hw);
@@ -3800,12 +3807,12 @@ void __devexit iwl_remove(struct iwl_priv * priv)
3800 iwl_disable_interrupts(priv); 3807 iwl_disable_interrupts(priv);
3801 spin_unlock_irqrestore(&priv->shrd->lock, flags); 3808 spin_unlock_irqrestore(&priv->shrd->lock, flags);
3802 3809
3803 trans_sync_irq(&priv->trans); 3810 iwl_trans_sync_irq(trans(priv));
3804 3811
3805 iwl_dealloc_ucode(priv); 3812 iwl_dealloc_ucode(priv);
3806 3813
3807 trans_rx_free(&priv->trans); 3814 iwl_trans_rx_free(trans(priv));
3808 trans_tx_free(&priv->trans); 3815 iwl_trans_tx_free(trans(priv));
3809 3816
3810 iwl_eeprom_free(priv); 3817 iwl_eeprom_free(priv);
3811 3818
@@ -3819,7 +3826,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
3819 priv->shrd->workqueue = NULL; 3826 priv->shrd->workqueue = NULL;
3820 iwl_free_traffic_mem(priv); 3827 iwl_free_traffic_mem(priv);
3821 3828
3822 trans_free(&priv->trans); 3829 iwl_trans_free(trans(priv));
3823 3830
3824 bus_set_drv_data(priv->bus, NULL); 3831 bus_set_drv_data(priv->bus, NULL);
3825 3832
diff --git a/drivers/net/wireless/iwlwifi/iwl-bus.h b/drivers/net/wireless/iwlwifi/iwl-bus.h
index a69800485c5c..5d0e155a6ee9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-bus.h
+++ b/drivers/net/wireless/iwlwifi/iwl-bus.h
@@ -89,7 +89,7 @@ struct iwl_bus_ops {
89struct iwl_bus { 89struct iwl_bus {
90 /* Common data to all buses */ 90 /* Common data to all buses */
91 struct device *dev; 91 struct device *dev;
92 struct iwl_bus_ops *ops; 92 const struct iwl_bus_ops *ops;
93 struct iwl_shared *shrd; 93 struct iwl_shared *shrd;
94 94
95 unsigned int irq; 95 unsigned int irq;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 9857136627f3..b5e99a66613e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -378,7 +378,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
378 le32_to_cpu(ctx->timing.beacon_init_val), 378 le32_to_cpu(ctx->timing.beacon_init_val),
379 le16_to_cpu(ctx->timing.atim_window)); 379 le16_to_cpu(ctx->timing.atim_window));
380 380
381 return trans_send_cmd_pdu(&priv->trans, ctx->rxon_timing_cmd, 381 return iwl_trans_send_cmd_pdu(trans(priv), ctx->rxon_timing_cmd,
382 CMD_SYNC, sizeof(ctx->timing), &ctx->timing); 382 CMD_SYNC, sizeof(ctx->timing), &ctx->timing);
383} 383}
384 384
@@ -1135,7 +1135,7 @@ void iwl_send_bt_config(struct iwl_priv *priv)
1135 IWL_DEBUG_INFO(priv, "BT coex %s\n", 1135 IWL_DEBUG_INFO(priv, "BT coex %s\n",
1136 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 1136 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
1137 1137
1138 if (trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG, 1138 if (iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
1139 CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) 1139 CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd))
1140 IWL_ERR(priv, "failed to send BT Coex Config\n"); 1140 IWL_ERR(priv, "failed to send BT Coex Config\n");
1141} 1141}
@@ -1148,12 +1148,12 @@ int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear)
1148 }; 1148 };
1149 1149
1150 if (flags & CMD_ASYNC) 1150 if (flags & CMD_ASYNC)
1151 return trans_send_cmd_pdu(&priv->trans, REPLY_STATISTICS_CMD, 1151 return iwl_trans_send_cmd_pdu(trans(priv), REPLY_STATISTICS_CMD,
1152 CMD_ASYNC, 1152 CMD_ASYNC,
1153 sizeof(struct iwl_statistics_cmd), 1153 sizeof(struct iwl_statistics_cmd),
1154 &statistics_cmd); 1154 &statistics_cmd);
1155 else 1155 else
1156 return trans_send_cmd_pdu(&priv->trans, REPLY_STATISTICS_CMD, 1156 return iwl_trans_send_cmd_pdu(trans(priv), REPLY_STATISTICS_CMD,
1157 CMD_SYNC, 1157 CMD_SYNC,
1158 sizeof(struct iwl_statistics_cmd), 1158 sizeof(struct iwl_statistics_cmd),
1159 &statistics_cmd); 1159 &statistics_cmd);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index fa92975b6a89..4f65b0980a1f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1231,7 +1231,6 @@ struct iwl_priv {
1231 1231
1232 /*TODO: remove these pointers - use bus(priv) instead */ 1232 /*TODO: remove these pointers - use bus(priv) instead */
1233 struct iwl_bus *bus; /* bus specific data */ 1233 struct iwl_bus *bus; /* bus specific data */
1234 struct iwl_trans trans;
1235 1234
1236 /* microcode/device supports multiple contexts */ 1235 /* microcode/device supports multiple contexts */
1237 u8 valid_contexts; 1236 u8 valid_contexts;
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 53b69ed704ff..4bc7389b1a6f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -112,7 +112,7 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd)
112 if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) 112 if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
113 iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); 113 iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
114 114
115 return trans_send_cmd(&priv->trans, &cmd); 115 return iwl_trans_send_cmd(trans(priv), &cmd);
116} 116}
117 117
118/* Set led pattern command */ 118/* Set led pattern command */
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 3b7efd7fee3d..521d7e265c2a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -66,6 +66,7 @@
66#include "iwl-bus.h" 66#include "iwl-bus.h"
67#include "iwl-shared.h" 67#include "iwl-shared.h"
68#include "iwl-agn.h" 68#include "iwl-agn.h"
69#include "iwl-trans.h"
69 70
70/* TODO: iwl_set_bit and friends should be implemented in bus layer 71/* TODO: iwl_set_bit and friends should be implemented in bus layer
71 * this would allow us not to include iwl-io.h here */ 72 * this would allow us not to include iwl-io.h here */
@@ -165,7 +166,7 @@ static u32 iwl_pci_read32(struct iwl_bus *bus, u32 ofs)
165 return val; 166 return val;
166} 167}
167 168
168static struct iwl_bus_ops pci_ops = { 169static const struct iwl_bus_ops bus_ops_pci = {
169 .get_pm_support = iwl_pci_is_pm_supported, 170 .get_pm_support = iwl_pci_is_pm_supported,
170 .apm_config = iwl_pci_apm_config, 171 .apm_config = iwl_pci_apm_config,
171 .set_drv_data = iwl_pci_set_drv_data, 172 .set_drv_data = iwl_pci_set_drv_data,
@@ -460,9 +461,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
460 461
461 bus->dev = &pdev->dev; 462 bus->dev = &pdev->dev;
462 bus->irq = pdev->irq; 463 bus->irq = pdev->irq;
463 bus->ops = &pci_ops; 464 bus->ops = &bus_ops_pci;
464 465
465 err = iwl_probe(bus, cfg); 466 err = iwl_probe(bus, &trans_ops_pcie, cfg);
466 if (err) 467 if (err)
467 goto out_disable_msi; 468 goto out_disable_msi;
468 return 0; 469 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 343317f6ce01..5ecb11e42e4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -336,7 +336,7 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
336 le32_to_cpu(cmd->sleep_interval[3]), 336 le32_to_cpu(cmd->sleep_interval[3]),
337 le32_to_cpu(cmd->sleep_interval[4])); 337 le32_to_cpu(cmd->sleep_interval[4]));
338 338
339 return trans_send_cmd_pdu(&priv->trans, POWER_TABLE_CMD, CMD_SYNC, 339 return iwl_trans_send_cmd_pdu(trans(priv), POWER_TABLE_CMD, CMD_SYNC,
340 sizeof(struct iwl_powertable_cmd), cmd); 340 sizeof(struct iwl_powertable_cmd), cmd);
341} 341}
342 342
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index fa100c5cefa3..1a0cb66d7bae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -75,7 +75,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
75 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 75 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
76 return -EIO; 76 return -EIO;
77 77
78 ret = trans_send_cmd(&priv->trans, &cmd); 78 ret = iwl_trans_send_cmd(trans(priv), &cmd);
79 if (ret) 79 if (ret)
80 return ret; 80 return ret;
81 81
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 71496bf05104..467cfaacd698 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -63,10 +63,14 @@
63#ifndef __iwl_shared_h__ 63#ifndef __iwl_shared_h__
64#define __iwl_shared_h__ 64#define __iwl_shared_h__
65 65
66/*This files includes all the types / functions that are exported by the
67 * upper layer to the bus and transport layer */
68
66struct iwl_cfg; 69struct iwl_cfg;
67struct iwl_bus; 70struct iwl_bus;
68struct iwl_priv; 71struct iwl_priv;
69struct iwl_sensitivity_ranges; 72struct iwl_sensitivity_ranges;
73struct iwl_trans_ops;
70 74
71extern struct iwl_mod_params iwlagn_mod_params; 75extern struct iwl_mod_params iwlagn_mod_params;
72 76
@@ -164,6 +168,7 @@ struct iwl_shared {
164 168
165 struct iwl_bus *bus; 169 struct iwl_bus *bus;
166 struct iwl_priv *priv; 170 struct iwl_priv *priv;
171 struct iwl_trans *trans;
167 struct iwl_hw_params hw_params; 172 struct iwl_hw_params hw_params;
168 173
169 struct workqueue_struct *workqueue; 174 struct workqueue_struct *workqueue;
@@ -175,6 +180,7 @@ struct iwl_shared {
175/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */ 180/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
176#define priv(_m) ((_m)->shrd->priv) 181#define priv(_m) ((_m)->shrd->priv)
177#define bus(_m) ((_m)->shrd->bus) 182#define bus(_m) ((_m)->shrd->bus)
183#define trans(_m) ((_m)->shrd->trans)
178#define hw_params(_m) ((_m)->shrd->hw_params) 184#define hw_params(_m) ((_m)->shrd->hw_params)
179 185
180#ifdef CONFIG_IWLWIFI_DEBUG 186#ifdef CONFIG_IWLWIFI_DEBUG
@@ -204,7 +210,8 @@ int iwl_suspend(struct iwl_priv *priv);
204int iwl_resume(struct iwl_priv *priv); 210int iwl_resume(struct iwl_priv *priv);
205#endif /* !CONFIG_PM */ 211#endif /* !CONFIG_PM */
206 212
207int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg); 213int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
214 struct iwl_cfg *cfg);
208void __devexit iwl_remove(struct iwl_priv * priv); 215void __devexit iwl_remove(struct iwl_priv * priv);
209 216
210#endif /* #__iwl_shared_h__ */ 217#endif /* #__iwl_shared_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 9424d79b9d65..d4c625c13119 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -168,7 +168,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
168 } 168 }
169 169
170 cmd.len[0] = iwlagn_build_addsta_hcmd(sta, data); 170 cmd.len[0] = iwlagn_build_addsta_hcmd(sta, data);
171 ret = trans_send_cmd(&priv->trans, &cmd); 171 ret = iwl_trans_send_cmd(trans(priv), &cmd);
172 172
173 if (ret || (flags & CMD_ASYNC)) 173 if (ret || (flags & CMD_ASYNC))
174 return ret; 174 return ret;
@@ -425,7 +425,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv,
425 425
426 cmd.flags |= CMD_WANT_SKB; 426 cmd.flags |= CMD_WANT_SKB;
427 427
428 ret = trans_send_cmd(&priv->trans, &cmd); 428 ret = iwl_trans_send_cmd(trans(priv), &cmd);
429 429
430 if (ret) 430 if (ret)
431 return ret; 431 return ret;
@@ -799,7 +799,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
799 return -EINVAL; 799 return -EINVAL;
800 800
801 if (is_lq_table_valid(priv, ctx, lq)) 801 if (is_lq_table_valid(priv, ctx, lq))
802 ret = trans_send_cmd(&priv->trans, &cmd); 802 ret = iwl_trans_send_cmd(trans(priv), &cmd);
803 else 803 else
804 ret = -EINVAL; 804 ret = -EINVAL;
805 805
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index ac751fa8b304..4d4358ae69a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -239,7 +239,7 @@ static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
239 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x," 239 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
240 " len %d\n", cmd.id, cmd.flags, cmd.len[0]); 240 " len %d\n", cmd.id, cmd.flags, cmd.len[0]);
241 /* ok, let's submit the command to ucode */ 241 /* ok, let's submit the command to ucode */
242 return trans_send_cmd(&priv->trans, &cmd); 242 return iwl_trans_send_cmd(trans(priv), &cmd);
243} 243}
244 244
245 245
@@ -405,7 +405,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
405 405
406 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: 406 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
407 iwl_testmode_cfg_init_calib(priv); 407 iwl_testmode_cfg_init_calib(priv);
408 trans_stop_device(&priv->trans); 408 iwl_trans_stop_device(trans(priv));
409 break; 409 break;
410 410
411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: 411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index b79330d84185..2bc421b43a91 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -32,6 +32,12 @@
32/*This file includes the declaration that are internal to the 32/*This file includes the declaration that are internal to the
33 * trans_pcie layer */ 33 * trans_pcie layer */
34 34
35/**
36 * struct iwl_trans_pcie - PCIe transport specific data
37 */
38struct iwl_trans_pcie {
39};
40
35/***************************************************** 41/*****************************************************
36* RX 42* RX
37******************************************************/ 43******************************************************/
@@ -62,21 +68,21 @@ int iwlagn_txq_attach_buf_to_tfd(struct iwl_priv *priv,
62 dma_addr_t addr, u16 len, u8 reset); 68 dma_addr_t addr, u16 len, u8 reset);
63int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 69int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
64 int count, int slots_num, u32 id); 70 int count, int slots_num, u32 id);
65int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); 71int iwl_trans_pcie_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
66int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, 72int __must_check iwl_trans_pcie_send_cmd_pdu(struct iwl_priv *priv, u8 id,
67 u16 len, const void *data); 73 u32 flags, u16 len, const void *data);
68void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); 74void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
69void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_priv *priv, 75void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
70 struct iwl_tx_queue *txq, 76 struct iwl_tx_queue *txq,
71 u16 byte_cnt); 77 u16 byte_cnt);
72int iwl_trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, 78int iwl_trans_pcie_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
73 u16 ssn_idx, u8 tx_fifo); 79 u16 ssn_idx, u8 tx_fifo);
74void iwl_trans_set_wr_ptrs(struct iwl_priv *priv, 80void iwl_trans_set_wr_ptrs(struct iwl_priv *priv,
75 int txq_id, u32 index); 81 int txq_id, u32 index);
76void iwl_trans_tx_queue_set_status(struct iwl_priv *priv, 82void iwl_trans_tx_queue_set_status(struct iwl_priv *priv,
77 struct iwl_tx_queue *txq, 83 struct iwl_tx_queue *txq,
78 int tx_fifo_id, int scd_retry); 84 int tx_fifo_id, int scd_retry);
79void iwl_trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid, 85void iwl_trans_pcie_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid,
80 int frame_limit); 86 int frame_limit);
81 87
82#endif /* __iwl_trans_int_pcie_h__ */ 88#endif /* __iwl_trans_int_pcie_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index 9c4bf8cd8771..6f5edf731542 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -443,7 +443,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
443 if (reclaim) { 443 if (reclaim) {
444 /* Invoke any callbacks, transfer the buffer to caller, 444 /* Invoke any callbacks, transfer the buffer to caller,
445 * and fire off the (possibly) blocking 445 * and fire off the (possibly) blocking
446 * trans_send_cmd() 446 * iwl_trans_send_cmd()
447 * as we reclaim the driver command queue */ 447 * as we reclaim the driver command queue */
448 if (rxb->page) 448 if (rxb->page)
449 iwl_tx_cmd_complete(priv, rxb); 449 iwl_tx_cmd_complete(priv, rxb);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index b0ad127715f6..9d7287e7a992 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -422,7 +422,7 @@ void iwl_trans_tx_queue_set_status(struct iwl_priv *priv,
422 scd_retry ? "BA" : "AC/CMD", txq_id, tx_fifo_id); 422 scd_retry ? "BA" : "AC/CMD", txq_id, tx_fifo_id);
423} 423}
424 424
425void iwl_trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid, 425void iwl_trans_pcie_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid,
426 int frame_limit) 426 int frame_limit)
427{ 427{
428 int tx_fifo, txq_id, ssn_idx; 428 int tx_fifo, txq_id, ssn_idx;
@@ -483,7 +483,7 @@ void iwl_trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid,
483 spin_unlock_irqrestore(&priv->shrd->lock, flags); 483 spin_unlock_irqrestore(&priv->shrd->lock, flags);
484} 484}
485 485
486int iwl_trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, 486int iwl_trans_pcie_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
487 u16 ssn_idx, u8 tx_fifo) 487 u16 ssn_idx, u8 tx_fifo)
488{ 488{
489 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) || 489 if ((IWLAGN_FIRST_AMPDU_QUEUE > txq_id) ||
@@ -1015,7 +1015,7 @@ fail:
1015 return ret; 1015 return ret;
1016} 1016}
1017 1017
1018int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 1018int iwl_trans_pcie_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1019{ 1019{
1020 if (cmd->flags & CMD_ASYNC) 1020 if (cmd->flags & CMD_ASYNC)
1021 return iwl_send_cmd_async(priv, cmd); 1021 return iwl_send_cmd_async(priv, cmd);
@@ -1023,8 +1023,8 @@ int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1023 return iwl_send_cmd_sync(priv, cmd); 1023 return iwl_send_cmd_sync(priv, cmd);
1024} 1024}
1025 1025
1026int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, u16 len, 1026int iwl_trans_pcie_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags,
1027 const void *data) 1027 u16 len, const void *data)
1028{ 1028{
1029 struct iwl_host_cmd cmd = { 1029 struct iwl_host_cmd cmd = {
1030 .id = id, 1030 .id = id,
@@ -1033,5 +1033,5 @@ int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
1033 .flags = flags, 1033 .flags = flags,
1034 }; 1034 };
1035 1035
1036 return iwl_send_cmd(priv, &cmd); 1036 return iwl_trans_pcie_send_cmd(priv, &cmd);
1037} 1037}
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index cc3fc237d320..739087f3025c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -60,6 +60,8 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63#include <linux/interrupt.h>
64
63#include "iwl-dev.h" 65#include "iwl-dev.h"
64#include "iwl-trans.h" 66#include "iwl-trans.h"
65#include "iwl-core.h" 67#include "iwl-core.h"
@@ -218,7 +220,7 @@ static int iwl_rx_init(struct iwl_priv *priv)
218 return 0; 220 return 0;
219} 221}
220 222
221static void iwl_trans_rx_free(struct iwl_priv *priv) 223static void iwl_trans_pcie_rx_free(struct iwl_priv *priv)
222{ 224{
223 struct iwl_rx_queue *rxq = &priv->rxq; 225 struct iwl_rx_queue *rxq = &priv->rxq;
224 unsigned long flags; 226 unsigned long flags;
@@ -453,7 +455,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
453 * 455 *
454 * Destroy all TX DMA queues and structures 456 * Destroy all TX DMA queues and structures
455 */ 457 */
456static void iwl_trans_tx_free(struct iwl_priv *priv) 458static void iwl_trans_pcie_tx_free(struct iwl_priv *priv)
457{ 459{
458 int txq_id; 460 int txq_id;
459 461
@@ -528,7 +530,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv)
528 return 0; 530 return 0;
529 531
530error: 532error:
531 trans_tx_free(&priv->trans); 533 iwl_trans_tx_free(trans(priv));
532 534
533 return ret; 535 return ret;
534} 536}
@@ -572,7 +574,7 @@ static int iwl_tx_init(struct iwl_priv *priv)
572error: 574error:
573 /*Upon error, free only if we allocated something */ 575 /*Upon error, free only if we allocated something */
574 if (alloc) 576 if (alloc)
575 trans_tx_free(&priv->trans); 577 iwl_trans_tx_free(trans(priv));
576 return ret; 578 return ret;
577} 579}
578 580
@@ -649,7 +651,7 @@ static int iwl_set_hw_ready(struct iwl_priv *priv)
649} 651}
650 652
651/* Note: returns standard 0/-ERROR code */ 653/* Note: returns standard 0/-ERROR code */
652static int iwl_trans_prepare_card_hw(struct iwl_priv *priv) 654static int iwl_trans_pcie_prepare_card_hw(struct iwl_priv *priv)
653{ 655{
654 int ret; 656 int ret;
655 657
@@ -677,14 +679,14 @@ static int iwl_trans_prepare_card_hw(struct iwl_priv *priv)
677 return ret; 679 return ret;
678} 680}
679 681
680static int iwl_trans_start_device(struct iwl_priv *priv) 682static int iwl_trans_pcie_start_device(struct iwl_priv *priv)
681{ 683{
682 int ret; 684 int ret;
683 685
684 priv->ucode_owner = IWL_OWNERSHIP_DRIVER; 686 priv->ucode_owner = IWL_OWNERSHIP_DRIVER;
685 687
686 if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) && 688 if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) &&
687 iwl_trans_prepare_card_hw(priv)) { 689 iwl_trans_pcie_prepare_card_hw(priv)) {
688 IWL_WARN(priv, "Exit HW not ready\n"); 690 IWL_WARN(priv, "Exit HW not ready\n");
689 return -EIO; 691 return -EIO;
690 } 692 }
@@ -768,7 +770,7 @@ static const struct queue_to_fifo_ac iwlagn_ipan_queue_to_tx_fifo[] = {
768 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, }, 770 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, },
769 { IWL_TX_FIFO_AUX, IWL_AC_UNSET, }, 771 { IWL_TX_FIFO_AUX, IWL_AC_UNSET, },
770}; 772};
771static void iwl_trans_tx_start(struct iwl_priv *priv) 773static void iwl_trans_pcie_tx_start(struct iwl_priv *priv)
772{ 774{
773 const struct queue_to_fifo_ac *queue_to_fifo; 775 const struct queue_to_fifo_ac *queue_to_fifo;
774 struct iwl_rxon_context *ctx; 776 struct iwl_rxon_context *ctx;
@@ -916,7 +918,7 @@ static int iwl_trans_tx_stop(struct iwl_priv *priv)
916 return 0; 918 return 0;
917} 919}
918 920
919static void iwl_trans_stop_device(struct iwl_priv *priv) 921static void iwl_trans_pcie_stop_device(struct iwl_priv *priv)
920{ 922{
921 unsigned long flags; 923 unsigned long flags;
922 924
@@ -927,7 +929,7 @@ static void iwl_trans_stop_device(struct iwl_priv *priv)
927 spin_lock_irqsave(&priv->shrd->lock, flags); 929 spin_lock_irqsave(&priv->shrd->lock, flags);
928 iwl_disable_interrupts(priv); 930 iwl_disable_interrupts(priv);
929 spin_unlock_irqrestore(&priv->shrd->lock, flags); 931 spin_unlock_irqrestore(&priv->shrd->lock, flags);
930 trans_sync_irq(&priv->trans); 932 iwl_trans_sync_irq(trans(priv));
931 933
932 /* device going down, Stop using ICT table */ 934 /* device going down, Stop using ICT table */
933 iwl_disable_ict(priv); 935 iwl_disable_ict(priv);
@@ -956,7 +958,7 @@ static void iwl_trans_stop_device(struct iwl_priv *priv)
956 iwl_apm_stop(priv); 958 iwl_apm_stop(priv);
957} 959}
958 960
959static struct iwl_tx_cmd *iwl_trans_get_tx_cmd(struct iwl_priv *priv, 961static struct iwl_tx_cmd *iwl_trans_pcie_get_tx_cmd(struct iwl_priv *priv,
960 int txq_id) 962 int txq_id)
961{ 963{
962 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 964 struct iwl_tx_queue *txq = &priv->txq[txq_id];
@@ -980,7 +982,7 @@ static struct iwl_tx_cmd *iwl_trans_get_tx_cmd(struct iwl_priv *priv,
980 return &dev_cmd->cmd.tx; 982 return &dev_cmd->cmd.tx;
981} 983}
982 984
983static int iwl_trans_tx(struct iwl_priv *priv, struct sk_buff *skb, 985static int iwl_trans_pcie_tx(struct iwl_priv *priv, struct sk_buff *skb,
984 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu, 986 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
985 struct iwl_rxon_context *ctx) 987 struct iwl_rxon_context *ctx)
986{ 988{
@@ -1109,71 +1111,88 @@ static int iwl_trans_tx(struct iwl_priv *priv, struct sk_buff *skb,
1109 return 0; 1111 return 0;
1110} 1112}
1111 1113
1112static void iwl_trans_kick_nic(struct iwl_priv *priv) 1114static void iwl_trans_pcie_kick_nic(struct iwl_priv *priv)
1113{ 1115{
1114 /* Remove all resets to allow NIC to operate */ 1116 /* Remove all resets to allow NIC to operate */
1115 iwl_write32(priv, CSR_RESET, 0); 1117 iwl_write32(priv, CSR_RESET, 0);
1116} 1118}
1117 1119
1118static void iwl_trans_sync_irq(struct iwl_priv *priv) 1120static int iwl_trans_pcie_request_irq(struct iwl_trans *trans)
1121{
1122 struct iwl_priv *priv = priv(trans);
1123 int err;
1124
1125 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
1126 iwl_irq_tasklet, (unsigned long)priv);
1127
1128 iwl_alloc_isr_ict(priv);
1129
1130 err = request_irq(bus(trans)->irq, iwl_isr_ict, IRQF_SHARED,
1131 DRV_NAME, priv);
1132 if (err) {
1133 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->bus->irq);
1134 iwl_free_isr_ict(priv);
1135 return err;
1136 }
1137
1138 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish);
1139 return 0;
1140}
1141
1142static void iwl_trans_pcie_sync_irq(struct iwl_priv *priv)
1119{ 1143{
1120 /* wait to make sure we flush pending tasklet*/ 1144 /* wait to make sure we flush pending tasklet*/
1121 synchronize_irq(priv->bus->irq); 1145 synchronize_irq(priv->bus->irq);
1122 tasklet_kill(&priv->irq_tasklet); 1146 tasklet_kill(&priv->irq_tasklet);
1123} 1147}
1124 1148
1125static void iwl_trans_free(struct iwl_priv *priv) 1149static void iwl_trans_pcie_free(struct iwl_priv *priv)
1126{ 1150{
1127 free_irq(priv->bus->irq, priv); 1151 free_irq(priv->bus->irq, priv);
1128 iwl_free_isr_ict(priv); 1152 iwl_free_isr_ict(priv);
1153 kfree(trans(priv));
1154 trans(priv) = NULL;
1129} 1155}
1130 1156
1131static const struct iwl_trans_ops trans_ops = { 1157const struct iwl_trans_ops trans_ops_pcie;
1132 .start_device = iwl_trans_start_device,
1133 .prepare_card_hw = iwl_trans_prepare_card_hw,
1134 .stop_device = iwl_trans_stop_device,
1135
1136 .tx_start = iwl_trans_tx_start,
1137 1158
1138 .rx_free = iwl_trans_rx_free, 1159static struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd)
1139 .tx_free = iwl_trans_tx_free, 1160{
1161 struct iwl_trans *iwl_trans = kzalloc(sizeof(struct iwl_trans) +
1162 sizeof(struct iwl_trans_pcie),
1163 GFP_KERNEL);
1164 if (iwl_trans) {
1165 iwl_trans->ops = &trans_ops_pcie;
1166 iwl_trans->shrd = shrd;
1167 }
1140 1168
1141 .send_cmd = iwl_send_cmd, 1169 return iwl_trans;
1142 .send_cmd_pdu = iwl_send_cmd_pdu, 1170}
1143 1171
1144 .get_tx_cmd = iwl_trans_get_tx_cmd, 1172const struct iwl_trans_ops trans_ops_pcie = {
1145 .tx = iwl_trans_tx, 1173 .alloc = iwl_trans_pcie_alloc,
1174 .request_irq = iwl_trans_pcie_request_irq,
1175 .start_device = iwl_trans_pcie_start_device,
1176 .prepare_card_hw = iwl_trans_pcie_prepare_card_hw,
1177 .stop_device = iwl_trans_pcie_stop_device,
1146 1178
1147 .txq_agg_disable = iwl_trans_txq_agg_disable, 1179 .tx_start = iwl_trans_pcie_tx_start,
1148 .txq_agg_setup = iwl_trans_txq_agg_setup,
1149 1180
1150 .kick_nic = iwl_trans_kick_nic, 1181 .rx_free = iwl_trans_pcie_rx_free,
1182 .tx_free = iwl_trans_pcie_tx_free,
1151 1183
1152 .sync_irq = iwl_trans_sync_irq, 1184 .send_cmd = iwl_trans_pcie_send_cmd,
1153 .free = iwl_trans_free, 1185 .send_cmd_pdu = iwl_trans_pcie_send_cmd_pdu,
1154};
1155 1186
1156int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv) 1187 .get_tx_cmd = iwl_trans_pcie_get_tx_cmd,
1157{ 1188 .tx = iwl_trans_pcie_tx,
1158 int err;
1159 1189
1160 priv->trans.ops = &trans_ops; 1190 .txq_agg_disable = iwl_trans_pcie_txq_agg_disable,
1161 priv->trans.priv = priv; 1191 .txq_agg_setup = iwl_trans_pcie_txq_agg_setup,
1162 1192
1163 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 1193 .kick_nic = iwl_trans_pcie_kick_nic,
1164 iwl_irq_tasklet, (unsigned long)priv);
1165 1194
1166 iwl_alloc_isr_ict(priv); 1195 .sync_irq = iwl_trans_pcie_sync_irq,
1167 1196 .free = iwl_trans_pcie_free,
1168 err = request_irq(priv->bus->irq, iwl_isr_ict, IRQF_SHARED, 1197};
1169 DRV_NAME, priv);
1170 if (err) {
1171 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->bus->irq);
1172 iwl_free_isr_ict(priv);
1173 return err;
1174 }
1175
1176 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish);
1177 1198
1178 return 0;
1179}
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 7993aa7ae668..eec25b424def 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -69,9 +69,12 @@
69struct iwl_priv; 69struct iwl_priv;
70struct iwl_rxon_context; 70struct iwl_rxon_context;
71struct iwl_host_cmd; 71struct iwl_host_cmd;
72struct iwl_shared;
72 73
73/** 74/**
74 * struct iwl_trans_ops - transport specific operations 75 * struct iwl_trans_ops - transport specific operations
76 * @alloc: allocates the meta data (not the queues themselves)
77 * @request_irq: requests IRQ - will be called before the FW load in probe flow
75 * @start_device: allocates and inits all the resources for the transport 78 * @start_device: allocates and inits all the resources for the transport
76 * layer. 79 * layer.
77 * @prepare_card_hw: claim the ownership on the HW. Will be called during 80 * @prepare_card_hw: claim the ownership on the HW. Will be called during
@@ -98,6 +101,8 @@ struct iwl_host_cmd;
98 */ 101 */
99struct iwl_trans_ops { 102struct iwl_trans_ops {
100 103
104 struct iwl_trans *(*alloc)(struct iwl_shared *shrd);
105 int (*request_irq)(struct iwl_trans *iwl_trans);
101 int (*start_device)(struct iwl_priv *priv); 106 int (*start_device)(struct iwl_priv *priv);
102 int (*prepare_card_hw)(struct iwl_priv *priv); 107 int (*prepare_card_hw)(struct iwl_priv *priv);
103 void (*stop_device)(struct iwl_priv *priv); 108 void (*stop_device)(struct iwl_priv *priv);
@@ -127,93 +132,105 @@ struct iwl_trans_ops {
127 132
128struct iwl_trans { 133struct iwl_trans {
129 const struct iwl_trans_ops *ops; 134 const struct iwl_trans_ops *ops;
130 struct iwl_priv *priv; 135 struct iwl_shared *shrd;
136
137 /* pointer to trans specific struct */
138 /*Ensure that this pointer will always be aligned to sizeof pointer */
139 char trans_specific[0] __attribute__((__aligned__(sizeof(void *))));
131}; 140};
132 141
133static inline int trans_start_device(struct iwl_trans *trans) 142static inline int iwl_trans_request_irq(struct iwl_trans *trans)
143{
144 return trans->ops->request_irq(trans);
145}
146
147static inline int iwl_trans_start_device(struct iwl_trans *trans)
134{ 148{
135 return trans->ops->start_device(trans->priv); 149 return trans->ops->start_device(priv(trans));
136} 150}
137 151
138static inline int trans_prepare_card_hw(struct iwl_trans *trans) 152static inline int iwl_trans_prepare_card_hw(struct iwl_trans *trans)
139{ 153{
140 return trans->ops->prepare_card_hw(trans->priv); 154 return trans->ops->prepare_card_hw(priv(trans));
141} 155}
142 156
143static inline void trans_stop_device(struct iwl_trans *trans) 157static inline void iwl_trans_stop_device(struct iwl_trans *trans)
144{ 158{
145 trans->ops->stop_device(trans->priv); 159 trans->ops->stop_device(priv(trans));
146} 160}
147 161
148static inline void trans_tx_start(struct iwl_trans *trans) 162static inline void iwl_trans_tx_start(struct iwl_trans *trans)
149{ 163{
150 trans->ops->tx_start(trans->priv); 164 trans->ops->tx_start(priv(trans));
151} 165}
152 166
153static inline void trans_rx_free(struct iwl_trans *trans) 167static inline void iwl_trans_rx_free(struct iwl_trans *trans)
154{ 168{
155 trans->ops->rx_free(trans->priv); 169 trans->ops->rx_free(priv(trans));
156} 170}
157 171
158static inline void trans_tx_free(struct iwl_trans *trans) 172static inline void iwl_trans_tx_free(struct iwl_trans *trans)
159{ 173{
160 trans->ops->tx_free(trans->priv); 174 trans->ops->tx_free(priv(trans));
161} 175}
162 176
163static inline int trans_send_cmd(struct iwl_trans *trans, 177static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
164 struct iwl_host_cmd *cmd) 178 struct iwl_host_cmd *cmd)
165{ 179{
166 return trans->ops->send_cmd(trans->priv, cmd); 180 return trans->ops->send_cmd(priv(trans), cmd);
167} 181}
168 182
169static inline int trans_send_cmd_pdu(struct iwl_trans *trans, u8 id, u32 flags, 183static inline int iwl_trans_send_cmd_pdu(struct iwl_trans *trans, u8 id,
170 u16 len, const void *data) 184 u32 flags, u16 len, const void *data)
171{ 185{
172 return trans->ops->send_cmd_pdu(trans->priv, id, flags, len, data); 186 return trans->ops->send_cmd_pdu(priv(trans), id, flags, len, data);
173} 187}
174 188
175static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_trans *trans, 189static inline struct iwl_tx_cmd *iwl_trans_get_tx_cmd(struct iwl_trans *trans,
176 int txq_id) 190 int txq_id)
177{ 191{
178 return trans->ops->get_tx_cmd(trans->priv, txq_id); 192 return trans->ops->get_tx_cmd(priv(trans), txq_id);
179} 193}
180 194
181static inline int trans_tx(struct iwl_trans *trans, struct sk_buff *skb, 195static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
182 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu, 196 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
183 struct iwl_rxon_context *ctx) 197 struct iwl_rxon_context *ctx)
184{ 198{
185 return trans->ops->tx(trans->priv, skb, tx_cmd, txq_id, fc, ampdu, ctx); 199 return trans->ops->tx(priv(trans), skb, tx_cmd, txq_id, fc, ampdu, ctx);
186} 200}
187 201
188static inline int trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id, 202static inline int iwl_trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id,
189 u16 ssn_idx, u8 tx_fifo) 203 u16 ssn_idx, u8 tx_fifo)
190{ 204{
191 return trans->ops->txq_agg_disable(trans->priv, txq_id, 205 return trans->ops->txq_agg_disable(priv(trans), txq_id,
192 ssn_idx, tx_fifo); 206 ssn_idx, tx_fifo);
193} 207}
194 208
195static inline void trans_txq_agg_setup(struct iwl_trans *trans, int sta_id, 209static inline void iwl_trans_txq_agg_setup(struct iwl_trans *trans, int sta_id,
196 int tid, int frame_limit) 210 int tid, int frame_limit)
197{ 211{
198 trans->ops->txq_agg_setup(trans->priv, sta_id, tid, frame_limit); 212 trans->ops->txq_agg_setup(priv(trans), sta_id, tid, frame_limit);
199} 213}
200 214
201static inline void trans_kick_nic(struct iwl_trans *trans) 215static inline void iwl_trans_kick_nic(struct iwl_trans *trans)
202{ 216{
203 trans->ops->kick_nic(trans->priv); 217 trans->ops->kick_nic(priv(trans));
204} 218}
205 219
206static inline void trans_sync_irq(struct iwl_trans *trans) 220static inline void iwl_trans_sync_irq(struct iwl_trans *trans)
207{ 221{
208 trans->ops->sync_irq(trans->priv); 222 trans->ops->sync_irq(priv(trans));
209} 223}
210 224
211static inline void trans_free(struct iwl_trans *trans) 225static inline void iwl_trans_free(struct iwl_trans *trans)
212{ 226{
213 trans->ops->free(trans->priv); 227 trans->ops->free(priv(trans));
214} 228}
215 229
216int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv); 230/*****************************************************
231* Transport layers implementations
232******************************************************/
233extern const struct iwl_trans_ops trans_ops_pcie;
217 234
218/*TODO: this functions should NOT be exported from trans module - export it 235/*TODO: this functions should NOT be exported from trans module - export it
219 * until the reclaim flow will be brought to the transport module too */ 236 * until the reclaim flow will be brought to the transport module too */