cfg80211.c (1cbc99dfe5d7d686fd022647f4e489b5eb8e9068) | cfg80211.c (7705ba6f7badb8cf38a0a19dad71e11a77ecb9cd) |
---|---|
1/* 2 * Copyright (c) 2010 Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 130 unchanged lines hidden (view full) --- 139}; 140 141#define wl_g_rates (__wl_rates + 0) 142#define wl_g_rates_size ARRAY_SIZE(__wl_rates) 143#define wl_a_rates (__wl_rates + 4) 144#define wl_a_rates_size (wl_g_rates_size - 4) 145 146#define CHAN2G(_channel, _freq) { \ | 1/* 2 * Copyright (c) 2010 Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 130 unchanged lines hidden (view full) --- 139}; 140 141#define wl_g_rates (__wl_rates + 0) 142#define wl_g_rates_size ARRAY_SIZE(__wl_rates) 143#define wl_a_rates (__wl_rates + 4) 144#define wl_a_rates_size (wl_g_rates_size - 4) 145 146#define CHAN2G(_channel, _freq) { \ |
147 .band = IEEE80211_BAND_2GHZ, \ | 147 .band = NL80211_BAND_2GHZ, \ |
148 .center_freq = (_freq), \ 149 .hw_value = (_channel), \ 150 .flags = IEEE80211_CHAN_DISABLED, \ 151 .max_antenna_gain = 0, \ 152 .max_power = 30, \ 153} 154 155#define CHAN5G(_channel) { \ | 148 .center_freq = (_freq), \ 149 .hw_value = (_channel), \ 150 .flags = IEEE80211_CHAN_DISABLED, \ 151 .max_antenna_gain = 0, \ 152 .max_power = 30, \ 153} 154 155#define CHAN5G(_channel) { \ |
156 .band = IEEE80211_BAND_5GHZ, \ | 156 .band = NL80211_BAND_5GHZ, \ |
157 .center_freq = 5000 + (5 * (_channel)), \ 158 .hw_value = (_channel), \ 159 .flags = IEEE80211_CHAN_DISABLED, \ 160 .max_antenna_gain = 0, \ 161 .max_power = 30, \ 162} 163 164static struct ieee80211_channel __wl_2ghz_channels[] = { --- 11 unchanged lines hidden (view full) --- 176 CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149), 177 CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165) 178}; 179 180/* Band templates duplicated per wiphy. The channel info 181 * above is added to the band during setup. 182 */ 183static const struct ieee80211_supported_band __wl_band_2ghz = { | 157 .center_freq = 5000 + (5 * (_channel)), \ 158 .hw_value = (_channel), \ 159 .flags = IEEE80211_CHAN_DISABLED, \ 160 .max_antenna_gain = 0, \ 161 .max_power = 30, \ 162} 163 164static struct ieee80211_channel __wl_2ghz_channels[] = { --- 11 unchanged lines hidden (view full) --- 176 CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149), 177 CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165) 178}; 179 180/* Band templates duplicated per wiphy. The channel info 181 * above is added to the band during setup. 182 */ 183static const struct ieee80211_supported_band __wl_band_2ghz = { |
184 .band = IEEE80211_BAND_2GHZ, | 184 .band = NL80211_BAND_2GHZ, |
185 .bitrates = wl_g_rates, 186 .n_bitrates = wl_g_rates_size, 187}; 188 189static const struct ieee80211_supported_band __wl_band_5ghz = { | 185 .bitrates = wl_g_rates, 186 .n_bitrates = wl_g_rates_size, 187}; 188 189static const struct ieee80211_supported_band __wl_band_5ghz = { |
190 .band = IEEE80211_BAND_5GHZ, | 190 .band = NL80211_BAND_5GHZ, |
191 .bitrates = wl_a_rates, 192 .n_bitrates = wl_a_rates_size, 193}; 194 195/* This is to override regulatory domains defined in cfg80211 module (reg.c) 196 * By default world regulatory domain defined in reg.c puts the flags 197 * NL80211_RRF_NO_IR for 5GHz channels (for * 36..48 and 149..165). 198 * With respect to these flags, wpa_supplicant doesn't * start p2p --- 46 unchanged lines hidden (view full) --- 245 struct brcmf_vs_tlv vndrie; 246}; 247 248struct parsed_vndr_ies { 249 u32 count; 250 struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT]; 251}; 252 | 191 .bitrates = wl_a_rates, 192 .n_bitrates = wl_a_rates_size, 193}; 194 195/* This is to override regulatory domains defined in cfg80211 module (reg.c) 196 * By default world regulatory domain defined in reg.c puts the flags 197 * NL80211_RRF_NO_IR for 5GHz channels (for * 36..48 and 149..165). 198 * With respect to these flags, wpa_supplicant doesn't * start p2p --- 46 unchanged lines hidden (view full) --- 245 struct brcmf_vs_tlv vndrie; 246}; 247 248struct parsed_vndr_ies { 249 u32 count; 250 struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT]; 251}; 252 |
253static u8 nl80211_band_to_fwil(enum nl80211_band band) 254{ 255 switch (band) { 256 case NL80211_BAND_2GHZ: 257 return WLC_BAND_2G; 258 case NL80211_BAND_5GHZ: 259 return WLC_BAND_5G; 260 default: 261 WARN_ON(1); 262 break; 263 } 264 return 0; 265} 266 |
|
253static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, 254 struct cfg80211_chan_def *ch) 255{ 256 struct brcmu_chan ch_inf; 257 s32 primary_offset; 258 259 brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", 260 ch->chan->center_freq, ch->center_freq1, ch->width); --- 26 unchanged lines hidden (view full) --- 287 case NL80211_CHAN_WIDTH_80P80: 288 case NL80211_CHAN_WIDTH_160: 289 case NL80211_CHAN_WIDTH_5: 290 case NL80211_CHAN_WIDTH_10: 291 default: 292 WARN_ON_ONCE(1); 293 } 294 switch (ch->chan->band) { | 267static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, 268 struct cfg80211_chan_def *ch) 269{ 270 struct brcmu_chan ch_inf; 271 s32 primary_offset; 272 273 brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", 274 ch->chan->center_freq, ch->center_freq1, ch->width); --- 26 unchanged lines hidden (view full) --- 301 case NL80211_CHAN_WIDTH_80P80: 302 case NL80211_CHAN_WIDTH_160: 303 case NL80211_CHAN_WIDTH_5: 304 case NL80211_CHAN_WIDTH_10: 305 default: 306 WARN_ON_ONCE(1); 307 } 308 switch (ch->chan->band) { |
295 case IEEE80211_BAND_2GHZ: | 309 case NL80211_BAND_2GHZ: |
296 ch_inf.band = BRCMU_CHAN_BAND_2G; 297 break; | 310 ch_inf.band = BRCMU_CHAN_BAND_2G; 311 break; |
298 case IEEE80211_BAND_5GHZ: | 312 case NL80211_BAND_5GHZ: |
299 ch_inf.band = BRCMU_CHAN_BAND_5G; 300 break; | 313 ch_inf.band = BRCMU_CHAN_BAND_5G; 314 break; |
301 case IEEE80211_BAND_60GHZ: | 315 case NL80211_BAND_60GHZ: |
302 default: 303 WARN_ON_ONCE(1); 304 } 305 d11inf->encchspec(&ch_inf); 306 307 return ch_inf.chspec; 308} 309 --- 1481 unchanged lines hidden (view full) --- 1791 if (type == NL80211_AUTHTYPE_AUTOMATIC && 1792 brcmf_feat_is_quirk_enabled(ifp, BRCMF_FEAT_QUIRK_AUTO_AUTH)) { 1793 brcmf_dbg(CONN, "WAR: use OPEN instead of AUTO\n"); 1794 type = NL80211_AUTHTYPE_OPEN_SYSTEM; 1795 } 1796 return type; 1797} 1798 | 316 default: 317 WARN_ON_ONCE(1); 318 } 319 d11inf->encchspec(&ch_inf); 320 321 return ch_inf.chspec; 322} 323 --- 1481 unchanged lines hidden (view full) --- 1805 if (type == NL80211_AUTHTYPE_AUTOMATIC && 1806 brcmf_feat_is_quirk_enabled(ifp, BRCMF_FEAT_QUIRK_AUTO_AUTH)) { 1807 brcmf_dbg(CONN, "WAR: use OPEN instead of AUTO\n"); 1808 type = NL80211_AUTHTYPE_OPEN_SYSTEM; 1809 } 1810 return type; 1811} 1812 |
1813static void brcmf_set_join_pref(struct brcmf_if *ifp, 1814 struct cfg80211_bss_selection *bss_select) 1815{ 1816 struct brcmf_join_pref_params join_pref_params[2]; 1817 enum nl80211_band band; 1818 int err, i = 0; 1819 1820 join_pref_params[i].len = 2; 1821 join_pref_params[i].rssi_gain = 0; 1822 1823 if (bss_select->behaviour != NL80211_BSS_SELECT_ATTR_BAND_PREF) 1824 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_ASSOC_PREFER, WLC_BAND_AUTO); 1825 1826 switch (bss_select->behaviour) { 1827 case __NL80211_BSS_SELECT_ATTR_INVALID: 1828 brcmf_c_set_joinpref_default(ifp); 1829 return; 1830 case NL80211_BSS_SELECT_ATTR_BAND_PREF: 1831 join_pref_params[i].type = BRCMF_JOIN_PREF_BAND; 1832 band = bss_select->param.band_pref; 1833 join_pref_params[i].band = nl80211_band_to_fwil(band); 1834 i++; 1835 break; 1836 case NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: 1837 join_pref_params[i].type = BRCMF_JOIN_PREF_RSSI_DELTA; 1838 band = bss_select->param.adjust.band; 1839 join_pref_params[i].band = nl80211_band_to_fwil(band); 1840 join_pref_params[i].rssi_gain = bss_select->param.adjust.delta; 1841 i++; 1842 break; 1843 case NL80211_BSS_SELECT_ATTR_RSSI: 1844 default: 1845 break; 1846 } 1847 join_pref_params[i].type = BRCMF_JOIN_PREF_RSSI; 1848 join_pref_params[i].len = 2; 1849 join_pref_params[i].rssi_gain = 0; 1850 join_pref_params[i].band = 0; 1851 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, 1852 sizeof(join_pref_params)); 1853 if (err) 1854 brcmf_err("Set join_pref error (%d)\n", err); 1855} 1856 |
|
1799static s32 1800brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, 1801 struct cfg80211_connect_params *sme) 1802{ 1803 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1804 struct brcmf_if *ifp = netdev_priv(ndev); 1805 struct ieee80211_channel *chan = sme->channel; 1806 struct brcmf_join_params join_params; --- 140 unchanged lines hidden (view full) --- 1947 cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS / 1948 BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS); 1949 } else { 1950 ext_join_params->scan_le.active_time = cpu_to_le32(-1); 1951 ext_join_params->scan_le.passive_time = cpu_to_le32(-1); 1952 ext_join_params->scan_le.nprobes = cpu_to_le32(-1); 1953 } 1954 | 1857static s32 1858brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, 1859 struct cfg80211_connect_params *sme) 1860{ 1861 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1862 struct brcmf_if *ifp = netdev_priv(ndev); 1863 struct ieee80211_channel *chan = sme->channel; 1864 struct brcmf_join_params join_params; --- 140 unchanged lines hidden (view full) --- 2005 cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS / 2006 BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS); 2007 } else { 2008 ext_join_params->scan_le.active_time = cpu_to_le32(-1); 2009 ext_join_params->scan_le.passive_time = cpu_to_le32(-1); 2010 ext_join_params->scan_le.nprobes = cpu_to_le32(-1); 2011 } 2012 |
2013 brcmf_set_join_pref(ifp, &sme->bss_select); 2014 |
|
1955 err = brcmf_fil_bsscfg_data_set(ifp, "join", ext_join_params, 1956 join_params_size); 1957 kfree(ext_join_params); 1958 if (!err) 1959 /* This is it. join command worked, we are done */ 1960 goto done; 1961 1962 /* join command failed, fallback to set ssid */ --- 711 unchanged lines hidden (view full) --- 2674 if (!bi->ctl_ch) { 2675 ch.chspec = le16_to_cpu(bi->chanspec); 2676 cfg->d11inf.decchspec(&ch); 2677 bi->ctl_ch = ch.chnum; 2678 } 2679 channel = bi->ctl_ch; 2680 2681 if (channel <= CH_MAX_2G_CHANNEL) | 2015 err = brcmf_fil_bsscfg_data_set(ifp, "join", ext_join_params, 2016 join_params_size); 2017 kfree(ext_join_params); 2018 if (!err) 2019 /* This is it. join command worked, we are done */ 2020 goto done; 2021 2022 /* join command failed, fallback to set ssid */ --- 711 unchanged lines hidden (view full) --- 2734 if (!bi->ctl_ch) { 2735 ch.chspec = le16_to_cpu(bi->chanspec); 2736 cfg->d11inf.decchspec(&ch); 2737 bi->ctl_ch = ch.chnum; 2738 } 2739 channel = bi->ctl_ch; 2740 2741 if (channel <= CH_MAX_2G_CHANNEL) |
2682 band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 2742 band = wiphy->bands[NL80211_BAND_2GHZ]; |
2683 else | 2743 else |
2684 band = wiphy->bands[IEEE80211_BAND_5GHZ]; | 2744 band = wiphy->bands[NL80211_BAND_5GHZ]; |
2685 2686 freq = ieee80211_channel_to_frequency(channel, band->band); 2687 notify_channel = ieee80211_get_channel(wiphy, freq); 2688 2689 notify_capability = le16_to_cpu(bi->capability); 2690 notify_interval = le16_to_cpu(bi->beacon_period); 2691 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); 2692 notify_ielen = le32_to_cpu(bi->ie_length); --- 90 unchanged lines hidden (view full) --- 2783 } 2784 2785 bi = (struct brcmf_bss_info_le *)(buf + 4); 2786 2787 ch.chspec = le16_to_cpu(bi->chanspec); 2788 cfg->d11inf.decchspec(&ch); 2789 2790 if (ch.band == BRCMU_CHAN_BAND_2G) | 2745 2746 freq = ieee80211_channel_to_frequency(channel, band->band); 2747 notify_channel = ieee80211_get_channel(wiphy, freq); 2748 2749 notify_capability = le16_to_cpu(bi->capability); 2750 notify_interval = le16_to_cpu(bi->beacon_period); 2751 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); 2752 notify_ielen = le32_to_cpu(bi->ie_length); --- 90 unchanged lines hidden (view full) --- 2843 } 2844 2845 bi = (struct brcmf_bss_info_le *)(buf + 4); 2846 2847 ch.chspec = le16_to_cpu(bi->chanspec); 2848 cfg->d11inf.decchspec(&ch); 2849 2850 if (ch.band == BRCMU_CHAN_BAND_2G) |
2791 band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 2851 band = wiphy->bands[NL80211_BAND_2GHZ]; |
2792 else | 2852 else |
2793 band = wiphy->bands[IEEE80211_BAND_5GHZ]; | 2853 band = wiphy->bands[NL80211_BAND_5GHZ]; |
2794 2795 freq = ieee80211_channel_to_frequency(ch.chnum, band->band); 2796 cfg->channel = freq; 2797 notify_channel = ieee80211_get_channel(wiphy, freq); 2798 2799 notify_capability = le16_to_cpu(bi->capability); 2800 notify_interval = le16_to_cpu(bi->beacon_period); 2801 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); --- 801 unchanged lines hidden (view full) --- 3603 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, 3604 brcmf_wowl_nd_results); 3605 } 3606 if (wowl->gtk_rekey_failure) 3607 wowl_config |= BRCMF_WOWL_GTK_FAILURE; 3608 if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) 3609 wowl_config |= BRCMF_WOWL_UNASSOC; 3610 | 2854 2855 freq = ieee80211_channel_to_frequency(ch.chnum, band->band); 2856 cfg->channel = freq; 2857 notify_channel = ieee80211_get_channel(wiphy, freq); 2858 2859 notify_capability = le16_to_cpu(bi->capability); 2860 notify_interval = le16_to_cpu(bi->beacon_period); 2861 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); --- 801 unchanged lines hidden (view full) --- 3663 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, 3664 brcmf_wowl_nd_results); 3665 } 3666 if (wowl->gtk_rekey_failure) 3667 wowl_config |= BRCMF_WOWL_GTK_FAILURE; 3668 if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) 3669 wowl_config |= BRCMF_WOWL_UNASSOC; 3670 |
3611 brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear")); | 3671 brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", 3672 sizeof(struct brcmf_wowl_wakeind_le)); |
3612 brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config); 3613 brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1); 3614 brcmf_bus_wowl_config(cfg->pub->bus_if, true); 3615 cfg->wowl.active = true; 3616} 3617 3618static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, 3619 struct cfg80211_wowlan *wowl) --- 1590 unchanged lines hidden (view full) --- 5210 if (err) 5211 goto done; 5212 5213 bi = (struct brcmf_bss_info_le *)(buf + 4); 5214 ch.chspec = le16_to_cpu(bi->chanspec); 5215 cfg->d11inf.decchspec(&ch); 5216 5217 if (ch.band == BRCMU_CHAN_BAND_2G) | 3673 brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config); 3674 brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1); 3675 brcmf_bus_wowl_config(cfg->pub->bus_if, true); 3676 cfg->wowl.active = true; 3677} 3678 3679static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, 3680 struct cfg80211_wowlan *wowl) --- 1590 unchanged lines hidden (view full) --- 5271 if (err) 5272 goto done; 5273 5274 bi = (struct brcmf_bss_info_le *)(buf + 4); 5275 ch.chspec = le16_to_cpu(bi->chanspec); 5276 cfg->d11inf.decchspec(&ch); 5277 5278 if (ch.band == BRCMU_CHAN_BAND_2G) |
5218 band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 5279 band = wiphy->bands[NL80211_BAND_2GHZ]; |
5219 else | 5280 else |
5220 band = wiphy->bands[IEEE80211_BAND_5GHZ]; | 5281 band = wiphy->bands[NL80211_BAND_5GHZ]; |
5221 5222 freq = ieee80211_channel_to_frequency(ch.chnum, band->band); 5223 notify_channel = ieee80211_get_channel(wiphy, freq); 5224 5225done: 5226 kfree(buf); 5227 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, 5228 conn_info->req_ie, conn_info->req_ie_len, --- 473 unchanged lines hidden (view full) --- 5702 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 5703 BRCMF_DCMD_MEDLEN); 5704 if (err) { 5705 brcmf_err("get chanspecs error (%d)\n", err); 5706 goto fail_pbuf; 5707 } 5708 5709 wiphy = cfg_to_wiphy(cfg); | 5282 5283 freq = ieee80211_channel_to_frequency(ch.chnum, band->band); 5284 notify_channel = ieee80211_get_channel(wiphy, freq); 5285 5286done: 5287 kfree(buf); 5288 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, 5289 conn_info->req_ie, conn_info->req_ie_len, --- 473 unchanged lines hidden (view full) --- 5763 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 5764 BRCMF_DCMD_MEDLEN); 5765 if (err) { 5766 brcmf_err("get chanspecs error (%d)\n", err); 5767 goto fail_pbuf; 5768 } 5769 5770 wiphy = cfg_to_wiphy(cfg); |
5710 band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 5771 band = wiphy->bands[NL80211_BAND_2GHZ]; |
5711 if (band) 5712 for (i = 0; i < band->n_channels; i++) 5713 band->channels[i].flags = IEEE80211_CHAN_DISABLED; | 5772 if (band) 5773 for (i = 0; i < band->n_channels; i++) 5774 band->channels[i].flags = IEEE80211_CHAN_DISABLED; |
5714 band = wiphy->bands[IEEE80211_BAND_5GHZ]; | 5775 band = wiphy->bands[NL80211_BAND_5GHZ]; |
5715 if (band) 5716 for (i = 0; i < band->n_channels; i++) 5717 band->channels[i].flags = IEEE80211_CHAN_DISABLED; 5718 5719 total = le32_to_cpu(list->count); 5720 for (i = 0; i < total; i++) { 5721 ch.chspec = (u16)le32_to_cpu(list->element[i]); 5722 cfg->d11inf.decchspec(&ch); 5723 5724 if (ch.band == BRCMU_CHAN_BAND_2G) { | 5776 if (band) 5777 for (i = 0; i < band->n_channels; i++) 5778 band->channels[i].flags = IEEE80211_CHAN_DISABLED; 5779 5780 total = le32_to_cpu(list->count); 5781 for (i = 0; i < total; i++) { 5782 ch.chspec = (u16)le32_to_cpu(list->element[i]); 5783 cfg->d11inf.decchspec(&ch); 5784 5785 if (ch.band == BRCMU_CHAN_BAND_2G) { |
5725 band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 5786 band = wiphy->bands[NL80211_BAND_2GHZ]; |
5726 } else if (ch.band == BRCMU_CHAN_BAND_5G) { | 5787 } else if (ch.band == BRCMU_CHAN_BAND_5G) { |
5727 band = wiphy->bands[IEEE80211_BAND_5GHZ]; | 5788 band = wiphy->bands[NL80211_BAND_5GHZ]; |
5728 } else { 5729 brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec); 5730 continue; 5731 } 5732 if (!band) 5733 continue; 5734 if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) && 5735 ch.bw == BRCMU_CHAN_BW_40) --- 98 unchanged lines hidden (view full) --- 5834 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 5835 BRCMF_DCMD_MEDLEN); 5836 if (err) { 5837 brcmf_err("get chanspecs error (%d)\n", err); 5838 kfree(pbuf); 5839 return err; 5840 } 5841 | 5789 } else { 5790 brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec); 5791 continue; 5792 } 5793 if (!band) 5794 continue; 5795 if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) && 5796 ch.bw == BRCMU_CHAN_BW_40) --- 98 unchanged lines hidden (view full) --- 5895 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 5896 BRCMF_DCMD_MEDLEN); 5897 if (err) { 5898 brcmf_err("get chanspecs error (%d)\n", err); 5899 kfree(pbuf); 5900 return err; 5901 } 5902 |
5842 band = cfg_to_wiphy(cfg)->bands[IEEE80211_BAND_2GHZ]; | 5903 band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ]; |
5843 list = (struct brcmf_chanspec_list *)pbuf; 5844 num_chan = le32_to_cpu(list->count); 5845 for (i = 0; i < num_chan; i++) { 5846 ch.chspec = (u16)le32_to_cpu(list->element[i]); 5847 cfg->d11inf.decchspec(&ch); 5848 if (WARN_ON(ch.band != BRCMU_CHAN_BAND_2G)) 5849 continue; 5850 if (WARN_ON(ch.bw != BRCMU_CHAN_BW_40)) --- 15 unchanged lines hidden (view full) --- 5866static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) 5867{ 5868 u32 band, mimo_bwcap; 5869 int err; 5870 5871 band = WLC_BAND_2G; 5872 err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band); 5873 if (!err) { | 5904 list = (struct brcmf_chanspec_list *)pbuf; 5905 num_chan = le32_to_cpu(list->count); 5906 for (i = 0; i < num_chan; i++) { 5907 ch.chspec = (u16)le32_to_cpu(list->element[i]); 5908 cfg->d11inf.decchspec(&ch); 5909 if (WARN_ON(ch.band != BRCMU_CHAN_BAND_2G)) 5910 continue; 5911 if (WARN_ON(ch.bw != BRCMU_CHAN_BW_40)) --- 15 unchanged lines hidden (view full) --- 5927static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) 5928{ 5929 u32 band, mimo_bwcap; 5930 int err; 5931 5932 band = WLC_BAND_2G; 5933 err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band); 5934 if (!err) { |
5874 bw_cap[IEEE80211_BAND_2GHZ] = band; | 5935 bw_cap[NL80211_BAND_2GHZ] = band; |
5875 band = WLC_BAND_5G; 5876 err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band); 5877 if (!err) { | 5936 band = WLC_BAND_5G; 5937 err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band); 5938 if (!err) { |
5878 bw_cap[IEEE80211_BAND_5GHZ] = band; | 5939 bw_cap[NL80211_BAND_5GHZ] = band; |
5879 return; 5880 } 5881 WARN_ON(1); 5882 return; 5883 } 5884 brcmf_dbg(INFO, "fallback to mimo_bw_cap info\n"); 5885 mimo_bwcap = 0; 5886 err = brcmf_fil_iovar_int_get(ifp, "mimo_bw_cap", &mimo_bwcap); 5887 if (err) 5888 /* assume 20MHz if firmware does not give a clue */ 5889 mimo_bwcap = WLC_N_BW_20ALL; 5890 5891 switch (mimo_bwcap) { 5892 case WLC_N_BW_40ALL: | 5940 return; 5941 } 5942 WARN_ON(1); 5943 return; 5944 } 5945 brcmf_dbg(INFO, "fallback to mimo_bw_cap info\n"); 5946 mimo_bwcap = 0; 5947 err = brcmf_fil_iovar_int_get(ifp, "mimo_bw_cap", &mimo_bwcap); 5948 if (err) 5949 /* assume 20MHz if firmware does not give a clue */ 5950 mimo_bwcap = WLC_N_BW_20ALL; 5951 5952 switch (mimo_bwcap) { 5953 case WLC_N_BW_40ALL: |
5893 bw_cap[IEEE80211_BAND_2GHZ] |= WLC_BW_40MHZ_BIT; | 5954 bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_40MHZ_BIT; |
5894 /* fall-thru */ 5895 case WLC_N_BW_20IN2G_40IN5G: | 5955 /* fall-thru */ 5956 case WLC_N_BW_20IN2G_40IN5G: |
5896 bw_cap[IEEE80211_BAND_5GHZ] |= WLC_BW_40MHZ_BIT; | 5957 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_40MHZ_BIT; |
5897 /* fall-thru */ 5898 case WLC_N_BW_20ALL: | 5958 /* fall-thru */ 5959 case WLC_N_BW_20ALL: |
5899 bw_cap[IEEE80211_BAND_2GHZ] |= WLC_BW_20MHZ_BIT; 5900 bw_cap[IEEE80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; | 5960 bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_20MHZ_BIT; 5961 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; |
5901 break; 5902 default: 5903 brcmf_err("invalid mimo_bw_cap value\n"); 5904 } 5905} 5906 5907static void brcmf_update_ht_cap(struct ieee80211_supported_band *band, 5908 u32 bw_cap[2], u32 nchain) --- 24 unchanged lines hidden (view full) --- 5933 5934static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, 5935 u32 bw_cap[2], u32 nchain, u32 txstreams, 5936 u32 txbf_bfe_cap, u32 txbf_bfr_cap) 5937{ 5938 __le16 mcs_map; 5939 5940 /* not allowed in 2.4G band */ | 5962 break; 5963 default: 5964 brcmf_err("invalid mimo_bw_cap value\n"); 5965 } 5966} 5967 5968static void brcmf_update_ht_cap(struct ieee80211_supported_band *band, 5969 u32 bw_cap[2], u32 nchain) --- 24 unchanged lines hidden (view full) --- 5994 5995static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, 5996 u32 bw_cap[2], u32 nchain, u32 txstreams, 5997 u32 txbf_bfe_cap, u32 txbf_bfr_cap) 5998{ 5999 __le16 mcs_map; 6000 6001 /* not allowed in 2.4G band */ |
5941 if (band->band == IEEE80211_BAND_2GHZ) | 6002 if (band->band == NL80211_BAND_2GHZ) |
5942 return; 5943 5944 band->vht_cap.vht_supported = true; 5945 /* 80MHz is mandatory */ 5946 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; 5947 if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { 5948 band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 5949 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; --- 42 unchanged lines hidden (view full) --- 5992 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); 5993 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); 5994 if (err) { 5995 brcmf_err("nmode error (%d)\n", err); 5996 } else { 5997 brcmf_get_bwcap(ifp, bw_cap); 5998 } 5999 brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n", | 6003 return; 6004 6005 band->vht_cap.vht_supported = true; 6006 /* 80MHz is mandatory */ 6007 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; 6008 if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { 6009 band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 6010 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; --- 42 unchanged lines hidden (view full) --- 6053 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); 6054 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); 6055 if (err) { 6056 brcmf_err("nmode error (%d)\n", err); 6057 } else { 6058 brcmf_get_bwcap(ifp, bw_cap); 6059 } 6060 brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n", |
6000 nmode, vhtmode, bw_cap[IEEE80211_BAND_2GHZ], 6001 bw_cap[IEEE80211_BAND_5GHZ]); | 6061 nmode, vhtmode, bw_cap[NL80211_BAND_2GHZ], 6062 bw_cap[NL80211_BAND_5GHZ]); |
6002 6003 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); 6004 if (err) { 6005 brcmf_err("rxchain error (%d)\n", err); 6006 nchain = 1; 6007 } else { 6008 for (nchain = 0; rxchain; nchain++) 6009 rxchain = rxchain & (rxchain - 1); --- 264 unchanged lines hidden (view full) --- 6274 wiphy->addresses = drvr->addresses; 6275 wiphy->n_addresses = i; 6276 6277 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; 6278 wiphy->cipher_suites = brcmf_cipher_suites; 6279 wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites); 6280 if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) 6281 wiphy->n_cipher_suites--; | 6063 6064 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); 6065 if (err) { 6066 brcmf_err("rxchain error (%d)\n", err); 6067 nchain = 1; 6068 } else { 6069 for (nchain = 0; rxchain; nchain++) 6070 rxchain = rxchain & (rxchain - 1); --- 264 unchanged lines hidden (view full) --- 6335 wiphy->addresses = drvr->addresses; 6336 wiphy->n_addresses = i; 6337 6338 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; 6339 wiphy->cipher_suites = brcmf_cipher_suites; 6340 wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites); 6341 if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) 6342 wiphy->n_cipher_suites--; |
6343 wiphy->bss_select_support = BIT(NL80211_BSS_SELECT_ATTR_RSSI) | 6344 BIT(NL80211_BSS_SELECT_ATTR_BAND_PREF) | 6345 BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST); 6346 |
|
6282 wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | 6283 WIPHY_FLAG_OFFCHAN_TX | 6284 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; 6285 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS)) 6286 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; 6287 if (!ifp->drvr->settings->roamoff) 6288 wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; 6289 wiphy->mgmt_stypes = brcmf_txrx_stypes; --- 26 unchanged lines hidden (view full) --- 6316 sizeof(__wl_2ghz_channels), 6317 GFP_KERNEL); 6318 if (!band->channels) { 6319 kfree(band); 6320 return -ENOMEM; 6321 } 6322 6323 band->n_channels = ARRAY_SIZE(__wl_2ghz_channels); | 6347 wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | 6348 WIPHY_FLAG_OFFCHAN_TX | 6349 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; 6350 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS)) 6351 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; 6352 if (!ifp->drvr->settings->roamoff) 6353 wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; 6354 wiphy->mgmt_stypes = brcmf_txrx_stypes; --- 26 unchanged lines hidden (view full) --- 6381 sizeof(__wl_2ghz_channels), 6382 GFP_KERNEL); 6383 if (!band->channels) { 6384 kfree(band); 6385 return -ENOMEM; 6386 } 6387 6388 band->n_channels = ARRAY_SIZE(__wl_2ghz_channels); |
6324 wiphy->bands[IEEE80211_BAND_2GHZ] = band; | 6389 wiphy->bands[NL80211_BAND_2GHZ] = band; |
6325 } 6326 if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) { 6327 band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz), 6328 GFP_KERNEL); 6329 if (!band) 6330 return -ENOMEM; 6331 6332 band->channels = kmemdup(&__wl_5ghz_channels, 6333 sizeof(__wl_5ghz_channels), 6334 GFP_KERNEL); 6335 if (!band->channels) { 6336 kfree(band); 6337 return -ENOMEM; 6338 } 6339 6340 band->n_channels = ARRAY_SIZE(__wl_5ghz_channels); | 6390 } 6391 if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) { 6392 band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz), 6393 GFP_KERNEL); 6394 if (!band) 6395 return -ENOMEM; 6396 6397 band->channels = kmemdup(&__wl_5ghz_channels, 6398 sizeof(__wl_5ghz_channels), 6399 GFP_KERNEL); 6400 if (!band->channels) { 6401 kfree(band); 6402 return -ENOMEM; 6403 } 6404 6405 band->n_channels = ARRAY_SIZE(__wl_5ghz_channels); |
6341 wiphy->bands[IEEE80211_BAND_5GHZ] = band; | 6406 wiphy->bands[NL80211_BAND_5GHZ] = band; |
6342 } 6343 } 6344 err = brcmf_setup_wiphybands(wiphy); 6345 return err; 6346} 6347 6348static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) 6349{ --- 249 unchanged lines hidden (view full) --- 6599 if (!wiphy) 6600 return; 6601 6602 if (wiphy->iface_combinations) { 6603 for (i = 0; i < wiphy->n_iface_combinations; i++) 6604 kfree(wiphy->iface_combinations[i].limits); 6605 } 6606 kfree(wiphy->iface_combinations); | 6407 } 6408 } 6409 err = brcmf_setup_wiphybands(wiphy); 6410 return err; 6411} 6412 6413static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) 6414{ --- 249 unchanged lines hidden (view full) --- 6664 if (!wiphy) 6665 return; 6666 6667 if (wiphy->iface_combinations) { 6668 for (i = 0; i < wiphy->n_iface_combinations; i++) 6669 kfree(wiphy->iface_combinations[i].limits); 6670 } 6671 kfree(wiphy->iface_combinations); |
6607 if (wiphy->bands[IEEE80211_BAND_2GHZ]) { 6608 kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels); 6609 kfree(wiphy->bands[IEEE80211_BAND_2GHZ]); | 6672 if (wiphy->bands[NL80211_BAND_2GHZ]) { 6673 kfree(wiphy->bands[NL80211_BAND_2GHZ]->channels); 6674 kfree(wiphy->bands[NL80211_BAND_2GHZ]); |
6610 } | 6675 } |
6611 if (wiphy->bands[IEEE80211_BAND_5GHZ]) { 6612 kfree(wiphy->bands[IEEE80211_BAND_5GHZ]->channels); 6613 kfree(wiphy->bands[IEEE80211_BAND_5GHZ]); | 6676 if (wiphy->bands[NL80211_BAND_5GHZ]) { 6677 kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels); 6678 kfree(wiphy->bands[NL80211_BAND_5GHZ]); |
6614 } 6615 wiphy_free(wiphy); 6616} 6617 6618struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, 6619 struct device *busdev, 6620 bool p2pdev_forced) 6621{ --- 71 unchanged lines hidden (view full) --- 6693 wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; 6694 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; 6695 wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); 6696 6697 /* firmware defaults to 40MHz disabled in 2G band. We signal 6698 * cfg80211 here that we do and have it decide we can enable 6699 * it. But first check if device does support 2G operation. 6700 */ | 6679 } 6680 wiphy_free(wiphy); 6681} 6682 6683struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, 6684 struct device *busdev, 6685 bool p2pdev_forced) 6686{ --- 71 unchanged lines hidden (view full) --- 6758 wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; 6759 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; 6760 wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); 6761 6762 /* firmware defaults to 40MHz disabled in 2G band. We signal 6763 * cfg80211 here that we do and have it decide we can enable 6764 * it. But first check if device does support 2G operation. 6765 */ |
6701 if (wiphy->bands[IEEE80211_BAND_2GHZ]) { 6702 cap = &wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap.cap; | 6766 if (wiphy->bands[NL80211_BAND_2GHZ]) { 6767 cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap; |
6703 *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 6704 } 6705 err = wiphy_register(wiphy); 6706 if (err < 0) { 6707 brcmf_err("Could not register wiphy device (%d)\n", err); 6708 goto priv_out; 6709 } 6710 --- 88 unchanged lines hidden --- | 6768 *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 6769 } 6770 err = wiphy_register(wiphy); 6771 if (err < 0) { 6772 brcmf_err("Could not register wiphy device (%d)\n", err); 6773 goto priv_out; 6774 } 6775 --- 88 unchanged lines hidden --- |