182
182
** cfg80211 connect utilites
184
184
static s32 wl_set_wpa_version(struct net_device *dev,
185
struct cfg80211_connect_params *sme);
185
struct cfg80211_connect_params *sme);
186
186
static s32 wl_set_auth_type(struct net_device *dev,
187
struct cfg80211_connect_params *sme);
187
struct cfg80211_connect_params *sme);
188
188
static s32 wl_set_set_cipher(struct net_device *dev,
189
struct cfg80211_connect_params *sme);
189
struct cfg80211_connect_params *sme);
190
190
static s32 wl_set_key_mgmt(struct net_device *dev,
191
struct cfg80211_connect_params *sme);
191
struct cfg80211_connect_params *sme);
192
192
static s32 wl_set_set_sharedkey(struct net_device *dev,
193
struct cfg80211_connect_params *sme);
193
struct cfg80211_connect_params *sme);
194
194
static s32 wl_get_assoc_ies(struct wl_priv *wl);
195
static void wl_clear_assoc_ies(struct wl_priv *wl);
195
196
static void wl_ch_to_chanspec(int ch,
196
197
struct wl_join_params *join_params, size_t *join_params_size);
199
200
** information element utilities
201
static void wl_rst_ie(struct wl_priv *wl);
202
202
static __used s32 wl_add_ie(struct wl_priv *wl, u8 t, u8 l, u8 *v);
203
static s32 wl_mrg_ie(struct wl_priv *wl, u8 *ie_stream, u16 ie_size);
204
static s32 wl_cp_ie(struct wl_priv *wl, u8 *dst, u16 dst_size);
205
static u32 wl_get_ielen(struct wl_priv *wl);
207
203
static s32 wl_mode_to_nl80211_iftype(s32 mode);
209
204
static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface,
211
206
static void wl_free_wdev(struct wl_priv *wl);
213
207
static s32 wl_inform_bss(struct wl_priv *wl);
214
208
static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi);
215
209
static s32 wl_update_bss_info(struct wl_priv *wl);
217
210
static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
218
u8 key_idx, const u8 *mac_addr,
219
struct key_params *params);
211
u8 key_idx, const u8 *mac_addr,
212
struct key_params *params);
222
215
** key indianess swap utilities
356
348
extern int dhd_wait_pend8021x(struct net_device *dev);
358
#if (WL_DBG_LEVEL > 0)
359
#define WL_DBG_ESTR_MAX 32
360
static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
361
"SET_SSID", "JOIN", "START", "AUTH", "AUTH_IND",
362
"DEAUTH", "DEAUTH_IND", "ASSOC", "ASSOC_IND", "REASSOC",
363
"REASSOC_IND", "DISASSOC", "DISASSOC_IND", "QUIET_START", "QUIET_END",
364
"BEACON_RX", "LINK", "MIC_ERROR", "NDIS_LINK", "ROAM",
365
"TXFAIL", "PMKID_CACHE", "RETROGRADE_TSF", "PRUNE", "AUTOAUTH",
366
"EAPOL_MSG", "SCAN_COMPLETE", "ADDTS_IND", "DELTS_IND", "BCNSENT_IND",
367
"BCNRX_MSG", "BCNLOST_MSG", "ROAM_PREP", "PFN_NET_FOUND",
369
"RESET_COMPLETE", "JOIN_START", "ROAM_START", "ASSOC_START",
371
"RADIO", "PSM_WATCHDOG",
373
"SCAN_CONFIRM_IND", "PSK_SUP", "COUNTRY_CODE_CHANGED",
374
"EXCEEDED_MEDIUM_TIME", "ICV_ERROR",
375
"UNICAST_DECODE_ERROR", "MULTICAST_DECODE_ERROR", "TRACE",
377
"RSSI", "PFN_SCAN_COMPLETE", "ACTION_FRAME", "ACTION_FRAME_COMPLETE",
379
#endif /* WL_DBG_LEVEL */
381
349
#define CHAN2G(_channel, _freq, _flags) { \
382
350
.band = IEEE80211_BAND_2GHZ, \
383
351
.center_freq = (_freq), \
556
524
static void swap_key_from_BE(struct wl_wsec_key *key)
558
key->index = htod32(key->index);
559
key->len = htod32(key->len);
560
key->algo = htod32(key->algo);
561
key->flags = htod32(key->flags);
562
key->rxiv.hi = htod32(key->rxiv.hi);
563
key->rxiv.lo = htod16(key->rxiv.lo);
564
key->iv_initialized = htod32(key->iv_initialized);
526
key->index = cpu_to_le32(key->index);
527
key->len = cpu_to_le32(key->len);
528
key->algo = cpu_to_le32(key->algo);
529
key->flags = cpu_to_le32(key->flags);
530
key->rxiv.hi = cpu_to_le32(key->rxiv.hi);
531
key->rxiv.lo = cpu_to_le16(key->rxiv.lo);
532
key->iv_initialized = cpu_to_le32(key->iv_initialized);
567
535
static void swap_key_to_BE(struct wl_wsec_key *key)
569
key->index = dtoh32(key->index);
570
key->len = dtoh32(key->len);
571
key->algo = dtoh32(key->algo);
572
key->flags = dtoh32(key->flags);
573
key->rxiv.hi = dtoh32(key->rxiv.hi);
574
key->rxiv.lo = dtoh16(key->rxiv.lo);
575
key->iv_initialized = dtoh32(key->iv_initialized);
537
key->index = le32_to_cpu(key->index);
538
key->len = le32_to_cpu(key->len);
539
key->algo = le32_to_cpu(key->algo);
540
key->flags = le32_to_cpu(key->flags);
541
key->rxiv.hi = le32_to_cpu(key->rxiv.hi);
542
key->rxiv.lo = le16_to_cpu(key->rxiv.lo);
543
key->iv_initialized = le32_to_cpu(key->iv_initialized);
992
961
struct cfg80211_ibss_params *params)
994
963
struct wl_priv *wl = wiphy_to_wl(wiphy);
995
struct cfg80211_bss *bss;
996
struct ieee80211_channel *chan;
997
964
struct wl_join_params join_params;
998
struct cfg80211_ssid ssid;
965
size_t join_params_size = 0;
974
WL_CONN("SSID: %s\n", params->ssid);
976
WL_CONN("SSID: NULL, Not supported\n");
981
WL_CONN("BSSID: %02X %02X %02X %02X %02X %02X\n",
982
params->bssid[0], params->bssid[1], params->bssid[2],
983
params->bssid[3], params->bssid[4], params->bssid[5]);
985
WL_CONN("No BSSID specified\n");
988
WL_CONN("channel: %d\n", params->channel->center_freq);
990
WL_CONN("no channel specified\n");
992
if (params->channel_fixed)
993
WL_CONN("fixed channel required\n");
995
WL_CONN("no fixed channel required\n");
997
if (params->ie && params->ie_len)
998
WL_CONN("ie len: %d\n", params->ie_len);
1000
WL_CONN("no ie specified\n");
1002
if (params->beacon_interval)
1003
WL_CONN("beacon interval: %d\n", params->beacon_interval);
1005
WL_CONN("no beacon interval specified\n");
1007
if (params->basic_rates)
1008
WL_CONN("basic rates: %08X\n", params->basic_rates);
1010
WL_CONN("no basic rates specified\n");
1012
if (params->privacy)
1013
WL_CONN("privacy required\n");
1015
WL_CONN("no privacy required\n");
1017
/* Configure Privacy for starter */
1018
if (params->privacy)
1019
wsec |= WEP_ENABLED;
1021
err = wl_dev_intvar_set(dev, "wsec", wsec);
1022
if (unlikely(err)) {
1023
WL_ERR("wsec failed (%d)\n", err);
1027
/* Configure Beacon Interval for starter */
1028
if (params->beacon_interval)
1029
bcnprd = cpu_to_le32(params->beacon_interval);
1031
bcnprd = cpu_to_le32(100);
1033
err = wl_dev_ioctl(dev, WLC_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
1034
if (unlikely(err)) {
1035
WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
1039
/* Configure required join parameter */
1040
memset(&join_params, 0, sizeof(wl_join_params_t));
1043
join_params.ssid.SSID_len =
1044
(params->ssid_len > 32) ? 32 : params->ssid_len;
1045
memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len);
1046
join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
1047
join_params_size = sizeof(join_params.ssid);
1048
wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);
1003
1051
if (params->bssid) {
1004
WL_ERR("Invalid bssid\n");
1007
bss = cfg80211_get_ibss(wiphy, NULL, params->ssid, params->ssid_len);
1009
memcpy(ssid.ssid, params->ssid, params->ssid_len);
1010
ssid.ssid_len = params->ssid_len;
1013
(__wl_cfg80211_scan(wiphy, dev, NULL, &ssid) ==
1019
} while (++scan_retry < WL_SCAN_RETRY_MAX);
1020
rtnl_unlock(); /* to allow scan_inform to paropagate
1021
to cfg80211 plane */
1022
schedule_timeout_interruptible(4 * HZ); /* wait 4 secons
1023
till scan done.... */
1025
bss = cfg80211_get_ibss(wiphy, NULL,
1026
params->ssid, params->ssid_len);
1029
wl->ibss_starter = false;
1030
WL_DBG("Found IBSS\n");
1052
memcpy(join_params.params.bssid, params->bssid, ETH_ALEN);
1054
sizeof(join_params.ssid) + WL_ASSOC_PARAMS_FIXED_SIZE;
1032
wl->ibss_starter = true;
1056
memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
1034
chan = params->channel;
1036
wl->channel = ieee80211_frequency_to_channel(chan->center_freq);
1038
** Join with specific BSSID and cached SSID
1039
** If SSID is zero join based on BSSID only
1041
memset(&join_params, 0, sizeof(join_params));
1042
memcpy((void *)join_params.ssid.SSID, (void *)params->ssid,
1044
join_params.ssid.SSID_len = htod32(params->ssid_len);
1046
memcpy(&join_params.params.bssid, params->bssid,
1049
memset(&join_params.params.bssid, 0, ETH_ALEN);
1051
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params,
1052
sizeof(join_params));
1058
wl_update_prof(wl, NULL, &join_params.params.bssid, WL_PROF_BSSID);
1061
if (params->channel) {
1065
ieee80211_frequency_to_channel(
1066
params->channel->center_freq);
1067
if (params->channel_fixed) {
1068
/* adding chanspec */
1069
wl_ch_to_chanspec(wl->channel,
1070
&join_params, &join_params_size);
1073
/* set channel for starter */
1074
target_channel = cpu_to_le32(wl->channel);
1075
err = wl_dev_ioctl(dev, WLC_SET_CHANNEL,
1076
&target_channel, sizeof(target_channel));
1077
if (unlikely(err)) {
1078
WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
1084
wl->ibss_starter = false;
1087
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
1053
1088
if (unlikely(err)) {
1054
WL_ERR("Error (%d)\n", err);
1089
WL_ERR("WLC_SET_SSID failed (%d)\n", err);
1093
set_bit(WL_STATUS_CONNECTING, &wl->status);
1372
1423
join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);
1373
1424
memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
1374
join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len);
1425
join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
1375
1426
wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);
1376
memcpy(&join_params.params.bssid, ðer_bcast, ETH_ALEN);
1378
wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);
1379
WL_DBG("join_param_size %d\n", join_params_size);
1429
memcpy(join_params.params.bssid, sme->bssid, ETH_ALEN);
1431
memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
1381
1433
if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
1382
WL_DBG("ssid \"%s\", len (%d)\n",
1434
WL_CONN("ssid \"%s\", len (%d)\n",
1383
1435
join_params.ssid.SSID, join_params.ssid.SSID_len);
1438
wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);
1385
1439
err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
1386
1440
if (unlikely(err)) {
1387
1441
WL_ERR("error (%d)\n", err);
1638
1708
switch (params->cipher) {
1639
1709
case WLAN_CIPHER_SUITE_WEP40:
1640
1710
key.algo = CRYPTO_ALGO_WEP1;
1641
WL_DBG("WLAN_CIPHER_SUITE_WEP40\n");
1711
WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
1643
1713
case WLAN_CIPHER_SUITE_WEP104:
1644
1714
key.algo = CRYPTO_ALGO_WEP128;
1645
WL_DBG("WLAN_CIPHER_SUITE_WEP104\n");
1715
WL_CONN("WLAN_CIPHER_SUITE_WEP104\n");
1647
1717
case WLAN_CIPHER_SUITE_TKIP:
1718
memcpy(keybuf, &key.data[24], sizeof(keybuf));
1719
memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
1720
memcpy(&key.data[16], keybuf, sizeof(keybuf));
1648
1721
key.algo = CRYPTO_ALGO_TKIP;
1649
WL_DBG("WLAN_CIPHER_SUITE_TKIP\n");
1722
WL_CONN("WLAN_CIPHER_SUITE_TKIP\n");
1651
1724
case WLAN_CIPHER_SUITE_AES_CMAC:
1652
1725
key.algo = CRYPTO_ALGO_AES_CCM;
1653
WL_DBG("WLAN_CIPHER_SUITE_AES_CMAC\n");
1726
WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n");
1655
1728
case WLAN_CIPHER_SUITE_CCMP:
1656
1729
key.algo = CRYPTO_ALGO_AES_CCM;
1657
WL_DBG("WLAN_CIPHER_SUITE_CCMP\n");
1730
WL_CONN("WLAN_CIPHER_SUITE_CCMP\n");
1660
1733
WL_ERR("Invalid cipher (0x%x)\n", params->cipher);
1664
1738
/* Set the new key/index */
1709
1784
key.flags = WL_PRIMARY_KEY;
1710
1785
key.algo = CRYPTO_ALGO_OFF;
1712
WL_DBG("key index (%d)\n", key_idx);
1787
WL_CONN("key index (%d)\n", key_idx);
1713
1788
/* Set the new key/index */
1714
1789
swap_key_from_BE(&key);
1715
1790
err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key));
1716
1791
if (unlikely(err)) {
1717
1792
if (err == -EINVAL) {
1718
if (key.index >= DOT11_MAX_DEFAULT_KEYS) {
1793
if (key.index >= DOT11_MAX_DEFAULT_KEYS)
1719
1794
/* we ignore this key index in this case */
1720
WL_DBG("invalid key index (%d)\n", key_idx);
1795
WL_ERR("invalid key index (%d)\n", key_idx);
1723
1797
WL_ERR("WLC_SET_KEY error (%d)\n", err);
1799
/* Ignore this error, may happen during DISASSOC */
1729
1805
err = wl_dev_intvar_get(dev, "wsec", &wsec);
1730
1806
if (unlikely(err)) {
1731
1807
WL_ERR("get wsec error (%d)\n", err);
1808
/* Ignore this error, may happen during DISASSOC */
1734
1812
wsec &= ~(WEP_ENABLED);
1736
1814
err = wl_dev_intvar_set(dev, "wsec", wsec);
1737
1815
if (unlikely(err)) {
1738
1816
WL_ERR("set wsec error (%d)\n", err);
1817
/* Ignore this error, may happen during DISASSOC */
1742
1822
val = 0; /* assume open key. otherwise 1 */
1823
val = cpu_to_le32(val);
1744
1824
err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val));
1745
1825
if (unlikely(err)) {
1746
1826
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
1827
/* Ignore this error, may happen during DISASSOC */
1764
WL_DBG("key index (%d)\n", key_idx);
1847
WL_TRACE("Enter\n");
1848
WL_CONN("key index (%d)\n", key_idx);
1765
1849
CHECK_SYS_UP();
1767
1851
memset(&key, 0, sizeof(key));
1768
1852
key.index = key_idx;
1769
1853
swap_key_to_BE(&key);
1770
1854
memset(¶ms, 0, sizeof(params));
1771
params.key_len = (u8) min_t(u8, DOT11_MAX_KEY_SIZE, key.len);
1855
params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);
1772
1856
memcpy(params.key, key.data, params.key_len);
1774
1858
err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));
1775
1859
if (unlikely(err)) {
1776
1860
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
1861
/* Ignore this error, may happen during DISASSOC */
1779
wsec = dtoh32(wsec);
1865
wsec = le32_to_cpu(wsec);
1780
1866
switch (wsec) {
1781
1867
case WEP_ENABLED:
1782
1868
sec = wl_read_prof(wl, WL_PROF_SEC);
1783
1869
if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
1784
1870
params.cipher = WLAN_CIPHER_SUITE_WEP40;
1785
WL_DBG("WLAN_CIPHER_SUITE_WEP40\n");
1871
WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
1786
1872
} else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) {
1787
1873
params.cipher = WLAN_CIPHER_SUITE_WEP104;
1788
WL_DBG("WLAN_CIPHER_SUITE_WEP104\n");
1874
WL_CONN("WLAN_CIPHER_SUITE_WEP104\n");
1791
1877
case TKIP_ENABLED:
1792
1878
params.cipher = WLAN_CIPHER_SUITE_TKIP;
1793
WL_DBG("WLAN_CIPHER_SUITE_TKIP\n");
1879
WL_CONN("WLAN_CIPHER_SUITE_TKIP\n");
1795
1881
case AES_ENABLED:
1796
1882
params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
1797
WL_DBG("WLAN_CIPHER_SUITE_AES_CMAC\n");
1883
WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n");
1800
1886
WL_ERR("Invalid algo (0x%x)\n", wsec);
1804
1890
callback(cookie, ¶ms);
1958
2061
err_a = wl_dev_intvar_set(dev, "a_rate", rate);
1959
2062
if (unlikely(err_bg && err_a)) {
1960
2063
WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);
1961
return err_bg | err_a;
2064
err = err_bg | err_a;
1967
2072
static s32 wl_cfg80211_resume(struct wiphy *wiphy)
1972
wl_invoke_iscan(wiphy_to_wl(wiphy));
2074
struct wl_priv *wl = wiphy_to_wl(wiphy);
2075
struct net_device *ndev = wl_to_ndev(wl);
2078
* Check for WL_STATUS_READY before any function call which
2079
* could result is bus access. Don't block the resume for
2080
* any driver error conditions
2082
WL_TRACE("Enter\n");
2084
#if defined(CONFIG_PM_SLEEP)
2085
atomic_set(&dhd_mmc_suspend, false);
2086
#endif /* defined(CONFIG_PM_SLEEP) */
2088
if (test_bit(WL_STATUS_READY, &wl->status)) {
2089
/* Turn on Watchdog timer */
2090
wl_os_wd_timer(ndev, dhd_watchdog_ms);
2091
wl_invoke_iscan(wiphy_to_wl(wiphy));
1977
2098
static s32 wl_cfg80211_suspend(struct wiphy *wiphy)
1979
2100
struct wl_priv *wl = wiphy_to_wl(wiphy);
1980
2101
struct net_device *ndev = wl_to_ndev(wl);
2103
WL_TRACE("Enter\n");
2106
* Check for WL_STATUS_READY before any function call which
2107
* could result is bus access. Don't block the suspend for
2108
* any driver error conditions
2112
* While going to suspend if associated with AP disassociate
2113
* from AP to save power while system is in suspended state
2115
if (test_bit(WL_STATUS_CONNECTED, &wl->status) &&
2116
test_bit(WL_STATUS_READY, &wl->status)) {
2117
WL_INFO("Disassociating from AP"
2118
" while entering suspend state\n");
2122
* Make sure WPA_Supplicant receives all the event
2123
* generated due to DISASSOC call to the fw to keep
2124
* the state fw and WPA_Supplicant state consistent
1985
2131
set_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
2132
if (test_bit(WL_STATUS_READY, &wl->status))
1987
2135
if (wl->scan_request) {
1988
cfg80211_scan_done(wl->scan_request, true); /* true means
1990
wl_set_mpc(ndev, 1);
2136
/* Indidate scan abort to cfg80211 layer */
2137
WL_INFO("Terminating scan in progress\n");
2138
cfg80211_scan_done(wl->scan_request, true);
1991
2139
wl->scan_request = NULL;
1993
2141
clear_bit(WL_STATUS_SCANNING, &wl->status);
1994
2142
clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
2143
clear_bit(WL_STATUS_CONNECTING, &wl->status);
2144
clear_bit(WL_STATUS_CONNECTED, &wl->status);
2146
/* Inform SDIO stack not to switch off power to the chip */
2147
sdioh_sdio_set_host_pm_flags(MMC_PM_KEEP_POWER);
2149
/* Turn off watchdog timer */
2150
if (test_bit(WL_STATUS_READY, &wl->status)) {
2151
WL_INFO("Terminate watchdog timer and enable MPC\n");
2152
wl_set_mpc(ndev, 1);
2153
wl_os_wd_timer(ndev, 0);
2156
#if defined(CONFIG_PM_SLEEP)
2157
atomic_set(&dhd_mmc_suspend, true);
2158
#endif /* defined(CONFIG_PM_SLEEP) */
1999
2165
static __used s32
2253
2425
static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
2255
2427
struct wiphy *wiphy = wl_to_wiphy(wl);
2256
struct ieee80211_mgmt *mgmt;
2257
struct ieee80211_channel *channel;
2428
struct ieee80211_channel *notify_channel;
2429
struct cfg80211_bss *bss;
2258
2430
struct ieee80211_supported_band *band;
2259
struct wl_cfg80211_bss_info *notif_bss_info;
2260
struct wl_scan_req *sr = wl_to_sr(wl);
2261
struct beacon_proberesp *beacon_proberesp;
2267
if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) {
2268
WL_DBG("Beacon is larger than buffer. Discarding\n");
2272
kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) +
2273
WL_BSS_INFO_MAX, GFP_KERNEL);
2274
if (unlikely(!notif_bss_info)) {
2275
WL_ERR("notif_bss_info alloc failed\n");
2278
mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf;
2279
notif_bss_info->channel =
2280
bi->ctl_ch ? bi->ctl_ch : CHSPEC_CHANNEL(bi->chanspec);
2282
if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL)
2434
u64 notify_timestamp;
2435
u16 notify_capability;
2436
u16 notify_interval;
2438
size_t notify_ielen;
2441
if (unlikely(le32_to_cpu(bi->length) > WL_BSS_INFO_MAX)) {
2442
WL_ERR("Bss info is larger than buffer. Discarding\n");
2446
channel = bi->ctl_ch ? bi->ctl_ch :
2447
CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec));
2449
if (channel <= CH_MAX_2G_CHANNEL)
2283
2450
band = wiphy->bands[IEEE80211_BAND_2GHZ];
2285
2452
band = wiphy->bands[IEEE80211_BAND_5GHZ];
2286
notif_bss_info->rssi = bi->RSSI;
2287
memcpy(mgmt->bssid, &bi->BSSID, ETH_ALEN);
2288
mgmt_type = wl->active_scan ?
2289
IEEE80211_STYPE_PROBE_RESP : IEEE80211_STYPE_BEACON;
2290
if (!memcmp(bi->SSID, sr->ssid.SSID, bi->SSID_len)) {
2291
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2294
beacon_proberesp = wl->active_scan ?
2295
(struct beacon_proberesp *)&mgmt->u.probe_resp :
2296
(struct beacon_proberesp *)&mgmt->u.beacon;
2297
beacon_proberesp->timestamp = 0;
2298
beacon_proberesp->beacon_int = cpu_to_le16(bi->beacon_period);
2299
beacon_proberesp->capab_info = cpu_to_le16(bi->capability);
2302
* wl_add_ie is not necessary because it can only add duplicated
2303
* SSID, rate information to frame_buf
2306
* wl_add_ie(wl, WLAN_EID_SSID, bi->SSID_len, bi->SSID);
2307
* wl_add_ie(wl, WLAN_EID_SUPP_RATES, bi->rateset.count,
2308
* bi->rateset.rates);
2310
wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length);
2311
wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX -
2312
offsetof(struct wl_cfg80211_bss_info, frame_buf));
2313
notif_bss_info->frame_len =
2314
offsetof(struct ieee80211_mgmt,
2315
u.beacon.variable) + wl_get_ielen(wl);
2316
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
2317
channel = ieee80211_get_channel(wiphy, freq);
2319
WL_DBG("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n",
2321
notif_bss_info->rssi, notif_bss_info->channel,
2322
mgmt->u.beacon.capab_info, &bi->BSSID);
2324
signal = notif_bss_info->rssi * 100;
2325
if (unlikely(!cfg80211_inform_bss_frame(wiphy, channel, mgmt,
2327
(notif_bss_info->frame_len),
2328
signal, GFP_KERNEL))) {
2454
freq = ieee80211_channel_to_frequency(channel, band->band);
2455
notify_channel = ieee80211_get_channel(wiphy, freq);
2457
notify_timestamp = jiffies_to_msecs(jiffies)*1000; /* uSec */
2458
notify_capability = le16_to_cpu(bi->capability);
2459
notify_interval = le16_to_cpu(bi->beacon_period);
2460
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
2461
notify_ielen = le16_to_cpu(bi->ie_length);
2462
notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
2464
WL_CONN("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2465
bi->BSSID[0], bi->BSSID[1], bi->BSSID[2],
2466
bi->BSSID[3], bi->BSSID[4], bi->BSSID[5]);
2467
WL_CONN("Channel: %d(%d)\n", channel, freq);
2468
WL_CONN("Capability: %X\n", notify_capability);
2469
WL_CONN("Beacon interval: %d\n", notify_interval);
2470
WL_CONN("Signal: %d\n", notify_signal);
2471
WL_CONN("notify_timestamp: %#018llx\n", notify_timestamp);
2473
bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID,
2474
notify_timestamp, notify_capability, notify_interval, notify_ie,
2475
notify_ielen, notify_signal, GFP_KERNEL);
2477
if (unlikely(!bss)) {
2329
2478
WL_ERR("cfg80211_inform_bss_frame error\n");
2330
kfree(notif_bss_info);
2331
2479
return -EINVAL;
2333
kfree(notif_bss_info);
2486
wl_inform_ibss(struct wl_priv *wl, struct net_device *dev, const u8 *bssid)
2488
struct wiphy *wiphy = wl_to_wiphy(wl);
2489
struct ieee80211_channel *notify_channel;
2490
struct wl_bss_info *bi = NULL;
2491
struct ieee80211_supported_band *band;
2496
u64 notify_timestamp;
2497
u16 notify_capability;
2498
u16 notify_interval;
2500
size_t notify_ielen;
2503
WL_TRACE("Enter\n");
2505
buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
2507
WL_ERR("kzalloc() failed\n");
2512
*(u32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
2514
err = wl_dev_ioctl(dev, WLC_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
2515
if (unlikely(err)) {
2516
WL_ERR("WLC_GET_BSS_INFO failed: %d\n", err);
2520
bi = (wl_bss_info_t *)(buf + 4);
2522
channel = bi->ctl_ch ? bi->ctl_ch :
2523
CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec));
2525
if (channel <= CH_MAX_2G_CHANNEL)
2526
band = wiphy->bands[IEEE80211_BAND_2GHZ];
2528
band = wiphy->bands[IEEE80211_BAND_5GHZ];
2530
freq = ieee80211_channel_to_frequency(channel, band->band);
2531
notify_channel = ieee80211_get_channel(wiphy, freq);
2533
notify_timestamp = jiffies_to_msecs(jiffies)*1000; /* uSec */
2534
notify_capability = le16_to_cpu(bi->capability);
2535
notify_interval = le16_to_cpu(bi->beacon_period);
2536
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
2537
notify_ielen = le16_to_cpu(bi->ie_length);
2538
notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
2540
WL_CONN("channel: %d(%d)\n", channel, freq);
2541
WL_CONN("capability: %X\n", notify_capability);
2542
WL_CONN("beacon interval: %d\n", notify_interval);
2543
WL_CONN("signal: %d\n", notify_signal);
2544
WL_CONN("notify_timestamp: %#018llx\n", notify_timestamp);
2546
cfg80211_inform_bss(wiphy, notify_channel, bssid,
2547
notify_timestamp, notify_capability, notify_interval,
2548
notify_ie, notify_ielen, notify_signal, GFP_KERNEL);
2338
2559
static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
2340
u32 event = ntoh32(e->event_type);
2341
u16 flags = ntoh16(e->flags);
2561
u32 event = be32_to_cpu(e->event_type);
2562
u32 status = be32_to_cpu(e->status);
2343
if (event == WLC_E_LINK) {
2344
if (flags & WLC_EVENT_MSG_LINK) {
2345
if (wl_is_ibssmode(wl)) {
2346
if (wl_is_ibssstarter(wl)) {
2564
if (event == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) {
2565
WL_CONN("Processing set ssid\n");
2386
2606
wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev,
2387
2607
const wl_event_msg_t *e, void *data)
2392
2611
if (wl_is_linkup(wl, e)) {
2612
WL_CONN("Linkup\n");
2394
2613
if (wl_is_ibssmode(wl)) {
2395
cfg80211_ibss_joined(ndev, (s8 *)&e->addr,
2397
WL_DBG("joined in IBSS network\n");
2614
wl_update_prof(wl, NULL, (void *)e->addr,
2616
wl_inform_ibss(wl, ndev, e->addr);
2617
cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL);
2618
clear_bit(WL_STATUS_CONNECTING, &wl->status);
2619
set_bit(WL_STATUS_CONNECTED, &wl->status);
2399
2621
wl_bss_connect_done(wl, ndev, e, data, true);
2400
WL_DBG("joined in BSS network \"%s\"\n",
2401
((struct wlc_ssid *)
2402
wl_read_prof(wl, WL_PROF_SSID))->SSID);
2405
wl_update_prof(wl, e, &act, WL_PROF_ACT);
2406
2622
} else if (wl_is_linkdown(wl, e)) {
2407
cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL);
2408
clear_bit(WL_STATUS_CONNECTED, &wl->status);
2623
WL_CONN("Linkdown\n");
2624
if (wl_is_ibssmode(wl)) {
2625
if (test_and_clear_bit(WL_STATUS_CONNECTED,
2629
if (test_and_clear_bit(WL_STATUS_CONNECTED,
2631
cfg80211_disconnected(ndev, 0, NULL, 0,
2410
2636
wl_init_prof(wl->profile);
2411
2637
} else if (wl_is_nonetwork(wl, e)) {
2412
wl_bss_connect_done(wl, ndev, e, data, false);
2638
if (wl_is_ibssmode(wl))
2639
clear_bit(WL_STATUS_CONNECTING, &wl->status);
2641
wl_bss_connect_done(wl, ndev, e, data, false);
2810
WL_TRACE("Enter\n");
2562
2811
if (wl_is_ibssmode(wl))
2565
2814
ssid = (struct wlc_ssid *)wl_read_prof(wl, WL_PROF_SSID);
2567
cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
2568
ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS,
2569
WLAN_CAPABILITY_ESS);
2572
if (unlikely(!bss)) {
2573
WL_DBG("Could not find the AP\n");
2574
*(u32 *) wl->extra_buf = htod32(WL_EXTRA_BUF_MAX);
2575
err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO,
2576
wl->extra_buf, WL_EXTRA_BUF_MAX);
2577
if (unlikely(err)) {
2578
WL_ERR("Could not get bss info %d\n", err);
2579
goto update_bss_info_out;
2581
bi = (struct wl_bss_info *)(wl->extra_buf + 4);
2582
if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETH_ALEN))) {
2584
goto update_bss_info_out;
2586
err = wl_inform_single_bss(wl, bi);
2588
goto update_bss_info_out;
2590
ie = ((u8 *)bi) + bi->ie_offset;
2591
ie_len = bi->ie_length;
2592
beacon_interval = cpu_to_le16(bi->beacon_period);
2594
WL_DBG("Found the AP in the list - BSSID %pM\n", bss->bssid);
2595
ie = bss->information_elements;
2596
ie_len = bss->len_information_elements;
2597
beacon_interval = bss->beacon_interval;
2598
cfg80211_put_bss(bss);
2816
*(u32 *)wl->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
2817
err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO,
2818
wl->extra_buf, WL_EXTRA_BUF_MAX);
2819
if (unlikely(err)) {
2820
WL_ERR("Could not get bss info %d\n", err);
2821
goto update_bss_info_out;
2824
bi = (struct wl_bss_info *)(wl->extra_buf + 4);
2825
err = wl_inform_single_bss(wl, bi);
2827
goto update_bss_info_out;
2829
ie = ((u8 *)bi) + bi->ie_offset;
2830
ie_len = bi->ie_length;
2831
beacon_interval = cpu_to_le16(bi->beacon_period);
2601
2833
tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
2603
2835
dtim_period = tim->data[1];
2606
2838
* active scan was done so we could not get dtim
2607
2839
* information out of probe response.
2608
2840
* so we speficially query dtim information to dongle.
2610
err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_DTIMPRD,
2611
&dtim_period, sizeof(dtim_period));
2843
err = wl_dev_intvar_get(wl_to_ndev(wl), "dtim_assoc", &var);
2612
2844
if (unlikely(err)) {
2613
WL_ERR("WLC_GET_DTIMPRD error (%d)\n", err);
2845
WL_ERR("wl dtim_assoc failed (%d)\n", err);
2614
2846
goto update_bss_info_out;
2848
dtim_period = (u8)var;
2618
2851
wl_update_prof(wl, NULL, &beacon_interval, WL_PROF_BEACONINT);
2619
2852
wl_update_prof(wl, NULL, &dtim_period, WL_PROF_DTIMPERIOD);
2621
2854
update_bss_info_out:
2706
2940
struct wl_scan_results *bss_list;
2707
2941
u32 len = WL_SCAN_BUF_MAX;
2710
if (wl->iscan_on && wl->iscan_kickstart)
2943
bool scan_abort = false;
2945
WL_TRACE("Enter\n");
2947
if (wl->iscan_on && wl->iscan_kickstart) {
2711
2949
return wl_wakeup_iscan(wl_to_iscan(wl));
2713
2952
if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) {
2714
2953
WL_ERR("Scan complete while device not scanning\n");
2717
if (unlikely(!wl->scan_request)) {
2720
2959
err = wl_dev_ioctl(ndev, WLC_GET_CHANNEL, &channel_inform,
2721
2960
sizeof(channel_inform));
2722
2961
if (unlikely(err)) {
2723
2962
WL_ERR("scan busy (%d)\n", err);
2724
2964
goto scan_done_out;
2726
channel_inform.scan_channel = dtoh32(channel_inform.scan_channel);
2966
channel_inform.scan_channel = le32_to_cpu(channel_inform.scan_channel);
2727
2967
if (unlikely(channel_inform.scan_channel)) {
2729
WL_DBG("channel_inform.scan_channel (%d)\n",
2969
WL_CONN("channel_inform.scan_channel (%d)\n",
2730
2970
channel_inform.scan_channel);
2732
2972
wl->bss_list = wl->scan_results;
2733
2973
bss_list = wl->bss_list;
2734
2974
memset(bss_list, 0, len);
2735
bss_list->buflen = htod32(len);
2975
bss_list->buflen = cpu_to_le32(len);
2736
2977
err = wl_dev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len);
2737
2978
if (unlikely(err)) {
2738
2979
WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
2740
2982
goto scan_done_out;
2742
bss_list->buflen = dtoh32(bss_list->buflen);
2743
bss_list->version = dtoh32(bss_list->version);
2744
bss_list->count = dtoh32(bss_list->count);
2984
bss_list->buflen = le32_to_cpu(bss_list->buflen);
2985
bss_list->version = le32_to_cpu(bss_list->version);
2986
bss_list->count = le32_to_cpu(bss_list->count);
2746
2988
err = wl_inform_bss(wl);
2748
2991
goto scan_done_out;
2751
2995
if (wl->scan_request) {
2752
cfg80211_scan_done(wl->scan_request, false);
2996
WL_SCAN("calling cfg80211_scan_done\n");
2997
cfg80211_scan_done(wl->scan_request, scan_abort);
2753
2998
wl_set_mpc(ndev, 1);
2754
2999
wl->scan_request = NULL;
3471
wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
3473
s8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +
3477
/* Setup timeout if Beacons are lost and roam is
3478
off to report link down */
3480
bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
3482
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3483
if (unlikely(err)) {
3484
WL_ERR("bcn_timeout error (%d)\n", err);
3485
goto dongle_rom_out;
3488
/* Enable/Disable built-in roaming to allow supplicant
3489
to take care of roaming */
3490
bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf));
3491
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3492
if (unlikely(err)) {
3493
WL_ERR("roam_off error (%d)\n", err);
3494
goto dongle_rom_out;
3500
static s32 wl_dongle_eventmsg(struct net_device *ndev)
3503
s8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +
3505
s8 eventmask[WL_EVENTING_MASK_LEN];
3508
/* Setup event_msgs */
3509
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf,
3511
err = wl_dev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
3512
if (unlikely(err)) {
3513
WL_ERR("Get event_msgs error (%d)\n", err);
3514
goto dongle_eventmsg_out;
3516
memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN);
3518
setbit(eventmask, WLC_E_SET_SSID);
3519
setbit(eventmask, WLC_E_PRUNE);
3520
setbit(eventmask, WLC_E_AUTH);
3521
setbit(eventmask, WLC_E_REASSOC);
3522
setbit(eventmask, WLC_E_REASSOC_IND);
3523
setbit(eventmask, WLC_E_DEAUTH_IND);
3524
setbit(eventmask, WLC_E_DISASSOC_IND);
3525
setbit(eventmask, WLC_E_DISASSOC);
3526
setbit(eventmask, WLC_E_JOIN);
3527
setbit(eventmask, WLC_E_ASSOC_IND);
3528
setbit(eventmask, WLC_E_PSK_SUP);
3529
setbit(eventmask, WLC_E_LINK);
3530
setbit(eventmask, WLC_E_NDIS_LINK);
3531
setbit(eventmask, WLC_E_MIC_ERROR);
3532
setbit(eventmask, WLC_E_PMKID_CACHE);
3533
setbit(eventmask, WLC_E_TXFAIL);
3534
setbit(eventmask, WLC_E_JOIN_START);
3535
setbit(eventmask, WLC_E_SCAN_COMPLETE);
3537
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf,
3539
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3540
if (unlikely(err)) {
3541
WL_ERR("Set event_msgs error (%d)\n", err);
3542
goto dongle_eventmsg_out;
3545
dongle_eventmsg_out:
3550
wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
3551
s32 scan_unassoc_time)
3555
err = wl_dev_ioctl(ndev, WLC_SET_SCAN_CHANNEL_TIME, &scan_assoc_time,
3556
sizeof(scan_assoc_time));
3558
if (err == -EOPNOTSUPP) {
3559
WL_INFO("Scan assoc time is not supported\n");
3561
WL_ERR("Scan assoc time error (%d)\n", err);
3563
goto dongle_scantime_out;
3565
err = wl_dev_ioctl(ndev, WLC_SET_SCAN_UNASSOC_TIME, &scan_unassoc_time,
3566
sizeof(scan_unassoc_time));
3568
if (err == -EOPNOTSUPP) {
3569
WL_INFO("Scan unassoc time is not supported\n");
3571
WL_ERR("Scan unassoc time error (%d)\n", err);
3573
goto dongle_scantime_out;
3576
dongle_scantime_out:
3581
3703
wl_dongle_offload(struct net_device *ndev, s32 arpoe, s32 arp_ol)
3583
3705
s8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +
3724
3848
#endif /* !EMBEDDED_PLATFORM */
3850
static s32 wl_dongle_eventmsg(struct net_device *ndev)
3852
s8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" +
3854
s8 eventmask[WL_EVENTING_MASK_LEN];
3857
WL_TRACE("Enter\n");
3859
/* Setup event_msgs */
3860
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf,
3862
err = wl_dev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
3863
if (unlikely(err)) {
3864
WL_ERR("Get event_msgs error (%d)\n", err);
3865
goto dongle_eventmsg_out;
3867
memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN);
3869
setbit(eventmask, WLC_E_SET_SSID);
3870
setbit(eventmask, WLC_E_ROAM);
3871
setbit(eventmask, WLC_E_PRUNE);
3872
setbit(eventmask, WLC_E_AUTH);
3873
setbit(eventmask, WLC_E_REASSOC);
3874
setbit(eventmask, WLC_E_REASSOC_IND);
3875
setbit(eventmask, WLC_E_DEAUTH_IND);
3876
setbit(eventmask, WLC_E_DISASSOC_IND);
3877
setbit(eventmask, WLC_E_DISASSOC);
3878
setbit(eventmask, WLC_E_JOIN);
3879
setbit(eventmask, WLC_E_ASSOC_IND);
3880
setbit(eventmask, WLC_E_PSK_SUP);
3881
setbit(eventmask, WLC_E_LINK);
3882
setbit(eventmask, WLC_E_NDIS_LINK);
3883
setbit(eventmask, WLC_E_MIC_ERROR);
3884
setbit(eventmask, WLC_E_PMKID_CACHE);
3885
setbit(eventmask, WLC_E_TXFAIL);
3886
setbit(eventmask, WLC_E_JOIN_START);
3887
setbit(eventmask, WLC_E_SCAN_COMPLETE);
3889
bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf,
3891
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3892
if (unlikely(err)) {
3893
WL_ERR("Set event_msgs error (%d)\n", err);
3894
goto dongle_eventmsg_out;
3897
dongle_eventmsg_out:
3903
wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
3911
* Setup timeout if Beacons are lost and roam is
3912
* off to report link down
3915
bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout,
3916
sizeof(bcn_timeout), iovbuf, sizeof(iovbuf));
3917
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3918
if (unlikely(err)) {
3919
WL_ERR("bcn_timeout error (%d)\n", err);
3920
goto dongle_rom_out;
3925
* Enable/Disable built-in roaming to allow supplicant
3926
* to take care of roaming
3928
WL_INFO("Internal Roaming = %s\n", roamvar ? "Off" : "On");
3929
bcm_mkiovar("roam_off", (char *)&roamvar,
3930
sizeof(roamvar), iovbuf, sizeof(iovbuf));
3931
err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
3932
if (unlikely(err)) {
3933
WL_ERR("roam_off error (%d)\n", err);
3934
goto dongle_rom_out;
3937
roamtrigger[0] = WL_ROAM_TRIGGER_LEVEL;
3938
roamtrigger[1] = WLC_BAND_ALL;
3939
err = wl_dev_ioctl(ndev, WLC_SET_ROAM_TRIGGER,
3940
(void *)roamtrigger, sizeof(roamtrigger));
3941
if (unlikely(err)) {
3942
WL_ERR("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
3943
goto dongle_rom_out;
3946
roam_delta[0] = WL_ROAM_DELTA;
3947
roam_delta[1] = WLC_BAND_ALL;
3948
err = wl_dev_ioctl(ndev, WLC_SET_ROAM_DELTA,
3949
(void *)roam_delta, sizeof(roam_delta));
3950
if (unlikely(err)) {
3951
WL_ERR("WLC_SET_ROAM_DELTA error (%d)\n", err);
3952
goto dongle_rom_out;
3960
wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
3961
s32 scan_unassoc_time, s32 scan_passive_time)
3965
err = wl_dev_ioctl(ndev, WLC_SET_SCAN_CHANNEL_TIME, &scan_assoc_time,
3966
sizeof(scan_assoc_time));
3968
if (err == -EOPNOTSUPP)
3969
WL_INFO("Scan assoc time is not supported\n");
3971
WL_ERR("Scan assoc time error (%d)\n", err);
3972
goto dongle_scantime_out;
3974
err = wl_dev_ioctl(ndev, WLC_SET_SCAN_UNASSOC_TIME, &scan_unassoc_time,
3975
sizeof(scan_unassoc_time));
3977
if (err == -EOPNOTSUPP)
3978
WL_INFO("Scan unassoc time is not supported\n");
3980
WL_ERR("Scan unassoc time error (%d)\n", err);
3981
goto dongle_scantime_out;
3984
err = wl_dev_ioctl(ndev, WLC_SET_SCAN_PASSIVE_TIME, &scan_passive_time,
3985
sizeof(scan_passive_time));
3987
if (err == -EOPNOTSUPP)
3988
WL_INFO("Scan passive time is not supported\n");
3990
WL_ERR("Scan passive time error (%d)\n", err);
3991
goto dongle_scantime_out;
3994
dongle_scantime_out:
3726
3998
s32 wl_config_dongle(struct wl_priv *wl, bool need_lock)
3728
4000
#ifndef DHD_SDALIGN
3999
static s32 wl_mrg_ie(struct wl_priv *wl, u8 *ie_stream, u16 ie_size)
4001
struct wl_ie *ie = wl_to_ie(wl);
4004
if (unlikely(ie->offset + ie_size > WL_TLV_INFO_MAX)) {
4005
WL_ERR("ei_stream crosses buffer boundary\n");
4008
memcpy(&ie->buf[ie->offset], ie_stream, ie_size);
4009
ie->offset += ie_size;
4014
static s32 wl_cp_ie(struct wl_priv *wl, u8 *dst, u16 dst_size)
4016
struct wl_ie *ie = wl_to_ie(wl);
4019
if (unlikely(ie->offset > dst_size)) {
4020
WL_ERR("dst_size is not enough\n");
4023
memcpy(dst, &ie->buf[0], ie->offset);
4028
static u32 wl_get_ielen(struct wl_priv *wl)
4030
struct wl_ie *ie = wl_to_ie(wl);
4035
static void wl_link_up(struct wl_priv *wl)
4040
4236
static void wl_link_down(struct wl_priv *wl)
4042
struct wl_connect_info *conn_info = wl_to_conn(wl);
4044
wl->link_up = false;
4045
kfree(conn_info->req_ie);
4046
conn_info->req_ie = NULL;
4047
conn_info->req_ie_len = 0;
4048
kfree(conn_info->resp_ie);
4049
conn_info->resp_ie = NULL;
4050
conn_info->resp_ie_len = 0;
4238
struct net_device *dev = NULL;
4241
WL_TRACE("Enter\n");
4242
clear_bit(WL_STATUS_CONNECTED, &wl->status);
4245
dev = wl_to_ndev(wl);
4246
WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
4247
err = wl_dev_ioctl(dev, WLC_DISASSOC, NULL, 0);
4249
WL_ERR("WLC_DISASSOC failed (%d)\n", err);
4250
wl->link_up = false;
4053
4255
static void wl_lock_eq(struct wl_priv *wl)