aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel.ortiz@intel.com>2009-01-23 16:45:20 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:01:37 -0500
commit17f841cd6cb0837ba0599ad18a746c30ddd83e08 (patch)
treec5964754f04fdc97deeff14b8c9d7ccabb2ea233 /drivers
parentaf48d048ac5f10981df093c7566ae0fea9ba1967 (diff)
iwl3945: Remaining host command cleanups
With the recent host command routines merge, we can now look at the various host command helpers and get rid of the duplicated ones. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c116
9 files changed, 45 insertions, 127 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 7f1e04205f30..12f93b6207d6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -41,6 +41,7 @@
41#include "iwl-fh.h" 41#include "iwl-fh.h"
42#include "iwl-3945-fh.h" 42#include "iwl-3945-fh.h"
43#include "iwl-commands.h" 43#include "iwl-commands.h"
44#include "iwl-sta.h"
44#include "iwl-3945.h" 45#include "iwl-3945.h"
45#include "iwl-eeprom.h" 46#include "iwl-eeprom.h"
46#include "iwl-helpers.h" 47#include "iwl-helpers.h"
@@ -895,7 +896,8 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
895 896
896 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 897 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
897 898
898 iwl3945_send_add_station(priv, &station->sta, flags); 899 iwl_send_add_sta(priv,
900 (struct iwl_addsta_cmd *)&station->sta, flags);
899 IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n", 901 IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n",
900 sta_id, tx_rate); 902 sta_id, tx_rate);
901 return sta_id; 903 return sta_id;
@@ -2376,6 +2378,13 @@ static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len)
2376 } 2378 }
2377} 2379}
2378 2380
2381static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
2382{
2383 u16 size = (u16)sizeof(struct iwl3945_addsta_cmd);
2384 memcpy(data, cmd, size);
2385 return size;
2386}
2387
2379/** 2388/**
2380 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table 2389 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
2381 */ 2390 */
@@ -2743,6 +2752,7 @@ static struct iwl_lib_ops iwl3945_lib = {
2743 2752
2744static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2753static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
2745 .get_hcmd_size = iwl3945_get_hcmd_size, 2754 .get_hcmd_size = iwl3945_get_hcmd_size,
2755 .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
2746}; 2756};
2747 2757
2748static struct iwl_ops iwl3945_ops = { 2758static struct iwl_ops iwl3945_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 77e97eaa4e4e..fef54e9cf8a8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -222,7 +222,6 @@ extern int __must_check iwl3945_send_cmd(struct iwl_priv *priv,
222 struct iwl_host_cmd *cmd); 222 struct iwl_host_cmd *cmd);
223extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 223extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
224 struct ieee80211_hdr *hdr,int left); 224 struct ieee80211_hdr *hdr,int left);
225extern int iwl3945_send_statistics_request(struct iwl_priv *priv);
226extern void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 225extern void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
227 u32 decrypt_res, 226 u32 decrypt_res,
228 struct ieee80211_rx_status *stats); 227 struct ieee80211_rx_status *stats);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5c6b3fe3eedf..757a9bd3ecd6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -310,20 +310,6 @@ void iwl_update_chain_flags(struct iwl_priv *priv)
310 iwl_commit_rxon(priv); 310 iwl_commit_rxon(priv);
311} 311}
312 312
313static int iwl_send_bt_config(struct iwl_priv *priv)
314{
315 struct iwl_bt_cmd bt_cmd = {
316 .flags = 3,
317 .lead_time = 0xAA,
318 .max_kill = 1,
319 .kill_ack_mask = 0,
320 .kill_cts_mask = 0,
321 };
322
323 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
324 sizeof(struct iwl_bt_cmd), &bt_cmd);
325}
326
327static void iwl_clear_free_frames(struct iwl_priv *priv) 313static void iwl_clear_free_frames(struct iwl_priv *priv)
328{ 314{
329 struct list_head *element; 315 struct list_head *element;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 902b75f25ea5..21f386568c9c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1007,6 +1007,21 @@ void iwl_enable_interrupts(struct iwl_priv *priv)
1007} 1007}
1008EXPORT_SYMBOL(iwl_enable_interrupts); 1008EXPORT_SYMBOL(iwl_enable_interrupts);
1009 1009
1010int iwl_send_bt_config(struct iwl_priv *priv)
1011{
1012 struct iwl_bt_cmd bt_cmd = {
1013 .flags = 3,
1014 .lead_time = 0xAA,
1015 .max_kill = 1,
1016 .kill_ack_mask = 0,
1017 .kill_cts_mask = 0,
1018 };
1019
1020 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1021 sizeof(struct iwl_bt_cmd), &bt_cmd);
1022}
1023EXPORT_SYMBOL(iwl_send_bt_config);
1024
1010int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags) 1025int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags)
1011{ 1026{
1012 u32 stat_flags = 0; 1027 u32 stat_flags = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 0c6250cd51db..c8e1dad6fb54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -335,6 +335,7 @@ void iwl_bg_scan_check(struct work_struct *data);
335void iwl_bg_abort_scan(struct work_struct *work); 335void iwl_bg_abort_scan(struct work_struct *work);
336void iwl_bg_scan_completed(struct work_struct *work); 336void iwl_bg_scan_completed(struct work_struct *work);
337void iwl_setup_scan_deferred_work(struct iwl_priv *priv); 337void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
338int iwl_send_scan_abort(struct iwl_priv *priv);
338 339
339/* For faster active scanning, scan will move to the next channel if fewer than 340/* For faster active scanning, scan will move to the next channel if fewer than
340 * PLCP_QUIET_THRESH packets are heard on this channel within 341 * PLCP_QUIET_THRESH packets are heard on this channel within
@@ -468,6 +469,7 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
468} 469}
469 470
470extern void iwl_rf_kill_ct_config(struct iwl_priv *priv); 471extern void iwl_rf_kill_ct_config(struct iwl_priv *priv);
472extern int iwl_send_bt_config(struct iwl_priv *priv);
471extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags); 473extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags);
472extern int iwl_verify_ucode(struct iwl_priv *priv); 474extern int iwl_verify_ucode(struct iwl_priv *priv);
473extern int iwl_send_lq_cmd(struct iwl_priv *priv, 475extern int iwl_send_lq_cmd(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 0ce122a17341..c282d1d294e6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -109,7 +109,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
109} 109}
110EXPORT_SYMBOL(iwl_scan_cancel_timeout); 110EXPORT_SYMBOL(iwl_scan_cancel_timeout);
111 111
112static int iwl_send_scan_abort(struct iwl_priv *priv) 112int iwl_send_scan_abort(struct iwl_priv *priv)
113{ 113{
114 int ret = 0; 114 int ret = 0;
115 struct iwl_rx_packet *res; 115 struct iwl_rx_packet *res;
@@ -150,7 +150,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
150 150
151 return ret; 151 return ret;
152} 152}
153 153EXPORT_SYMBOL(iwl_send_scan_abort);
154 154
155/* Service response to REPLY_SCAN_CMD (0x80) */ 155/* Service response to REPLY_SCAN_CMD (0x80) */
156static void iwl_rx_reply_scan(struct iwl_priv *priv, 156static void iwl_rx_reply_scan(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 0cbb4495c062..9bba98e5e056 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -86,7 +86,8 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
86 86
87 spin_lock_irqsave(&priv->sta_lock, flags); 87 spin_lock_irqsave(&priv->sta_lock, flags);
88 88
89 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) 89 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) &&
90 !(priv->stations_39[sta_id].used & IWL_STA_DRIVER_ACTIVE))
90 IWL_ERR(priv, "ACTIVATE a non DRIVER active station %d\n", 91 IWL_ERR(priv, "ACTIVATE a non DRIVER active station %d\n",
91 sta_id); 92 sta_id);
92 93
@@ -131,7 +132,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
131 return 1; 132 return 1;
132} 133}
133 134
134static int iwl_send_add_sta(struct iwl_priv *priv, 135int iwl_send_add_sta(struct iwl_priv *priv,
135 struct iwl_addsta_cmd *sta, u8 flags) 136 struct iwl_addsta_cmd *sta, u8 flags)
136{ 137{
137 struct iwl_rx_packet *res = NULL; 138 struct iwl_rx_packet *res = NULL;
@@ -179,6 +180,7 @@ static int iwl_send_add_sta(struct iwl_priv *priv,
179 180
180 return ret; 181 return ret;
181} 182}
183EXPORT_SYMBOL(iwl_send_add_sta);
182 184
183static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, 185static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
184 struct ieee80211_sta_ht_cap *sta_ht_inf) 186 struct ieee80211_sta_ht_cap *sta_ht_inf)
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 3fe7cc575fa6..97f6169007f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -56,6 +56,8 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap);
56void iwl_clear_stations_table(struct iwl_priv *priv); 56void iwl_clear_stations_table(struct iwl_priv *priv);
57int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 57int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
58int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 58int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
59int iwl_send_add_sta(struct iwl_priv *priv,
60 struct iwl_addsta_cmd *sta, u8 flags);
59u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, 61u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
60 int is_ap, u8 flags, 62 int is_ap, u8 flags,
61 struct ieee80211_sta_ht_cap *ht_info); 63 struct ieee80211_sta_ht_cap *ht_info);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 13fb61851845..d09325591de0 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -51,6 +51,7 @@
51#include "iwl-fh.h" 51#include "iwl-fh.h"
52#include "iwl-3945-fh.h" 52#include "iwl-3945-fh.h"
53#include "iwl-commands.h" 53#include "iwl-commands.h"
54#include "iwl-sta.h"
54#include "iwl-3945.h" 55#include "iwl-3945.h"
55#include "iwl-helpers.h" 56#include "iwl-helpers.h"
56#include "iwl-core.h" 57#include "iwl-core.h"
@@ -226,24 +227,12 @@ u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flag
226 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 227 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
227 228
228 /* Add station to device's station table */ 229 /* Add station to device's station table */
229 iwl3945_send_add_station(priv, &station->sta, flags); 230 iwl_send_add_sta(priv,
231 (struct iwl_addsta_cmd *)&station->sta, flags);
230 return index; 232 return index;
231 233
232} 234}
233 235
234int iwl3945_send_statistics_request(struct iwl_priv *priv)
235{
236 u32 val = 0;
237
238 struct iwl_host_cmd cmd = {
239 .id = REPLY_STATISTICS_CMD,
240 .len = sizeof(val),
241 .data = &val,
242 };
243
244 return iwl_send_cmd_sync(priv, &cmd);
245}
246
247/** 236/**
248 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON 237 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
249 * @band: 2.4 or 5 GHz band 238 * @band: 2.4 or 5 GHz band
@@ -611,95 +600,6 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
611 return 0; 600 return 0;
612} 601}
613 602
614static int iwl3945_send_bt_config(struct iwl_priv *priv)
615{
616 struct iwl_bt_cmd bt_cmd = {
617 .flags = 3,
618 .lead_time = 0xAA,
619 .max_kill = 1,
620 .kill_ack_mask = 0,
621 .kill_cts_mask = 0,
622 };
623
624 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
625 sizeof(bt_cmd), &bt_cmd);
626}
627
628static int iwl3945_add_sta_sync_callback(struct iwl_priv *priv,
629 struct iwl_cmd *cmd, struct sk_buff *skb)
630{
631 struct iwl_rx_packet *res = NULL;
632
633 if (!skb) {
634 IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n");
635 return 1;
636 }
637
638 res = (struct iwl_rx_packet *)skb->data;
639 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
640 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
641 res->hdr.flags);
642 return 1;
643 }
644
645 switch (res->u.add_sta.status) {
646 case ADD_STA_SUCCESS_MSK:
647 break;
648 default:
649 break;
650 }
651
652 /* We didn't cache the SKB; let the caller free it */
653 return 1;
654}
655
656int iwl3945_send_add_station(struct iwl_priv *priv,
657 struct iwl3945_addsta_cmd *sta, u8 flags)
658{
659 struct iwl_rx_packet *res = NULL;
660 int rc = 0;
661 struct iwl_host_cmd cmd = {
662 .id = REPLY_ADD_STA,
663 .len = sizeof(struct iwl3945_addsta_cmd),
664 .meta.flags = flags,
665 .data = sta,
666 };
667
668 if (flags & CMD_ASYNC)
669 cmd.meta.u.callback = iwl3945_add_sta_sync_callback;
670 else
671 cmd.meta.flags |= CMD_WANT_SKB;
672
673 rc = iwl_send_cmd(priv, &cmd);
674
675 if (rc || (flags & CMD_ASYNC))
676 return rc;
677
678 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
679 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
680 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
681 res->hdr.flags);
682 rc = -EIO;
683 }
684
685 if (rc == 0) {
686 switch (res->u.add_sta.status) {
687 case ADD_STA_SUCCESS_MSK:
688 IWL_DEBUG_INFO("REPLY_ADD_STA PASSED\n");
689 break;
690 default:
691 rc = -EIO;
692 IWL_WARN(priv, "REPLY_ADD_STA failed\n");
693 break;
694 }
695 }
696
697 priv->alloc_rxb_skb--;
698 dev_kfree_skb_any(cmd.meta.u.skb);
699
700 return rc;
701}
702
703static int iwl3945_update_sta_key_info(struct iwl_priv *priv, 603static int iwl3945_update_sta_key_info(struct iwl_priv *priv,
704 struct ieee80211_key_conf *keyconf, 604 struct ieee80211_key_conf *keyconf,
705 u8 sta_id) 605 u8 sta_id)
@@ -734,7 +634,8 @@ static int iwl3945_update_sta_key_info(struct iwl_priv *priv,
734 spin_unlock_irqrestore(&priv->sta_lock, flags); 634 spin_unlock_irqrestore(&priv->sta_lock, flags);
735 635
736 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); 636 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
737 iwl3945_send_add_station(priv, &priv->stations_39[sta_id].sta, 0); 637 iwl_send_add_sta(priv,
638 (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, 0);
738 return 0; 639 return 0;
739} 640}
740 641
@@ -752,7 +653,8 @@ static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id)
752 spin_unlock_irqrestore(&priv->sta_lock, flags); 653 spin_unlock_irqrestore(&priv->sta_lock, flags);
753 654
754 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); 655 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
755 iwl3945_send_add_station(priv, &priv->stations_39[sta_id].sta, 0); 656 iwl_send_add_sta(priv,
657 (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, 0);
756 return 0; 658 return 0;
757} 659}
758 660
@@ -4005,7 +3907,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
4005 } 3907 }
4006 3908
4007 /* Configure Bluetooth device coexistence support */ 3909 /* Configure Bluetooth device coexistence support */
4008 iwl3945_send_bt_config(priv); 3910 iwl_send_bt_config(priv);
4009 3911
4010 /* Configure the adapter for unassociated operation */ 3912 /* Configure the adapter for unassociated operation */
4011 iwl3945_commit_rxon(priv); 3913 iwl3945_commit_rxon(priv);
@@ -5810,7 +5712,7 @@ static ssize_t show_statistics(struct device *d,
5810 return -EAGAIN; 5712 return -EAGAIN;
5811 5713
5812 mutex_lock(&priv->mutex); 5714 mutex_lock(&priv->mutex);
5813 rc = iwl3945_send_statistics_request(priv); 5715 rc = iwl_send_statistics_request(priv, 0);
5814 mutex_unlock(&priv->mutex); 5716 mutex_unlock(&priv->mutex);
5815 5717
5816 if (rc) { 5718 if (rc) {