diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2009-10-22 09:30:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:48:36 -0400 |
commit | 2d46502dce3c79c3c15ac537cb271911f58d12d1 (patch) | |
tree | 7bf08660d6316121e2b08fad286fdbf75e14128d /drivers/net/wireless/libertas | |
parent | 243e84e91ed810f7dca5ba1c2d1a611811948566 (diff) |
libertas: move scan/assoc related stuff
Another cfg80211-preparation patch: removes some code/definitions from
main.c and dev.h and put's it into assoc.c/.h, scan.c/.h.
No function change.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/assoc.h | 122 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/decl.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/defs.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 155 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 182 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 184 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.h | 30 |
9 files changed, 348 insertions, 340 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 5a280ebadba4..2ccfeca32cde 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -23,6 +23,13 @@ static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) = | |||
23 | */ | 23 | */ |
24 | #define CAPINFO_MASK (~(0xda00)) | 24 | #define CAPINFO_MASK (~(0xda00)) |
25 | 25 | ||
26 | /** | ||
27 | * 802.11b/g supported bitrates (in 500Kb/s units) | ||
28 | */ | ||
29 | u8 lbs_bg_rates[MAX_RATES] = | ||
30 | { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, | ||
31 | 0x00, 0x00 }; | ||
32 | |||
26 | 33 | ||
27 | /** | 34 | /** |
28 | * @brief This function finds common rates between rates and card rates. | 35 | * @brief This function finds common rates between rates and card rates. |
diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index 6e765e9f91a3..610d14c14cd4 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h | |||
@@ -3,7 +3,127 @@ | |||
3 | #ifndef _LBS_ASSOC_H_ | 3 | #ifndef _LBS_ASSOC_H_ |
4 | #define _LBS_ASSOC_H_ | 4 | #define _LBS_ASSOC_H_ |
5 | 5 | ||
6 | #include "dev.h" | 6 | |
7 | #include "defs.h" | ||
8 | #include "host.h" | ||
9 | |||
10 | |||
11 | struct lbs_private; | ||
12 | |||
13 | /* | ||
14 | * In theory, the IE is limited to the IE length, 255, | ||
15 | * but in practice 64 bytes are enough. | ||
16 | */ | ||
17 | #define MAX_WPA_IE_LEN 64 | ||
18 | |||
19 | |||
20 | |||
21 | struct lbs_802_11_security { | ||
22 | u8 WPAenabled; | ||
23 | u8 WPA2enabled; | ||
24 | u8 wep_enabled; | ||
25 | u8 auth_mode; | ||
26 | u32 key_mgmt; | ||
27 | }; | ||
28 | |||
29 | /** Current Basic Service Set State Structure */ | ||
30 | struct current_bss_params { | ||
31 | /** bssid */ | ||
32 | u8 bssid[ETH_ALEN]; | ||
33 | /** ssid */ | ||
34 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
35 | u8 ssid_len; | ||
36 | |||
37 | /** band */ | ||
38 | u8 band; | ||
39 | /** channel */ | ||
40 | u8 channel; | ||
41 | /** zero-terminated array of supported data rates */ | ||
42 | u8 rates[MAX_RATES + 1]; | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * @brief Structure used to store information for each beacon/probe response | ||
47 | */ | ||
48 | struct bss_descriptor { | ||
49 | u8 bssid[ETH_ALEN]; | ||
50 | |||
51 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
52 | u8 ssid_len; | ||
53 | |||
54 | u16 capability; | ||
55 | u32 rssi; | ||
56 | u32 channel; | ||
57 | u16 beaconperiod; | ||
58 | __le16 atimwindow; | ||
59 | |||
60 | /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ | ||
61 | u8 mode; | ||
62 | |||
63 | /* zero-terminated array of supported data rates */ | ||
64 | u8 rates[MAX_RATES + 1]; | ||
65 | |||
66 | unsigned long last_scanned; | ||
67 | |||
68 | union ieee_phy_param_set phy; | ||
69 | union ieee_ss_param_set ss; | ||
70 | |||
71 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
72 | size_t wpa_ie_len; | ||
73 | u8 rsn_ie[MAX_WPA_IE_LEN]; | ||
74 | size_t rsn_ie_len; | ||
75 | |||
76 | u8 mesh; | ||
77 | |||
78 | struct list_head list; | ||
79 | }; | ||
80 | |||
81 | /** Association request | ||
82 | * | ||
83 | * Encapsulates all the options that describe a specific assocation request | ||
84 | * or configuration of the wireless card's radio, mode, and security settings. | ||
85 | */ | ||
86 | struct assoc_request { | ||
87 | #define ASSOC_FLAG_SSID 1 | ||
88 | #define ASSOC_FLAG_CHANNEL 2 | ||
89 | #define ASSOC_FLAG_BAND 3 | ||
90 | #define ASSOC_FLAG_MODE 4 | ||
91 | #define ASSOC_FLAG_BSSID 5 | ||
92 | #define ASSOC_FLAG_WEP_KEYS 6 | ||
93 | #define ASSOC_FLAG_WEP_TX_KEYIDX 7 | ||
94 | #define ASSOC_FLAG_WPA_MCAST_KEY 8 | ||
95 | #define ASSOC_FLAG_WPA_UCAST_KEY 9 | ||
96 | #define ASSOC_FLAG_SECINFO 10 | ||
97 | #define ASSOC_FLAG_WPA_IE 11 | ||
98 | unsigned long flags; | ||
99 | |||
100 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
101 | u8 ssid_len; | ||
102 | u8 channel; | ||
103 | u8 band; | ||
104 | u8 mode; | ||
105 | u8 bssid[ETH_ALEN] __attribute__ ((aligned (2))); | ||
106 | |||
107 | /** WEP keys */ | ||
108 | struct enc_key wep_keys[4]; | ||
109 | u16 wep_tx_keyidx; | ||
110 | |||
111 | /** WPA keys */ | ||
112 | struct enc_key wpa_mcast_key; | ||
113 | struct enc_key wpa_unicast_key; | ||
114 | |||
115 | struct lbs_802_11_security secinfo; | ||
116 | |||
117 | /** WPA Information Elements*/ | ||
118 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
119 | u8 wpa_ie_len; | ||
120 | |||
121 | /* BSS to associate with for infrastructure of Ad-Hoc join */ | ||
122 | struct bss_descriptor bss; | ||
123 | }; | ||
124 | |||
125 | |||
126 | extern u8 lbs_bg_rates[MAX_RATES]; | ||
7 | 127 | ||
8 | void lbs_association_worker(struct work_struct *work); | 128 | void lbs_association_worker(struct work_struct *work); |
9 | struct assoc_request *lbs_get_association_request(struct lbs_private *priv); | 129 | struct assoc_request *lbs_get_association_request(struct lbs_private *priv); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index dd4f98231352..ec65be0c4d93 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "dev.h" | 12 | #include "dev.h" |
13 | #include "assoc.h" | 13 | #include "assoc.h" |
14 | #include "wext.h" | 14 | #include "wext.h" |
15 | #include "scan.h" | ||
15 | #include "cmd.h" | 16 | #include "cmd.h" |
16 | 17 | ||
17 | static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); | 18 | static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); |
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 20fa8176cd88..7d8323876c52 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | #include "defs.h" | 11 | #include "defs.h" |
12 | 12 | ||
13 | |||
14 | extern const struct ethtool_ops lbs_ethtool_ops; | ||
15 | |||
13 | /** Function Prototype Declaration */ | 16 | /** Function Prototype Declaration */ |
14 | struct lbs_private; | 17 | struct lbs_private; |
15 | struct sk_buff; | 18 | struct sk_buff; |
@@ -33,7 +36,6 @@ u8 lbs_data_rate_to_fw_index(u32 rate); | |||
33 | /** The proc fs interface */ | 36 | /** The proc fs interface */ |
34 | netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, | 37 | netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, |
35 | struct net_device *dev); | 38 | struct net_device *dev); |
36 | int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); | ||
37 | 39 | ||
38 | int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); | 40 | int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); |
39 | 41 | ||
@@ -49,8 +51,6 @@ void lbs_persist_config_init(struct net_device *net); | |||
49 | void lbs_persist_config_remove(struct net_device *net); | 51 | void lbs_persist_config_remove(struct net_device *net); |
50 | 52 | ||
51 | /* main.c */ | 53 | /* main.c */ |
52 | struct chan_freq_power *lbs_get_region_cfp_table(u8 region, | ||
53 | int *cfp_no); | ||
54 | struct lbs_private *lbs_add_card(void *card, struct device *dmdev); | 54 | struct lbs_private *lbs_add_card(void *card, struct device *dmdev); |
55 | void lbs_remove_card(struct lbs_private *priv); | 55 | void lbs_remove_card(struct lbs_private *priv); |
56 | int lbs_start_card(struct lbs_private *priv); | 56 | int lbs_start_card(struct lbs_private *priv); |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 1cf5d5985dac..6b6ea9f7bf5b 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -322,7 +322,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in | |||
322 | extern const char lbs_driver_version[]; | 322 | extern const char lbs_driver_version[]; |
323 | extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; | 323 | extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; |
324 | 324 | ||
325 | extern u8 lbs_bg_rates[MAX_RATES]; | ||
326 | 325 | ||
327 | /** ENUM definition*/ | 326 | /** ENUM definition*/ |
328 | /** SNRNF_TYPE */ | 327 | /** SNRNF_TYPE */ |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 50b457706bad..cc245820d3f2 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -6,75 +6,10 @@ | |||
6 | #ifndef _LBS_DEV_H_ | 6 | #ifndef _LBS_DEV_H_ |
7 | #define _LBS_DEV_H_ | 7 | #define _LBS_DEV_H_ |
8 | 8 | ||
9 | #include <linux/netdevice.h> | 9 | #include "scan.h" |
10 | #include <linux/wireless.h> | 10 | #include "assoc.h" |
11 | #include <linux/ethtool.h> | ||
12 | #include <linux/debugfs.h> | ||
13 | 11 | ||
14 | #include "defs.h" | ||
15 | #include "host.h" | ||
16 | 12 | ||
17 | extern const struct ethtool_ops lbs_ethtool_ops; | ||
18 | |||
19 | #define MAX_BSSID_PER_CHANNEL 16 | ||
20 | |||
21 | #define NR_TX_QUEUE 3 | ||
22 | |||
23 | /* For the extended Scan */ | ||
24 | #define MAX_EXTENDED_SCAN_BSSID_LIST MAX_BSSID_PER_CHANNEL * \ | ||
25 | MRVDRV_MAX_CHANNEL_SIZE + 1 | ||
26 | |||
27 | #define MAX_REGION_CHANNEL_NUM 2 | ||
28 | |||
29 | /** Chan-freq-TxPower mapping table*/ | ||
30 | struct chan_freq_power { | ||
31 | /** channel Number */ | ||
32 | u16 channel; | ||
33 | /** frequency of this channel */ | ||
34 | u32 freq; | ||
35 | /** Max allowed Tx power level */ | ||
36 | u16 maxtxpower; | ||
37 | /** TRUE:channel unsupported; FLASE:supported*/ | ||
38 | u8 unsupported; | ||
39 | }; | ||
40 | |||
41 | /** region-band mapping table*/ | ||
42 | struct region_channel { | ||
43 | /** TRUE if this entry is valid */ | ||
44 | u8 valid; | ||
45 | /** region code for US, Japan ... */ | ||
46 | u8 region; | ||
47 | /** band B/G/A, used for BAND_CONFIG cmd */ | ||
48 | u8 band; | ||
49 | /** Actual No. of elements in the array below */ | ||
50 | u8 nrcfp; | ||
51 | /** chan-freq-txpower mapping table*/ | ||
52 | struct chan_freq_power *CFP; | ||
53 | }; | ||
54 | |||
55 | struct lbs_802_11_security { | ||
56 | u8 WPAenabled; | ||
57 | u8 WPA2enabled; | ||
58 | u8 wep_enabled; | ||
59 | u8 auth_mode; | ||
60 | u32 key_mgmt; | ||
61 | }; | ||
62 | |||
63 | /** Current Basic Service Set State Structure */ | ||
64 | struct current_bss_params { | ||
65 | /** bssid */ | ||
66 | u8 bssid[ETH_ALEN]; | ||
67 | /** ssid */ | ||
68 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
69 | u8 ssid_len; | ||
70 | |||
71 | /** band */ | ||
72 | u8 band; | ||
73 | /** channel */ | ||
74 | u8 channel; | ||
75 | /** zero-terminated array of supported data rates */ | ||
76 | u8 rates[MAX_RATES + 1]; | ||
77 | }; | ||
78 | 13 | ||
79 | /** sleep_params */ | 14 | /** sleep_params */ |
80 | struct sleep_params { | 15 | struct sleep_params { |
@@ -295,12 +230,6 @@ struct lbs_private { | |||
295 | struct enc_key wpa_mcast_key; | 230 | struct enc_key wpa_mcast_key; |
296 | struct enc_key wpa_unicast_key; | 231 | struct enc_key wpa_unicast_key; |
297 | 232 | ||
298 | /* | ||
299 | * In theory, the IE is limited to the IE length, 255, | ||
300 | * but in practice 64 bytes are enough. | ||
301 | */ | ||
302 | #define MAX_WPA_IE_LEN 64 | ||
303 | |||
304 | /** WPA Information Elements*/ | 233 | /** WPA Information Elements*/ |
305 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 234 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
306 | u8 wpa_ie_len; | 235 | u8 wpa_ie_len; |
@@ -334,84 +263,4 @@ struct lbs_private { | |||
334 | 263 | ||
335 | extern struct cmd_confirm_sleep confirm_sleep; | 264 | extern struct cmd_confirm_sleep confirm_sleep; |
336 | 265 | ||
337 | /** | ||
338 | * @brief Structure used to store information for each beacon/probe response | ||
339 | */ | ||
340 | struct bss_descriptor { | ||
341 | u8 bssid[ETH_ALEN]; | ||
342 | |||
343 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
344 | u8 ssid_len; | ||
345 | |||
346 | u16 capability; | ||
347 | u32 rssi; | ||
348 | u32 channel; | ||
349 | u16 beaconperiod; | ||
350 | __le16 atimwindow; | ||
351 | |||
352 | /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ | ||
353 | u8 mode; | ||
354 | |||
355 | /* zero-terminated array of supported data rates */ | ||
356 | u8 rates[MAX_RATES + 1]; | ||
357 | |||
358 | unsigned long last_scanned; | ||
359 | |||
360 | union ieee_phy_param_set phy; | ||
361 | union ieee_ss_param_set ss; | ||
362 | |||
363 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
364 | size_t wpa_ie_len; | ||
365 | u8 rsn_ie[MAX_WPA_IE_LEN]; | ||
366 | size_t rsn_ie_len; | ||
367 | |||
368 | u8 mesh; | ||
369 | |||
370 | struct list_head list; | ||
371 | }; | ||
372 | |||
373 | /** Association request | ||
374 | * | ||
375 | * Encapsulates all the options that describe a specific assocation request | ||
376 | * or configuration of the wireless card's radio, mode, and security settings. | ||
377 | */ | ||
378 | struct assoc_request { | ||
379 | #define ASSOC_FLAG_SSID 1 | ||
380 | #define ASSOC_FLAG_CHANNEL 2 | ||
381 | #define ASSOC_FLAG_BAND 3 | ||
382 | #define ASSOC_FLAG_MODE 4 | ||
383 | #define ASSOC_FLAG_BSSID 5 | ||
384 | #define ASSOC_FLAG_WEP_KEYS 6 | ||
385 | #define ASSOC_FLAG_WEP_TX_KEYIDX 7 | ||
386 | #define ASSOC_FLAG_WPA_MCAST_KEY 8 | ||
387 | #define ASSOC_FLAG_WPA_UCAST_KEY 9 | ||
388 | #define ASSOC_FLAG_SECINFO 10 | ||
389 | #define ASSOC_FLAG_WPA_IE 11 | ||
390 | unsigned long flags; | ||
391 | |||
392 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | ||
393 | u8 ssid_len; | ||
394 | u8 channel; | ||
395 | u8 band; | ||
396 | u8 mode; | ||
397 | u8 bssid[ETH_ALEN] __attribute__ ((aligned (2))); | ||
398 | |||
399 | /** WEP keys */ | ||
400 | struct enc_key wep_keys[4]; | ||
401 | u16 wep_tx_keyidx; | ||
402 | |||
403 | /** WPA keys */ | ||
404 | struct enc_key wpa_mcast_key; | ||
405 | struct enc_key wpa_unicast_key; | ||
406 | |||
407 | struct lbs_802_11_security secinfo; | ||
408 | |||
409 | /** WPA Information Elements*/ | ||
410 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
411 | u8 wpa_ie_len; | ||
412 | |||
413 | /* BSS to associate with for infrastructure of Ad-Hoc join */ | ||
414 | struct bss_descriptor bss; | ||
415 | }; | ||
416 | |||
417 | #endif | 266 | #endif |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 2f87659cc1d3..ee0893334553 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -45,119 +45,6 @@ module_param_named(libertas_debug, lbs_debug, int, 0644); | |||
45 | struct cmd_confirm_sleep confirm_sleep; | 45 | struct cmd_confirm_sleep confirm_sleep; |
46 | 46 | ||
47 | 47 | ||
48 | #define LBS_TX_PWR_DEFAULT 20 /*100mW */ | ||
49 | #define LBS_TX_PWR_US_DEFAULT 20 /*100mW */ | ||
50 | #define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */ | ||
51 | #define LBS_TX_PWR_FR_DEFAULT 20 /*100mW */ | ||
52 | #define LBS_TX_PWR_EMEA_DEFAULT 20 /*100mW */ | ||
53 | |||
54 | /* Format { channel, frequency (MHz), maxtxpower } */ | ||
55 | /* band: 'B/G', region: USA FCC/Canada IC */ | ||
56 | static struct chan_freq_power channel_freq_power_US_BG[] = { | ||
57 | {1, 2412, LBS_TX_PWR_US_DEFAULT}, | ||
58 | {2, 2417, LBS_TX_PWR_US_DEFAULT}, | ||
59 | {3, 2422, LBS_TX_PWR_US_DEFAULT}, | ||
60 | {4, 2427, LBS_TX_PWR_US_DEFAULT}, | ||
61 | {5, 2432, LBS_TX_PWR_US_DEFAULT}, | ||
62 | {6, 2437, LBS_TX_PWR_US_DEFAULT}, | ||
63 | {7, 2442, LBS_TX_PWR_US_DEFAULT}, | ||
64 | {8, 2447, LBS_TX_PWR_US_DEFAULT}, | ||
65 | {9, 2452, LBS_TX_PWR_US_DEFAULT}, | ||
66 | {10, 2457, LBS_TX_PWR_US_DEFAULT}, | ||
67 | {11, 2462, LBS_TX_PWR_US_DEFAULT} | ||
68 | }; | ||
69 | |||
70 | /* band: 'B/G', region: Europe ETSI */ | ||
71 | static struct chan_freq_power channel_freq_power_EU_BG[] = { | ||
72 | {1, 2412, LBS_TX_PWR_EMEA_DEFAULT}, | ||
73 | {2, 2417, LBS_TX_PWR_EMEA_DEFAULT}, | ||
74 | {3, 2422, LBS_TX_PWR_EMEA_DEFAULT}, | ||
75 | {4, 2427, LBS_TX_PWR_EMEA_DEFAULT}, | ||
76 | {5, 2432, LBS_TX_PWR_EMEA_DEFAULT}, | ||
77 | {6, 2437, LBS_TX_PWR_EMEA_DEFAULT}, | ||
78 | {7, 2442, LBS_TX_PWR_EMEA_DEFAULT}, | ||
79 | {8, 2447, LBS_TX_PWR_EMEA_DEFAULT}, | ||
80 | {9, 2452, LBS_TX_PWR_EMEA_DEFAULT}, | ||
81 | {10, 2457, LBS_TX_PWR_EMEA_DEFAULT}, | ||
82 | {11, 2462, LBS_TX_PWR_EMEA_DEFAULT}, | ||
83 | {12, 2467, LBS_TX_PWR_EMEA_DEFAULT}, | ||
84 | {13, 2472, LBS_TX_PWR_EMEA_DEFAULT} | ||
85 | }; | ||
86 | |||
87 | /* band: 'B/G', region: Spain */ | ||
88 | static struct chan_freq_power channel_freq_power_SPN_BG[] = { | ||
89 | {10, 2457, LBS_TX_PWR_DEFAULT}, | ||
90 | {11, 2462, LBS_TX_PWR_DEFAULT} | ||
91 | }; | ||
92 | |||
93 | /* band: 'B/G', region: France */ | ||
94 | static struct chan_freq_power channel_freq_power_FR_BG[] = { | ||
95 | {10, 2457, LBS_TX_PWR_FR_DEFAULT}, | ||
96 | {11, 2462, LBS_TX_PWR_FR_DEFAULT}, | ||
97 | {12, 2467, LBS_TX_PWR_FR_DEFAULT}, | ||
98 | {13, 2472, LBS_TX_PWR_FR_DEFAULT} | ||
99 | }; | ||
100 | |||
101 | /* band: 'B/G', region: Japan */ | ||
102 | static struct chan_freq_power channel_freq_power_JPN_BG[] = { | ||
103 | {1, 2412, LBS_TX_PWR_JP_DEFAULT}, | ||
104 | {2, 2417, LBS_TX_PWR_JP_DEFAULT}, | ||
105 | {3, 2422, LBS_TX_PWR_JP_DEFAULT}, | ||
106 | {4, 2427, LBS_TX_PWR_JP_DEFAULT}, | ||
107 | {5, 2432, LBS_TX_PWR_JP_DEFAULT}, | ||
108 | {6, 2437, LBS_TX_PWR_JP_DEFAULT}, | ||
109 | {7, 2442, LBS_TX_PWR_JP_DEFAULT}, | ||
110 | {8, 2447, LBS_TX_PWR_JP_DEFAULT}, | ||
111 | {9, 2452, LBS_TX_PWR_JP_DEFAULT}, | ||
112 | {10, 2457, LBS_TX_PWR_JP_DEFAULT}, | ||
113 | {11, 2462, LBS_TX_PWR_JP_DEFAULT}, | ||
114 | {12, 2467, LBS_TX_PWR_JP_DEFAULT}, | ||
115 | {13, 2472, LBS_TX_PWR_JP_DEFAULT}, | ||
116 | {14, 2484, LBS_TX_PWR_JP_DEFAULT} | ||
117 | }; | ||
118 | |||
119 | /** | ||
120 | * the structure for channel, frequency and power | ||
121 | */ | ||
122 | struct region_cfp_table { | ||
123 | u8 region; | ||
124 | struct chan_freq_power *cfp_BG; | ||
125 | int cfp_no_BG; | ||
126 | }; | ||
127 | |||
128 | /** | ||
129 | * the structure for the mapping between region and CFP | ||
130 | */ | ||
131 | static struct region_cfp_table region_cfp_table[] = { | ||
132 | {0x10, /*US FCC */ | ||
133 | channel_freq_power_US_BG, | ||
134 | ARRAY_SIZE(channel_freq_power_US_BG), | ||
135 | } | ||
136 | , | ||
137 | {0x20, /*CANADA IC */ | ||
138 | channel_freq_power_US_BG, | ||
139 | ARRAY_SIZE(channel_freq_power_US_BG), | ||
140 | } | ||
141 | , | ||
142 | {0x30, /*EU*/ channel_freq_power_EU_BG, | ||
143 | ARRAY_SIZE(channel_freq_power_EU_BG), | ||
144 | } | ||
145 | , | ||
146 | {0x31, /*SPAIN*/ channel_freq_power_SPN_BG, | ||
147 | ARRAY_SIZE(channel_freq_power_SPN_BG), | ||
148 | } | ||
149 | , | ||
150 | {0x32, /*FRANCE*/ channel_freq_power_FR_BG, | ||
151 | ARRAY_SIZE(channel_freq_power_FR_BG), | ||
152 | } | ||
153 | , | ||
154 | {0x40, /*JAPAN*/ channel_freq_power_JPN_BG, | ||
155 | ARRAY_SIZE(channel_freq_power_JPN_BG), | ||
156 | } | ||
157 | , | ||
158 | /*Add new region here */ | ||
159 | }; | ||
160 | |||
161 | /** | 48 | /** |
162 | * the table to keep region code | 49 | * the table to keep region code |
163 | */ | 50 | */ |
@@ -165,13 +52,6 @@ u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE] = | |||
165 | { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; | 52 | { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; |
166 | 53 | ||
167 | /** | 54 | /** |
168 | * 802.11b/g supported bitrates (in 500Kb/s units) | ||
169 | */ | ||
170 | u8 lbs_bg_rates[MAX_RATES] = | ||
171 | { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, | ||
172 | 0x00, 0x00 }; | ||
173 | |||
174 | /** | ||
175 | * FW rate table. FW refers to rates by their index in this table, not by the | 55 | * FW rate table. FW refers to rates by their index in this table, not by the |
176 | * rate value itself. Values of 0x00 are | 56 | * rate value itself. Values of 0x00 are |
177 | * reserved positions. | 57 | * reserved positions. |
@@ -1617,68 +1497,6 @@ static void lbs_remove_mesh(struct lbs_private *priv) | |||
1617 | lbs_deb_leave(LBS_DEB_MESH); | 1497 | lbs_deb_leave(LBS_DEB_MESH); |
1618 | } | 1498 | } |
1619 | 1499 | ||
1620 | /** | ||
1621 | * @brief This function finds the CFP in | ||
1622 | * region_cfp_table based on region and band parameter. | ||
1623 | * | ||
1624 | * @param region The region code | ||
1625 | * @param band The band | ||
1626 | * @param cfp_no A pointer to CFP number | ||
1627 | * @return A pointer to CFP | ||
1628 | */ | ||
1629 | struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no) | ||
1630 | { | ||
1631 | int i, end; | ||
1632 | |||
1633 | lbs_deb_enter(LBS_DEB_MAIN); | ||
1634 | |||
1635 | end = ARRAY_SIZE(region_cfp_table); | ||
1636 | |||
1637 | for (i = 0; i < end ; i++) { | ||
1638 | lbs_deb_main("region_cfp_table[i].region=%d\n", | ||
1639 | region_cfp_table[i].region); | ||
1640 | if (region_cfp_table[i].region == region) { | ||
1641 | *cfp_no = region_cfp_table[i].cfp_no_BG; | ||
1642 | lbs_deb_leave(LBS_DEB_MAIN); | ||
1643 | return region_cfp_table[i].cfp_BG; | ||
1644 | } | ||
1645 | } | ||
1646 | |||
1647 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL"); | ||
1648 | return NULL; | ||
1649 | } | ||
1650 | |||
1651 | int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) | ||
1652 | { | ||
1653 | int ret = 0; | ||
1654 | int i = 0; | ||
1655 | |||
1656 | struct chan_freq_power *cfp; | ||
1657 | int cfp_no; | ||
1658 | |||
1659 | lbs_deb_enter(LBS_DEB_MAIN); | ||
1660 | |||
1661 | memset(priv->region_channel, 0, sizeof(priv->region_channel)); | ||
1662 | |||
1663 | cfp = lbs_get_region_cfp_table(region, &cfp_no); | ||
1664 | if (cfp != NULL) { | ||
1665 | priv->region_channel[i].nrcfp = cfp_no; | ||
1666 | priv->region_channel[i].CFP = cfp; | ||
1667 | } else { | ||
1668 | lbs_deb_main("wrong region code %#x in band B/G\n", | ||
1669 | region); | ||
1670 | ret = -1; | ||
1671 | goto out; | ||
1672 | } | ||
1673 | priv->region_channel[i].valid = 1; | ||
1674 | priv->region_channel[i].region = region; | ||
1675 | priv->region_channel[i].band = band; | ||
1676 | i++; | ||
1677 | out: | ||
1678 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); | ||
1679 | return ret; | ||
1680 | } | ||
1681 | |||
1682 | void lbs_queue_event(struct lbs_private *priv, u32 event) | 1500 | void lbs_queue_event(struct lbs_private *priv, u32 event) |
1683 | { | 1501 | { |
1684 | unsigned long flags; | 1502 | unsigned long flags; |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 2700f4b455e3..8273bcd216be 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "decl.h" | 15 | #include "decl.h" |
16 | #include "dev.h" | 16 | #include "dev.h" |
17 | #include "scan.h" | 17 | #include "scan.h" |
18 | #include "assoc.h" | ||
18 | #include "cmd.h" | 19 | #include "cmd.h" |
19 | 20 | ||
20 | //! Approximate amount of data needed to pass a scan result back to iwlist | 21 | //! Approximate amount of data needed to pass a scan result back to iwlist |
@@ -121,6 +122,189 @@ static inline int is_same_network(struct bss_descriptor *src, | |||
121 | 122 | ||
122 | 123 | ||
123 | 124 | ||
125 | /*********************************************************************/ | ||
126 | /* */ | ||
127 | /* Region channel support */ | ||
128 | /* */ | ||
129 | /*********************************************************************/ | ||
130 | |||
131 | #define LBS_TX_PWR_DEFAULT 20 /*100mW */ | ||
132 | #define LBS_TX_PWR_US_DEFAULT 20 /*100mW */ | ||
133 | #define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */ | ||
134 | #define LBS_TX_PWR_FR_DEFAULT 20 /*100mW */ | ||
135 | #define LBS_TX_PWR_EMEA_DEFAULT 20 /*100mW */ | ||
136 | |||
137 | /* Format { channel, frequency (MHz), maxtxpower } */ | ||
138 | /* band: 'B/G', region: USA FCC/Canada IC */ | ||
139 | static struct chan_freq_power channel_freq_power_US_BG[] = { | ||
140 | {1, 2412, LBS_TX_PWR_US_DEFAULT}, | ||
141 | {2, 2417, LBS_TX_PWR_US_DEFAULT}, | ||
142 | {3, 2422, LBS_TX_PWR_US_DEFAULT}, | ||
143 | {4, 2427, LBS_TX_PWR_US_DEFAULT}, | ||
144 | {5, 2432, LBS_TX_PWR_US_DEFAULT}, | ||
145 | {6, 2437, LBS_TX_PWR_US_DEFAULT}, | ||
146 | {7, 2442, LBS_TX_PWR_US_DEFAULT}, | ||
147 | {8, 2447, LBS_TX_PWR_US_DEFAULT}, | ||
148 | {9, 2452, LBS_TX_PWR_US_DEFAULT}, | ||
149 | {10, 2457, LBS_TX_PWR_US_DEFAULT}, | ||
150 | {11, 2462, LBS_TX_PWR_US_DEFAULT} | ||
151 | }; | ||
152 | |||
153 | /* band: 'B/G', region: Europe ETSI */ | ||
154 | static struct chan_freq_power channel_freq_power_EU_BG[] = { | ||
155 | {1, 2412, LBS_TX_PWR_EMEA_DEFAULT}, | ||
156 | {2, 2417, LBS_TX_PWR_EMEA_DEFAULT}, | ||
157 | {3, 2422, LBS_TX_PWR_EMEA_DEFAULT}, | ||
158 | {4, 2427, LBS_TX_PWR_EMEA_DEFAULT}, | ||
159 | {5, 2432, LBS_TX_PWR_EMEA_DEFAULT}, | ||
160 | {6, 2437, LBS_TX_PWR_EMEA_DEFAULT}, | ||
161 | {7, 2442, LBS_TX_PWR_EMEA_DEFAULT}, | ||
162 | {8, 2447, LBS_TX_PWR_EMEA_DEFAULT}, | ||
163 | {9, 2452, LBS_TX_PWR_EMEA_DEFAULT}, | ||
164 | {10, 2457, LBS_TX_PWR_EMEA_DEFAULT}, | ||
165 | {11, 2462, LBS_TX_PWR_EMEA_DEFAULT}, | ||
166 | {12, 2467, LBS_TX_PWR_EMEA_DEFAULT}, | ||
167 | {13, 2472, LBS_TX_PWR_EMEA_DEFAULT} | ||
168 | }; | ||
169 | |||
170 | /* band: 'B/G', region: Spain */ | ||
171 | static struct chan_freq_power channel_freq_power_SPN_BG[] = { | ||
172 | {10, 2457, LBS_TX_PWR_DEFAULT}, | ||
173 | {11, 2462, LBS_TX_PWR_DEFAULT} | ||
174 | }; | ||
175 | |||
176 | /* band: 'B/G', region: France */ | ||
177 | static struct chan_freq_power channel_freq_power_FR_BG[] = { | ||
178 | {10, 2457, LBS_TX_PWR_FR_DEFAULT}, | ||
179 | {11, 2462, LBS_TX_PWR_FR_DEFAULT}, | ||
180 | {12, 2467, LBS_TX_PWR_FR_DEFAULT}, | ||
181 | {13, 2472, LBS_TX_PWR_FR_DEFAULT} | ||
182 | }; | ||
183 | |||
184 | /* band: 'B/G', region: Japan */ | ||
185 | static struct chan_freq_power channel_freq_power_JPN_BG[] = { | ||
186 | {1, 2412, LBS_TX_PWR_JP_DEFAULT}, | ||
187 | {2, 2417, LBS_TX_PWR_JP_DEFAULT}, | ||
188 | {3, 2422, LBS_TX_PWR_JP_DEFAULT}, | ||
189 | {4, 2427, LBS_TX_PWR_JP_DEFAULT}, | ||
190 | {5, 2432, LBS_TX_PWR_JP_DEFAULT}, | ||
191 | {6, 2437, LBS_TX_PWR_JP_DEFAULT}, | ||
192 | {7, 2442, LBS_TX_PWR_JP_DEFAULT}, | ||
193 | {8, 2447, LBS_TX_PWR_JP_DEFAULT}, | ||
194 | {9, 2452, LBS_TX_PWR_JP_DEFAULT}, | ||
195 | {10, 2457, LBS_TX_PWR_JP_DEFAULT}, | ||
196 | {11, 2462, LBS_TX_PWR_JP_DEFAULT}, | ||
197 | {12, 2467, LBS_TX_PWR_JP_DEFAULT}, | ||
198 | {13, 2472, LBS_TX_PWR_JP_DEFAULT}, | ||
199 | {14, 2484, LBS_TX_PWR_JP_DEFAULT} | ||
200 | }; | ||
201 | |||
202 | /** | ||
203 | * the structure for channel, frequency and power | ||
204 | */ | ||
205 | struct region_cfp_table { | ||
206 | u8 region; | ||
207 | struct chan_freq_power *cfp_BG; | ||
208 | int cfp_no_BG; | ||
209 | }; | ||
210 | |||
211 | /** | ||
212 | * the structure for the mapping between region and CFP | ||
213 | */ | ||
214 | static struct region_cfp_table region_cfp_table[] = { | ||
215 | {0x10, /*US FCC */ | ||
216 | channel_freq_power_US_BG, | ||
217 | ARRAY_SIZE(channel_freq_power_US_BG), | ||
218 | } | ||
219 | , | ||
220 | {0x20, /*CANADA IC */ | ||
221 | channel_freq_power_US_BG, | ||
222 | ARRAY_SIZE(channel_freq_power_US_BG), | ||
223 | } | ||
224 | , | ||
225 | {0x30, /*EU*/ channel_freq_power_EU_BG, | ||
226 | ARRAY_SIZE(channel_freq_power_EU_BG), | ||
227 | } | ||
228 | , | ||
229 | {0x31, /*SPAIN*/ channel_freq_power_SPN_BG, | ||
230 | ARRAY_SIZE(channel_freq_power_SPN_BG), | ||
231 | } | ||
232 | , | ||
233 | {0x32, /*FRANCE*/ channel_freq_power_FR_BG, | ||
234 | ARRAY_SIZE(channel_freq_power_FR_BG), | ||
235 | } | ||
236 | , | ||
237 | {0x40, /*JAPAN*/ channel_freq_power_JPN_BG, | ||
238 | ARRAY_SIZE(channel_freq_power_JPN_BG), | ||
239 | } | ||
240 | , | ||
241 | /*Add new region here */ | ||
242 | }; | ||
243 | |||
244 | /** | ||
245 | * @brief This function finds the CFP in | ||
246 | * region_cfp_table based on region and band parameter. | ||
247 | * | ||
248 | * @param region The region code | ||
249 | * @param band The band | ||
250 | * @param cfp_no A pointer to CFP number | ||
251 | * @return A pointer to CFP | ||
252 | */ | ||
253 | static struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no) | ||
254 | { | ||
255 | int i, end; | ||
256 | |||
257 | lbs_deb_enter(LBS_DEB_MAIN); | ||
258 | |||
259 | end = ARRAY_SIZE(region_cfp_table); | ||
260 | |||
261 | for (i = 0; i < end ; i++) { | ||
262 | lbs_deb_main("region_cfp_table[i].region=%d\n", | ||
263 | region_cfp_table[i].region); | ||
264 | if (region_cfp_table[i].region == region) { | ||
265 | *cfp_no = region_cfp_table[i].cfp_no_BG; | ||
266 | lbs_deb_leave(LBS_DEB_MAIN); | ||
267 | return region_cfp_table[i].cfp_BG; | ||
268 | } | ||
269 | } | ||
270 | |||
271 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL"); | ||
272 | return NULL; | ||
273 | } | ||
274 | |||
275 | int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) | ||
276 | { | ||
277 | int ret = 0; | ||
278 | int i = 0; | ||
279 | |||
280 | struct chan_freq_power *cfp; | ||
281 | int cfp_no; | ||
282 | |||
283 | lbs_deb_enter(LBS_DEB_MAIN); | ||
284 | |||
285 | memset(priv->region_channel, 0, sizeof(priv->region_channel)); | ||
286 | |||
287 | cfp = lbs_get_region_cfp_table(region, &cfp_no); | ||
288 | if (cfp != NULL) { | ||
289 | priv->region_channel[i].nrcfp = cfp_no; | ||
290 | priv->region_channel[i].CFP = cfp; | ||
291 | } else { | ||
292 | lbs_deb_main("wrong region code %#x in band B/G\n", | ||
293 | region); | ||
294 | ret = -1; | ||
295 | goto out; | ||
296 | } | ||
297 | priv->region_channel[i].valid = 1; | ||
298 | priv->region_channel[i].region = region; | ||
299 | priv->region_channel[i].band = band; | ||
300 | i++; | ||
301 | out: | ||
302 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); | ||
303 | return ret; | ||
304 | } | ||
305 | |||
306 | |||
307 | |||
124 | 308 | ||
125 | /*********************************************************************/ | 309 | /*********************************************************************/ |
126 | /* */ | 310 | /* */ |
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index fab7d5d097fc..8fb1706d7526 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h | |||
@@ -9,8 +9,36 @@ | |||
9 | 9 | ||
10 | #include <net/iw_handler.h> | 10 | #include <net/iw_handler.h> |
11 | 11 | ||
12 | struct lbs_private; | ||
13 | |||
12 | #define MAX_NETWORK_COUNT 128 | 14 | #define MAX_NETWORK_COUNT 128 |
13 | 15 | ||
16 | /** Chan-freq-TxPower mapping table*/ | ||
17 | struct chan_freq_power { | ||
18 | /** channel Number */ | ||
19 | u16 channel; | ||
20 | /** frequency of this channel */ | ||
21 | u32 freq; | ||
22 | /** Max allowed Tx power level */ | ||
23 | u16 maxtxpower; | ||
24 | /** TRUE:channel unsupported; FLASE:supported*/ | ||
25 | u8 unsupported; | ||
26 | }; | ||
27 | |||
28 | /** region-band mapping table*/ | ||
29 | struct region_channel { | ||
30 | /** TRUE if this entry is valid */ | ||
31 | u8 valid; | ||
32 | /** region code for US, Japan ... */ | ||
33 | u8 region; | ||
34 | /** band B/G/A, used for BAND_CONFIG cmd */ | ||
35 | u8 band; | ||
36 | /** Actual No. of elements in the array below */ | ||
37 | u8 nrcfp; | ||
38 | /** chan-freq-txpower mapping table*/ | ||
39 | struct chan_freq_power *CFP; | ||
40 | }; | ||
41 | |||
14 | /** | 42 | /** |
15 | * @brief Maximum number of channels that can be sent in a setuserscan ioctl | 43 | * @brief Maximum number of channels that can be sent in a setuserscan ioctl |
16 | */ | 44 | */ |
@@ -18,6 +46,8 @@ | |||
18 | 46 | ||
19 | int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); | 47 | int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); |
20 | 48 | ||
49 | int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); | ||
50 | |||
21 | int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, | 51 | int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, |
22 | u8 ssid_len); | 52 | u8 ssid_len); |
23 | 53 | ||