diff options
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/fw.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/hostcmd.h | 20 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 111 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 58 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/types.h | 42 |
8 files changed, 91 insertions, 164 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 715cbdaa1d4b..e5cbfa8d6e3f 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -70,18 +70,18 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, | |||
70 | 70 | ||
71 | mutex_lock(&priv->adapter->lock); | 71 | mutex_lock(&priv->adapter->lock); |
72 | list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { | 72 | list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { |
73 | u16 cap; | 73 | u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS); |
74 | u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY); | ||
75 | u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT); | ||
74 | 76 | ||
75 | memcpy(&cap, &iter_bss->cap, sizeof(cap)); | ||
76 | pos += snprintf(buf+pos, len-pos, | 77 | pos += snprintf(buf+pos, len-pos, |
77 | "%02u| %03d | %03ld | " MAC_FMT " |", | 78 | "%02u| %03d | %03ld | " MAC_FMT " |", |
78 | numscansdone, iter_bss->channel, iter_bss->rssi, | 79 | numscansdone, iter_bss->channel, iter_bss->rssi, |
79 | MAC_ARG(iter_bss->bssid)); | 80 | MAC_ARG(iter_bss->bssid)); |
80 | pos += snprintf(buf+pos, len-pos, " %04x-", cap); | 81 | pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability); |
81 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", | 82 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", |
82 | iter_bss->cap.ibss ? 'A' : 'I', | 83 | ibss ? 'A' : 'I', privacy ? 'P' : ' ', |
83 | iter_bss->cap.privacy ? 'P' : ' ', | 84 | spectrum_mgmt ? 'S' : ' '); |
84 | iter_bss->cap.spectrummgmt ? 'S' : ' '); | ||
85 | pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); | 85 | pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); |
86 | pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi)); | 86 | pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi)); |
87 | pos += snprintf(buf+pos, len-pos, " %s\n", | 87 | pos += snprintf(buf+pos, len-pos, " %s\n", |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 785192b884bc..675c65dbc070 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -275,7 +275,7 @@ struct _wlan_adapter { | |||
275 | u8 adhoccreate; | 275 | u8 adhoccreate; |
276 | 276 | ||
277 | /** capability Info used in Association, start, join */ | 277 | /** capability Info used in Association, start, join */ |
278 | struct ieeetypes_capinfo capinfo; | 278 | u16 capability; |
279 | 279 | ||
280 | /** MAC address information */ | 280 | /** MAC address information */ |
281 | u8 current_addr[ETH_ALEN]; | 281 | u8 current_addr[ETH_ALEN]; |
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 2dc84ff7a54a..6c2b3c25b821 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -217,10 +217,8 @@ static void wlan_init_adapter(wlan_private * priv) | |||
217 | adapter->is_datarate_auto = 1; | 217 | adapter->is_datarate_auto = 1; |
218 | adapter->beaconperiod = MRVDRV_BEACON_INTERVAL; | 218 | adapter->beaconperiod = MRVDRV_BEACON_INTERVAL; |
219 | 219 | ||
220 | // set default value of capinfo. | 220 | // set default capabilities |
221 | #define SHORT_PREAMBLE_ALLOWED 1 | 221 | adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; |
222 | memset(&adapter->capinfo, 0, sizeof(adapter->capinfo)); | ||
223 | adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED; | ||
224 | 222 | ||
225 | adapter->psmode = wlan802_11powermodecam; | 223 | adapter->psmode = wlan802_11powermodecam; |
226 | adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; | 224 | adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 09b898f6719c..1322552fa6c9 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -108,12 +108,6 @@ struct wlan_offset_value { | |||
108 | u32 value; | 108 | u32 value; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | struct WLAN_802_11_FIXED_IEs { | ||
112 | __le64 timestamp; | ||
113 | __le16 beaconinterval; | ||
114 | u16 capabilities; /* Actually struct ieeetypes_capinfo */ | ||
115 | }; | ||
116 | |||
117 | struct WLAN_802_11_VARIABLE_IEs { | 111 | struct WLAN_802_11_VARIABLE_IEs { |
118 | u8 elementid; | 112 | u8 elementid; |
119 | u8 length; | 113 | u8 length; |
@@ -237,7 +231,7 @@ struct cmd_ds_802_11_deauthenticate { | |||
237 | 231 | ||
238 | struct cmd_ds_802_11_associate { | 232 | struct cmd_ds_802_11_associate { |
239 | u8 peerstaaddr[6]; | 233 | u8 peerstaaddr[6]; |
240 | struct ieeetypes_capinfo capinfo; | 234 | __le16 capability; |
241 | __le16 listeninterval; | 235 | __le16 listeninterval; |
242 | __le16 bcnperiod; | 236 | __le16 bcnperiod; |
243 | u8 dtimperiod; | 237 | u8 dtimperiod; |
@@ -469,22 +463,22 @@ struct cmd_ds_802_11_ad_hoc_start { | |||
469 | union IEEEtypes_ssparamset ssparamset; | 463 | union IEEEtypes_ssparamset ssparamset; |
470 | union ieeetypes_phyparamset phyparamset; | 464 | union ieeetypes_phyparamset phyparamset; |
471 | __le16 probedelay; | 465 | __le16 probedelay; |
472 | struct ieeetypes_capinfo cap; | 466 | __le16 capability; |
473 | u8 datarate[G_SUPPORTED_RATES]; | 467 | u8 datarate[G_SUPPORTED_RATES]; |
474 | u8 tlv_memory_size_pad[100]; | 468 | u8 tlv_memory_size_pad[100]; |
475 | } __attribute__ ((packed)); | 469 | } __attribute__ ((packed)); |
476 | 470 | ||
477 | struct adhoc_bssdesc { | 471 | struct adhoc_bssdesc { |
478 | u8 BSSID[6]; | 472 | u8 bssid[6]; |
479 | u8 SSID[32]; | 473 | u8 ssid[32]; |
480 | u8 bsstype; | 474 | u8 type; |
481 | __le16 beaconperiod; | 475 | __le16 beaconperiod; |
482 | u8 dtimperiod; | 476 | u8 dtimperiod; |
483 | __le64 timestamp; | 477 | __le64 timestamp; |
484 | __le64 localtime; | 478 | __le64 localtime; |
485 | union ieeetypes_phyparamset phyparamset; | 479 | union ieeetypes_phyparamset phyparamset; |
486 | union IEEEtypes_ssparamset ssparamset; | 480 | union IEEEtypes_ssparamset ssparamset; |
487 | struct ieeetypes_capinfo cap; | 481 | __le16 capability; |
488 | u8 datarates[G_SUPPORTED_RATES]; | 482 | u8 datarates[G_SUPPORTED_RATES]; |
489 | 483 | ||
490 | /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the | 484 | /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the |
@@ -494,7 +488,7 @@ struct adhoc_bssdesc { | |||
494 | } __attribute__ ((packed)); | 488 | } __attribute__ ((packed)); |
495 | 489 | ||
496 | struct cmd_ds_802_11_ad_hoc_join { | 490 | struct cmd_ds_802_11_ad_hoc_join { |
497 | struct adhoc_bssdesc bssdescriptor; | 491 | struct adhoc_bssdesc bss; |
498 | __le16 failtimeout; | 492 | __le16 failtimeout; |
499 | __le16 probedelay; | 493 | __le16 probedelay; |
500 | 494 | ||
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 78ac3064a0bd..2db7fbfcaeb4 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include "dev.h" | 17 | #include "dev.h" |
18 | #include "assoc.h" | 18 | #include "assoc.h" |
19 | 19 | ||
20 | #define AD_HOC_CAP_PRIVACY_ON 1 | ||
21 | |||
22 | /** | 20 | /** |
23 | * @brief This function finds out the common rates between rate1 and rate2. | 21 | * @brief This function finds out the common rates between rate1 and rate2. |
24 | * | 22 | * |
@@ -121,7 +119,8 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) | |||
121 | goto done; | 119 | goto done; |
122 | 120 | ||
123 | /* set preamble to firmware */ | 121 | /* set preamble to firmware */ |
124 | if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble) | 122 | if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
123 | && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) | ||
125 | adapter->preamble = cmd_type_short_preamble; | 124 | adapter->preamble = cmd_type_short_preamble; |
126 | else | 125 | else |
127 | adapter->preamble = cmd_type_long_preamble; | 126 | adapter->preamble = cmd_type_long_preamble; |
@@ -150,12 +149,12 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass | |||
150 | 149 | ||
151 | adapter->adhoccreate = 1; | 150 | adapter->adhoccreate = 1; |
152 | 151 | ||
153 | if (!adapter->capinfo.shortpreamble) { | 152 | if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { |
154 | lbs_deb_join("AdhocStart: Long preamble\n"); | ||
155 | adapter->preamble = cmd_type_long_preamble; | ||
156 | } else { | ||
157 | lbs_deb_join("AdhocStart: Short preamble\n"); | 153 | lbs_deb_join("AdhocStart: Short preamble\n"); |
158 | adapter->preamble = cmd_type_short_preamble; | 154 | adapter->preamble = cmd_type_short_preamble; |
155 | } else { | ||
156 | lbs_deb_join("AdhocStart: Long preamble\n"); | ||
157 | adapter->preamble = cmd_type_long_preamble; | ||
159 | } | 158 | } |
160 | 159 | ||
161 | libertas_set_radio_control(priv); | 160 | libertas_set_radio_control(priv); |
@@ -205,9 +204,10 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso | |||
205 | return -1; | 204 | return -1; |
206 | } | 205 | } |
207 | 206 | ||
208 | /*Use shortpreamble only when both creator and card supports | 207 | /* Use shortpreamble only when both creator and card supports |
209 | short preamble */ | 208 | short preamble */ |
210 | if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) { | 209 | if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
210 | || !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { | ||
211 | lbs_deb_join("AdhocJoin: Long preamble\n"); | 211 | lbs_deb_join("AdhocJoin: Long preamble\n"); |
212 | adapter->preamble = cmd_type_long_preamble; | 212 | adapter->preamble = cmd_type_long_preamble; |
213 | } else { | 213 | } else { |
@@ -357,7 +357,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
357 | /* set the listen interval */ | 357 | /* set the listen interval */ |
358 | passo->listeninterval = cpu_to_le16(adapter->listeninterval); | 358 | passo->listeninterval = cpu_to_le16(adapter->listeninterval); |
359 | 359 | ||
360 | pos += sizeof(passo->capinfo); | 360 | pos += sizeof(passo->capability); |
361 | pos += sizeof(passo->listeninterval); | 361 | pos += sizeof(passo->listeninterval); |
362 | pos += sizeof(passo->bcnperiod); | 362 | pos += sizeof(passo->bcnperiod); |
363 | pos += sizeof(passo->dtimperiod); | 363 | pos += sizeof(passo->dtimperiod); |
@@ -427,12 +427,6 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
427 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", | 427 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", |
428 | cpu_to_le16(rates->header.len)); | 428 | cpu_to_le16(rates->header.len)); |
429 | 429 | ||
430 | /* set IBSS field */ | ||
431 | if (bss->mode == IW_MODE_INFRA) { | ||
432 | #define CAPINFO_ESS_MODE 1 | ||
433 | passo->capinfo.ess = CAPINFO_ESS_MODE; | ||
434 | } | ||
435 | |||
436 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { | 430 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { |
437 | ret = -1; | 431 | ret = -1; |
438 | goto done; | 432 | goto done; |
@@ -440,12 +434,13 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
440 | 434 | ||
441 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); | 435 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); |
442 | 436 | ||
443 | /* set the capability info at last */ | 437 | /* set the capability info */ |
444 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); | 438 | tmpcap = (bss->capability & CAPINFO_MASK); |
445 | tmpcap &= CAPINFO_MASK; | 439 | if (bss->mode == IW_MODE_INFRA) |
446 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 440 | tmpcap |= WLAN_CAPABILITY_ESS; |
441 | passo->capability = cpu_to_le16(tmpcap); | ||
442 | lbs_deb_join("ASSOC_CMD: capability=%4X CAPINFO_MASK=%4X\n", | ||
447 | tmpcap, CAPINFO_MASK); | 443 | tmpcap, CAPINFO_MASK); |
448 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); | ||
449 | 444 | ||
450 | done: | 445 | done: |
451 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | 446 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
@@ -461,6 +456,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
461 | int cmdappendsize = 0; | 456 | int cmdappendsize = 0; |
462 | int i; | 457 | int i; |
463 | struct assoc_request * assoc_req = pdata_buf; | 458 | struct assoc_request * assoc_req = pdata_buf; |
459 | u16 tmpcap = 0; | ||
464 | 460 | ||
465 | lbs_deb_enter(LBS_DEB_JOIN); | 461 | lbs_deb_enter(LBS_DEB_JOIN); |
466 | 462 | ||
@@ -518,19 +514,17 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
518 | adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); | 514 | adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); |
519 | 515 | ||
520 | /* set capability info */ | 516 | /* set capability info */ |
521 | adhs->cap.ess = 0; | 517 | tmpcap = WLAN_CAPABILITY_IBSS; |
522 | adhs->cap.ibss = 1; | ||
523 | |||
524 | /* probedelay */ | ||
525 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); | ||
526 | |||
527 | /* set up privacy in adapter->scantable[i] */ | ||
528 | if (assoc_req->secinfo.wep_enabled) { | 518 | if (assoc_req->secinfo.wep_enabled) { |
529 | lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); | 519 | lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); |
530 | adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 520 | tmpcap |= WLAN_CAPABILITY_PRIVACY; |
531 | } else { | 521 | } else { |
532 | lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); | 522 | lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); |
533 | } | 523 | } |
524 | adhs->capability = cpu_to_le16(tmpcap); | ||
525 | |||
526 | /* probedelay */ | ||
527 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); | ||
534 | 528 | ||
535 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); | 529 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); |
536 | 530 | ||
@@ -585,67 +579,58 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
585 | struct cmd_ds_command *cmd, void *pdata_buf) | 579 | struct cmd_ds_command *cmd, void *pdata_buf) |
586 | { | 580 | { |
587 | wlan_adapter *adapter = priv->adapter; | 581 | wlan_adapter *adapter = priv->adapter; |
588 | struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; | 582 | struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj; |
589 | struct assoc_request * assoc_req = pdata_buf; | 583 | struct assoc_request * assoc_req = pdata_buf; |
590 | struct bss_descriptor *bss = &assoc_req->bss; | 584 | struct bss_descriptor *bss = &assoc_req->bss; |
591 | int cmdappendsize = 0; | 585 | int cmdappendsize = 0; |
592 | int ret = 0; | 586 | int ret = 0; |
593 | u8 *card_rates; | 587 | u8 *card_rates; |
594 | int card_rates_size; | 588 | int card_rates_size; |
595 | u16 tmpcap; | ||
596 | int i; | 589 | int i; |
597 | 590 | ||
598 | lbs_deb_enter(LBS_DEB_JOIN); | 591 | lbs_deb_enter(LBS_DEB_JOIN); |
599 | 592 | ||
600 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); | 593 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); |
601 | 594 | ||
602 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; | 595 | join_cmd->bss.type = cmd_bss_type_ibss; |
603 | 596 | join_cmd->bss.beaconperiod = cpu_to_le16(bss->beaconperiod); | |
604 | padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod); | ||
605 | |||
606 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); | ||
607 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len); | ||
608 | 597 | ||
609 | memcpy(&padhocjoin->bssdescriptor.phyparamset, | 598 | memcpy(&join_cmd->bss.bssid, &bss->bssid, ETH_ALEN); |
610 | &bss->phyparamset, sizeof(union ieeetypes_phyparamset)); | 599 | memcpy(&join_cmd->bss.ssid, &bss->ssid, bss->ssid_len); |
611 | 600 | ||
612 | memcpy(&padhocjoin->bssdescriptor.ssparamset, | 601 | memcpy(&join_cmd->bss.phyparamset, &bss->phyparamset, |
613 | &bss->ssparamset, sizeof(union IEEEtypes_ssparamset)); | 602 | sizeof(union ieeetypes_phyparamset)); |
614 | 603 | ||
615 | memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo)); | 604 | memcpy(&join_cmd->bss.ssparamset, &bss->ssparamset, |
616 | tmpcap &= CAPINFO_MASK; | 605 | sizeof(union IEEEtypes_ssparamset)); |
617 | 606 | ||
607 | join_cmd->bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); | ||
618 | lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 608 | lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
619 | tmpcap, CAPINFO_MASK); | 609 | bss->capability, CAPINFO_MASK); |
620 | memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap, | ||
621 | sizeof(struct ieeetypes_capinfo)); | ||
622 | 610 | ||
623 | /* information on BSSID descriptor passed to FW */ | 611 | /* information on BSSID descriptor passed to FW */ |
624 | lbs_deb_join( | 612 | lbs_deb_join( |
625 | "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n", | 613 | "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n", |
626 | MAC_ARG(padhocjoin->bssdescriptor.BSSID), | 614 | MAC_ARG(join_cmd->bss.bssid), join_cmd->bss.ssid); |
627 | padhocjoin->bssdescriptor.SSID); | ||
628 | 615 | ||
629 | /* failtimeout */ | 616 | /* failtimeout */ |
630 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); | 617 | join_cmd->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); |
631 | 618 | ||
632 | /* probedelay */ | 619 | /* probedelay */ |
633 | padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); | 620 | join_cmd->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
634 | 621 | ||
635 | /* Copy Data rates from the rates recorded in scan response */ | 622 | /* Copy Data rates from the rates recorded in scan response */ |
636 | memset(padhocjoin->bssdescriptor.datarates, 0, | 623 | memset(join_cmd->bss.datarates, 0, sizeof(join_cmd->bss.datarates)); |
637 | sizeof(padhocjoin->bssdescriptor.datarates)); | 624 | memcpy(join_cmd->bss.datarates, bss->datarates, |
638 | memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates, | 625 | min(sizeof(join_cmd->bss.datarates), sizeof(bss->datarates))); |
639 | min(sizeof(padhocjoin->bssdescriptor.datarates), | ||
640 | sizeof(bss->datarates))); | ||
641 | 626 | ||
642 | card_rates = libertas_supported_rates; | 627 | card_rates = libertas_supported_rates; |
643 | card_rates_size = sizeof(libertas_supported_rates); | 628 | card_rates_size = sizeof(libertas_supported_rates); |
644 | 629 | ||
645 | adapter->curbssparams.channel = bss->channel; | 630 | adapter->curbssparams.channel = bss->channel; |
646 | 631 | ||
647 | if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, | 632 | if (get_common_rates(adapter, join_cmd->bss.datarates, |
648 | sizeof(padhocjoin->bssdescriptor.datarates), | 633 | sizeof(join_cmd->bss.datarates), |
649 | card_rates, card_rates_size)) { | 634 | card_rates, card_rates_size)) { |
650 | lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); | 635 | lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); |
651 | ret = -1; | 636 | ret = -1; |
@@ -653,8 +638,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
653 | } | 638 | } |
654 | 639 | ||
655 | /* Find the last non zero */ | 640 | /* Find the last non zero */ |
656 | for (i = 0; i < sizeof(padhocjoin->bssdescriptor.datarates) | 641 | for (i = 0; i < sizeof(join_cmd->bss.datarates) |
657 | && padhocjoin->bssdescriptor.datarates[i]; i++) ; | 642 | && join_cmd->bss.datarates[i]; i++) ; |
658 | 643 | ||
659 | adapter->curbssparams.numofrates = i; | 644 | adapter->curbssparams.numofrates = i; |
660 | 645 | ||
@@ -662,14 +647,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
662 | * Copy the adhoc joining rates to Current BSS State structure | 647 | * Copy the adhoc joining rates to Current BSS State structure |
663 | */ | 648 | */ |
664 | memcpy(adapter->curbssparams.datarates, | 649 | memcpy(adapter->curbssparams.datarates, |
665 | padhocjoin->bssdescriptor.datarates, | 650 | join_cmd->bss.datarates, |
666 | adapter->curbssparams.numofrates); | 651 | adapter->curbssparams.numofrates); |
667 | 652 | ||
668 | padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = | 653 | join_cmd->bss.ssparamset.ibssparamset.atimwindow = |
669 | cpu_to_le16(bss->atimwindow); | 654 | cpu_to_le16(bss->atimwindow); |
670 | 655 | ||
671 | if (assoc_req->secinfo.wep_enabled) { | 656 | if (assoc_req->secinfo.wep_enabled) { |
672 | padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 657 | u16 tmp = le16_to_cpu(join_cmd->bss.capability); |
658 | tmp |= WLAN_CAPABILITY_PRIVACY; | ||
659 | join_cmd->bss.capability = cpu_to_le16(tmp); | ||
673 | } | 660 | } |
674 | 661 | ||
675 | if (adapter->psmode == wlan802_11powermodemax_psp) { | 662 | if (adapter->psmode == wlan802_11powermodemax_psp) { |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c3043dcb541e..8753f9344f3e 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -76,7 +76,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo, | |||
76 | && !secinfo->WPA2enabled | 76 | && !secinfo->WPA2enabled |
77 | && match_bss->wpa_ie[0] != WPA_IE | 77 | && match_bss->wpa_ie[0] != WPA_IE |
78 | && match_bss->rsn_ie[0] != WPA2_IE | 78 | && match_bss->rsn_ie[0] != WPA2_IE |
79 | && !match_bss->privacy) { | 79 | && !(match_bss->capability & WLAN_CAPABILITY_PRIVACY)) { |
80 | return 1; | 80 | return 1; |
81 | } | 81 | } |
82 | return 0; | 82 | return 0; |
@@ -88,7 +88,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo, | |||
88 | if ( secinfo->wep_enabled | 88 | if ( secinfo->wep_enabled |
89 | && !secinfo->WPAenabled | 89 | && !secinfo->WPAenabled |
90 | && !secinfo->WPA2enabled | 90 | && !secinfo->WPA2enabled |
91 | && match_bss->privacy) { | 91 | && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) { |
92 | return 1; | 92 | return 1; |
93 | } | 93 | } |
94 | return 0; | 94 | return 0; |
@@ -101,7 +101,8 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, | |||
101 | && secinfo->WPAenabled | 101 | && secinfo->WPAenabled |
102 | && (match_bss->wpa_ie[0] == WPA_IE) | 102 | && (match_bss->wpa_ie[0] == WPA_IE) |
103 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 103 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
104 | && bss->privacy */ | 104 | && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) { |
105 | */ | ||
105 | ) { | 106 | ) { |
106 | return 1; | 107 | return 1; |
107 | } | 108 | } |
@@ -115,7 +116,8 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, | |||
115 | && secinfo->WPA2enabled | 116 | && secinfo->WPA2enabled |
116 | && (match_bss->rsn_ie[0] == WPA2_IE) | 117 | && (match_bss->rsn_ie[0] == WPA2_IE) |
117 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 118 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
118 | && bss->privacy */ | 119 | && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) { |
120 | */ | ||
119 | ) { | 121 | ) { |
120 | return 1; | 122 | return 1; |
121 | } | 123 | } |
@@ -130,7 +132,7 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo, | |||
130 | && !secinfo->WPA2enabled | 132 | && !secinfo->WPA2enabled |
131 | && (match_bss->wpa_ie[0] != WPA_IE) | 133 | && (match_bss->wpa_ie[0] != WPA_IE) |
132 | && (match_bss->rsn_ie[0] != WPA2_IE) | 134 | && (match_bss->rsn_ie[0] != WPA2_IE) |
133 | && match_bss->privacy) { | 135 | && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) { |
134 | return 1; | 136 | return 1; |
135 | } | 137 | } |
136 | return 0; | 138 | return 0; |
@@ -177,7 +179,7 @@ static int is_network_compatible(wlan_adapter * adapter, | |||
177 | adapter->secinfo.wep_enabled ? "e" : "d", | 179 | adapter->secinfo.wep_enabled ? "e" : "d", |
178 | adapter->secinfo.WPAenabled ? "e" : "d", | 180 | adapter->secinfo.WPAenabled ? "e" : "d", |
179 | adapter->secinfo.WPA2enabled ? "e" : "d", | 181 | adapter->secinfo.WPA2enabled ? "e" : "d", |
180 | bss->privacy); | 182 | (bss->capability & WLAN_CAPABILITY_PRIVACY)); |
181 | goto done; | 183 | goto done; |
182 | } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { | 184 | } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { |
183 | lbs_deb_scan( | 185 | lbs_deb_scan( |
@@ -187,15 +189,14 @@ static int is_network_compatible(wlan_adapter * adapter, | |||
187 | adapter->secinfo.wep_enabled ? "e" : "d", | 189 | adapter->secinfo.wep_enabled ? "e" : "d", |
188 | adapter->secinfo.WPAenabled ? "e" : "d", | 190 | adapter->secinfo.WPAenabled ? "e" : "d", |
189 | adapter->secinfo.WPA2enabled ? "e" : "d", | 191 | adapter->secinfo.WPA2enabled ? "e" : "d", |
190 | bss->privacy); | 192 | (bss->capability & WLAN_CAPABILITY_PRIVACY)); |
191 | goto done; | 193 | goto done; |
192 | } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { | 194 | } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { |
193 | lbs_deb_scan( | 195 | lbs_deb_scan( |
194 | "is_network_compatible() dynamic WEP: " | 196 | "is_network_compatible() dynamic WEP: " |
195 | "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", | 197 | "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", |
196 | bss->wpa_ie[0], | 198 | bss->wpa_ie[0], bss->rsn_ie[0], |
197 | bss->rsn_ie[0], | 199 | (bss->capability & WLAN_CAPABILITY_PRIVACY)); |
198 | bss->privacy); | ||
199 | goto done; | 200 | goto done; |
200 | } | 201 | } |
201 | 202 | ||
@@ -207,7 +208,7 @@ static int is_network_compatible(wlan_adapter * adapter, | |||
207 | adapter->secinfo.wep_enabled ? "e" : "d", | 208 | adapter->secinfo.wep_enabled ? "e" : "d", |
208 | adapter->secinfo.WPAenabled ? "e" : "d", | 209 | adapter->secinfo.WPAenabled ? "e" : "d", |
209 | adapter->secinfo.WPA2enabled ? "e" : "d", | 210 | adapter->secinfo.WPA2enabled ? "e" : "d", |
210 | bss->privacy); | 211 | (bss->capability & WLAN_CAPABILITY_PRIVACY)); |
211 | 212 | ||
212 | done: | 213 | done: |
213 | lbs_deb_leave(LBS_DEB_SCAN); | 214 | lbs_deb_leave(LBS_DEB_SCAN); |
@@ -904,8 +905,6 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
904 | struct ieeetypes_dsparamset *pDS; | 905 | struct ieeetypes_dsparamset *pDS; |
905 | struct ieeetypes_cfparamset *pCF; | 906 | struct ieeetypes_cfparamset *pCF; |
906 | struct ieeetypes_ibssparamset *pibss; | 907 | struct ieeetypes_ibssparamset *pibss; |
907 | struct ieeetypes_capinfo *pcap; | ||
908 | struct WLAN_802_11_FIXED_IEs fixedie; | ||
909 | u8 *pcurrentptr; | 908 | u8 *pcurrentptr; |
910 | u8 *pRate; | 909 | u8 *pRate; |
911 | u8 elemlen; | 910 | u8 elemlen; |
@@ -974,24 +973,28 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
974 | bytesleftforcurrentbeacon -= 1; | 973 | bytesleftforcurrentbeacon -= 1; |
975 | 974 | ||
976 | /* time stamp is 8 bytes long */ | 975 | /* time stamp is 8 bytes long */ |
977 | fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr); | 976 | bss->timestamp = le64_to_cpup((void *)pcurrentptr); |
978 | pcurrentptr += 8; | 977 | pcurrentptr += 8; |
979 | bytesleftforcurrentbeacon -= 8; | 978 | bytesleftforcurrentbeacon -= 8; |
980 | 979 | ||
981 | /* beacon interval is 2 bytes long */ | 980 | /* beacon interval is 2 bytes long */ |
982 | fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); | 981 | bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); |
983 | pcurrentptr += 2; | 982 | pcurrentptr += 2; |
984 | bytesleftforcurrentbeacon -= 2; | 983 | bytesleftforcurrentbeacon -= 2; |
985 | 984 | ||
986 | /* capability information is 2 bytes long */ | 985 | /* capability information is 2 bytes long */ |
987 | memcpy(&fixedie.capabilities, pcurrentptr, 2); | 986 | bss->capability = le16_to_cpup((void *)pcurrentptr); |
988 | lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", | 987 | lbs_deb_scan("process_bss: capabilities = 0x%4X\n", bss->capability); |
989 | fixedie.capabilities); | ||
990 | pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; | ||
991 | memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo)); | ||
992 | pcurrentptr += 2; | 988 | pcurrentptr += 2; |
993 | bytesleftforcurrentbeacon -= 2; | 989 | bytesleftforcurrentbeacon -= 2; |
994 | 990 | ||
991 | if (bss->capability & WLAN_CAPABILITY_PRIVACY) | ||
992 | lbs_deb_scan("process_bss: AP WEP enabled\n"); | ||
993 | if (bss->capability & WLAN_CAPABILITY_IBSS) | ||
994 | bss->mode = IW_MODE_ADHOC; | ||
995 | else | ||
996 | bss->mode = IW_MODE_INFRA; | ||
997 | |||
995 | /* rest of the current buffer are IE's */ | 998 | /* rest of the current buffer are IE's */ |
996 | lbs_deb_scan("process_bss: IE length for this AP = %d\n", | 999 | lbs_deb_scan("process_bss: IE length for this AP = %d\n", |
997 | bytesleftforcurrentbeacon); | 1000 | bytesleftforcurrentbeacon); |
@@ -999,19 +1002,6 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
999 | lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr, | 1002 | lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr, |
1000 | bytesleftforcurrentbeacon); | 1003 | bytesleftforcurrentbeacon); |
1001 | 1004 | ||
1002 | if (pcap->privacy) { | ||
1003 | lbs_deb_scan("process_bss: AP WEP enabled\n"); | ||
1004 | bss->privacy = wlan802_11privfilter8021xWEP; | ||
1005 | } else { | ||
1006 | bss->privacy = wlan802_11privfilteracceptall; | ||
1007 | } | ||
1008 | |||
1009 | if (pcap->ibss == 1) { | ||
1010 | bss->mode = IW_MODE_ADHOC; | ||
1011 | } else { | ||
1012 | bss->mode = IW_MODE_INFRA; | ||
1013 | } | ||
1014 | |||
1015 | /* process variable IE */ | 1005 | /* process variable IE */ |
1016 | while (bytesleftforcurrentbeacon >= 2) { | 1006 | while (bytesleftforcurrentbeacon >= 2) { |
1017 | elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr)); | 1007 | elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr)); |
@@ -1550,7 +1540,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, | |||
1550 | 1540 | ||
1551 | /* Add encryption capability */ | 1541 | /* Add encryption capability */ |
1552 | iwe.cmd = SIOCGIWENCODE; | 1542 | iwe.cmd = SIOCGIWENCODE; |
1553 | if (bss->privacy) { | 1543 | if (bss->capability & WLAN_CAPABILITY_PRIVACY) { |
1554 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | 1544 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; |
1555 | } else { | 1545 | } else { |
1556 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1546 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index bd019e5ff1eb..2a095733f194 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h | |||
@@ -140,8 +140,7 @@ struct bss_descriptor { | |||
140 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | 140 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
141 | u8 ssid_len; | 141 | u8 ssid_len; |
142 | 142 | ||
143 | /* WEP encryption requirement */ | 143 | u16 capability; |
144 | u32 privacy; | ||
145 | 144 | ||
146 | /* receive signal strength in dBm */ | 145 | /* receive signal strength in dBm */ |
147 | long rssi; | 146 | long rssi; |
@@ -160,7 +159,6 @@ struct bss_descriptor { | |||
160 | 159 | ||
161 | union ieeetypes_phyparamset phyparamset; | 160 | union ieeetypes_phyparamset phyparamset; |
162 | union IEEEtypes_ssparamset ssparamset; | 161 | union IEEEtypes_ssparamset ssparamset; |
163 | struct ieeetypes_capinfo cap; | ||
164 | u8 datarates[WLAN_SUPPORTED_RATES]; | 162 | u8 datarates[WLAN_SUPPORTED_RATES]; |
165 | 163 | ||
166 | u64 networktsf; //!< TSF timestamp from the current firmware TSF | 164 | u64 networktsf; //!< TSF timestamp from the current firmware TSF |
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h index 028e2f3b53d6..f4be1293cd16 100644 --- a/drivers/net/wireless/libertas/types.h +++ b/drivers/net/wireless/libertas/types.h | |||
@@ -30,47 +30,7 @@ enum ieeetypes_elementid { | |||
30 | EXTRA_IE = 133, | 30 | EXTRA_IE = 133, |
31 | } __attribute__ ((packed)); | 31 | } __attribute__ ((packed)); |
32 | 32 | ||
33 | #ifdef __BIG_ENDIAN | ||
34 | #define CAPINFO_MASK (~(0xda00)) | ||
35 | #else | ||
36 | #define CAPINFO_MASK (~(0x00da)) | 33 | #define CAPINFO_MASK (~(0x00da)) |
37 | #endif | ||
38 | |||
39 | struct ieeetypes_capinfo { | ||
40 | #ifdef __BIG_ENDIAN_BITFIELD | ||
41 | u8 chanagility:1; | ||
42 | u8 pbcc:1; | ||
43 | u8 shortpreamble:1; | ||
44 | u8 privacy:1; | ||
45 | u8 cfpollrqst:1; | ||
46 | u8 cfpollable:1; | ||
47 | u8 ibss:1; | ||
48 | u8 ess:1; | ||
49 | u8 rsrvd1:2; | ||
50 | u8 dsssofdm:1; | ||
51 | u8 rsvrd2:1; | ||
52 | u8 apsd:1; | ||
53 | u8 shortslottime:1; | ||
54 | u8 rsrvd3:1; | ||
55 | u8 spectrummgmt:1; | ||
56 | #else | ||
57 | u8 ess:1; | ||
58 | u8 ibss:1; | ||
59 | u8 cfpollable:1; | ||
60 | u8 cfpollrqst:1; | ||
61 | u8 privacy:1; | ||
62 | u8 shortpreamble:1; | ||
63 | u8 pbcc:1; | ||
64 | u8 chanagility:1; | ||
65 | u8 spectrummgmt:1; | ||
66 | u8 rsrvd3:1; | ||
67 | u8 shortslottime:1; | ||
68 | u8 apsd:1; | ||
69 | u8 rsvrd2:1; | ||
70 | u8 dsssofdm:1; | ||
71 | u8 rsrvd1:2; | ||
72 | #endif | ||
73 | } __attribute__ ((packed)); | ||
74 | 34 | ||
75 | struct ieeetypes_cfparamset { | 35 | struct ieeetypes_cfparamset { |
76 | u8 elementid; | 36 | u8 elementid; |
@@ -114,7 +74,7 @@ union ieeetypes_phyparamset { | |||
114 | } __attribute__ ((packed)); | 74 | } __attribute__ ((packed)); |
115 | 75 | ||
116 | struct ieeetypes_assocrsp { | 76 | struct ieeetypes_assocrsp { |
117 | struct ieeetypes_capinfo capability; | 77 | __le16 capability; |
118 | __le16 statuscode; | 78 | __le16 statuscode; |
119 | __le16 aid; | 79 | __le16 aid; |
120 | u8 iebuffer[1]; | 80 | u8 iebuffer[1]; |