aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-04-30 14:30:48 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-05-10 18:09:06 -0400
commitc1182743b688bce7b0bbd7cff78b049e45672cb5 (patch)
tree6206c18abd4422bb67acb5cf32ddbad238143b21 /drivers
parentbdbb612fb2c49111d393a69a08b0328e51913c17 (diff)
iwlwifi: move iwl_find_station() to 4965
4965 code is the only thing that now still needs iwl_find_station(), so move it there and make it static. Everything else can rely on the station data passed by mac80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c44
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h6
3 files changed, 44 insertions, 51 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 93893aec6cc4..d3afddae8d9f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1953,6 +1953,50 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1953 return 0; 1953 return 0;
1954} 1954}
1955 1955
1956static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
1957{
1958 int i;
1959 int start = 0;
1960 int ret = IWL_INVALID_STATION;
1961 unsigned long flags;
1962
1963 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) ||
1964 (priv->iw_mode == NL80211_IFTYPE_AP))
1965 start = IWL_STA_ID;
1966
1967 if (is_broadcast_ether_addr(addr))
1968 return priv->hw_params.bcast_sta_id;
1969
1970 spin_lock_irqsave(&priv->sta_lock, flags);
1971 for (i = start; i < priv->hw_params.max_stations; i++)
1972 if (priv->stations[i].used &&
1973 (!compare_ether_addr(priv->stations[i].sta.sta.addr,
1974 addr))) {
1975 ret = i;
1976 goto out;
1977 }
1978
1979 IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n",
1980 addr, priv->num_stations);
1981
1982 out:
1983 /*
1984 * It may be possible that more commands interacting with stations
1985 * arrive before we completed processing the adding of
1986 * station
1987 */
1988 if (ret != IWL_INVALID_STATION &&
1989 (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) ||
1990 ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) &&
1991 (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) {
1992 IWL_ERR(priv, "Requested station info for sta %d before ready.\n",
1993 ret);
1994 ret = IWL_INVALID_STATION;
1995 }
1996 spin_unlock_irqrestore(&priv->sta_lock, flags);
1997 return ret;
1998}
1999
1956static int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) 2000static int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
1957{ 2001{
1958 if (priv->iw_mode == NL80211_IFTYPE_STATION) { 2002 if (priv->iw_mode == NL80211_IFTYPE_STATION) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index b8053e7f16ac..ba36df5e2c78 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -35,51 +35,6 @@
35#include "iwl-core.h" 35#include "iwl-core.h"
36#include "iwl-sta.h" 36#include "iwl-sta.h"
37 37
38u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
39{
40 int i;
41 int start = 0;
42 int ret = IWL_INVALID_STATION;
43 unsigned long flags;
44
45 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) ||
46 (priv->iw_mode == NL80211_IFTYPE_AP))
47 start = IWL_STA_ID;
48
49 if (is_broadcast_ether_addr(addr))
50 return priv->hw_params.bcast_sta_id;
51
52 spin_lock_irqsave(&priv->sta_lock, flags);
53 for (i = start; i < priv->hw_params.max_stations; i++)
54 if (priv->stations[i].used &&
55 (!compare_ether_addr(priv->stations[i].sta.sta.addr,
56 addr))) {
57 ret = i;
58 goto out;
59 }
60
61 IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n",
62 addr, priv->num_stations);
63
64 out:
65 /*
66 * It may be possible that more commands interacting with stations
67 * arrive before we completed processing the adding of
68 * station
69 */
70 if (ret != IWL_INVALID_STATION &&
71 (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) ||
72 ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) &&
73 (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) {
74 IWL_ERR(priv, "Requested station info for sta %d before ready.\n",
75 ret);
76 ret = IWL_INVALID_STATION;
77 }
78 spin_unlock_irqrestore(&priv->sta_lock, flags);
79 return ret;
80}
81EXPORT_SYMBOL(iwl_find_station);
82
83/* priv->sta_lock must be held */ 38/* priv->sta_lock must be held */
84static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) 39static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
85{ 40{
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 08d4bc1363f1..6872bcfe7de1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -43,12 +43,6 @@
43#define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ 43#define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */
44 44
45 45
46/**
47 * iwl_find_station - Find station id for a given BSSID
48 * @bssid: MAC address of station ID to find
49 */
50u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid);
51
52int iwl_remove_default_wep_key(struct iwl_priv *priv, 46int iwl_remove_default_wep_key(struct iwl_priv *priv,
53 struct ieee80211_key_conf *key); 47 struct ieee80211_key_conf *key);
54int iwl_set_default_wep_key(struct iwl_priv *priv, 48int iwl_set_default_wep_key(struct iwl_priv *priv,