aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-07-11 01:51:04 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-07-21 10:29:48 -0400
commit41c50542669cd7aec45ad708f5120ff8fdaa1194 (patch)
treefb0d02e7a0047e4ea480cb6cea64b09c7838b845 /drivers/net
parent0286cee0d2b6357e8e30d817bbce8ff166f358b5 (diff)
iwlagn: transport layer receives struct iwl_trans*
It still holds a pointer to iwl_priv. But hopefully this will disappear at some point. Also add the multiple inclusion protection to iwl-trans.h that was forgotten. Move iwl-trans structures to iwl-trans.h Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-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.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c29
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h62
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c2
-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-sta.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sv-open.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h133
18 files changed, 168 insertions, 154 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 8c6fbd74b8da..3eeb12ebe6e9 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, &hcmd); 318 return trans_send_cmd(&priv->trans, &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 ea48246f8dd3..973d1972e8cc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -253,7 +253,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
253 return -EFAULT; 253 return -EFAULT;
254 } 254 }
255 255
256 return trans_send_cmd(priv, &hcmd); 256 return trans_send_cmd(&priv->trans, &hcmd);
257} 257}
258 258
259static struct iwl_lib_ops iwl6000_lib = { 259static 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 540e66f55153..204f0ece3c26 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, &hcmd); 101 ret = trans_send_cmd(&priv->trans, &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, &cmd_out); 487 return trans_send_cmd(&priv->trans, &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 */
@@ -548,7 +548,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
548 &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]), 548 &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
549 sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES); 549 sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);
550 550
551 return trans_send_cmd(priv, &cmd_out); 551 return trans_send_cmd(&priv->trans, &cmd_out);
552} 552}
553 553
554void iwl_init_sensitivity(struct iwl_priv *priv) 554void iwl_init_sensitivity(struct iwl_priv *priv)
@@ -892,7 +892,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
892 priv->_agn.phy_calib_chain_noise_gain_cmd); 892 priv->_agn.phy_calib_chain_noise_gain_cmd);
893 cmd.delta_gain_1 = data->delta_gain_code[1]; 893 cmd.delta_gain_1 = data->delta_gain_code[1];
894 cmd.delta_gain_2 = data->delta_gain_code[2]; 894 cmd.delta_gain_2 = data->delta_gain_code[2];
895 trans_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 895 trans_send_cmd_pdu(&priv->trans, REPLY_PHY_CALIBRATION_CMD,
896 CMD_ASYNC, sizeof(cmd), &cmd); 896 CMD_ASYNC, sizeof(cmd), &cmd);
897 897
898 data->radio_write = 1; 898 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 6ed0eae4c543..67b55c5fa0d2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -519,7 +519,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
519 else 519 else
520 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; 520 tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
521 521
522 return trans_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC, 522 return trans_send_cmd_pdu(&priv->trans, tx_ant_cfg_cmd, CMD_SYNC,
523 sizeof(tx_power_cmd), &tx_power_cmd); 523 sizeof(tx_power_cmd), &tx_power_cmd);
524} 524}
525 525
@@ -1061,7 +1061,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
1061 if (ret) 1061 if (ret)
1062 return ret; 1062 return ret;
1063 1063
1064 ret = trans_send_cmd(priv, &cmd); 1064 ret = trans_send_cmd(&priv->trans, &cmd);
1065 if (ret) { 1065 if (ret) {
1066 clear_bit(STATUS_SCAN_HW, &priv->status); 1066 clear_bit(STATUS_SCAN_HW, &priv->status);
1067 iwlagn_set_pan_params(priv); 1067 iwlagn_set_pan_params(priv);
@@ -1167,7 +1167,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
1167 flush_cmd.fifo_control); 1167 flush_cmd.fifo_control);
1168 flush_cmd.flush_control = cpu_to_le16(flush_control); 1168 flush_cmd.flush_control = cpu_to_le16(flush_control);
1169 1169
1170 return trans_send_cmd(priv, &cmd); 1170 return trans_send_cmd(&priv->trans, &cmd);
1171} 1171}
1172 1172
1173void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) 1173void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
@@ -1361,12 +1361,12 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
1361 if (priv->cfg->bt_params->bt_session_2) { 1361 if (priv->cfg->bt_params->bt_session_2) {
1362 memcpy(&bt_cmd_2000.basic, &basic, 1362 memcpy(&bt_cmd_2000.basic, &basic,
1363 sizeof(basic)); 1363 sizeof(basic));
1364 ret = trans_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1364 ret = trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG,
1365 CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000); 1365 CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
1366 } else { 1366 } else {
1367 memcpy(&bt_cmd_6000.basic, &basic, 1367 memcpy(&bt_cmd_6000.basic, &basic,
1368 sizeof(basic)); 1368 sizeof(basic));
1369 ret = trans_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1369 ret = trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG,
1370 CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000); 1370 CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
1371 } 1371 }
1372 if (ret) 1372 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 53e74752d130..581534a54155 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -40,7 +40,7 @@ static int iwlagn_disable_bss(struct iwl_priv *priv,
40 int ret; 40 int ret;
41 41
42 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 42 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
43 ret = trans_send_cmd_pdu(priv, ctx->rxon_cmd, 43 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd,
44 CMD_SYNC, sizeof(*send), send); 44 CMD_SYNC, sizeof(*send), send);
45 45
46 send->filter_flags = old_filter; 46 send->filter_flags = old_filter;
@@ -66,7 +66,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
66 66
67 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 67 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
68 send->dev_type = RXON_DEV_TYPE_P2P; 68 send->dev_type = RXON_DEV_TYPE_P2P;
69 ret = trans_send_cmd_pdu(priv, ctx->rxon_cmd, 69 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd,
70 CMD_SYNC, sizeof(*send), send); 70 CMD_SYNC, sizeof(*send), send);
71 71
72 send->filter_flags = old_filter; 72 send->filter_flags = old_filter;
@@ -92,7 +92,7 @@ static int iwlagn_disconn_pan(struct iwl_priv *priv,
92 int ret; 92 int ret;
93 93
94 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 94 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
95 ret = trans_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 95 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC,
96 sizeof(*send), send); 96 sizeof(*send), send);
97 97
98 send->filter_flags = old_filter; 98 send->filter_flags = old_filter;
@@ -121,7 +121,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
121 ctx->qos_data.qos_active, 121 ctx->qos_data.qos_active,
122 ctx->qos_data.def_qos_parm.qos_flags); 122 ctx->qos_data.def_qos_parm.qos_flags);
123 123
124 ret = trans_send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC, 124 ret = trans_send_cmd_pdu(&priv->trans, ctx->qos_cmd, CMD_SYNC,
125 sizeof(struct iwl_qosparam_cmd), 125 sizeof(struct iwl_qosparam_cmd),
126 &ctx->qos_data.def_qos_parm); 126 &ctx->qos_data.def_qos_parm);
127 if (ret) 127 if (ret)
@@ -180,7 +180,7 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
180 ctx->staging.ofdm_ht_triple_stream_basic_rates; 180 ctx->staging.ofdm_ht_triple_stream_basic_rates;
181 rxon_assoc.acquisition_data = ctx->staging.acquisition_data; 181 rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
182 182
183 ret = trans_send_cmd_pdu(priv, ctx->rxon_assoc_cmd, 183 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_assoc_cmd,
184 CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc); 184 CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc);
185 return ret; 185 return ret;
186} 186}
@@ -266,7 +266,7 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
266 * Associated RXON doesn't clear the station table in uCode, 266 * Associated RXON doesn't clear the station table in uCode,
267 * so we don't need to restore stations etc. after this. 267 * so we don't need to restore stations etc. after this.
268 */ 268 */
269 ret = trans_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, 269 ret = trans_send_cmd_pdu(&priv->trans, ctx->rxon_cmd, CMD_SYNC,
270 sizeof(struct iwl_rxon_cmd), &ctx->staging); 270 sizeof(struct iwl_rxon_cmd), &ctx->staging);
271 if (ret) { 271 if (ret) {
272 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); 272 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, REPLY_WIPAN_PARAMS, CMD_SYNC, 391 ret = trans_send_cmd_pdu(&priv->trans, 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);
@@ -788,7 +788,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
788 memset(&cmd, 0, sizeof(cmd)); 788 memset(&cmd, 0, sizeof(cmd));
789 iwl_set_calib_hdr(&cmd.hdr, 789 iwl_set_calib_hdr(&cmd.hdr,
790 priv->_agn.phy_calib_chain_noise_reset_cmd); 790 priv->_agn.phy_calib_chain_noise_reset_cmd);
791 ret = trans_send_cmd_pdu(priv, 791 ret = trans_send_cmd_pdu(&priv->trans,
792 REPLY_PHY_CALIBRATION_CMD, 792 REPLY_PHY_CALIBRATION_CMD,
793 CMD_SYNC, sizeof(cmd), &cmd); 793 CMD_SYNC, sizeof(cmd), &cmd);
794 if (ret) 794 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 001622c06526..67b9c2bacc5f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -181,7 +181,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
181 cmd.len[0] = cmd_size; 181 cmd.len[0] = cmd_size;
182 182
183 if (not_empty || send_if_empty) 183 if (not_empty || send_if_empty)
184 return trans_send_cmd(priv, &cmd); 184 return trans_send_cmd(&priv->trans, &cmd);
185 else 185 else
186 return 0; 186 return 0;
187} 187}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 932425d019dd..a5295c15d70d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -433,7 +433,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
433 } 433 }
434 } 434 }
435 435
436 tx_cmd = trans_get_tx_cmd(priv, txq_id); 436 tx_cmd = trans_get_tx_cmd(&priv->trans, txq_id);
437 if (unlikely(!tx_cmd)) 437 if (unlikely(!tx_cmd))
438 goto drop_unlock_sta; 438 goto drop_unlock_sta;
439 439
@@ -455,7 +455,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
455 455
456 iwl_update_stats(priv, true, fc, len); 456 iwl_update_stats(priv, true, fc, len);
457 457
458 if (trans_tx(priv, skb, tx_cmd, txq_id, fc, is_agg, ctx)) 458 if (trans_tx(&priv->trans, skb, tx_cmd, txq_id, fc, is_agg, ctx))
459 goto drop_unlock_sta; 459 goto drop_unlock_sta;
460 460
461 if (ieee80211_is_data_qos(fc)) { 461 if (ieee80211_is_data_qos(fc)) {
@@ -633,7 +633,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
633 * to deactivate the uCode queue, just return "success" to allow 633 * to deactivate the uCode queue, just return "success" to allow
634 * mac80211 to clean up it own data. 634 * mac80211 to clean up it own data.
635 */ 635 */
636 trans_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); 636 trans_txq_agg_disable(&priv->trans, txq_id, ssn, tx_fifo_id);
637 spin_unlock_irqrestore(&priv->lock, flags); 637 spin_unlock_irqrestore(&priv->lock, flags);
638 638
639 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 639 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
@@ -662,7 +662,8 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
662 u16 ssn = SEQ_TO_SN(tid_data->seq_number); 662 u16 ssn = SEQ_TO_SN(tid_data->seq_number);
663 int tx_fifo = get_fifo_from_tid(ctx, tid); 663 int tx_fifo = get_fifo_from_tid(ctx, tid);
664 IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n"); 664 IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n");
665 trans_txq_agg_disable(priv, txq_id, ssn, tx_fifo); 665 trans_txq_agg_disable(&priv->trans, txq_id,
666 ssn, tx_fifo);
666 tid_data->agg.state = IWL_AGG_OFF; 667 tid_data->agg.state = IWL_AGG_OFF;
667 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 668 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
668 } 669 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index e4b2f78775f4..946d3a16e494 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, &cmd); 196 return trans_send_cmd(&priv->trans, &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, 294 return trans_send_cmd_pdu(&priv->trans,
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, 327 if (trans_send_cmd_pdu(&priv->trans,
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, 340 ret = trans_send_cmd_pdu(&priv->trans,
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); 353 trans_tx_start(&priv->trans);
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); 481 ret = trans_start_device(&priv->trans);
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); 498 trans_kick_nic(&priv->trans);
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
@@ -573,6 +573,6 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
573 iwlagn_remove_notification(priv, &calib_wait); 573 iwlagn_remove_notification(priv, &calib_wait);
574 out: 574 out:
575 /* Whatever happened, stop the device */ 575 /* Whatever happened, stop the device */
576 trans_stop_device(priv); 576 trans_stop_device(&priv->trans);
577 return ret; 577 return ret;
578} 578}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 703c106aa8dd..d3163d8cf6d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -206,7 +206,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
206 cmd.data[1] = priv->beacon_skb->data; 206 cmd.data[1] = priv->beacon_skb->data;
207 cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY; 207 cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY;
208 208
209 return trans_send_cmd(priv, &cmd); 209 return trans_send_cmd(&priv->trans, &cmd);
210} 210}
211 211
212static void iwl_bg_beacon_update(struct work_struct *work) 212static void iwl_bg_beacon_update(struct work_struct *work)
@@ -1568,7 +1568,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1568 adv_cmd.critical_temperature_exit = 1568 adv_cmd.critical_temperature_exit =
1569 cpu_to_le32(priv->hw_params.ct_kill_exit_threshold); 1569 cpu_to_le32(priv->hw_params.ct_kill_exit_threshold);
1570 1570
1571 ret = trans_send_cmd_pdu(priv, 1571 ret = trans_send_cmd_pdu(&priv->trans,
1572 REPLY_CT_KILL_CONFIG_CMD, 1572 REPLY_CT_KILL_CONFIG_CMD,
1573 CMD_SYNC, sizeof(adv_cmd), &adv_cmd); 1573 CMD_SYNC, sizeof(adv_cmd), &adv_cmd);
1574 if (ret) 1574 if (ret)
@@ -1584,7 +1584,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1584 cmd.critical_temperature_R = 1584 cmd.critical_temperature_R =
1585 cpu_to_le32(priv->hw_params.ct_kill_threshold); 1585 cpu_to_le32(priv->hw_params.ct_kill_threshold);
1586 1586
1587 ret = trans_send_cmd_pdu(priv, 1587 ret = trans_send_cmd_pdu(&priv->trans,
1588 REPLY_CT_KILL_CONFIG_CMD, 1588 REPLY_CT_KILL_CONFIG_CMD,
1589 CMD_SYNC, sizeof(cmd), &cmd); 1589 CMD_SYNC, sizeof(cmd), &cmd);
1590 if (ret) 1590 if (ret)
@@ -1610,7 +1610,7 @@ static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
1610 calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL; 1610 calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
1611 calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg); 1611 calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg);
1612 1612
1613 return trans_send_cmd(priv, &cmd); 1613 return trans_send_cmd(&priv->trans, &cmd);
1614} 1614}
1615 1615
1616 1616
@@ -1622,7 +1622,7 @@ static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
1622 1622
1623 if (IWL_UCODE_API(priv->ucode_ver) > 1) { 1623 if (IWL_UCODE_API(priv->ucode_ver) > 1) {
1624 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); 1624 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
1625 return trans_send_cmd_pdu(priv, 1625 return trans_send_cmd_pdu(&priv->trans,
1626 TX_ANT_CONFIGURATION_CMD, 1626 TX_ANT_CONFIGURATION_CMD,
1627 CMD_SYNC, 1627 CMD_SYNC,
1628 sizeof(struct iwl_tx_ant_config_cmd), 1628 sizeof(struct iwl_tx_ant_config_cmd),
@@ -1783,7 +1783,7 @@ static void __iwl_down(struct iwl_priv *priv)
1783 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1783 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
1784 STATUS_EXIT_PENDING; 1784 STATUS_EXIT_PENDING;
1785 1785
1786 trans_stop_device(priv); 1786 trans_stop_device(&priv->trans);
1787 1787
1788 dev_kfree_skb(priv->beacon_skb); 1788 dev_kfree_skb(priv->beacon_skb);
1789 priv->beacon_skb = NULL; 1789 priv->beacon_skb = NULL;
@@ -2412,7 +2412,8 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
2412 case IEEE80211_AMPDU_TX_OPERATIONAL: 2412 case IEEE80211_AMPDU_TX_OPERATIONAL:
2413 buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); 2413 buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
2414 2414
2415 trans_txq_agg_setup(priv, iwl_sta_id(sta), tid, buf_size); 2415 trans_txq_agg_setup(&priv->trans, iwl_sta_id(sta), tid,
2416 buf_size);
2416 2417
2417 /* 2418 /*
2418 * If the limit is 0, then it wasn't initialised yet, 2419 * If the limit is 0, then it wasn't initialised yet,
@@ -3136,7 +3137,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
3136 priv->cfg = cfg; 3137 priv->cfg = cfg;
3137 priv->inta_mask = CSR_INI_SET_MASK; 3138 priv->inta_mask = CSR_INI_SET_MASK;
3138 3139
3139 err = iwl_trans_register(priv); 3140 err = iwl_trans_register(&priv->trans, priv);
3140 if (err) 3141 if (err)
3141 goto out_free_priv; 3142 goto out_free_priv;
3142 3143
@@ -3174,7 +3175,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
3174 IWL_INFO(priv, "Detected %s, REV=0x%X\n", 3175 IWL_INFO(priv, "Detected %s, REV=0x%X\n",
3175 priv->cfg->name, hw_rev); 3176 priv->cfg->name, hw_rev);
3176 3177
3177 if (trans_prepare_card_hw(priv)) { 3178 if (trans_prepare_card_hw(&priv->trans)) {
3178 err = -EIO; 3179 err = -EIO;
3179 IWL_WARN(priv, "Failed, HW not ready\n"); 3180 IWL_WARN(priv, "Failed, HW not ready\n");
3180 goto out_free_traffic_mem; 3181 goto out_free_traffic_mem;
@@ -3272,7 +3273,7 @@ out_free_eeprom:
3272 iwl_eeprom_free(priv); 3273 iwl_eeprom_free(priv);
3273out_free_traffic_mem: 3274out_free_traffic_mem:
3274 iwl_free_traffic_mem(priv); 3275 iwl_free_traffic_mem(priv);
3275 trans_free(priv); 3276 trans_free(&priv->trans);
3276out_free_priv: 3277out_free_priv:
3277 ieee80211_free_hw(priv->hw); 3278 ieee80211_free_hw(priv->hw);
3278out: 3279out:
@@ -3317,12 +3318,12 @@ void __devexit iwl_remove(struct iwl_priv * priv)
3317 iwl_disable_interrupts(priv); 3318 iwl_disable_interrupts(priv);
3318 spin_unlock_irqrestore(&priv->lock, flags); 3319 spin_unlock_irqrestore(&priv->lock, flags);
3319 3320
3320 trans_sync_irq(priv); 3321 trans_sync_irq(&priv->trans);
3321 3322
3322 iwl_dealloc_ucode(priv); 3323 iwl_dealloc_ucode(priv);
3323 3324
3324 trans_rx_free(priv); 3325 trans_rx_free(&priv->trans);
3325 trans_tx_free(priv); 3326 trans_tx_free(&priv->trans);
3326 3327
3327 iwl_eeprom_free(priv); 3328 iwl_eeprom_free(priv);
3328 3329
@@ -3336,7 +3337,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
3336 priv->workqueue = NULL; 3337 priv->workqueue = NULL;
3337 iwl_free_traffic_mem(priv); 3338 iwl_free_traffic_mem(priv);
3338 3339
3339 trans_free(priv); 3340 trans_free(&priv->trans);
3340 3341
3341 priv->bus.ops->set_drv_data(&priv->bus, NULL); 3342 priv->bus.ops->set_drv_data(&priv->bus, NULL);
3342 3343
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index fa3d5bacbde2..a2a95bace84a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -376,7 +376,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
376 le32_to_cpu(ctx->timing.beacon_init_val), 376 le32_to_cpu(ctx->timing.beacon_init_val),
377 le16_to_cpu(ctx->timing.atim_window)); 377 le16_to_cpu(ctx->timing.atim_window));
378 378
379 return trans_send_cmd_pdu(priv, ctx->rxon_timing_cmd, 379 return trans_send_cmd_pdu(&priv->trans, ctx->rxon_timing_cmd,
380 CMD_SYNC, sizeof(ctx->timing), &ctx->timing); 380 CMD_SYNC, sizeof(ctx->timing), &ctx->timing);
381} 381}
382 382
@@ -1132,7 +1132,7 @@ void iwl_send_bt_config(struct iwl_priv *priv)
1132 IWL_DEBUG_INFO(priv, "BT coex %s\n", 1132 IWL_DEBUG_INFO(priv, "BT coex %s\n",
1133 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 1133 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
1134 1134
1135 if (trans_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1135 if (trans_send_cmd_pdu(&priv->trans, REPLY_BT_CONFIG,
1136 CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) 1136 CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd))
1137 IWL_ERR(priv, "failed to send BT Coex Config\n"); 1137 IWL_ERR(priv, "failed to send BT Coex Config\n");
1138} 1138}
@@ -1145,12 +1145,12 @@ int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear)
1145 }; 1145 };
1146 1146
1147 if (flags & CMD_ASYNC) 1147 if (flags & CMD_ASYNC)
1148 return trans_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 1148 return trans_send_cmd_pdu(&priv->trans, REPLY_STATISTICS_CMD,
1149 CMD_ASYNC, 1149 CMD_ASYNC,
1150 sizeof(struct iwl_statistics_cmd), 1150 sizeof(struct iwl_statistics_cmd),
1151 &statistics_cmd); 1151 &statistics_cmd);
1152 else 1152 else
1153 return trans_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 1153 return trans_send_cmd_pdu(&priv->trans, REPLY_STATISTICS_CMD,
1154 CMD_SYNC, 1154 CMD_SYNC,
1155 sizeof(struct iwl_statistics_cmd), 1155 sizeof(struct iwl_statistics_cmd),
1156 &statistics_cmd); 1156 &statistics_cmd);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 9a39836c0cd1..a89b40a585cf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -47,6 +47,7 @@
47#include "iwl-power.h" 47#include "iwl-power.h"
48#include "iwl-agn-rs.h" 48#include "iwl-agn-rs.h"
49#include "iwl-agn-tt.h" 49#include "iwl-agn-tt.h"
50#include "iwl-trans.h"
50 51
51#define DRV_NAME "iwlagn" 52#define DRV_NAME "iwlagn"
52 53
@@ -1230,67 +1231,6 @@ struct iwl_bus {
1230 unsigned int irq; 1231 unsigned int irq;
1231}; 1232};
1232 1233
1233struct iwl_trans;
1234
1235/**
1236 * struct iwl_trans_ops - transport specific operations
1237 * @start_device: allocates and inits all the resources for the transport
1238 * layer.
1239 * @prepare_card_hw: claim the ownership on the HW. Will be called during
1240 * probe.
1241 * @tx_start: starts and configures all the Tx fifo - usually done once the fw
1242 * is alive.
1243 * @stop_device:stops the whole device (embedded CPU put to reset)
1244 * @rx_free: frees the rx memory
1245 * @tx_free: frees the tx memory
1246 * @send_cmd:send a host command
1247 * @send_cmd_pdu:send a host command: flags can be CMD_*
1248 * @get_tx_cmd: returns a pointer to a new Tx cmd for the upper layer use
1249 * @tx: send an skb
1250 * @txq_agg_setup: setup a tx queue for AMPDU - will be called once the HW is
1251 * ready and a successful ADDBA response has been received.
1252 * @txq_agg_disable: de-configure a Tx queue to send AMPDUs
1253 * @kick_nic: remove the RESET from the embedded CPU and let it run
1254 * @sync_irq: the upper layer will typically disable interrupt and call this
1255 * handler. After this handler returns, it is guaranteed that all
1256 * the ISR / tasklet etc... have finished running and the transport
1257 * layer shall not pass any Rx.
1258 * @free: release all the ressource for the transport layer itself such as
1259 * irq, tasklet etc...
1260 */
1261struct iwl_trans_ops {
1262
1263 int (*start_device)(struct iwl_priv *priv);
1264 int (*prepare_card_hw)(struct iwl_priv *priv);
1265 void (*stop_device)(struct iwl_priv *priv);
1266 void (*tx_start)(struct iwl_priv *priv);
1267 void (*tx_free)(struct iwl_priv *priv);
1268 void (*rx_free)(struct iwl_priv *priv);
1269
1270 int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
1271
1272 int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
1273 const void *data);
1274 struct iwl_tx_cmd * (*get_tx_cmd)(struct iwl_priv *priv, int txq_id);
1275 int (*tx)(struct iwl_priv *priv, struct sk_buff *skb,
1276 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
1277 struct iwl_rxon_context *ctx);
1278
1279 int (*txq_agg_disable)(struct iwl_priv *priv, u16 txq_id,
1280 u16 ssn_idx, u8 tx_fifo);
1281 void (*txq_agg_setup)(struct iwl_priv *priv, int sta_id, int tid,
1282 int frame_limit);
1283
1284 void (*kick_nic)(struct iwl_priv *priv);
1285
1286 void (*sync_irq)(struct iwl_priv *priv);
1287 void (*free)(struct iwl_priv *priv);
1288};
1289
1290struct iwl_trans {
1291 const struct iwl_trans_ops *ops;
1292};
1293
1294/* uCode ownership */ 1234/* uCode ownership */
1295#define IWL_OWNERSHIP_DRIVER 0 1235#define IWL_OWNERSHIP_DRIVER 0
1296#define IWL_OWNERSHIP_TM 1 1236#define IWL_OWNERSHIP_TM 1
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 60e4169f25e1..75663c12e99f 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, &cmd); 115 return trans_send_cmd(&priv->trans, &cmd);
116} 116}
117 117
118/* Set led pattern command */ 118/* Set led pattern command */
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 64ff40ae1026..7c99f432996d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -335,7 +335,7 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
335 le32_to_cpu(cmd->sleep_interval[3]), 335 le32_to_cpu(cmd->sleep_interval[3]),
336 le32_to_cpu(cmd->sleep_interval[4])); 336 le32_to_cpu(cmd->sleep_interval[4]));
337 337
338 return trans_send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC, 338 return trans_send_cmd_pdu(&priv->trans, POWER_TABLE_CMD, CMD_SYNC,
339 sizeof(struct iwl_powertable_cmd), cmd); 339 sizeof(struct iwl_powertable_cmd), cmd);
340} 340}
341 341
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index f6ebe29eb790..0505b1ac7561 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->status)) 75 test_bit(STATUS_EXIT_PENDING, &priv->status))
76 return -EIO; 76 return -EIO;
77 77
78 ret = trans_send_cmd(priv, &cmd); 78 ret = trans_send_cmd(&priv->trans, &cmd);
79 if (ret) 79 if (ret)
80 return ret; 80 return ret;
81 81
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 65386e575b1c..58dba0a49f8a 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, &cmd); 171 ret = trans_send_cmd(&priv->trans, &cmd);
172 172
173 if (ret || (flags & CMD_ASYNC)) 173 if (ret || (flags & CMD_ASYNC))
174 return ret; 174 return ret;
@@ -424,7 +424,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv,
424 424
425 cmd.flags |= CMD_WANT_SKB; 425 cmd.flags |= CMD_WANT_SKB;
426 426
427 ret = trans_send_cmd(priv, &cmd); 427 ret = trans_send_cmd(&priv->trans, &cmd);
428 428
429 if (ret) 429 if (ret)
430 return ret; 430 return ret;
@@ -793,7 +793,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
793 return -EINVAL; 793 return -EINVAL;
794 794
795 if (is_lq_table_valid(priv, ctx, lq)) 795 if (is_lq_table_valid(priv, ctx, lq))
796 ret = trans_send_cmd(priv, &cmd); 796 ret = trans_send_cmd(&priv->trans, &cmd);
797 else 797 else
798 ret = -EINVAL; 798 ret = -EINVAL;
799 799
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index d736a9d0e06e..d47483561a8f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -241,7 +241,7 @@ static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
241 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x," 241 IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
242 " len %d\n", cmd.id, cmd.flags, cmd.len[0]); 242 " len %d\n", cmd.id, cmd.flags, cmd.len[0]);
243 /* ok, let's submit the command to ucode */ 243 /* ok, let's submit the command to ucode */
244 return trans_send_cmd(priv, &cmd); 244 return trans_send_cmd(&priv->trans, &cmd);
245} 245}
246 246
247 247
@@ -407,7 +407,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
407 407
408 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: 408 case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
409 iwl_testmode_cfg_init_calib(priv); 409 iwl_testmode_cfg_init_calib(priv);
410 trans_stop_device(priv); 410 trans_stop_device(&priv->trans);
411 break; 411 break;
412 412
413 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: 413 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 88ab20abe253..edd28f00dab5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -526,7 +526,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv)
526 return 0; 526 return 0;
527 527
528error: 528error:
529 trans_tx_free(priv); 529 trans_tx_free(&priv->trans);
530 530
531 return ret; 531 return ret;
532} 532}
@@ -570,7 +570,7 @@ static int iwl_tx_init(struct iwl_priv *priv)
570error: 570error:
571 /*Upon error, free only if we allocated something */ 571 /*Upon error, free only if we allocated something */
572 if (alloc) 572 if (alloc)
573 trans_tx_free(priv); 573 trans_tx_free(&priv->trans);
574 return ret; 574 return ret;
575} 575}
576 576
@@ -920,7 +920,7 @@ static void iwl_trans_stop_device(struct iwl_priv *priv)
920 spin_lock_irqsave(&priv->lock, flags); 920 spin_lock_irqsave(&priv->lock, flags);
921 iwl_disable_interrupts(priv); 921 iwl_disable_interrupts(priv);
922 spin_unlock_irqrestore(&priv->lock, flags); 922 spin_unlock_irqrestore(&priv->lock, flags);
923 trans_sync_irq(priv); 923 trans_sync_irq(&priv->trans);
924 924
925 /* device going down, Stop using ICT table */ 925 /* device going down, Stop using ICT table */
926 iwl_disable_ict(priv); 926 iwl_disable_ict(priv);
@@ -1146,11 +1146,12 @@ static const struct iwl_trans_ops trans_ops = {
1146 .free = iwl_trans_free, 1146 .free = iwl_trans_free,
1147}; 1147};
1148 1148
1149int iwl_trans_register(struct iwl_priv *priv) 1149int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv)
1150{ 1150{
1151 int err; 1151 int err;
1152 1152
1153 priv->trans.ops = &trans_ops; 1153 priv->trans.ops = &trans_ops;
1154 priv->trans.priv = priv;
1154 1155
1155 iwl_alloc_isr_ict(priv); 1156 iwl_alloc_isr_ict(priv);
1156 1157
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index fca01819f10c..7993aa7ae668 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -60,95 +60,166 @@
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#ifndef __iwl_trans_h__
64#define __iwl_trans_h__
63 65
64 /*This file includes the declaration that are exported from the transport 66 /*This file includes the declaration that are exported from the transport
65 * layer */ 67 * layer */
66 68
67static inline int trans_start_device(struct iwl_priv *priv) 69struct iwl_priv;
70struct iwl_rxon_context;
71struct iwl_host_cmd;
72
73/**
74 * struct iwl_trans_ops - transport specific operations
75 * @start_device: allocates and inits all the resources for the transport
76 * layer.
77 * @prepare_card_hw: claim the ownership on the HW. Will be called during
78 * probe.
79 * @tx_start: starts and configures all the Tx fifo - usually done once the fw
80 * is alive.
81 * @stop_device:stops the whole device (embedded CPU put to reset)
82 * @rx_free: frees the rx memory
83 * @tx_free: frees the tx memory
84 * @send_cmd:send a host command
85 * @send_cmd_pdu:send a host command: flags can be CMD_*
86 * @get_tx_cmd: returns a pointer to a new Tx cmd for the upper layer use
87 * @tx: send an skb
88 * @txq_agg_setup: setup a tx queue for AMPDU - will be called once the HW is
89 * ready and a successful ADDBA response has been received.
90 * @txq_agg_disable: de-configure a Tx queue to send AMPDUs
91 * @kick_nic: remove the RESET from the embedded CPU and let it run
92 * @sync_irq: the upper layer will typically disable interrupt and call this
93 * handler. After this handler returns, it is guaranteed that all
94 * the ISR / tasklet etc... have finished running and the transport
95 * layer shall not pass any Rx.
96 * @free: release all the ressource for the transport layer itself such as
97 * irq, tasklet etc...
98 */
99struct iwl_trans_ops {
100
101 int (*start_device)(struct iwl_priv *priv);
102 int (*prepare_card_hw)(struct iwl_priv *priv);
103 void (*stop_device)(struct iwl_priv *priv);
104 void (*tx_start)(struct iwl_priv *priv);
105 void (*tx_free)(struct iwl_priv *priv);
106 void (*rx_free)(struct iwl_priv *priv);
107
108 int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
109
110 int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
111 const void *data);
112 struct iwl_tx_cmd * (*get_tx_cmd)(struct iwl_priv *priv, int txq_id);
113 int (*tx)(struct iwl_priv *priv, struct sk_buff *skb,
114 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
115 struct iwl_rxon_context *ctx);
116
117 int (*txq_agg_disable)(struct iwl_priv *priv, u16 txq_id,
118 u16 ssn_idx, u8 tx_fifo);
119 void (*txq_agg_setup)(struct iwl_priv *priv, int sta_id, int tid,
120 int frame_limit);
121
122 void (*kick_nic)(struct iwl_priv *priv);
123
124 void (*sync_irq)(struct iwl_priv *priv);
125 void (*free)(struct iwl_priv *priv);
126};
127
128struct iwl_trans {
129 const struct iwl_trans_ops *ops;
130 struct iwl_priv *priv;
131};
132
133static inline int trans_start_device(struct iwl_trans *trans)
68{ 134{
69 return priv->trans.ops->start_device(priv); 135 return trans->ops->start_device(trans->priv);
70} 136}
71 137
72static inline int trans_prepare_card_hw(struct iwl_priv *priv) 138static inline int trans_prepare_card_hw(struct iwl_trans *trans)
73{ 139{
74 return priv->trans.ops->prepare_card_hw(priv); 140 return trans->ops->prepare_card_hw(trans->priv);
75} 141}
76 142
77static inline void trans_stop_device(struct iwl_priv *priv) 143static inline void trans_stop_device(struct iwl_trans *trans)
78{ 144{
79 priv->trans.ops->stop_device(priv); 145 trans->ops->stop_device(trans->priv);
80} 146}
81 147
82static inline void trans_tx_start(struct iwl_priv *priv) 148static inline void trans_tx_start(struct iwl_trans *trans)
83{ 149{
84 priv->trans.ops->tx_start(priv); 150 trans->ops->tx_start(trans->priv);
85} 151}
86 152
87static inline void trans_rx_free(struct iwl_priv *priv) 153static inline void trans_rx_free(struct iwl_trans *trans)
88{ 154{
89 priv->trans.ops->rx_free(priv); 155 trans->ops->rx_free(trans->priv);
90} 156}
91 157
92static inline void trans_tx_free(struct iwl_priv *priv) 158static inline void trans_tx_free(struct iwl_trans *trans)
93{ 159{
94 priv->trans.ops->tx_free(priv); 160 trans->ops->tx_free(trans->priv);
95} 161}
96 162
97static inline int trans_send_cmd(struct iwl_priv *priv, 163static inline int trans_send_cmd(struct iwl_trans *trans,
98 struct iwl_host_cmd *cmd) 164 struct iwl_host_cmd *cmd)
99{ 165{
100 return priv->trans.ops->send_cmd(priv, cmd); 166 return trans->ops->send_cmd(trans->priv, cmd);
101} 167}
102 168
103static inline int trans_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, 169static inline int trans_send_cmd_pdu(struct iwl_trans *trans, u8 id, u32 flags,
104 u16 len, const void *data) 170 u16 len, const void *data)
105{ 171{
106 return priv->trans.ops->send_cmd_pdu(priv, id, flags, len, data); 172 return trans->ops->send_cmd_pdu(trans->priv, id, flags, len, data);
107} 173}
108 174
109static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_priv *priv, 175static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_trans *trans,
110 int txq_id) 176 int txq_id)
111{ 177{
112 return priv->trans.ops->get_tx_cmd(priv, txq_id); 178 return trans->ops->get_tx_cmd(trans->priv, txq_id);
113} 179}
114 180
115static inline int trans_tx(struct iwl_priv *priv, struct sk_buff *skb, 181static inline int trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
116 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu, 182 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
117 struct iwl_rxon_context *ctx) 183 struct iwl_rxon_context *ctx)
118{ 184{
119 return priv->trans.ops->tx(priv, skb, tx_cmd, txq_id, fc, ampdu, ctx); 185 return trans->ops->tx(trans->priv, skb, tx_cmd, txq_id, fc, ampdu, ctx);
120} 186}
121 187
122static inline int trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, 188static inline int trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id,
123 u16 ssn_idx, u8 tx_fifo) 189 u16 ssn_idx, u8 tx_fifo)
124{ 190{
125 return priv->trans.ops->txq_agg_disable(priv, txq_id, ssn_idx, tx_fifo); 191 return trans->ops->txq_agg_disable(trans->priv, txq_id,
192 ssn_idx, tx_fifo);
126} 193}
127 194
128static inline void trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, 195static inline void trans_txq_agg_setup(struct iwl_trans *trans, int sta_id,
129 int tid, int frame_limit) 196 int tid, int frame_limit)
130{ 197{
131 priv->trans.ops->txq_agg_setup(priv, sta_id, tid, frame_limit); 198 trans->ops->txq_agg_setup(trans->priv, sta_id, tid, frame_limit);
132} 199}
133 200
134static inline void trans_kick_nic(struct iwl_priv *priv) 201static inline void trans_kick_nic(struct iwl_trans *trans)
135{ 202{
136 priv->trans.ops->kick_nic(priv); 203 trans->ops->kick_nic(trans->priv);
137} 204}
138 205
139static inline void trans_sync_irq(struct iwl_priv *priv) 206static inline void trans_sync_irq(struct iwl_trans *trans)
140{ 207{
141 priv->trans.ops->sync_irq(priv); 208 trans->ops->sync_irq(trans->priv);
142} 209}
143 210
144static inline void trans_free(struct iwl_priv *priv) 211static inline void trans_free(struct iwl_trans *trans)
145{ 212{
146 priv->trans.ops->free(priv); 213 trans->ops->free(trans->priv);
147} 214}
148 215
149int iwl_trans_register(struct iwl_priv *priv); 216int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv);
150 217
151/*TODO: this functions should NOT be exported from trans module - export it 218/*TODO: this functions should NOT be exported from trans module - export it
152 * until the reclaim flow will be brought to the transport module too */ 219 * until the reclaim flow will be brought to the transport module too */
220
221struct iwl_tx_queue;
153void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, 222void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
154 struct iwl_tx_queue *txq); 223 struct iwl_tx_queue *txq);
224
225#endif /* __iwl_trans_h__ */