.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2002-2005, Instant802 Networks, Inc. |
---|
3 | 4 | * Copyright 2005-2006, Devicescape Software, Inc. |
---|
4 | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
---|
5 | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
---|
6 | 7 | * Copyright (C) 2017 Intel Deutschland GmbH |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
| 8 | + * Copyright (C) 2018 - 2019 Intel Corporation |
---|
11 | 9 | */ |
---|
12 | 10 | |
---|
13 | 11 | #include <net/mac80211.h> |
---|
14 | 12 | #include <linux/module.h> |
---|
| 13 | +#include <linux/fips.h> |
---|
15 | 14 | #include <linux/init.h> |
---|
16 | 15 | #include <linux/netdevice.h> |
---|
17 | 16 | #include <linux/types.h> |
---|
.. | .. |
---|
65 | 64 | if (local->fif_pspoll) |
---|
66 | 65 | new_flags |= FIF_PSPOLL; |
---|
67 | 66 | |
---|
| 67 | + if (local->rx_mcast_action_reg) |
---|
| 68 | + new_flags |= FIF_MCAST_ACTION; |
---|
| 69 | + |
---|
68 | 70 | spin_lock_bh(&local->filter_lock); |
---|
69 | 71 | changed_flags = local->filter_flags ^ new_flags; |
---|
70 | 72 | |
---|
.. | .. |
---|
105 | 107 | chandef.chan = local->tmp_channel; |
---|
106 | 108 | chandef.width = NL80211_CHAN_WIDTH_20_NOHT; |
---|
107 | 109 | chandef.center_freq1 = chandef.chan->center_freq; |
---|
| 110 | + chandef.freq1_offset = chandef.chan->freq_offset; |
---|
108 | 111 | } else |
---|
109 | 112 | chandef = local->_oper_chandef; |
---|
110 | 113 | |
---|
111 | 114 | WARN(!cfg80211_chandef_valid(&chandef), |
---|
112 | | - "control:%d MHz width:%d center: %d/%d MHz", |
---|
113 | | - chandef.chan->center_freq, chandef.width, |
---|
114 | | - chandef.center_freq1, chandef.center_freq2); |
---|
| 115 | + "control:%d.%03d MHz width:%d center: %d.%03d/%d MHz", |
---|
| 116 | + chandef.chan->center_freq, chandef.chan->freq_offset, |
---|
| 117 | + chandef.width, chandef.center_freq1, chandef.freq1_offset, |
---|
| 118 | + chandef.center_freq2); |
---|
115 | 119 | |
---|
116 | 120 | if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef)) |
---|
117 | 121 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; |
---|
.. | .. |
---|
146 | 150 | if (!rcu_access_pointer(sdata->vif.chanctx_conf)) |
---|
147 | 151 | continue; |
---|
148 | 152 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
---|
| 153 | + continue; |
---|
| 154 | + if (sdata->vif.bss_conf.txpower == INT_MIN) |
---|
149 | 155 | continue; |
---|
150 | 156 | power = min(power, sdata->vif.bss_conf.txpower); |
---|
151 | 157 | } |
---|
.. | .. |
---|
353 | 359 | sdata_lock(sdata); |
---|
354 | 360 | |
---|
355 | 361 | /* Copy the addresses to the bss_conf list */ |
---|
356 | | - ifa = idev->ifa_list; |
---|
| 362 | + ifa = rtnl_dereference(idev->ifa_list); |
---|
357 | 363 | while (ifa) { |
---|
358 | 364 | if (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN) |
---|
359 | 365 | bss_conf->arp_addr_list[c] = ifa->ifa_address; |
---|
360 | | - ifa = ifa->ifa_next; |
---|
| 366 | + ifa = rtnl_dereference(ifa->ifa_next); |
---|
361 | 367 | c++; |
---|
362 | 368 | } |
---|
363 | 369 | |
---|
.. | .. |
---|
417 | 423 | }, |
---|
418 | 424 | [NL80211_IFTYPE_STATION] = { |
---|
419 | 425 | .tx = 0xffff, |
---|
| 426 | + /* |
---|
| 427 | + * To support Pre Association Security Negotiation (PASN) while |
---|
| 428 | + * already associated to one AP, allow user space to register to |
---|
| 429 | + * Rx authentication frames, so that the user space logic would |
---|
| 430 | + * be able to receive/handle authentication frames from a |
---|
| 431 | + * different AP as part of PASN. |
---|
| 432 | + * It is expected that user space would intelligently register |
---|
| 433 | + * for Rx authentication frames, i.e., only when PASN is used |
---|
| 434 | + * and configure a match filter only for PASN authentication |
---|
| 435 | + * algorithm, as otherwise the MLME functionality of mac80211 |
---|
| 436 | + * would be broken. |
---|
| 437 | + */ |
---|
420 | 438 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | |
---|
| 439 | + BIT(IEEE80211_STYPE_AUTH >> 4) | |
---|
421 | 440 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4), |
---|
422 | 441 | }, |
---|
423 | 442 | [NL80211_IFTYPE_AP] = { |
---|
.. | .. |
---|
477 | 496 | IEEE80211_HT_CAP_MAX_AMSDU | |
---|
478 | 497 | IEEE80211_HT_CAP_SGI_20 | |
---|
479 | 498 | IEEE80211_HT_CAP_SGI_40 | |
---|
| 499 | + IEEE80211_HT_CAP_TX_STBC | |
---|
| 500 | + IEEE80211_HT_CAP_RX_STBC | |
---|
480 | 501 | IEEE80211_HT_CAP_LDPC_CODING | |
---|
481 | 502 | IEEE80211_HT_CAP_40MHZ_INTOLERANT), |
---|
482 | 503 | .mcs = { |
---|
.. | .. |
---|
560 | 581 | WIPHY_FLAG_REPORTS_OBSS | |
---|
561 | 582 | WIPHY_FLAG_OFFCHAN_TX; |
---|
562 | 583 | |
---|
563 | | - if (ops->remain_on_channel) |
---|
| 584 | + if (!use_chanctx || ops->remain_on_channel) |
---|
564 | 585 | wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; |
---|
565 | 586 | |
---|
566 | 587 | wiphy->features |= NL80211_FEATURE_SK_TX_STATUS | |
---|
.. | .. |
---|
573 | 594 | wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA); |
---|
574 | 595 | wiphy_ext_feature_set(wiphy, |
---|
575 | 596 | NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211); |
---|
| 597 | + wiphy_ext_feature_set(wiphy, |
---|
| 598 | + NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH); |
---|
| 599 | + wiphy_ext_feature_set(wiphy, |
---|
| 600 | + NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS); |
---|
| 601 | + wiphy_ext_feature_set(wiphy, |
---|
| 602 | + NL80211_EXT_FEATURE_SCAN_FREQ_KHZ); |
---|
576 | 603 | |
---|
577 | 604 | if (!ops->hw_scan) { |
---|
578 | 605 | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | |
---|
.. | .. |
---|
610 | 637 | local->ops = ops; |
---|
611 | 638 | local->use_chanctx = use_chanctx; |
---|
612 | 639 | |
---|
| 640 | + /* |
---|
| 641 | + * We need a bit of data queued to build aggregates properly, so |
---|
| 642 | + * instruct the TCP stack to allow more than a single ms of data |
---|
| 643 | + * to be queued in the stack. The value is a bit-shift of 1 |
---|
| 644 | + * second, so 7 is ~8ms of queued data. Only affects local TCP |
---|
| 645 | + * sockets. |
---|
| 646 | + * This is the default, anyhow - drivers may need to override it |
---|
| 647 | + * for local reasons (longer buffers, longer completion time, or |
---|
| 648 | + * similar). |
---|
| 649 | + */ |
---|
| 650 | + local->hw.tx_sk_pacing_shift = 7; |
---|
| 651 | + |
---|
613 | 652 | /* set up some defaults */ |
---|
614 | 653 | local->hw.queues = 1; |
---|
615 | 654 | local->hw.max_rates = 1; |
---|
.. | .. |
---|
626 | 665 | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; |
---|
627 | 666 | local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; |
---|
628 | 667 | local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; |
---|
| 668 | + local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; |
---|
629 | 669 | local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; |
---|
630 | 670 | wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; |
---|
631 | 671 | wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask; |
---|
.. | .. |
---|
649 | 689 | spin_lock_init(&local->filter_lock); |
---|
650 | 690 | spin_lock_init(&local->rx_path_lock); |
---|
651 | 691 | spin_lock_init(&local->queue_stop_reason_lock); |
---|
| 692 | + |
---|
| 693 | + for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
---|
| 694 | + INIT_LIST_HEAD(&local->active_txqs[i]); |
---|
| 695 | + spin_lock_init(&local->active_txq_lock[i]); |
---|
| 696 | + local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; |
---|
| 697 | + local->aql_txq_limit_high[i] = |
---|
| 698 | + IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; |
---|
| 699 | + } |
---|
| 700 | + |
---|
| 701 | + local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; |
---|
| 702 | + local->aql_threshold = IEEE80211_AQL_THRESHOLD; |
---|
| 703 | + atomic_set(&local->aql_total_pending_airtime, 0); |
---|
652 | 704 | |
---|
653 | 705 | INIT_LIST_HEAD(&local->chanctx_list); |
---|
654 | 706 | mutex_init(&local->chanctx_mtx); |
---|
.. | .. |
---|
684 | 736 | tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending, |
---|
685 | 737 | (unsigned long)local); |
---|
686 | 738 | |
---|
| 739 | + if (ops->wake_tx_queue) |
---|
| 740 | + tasklet_init(&local->wake_txqs_tasklet, ieee80211_wake_txqs, |
---|
| 741 | + (unsigned long)local); |
---|
| 742 | + |
---|
687 | 743 | tasklet_init(&local->tasklet, |
---|
688 | 744 | ieee80211_tasklet_handler, |
---|
689 | 745 | (unsigned long) local); |
---|
.. | .. |
---|
708 | 764 | |
---|
709 | 765 | static int ieee80211_init_cipher_suites(struct ieee80211_local *local) |
---|
710 | 766 | { |
---|
711 | | - bool have_wep = !(IS_ERR(local->wep_tx_tfm) || |
---|
712 | | - IS_ERR(local->wep_rx_tfm)); |
---|
| 767 | + bool have_wep = !fips_enabled; /* FIPS does not permit the use of RC4 */ |
---|
713 | 768 | bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE); |
---|
714 | 769 | int n_suites = 0, r = 0, w = 0; |
---|
715 | 770 | u32 *suites; |
---|
.. | .. |
---|
843 | 898 | enum nl80211_band band; |
---|
844 | 899 | int channels, max_bitrates; |
---|
845 | 900 | bool supp_ht, supp_vht, supp_he; |
---|
846 | | - netdev_features_t feature_whitelist; |
---|
847 | 901 | struct cfg80211_chan_def dflt_chandef = {}; |
---|
848 | 902 | |
---|
849 | 903 | if (ieee80211_hw_check(hw, QUEUE_CONTROL) && |
---|
.. | .. |
---|
902 | 956 | } |
---|
903 | 957 | |
---|
904 | 958 | /* Only HW csum features are currently compatible with mac80211 */ |
---|
905 | | - feature_whitelist = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
---|
906 | | - NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | |
---|
907 | | - NETIF_F_GSO_SOFTWARE | NETIF_F_RXCSUM; |
---|
908 | | - if (WARN_ON(hw->netdev_features & ~feature_whitelist)) |
---|
| 959 | + if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES)) |
---|
909 | 960 | return -EINVAL; |
---|
910 | 961 | |
---|
911 | 962 | if (hw->max_report_rates == 0) |
---|
.. | .. |
---|
962 | 1013 | |
---|
963 | 1014 | if (!supp_he) |
---|
964 | 1015 | supp_he = !!ieee80211_get_he_sta_cap(sband); |
---|
| 1016 | + |
---|
| 1017 | + /* HT, VHT, HE require QoS, thus >= 4 queues */ |
---|
| 1018 | + if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS && |
---|
| 1019 | + (supp_ht || supp_vht || supp_he))) |
---|
| 1020 | + return -EINVAL; |
---|
965 | 1021 | |
---|
966 | 1022 | if (!sband->ht_cap.ht_supported) |
---|
967 | 1023 | continue; |
---|
.. | .. |
---|
1033 | 1089 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; |
---|
1034 | 1090 | if (hw->max_signal <= 0) { |
---|
1035 | 1091 | result = -EINVAL; |
---|
1036 | | - goto fail_wiphy_register; |
---|
| 1092 | + goto fail_workqueue; |
---|
1037 | 1093 | } |
---|
1038 | 1094 | } |
---|
| 1095 | + |
---|
| 1096 | + /* Mac80211 and therefore all drivers using SW crypto only |
---|
| 1097 | + * are able to handle PTK rekeys and Extended Key ID. |
---|
| 1098 | + */ |
---|
| 1099 | + if (!local->ops->set_key) { |
---|
| 1100 | + wiphy_ext_feature_set(local->hw.wiphy, |
---|
| 1101 | + NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); |
---|
| 1102 | + wiphy_ext_feature_set(local->hw.wiphy, |
---|
| 1103 | + NL80211_EXT_FEATURE_EXT_KEY_ID); |
---|
| 1104 | + } |
---|
| 1105 | + |
---|
| 1106 | + if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC)) |
---|
| 1107 | + wiphy_ext_feature_set(local->hw.wiphy, |
---|
| 1108 | + NL80211_EXT_FEATURE_DEL_IBSS_STA); |
---|
1039 | 1109 | |
---|
1040 | 1110 | /* |
---|
1041 | 1111 | * Calculate scan IE length -- we need this to alloc |
---|
.. | .. |
---|
1088 | 1158 | |
---|
1089 | 1159 | result = ieee80211_init_cipher_suites(local); |
---|
1090 | 1160 | if (result < 0) |
---|
1091 | | - goto fail_wiphy_register; |
---|
| 1161 | + goto fail_workqueue; |
---|
1092 | 1162 | |
---|
1093 | 1163 | if (!local->ops->remain_on_channel) |
---|
1094 | 1164 | local->hw.wiphy->max_remain_on_channel_duration = 5000; |
---|
.. | .. |
---|
1101 | 1171 | if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) |
---|
1102 | 1172 | local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING; |
---|
1103 | 1173 | |
---|
1104 | | - local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM; |
---|
| 1174 | + /* mac80211 supports multi BSSID, if the driver supports it */ |
---|
| 1175 | + if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) { |
---|
| 1176 | + local->hw.wiphy->support_mbssid = true; |
---|
| 1177 | + if (ieee80211_hw_check(&local->hw, |
---|
| 1178 | + SUPPORTS_ONLY_HE_MULTI_BSSID)) |
---|
| 1179 | + local->hw.wiphy->support_only_he_mbssid = true; |
---|
| 1180 | + else |
---|
| 1181 | + local->ext_capa[2] |= |
---|
| 1182 | + WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT; |
---|
| 1183 | + } |
---|
1105 | 1184 | |
---|
1106 | | - result = wiphy_register(local->hw.wiphy); |
---|
1107 | | - if (result < 0) |
---|
1108 | | - goto fail_wiphy_register; |
---|
| 1185 | + local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM; |
---|
1109 | 1186 | |
---|
1110 | 1187 | /* |
---|
1111 | 1188 | * We use the number of queues for feature tests (QoS, HT) internally |
---|
.. | .. |
---|
1129 | 1206 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
---|
1130 | 1207 | IEEE80211_TX_STATUS_HEADROOM); |
---|
1131 | 1208 | |
---|
1132 | | - debugfs_hw_add(local); |
---|
1133 | | - |
---|
1134 | 1209 | /* |
---|
1135 | 1210 | * if the driver doesn't specify a max listen interval we |
---|
1136 | 1211 | * use 5 which should be a safe default |
---|
.. | .. |
---|
1145 | 1220 | if (!local->hw.max_nan_de_entries) |
---|
1146 | 1221 | local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID; |
---|
1147 | 1222 | |
---|
1148 | | - result = ieee80211_wep_init(local); |
---|
1149 | | - if (result < 0) |
---|
1150 | | - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", |
---|
1151 | | - result); |
---|
| 1223 | + if (!local->hw.weight_multiplier) |
---|
| 1224 | + local->hw.weight_multiplier = 1; |
---|
| 1225 | + |
---|
| 1226 | + ieee80211_wep_init(local); |
---|
1152 | 1227 | |
---|
1153 | 1228 | local->hw.conf.flags = IEEE80211_CONF_IDLE; |
---|
1154 | 1229 | |
---|
.. | .. |
---|
1159 | 1234 | goto fail_flows; |
---|
1160 | 1235 | |
---|
1161 | 1236 | rtnl_lock(); |
---|
1162 | | - |
---|
1163 | 1237 | result = ieee80211_init_rate_ctrl_alg(local, |
---|
1164 | 1238 | hw->rate_control_algorithm); |
---|
| 1239 | + rtnl_unlock(); |
---|
1165 | 1240 | if (result < 0) { |
---|
1166 | 1241 | wiphy_debug(local->hw.wiphy, |
---|
1167 | 1242 | "Failed to initialize rate control algorithm\n"); |
---|
1168 | 1243 | goto fail_rate; |
---|
1169 | 1244 | } |
---|
1170 | 1245 | |
---|
| 1246 | + if (local->rate_ctrl) { |
---|
| 1247 | + clear_bit(IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, hw->flags); |
---|
| 1248 | + if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW) |
---|
| 1249 | + ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); |
---|
| 1250 | + } |
---|
| 1251 | + |
---|
| 1252 | + /* |
---|
| 1253 | + * If the VHT capabilities don't have IEEE80211_VHT_EXT_NSS_BW_CAPABLE, |
---|
| 1254 | + * or have it when we don't, copy the sband structure and set/clear it. |
---|
| 1255 | + * This is necessary because rate scaling algorithms could be switched |
---|
| 1256 | + * and have different support values. |
---|
| 1257 | + * Print a message so that in the common case the reallocation can be |
---|
| 1258 | + * avoided. |
---|
| 1259 | + */ |
---|
| 1260 | + BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated)); |
---|
| 1261 | + for (band = 0; band < NUM_NL80211_BANDS; band++) { |
---|
| 1262 | + struct ieee80211_supported_band *sband; |
---|
| 1263 | + bool local_cap, ie_cap; |
---|
| 1264 | + |
---|
| 1265 | + local_cap = ieee80211_hw_check(hw, SUPPORTS_VHT_EXT_NSS_BW); |
---|
| 1266 | + |
---|
| 1267 | + sband = local->hw.wiphy->bands[band]; |
---|
| 1268 | + if (!sband || !sband->vht_cap.vht_supported) |
---|
| 1269 | + continue; |
---|
| 1270 | + |
---|
| 1271 | + ie_cap = !!(sband->vht_cap.vht_mcs.tx_highest & |
---|
| 1272 | + cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE)); |
---|
| 1273 | + |
---|
| 1274 | + if (local_cap == ie_cap) |
---|
| 1275 | + continue; |
---|
| 1276 | + |
---|
| 1277 | + sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL); |
---|
| 1278 | + if (!sband) { |
---|
| 1279 | + result = -ENOMEM; |
---|
| 1280 | + goto fail_rate; |
---|
| 1281 | + } |
---|
| 1282 | + |
---|
| 1283 | + wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n", |
---|
| 1284 | + band); |
---|
| 1285 | + |
---|
| 1286 | + sband->vht_cap.vht_mcs.tx_highest ^= |
---|
| 1287 | + cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE); |
---|
| 1288 | + |
---|
| 1289 | + local->hw.wiphy->bands[band] = sband; |
---|
| 1290 | + local->sband_allocated |= BIT(band); |
---|
| 1291 | + } |
---|
| 1292 | + |
---|
| 1293 | + result = wiphy_register(local->hw.wiphy); |
---|
| 1294 | + if (result < 0) |
---|
| 1295 | + goto fail_wiphy_register; |
---|
| 1296 | + |
---|
| 1297 | + debugfs_hw_add(local); |
---|
| 1298 | + rate_control_add_debugfs(local); |
---|
| 1299 | + |
---|
| 1300 | + rtnl_lock(); |
---|
| 1301 | + |
---|
1171 | 1302 | /* add one default STA interface if supported */ |
---|
1172 | 1303 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && |
---|
1173 | 1304 | !ieee80211_hw_check(hw, NO_AUTO_VIF)) { |
---|
| 1305 | + struct vif_params params = {0}; |
---|
| 1306 | + |
---|
1174 | 1307 | result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL, |
---|
1175 | | - NL80211_IFTYPE_STATION, NULL); |
---|
| 1308 | + NL80211_IFTYPE_STATION, ¶ms); |
---|
1176 | 1309 | if (result) |
---|
1177 | 1310 | wiphy_warn(local->hw.wiphy, |
---|
1178 | 1311 | "Failed to add default virtual iface\n"); |
---|
.. | .. |
---|
1205 | 1338 | #if defined(CONFIG_INET) || defined(CONFIG_IPV6) |
---|
1206 | 1339 | fail_ifa: |
---|
1207 | 1340 | #endif |
---|
| 1341 | + wiphy_unregister(local->hw.wiphy); |
---|
| 1342 | + fail_wiphy_register: |
---|
1208 | 1343 | rtnl_lock(); |
---|
1209 | 1344 | rate_control_deinitialize(local); |
---|
1210 | 1345 | ieee80211_remove_interfaces(local); |
---|
1211 | | - fail_rate: |
---|
1212 | 1346 | rtnl_unlock(); |
---|
1213 | | - ieee80211_led_exit(local); |
---|
1214 | | - ieee80211_wep_free(local); |
---|
| 1347 | + fail_rate: |
---|
1215 | 1348 | fail_flows: |
---|
| 1349 | + ieee80211_led_exit(local); |
---|
1216 | 1350 | destroy_workqueue(local->workqueue); |
---|
1217 | 1351 | fail_workqueue: |
---|
1218 | | - wiphy_unregister(local->hw.wiphy); |
---|
1219 | | - fail_wiphy_register: |
---|
1220 | | - if (local->wiphy_ciphers_allocated) |
---|
| 1352 | + if (local->wiphy_ciphers_allocated) { |
---|
1221 | 1353 | kfree(local->hw.wiphy->cipher_suites); |
---|
| 1354 | + local->wiphy_ciphers_allocated = false; |
---|
| 1355 | + } |
---|
1222 | 1356 | kfree(local->int_scan_req); |
---|
1223 | 1357 | return result; |
---|
1224 | 1358 | } |
---|
.. | .. |
---|
1266 | 1400 | skb_queue_purge(&local->skb_queue_unreliable); |
---|
1267 | 1401 | skb_queue_purge(&local->skb_queue_tdls_chsw); |
---|
1268 | 1402 | |
---|
1269 | | - destroy_workqueue(local->workqueue); |
---|
1270 | 1403 | wiphy_unregister(local->hw.wiphy); |
---|
1271 | | - ieee80211_wep_free(local); |
---|
| 1404 | + destroy_workqueue(local->workqueue); |
---|
1272 | 1405 | ieee80211_led_exit(local); |
---|
1273 | 1406 | kfree(local->int_scan_req); |
---|
1274 | 1407 | } |
---|
.. | .. |
---|
1284 | 1417 | void ieee80211_free_hw(struct ieee80211_hw *hw) |
---|
1285 | 1418 | { |
---|
1286 | 1419 | struct ieee80211_local *local = hw_to_local(hw); |
---|
| 1420 | + enum nl80211_band band; |
---|
1287 | 1421 | |
---|
1288 | 1422 | mutex_destroy(&local->iflist_mtx); |
---|
1289 | 1423 | mutex_destroy(&local->mtx); |
---|
1290 | 1424 | |
---|
1291 | | - if (local->wiphy_ciphers_allocated) |
---|
| 1425 | + if (local->wiphy_ciphers_allocated) { |
---|
1292 | 1426 | kfree(local->hw.wiphy->cipher_suites); |
---|
| 1427 | + local->wiphy_ciphers_allocated = false; |
---|
| 1428 | + } |
---|
1293 | 1429 | |
---|
1294 | 1430 | idr_for_each(&local->ack_status_frames, |
---|
1295 | 1431 | ieee80211_free_ack_frame, NULL); |
---|
.. | .. |
---|
1298 | 1434 | sta_info_stop(local); |
---|
1299 | 1435 | |
---|
1300 | 1436 | ieee80211_free_led_names(local); |
---|
| 1437 | + |
---|
| 1438 | + for (band = 0; band < NUM_NL80211_BANDS; band++) { |
---|
| 1439 | + if (!(local->sband_allocated & BIT(band))) |
---|
| 1440 | + continue; |
---|
| 1441 | + kfree(local->hw.wiphy->bands[band]); |
---|
| 1442 | + } |
---|
1301 | 1443 | |
---|
1302 | 1444 | wiphy_free(local->hw.wiphy); |
---|
1303 | 1445 | } |
---|
.. | .. |
---|
1316 | 1458 | if (ret) |
---|
1317 | 1459 | return ret; |
---|
1318 | 1460 | |
---|
1319 | | - ret = rc80211_minstrel_ht_init(); |
---|
1320 | | - if (ret) |
---|
1321 | | - goto err_minstrel; |
---|
1322 | | - |
---|
1323 | 1461 | ret = ieee80211_iface_init(); |
---|
1324 | 1462 | if (ret) |
---|
1325 | 1463 | goto err_netdev; |
---|
1326 | 1464 | |
---|
1327 | 1465 | return 0; |
---|
1328 | 1466 | err_netdev: |
---|
1329 | | - rc80211_minstrel_ht_exit(); |
---|
1330 | | - err_minstrel: |
---|
1331 | 1467 | rc80211_minstrel_exit(); |
---|
1332 | 1468 | |
---|
1333 | 1469 | return ret; |
---|
.. | .. |
---|
1335 | 1471 | |
---|
1336 | 1472 | static void __exit ieee80211_exit(void) |
---|
1337 | 1473 | { |
---|
1338 | | - rc80211_minstrel_ht_exit(); |
---|
1339 | 1474 | rc80211_minstrel_exit(); |
---|
1340 | 1475 | |
---|
1341 | 1476 | ieee80211s_stop(); |
---|