aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c116
1 files changed, 9 insertions, 107 deletions
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) {