aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/join.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/join.c')
-rw-r--r--drivers/net/wireless/libertas/join.c111
1 files changed, 49 insertions, 62 deletions
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
450done: 445done:
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) {