diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-04-16 19:34:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:10 -0400 |
commit | 947b13a7ccd31d8adbf41f466d6a1c770461596a (patch) | |
tree | 1cbb139f37aefdf6d1120ff2a15b1c657c918dfc /drivers/net/wireless/iwlwifi | |
parent | f0832f137c21d130998a0f97f97ac01a2d97210b (diff) |
iwlwifi: move find station to iwl-sta.c
This patch move iwl_find_station into iwl-sta.c file
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 10 |
5 files changed, 48 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index b608e1ca8b40..557912af1ff6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -2190,7 +2190,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2190 | 2190 | ||
2191 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2191 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && |
2192 | !lq_sta->ibss_sta_added) { | 2192 | !lq_sta->ibss_sta_added) { |
2193 | u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1); | 2193 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
2194 | DECLARE_MAC_BUF(mac); | 2194 | DECLARE_MAC_BUF(mac); |
2195 | 2195 | ||
2196 | if (sta_id == IWL_INVALID_STATION) { | 2196 | if (sta_id == IWL_INVALID_STATION) { |
@@ -2268,7 +2268,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2268 | 2268 | ||
2269 | lq_sta->ibss_sta_added = 0; | 2269 | lq_sta->ibss_sta_added = 0; |
2270 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2270 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { |
2271 | u8 sta_id = iwl4965_hw_find_station(priv, sta->addr); | 2271 | u8 sta_id = iwl_find_station(priv, sta->addr); |
2272 | DECLARE_MAC_BUF(mac); | 2272 | DECLARE_MAC_BUF(mac); |
2273 | 2273 | ||
2274 | /* for IBSS the call are from tasklet */ | 2274 | /* for IBSS the call are from tasklet */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index be4cc5ffa742..f318c50a1a8f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -492,38 +492,6 @@ int iwl4965_hw_rxq_stop(struct iwl_priv *priv) | |||
492 | return 0; | 492 | return 0; |
493 | } | 493 | } |
494 | 494 | ||
495 | u8 iwl4965_hw_find_station(struct iwl_priv *priv, const u8 *addr) | ||
496 | { | ||
497 | int i; | ||
498 | int start = 0; | ||
499 | int ret = IWL_INVALID_STATION; | ||
500 | unsigned long flags; | ||
501 | DECLARE_MAC_BUF(mac); | ||
502 | |||
503 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) || | ||
504 | (priv->iw_mode == IEEE80211_IF_TYPE_AP)) | ||
505 | start = IWL_STA_ID; | ||
506 | |||
507 | if (is_broadcast_ether_addr(addr)) | ||
508 | return priv->hw_params.bcast_sta_id; | ||
509 | |||
510 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
511 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
512 | if ((priv->stations[i].used) && | ||
513 | (!compare_ether_addr | ||
514 | (priv->stations[i].sta.sta.addr, addr))) { | ||
515 | ret = i; | ||
516 | goto out; | ||
517 | } | ||
518 | |||
519 | IWL_DEBUG_ASSOC_LIMIT("can not find STA %s total %d\n", | ||
520 | print_mac(mac, addr), priv->num_stations); | ||
521 | |||
522 | out: | ||
523 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
524 | return ret; | ||
525 | } | ||
526 | |||
527 | static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) | 495 | static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) |
528 | { | 496 | { |
529 | int ret; | 497 | int ret; |
@@ -3125,7 +3093,7 @@ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) | |||
3125 | static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) | 3093 | static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) |
3126 | { | 3094 | { |
3127 | /* FIXME: need locking over ps_status ??? */ | 3095 | /* FIXME: need locking over ps_status ??? */ |
3128 | u8 sta_id = iwl4965_hw_find_station(priv, addr); | 3096 | u8 sta_id = iwl_find_station(priv, addr); |
3129 | 3097 | ||
3130 | if (sta_id != IWL_INVALID_STATION) { | 3098 | if (sta_id != IWL_INVALID_STATION) { |
3131 | u8 sta_awake = priv->stations[sta_id]. | 3099 | u8 sta_awake = priv->stations[sta_id]. |
@@ -4112,7 +4080,7 @@ static int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, const u8 *da, | |||
4112 | IWL_WARNING("%s on da = %s tid = %d\n", | 4080 | IWL_WARNING("%s on da = %s tid = %d\n", |
4113 | __func__, print_mac(mac, da), tid); | 4081 | __func__, print_mac(mac, da), tid); |
4114 | 4082 | ||
4115 | sta_id = iwl4965_hw_find_station(priv, da); | 4083 | sta_id = iwl_find_station(priv, da); |
4116 | if (sta_id == IWL_INVALID_STATION) | 4084 | if (sta_id == IWL_INVALID_STATION) |
4117 | return -ENXIO; | 4085 | return -ENXIO; |
4118 | 4086 | ||
@@ -4171,7 +4139,7 @@ static int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, const u8 *da, | |||
4171 | else | 4139 | else |
4172 | return -EINVAL; | 4140 | return -EINVAL; |
4173 | 4141 | ||
4174 | sta_id = iwl4965_hw_find_station(priv, da); | 4142 | sta_id = iwl_find_station(priv, da); |
4175 | 4143 | ||
4176 | if (sta_id == IWL_INVALID_STATION) | 4144 | if (sta_id == IWL_INVALID_STATION) |
4177 | return -ENXIO; | 4145 | return -ENXIO; |
@@ -4221,7 +4189,7 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
4221 | 4189 | ||
4222 | IWL_DEBUG_HT("A-MPDU action on da=%s tid=%d ", | 4190 | IWL_DEBUG_HT("A-MPDU action on da=%s tid=%d ", |
4223 | print_mac(mac, addr), tid); | 4191 | print_mac(mac, addr), tid); |
4224 | sta_id = iwl4965_hw_find_station(priv, addr); | 4192 | sta_id = iwl_find_station(priv, addr); |
4225 | switch (action) { | 4193 | switch (action) { |
4226 | case IEEE80211_AMPDU_RX_START: | 4194 | case IEEE80211_AMPDU_RX_START: |
4227 | IWL_DEBUG_HT("start Rx\n"); | 4195 | IWL_DEBUG_HT("start Rx\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index d728dd837e97..b51243f46938 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -733,14 +733,14 @@ extern void iwl4965_disable_events(struct iwl_priv *priv); | |||
733 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); | 733 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); |
734 | 734 | ||
735 | /** | 735 | /** |
736 | * iwl4965_hw_find_station - Find station id for a given BSSID | 736 | * iwl_find_station - Find station id for a given BSSID |
737 | * @bssid: MAC address of station ID to find | 737 | * @bssid: MAC address of station ID to find |
738 | * | 738 | * |
739 | * NOTE: This should not be hardware specific but the code has | 739 | * NOTE: This should not be hardware specific but the code has |
740 | * not yet been merged into a single common layer for managing the | 740 | * not yet been merged into a single common layer for managing the |
741 | * station tables. | 741 | * station tables. |
742 | */ | 742 | */ |
743 | extern u8 iwl4965_hw_find_station(struct iwl_priv *priv, const u8 *bssid); | 743 | extern u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid); |
744 | 744 | ||
745 | extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel); | 745 | extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel); |
746 | extern int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); | 746 | extern int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index e4fdfaa2b9b2..fa463ce6399b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -28,6 +28,7 @@ | |||
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #include <net/mac80211.h> | 30 | #include <net/mac80211.h> |
31 | #include <linux/etherdevice.h> | ||
31 | 32 | ||
32 | #include "iwl-eeprom.h" | 33 | #include "iwl-eeprom.h" |
33 | #include "iwl-4965.h" | 34 | #include "iwl-4965.h" |
@@ -38,6 +39,40 @@ | |||
38 | #include "iwl-4965.h" | 39 | #include "iwl-4965.h" |
39 | #include "iwl-sta.h" | 40 | #include "iwl-sta.h" |
40 | 41 | ||
42 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | ||
43 | { | ||
44 | int i; | ||
45 | int start = 0; | ||
46 | int ret = IWL_INVALID_STATION; | ||
47 | unsigned long flags; | ||
48 | DECLARE_MAC_BUF(mac); | ||
49 | |||
50 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) || | ||
51 | (priv->iw_mode == IEEE80211_IF_TYPE_AP)) | ||
52 | start = IWL_STA_ID; | ||
53 | |||
54 | if (is_broadcast_ether_addr(addr)) | ||
55 | return priv->hw_params.bcast_sta_id; | ||
56 | |||
57 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
58 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
59 | if (priv->stations[i].used && | ||
60 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
61 | addr))) { | ||
62 | ret = i; | ||
63 | goto out; | ||
64 | } | ||
65 | |||
66 | IWL_DEBUG_ASSOC_LIMIT("can not find STA %s total %d\n", | ||
67 | print_mac(mac, addr), priv->num_stations); | ||
68 | |||
69 | out: | ||
70 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
71 | return ret; | ||
72 | } | ||
73 | EXPORT_SYMBOL(iwl_find_station); | ||
74 | |||
75 | |||
41 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | 76 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv) |
42 | { | 77 | { |
43 | int i; | 78 | int i; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 8a68ff4323de..c8cbf70600da 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -2076,7 +2076,7 @@ static int iwl4965_get_sta_id(struct iwl_priv *priv, | |||
2076 | 2076 | ||
2077 | /* If we are an AP, then find the station, or use BCAST */ | 2077 | /* If we are an AP, then find the station, or use BCAST */ |
2078 | case IEEE80211_IF_TYPE_AP: | 2078 | case IEEE80211_IF_TYPE_AP: |
2079 | sta_id = iwl4965_hw_find_station(priv, hdr->addr1); | 2079 | sta_id = iwl_find_station(priv, hdr->addr1); |
2080 | if (sta_id != IWL_INVALID_STATION) | 2080 | if (sta_id != IWL_INVALID_STATION) |
2081 | return sta_id; | 2081 | return sta_id; |
2082 | return priv->hw_params.bcast_sta_id; | 2082 | return priv->hw_params.bcast_sta_id; |
@@ -2084,7 +2084,7 @@ static int iwl4965_get_sta_id(struct iwl_priv *priv, | |||
2084 | /* If this frame is going out to an IBSS network, find the station, | 2084 | /* If this frame is going out to an IBSS network, find the station, |
2085 | * or create a new station table entry */ | 2085 | * or create a new station table entry */ |
2086 | case IEEE80211_IF_TYPE_IBSS: | 2086 | case IEEE80211_IF_TYPE_IBSS: |
2087 | sta_id = iwl4965_hw_find_station(priv, hdr->addr1); | 2087 | sta_id = iwl_find_station(priv, hdr->addr1); |
2088 | if (sta_id != IWL_INVALID_STATION) | 2088 | if (sta_id != IWL_INVALID_STATION) |
2089 | return sta_id; | 2089 | return sta_id; |
2090 | 2090 | ||
@@ -2778,7 +2778,7 @@ static inline int iwl4965_get_ra_sta_id(struct iwl_priv *priv, | |||
2778 | return IWL_AP_ID; | 2778 | return IWL_AP_ID; |
2779 | else { | 2779 | else { |
2780 | u8 *da = ieee80211_get_DA(hdr); | 2780 | u8 *da = ieee80211_get_DA(hdr); |
2781 | return iwl4965_hw_find_station(priv, da); | 2781 | return iwl_find_station(priv, da); |
2782 | } | 2782 | } |
2783 | } | 2783 | } |
2784 | 2784 | ||
@@ -6768,7 +6768,7 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
6768 | 6768 | ||
6769 | IWL_DEBUG_MAC80211("enter\n"); | 6769 | IWL_DEBUG_MAC80211("enter\n"); |
6770 | 6770 | ||
6771 | sta_id = iwl4965_hw_find_station(priv, addr); | 6771 | sta_id = iwl_find_station(priv, addr); |
6772 | if (sta_id == IWL_INVALID_STATION) { | 6772 | if (sta_id == IWL_INVALID_STATION) { |
6773 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | 6773 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", |
6774 | print_mac(mac, addr)); | 6774 | print_mac(mac, addr)); |
@@ -6824,7 +6824,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
6824 | /* only support pairwise keys */ | 6824 | /* only support pairwise keys */ |
6825 | return -EOPNOTSUPP; | 6825 | return -EOPNOTSUPP; |
6826 | 6826 | ||
6827 | sta_id = iwl4965_hw_find_station(priv, addr); | 6827 | sta_id = iwl_find_station(priv, addr); |
6828 | if (sta_id == IWL_INVALID_STATION) { | 6828 | if (sta_id == IWL_INVALID_STATION) { |
6829 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | 6829 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", |
6830 | print_mac(mac, addr)); | 6830 | print_mac(mac, addr)); |