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.c145
1 files changed, 16 insertions, 129 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a7d18fea89d..4a22d3fba75b 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2035,36 +2035,6 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
2035 return rc; 2035 return rc;
2036} 2036}
2037 2037
2038int iwl3945_is_network_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
2039{
2040 /* Filter incoming packets to determine if they are targeted toward
2041 * this network, discarding packets coming from ourselves */
2042 switch (priv->iw_mode) {
2043 case IEEE80211_IF_TYPE_IBSS: /* Header: Dest. | Source | BSSID */
2044 /* packets from our adapter are dropped (echo) */
2045 if (!compare_ether_addr(header->addr2, priv->mac_addr))
2046 return 0;
2047 /* {broad,multi}cast packets to our IBSS go through */
2048 if (is_multicast_ether_addr(header->addr1))
2049 return !compare_ether_addr(header->addr3, priv->bssid);
2050 /* packets to our adapter go through */
2051 return !compare_ether_addr(header->addr1, priv->mac_addr);
2052 case IEEE80211_IF_TYPE_STA: /* Header: Dest. | AP{BSSID} | Source */
2053 /* packets from our adapter are dropped (echo) */
2054 if (!compare_ether_addr(header->addr3, priv->mac_addr))
2055 return 0;
2056 /* {broad,multi}cast packets to our BSS go through */
2057 if (is_multicast_ether_addr(header->addr1))
2058 return !compare_ether_addr(header->addr2, priv->bssid);
2059 /* packets to our adapter go through */
2060 return !compare_ether_addr(header->addr1, priv->mac_addr);
2061 default:
2062 return 1;
2063 }
2064
2065 return 1;
2066}
2067
2068/** 2038/**
2069 * iwl3945_scan_cancel - Cancel any currently executing HW scan 2039 * iwl3945_scan_cancel - Cancel any currently executing HW scan
2070 * 2040 *
@@ -2117,20 +2087,6 @@ static int iwl3945_scan_cancel_timeout(struct iwl3945_priv *priv, unsigned long
2117 return ret; 2087 return ret;
2118} 2088}
2119 2089
2120static void iwl3945_sequence_reset(struct iwl3945_priv *priv)
2121{
2122 /* Reset ieee stats */
2123
2124 /* We don't reset the net_device_stats (ieee->stats) on
2125 * re-association */
2126
2127 priv->last_seq_num = -1;
2128 priv->last_frag_num = -1;
2129 priv->last_packet_time = 0;
2130
2131 iwl3945_scan_cancel(priv);
2132}
2133
2134#define MAX_UCODE_BEACON_INTERVAL 1024 2090#define MAX_UCODE_BEACON_INTERVAL 1024
2135#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 2091#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA)
2136 2092
@@ -2925,72 +2881,6 @@ void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
2925 } 2881 }
2926} 2882}
2927 2883
2928#define IWL_PACKET_RETRY_TIME HZ
2929
2930int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
2931{
2932 u16 sc = le16_to_cpu(header->seq_ctrl);
2933 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
2934 u16 frag = sc & IEEE80211_SCTL_FRAG;
2935 u16 *last_seq, *last_frag;
2936 unsigned long *last_time;
2937
2938 switch (priv->iw_mode) {
2939 case IEEE80211_IF_TYPE_IBSS:{
2940 struct list_head *p;
2941 struct iwl3945_ibss_seq *entry = NULL;
2942 u8 *mac = header->addr2;
2943 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1);
2944
2945 __list_for_each(p, &priv->ibss_mac_hash[index]) {
2946 entry = list_entry(p, struct iwl3945_ibss_seq, list);
2947 if (!compare_ether_addr(entry->mac, mac))
2948 break;
2949 }
2950 if (p == &priv->ibss_mac_hash[index]) {
2951 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
2952 if (!entry) {
2953 IWL_ERROR("Cannot malloc new mac entry\n");
2954 return 0;
2955 }
2956 memcpy(entry->mac, mac, ETH_ALEN);
2957 entry->seq_num = seq;
2958 entry->frag_num = frag;
2959 entry->packet_time = jiffies;
2960 list_add(&entry->list, &priv->ibss_mac_hash[index]);
2961 return 0;
2962 }
2963 last_seq = &entry->seq_num;
2964 last_frag = &entry->frag_num;
2965 last_time = &entry->packet_time;
2966 break;
2967 }
2968 case IEEE80211_IF_TYPE_STA:
2969 last_seq = &priv->last_seq_num;
2970 last_frag = &priv->last_frag_num;
2971 last_time = &priv->last_packet_time;
2972 break;
2973 default:
2974 return 0;
2975 }
2976 if ((*last_seq == seq) &&
2977 time_after(*last_time + IWL_PACKET_RETRY_TIME, jiffies)) {
2978 if (*last_frag == frag)
2979 goto drop;
2980 if (*last_frag + 1 != frag)
2981 /* out-of-order fragment */
2982 goto drop;
2983 } else
2984 *last_seq = seq;
2985
2986 *last_frag = frag;
2987 *last_time = jiffies;
2988 return 0;
2989
2990 drop:
2991 return 1;
2992}
2993
2994#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 2884#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
2995 2885
2996#include "iwl-spectrum.h" 2886#include "iwl-spectrum.h"
@@ -6531,8 +6421,6 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
6531 break; 6421 break;
6532 } 6422 }
6533 6423
6534 iwl3945_sequence_reset(priv);
6535
6536 iwl3945_activate_qos(priv, 0); 6424 iwl3945_activate_qos(priv, 0);
6537 6425
6538 /* we have just associated, don't start scan too early */ 6426 /* we have just associated, don't start scan too early */
@@ -6907,6 +6795,9 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
6907 * clear sta table, add BCAST sta... */ 6795 * clear sta table, add BCAST sta... */
6908} 6796}
6909 6797
6798/* temporary */
6799static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb);
6800
6910static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, 6801static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6911 struct ieee80211_vif *vif, 6802 struct ieee80211_vif *vif,
6912 struct ieee80211_if_conf *conf) 6803 struct ieee80211_if_conf *conf)
@@ -6924,10 +6815,21 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6924 return 0; 6815 return 0;
6925 } 6816 }
6926 6817
6818 /* handle this temporarily here */
6819 if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS &&
6820 conf->changed & IEEE80211_IFCC_BEACON) {
6821 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
6822 if (!beacon)
6823 return -ENOMEM;
6824 rc = iwl3945_mac_beacon_update(hw, beacon);
6825 if (rc)
6826 return rc;
6827 }
6828
6927 /* XXX: this MUST use conf->mac_addr */ 6829 /* XXX: this MUST use conf->mac_addr */
6928 6830
6929 if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && 6831 if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) &&
6930 (!conf->beacon || !conf->ssid_len)) { 6832 (!conf->ssid_len)) {
6931 IWL_DEBUG_MAC80211 6833 IWL_DEBUG_MAC80211
6932 ("Leaving in AP mode because HostAPD is not ready.\n"); 6834 ("Leaving in AP mode because HostAPD is not ready.\n");
6933 return 0; 6835 return 0;
@@ -6959,7 +6861,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6959 if (priv->ibss_beacon) 6861 if (priv->ibss_beacon)
6960 dev_kfree_skb(priv->ibss_beacon); 6862 dev_kfree_skb(priv->ibss_beacon);
6961 6863
6962 priv->ibss_beacon = conf->beacon; 6864 priv->ibss_beacon = ieee80211_beacon_get(hw, vif);
6963 } 6865 }
6964 6866
6965 if (iwl3945_is_rfkill(priv)) 6867 if (iwl3945_is_rfkill(priv))
@@ -7940,7 +7842,6 @@ static struct ieee80211_ops iwl3945_hw_ops = {
7940 .conf_tx = iwl3945_mac_conf_tx, 7842 .conf_tx = iwl3945_mac_conf_tx,
7941 .get_tsf = iwl3945_mac_get_tsf, 7843 .get_tsf = iwl3945_mac_get_tsf,
7942 .reset_tsf = iwl3945_mac_reset_tsf, 7844 .reset_tsf = iwl3945_mac_reset_tsf,
7943 .beacon_update = iwl3945_mac_beacon_update,
7944 .hw_scan = iwl3945_mac_hw_scan 7845 .hw_scan = iwl3945_mac_hw_scan
7945}; 7846};
7946 7847
@@ -7950,7 +7851,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7950 struct iwl3945_priv *priv; 7851 struct iwl3945_priv *priv;
7951 struct ieee80211_hw *hw; 7852 struct ieee80211_hw *hw;
7952 struct iwl_3945_cfg *cfg = (struct iwl_3945_cfg *)(ent->driver_data); 7853 struct iwl_3945_cfg *cfg = (struct iwl_3945_cfg *)(ent->driver_data);
7953 int i;
7954 unsigned long flags; 7854 unsigned long flags;
7955 DECLARE_MAC_BUF(mac); 7855 DECLARE_MAC_BUF(mac);
7956 7856
@@ -8011,9 +7911,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8011 spin_lock_init(&priv->sta_lock); 7911 spin_lock_init(&priv->sta_lock);
8012 spin_lock_init(&priv->hcmd_lock); 7912 spin_lock_init(&priv->hcmd_lock);
8013 7913
8014 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++)
8015 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);
8016
8017 INIT_LIST_HEAD(&priv->free_frames); 7914 INIT_LIST_HEAD(&priv->free_frames);
8018 7915
8019 mutex_init(&priv->mutex); 7916 mutex_init(&priv->mutex);
@@ -8186,8 +8083,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8186static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) 8083static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8187{ 8084{
8188 struct iwl3945_priv *priv = pci_get_drvdata(pdev); 8085 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8189 struct list_head *p, *q;
8190 int i;
8191 unsigned long flags; 8086 unsigned long flags;
8192 8087
8193 if (!priv) 8088 if (!priv)
@@ -8208,14 +8103,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8208 8103
8209 iwl_synchronize_irq(priv); 8104 iwl_synchronize_irq(priv);
8210 8105
8211 /* Free MAC hash list for ADHOC */
8212 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
8213 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) {
8214 list_del(p);
8215 kfree(list_entry(p, struct iwl3945_ibss_seq, list));
8216 }
8217 }
8218
8219 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 8106 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8220 8107
8221 iwl3945_rfkill_unregister(priv); 8108 iwl3945_rfkill_unregister(priv);