diff options
Diffstat (limited to 'drivers/net/wireless/libertas/join.c')
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 91 |
1 files changed, 37 insertions, 54 deletions
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index f222e78a922c..781b563a2f4f 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -306,13 +306,11 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, | |||
306 | lbs_deb_enter(LBS_DEB_JOIN); | 306 | lbs_deb_enter(LBS_DEB_JOIN); |
307 | 307 | ||
308 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); | 308 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); |
309 | cmd->size = | 309 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + |
310 | cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + | ||
311 | S_DS_GEN); | 310 | S_DS_GEN); |
312 | 311 | ||
313 | /* set AP MAC address */ | 312 | /* set AP MAC address */ |
314 | memmove(dauth->macaddr, adapter->curbssparams.bssid, | 313 | memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); |
315 | ETH_ALEN); | ||
316 | 314 | ||
317 | /* Reason code 3 = Station is leaving */ | 315 | /* Reason code 3 = Station is leaving */ |
318 | #define REASON_CODE_STA_LEAVING 3 | 316 | #define REASON_CODE_STA_LEAVING 3 |
@@ -333,7 +331,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
333 | u8 *card_rates; | 331 | u8 *card_rates; |
334 | u8 *pos; | 332 | u8 *pos; |
335 | int card_rates_size; | 333 | int card_rates_size; |
336 | u16 tmpcap; | 334 | u16 tmpcap, tmplen; |
337 | struct mrvlietypes_ssidparamset *ssid; | 335 | struct mrvlietypes_ssidparamset *ssid; |
338 | struct mrvlietypes_phyparamset *phy; | 336 | struct mrvlietypes_phyparamset *phy; |
339 | struct mrvlietypes_ssparamset *ss; | 337 | struct mrvlietypes_ssparamset *ss; |
@@ -355,7 +353,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
355 | pos += sizeof(passo->peerstaaddr); | 353 | pos += sizeof(passo->peerstaaddr); |
356 | 354 | ||
357 | /* set the listen interval */ | 355 | /* set the listen interval */ |
358 | passo->listeninterval = adapter->listeninterval; | 356 | passo->listeninterval = cpu_to_le16(adapter->listeninterval); |
359 | 357 | ||
360 | pos += sizeof(passo->capinfo); | 358 | pos += sizeof(passo->capinfo); |
361 | pos += sizeof(passo->listeninterval); | 359 | pos += sizeof(passo->listeninterval); |
@@ -364,14 +362,14 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
364 | 362 | ||
365 | ssid = (struct mrvlietypes_ssidparamset *) pos; | 363 | ssid = (struct mrvlietypes_ssidparamset *) pos; |
366 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); | 364 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); |
367 | ssid->header.len = bss->ssid.ssidlength; | 365 | ssid->header.len = cpu_to_le16(bss->ssid.ssidlength); |
368 | memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); | 366 | memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); |
369 | pos += sizeof(ssid->header) + ssid->header.len; | 367 | pos += sizeof(ssid->header) + ssid->header.len; |
370 | ssid->header.len = cpu_to_le16(ssid->header.len); | 368 | ssid->header.len = cpu_to_le16(ssid->header.len); |
371 | 369 | ||
372 | phy = (struct mrvlietypes_phyparamset *) pos; | 370 | phy = (struct mrvlietypes_phyparamset *) pos; |
373 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); | 371 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); |
374 | phy->header.len = sizeof(phy->fh_ds.dsparamset); | 372 | phy->header.len = cpu_to_le16(sizeof(phy->fh_ds.dsparamset)); |
375 | memcpy(&phy->fh_ds.dsparamset, | 373 | memcpy(&phy->fh_ds.dsparamset, |
376 | &bss->phyparamset.dsparamset.currentchan, | 374 | &bss->phyparamset.dsparamset.currentchan, |
377 | sizeof(phy->fh_ds.dsparamset)); | 375 | sizeof(phy->fh_ds.dsparamset)); |
@@ -380,7 +378,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
380 | 378 | ||
381 | ss = (struct mrvlietypes_ssparamset *) pos; | 379 | ss = (struct mrvlietypes_ssparamset *) pos; |
382 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); | 380 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); |
383 | ss->header.len = sizeof(ss->cf_ibss.cfparamset); | 381 | ss->header.len = cpu_to_le16(sizeof(ss->cf_ibss.cfparamset)); |
384 | pos += sizeof(ss->header) + ss->header.len; | 382 | pos += sizeof(ss->header) + ss->header.len; |
385 | ss->header.len = cpu_to_le16(ss->header.len); | 383 | ss->header.len = cpu_to_le16(ss->header.len); |
386 | 384 | ||
@@ -398,33 +396,34 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
398 | goto done; | 396 | goto done; |
399 | } | 397 | } |
400 | 398 | ||
401 | rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); | 399 | tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); |
402 | adapter->curbssparams.numofrates = rates->header.len; | 400 | adapter->curbssparams.numofrates = tmplen; |
403 | 401 | ||
404 | pos += sizeof(rates->header) + rates->header.len; | 402 | pos += sizeof(rates->header) + tmplen; |
405 | rates->header.len = cpu_to_le16(rates->header.len); | 403 | rates->header.len = cpu_to_le16(tmplen); |
406 | 404 | ||
407 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { | 405 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
408 | rsn = (struct mrvlietypes_rsnparamset *) pos; | 406 | rsn = (struct mrvlietypes_rsnparamset *) pos; |
409 | rsn->header.type = (u16) assoc_req->wpa_ie[0]; /* WPA_IE or WPA2_IE */ | 407 | /* WPA_IE or WPA2_IE */ |
410 | rsn->header.type = cpu_to_le16(rsn->header.type); | 408 | rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]); |
411 | rsn->header.len = (u16) assoc_req->wpa_ie[1]; | 409 | tmplen = (u16) assoc_req->wpa_ie[1]; |
412 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], rsn->header.len); | 410 | rsn->header.len = cpu_to_le16(tmplen); |
411 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen); | ||
413 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, | 412 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, |
414 | sizeof(rsn->header) + rsn->header.len); | 413 | sizeof(rsn->header) + tmplen); |
415 | pos += sizeof(rsn->header) + rsn->header.len; | 414 | pos += sizeof(rsn->header) + tmplen; |
416 | rsn->header.len = cpu_to_le16(rsn->header.len); | ||
417 | } | 415 | } |
418 | 416 | ||
419 | /* update curbssparams */ | 417 | /* update curbssparams */ |
420 | adapter->curbssparams.channel = | 418 | adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; |
421 | (bss->phyparamset.dsparamset.currentchan); | ||
422 | 419 | ||
423 | /* Copy the infra. association rates into Current BSS state structure */ | 420 | /* Copy the infra. association rates into Current BSS state structure */ |
424 | memcpy(&adapter->curbssparams.datarates, &rates->rates, | 421 | memcpy(&adapter->curbssparams.datarates, &rates->rates, |
425 | min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); | 422 | min_t(size_t, sizeof(adapter->curbssparams.datarates), |
423 | cpu_to_le16(rates->header.len))); | ||
426 | 424 | ||
427 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len); | 425 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", |
426 | cpu_to_le16(rates->header.len)); | ||
428 | 427 | ||
429 | /* set IBSS field */ | 428 | /* set IBSS field */ |
430 | if (bss->mode == IW_MODE_INFRA) { | 429 | if (bss->mode == IW_MODE_INFRA) { |
@@ -443,8 +442,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
443 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); | 442 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); |
444 | tmpcap &= CAPINFO_MASK; | 443 | tmpcap &= CAPINFO_MASK; |
445 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 444 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
446 | tmpcap, CAPINFO_MASK); | 445 | tmpcap, CAPINFO_MASK); |
447 | tmpcap = cpu_to_le16(tmpcap); | ||
448 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); | 446 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); |
449 | 447 | ||
450 | done: | 448 | done: |
@@ -460,7 +458,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
460 | int ret = 0; | 458 | int ret = 0; |
461 | int cmdappendsize = 0; | 459 | int cmdappendsize = 0; |
462 | int i; | 460 | int i; |
463 | u16 tmpcap; | ||
464 | struct assoc_request * assoc_req = pdata_buf; | 461 | struct assoc_request * assoc_req = pdata_buf; |
465 | 462 | ||
466 | lbs_deb_enter(LBS_DEB_JOIN); | 463 | lbs_deb_enter(LBS_DEB_JOIN); |
@@ -492,7 +489,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
492 | /* set the BSS type */ | 489 | /* set the BSS type */ |
493 | adhs->bsstype = cmd_bss_type_ibss; | 490 | adhs->bsstype = cmd_bss_type_ibss; |
494 | adapter->mode = IW_MODE_ADHOC; | 491 | adapter->mode = IW_MODE_ADHOC; |
495 | adhs->beaconperiod = adapter->beaconperiod; | 492 | adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod); |
496 | 493 | ||
497 | /* set Physical param set */ | 494 | /* set Physical param set */ |
498 | #define DS_PARA_IE_ID 3 | 495 | #define DS_PARA_IE_ID 3 |
@@ -504,7 +501,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
504 | WARN_ON(!assoc_req->channel); | 501 | WARN_ON(!assoc_req->channel); |
505 | 502 | ||
506 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", | 503 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", |
507 | assoc_req->channel); | 504 | assoc_req->channel); |
508 | 505 | ||
509 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; | 506 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; |
510 | 507 | ||
@@ -514,7 +511,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
514 | 511 | ||
515 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; | 512 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; |
516 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; | 513 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; |
517 | adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; | 514 | adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); |
518 | 515 | ||
519 | /* set capability info */ | 516 | /* set capability info */ |
520 | adhs->cap.ess = 0; | 517 | adhs->cap.ess = 0; |
@@ -562,13 +559,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
562 | goto done; | 559 | goto done; |
563 | } | 560 | } |
564 | 561 | ||
565 | cmd->size = | 562 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) + |
566 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) | 563 | S_DS_GEN + cmdappendsize); |
567 | + S_DS_GEN + cmdappendsize); | ||
568 | |||
569 | memcpy(&tmpcap, &adhs->cap, sizeof(u16)); | ||
570 | tmpcap = cpu_to_le16(tmpcap); | ||
571 | memcpy(&adhs->cap, &tmpcap, sizeof(u16)); | ||
572 | 564 | ||
573 | ret = 0; | 565 | ret = 0; |
574 | done: | 566 | done: |
@@ -605,7 +597,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
605 | 597 | ||
606 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; | 598 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; |
607 | 599 | ||
608 | padhocjoin->bssdescriptor.beaconperiod = bss->beaconperiod; | 600 | padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod); |
609 | 601 | ||
610 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); | 602 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); |
611 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); | 603 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); |
@@ -634,8 +626,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
634 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); | 626 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); |
635 | 627 | ||
636 | /* probedelay */ | 628 | /* probedelay */ |
637 | padhocjoin->probedelay = | 629 | padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
638 | cpu_to_le16(cmd_scan_probe_delay_time); | ||
639 | 630 | ||
640 | /* Copy Data rates from the rates recorded in scan response */ | 631 | /* Copy Data rates from the rates recorded in scan response */ |
641 | memset(padhocjoin->bssdescriptor.datarates, 0, | 632 | memset(padhocjoin->bssdescriptor.datarates, 0, |
@@ -679,9 +670,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
679 | 670 | ||
680 | if (adapter->psmode == wlan802_11powermodemax_psp) { | 671 | if (adapter->psmode == wlan802_11powermodemax_psp) { |
681 | /* wake up first */ | 672 | /* wake up first */ |
682 | enum WLAN_802_11_POWER_MODE Localpsmode; | 673 | __le32 Localpsmode; |
683 | 674 | ||
684 | Localpsmode = wlan802_11powermodecam; | 675 | Localpsmode = cpu_to_le32(wlan802_11powermodecam); |
685 | ret = libertas_prepare_and_send_command(priv, | 676 | ret = libertas_prepare_and_send_command(priv, |
686 | cmd_802_11_ps_mode, | 677 | cmd_802_11_ps_mode, |
687 | cmd_act_set, | 678 | cmd_act_set, |
@@ -698,16 +689,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
698 | goto done; | 689 | goto done; |
699 | } | 690 | } |
700 | 691 | ||
701 | cmd->size = | 692 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) + |
702 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) | 693 | S_DS_GEN + cmdappendsize); |
703 | + S_DS_GEN + cmdappendsize); | ||
704 | |||
705 | memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap, | ||
706 | sizeof(struct ieeetypes_capinfo)); | ||
707 | tmpcap = cpu_to_le16(tmpcap); | ||
708 | |||
709 | memcpy(&padhocjoin->bssdescriptor.cap, | ||
710 | &tmpcap, sizeof(struct ieeetypes_capinfo)); | ||
711 | 694 | ||
712 | done: | 695 | done: |
713 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | 696 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
@@ -734,11 +717,11 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
734 | 717 | ||
735 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; | 718 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; |
736 | 719 | ||
737 | if (passocrsp->statuscode) { | 720 | if (le16_to_cpu(passocrsp->statuscode)) { |
738 | libertas_mac_event_disconnected(priv); | 721 | libertas_mac_event_disconnected(priv); |
739 | 722 | ||
740 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", | 723 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", |
741 | passocrsp->statuscode); | 724 | le16_to_cpu(passocrsp->statuscode)); |
742 | 725 | ||
743 | ret = -1; | 726 | ret = -1; |
744 | goto done; | 727 | goto done; |