aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi/cfg80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi/cfg80211.c')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index f3c55658225b..2e00a4b389e6 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -405,39 +405,21 @@ static int iwm_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
405{ 405{
406 struct iwm_priv *iwm = wiphy_to_iwm(wiphy); 406 struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
407 struct ieee80211_channel *chan = params->channel; 407 struct ieee80211_channel *chan = params->channel;
408 struct cfg80211_bss *bss;
409 408
410 if (!test_bit(IWM_STATUS_READY, &iwm->status)) 409 if (!test_bit(IWM_STATUS_READY, &iwm->status))
411 return -EIO; 410 return -EIO;
412 411
413 /* UMAC doesn't support creating IBSS network with specified bssid. 412 /* UMAC doesn't support creating or joining an IBSS network
414 * This should be removed after we have join only mode supported. */ 413 * with specified bssid. */
415 if (params->bssid) 414 if (params->bssid)
416 return -EOPNOTSUPP; 415 return -EOPNOTSUPP;
417 416
418 bss = cfg80211_get_ibss(iwm_to_wiphy(iwm), NULL,
419 params->ssid, params->ssid_len);
420 if (!bss) {
421 iwm_scan_one_ssid(iwm, params->ssid, params->ssid_len);
422 schedule_timeout_interruptible(2 * HZ);
423 bss = cfg80211_get_ibss(iwm_to_wiphy(iwm), NULL,
424 params->ssid, params->ssid_len);
425 }
426 /* IBSS join only mode is not supported by UMAC ATM */
427 if (bss) {
428 cfg80211_put_bss(bss);
429 return -EOPNOTSUPP;
430 }
431
432 iwm->channel = ieee80211_frequency_to_channel(chan->center_freq); 417 iwm->channel = ieee80211_frequency_to_channel(chan->center_freq);
433 iwm->umac_profile->ibss.band = chan->band; 418 iwm->umac_profile->ibss.band = chan->band;
434 iwm->umac_profile->ibss.channel = iwm->channel; 419 iwm->umac_profile->ibss.channel = iwm->channel;
435 iwm->umac_profile->ssid.ssid_len = params->ssid_len; 420 iwm->umac_profile->ssid.ssid_len = params->ssid_len;
436 memcpy(iwm->umac_profile->ssid.ssid, params->ssid, params->ssid_len); 421 memcpy(iwm->umac_profile->ssid.ssid, params->ssid, params->ssid_len);
437 422
438 if (params->bssid)
439 memcpy(&iwm->umac_profile->bssid[0], params->bssid, ETH_ALEN);
440
441 return iwm_send_mlme_profile(iwm); 423 return iwm_send_mlme_profile(iwm);
442} 424}
443 425
@@ -490,12 +472,12 @@ static int iwm_set_wpa_version(struct iwm_priv *iwm, u32 wpa_version)
490 return 0; 472 return 0;
491 } 473 }
492 474
475 if (wpa_version & NL80211_WPA_VERSION_1)
476 iwm->umac_profile->sec.flags = UMAC_SEC_FLG_WPA_ON_MSK;
477
493 if (wpa_version & NL80211_WPA_VERSION_2) 478 if (wpa_version & NL80211_WPA_VERSION_2)
494 iwm->umac_profile->sec.flags = UMAC_SEC_FLG_RSNA_ON_MSK; 479 iwm->umac_profile->sec.flags = UMAC_SEC_FLG_RSNA_ON_MSK;
495 480
496 if (wpa_version & NL80211_WPA_VERSION_1)
497 iwm->umac_profile->sec.flags |= UMAC_SEC_FLG_WPA_ON_MSK;
498
499 return 0; 481 return 0;
500} 482}
501 483
@@ -646,6 +628,13 @@ static int iwm_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
646 iwm->default_key = sme->key_idx; 628 iwm->default_key = sme->key_idx;
647 } 629 }
648 630
631 /* WPA and open AUTH type from wpa_s means WPS (a.k.a. WSC) */
632 if ((iwm->umac_profile->sec.flags &
633 (UMAC_SEC_FLG_WPA_ON_MSK | UMAC_SEC_FLG_RSNA_ON_MSK)) &&
634 iwm->umac_profile->sec.auth_type == UMAC_AUTH_TYPE_OPEN) {
635 iwm->umac_profile->sec.flags = UMAC_SEC_FLG_WSC_ON_MSK;
636 }
637
649 ret = iwm_send_mlme_profile(iwm); 638 ret = iwm_send_mlme_profile(iwm);
650 639
651 if (iwm->umac_profile->sec.auth_type != UMAC_AUTH_TYPE_LEGACY_PSK || 640 if (iwm->umac_profile->sec.auth_type != UMAC_AUTH_TYPE_LEGACY_PSK ||
@@ -682,9 +671,19 @@ static int iwm_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
682static int iwm_cfg80211_set_txpower(struct wiphy *wiphy, 671static int iwm_cfg80211_set_txpower(struct wiphy *wiphy,
683 enum tx_power_setting type, int dbm) 672 enum tx_power_setting type, int dbm)
684{ 673{
674 struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
675 int ret;
676
685 switch (type) { 677 switch (type) {
686 case TX_POWER_AUTOMATIC: 678 case TX_POWER_AUTOMATIC:
687 return 0; 679 return 0;
680 case TX_POWER_FIXED:
681 ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
682 CFG_TX_PWR_LIMIT_USR, dbm * 2);
683 if (ret < 0)
684 return ret;
685
686 return iwm_tx_power_trigger(iwm);
688 default: 687 default:
689 return -EOPNOTSUPP; 688 return -EOPNOTSUPP;
690 } 689 }
@@ -696,7 +695,7 @@ static int iwm_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
696{ 695{
697 struct iwm_priv *iwm = wiphy_to_iwm(wiphy); 696 struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
698 697
699 *dbm = iwm->txpower; 698 *dbm = iwm->txpower >> 1;
700 699
701 return 0; 700 return 0;
702} 701}