Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge commit 'c1e140bf79d817d4a7aa9932eb98b0359c87af33' from mac80211-next

Patch "ath9k: Fix no-ack frame status" needs these mac80211 patches:

commit 5cf16616e152dd5c274a65954c77f64892d025a8
Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Date: Wed Dec 10 21:26:11 2014 +0530

mac80211: Fix accounting of multicast frames

commit 6b127c71fbdd3daacfd8b9f80b8e6ebfb70a889e
Author: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Date: Wed Dec 10 21:26:10 2014 +0530

mac80211: Move IEEE80211_TX_CTL_PS_RESPONSE

Conflicts:
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c

+1754 -835
-1
Documentation/DocBook/80211.tmpl
··· 113 113 !Finclude/net/cfg80211.h cfg80211_beacon_data 114 114 !Finclude/net/cfg80211.h cfg80211_ap_settings 115 115 !Finclude/net/cfg80211.h station_parameters 116 - !Finclude/net/cfg80211.h station_info_flags 117 116 !Finclude/net/cfg80211.h rate_info_flags 118 117 !Finclude/net/cfg80211.h rate_info 119 118 !Finclude/net/cfg80211.h station_info
+12
Documentation/kernel-parameters.txt
··· 3206 3206 3207 3207 retain_initrd [RAM] Keep initrd memory after extraction 3208 3208 3209 + rfkill.default_state= 3210 + 0 "airplane mode". All wifi, bluetooth, wimax, gps, fm, 3211 + etc. communication is blocked by default. 3212 + 1 Unblocked. 3213 + 3214 + rfkill.master_switch_mode= 3215 + 0 The "airplane mode" button does nothing. 3216 + 1 The "airplane mode" button toggles between everything 3217 + blocked and the previous configuration. 3218 + 2 The "airplane mode" button toggles between everything 3219 + blocked and everything unblocked. 3220 + 3209 3221 rhash_entries= [KNL,NET] 3210 3222 Set number of hash buckets for route cache 3211 3223
+3
Documentation/rfkill.txt
··· 25 25 - soft block: writable radio block (need not be readable) that is set by 26 26 the system software. 27 27 28 + The rfkill subsystem has two parameters, rfkill.default_state and 29 + rfkill.master_switch_mode, which are documented in kernel-parameters.txt. 30 + 28 31 29 32 2. Implementation details 30 33
+2 -1
drivers/net/wireless/ath/ath10k/mac.c
··· 2948 2948 int bit; 2949 2949 u32 vdev_param; 2950 2950 2951 + vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; 2952 + 2951 2953 mutex_lock(&ar->conf_mutex); 2952 2954 2953 2955 memset(arvif, 0, sizeof(*arvif)); ··· 5104 5102 ar->hw->flags = IEEE80211_HW_SIGNAL_DBM | 5105 5103 IEEE80211_HW_SUPPORTS_PS | 5106 5104 IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 5107 - IEEE80211_HW_SUPPORTS_UAPSD | 5108 5105 IEEE80211_HW_MFP_CAPABLE | 5109 5106 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 5110 5107 IEEE80211_HW_HAS_RATE_CONTROL |
+4 -4
drivers/net/wireless/ath/ath10k/wmi.c
··· 1650 1650 rx_clear_count -= ar->survey_last_rx_clear_count; 1651 1651 1652 1652 survey = &ar->survey[idx]; 1653 - survey->channel_time = WMI_CHAN_INFO_MSEC(cycle_count); 1654 - survey->channel_time_rx = WMI_CHAN_INFO_MSEC(rx_clear_count); 1653 + survey->time = WMI_CHAN_INFO_MSEC(cycle_count); 1654 + survey->time_rx = WMI_CHAN_INFO_MSEC(rx_clear_count); 1655 1655 survey->noise = noise_floor; 1656 - survey->filled = SURVEY_INFO_CHANNEL_TIME | 1657 - SURVEY_INFO_CHANNEL_TIME_RX | 1656 + survey->filled = SURVEY_INFO_TIME | 1657 + SURVEY_INFO_TIME_RX | 1658 1658 SURVEY_INFO_NOISE_DBM; 1659 1659 } 1660 1660
+8 -8
drivers/net/wireless/ath/ath5k/mac80211-ops.c
··· 672 672 spin_lock_bh(&common->cc_lock); 673 673 ath_hw_cycle_counters_update(common); 674 674 if (cc->cycles > 0) { 675 - ah->survey.channel_time += cc->cycles / div; 676 - ah->survey.channel_time_busy += cc->rx_busy / div; 677 - ah->survey.channel_time_rx += cc->rx_frame / div; 678 - ah->survey.channel_time_tx += cc->tx_frame / div; 675 + ah->survey.time += cc->cycles / div; 676 + ah->survey.time_busy += cc->rx_busy / div; 677 + ah->survey.time_rx += cc->rx_frame / div; 678 + ah->survey.time_tx += cc->tx_frame / div; 679 679 } 680 680 memset(cc, 0, sizeof(*cc)); 681 681 spin_unlock_bh(&common->cc_lock); ··· 686 686 survey->noise = ah->ah_noise_floor; 687 687 survey->filled = SURVEY_INFO_NOISE_DBM | 688 688 SURVEY_INFO_IN_USE | 689 - SURVEY_INFO_CHANNEL_TIME | 690 - SURVEY_INFO_CHANNEL_TIME_BUSY | 691 - SURVEY_INFO_CHANNEL_TIME_RX | 692 - SURVEY_INFO_CHANNEL_TIME_TX; 689 + SURVEY_INFO_TIME | 690 + SURVEY_INFO_TIME_BUSY | 691 + SURVEY_INFO_TIME_RX | 692 + SURVEY_INFO_TIME_TX; 693 693 694 694 return 0; 695 695 }
+9 -8
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 1799 1799 1800 1800 if (vif->target_stats.rx_byte) { 1801 1801 sinfo->rx_bytes = vif->target_stats.rx_byte; 1802 - sinfo->filled |= STATION_INFO_RX_BYTES64; 1802 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64); 1803 1803 sinfo->rx_packets = vif->target_stats.rx_pkt; 1804 - sinfo->filled |= STATION_INFO_RX_PACKETS; 1804 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS); 1805 1805 } 1806 1806 1807 1807 if (vif->target_stats.tx_byte) { 1808 1808 sinfo->tx_bytes = vif->target_stats.tx_byte; 1809 - sinfo->filled |= STATION_INFO_TX_BYTES64; 1809 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64); 1810 1810 sinfo->tx_packets = vif->target_stats.tx_pkt; 1811 - sinfo->filled |= STATION_INFO_TX_PACKETS; 1811 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS); 1812 1812 } 1813 1813 1814 1814 sinfo->signal = vif->target_stats.cs_rssi; 1815 - sinfo->filled |= STATION_INFO_SIGNAL; 1815 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1816 1816 1817 1817 rate = vif->target_stats.tx_ucast_rate; 1818 1818 ··· 1827 1827 } 1828 1828 1829 1829 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; 1830 + sinfo->txrate.bw = RATE_INFO_BW_20; 1830 1831 } else if (is_rate_ht40(rate, &mcs, &sgi)) { 1831 1832 if (sgi) { 1832 1833 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; ··· 1836 1835 sinfo->txrate.mcs = mcs; 1837 1836 } 1838 1837 1839 - sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 1838 + sinfo->txrate.bw = RATE_INFO_BW_40; 1840 1839 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; 1841 1840 } else { 1842 1841 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, ··· 1845 1844 return 0; 1846 1845 } 1847 1846 1848 - sinfo->filled |= STATION_INFO_TX_BITRATE; 1847 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 1849 1848 1850 1849 if (test_bit(CONNECTED, &vif->flags) && 1851 1850 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) && 1852 1851 vif->nw_type == INFRA_NETWORK) { 1853 - sinfo->filled |= STATION_INFO_BSS_PARAM; 1852 + sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); 1854 1853 sinfo->bss_param.flags = 0; 1855 1854 sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period; 1856 1855 sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int;
-1
drivers/net/wireless/ath/ath6kl/main.c
··· 488 488 489 489 sinfo.assoc_req_ies = ies; 490 490 sinfo.assoc_req_ies_len = ies_len; 491 - sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; 492 491 493 492 cfg80211_new_sta(vif->ndev, mac_addr, &sinfo, GFP_KERNEL); 494 493
+8 -8
drivers/net/wireless/ath/ath9k/link.c
··· 516 516 ath_hw_cycle_counters_update(common); 517 517 518 518 if (cc->cycles > 0) { 519 - survey->filled |= SURVEY_INFO_CHANNEL_TIME | 520 - SURVEY_INFO_CHANNEL_TIME_BUSY | 521 - SURVEY_INFO_CHANNEL_TIME_RX | 522 - SURVEY_INFO_CHANNEL_TIME_TX; 523 - survey->channel_time += cc->cycles / div; 524 - survey->channel_time_busy += cc->rx_busy / div; 525 - survey->channel_time_rx += cc->rx_frame / div; 526 - survey->channel_time_tx += cc->tx_frame / div; 519 + survey->filled |= SURVEY_INFO_TIME | 520 + SURVEY_INFO_TIME_BUSY | 521 + SURVEY_INFO_TIME_RX | 522 + SURVEY_INFO_TIME_TX; 523 + survey->time += cc->cycles / div; 524 + survey->time_busy += cc->rx_busy / div; 525 + survey->time_rx += cc->rx_frame / div; 526 + survey->time_tx += cc->tx_frame / div; 527 527 } 528 528 529 529 if (cc->cycles < div)
+4 -2
drivers/net/wireless/ath/ath9k/xmit.c
··· 2303 2303 struct ath_txq *txq = txctl->txq; 2304 2304 struct ath_atx_tid *tid = NULL; 2305 2305 struct ath_buf *bf; 2306 - bool queue, skip_uapsd = false; 2306 + bool queue, skip_uapsd = false, ps_resp; 2307 2307 int q, ret; 2308 2308 2309 2309 if (vif) ··· 2311 2311 2312 2312 if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) 2313 2313 txctl->force_channel = true; 2314 + 2315 + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE); 2314 2316 2315 2317 ret = ath_tx_prepare(hw, skb, txctl); 2316 2318 if (ret) ··· 2356 2354 if (txctl->an && queue) 2357 2355 tid = ath_get_skb_tid(sc, txctl->an, skb); 2358 2356 2359 - if (!skip_uapsd && (info->flags & IEEE80211_TX_CTL_PS_RESPONSE)) { 2357 + if (!skip_uapsd && ps_resp) { 2360 2358 ath_txq_unlock(sc, txq); 2361 2359 txq = sc->tx.uapsdq; 2362 2360 ath_txq_lock(sc, txq);
+6 -6
drivers/net/wireless/ath/carl9170/cmd.c
··· 188 188 189 189 if (ar->channel) { 190 190 info = &ar->survey[ar->channel->hw_value]; 191 - info->channel_time = ar->tally.active; 192 - info->channel_time_busy = ar->tally.cca; 193 - info->channel_time_tx = ar->tally.tx_time; 194 - do_div(info->channel_time, 1000); 195 - do_div(info->channel_time_busy, 1000); 196 - do_div(info->channel_time_tx, 1000); 191 + info->time = ar->tally.active; 192 + info->time_busy = ar->tally.cca; 193 + info->time_tx = ar->tally.tx_time; 194 + do_div(info->time, 1000); 195 + do_div(info->time_busy, 1000); 196 + do_div(info->time_tx, 1000); 197 197 } 198 198 } 199 199 return 0;
+3 -3
drivers/net/wireless/ath/carl9170/main.c
··· 1690 1690 survey->filled |= SURVEY_INFO_IN_USE; 1691 1691 1692 1692 if (ar->fw.hw_counters) { 1693 - survey->filled |= SURVEY_INFO_CHANNEL_TIME | 1694 - SURVEY_INFO_CHANNEL_TIME_BUSY | 1695 - SURVEY_INFO_CHANNEL_TIME_TX; 1693 + survey->filled |= SURVEY_INFO_TIME | 1694 + SURVEY_INFO_TIME_BUSY | 1695 + SURVEY_INFO_TIME_TX; 1696 1696 } 1697 1697 1698 1698 return 0;
+9 -9
drivers/net/wireless/ath/wil6210/cfg80211.c
··· 142 142 143 143 sinfo->generation = wil->sinfo_gen; 144 144 145 - sinfo->filled = STATION_INFO_RX_BYTES | 146 - STATION_INFO_TX_BYTES | 147 - STATION_INFO_RX_PACKETS | 148 - STATION_INFO_TX_PACKETS | 149 - STATION_INFO_RX_BITRATE | 150 - STATION_INFO_TX_BITRATE | 151 - STATION_INFO_RX_DROP_MISC | 152 - STATION_INFO_TX_FAILED; 145 + sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) | 146 + BIT(NL80211_STA_INFO_TX_BYTES) | 147 + BIT(NL80211_STA_INFO_RX_PACKETS) | 148 + BIT(NL80211_STA_INFO_TX_PACKETS) | 149 + BIT(NL80211_STA_INFO_RX_BITRATE) | 150 + BIT(NL80211_STA_INFO_TX_BITRATE) | 151 + BIT(NL80211_STA_INFO_RX_DROP_MISC) | 152 + BIT(NL80211_STA_INFO_TX_FAILED); 153 153 154 154 sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; 155 155 sinfo->txrate.mcs = le16_to_cpu(reply.evt.bf_mcs); ··· 163 163 sinfo->tx_failed = stats->tx_errors; 164 164 165 165 if (test_bit(wil_status_fwconnected, wil->status)) { 166 - sinfo->filled |= STATION_INFO_SIGNAL; 166 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 167 167 sinfo->signal = reply.evt.sqi; 168 168 } 169 169
-1
drivers/net/wireless/ath/wil6210/wmi.c
··· 462 462 if (assoc_req_ie) { 463 463 sinfo.assoc_req_ies = assoc_req_ie; 464 464 sinfo.assoc_req_ies_len = assoc_req_ielen; 465 - sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; 466 465 } 467 466 468 467 cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL);
+5 -6
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
··· 2375 2375 brcmf_err("GET STA INFO failed, %d\n", err); 2376 2376 goto done; 2377 2377 } 2378 - sinfo->filled = STATION_INFO_INACTIVE_TIME; 2378 + sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME); 2379 2379 sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; 2380 2380 if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) { 2381 - sinfo->filled |= STATION_INFO_CONNECTED_TIME; 2381 + sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME); 2382 2382 sinfo->connected_time = le32_to_cpu(sta_info_le.in); 2383 2383 } 2384 2384 brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n", ··· 2396 2396 brcmf_err("Could not get rate (%d)\n", err); 2397 2397 goto done; 2398 2398 } else { 2399 - sinfo->filled |= STATION_INFO_TX_BITRATE; 2399 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 2400 2400 sinfo->txrate.legacy = rate * 5; 2401 2401 brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2); 2402 2402 } ··· 2411 2411 goto done; 2412 2412 } else { 2413 2413 rssi = le32_to_cpu(scb_val.val); 2414 - sinfo->filled |= STATION_INFO_SIGNAL; 2414 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 2415 2415 sinfo->signal = rssi; 2416 2416 brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); 2417 2417 } ··· 2438 2438 brcmf_dbg(CONN, "DTIM peroid %d\n", 2439 2439 dtim_period); 2440 2440 } 2441 - sinfo->filled |= STATION_INFO_BSS_PARAM; 2441 + sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); 2442 2442 } 2443 2443 } else 2444 2444 err = -EPERM; ··· 4878 4878 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && 4879 4879 (reason == BRCMF_E_STATUS_SUCCESS)) { 4880 4880 memset(&sinfo, 0, sizeof(sinfo)); 4881 - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; 4882 4881 if (!data) { 4883 4882 brcmf_err("No IEs present in ASSOC/REASSOC_IND"); 4884 4883 return -EINVAL;
-1
drivers/net/wireless/cw1200/main.c
··· 282 282 IEEE80211_HW_SUPPORTS_PS | 283 283 IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 284 284 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 285 - IEEE80211_HW_SUPPORTS_UAPSD | 286 285 IEEE80211_HW_CONNECTION_MONITOR | 287 286 IEEE80211_HW_AMPDU_AGGREGATION | 288 287 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW |
+3 -1
drivers/net/wireless/cw1200/sta.c
··· 213 213 /* __le32 auto_calibration_mode = __cpu_to_le32(1); */ 214 214 215 215 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | 216 + IEEE80211_VIF_SUPPORTS_UAPSD | 216 217 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 217 218 218 219 mutex_lock(&priv->conf_mutex); ··· 709 708 if (sta) 710 709 peer_addr = sta->addr; 711 710 712 - key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; 711 + key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | 712 + IEEE80211_KEY_FLAG_RESERVE_TAILROOM; 713 713 714 714 switch (key->cipher) { 715 715 case WLAN_CIPHER_SUITE_WEP40:
+6 -7
drivers/net/wireless/iwlwifi/mvm/mac80211.c
··· 327 327 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC | 328 328 IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED; 329 329 hw->rate_control_algorithm = "iwl-mvm-rs"; 330 + hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; 331 + hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; 330 332 331 333 /* 332 334 * Enable 11w if advertised by firmware and software crypto ··· 338 336 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP && 339 337 !iwlwifi_mod_params.sw_crypto) 340 338 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 341 - 342 - if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT && 343 - !iwlwifi_mod_params.uapsd_disable) { 344 - hw->flags |= IEEE80211_HW_SUPPORTS_UAPSD; 345 - hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; 346 - hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; 347 - } 348 339 349 340 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN || 350 341 mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { ··· 1213 1218 mvm->bf_allowed_vif = mvmvif; 1214 1219 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | 1215 1220 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 1221 + if (mvm->fw->ucode_capa.flags & 1222 + IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT && 1223 + !iwlwifi_mod_params.uapsd_disable) 1224 + vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; 1216 1225 } 1217 1226 1218 1227 /*
+6 -6
drivers/net/wireless/libertas/cfg.c
··· 1616 1616 1617 1617 lbs_deb_enter(LBS_DEB_CFG80211); 1618 1618 1619 - sinfo->filled |= STATION_INFO_TX_BYTES | 1620 - STATION_INFO_TX_PACKETS | 1621 - STATION_INFO_RX_BYTES | 1622 - STATION_INFO_RX_PACKETS; 1619 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES) | 1620 + BIT(NL80211_STA_INFO_TX_PACKETS) | 1621 + BIT(NL80211_STA_INFO_RX_BYTES) | 1622 + BIT(NL80211_STA_INFO_RX_PACKETS); 1623 1623 sinfo->tx_bytes = priv->dev->stats.tx_bytes; 1624 1624 sinfo->tx_packets = priv->dev->stats.tx_packets; 1625 1625 sinfo->rx_bytes = priv->dev->stats.rx_bytes; ··· 1629 1629 ret = lbs_get_rssi(priv, &signal, &noise); 1630 1630 if (ret == 0) { 1631 1631 sinfo->signal = signal; 1632 - sinfo->filled |= STATION_INFO_SIGNAL; 1632 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1633 1633 } 1634 1634 1635 1635 /* Convert priv->cur_rate from hw_value to NL80211 value */ 1636 1636 for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) { 1637 1637 if (priv->cur_rate == lbs_rates[i].hw_value) { 1638 1638 sinfo->txrate.legacy = lbs_rates[i].bitrate; 1639 - sinfo->filled |= STATION_INFO_TX_BITRATE; 1639 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 1640 1640 break; 1641 1641 } 1642 1642 }
+15 -15
drivers/net/wireless/mac80211_hwsim.c
··· 625 625 old_ps = data->ps; 626 626 data->ps = val; 627 627 628 + local_bh_disable(); 628 629 if (val == PS_MANUAL_POLL) { 629 - ieee80211_iterate_active_interfaces(data->hw, 630 - IEEE80211_IFACE_ITER_NORMAL, 631 - hwsim_send_ps_poll, data); 630 + ieee80211_iterate_active_interfaces_atomic( 631 + data->hw, IEEE80211_IFACE_ITER_NORMAL, 632 + hwsim_send_ps_poll, data); 632 633 data->ps_poll_pending = true; 633 634 } else if (old_ps == PS_DISABLED && val != PS_DISABLED) { 634 - ieee80211_iterate_active_interfaces(data->hw, 635 - IEEE80211_IFACE_ITER_NORMAL, 636 - hwsim_send_nullfunc_ps, 637 - data); 635 + ieee80211_iterate_active_interfaces_atomic( 636 + data->hw, IEEE80211_IFACE_ITER_NORMAL, 637 + hwsim_send_nullfunc_ps, data); 638 638 } else if (old_ps != PS_DISABLED && val == PS_DISABLED) { 639 - ieee80211_iterate_active_interfaces(data->hw, 640 - IEEE80211_IFACE_ITER_NORMAL, 641 - hwsim_send_nullfunc_no_ps, 642 - data); 639 + ieee80211_iterate_active_interfaces_atomic( 640 + data->hw, IEEE80211_IFACE_ITER_NORMAL, 641 + hwsim_send_nullfunc_no_ps, data); 643 642 } 643 + local_bh_enable(); 644 644 645 645 return 0; 646 646 } ··· 2149 2149 if (param->regd) { 2150 2150 int i; 2151 2151 2152 - for (i = 0; hwsim_world_regdom_custom[i] != param->regd && 2153 - i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) 2154 - ; 2152 + for (i = 0; i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) { 2153 + if (hwsim_world_regdom_custom[i] != param->regd) 2154 + continue; 2155 2155 2156 - if (i < ARRAY_SIZE(hwsim_world_regdom_custom)) { 2157 2156 ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i); 2158 2157 if (ret < 0) 2159 2158 return ret; 2159 + break; 2160 2160 } 2161 2161 } 2162 2162
+15 -13
drivers/net/wireless/mwifiex/cfg80211.c
··· 856 856 /* HT or VHT */ 857 857 switch (tx_htinfo & (BIT(3) | BIT(2))) { 858 858 case 0: 859 - /* This will be 20MHz */ 859 + rate->bw = RATE_INFO_BW_20; 860 860 break; 861 861 case (BIT(2)): 862 - rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 862 + rate->bw = RATE_INFO_BW_40; 863 863 break; 864 864 case (BIT(3)): 865 - rate->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 865 + rate->bw = RATE_INFO_BW_80; 866 866 break; 867 867 case (BIT(3) | BIT(2)): 868 - rate->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 868 + rate->bw = RATE_INFO_BW_160; 869 869 break; 870 870 } 871 871 ··· 885 885 if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { 886 886 rate->mcs = priv->tx_rate; 887 887 rate->flags |= RATE_INFO_FLAGS_MCS; 888 + rate->bw = RATE_INFO_BW_20; 888 889 if (tx_htinfo & BIT(1)) 889 - rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 890 + rate->bw = RATE_INFO_BW_40; 890 891 if (tx_htinfo & BIT(2)) 891 892 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; 892 893 } ··· 911 910 { 912 911 u32 rate; 913 912 914 - sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | 915 - STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | 916 - STATION_INFO_TX_BITRATE | 917 - STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 913 + sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) | BIT(NL80211_STA_INFO_TX_BYTES) | 914 + BIT(NL80211_STA_INFO_RX_PACKETS) | BIT(NL80211_STA_INFO_TX_PACKETS) | 915 + BIT(NL80211_STA_INFO_TX_BITRATE) | 916 + BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_SIGNAL_AVG); 918 917 919 918 /* Get signal information from the firmware */ 920 919 if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO, ··· 945 944 sinfo->txrate.legacy = rate * 5; 946 945 947 946 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 948 - sinfo->filled |= STATION_INFO_BSS_PARAM; 947 + sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM); 949 948 sinfo->bss_param.flags = 0; 950 949 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & 951 950 WLAN_CAPABILITY_SHORT_PREAMBLE) ··· 1038 1037 survey->channel = ieee80211_get_channel(wiphy, 1039 1038 ieee80211_channel_to_frequency(pchan_stats[idx].chan_num, band)); 1040 1039 survey->filled = SURVEY_INFO_NOISE_DBM | 1041 - SURVEY_INFO_CHANNEL_TIME | SURVEY_INFO_CHANNEL_TIME_BUSY; 1040 + SURVEY_INFO_TIME | 1041 + SURVEY_INFO_TIME_BUSY; 1042 1042 survey->noise = pchan_stats[idx].noise; 1043 - survey->channel_time = pchan_stats[idx].cca_scan_dur; 1044 - survey->channel_time_busy = pchan_stats[idx].cca_busy_dur; 1043 + survey->time = pchan_stats[idx].cca_scan_dur; 1044 + survey->time_busy = pchan_stats[idx].cca_busy_dur; 1045 1045 1046 1046 return 0; 1047 1047 }
-1
drivers/net/wireless/mwifiex/uap_event.c
··· 68 68 len = ETH_ALEN; 69 69 70 70 if (len != -1) { 71 - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; 72 71 sinfo.assoc_req_ies = &event->data[len]; 73 72 len = (u8 *)sinfo.assoc_req_ies - 74 73 (u8 *)&event->frame_control;
+6 -6
drivers/net/wireless/mwl8k.c
··· 3098 3098 3099 3099 cca_cnt = ioread32(priv->regs + NOK_CCA_CNT_REG); 3100 3100 cca_cnt /= 1000; /* uSecs to mSecs */ 3101 - survey->channel_time_busy = (u64) cca_cnt; 3101 + survey->time_busy = (u64) cca_cnt; 3102 3102 3103 3103 rx_rdy = ioread32(priv->regs + BBU_RXRDY_CNT_REG); 3104 3104 rx_rdy /= 1000; /* uSecs to mSecs */ 3105 - survey->channel_time_rx = (u64) rx_rdy; 3105 + survey->time_rx = (u64) rx_rdy; 3106 3106 3107 3107 priv->channel_time = jiffies - priv->channel_time; 3108 - survey->channel_time = jiffies_to_msecs(priv->channel_time); 3108 + survey->time = jiffies_to_msecs(priv->channel_time); 3109 3109 3110 3110 survey->channel = channel; 3111 3111 ··· 3115 3115 survey->noise = nf * -1; 3116 3116 3117 3117 survey->filled = SURVEY_INFO_NOISE_DBM | 3118 - SURVEY_INFO_CHANNEL_TIME | 3119 - SURVEY_INFO_CHANNEL_TIME_BUSY | 3120 - SURVEY_INFO_CHANNEL_TIME_RX; 3118 + SURVEY_INFO_TIME | 3119 + SURVEY_INFO_TIME_BUSY | 3120 + SURVEY_INFO_TIME_RX; 3121 3121 } 3122 3122 3123 3123 /*
+3 -3
drivers/net/wireless/p54/eeprom.c
··· 196 196 dest->max_power = chan->max_power; 197 197 priv->survey[*chan_num].channel = &tmp->channels[j]; 198 198 priv->survey[*chan_num].filled = SURVEY_INFO_NOISE_DBM | 199 - SURVEY_INFO_CHANNEL_TIME | 200 - SURVEY_INFO_CHANNEL_TIME_BUSY | 201 - SURVEY_INFO_CHANNEL_TIME_TX; 199 + SURVEY_INFO_TIME | 200 + SURVEY_INFO_TIME_BUSY | 201 + SURVEY_INFO_TIME_TX; 202 202 dest->hw_value = (*chan_num); 203 203 j++; 204 204 (*chan_num)++;
+6 -4
drivers/net/wireless/p54/main.c
··· 305 305 struct survey_info *info = &priv->survey[chan->hw_value]; 306 306 307 307 /* only reset channel statistics, don't touch .filled, etc. */ 308 - info->channel_time = 0; 309 - info->channel_time_busy = 0; 310 - info->channel_time_tx = 0; 308 + info->time = 0; 309 + info->time_busy = 0; 310 + info->time_tx = 0; 311 311 } 312 312 313 313 priv->update_stats = true; ··· 575 575 key->hw_key_idx = 0xff; 576 576 goto out_unlock; 577 577 } 578 + 579 + key->flags |= IEEE80211_KEY_FLAG_RESERVE_TAILROOM; 578 580 } else { 579 581 slot = key->hw_key_idx; 580 582 ··· 636 634 637 635 if (in_use) { 638 636 /* test if the reported statistics are valid. */ 639 - if (survey->channel_time != 0) { 637 + if (survey->time != 0) { 640 638 survey->filled |= SURVEY_INFO_IN_USE; 641 639 } else { 642 640 /*
+6 -6
drivers/net/wireless/p54/txrx.c
··· 587 587 if (chan) { 588 588 struct survey_info *survey = &priv->survey[chan->hw_value]; 589 589 survey->noise = clamp(priv->noise, -128, 127); 590 - survey->channel_time = priv->survey_raw.active; 591 - survey->channel_time_tx = priv->survey_raw.tx; 592 - survey->channel_time_busy = priv->survey_raw.tx + 590 + survey->time = priv->survey_raw.active; 591 + survey->time_tx = priv->survey_raw.tx; 592 + survey->time_busy = priv->survey_raw.tx + 593 593 priv->survey_raw.cca; 594 - do_div(survey->channel_time, 1024); 595 - do_div(survey->channel_time_tx, 1024); 596 - do_div(survey->channel_time_busy, 1024); 594 + do_div(survey->time, 1024); 595 + do_div(survey->time_tx, 1024); 596 + do_div(survey->time_busy, 1024); 597 597 } 598 598 599 599 tmp = p54_find_and_unlink_skb(priv, hdr->req_id);
+2 -2
drivers/net/wireless/rndis_wlan.c
··· 2478 2478 ret = rndis_query_oid(usbdev, RNDIS_OID_GEN_LINK_SPEED, &linkspeed, &len); 2479 2479 if (ret == 0) { 2480 2480 sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000; 2481 - sinfo->filled |= STATION_INFO_TX_BITRATE; 2481 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 2482 2482 } 2483 2483 2484 2484 len = sizeof(rssi); ··· 2486 2486 &rssi, &len); 2487 2487 if (ret == 0) { 2488 2488 sinfo->signal = level_to_qual(le32_to_cpu(rssi)); 2489 - sinfo->filled |= STATION_INFO_SIGNAL; 2489 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 2490 2490 } 2491 2491 } 2492 2492
+6 -6
drivers/net/wireless/rt2x00/rt2800lib.c
··· 8020 8020 rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, &busy_ext); 8021 8021 8022 8022 if (idle || busy) { 8023 - survey->filled = SURVEY_INFO_CHANNEL_TIME | 8024 - SURVEY_INFO_CHANNEL_TIME_BUSY | 8025 - SURVEY_INFO_CHANNEL_TIME_EXT_BUSY; 8023 + survey->filled = SURVEY_INFO_TIME | 8024 + SURVEY_INFO_TIME_BUSY | 8025 + SURVEY_INFO_TIME_EXT_BUSY; 8026 8026 8027 - survey->channel_time = (idle + busy) / 1000; 8028 - survey->channel_time_busy = busy / 1000; 8029 - survey->channel_time_ext_busy = busy_ext / 1000; 8027 + survey->time = (idle + busy) / 1000; 8028 + survey->time_busy = busy / 1000; 8029 + survey->time_ext_busy = busy_ext / 1000; 8030 8030 } 8031 8031 8032 8032 if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL))
+2 -3
drivers/net/wireless/ti/wl1251/main.c
··· 500 500 int ret = 0; 501 501 502 502 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | 503 + IEEE80211_VIF_SUPPORTS_UAPSD | 503 504 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 504 505 505 506 wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", ··· 1481 1480 /* unit us */ 1482 1481 /* FIXME: find a proper value */ 1483 1482 1484 - wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | 1485 - IEEE80211_HW_SUPPORTS_PS | 1486 - IEEE80211_HW_SUPPORTS_UAPSD; 1483 + wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SUPPORTS_PS; 1487 1484 1488 1485 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 1489 1486 BIT(NL80211_IFTYPE_ADHOC);
+12 -10
drivers/net/wireless/ti/wlcore/main.c
··· 2552 2552 } 2553 2553 2554 2554 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | 2555 + IEEE80211_VIF_SUPPORTS_UAPSD | 2555 2556 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 2556 2557 2557 2558 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", ··· 5662 5661 ieee80211_queue_work(hw, &wlvif->rc_update_work); 5663 5662 } 5664 5663 5665 - static int wlcore_op_get_rssi(struct ieee80211_hw *hw, 5666 - struct ieee80211_vif *vif, 5667 - struct ieee80211_sta *sta, 5668 - s8 *rssi_dbm) 5664 + static void wlcore_op_sta_statistics(struct ieee80211_hw *hw, 5665 + struct ieee80211_vif *vif, 5666 + struct ieee80211_sta *sta, 5667 + struct station_info *sinfo) 5669 5668 { 5670 5669 struct wl1271 *wl = hw->priv; 5671 5670 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); 5672 - int ret = 0; 5671 + s8 rssi_dbm; 5672 + int ret; 5673 5673 5674 5674 wl1271_debug(DEBUG_MAC80211, "mac80211 get_rssi"); 5675 5675 ··· 5683 5681 if (ret < 0) 5684 5682 goto out_sleep; 5685 5683 5686 - ret = wlcore_acx_average_rssi(wl, wlvif, rssi_dbm); 5684 + ret = wlcore_acx_average_rssi(wl, wlvif, &rssi_dbm); 5687 5685 if (ret < 0) 5688 5686 goto out_sleep; 5687 + 5688 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 5689 + sinfo->signal = rssi_dbm; 5689 5690 5690 5691 out_sleep: 5691 5692 wl1271_ps_elp_sleep(wl); 5692 5693 5693 5694 out: 5694 5695 mutex_unlock(&wl->mutex); 5695 - 5696 - return ret; 5697 5696 } 5698 5697 5699 5698 static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) ··· 5896 5893 .unassign_vif_chanctx = wlcore_op_unassign_vif_chanctx, 5897 5894 .switch_vif_chanctx = wlcore_op_switch_vif_chanctx, 5898 5895 .sta_rc_update = wlcore_op_sta_rc_update, 5899 - .get_rssi = wlcore_op_get_rssi, 5896 + .sta_statistics = wlcore_op_sta_statistics, 5900 5897 CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 5901 5898 }; 5902 5899 ··· 6067 6064 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | 6068 6065 IEEE80211_HW_SUPPORTS_PS | 6069 6066 IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 6070 - IEEE80211_HW_SUPPORTS_UAPSD | 6071 6067 IEEE80211_HW_HAS_RATE_CONTROL | 6072 6068 IEEE80211_HW_CONNECTION_MONITOR | 6073 6069 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+5 -5
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
··· 1091 1091 goto exit; 1092 1092 } 1093 1093 1094 - sinfo->filled |= STATION_INFO_SIGNAL; 1094 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1095 1095 sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv. 1096 1096 signal_strength); 1097 1097 1098 - sinfo->filled |= STATION_INFO_TX_BITRATE; 1098 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 1099 1099 sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); 1100 1100 1101 - sinfo->filled |= STATION_INFO_RX_PACKETS; 1101 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS); 1102 1102 sinfo->rx_packets = sta_rx_data_pkts(psta); 1103 1103 1104 - sinfo->filled |= STATION_INFO_TX_PACKETS; 1104 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS); 1105 1105 sinfo->tx_packets = psta->sta_stats.tx_pkts; 1106 1106 } 1107 1107 ··· 2363 2363 ie_offset = offsetof(struct ieee80211_mgmt, 2364 2364 u.reassoc_req.variable); 2365 2365 2366 - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; 2366 + sinfo.filled = 0; 2367 2367 sinfo.assoc_req_ies = pmgmt_frame + ie_offset; 2368 2368 sinfo.assoc_req_ies_len = frame_len - ie_offset; 2369 2369 cfg80211_new_sta(ndev, hdr->addr2, &sinfo, GFP_ATOMIC);
+2 -2
drivers/staging/wlan-ng/cfg80211.c
··· 325 325 326 326 if (result == 0) { 327 327 sinfo->txrate.legacy = quality.txrate.data; 328 - sinfo->filled |= STATION_INFO_TX_BITRATE; 328 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 329 329 sinfo->signal = quality.level.data; 330 - sinfo->filled |= STATION_INFO_SIGNAL; 330 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 331 331 } 332 332 333 333 return result;
+174 -114
include/net/cfg80211.h
··· 520 520 * 521 521 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 522 522 * @SURVEY_INFO_IN_USE: channel is currently being used 523 - * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 524 - * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 525 - * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 526 - * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 527 - * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 523 + * @SURVEY_INFO_TIME: active time (in ms) was filled in 524 + * @SURVEY_INFO_TIME_BUSY: busy time was filled in 525 + * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 526 + * @SURVEY_INFO_TIME_RX: receive time was filled in 527 + * @SURVEY_INFO_TIME_TX: transmit time was filled in 528 + * @SURVEY_INFO_TIME_SCAN: scan time was filled in 528 529 * 529 530 * Used by the driver to indicate which info in &struct survey_info 530 531 * it has filled in during the get_survey(). 531 532 */ 532 533 enum survey_info_flags { 533 - SURVEY_INFO_NOISE_DBM = 1<<0, 534 - SURVEY_INFO_IN_USE = 1<<1, 535 - SURVEY_INFO_CHANNEL_TIME = 1<<2, 536 - SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 537 - SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 538 - SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 539 - SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 534 + SURVEY_INFO_NOISE_DBM = BIT(0), 535 + SURVEY_INFO_IN_USE = BIT(1), 536 + SURVEY_INFO_TIME = BIT(2), 537 + SURVEY_INFO_TIME_BUSY = BIT(3), 538 + SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 539 + SURVEY_INFO_TIME_RX = BIT(5), 540 + SURVEY_INFO_TIME_TX = BIT(6), 541 + SURVEY_INFO_TIME_SCAN = BIT(7), 540 542 }; 541 543 542 544 /** 543 545 * struct survey_info - channel survey response 544 546 * 545 - * @channel: the channel this survey record reports, mandatory 547 + * @channel: the channel this survey record reports, may be %NULL for a single 548 + * record to report global statistics 546 549 * @filled: bitflag of flags from &enum survey_info_flags 547 550 * @noise: channel noise in dBm. This and all following fields are 548 551 * optional 549 - * @channel_time: amount of time in ms the radio spent on the channel 550 - * @channel_time_busy: amount of time the primary channel was sensed busy 551 - * @channel_time_ext_busy: amount of time the extension channel was sensed busy 552 - * @channel_time_rx: amount of time the radio spent receiving data 553 - * @channel_time_tx: amount of time the radio spent transmitting data 552 + * @time: amount of time in ms the radio was turn on (on the channel) 553 + * @time_busy: amount of time the primary channel was sensed busy 554 + * @time_ext_busy: amount of time the extension channel was sensed busy 555 + * @time_rx: amount of time the radio spent receiving data 556 + * @time_tx: amount of time the radio spent transmitting data 557 + * @time_scan: amount of time the radio spent for scanning 554 558 * 555 559 * Used by dump_survey() to report back per-channel survey information. 556 560 * ··· 563 559 */ 564 560 struct survey_info { 565 561 struct ieee80211_channel *channel; 566 - u64 channel_time; 567 - u64 channel_time_busy; 568 - u64 channel_time_ext_busy; 569 - u64 channel_time_rx; 570 - u64 channel_time_tx; 562 + u64 time; 563 + u64 time_busy; 564 + u64 time_ext_busy; 565 + u64 time_rx; 566 + u64 time_tx; 567 + u64 time_scan; 571 568 u32 filled; 572 569 s8 noise; 573 570 }; ··· 866 861 enum cfg80211_station_type statype); 867 862 868 863 /** 869 - * enum station_info_flags - station information flags 870 - * 871 - * Used by the driver to indicate which info in &struct station_info 872 - * it has filled in during get_station() or dump_station(). 873 - * 874 - * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 875 - * @STATION_INFO_RX_BYTES: @rx_bytes filled 876 - * @STATION_INFO_TX_BYTES: @tx_bytes filled 877 - * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value 878 - * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value 879 - * @STATION_INFO_LLID: @llid filled 880 - * @STATION_INFO_PLID: @plid filled 881 - * @STATION_INFO_PLINK_STATE: @plink_state filled 882 - * @STATION_INFO_SIGNAL: @signal filled 883 - * @STATION_INFO_TX_BITRATE: @txrate fields are filled 884 - * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 885 - * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value 886 - * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value 887 - * @STATION_INFO_TX_RETRIES: @tx_retries filled 888 - * @STATION_INFO_TX_FAILED: @tx_failed filled 889 - * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 890 - * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 891 - * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 892 - * @STATION_INFO_BSS_PARAM: @bss_param filled 893 - * @STATION_INFO_CONNECTED_TIME: @connected_time filled 894 - * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 895 - * @STATION_INFO_STA_FLAGS: @sta_flags filled 896 - * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 897 - * @STATION_INFO_T_OFFSET: @t_offset filled 898 - * @STATION_INFO_LOCAL_PM: @local_pm filled 899 - * @STATION_INFO_PEER_PM: @peer_pm filled 900 - * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 901 - * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 902 - * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 903 - * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled 904 - */ 905 - enum station_info_flags { 906 - STATION_INFO_INACTIVE_TIME = BIT(0), 907 - STATION_INFO_RX_BYTES = BIT(1), 908 - STATION_INFO_TX_BYTES = BIT(2), 909 - STATION_INFO_LLID = BIT(3), 910 - STATION_INFO_PLID = BIT(4), 911 - STATION_INFO_PLINK_STATE = BIT(5), 912 - STATION_INFO_SIGNAL = BIT(6), 913 - STATION_INFO_TX_BITRATE = BIT(7), 914 - STATION_INFO_RX_PACKETS = BIT(8), 915 - STATION_INFO_TX_PACKETS = BIT(9), 916 - STATION_INFO_TX_RETRIES = BIT(10), 917 - STATION_INFO_TX_FAILED = BIT(11), 918 - STATION_INFO_RX_DROP_MISC = BIT(12), 919 - STATION_INFO_SIGNAL_AVG = BIT(13), 920 - STATION_INFO_RX_BITRATE = BIT(14), 921 - STATION_INFO_BSS_PARAM = BIT(15), 922 - STATION_INFO_CONNECTED_TIME = BIT(16), 923 - STATION_INFO_ASSOC_REQ_IES = BIT(17), 924 - STATION_INFO_STA_FLAGS = BIT(18), 925 - STATION_INFO_BEACON_LOSS_COUNT = BIT(19), 926 - STATION_INFO_T_OFFSET = BIT(20), 927 - STATION_INFO_LOCAL_PM = BIT(21), 928 - STATION_INFO_PEER_PM = BIT(22), 929 - STATION_INFO_NONPEER_PM = BIT(23), 930 - STATION_INFO_RX_BYTES64 = BIT(24), 931 - STATION_INFO_TX_BYTES64 = BIT(25), 932 - STATION_INFO_CHAIN_SIGNAL = BIT(26), 933 - STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), 934 - STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), 935 - }; 936 - 937 - /** 938 864 * enum station_info_rate_flags - bitrate info flags 939 865 * 940 866 * Used by the driver to indicate the specific rate transmission ··· 873 937 * 874 938 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 875 939 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 876 - * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission 877 - * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission 878 - * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission 879 - * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission 880 940 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 881 941 * @RATE_INFO_FLAGS_60G: 60GHz MCS 882 942 */ 883 943 enum rate_info_flags { 884 944 RATE_INFO_FLAGS_MCS = BIT(0), 885 945 RATE_INFO_FLAGS_VHT_MCS = BIT(1), 886 - RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 887 - RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 888 - RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4), 889 - RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5), 890 - RATE_INFO_FLAGS_SHORT_GI = BIT(6), 891 - RATE_INFO_FLAGS_60G = BIT(7), 946 + RATE_INFO_FLAGS_SHORT_GI = BIT(2), 947 + RATE_INFO_FLAGS_60G = BIT(3), 948 + }; 949 + 950 + /** 951 + * enum rate_info_bw - rate bandwidth information 952 + * 953 + * Used by the driver to indicate the rate bandwidth. 954 + * 955 + * @RATE_INFO_BW_5: 5 MHz bandwidth 956 + * @RATE_INFO_BW_10: 10 MHz bandwidth 957 + * @RATE_INFO_BW_20: 20 MHz bandwidth 958 + * @RATE_INFO_BW_40: 40 MHz bandwidth 959 + * @RATE_INFO_BW_80: 80 MHz bandwidth 960 + * @RATE_INFO_BW_160: 160 MHz bandwidth 961 + */ 962 + enum rate_info_bw { 963 + RATE_INFO_BW_5, 964 + RATE_INFO_BW_10, 965 + RATE_INFO_BW_20, 966 + RATE_INFO_BW_40, 967 + RATE_INFO_BW_80, 968 + RATE_INFO_BW_160, 892 969 }; 893 970 894 971 /** ··· 913 964 * @mcs: mcs index if struct describes a 802.11n bitrate 914 965 * @legacy: bitrate in 100kbit/s for 802.11abg 915 966 * @nss: number of streams (VHT only) 967 + * @bw: bandwidth (from &enum rate_info_bw) 916 968 */ 917 969 struct rate_info { 918 970 u8 flags; 919 971 u8 mcs; 920 972 u16 legacy; 921 973 u8 nss; 974 + u8 bw; 922 975 }; 923 976 924 977 /** ··· 954 1003 u16 beacon_interval; 955 1004 }; 956 1005 1006 + /** 1007 + * struct cfg80211_tid_stats - per-TID statistics 1008 + * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 1009 + * indicate the relevant values in this struct are filled 1010 + * @rx_msdu: number of received MSDUs 1011 + * @tx_msdu: number of (attempted) transmitted MSDUs 1012 + * @tx_msdu_retries: number of retries (not counting the first) for 1013 + * transmitted MSDUs 1014 + * @tx_msdu_failed: number of failed transmitted MSDUs 1015 + */ 1016 + struct cfg80211_tid_stats { 1017 + u32 filled; 1018 + u64 rx_msdu; 1019 + u64 tx_msdu; 1020 + u64 tx_msdu_retries; 1021 + u64 tx_msdu_failed; 1022 + }; 1023 + 957 1024 #define IEEE80211_MAX_CHAINS 4 958 1025 959 1026 /** ··· 979 1010 * 980 1011 * Station information filled by driver for get_station() and dump_station. 981 1012 * 982 - * @filled: bitflag of flags from &enum station_info_flags 1013 + * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1014 + * indicate the relevant values in this struct for them 983 1015 * @connected_time: time(in secs) since a station is last connected 984 1016 * @inactive_time: time since last station activity (tx/rx) in milliseconds 985 - * @rx_bytes: bytes received from this station 986 - * @tx_bytes: bytes transmitted to this station 1017 + * @rx_bytes: bytes (size of MPDUs) received from this station 1018 + * @tx_bytes: bytes (size of MPDUs) transmitted to this station 987 1019 * @llid: mesh local link id 988 1020 * @plid: mesh peer link id 989 1021 * @plink_state: mesh peer link state ··· 997 1027 * @chain_signal_avg: per-chain signal strength average in dBm 998 1028 * @txrate: current unicast bitrate from this station 999 1029 * @rxrate: current unicast bitrate to this station 1000 - * @rx_packets: packets received from this station 1001 - * @tx_packets: packets transmitted to this station 1002 - * @tx_retries: cumulative retry counts 1003 - * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 1030 + * @rx_packets: packets (MSDUs & MMPDUs) received from this station 1031 + * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 1032 + * @tx_retries: cumulative retry counts (MPDUs) 1033 + * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 1004 1034 * @rx_dropped_misc: Dropped for un-specified reason. 1005 1035 * @bss_param: current BSS parameters 1006 1036 * @generation: generation number for nl80211 dumps. ··· 1020 1050 * @nonpeer_pm: non-peer mesh STA power save mode 1021 1051 * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1022 1052 * towards this station. 1053 + * @rx_beacon: number of beacons received from this peer 1054 + * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1055 + * from this peer 1056 + * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 1057 + * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1023 1058 */ 1024 1059 struct station_info { 1025 1060 u32 filled; ··· 1065 1090 1066 1091 u32 expected_throughput; 1067 1092 1068 - /* 1069 - * Note: Add a new enum station_info_flags value for each new field and 1070 - * use it to check which fields are initialized. 1071 - */ 1093 + u64 rx_beacon; 1094 + u8 rx_beacon_signal_avg; 1095 + struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1072 1096 }; 1073 1097 1074 1098 /** ··· 1490 1516 * @mac_addr_mask: MAC address mask used with randomisation, bits that 1491 1517 * are 0 in the mask should be randomised, bits that are 1 should 1492 1518 * be taken from the @mac_addr 1519 + * @rcu_head: RCU callback used to free the struct 1520 + * @owner_nlportid: netlink portid of owner (if this should is a request 1521 + * owned by a particular socket) 1493 1522 */ 1494 1523 struct cfg80211_sched_scan_request { 1495 1524 struct cfg80211_ssid *ssids; ··· 1514 1537 struct wiphy *wiphy; 1515 1538 struct net_device *dev; 1516 1539 unsigned long scan_start; 1540 + struct rcu_head rcu_head; 1541 + u32 owner_nlportid; 1517 1542 1518 1543 /* keep last */ 1519 1544 struct ieee80211_channel *channels[0]; ··· 2990 3011 * @regulatory_flags: wiphy regulatory flags, see 2991 3012 * &enum ieee80211_regulatory_flags 2992 3013 * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3014 + * @ext_features: extended features advertised to nl80211, see 3015 + * &enum nl80211_ext_feature_index. 2993 3016 * @bss_priv_size: each BSS struct has private data allocated with it, 2994 3017 * this variable determines its size 2995 3018 * @max_scan_ssids: maximum number of SSIDs the device can scan for in ··· 3101 3120 u16 max_acl_mac_addrs; 3102 3121 3103 3122 u32 flags, regulatory_flags, features; 3123 + u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3104 3124 3105 3125 u32 ap_sme_capa; 3106 3126 ··· 3788 3806 * Return: 0 on success. -ENOMEM. 3789 3807 */ 3790 3808 int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3809 + 3810 + /** 3811 + * regulatory_set_wiphy_regd - set regdom info for self managed drivers 3812 + * @wiphy: the wireless device we want to process the regulatory domain on 3813 + * @rd: the regulatory domain informatoin to use for this wiphy 3814 + * 3815 + * Set the regulatory domain information for self-managed wiphys, only they 3816 + * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 3817 + * information. 3818 + * 3819 + * Return: 0 on success. -EINVAL, -EPERM 3820 + */ 3821 + int regulatory_set_wiphy_regd(struct wiphy *wiphy, 3822 + struct ieee80211_regdomain *rd); 3823 + 3824 + /** 3825 + * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 3826 + * @wiphy: the wireless device we want to process the regulatory domain on 3827 + * @rd: the regulatory domain information to use for this wiphy 3828 + * 3829 + * This functions requires the RTNL to be held and applies the new regdomain 3830 + * synchronously to this wiphy. For more details see 3831 + * regulatory_set_wiphy_regd(). 3832 + * 3833 + * Return: 0 on success. -EINVAL, -EPERM 3834 + */ 3835 + int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 3836 + struct ieee80211_regdomain *rd); 3791 3837 3792 3838 /** 3793 3839 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain ··· 4575 4565 struct station_info *sinfo, gfp_t gfp); 4576 4566 4577 4567 /** 4568 + * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 4569 + * @dev: the netdev 4570 + * @mac_addr: the station's address 4571 + * @sinfo: the station information/statistics 4572 + * @gfp: allocation flags 4573 + */ 4574 + void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 4575 + struct station_info *sinfo, gfp_t gfp); 4576 + 4577 + /** 4578 4578 * cfg80211_del_sta - notify userspace about deletion of a station 4579 4579 * 4580 4580 * @dev: the netdev 4581 4581 * @mac_addr: the station's address 4582 4582 * @gfp: allocation flags 4583 4583 */ 4584 - void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 4584 + static inline void cfg80211_del_sta(struct net_device *dev, 4585 + const u8 *mac_addr, gfp_t gfp) 4586 + { 4587 + cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 4588 + } 4585 4589 4586 4590 /** 4587 4591 * cfg80211_conn_failed - connection request failed notification ··· 5057 5033 */ 5058 5034 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5059 5035 5036 + /** 5037 + * wiphy_ext_feature_set - set the extended feature flag 5038 + * 5039 + * @wiphy: the wiphy to modify. 5040 + * @ftidx: extended feature bit index. 5041 + * 5042 + * The extended features are flagged in multiple bytes (see 5043 + * &struct wiphy.@ext_features) 5044 + */ 5045 + static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 5046 + enum nl80211_ext_feature_index ftidx) 5047 + { 5048 + u8 *ft_byte; 5049 + 5050 + ft_byte = &wiphy->ext_features[ftidx / 8]; 5051 + *ft_byte |= BIT(ftidx % 8); 5052 + } 5053 + 5054 + /** 5055 + * wiphy_ext_feature_isset - check the extended feature flag 5056 + * 5057 + * @wiphy: the wiphy to modify. 5058 + * @ftidx: extended feature bit index. 5059 + * 5060 + * The extended features are flagged in multiple bytes (see 5061 + * &struct wiphy.@ext_features) 5062 + */ 5063 + static inline bool 5064 + wiphy_ext_feature_isset(struct wiphy *wiphy, 5065 + enum nl80211_ext_feature_index ftidx) 5066 + { 5067 + u8 ft_byte; 5068 + 5069 + ft_byte = wiphy->ext_features[ftidx / 8]; 5070 + return (ft_byte & BIT(ftidx % 8)) != 0; 5071 + } 5060 5072 5061 5073 /* ethtool helper */ 5062 5074 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
+34 -20
include/net/mac80211.h
··· 505 505 * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it 506 506 * would be fragmented by size (this is optional, only used for 507 507 * monitor injection). 508 - * @IEEE80211_TX_CTL_PS_RESPONSE: This frame is a response to a poll 509 - * frame (PS-Poll or uAPSD). 508 + * @IEEE80211_TX_STAT_NOACK_TRANSMITTED: A frame that was marked with 509 + * IEEE80211_TX_CTL_NO_ACK has been successfully transmitted without 510 + * any errors (like issues specific to the driver/HW). 511 + * This flag must not be set for frames that don't request no-ack 512 + * behaviour with IEEE80211_TX_CTL_NO_ACK. 510 513 * 511 514 * Note: If you have to add new flags to the enumeration, then don't 512 515 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. ··· 545 542 IEEE80211_TX_STATUS_EOSP = BIT(28), 546 543 IEEE80211_TX_CTL_USE_MINRATE = BIT(29), 547 544 IEEE80211_TX_CTL_DONTFRAG = BIT(30), 548 - IEEE80211_TX_CTL_PS_RESPONSE = BIT(31), 545 + IEEE80211_TX_STAT_NOACK_TRANSMITTED = BIT(31), 549 546 }; 550 547 551 548 #define IEEE80211_TX_CTL_STBC_SHIFT 23 ··· 555 552 * 556 553 * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control 557 554 * protocol frame (e.g. EAP) 555 + * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll 556 + * frame (PS-Poll or uAPSD). 558 557 * 559 558 * These flags are used in tx_info->control.flags. 560 559 */ 561 560 enum mac80211_tx_control_flags { 562 561 IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), 562 + IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), 563 563 }; 564 564 565 565 /* ··· 931 925 * These flags are used with the @vht_flag member of 932 926 * &struct ieee80211_rx_status. 933 927 * @RX_VHT_FLAG_80MHZ: 80 MHz was used 934 - * @RX_VHT_FLAG_80P80MHZ: 80+80 MHz was used 935 928 * @RX_VHT_FLAG_160MHZ: 160 MHz was used 936 929 * @RX_VHT_FLAG_BF: packet was beamformed 937 930 */ 938 931 enum mac80211_rx_vht_flags { 939 932 RX_VHT_FLAG_80MHZ = BIT(0), 940 - RX_VHT_FLAG_80P80MHZ = BIT(1), 941 - RX_VHT_FLAG_160MHZ = BIT(2), 942 - RX_VHT_FLAG_BF = BIT(3), 933 + RX_VHT_FLAG_160MHZ = BIT(1), 934 + RX_VHT_FLAG_BF = BIT(2), 943 935 }; 944 936 945 937 /** ··· 1185 1181 * monitoring on this virtual interface -- i.e. it can monitor 1186 1182 * connection quality related parameters, such as the RSSI level and 1187 1183 * provide notifications if configured trigger levels are reached. 1184 + * @IEEE80211_VIF_SUPPORTS_UAPSD: The device can do U-APSD for this 1185 + * interface. This flag should be set during interface addition, 1186 + * but may be set/cleared as late as authentication to an AP. It is 1187 + * only valid for managed/station mode interfaces. 1188 1188 */ 1189 1189 enum ieee80211_vif_flags { 1190 1190 IEEE80211_VIF_BEACON_FILTER = BIT(0), 1191 1191 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), 1192 + IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), 1192 1193 }; 1193 1194 1194 1195 /** ··· 1305 1296 * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the 1306 1297 * driver for a CCMP key to indicate that is requires IV generation 1307 1298 * only for managment frames (MFP). 1299 + * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the 1300 + * driver for a key to indicate that sufficient tailroom must always 1301 + * be reserved for ICV or MIC, even when HW encryption is enabled. 1308 1302 */ 1309 1303 enum ieee80211_key_flags { 1310 1304 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0), ··· 1317 1305 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4), 1318 1306 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5), 1319 1307 IEEE80211_KEY_FLAG_RX_MGMT = BIT(6), 1308 + IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7), 1320 1309 }; 1321 1310 1322 1311 /** ··· 1596 1583 * @IEEE80211_HW_MFP_CAPABLE: 1597 1584 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1598 1585 * 1599 - * @IEEE80211_HW_SUPPORTS_UAPSD: 1600 - * Hardware supports Unscheduled Automatic Power Save Delivery 1601 - * (U-APSD) in managed mode. The mode is configured with 1602 - * conf_tx() operation. 1603 - * 1604 1586 * @IEEE80211_HW_REPORTS_TX_ACK_STATUS: 1605 1587 * Hardware can provide ack status reports of Tx frames to 1606 1588 * the stack. ··· 1681 1673 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1682 1674 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14, 1683 1675 IEEE80211_HW_NO_AUTO_VIF = 1<<15, 1684 - /* free slot */ 1685 - IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1676 + /* free slots */ 1686 1677 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1687 1678 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1688 1679 IEEE80211_HW_QUEUE_CONTROL = 1<<20, ··· 2033 2026 * enabled whenever user has enabled powersave. 2034 2027 * 2035 2028 * Driver informs U-APSD client support by enabling 2036 - * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 2029 + * %IEEE80211_VIF_SUPPORTS_UAPSD flag. The mode is configured through the 2037 2030 * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS 2038 2031 * Nullfunc frames and stay awake until the service period has ended. To 2039 2032 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames ··· 2706 2699 * is only used if the configured rate control algorithm actually uses 2707 2700 * the new rate table API, and is therefore optional. Must be atomic. 2708 2701 * 2702 + * @sta_statistics: Get statistics for this station. For example with beacon 2703 + * filtering, the statistics kept by mac80211 might not be accurate, so 2704 + * let the driver pre-fill the statistics. The driver can fill most of 2705 + * the values (indicating which by setting the filled bitmap), but not 2706 + * all of them make sense - see the source for which ones are possible. 2707 + * Statistics that the driver doesn't fill will be filled by mac80211. 2708 + * The callback can sleep. 2709 + * 2709 2710 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 2710 2711 * bursting) for a hardware TX queue. 2711 2712 * Returns a negative error code on failure. ··· 2873 2858 * 2874 2859 * @get_et_strings: Ethtool API to get a set of strings to describe stats 2875 2860 * and perhaps other supported types of ethtool data-sets. 2876 - * 2877 - * @get_rssi: Get current signal strength in dBm, the function is optional 2878 - * and can sleep. 2879 2861 * 2880 2862 * @mgd_prepare_tx: Prepare for transmitting a management frame for association 2881 2863 * before associated. In multi-channel scenarios, a virtual interface is ··· 3074 3062 void (*sta_rate_tbl_update)(struct ieee80211_hw *hw, 3075 3063 struct ieee80211_vif *vif, 3076 3064 struct ieee80211_sta *sta); 3065 + void (*sta_statistics)(struct ieee80211_hw *hw, 3066 + struct ieee80211_vif *vif, 3067 + struct ieee80211_sta *sta, 3068 + struct station_info *sinfo); 3077 3069 int (*conf_tx)(struct ieee80211_hw *hw, 3078 3070 struct ieee80211_vif *vif, u16 ac, 3079 3071 const struct ieee80211_tx_queue_params *params); ··· 3145 3129 void (*get_et_strings)(struct ieee80211_hw *hw, 3146 3130 struct ieee80211_vif *vif, 3147 3131 u32 sset, u8 *data); 3148 - int (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 3149 - struct ieee80211_sta *sta, s8 *rssi_dbm); 3150 3132 3151 3133 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 3152 3134 struct ieee80211_vif *vif);
+19
include/net/regulatory.h
··· 147 147 * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, 148 148 * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device 149 149 * includes any modes unsupported for enforcement checking. 150 + * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific 151 + * regdom management. These devices will ignore all regdom changes not 152 + * originating from their own wiphy. 153 + * A self-managed wiphys only employs regulatory information obtained from 154 + * the FW and driver and does not use other cfg80211 sources like 155 + * beacon-hints, country-code IEs and hints from other devices on the same 156 + * system. Conversely, a self-managed wiphy does not share its regulatory 157 + * hints with other devices in the system. If a system contains several 158 + * devices, one or more of which are self-managed, there might be 159 + * contradictory regulatory settings between them. Usage of flag is 160 + * generally discouraged. Only use it if the FW/driver is incompatible 161 + * with non-locally originated hints. 162 + * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG, 163 + * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER, 164 + * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS. 165 + * Mixing any of the above flags with this flag will result in a failure 166 + * to register the wiphy. This flag implies 167 + * %REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE. 150 168 */ 151 169 enum ieee80211_regulatory_flags { 152 170 REGULATORY_CUSTOM_REG = BIT(0), ··· 174 156 REGULATORY_COUNTRY_IE_IGNORE = BIT(4), 175 157 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), 176 158 REGULATORY_IGNORE_STALE_KICKOFF = BIT(6), 159 + REGULATORY_WIPHY_SELF_MANAGED = BIT(7), 177 160 }; 178 161 179 162 struct ieee80211_freq_range {
+161 -26
include/uapi/linux/nl80211.h
··· 29 29 30 30 #define NL80211_GENL_NAME "nl80211" 31 31 32 + #define NL80211_MULTICAST_GROUP_CONFIG "config" 33 + #define NL80211_MULTICAST_GROUP_SCAN "scan" 34 + #define NL80211_MULTICAST_GROUP_REG "regulatory" 35 + #define NL80211_MULTICAST_GROUP_MLME "mlme" 36 + #define NL80211_MULTICAST_GROUP_VENDOR "vendor" 37 + #define NL80211_MULTICAST_GROUP_TESTMODE "testmode" 38 + 32 39 /** 33 40 * DOC: Station handling 34 41 * ··· 259 252 * %NL80211_ATTR_IFINDEX. 260 253 * 261 254 * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set 262 - * regulatory domain. 255 + * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device 256 + * has a private regulatory domain, it will be returned. Otherwise, the 257 + * global regdomain will be returned. 258 + * A device will have a private regulatory domain if it uses the 259 + * regulatory_hint() API. Even when a private regdomain is used the channel 260 + * information will still be mended according to further hints from 261 + * the regulatory core to help with compliance. A dump version of this API 262 + * is now available which will returns the global regdomain as well as 263 + * all private regdomains of present wiphys (for those that have it). 264 + * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then 265 + * its private regdomain is the only valid one for it. The regulatory 266 + * core is not used to help with compliance in this case. 263 267 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command 264 268 * after being queried by the kernel. CRDA replies by sending a regulatory 265 269 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our ··· 792 774 * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel 793 775 * when this command completes. 794 776 * 777 + * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used 778 + * as an event to indicate changes for devices with wiphy-specific regdom 779 + * management. 780 + * 795 781 * @NL80211_CMD_MAX: highest used command number 796 782 * @__NL80211_CMD_AFTER_LAST: internal use 797 783 */ ··· 979 957 980 958 NL80211_CMD_TDLS_CHANNEL_SWITCH, 981 959 NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH, 960 + 961 + NL80211_CMD_WIPHY_REG_CHANGE, 982 962 983 963 /* add new commands above here */ 984 964 ··· 1679 1655 * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface 1680 1656 * creation then the new interface will be owned by the netlink socket 1681 1657 * that created it and will be destroyed when the socket is closed. 1658 + * If set during scheduled scan start then the new scan req will be 1659 + * owned by the netlink socket that created it and the scheduled scan will 1660 + * be stopped when the socket is closed. 1682 1661 * 1683 1662 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is 1684 1663 * the TDLS link initiator. ··· 1714 1687 * @NL80211_ATTR_OPER_CLASS: operating class 1715 1688 * 1716 1689 * @NL80211_ATTR_MAC_MASK: MAC address mask 1690 + * 1691 + * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device 1692 + * is self-managing its regulatory information and any regulatory domain 1693 + * obtained from it is coming from the device's wiphy and not the global 1694 + * cfg80211 regdomain. 1695 + * 1696 + * @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte 1697 + * array. The feature flags are identified by their bit index (see &enum 1698 + * nl80211_ext_feature_index). The bit index is ordered starting at the 1699 + * least-significant bit of the first byte in the array, ie. bit index 0 1700 + * is located at bit 0 of byte 0. bit index 25 would be located at bit 1 1701 + * of byte 3 (u8 array). 1702 + * 1703 + * @NL80211_ATTR_SURVEY_RADIO_STATS: Request overall radio statistics to be 1704 + * returned along with other survey data. If set, @NL80211_CMD_GET_SURVEY 1705 + * may return a survey entry without a channel indicating global radio 1706 + * statistics (only some values are valid and make sense.) 1707 + * For devices that don't return such an entry even then, the information 1708 + * should be contained in the result as the sum of the respective counters 1709 + * over all channels. 1717 1710 * 1718 1711 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 1719 1712 * @NL80211_ATTR_MAX: highest attribute number currently defined ··· 2092 2045 2093 2046 NL80211_ATTR_MAC_MASK, 2094 2047 2048 + NL80211_ATTR_WIPHY_SELF_MANAGED_REG, 2049 + 2050 + NL80211_ATTR_EXT_FEATURES, 2051 + 2052 + NL80211_ATTR_SURVEY_RADIO_STATS, 2053 + 2095 2054 /* add attributes here, update the policy in nl80211.c */ 2096 2055 2097 2056 __NL80211_ATTR_AFTER_LAST, ··· 2138 2085 2139 2086 #define NL80211_MAX_SUPP_RATES 32 2140 2087 #define NL80211_MAX_SUPP_HT_RATES 77 2141 - #define NL80211_MAX_SUPP_REG_RULES 32 2088 + #define NL80211_MAX_SUPP_REG_RULES 64 2142 2089 #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 2143 2090 #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 2144 2091 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 ··· 2278 2225 * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8) 2279 2226 * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8) 2280 2227 * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate 2281 - * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: 80+80 MHz VHT rate 2228 + * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the 2229 + * same as 160 for purposes of the bitrates 2282 2230 * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate 2231 + * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is 2232 + * a legacy rate and will be reported as the actual bitrate, i.e. 2233 + * half the base (20 MHz) rate 2234 + * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is 2235 + * a legacy rate and will be reported as the actual bitrate, i.e. 2236 + * a quarter of the base (20 MHz) rate 2283 2237 * @__NL80211_RATE_INFO_AFTER_LAST: internal use 2284 2238 */ 2285 2239 enum nl80211_rate_info { ··· 2301 2241 NL80211_RATE_INFO_80_MHZ_WIDTH, 2302 2242 NL80211_RATE_INFO_80P80_MHZ_WIDTH, 2303 2243 NL80211_RATE_INFO_160_MHZ_WIDTH, 2244 + NL80211_RATE_INFO_10_MHZ_WIDTH, 2245 + NL80211_RATE_INFO_5_MHZ_WIDTH, 2304 2246 2305 2247 /* keep last */ 2306 2248 __NL80211_RATE_INFO_AFTER_LAST, ··· 2347 2285 * 2348 2286 * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved 2349 2287 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) 2350 - * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) 2351 - * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 2352 - * @NL80211_STA_INFO_RX_BYTES64: total received bytes (u64, from this station) 2353 - * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (u64, to this station) 2288 + * @NL80211_STA_INFO_RX_BYTES: total received bytes (MPDU length) 2289 + * (u32, from this station) 2290 + * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (MPDU length) 2291 + * (u32, to this station) 2292 + * @NL80211_STA_INFO_RX_BYTES64: total received bytes (MPDU length) 2293 + * (u64, from this station) 2294 + * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (MPDU length) 2295 + * (u64, to this station) 2354 2296 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) 2355 2297 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute 2356 2298 * containing info as possible, see &enum nl80211_rate_info 2357 - * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) 2358 - * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this 2359 - * station) 2360 - * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) 2361 - * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) 2299 + * @NL80211_STA_INFO_RX_PACKETS: total received packet (MSDUs and MMPDUs) 2300 + * (u32, from this station) 2301 + * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (MSDUs and MMPDUs) 2302 + * (u32, to this station) 2303 + * @NL80211_STA_INFO_TX_RETRIES: total retries (MPDUs) (u32, to this station) 2304 + * @NL80211_STA_INFO_TX_FAILED: total failed packets (MPDUs) 2305 + * (u32, to this station) 2362 2306 * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) 2363 2307 * @NL80211_STA_INFO_LLID: the station's mesh LLID 2364 2308 * @NL80211_STA_INFO_PLID: the station's mesh PLID ··· 2388 2320 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. 2389 2321 * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the 2390 2322 * 802.11 header (u32, kbps) 2323 + * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons 2324 + * (u64) 2325 + * @NL80211_STA_INFO_BEACON_RX: number of beacons received from this peer (u64) 2326 + * @NL80211_STA_INFO_BEACON_SIGNAL_AVG: signal strength average 2327 + * for beacons only (u8, dBm) 2328 + * @NL80211_STA_INFO_TID_STATS: per-TID statistics (see &enum nl80211_tid_stats) 2329 + * This is a nested attribute where each the inner attribute number is the 2330 + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames; 2331 + * each one of those is again nested with &enum nl80211_tid_stats 2332 + * attributes carrying the actual values. 2391 2333 * @__NL80211_STA_INFO_AFTER_LAST: internal 2392 2334 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2393 2335 */ ··· 2430 2352 NL80211_STA_INFO_CHAIN_SIGNAL, 2431 2353 NL80211_STA_INFO_CHAIN_SIGNAL_AVG, 2432 2354 NL80211_STA_INFO_EXPECTED_THROUGHPUT, 2355 + NL80211_STA_INFO_RX_DROP_MISC, 2356 + NL80211_STA_INFO_BEACON_RX, 2357 + NL80211_STA_INFO_BEACON_SIGNAL_AVG, 2358 + NL80211_STA_INFO_TID_STATS, 2433 2359 2434 2360 /* keep last */ 2435 2361 __NL80211_STA_INFO_AFTER_LAST, 2436 2362 NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 2363 + }; 2364 + 2365 + /** 2366 + * enum nl80211_tid_stats - per TID statistics attributes 2367 + * @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved 2368 + * @NL80211_TID_STATS_RX_MSDU: number of MSDUs received (u64) 2369 + * @NL80211_TID_STATS_TX_MSDU: number of MSDUs transmitted (or 2370 + * attempted to transmit; u64) 2371 + * @NL80211_TID_STATS_TX_MSDU_RETRIES: number of retries for 2372 + * transmitted MSDUs (not counting the first attempt; u64) 2373 + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted 2374 + * MSDUs (u64) 2375 + * @NUM_NL80211_TID_STATS: number of attributes here 2376 + * @NL80211_TID_STATS_MAX: highest numbered attribute here 2377 + */ 2378 + enum nl80211_tid_stats { 2379 + __NL80211_TID_STATS_INVALID, 2380 + NL80211_TID_STATS_RX_MSDU, 2381 + NL80211_TID_STATS_TX_MSDU, 2382 + NL80211_TID_STATS_TX_MSDU_RETRIES, 2383 + NL80211_TID_STATS_TX_MSDU_FAILED, 2384 + 2385 + /* keep last */ 2386 + NUM_NL80211_TID_STATS, 2387 + NL80211_TID_STATS_MAX = NUM_NL80211_TID_STATS - 1 2437 2388 }; 2438 2389 2439 2390 /** ··· 2879 2772 * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel 2880 2773 * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) 2881 2774 * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used 2882 - * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio 2883 - * spent on this channel 2884 - * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary 2775 + * @NL80211_SURVEY_INFO_TIME: amount of time (in ms) that the radio 2776 + * was turned on (on channel or globally) 2777 + * @NL80211_SURVEY_INFO_TIME_BUSY: amount of the time the primary 2885 2778 * channel was sensed busy (either due to activity or energy detect) 2886 - * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension 2779 + * @NL80211_SURVEY_INFO_TIME_EXT_BUSY: amount of time the extension 2887 2780 * channel was sensed busy 2888 - * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent 2889 - * receiving data 2890 - * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent 2891 - * transmitting data 2781 + * @NL80211_SURVEY_INFO_TIME_RX: amount of time the radio spent 2782 + * receiving data (on channel or globally) 2783 + * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent 2784 + * transmitting data (on channel or globally) 2785 + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan 2786 + * (on this channel or globally) 2892 2787 * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number 2893 2788 * currently defined 2894 2789 * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use ··· 2900 2791 NL80211_SURVEY_INFO_FREQUENCY, 2901 2792 NL80211_SURVEY_INFO_NOISE, 2902 2793 NL80211_SURVEY_INFO_IN_USE, 2903 - NL80211_SURVEY_INFO_CHANNEL_TIME, 2904 - NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, 2905 - NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, 2906 - NL80211_SURVEY_INFO_CHANNEL_TIME_RX, 2907 - NL80211_SURVEY_INFO_CHANNEL_TIME_TX, 2794 + NL80211_SURVEY_INFO_TIME, 2795 + NL80211_SURVEY_INFO_TIME_BUSY, 2796 + NL80211_SURVEY_INFO_TIME_EXT_BUSY, 2797 + NL80211_SURVEY_INFO_TIME_RX, 2798 + NL80211_SURVEY_INFO_TIME_TX, 2799 + NL80211_SURVEY_INFO_TIME_SCAN, 2908 2800 2909 2801 /* keep last */ 2910 2802 __NL80211_SURVEY_INFO_AFTER_LAST, 2911 2803 NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 2912 2804 }; 2805 + 2806 + /* keep old names for compatibility */ 2807 + #define NL80211_SURVEY_INFO_CHANNEL_TIME NL80211_SURVEY_INFO_TIME 2808 + #define NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY NL80211_SURVEY_INFO_TIME_BUSY 2809 + #define NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY NL80211_SURVEY_INFO_TIME_EXT_BUSY 2810 + #define NL80211_SURVEY_INFO_CHANNEL_TIME_RX NL80211_SURVEY_INFO_TIME_RX 2811 + #define NL80211_SURVEY_INFO_CHANNEL_TIME_TX NL80211_SURVEY_INFO_TIME_TX 2913 2812 2914 2813 /** 2915 2814 * enum nl80211_mntr_flags - monitor configuration flags ··· 3355 3238 /** 3356 3239 * enum nl80211_bss_status - BSS "status" 3357 3240 * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS. 3241 + * Note that this is no longer used since cfg80211 no longer 3242 + * keeps track of whether or not authentication was done with 3243 + * a given BSS. 3358 3244 * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS. 3359 3245 * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS. 3360 3246 * ··· 3743 3623 * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It 3744 3624 * specifies how the scan is performed (e.g. the interval and the 3745 3625 * channels to scan) as well as the scan results that will 3746 - * trigger a wake (i.e. the matchsets). 3626 + * trigger a wake (i.e. the matchsets). This attribute is also 3627 + * sent in a response to @NL80211_CMD_GET_WIPHY, indicating the 3628 + * number of match sets supported by the driver (u32). 3747 3629 * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute 3748 3630 * containing an array with information about what triggered the 3749 3631 * wake up. If no elements are present in the array, it means ··· 4313 4191 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, 4314 4192 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, 4315 4193 NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31, 4194 + }; 4195 + 4196 + /** 4197 + * enum nl80211_ext_feature_index - bit index of extended features. 4198 + * 4199 + * @NUM_NL80211_EXT_FEATURES: number of extended features. 4200 + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 4201 + */ 4202 + enum nl80211_ext_feature_index { 4203 + 4204 + /* add new features before the definition below */ 4205 + NUM_NL80211_EXT_FEATURES, 4206 + MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1 4316 4207 }; 4317 4208 4318 4209 /**
+24 -16
net/mac80211/cfg.c
··· 428 428 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 429 429 } 430 430 if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) 431 - rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 432 - if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) 433 - rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 434 - if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) 435 - rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 431 + rinfo->bw = RATE_INFO_BW_40; 432 + else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) 433 + rinfo->bw = RATE_INFO_BW_80; 434 + else if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) 435 + rinfo->bw = RATE_INFO_BW_160; 436 + else 437 + rinfo->bw = RATE_INFO_BW_20; 436 438 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) 437 439 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 438 440 } ··· 461 459 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 462 460 } 463 461 464 - if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) 465 - rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 466 462 if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) 467 463 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 468 - if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) 469 - rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 470 - if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80P80MHZ) 471 - rinfo->flags |= RATE_INFO_FLAGS_80P80_MHZ_WIDTH; 472 - if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) 473 - rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 464 + 465 + if (sta->last_rx_rate_flag & RX_FLAG_5MHZ) 466 + rinfo->bw = RATE_INFO_BW_5; 467 + else if (sta->last_rx_rate_flag & RX_FLAG_10MHZ) 468 + rinfo->bw = RATE_INFO_BW_10; 469 + else if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) 470 + rinfo->bw = RATE_INFO_BW_40; 471 + else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) 472 + rinfo->bw = RATE_INFO_BW_80; 473 + else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) 474 + rinfo->bw = RATE_INFO_BW_160; 475 + else 476 + rinfo->bw = RATE_INFO_BW_20; 474 477 } 475 478 476 479 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, ··· 685 678 BSS_CHANGED_BEACON_ENABLED | 686 679 BSS_CHANGED_BEACON | 687 680 BSS_CHANGED_SSID | 688 - BSS_CHANGED_P2P_PS; 681 + BSS_CHANGED_P2P_PS | 682 + BSS_CHANGED_TXPOWER; 689 683 int err; 690 684 691 685 old = sdata_dereference(sdata->u.ap.beacon, sdata); ··· 2564 2556 2565 2557 /* if there's one pending or we're scanning, queue this one */ 2566 2558 if (!list_empty(&local->roc_list) || 2567 - local->scanning || local->radar_detect_enabled) 2559 + local->scanning || ieee80211_is_radar_required(local)) 2568 2560 goto out_check_combine; 2569 2561 2570 2562 /* if not HW assist, just queue & schedule work */ ··· 3672 3664 * queues. 3673 3665 */ 3674 3666 synchronize_net(); 3675 - ieee80211_flush_queues(local, sdata); 3667 + ieee80211_flush_queues(local, sdata, false); 3676 3668 3677 3669 /* restore the normal QoS parameters 3678 3670 * (unconditionally to avoid races)
+32 -5
net/mac80211/chan.c
··· 388 388 return NULL; 389 389 } 390 390 391 - static bool ieee80211_is_radar_required(struct ieee80211_local *local) 391 + bool ieee80211_is_radar_required(struct ieee80211_local *local) 392 392 { 393 393 struct ieee80211_sub_if_data *sdata; 394 394 ··· 404 404 rcu_read_unlock(); 405 405 406 406 return false; 407 + } 408 + 409 + static bool 410 + ieee80211_chanctx_radar_required(struct ieee80211_local *local, 411 + struct ieee80211_chanctx *ctx) 412 + { 413 + struct ieee80211_chanctx_conf *conf = &ctx->conf; 414 + struct ieee80211_sub_if_data *sdata; 415 + bool required = false; 416 + 417 + lockdep_assert_held(&local->chanctx_mtx); 418 + lockdep_assert_held(&local->mtx); 419 + 420 + rcu_read_lock(); 421 + list_for_each_entry_rcu(sdata, &local->interfaces, list) { 422 + if (!ieee80211_sdata_running(sdata)) 423 + continue; 424 + if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) 425 + continue; 426 + if (!sdata->radar_required) 427 + continue; 428 + 429 + required = true; 430 + break; 431 + } 432 + rcu_read_unlock(); 433 + 434 + return required; 407 435 } 408 436 409 437 static struct ieee80211_chanctx * ··· 453 425 ctx->conf.rx_chains_static = 1; 454 426 ctx->conf.rx_chains_dynamic = 1; 455 427 ctx->mode = mode; 456 - ctx->conf.radar_enabled = ieee80211_is_radar_required(local); 428 + ctx->conf.radar_enabled = false; 457 429 ieee80211_recalc_chanctx_min_def(local, ctx); 458 430 459 431 return ctx; ··· 595 567 bool radar_enabled; 596 568 597 569 lockdep_assert_held(&local->chanctx_mtx); 598 - /* for setting local->radar_detect_enabled */ 570 + /* for ieee80211_is_radar_required */ 599 571 lockdep_assert_held(&local->mtx); 600 572 601 - radar_enabled = ieee80211_is_radar_required(local); 573 + radar_enabled = ieee80211_chanctx_radar_required(local, chanctx); 602 574 603 575 if (radar_enabled == chanctx->conf.radar_enabled) 604 576 return; 605 577 606 578 chanctx->conf.radar_enabled = radar_enabled; 607 - local->radar_detect_enabled = chanctx->conf.radar_enabled; 608 579 609 580 if (!local->use_chanctx) { 610 581 local->hw.conf.radar_enabled = chanctx->conf.radar_enabled;
-2
net/mac80211/debugfs.c
··· 303 303 sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_PS\n"); 304 304 if (local->hw.flags & IEEE80211_HW_MFP_CAPABLE) 305 305 sf += scnprintf(buf + sf, mxln - sf, "MFP_CAPABLE\n"); 306 - if (local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) 307 - sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_UAPSD\n"); 308 306 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 309 307 sf += scnprintf(buf + sf, mxln - sf, 310 308 "REPORTS_TX_ACK_STATUS\n");
+15 -15
net/mac80211/driver-ops.h
··· 639 639 trace_drv_return_void(local); 640 640 } 641 641 642 + static inline void drv_sta_statistics(struct ieee80211_local *local, 643 + struct ieee80211_sub_if_data *sdata, 644 + struct ieee80211_sta *sta, 645 + struct station_info *sinfo) 646 + { 647 + sdata = get_bss_sdata(sdata); 648 + if (!check_sdata_in_driver(sdata)) 649 + return; 650 + 651 + trace_drv_sta_statistics(local, sdata, sta); 652 + if (local->ops->sta_statistics) 653 + local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo); 654 + trace_drv_return_void(local); 655 + } 656 + 642 657 static inline int drv_conf_tx(struct ieee80211_local *local, 643 658 struct ieee80211_sub_if_data *sdata, u16 ac, 644 659 const struct ieee80211_tx_queue_params *params) ··· 979 964 tids, num_frames, reason, 980 965 more_data); 981 966 trace_drv_return_void(local); 982 - } 983 - 984 - static inline int drv_get_rssi(struct ieee80211_local *local, 985 - struct ieee80211_sub_if_data *sdata, 986 - struct ieee80211_sta *sta, 987 - s8 *rssi_dbm) 988 - { 989 - int ret; 990 - 991 - might_sleep(); 992 - 993 - ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm); 994 - trace_drv_get_rssi(local, sta, *rssi_dbm, ret); 995 - 996 - return ret; 997 967 } 998 968 999 969 static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
+13 -13
net/mac80211/ethtool.c
··· 117 117 data[i++] = sta->sta_state; 118 118 119 119 120 - if (sinfo.filled & STATION_INFO_TX_BITRATE) 120 + if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE)) 121 121 data[i] = 100000 * 122 122 cfg80211_calculate_bitrate(&sinfo.txrate); 123 123 i++; 124 - if (sinfo.filled & STATION_INFO_RX_BITRATE) 124 + if (sinfo.filled & BIT(NL80211_STA_INFO_RX_BITRATE)) 125 125 data[i] = 100000 * 126 126 cfg80211_calculate_bitrate(&sinfo.rxrate); 127 127 i++; 128 128 129 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG) 129 + if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL_AVG)) 130 130 data[i] = (u8)sinfo.signal_avg; 131 131 i++; 132 132 } else { ··· 175 175 data[i++] = (u8)survey.noise; 176 176 else 177 177 data[i++] = -1LL; 178 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME) 179 - data[i++] = survey.channel_time; 178 + if (survey.filled & SURVEY_INFO_TIME) 179 + data[i++] = survey.time; 180 180 else 181 181 data[i++] = -1LL; 182 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY) 183 - data[i++] = survey.channel_time_busy; 182 + if (survey.filled & SURVEY_INFO_TIME_BUSY) 183 + data[i++] = survey.time_busy; 184 184 else 185 185 data[i++] = -1LL; 186 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY) 187 - data[i++] = survey.channel_time_ext_busy; 186 + if (survey.filled & SURVEY_INFO_TIME_EXT_BUSY) 187 + data[i++] = survey.time_ext_busy; 188 188 else 189 189 data[i++] = -1LL; 190 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX) 191 - data[i++] = survey.channel_time_rx; 190 + if (survey.filled & SURVEY_INFO_TIME_RX) 191 + data[i++] = survey.time_rx; 192 192 else 193 193 data[i++] = -1LL; 194 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX) 195 - data[i++] = survey.channel_time_tx; 194 + if (survey.filled & SURVEY_INFO_TIME_TX) 195 + data[i++] = survey.time_tx; 196 196 else 197 197 data[i++] = -1LL; 198 198
+9 -2
net/mac80211/ibss.c
··· 1069 1069 } 1070 1070 1071 1071 if (sta && rates_updated) { 1072 - drv_sta_rc_update(local, sdata, &sta->sta, 1073 - IEEE80211_RC_SUPP_RATES_CHANGED); 1072 + u32 changed = IEEE80211_RC_SUPP_RATES_CHANGED; 1073 + u8 rx_nss = sta->sta.rx_nss; 1074 + 1075 + /* Force rx_nss recalculation */ 1076 + sta->sta.rx_nss = 0; 1074 1077 rate_control_rate_init(sta); 1078 + if (sta->sta.rx_nss != rx_nss) 1079 + changed |= IEEE80211_RC_NSS_CHANGED; 1080 + 1081 + drv_sta_rc_update(local, sdata, &sta->sta, changed); 1075 1082 } 1076 1083 1077 1084 rcu_read_unlock();
+4 -4
net/mac80211/ieee80211_i.h
··· 1168 1168 /* wowlan is enabled -- don't reconfig on resume */ 1169 1169 bool wowlan; 1170 1170 1171 - /* DFS/radar detection is enabled */ 1172 - bool radar_detect_enabled; 1173 1171 struct work_struct radar_detected_work; 1174 1172 1175 1173 /* number of RX chains the hardware has */ ··· 1702 1704 struct ieee80211_supported_band *sband, 1703 1705 const struct ieee80211_vht_cap *vht_cap_ie, 1704 1706 struct sta_info *sta); 1707 + enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta); 1705 1708 enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); 1706 1709 void ieee80211_sta_set_rx_nss(struct sta_info *sta); 1707 1710 u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, ··· 1880 1881 void ieee80211_add_pending_skbs(struct ieee80211_local *local, 1881 1882 struct sk_buff_head *skbs); 1882 1883 void ieee80211_flush_queues(struct ieee80211_local *local, 1883 - struct ieee80211_sub_if_data *sdata); 1884 + struct ieee80211_sub_if_data *sdata, bool drop); 1884 1885 void __ieee80211_flush_queues(struct ieee80211_local *local, 1885 1886 struct ieee80211_sub_if_data *sdata, 1886 - unsigned int queues); 1887 + unsigned int queues, bool drop); 1887 1888 1888 1889 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 1889 1890 u16 transaction, u16 auth_alg, u16 status, ··· 1980 1981 struct ieee80211_chanctx *chanctx); 1981 1982 void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 1982 1983 struct ieee80211_chanctx *ctx); 1984 + bool ieee80211_is_radar_required(struct ieee80211_local *local); 1983 1985 1984 1986 void ieee80211_dfs_cac_timer(unsigned long data); 1985 1987 void ieee80211_dfs_cac_timer_work(struct work_struct *work);
+1 -1
net/mac80211/iface.c
··· 93 93 if (local->hw.conf.flags & IEEE80211_CONF_IDLE) 94 94 return 0; 95 95 96 - ieee80211_flush_queues(local, NULL); 96 + ieee80211_flush_queues(local, NULL, false); 97 97 98 98 local->hw.conf.flags |= IEEE80211_CONF_IDLE; 99 99 return IEEE80211_CONF_CHANGE_IDLE;
+6 -3
net/mac80211/key.c
··· 140 140 if (!ret) { 141 141 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 142 142 143 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 143 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 144 + (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) 144 145 sdata->crypto_tx_tailroom_needed_cnt--; 145 146 146 147 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && ··· 189 188 sta = key->sta; 190 189 sdata = key->sdata; 191 190 192 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 191 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 192 + (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) 193 193 increment_tailroom_need_count(sdata); 194 194 195 195 ret = drv_set_key(key->local, DISABLE_KEY, sdata, ··· 886 884 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 887 885 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 888 886 889 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 887 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 888 + (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) 890 889 increment_tailroom_need_count(key->sdata); 891 890 } 892 891
-4
net/mac80211/main.c
··· 916 916 } 917 917 } 918 918 919 - WARN((local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) 920 - && (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK), 921 - "U-APSD not supported with HW_PS_NULLFUNC_STACK\n"); 922 - 923 919 /* 924 920 * Calculate scan IE length -- we need this to alloc 925 921 * memory and to subtract from the driver limit. It
+7
net/mac80211/mesh_plink.c
··· 523 523 sdata->u.mesh.mshcfg.auto_open_plinks && 524 524 rssi_threshold_check(sdata, sta)) 525 525 changed = mesh_plink_open(sta); 526 + else if (sta->plink_state == NL80211_PLINK_LISTEN && 527 + (sdata->u.mesh.user_mpm || 528 + sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED)) 529 + cfg80211_notify_new_peer_candidate(sdata->dev, hw_addr, 530 + elems->ie_start, 531 + elems->total_len, 532 + GFP_ATOMIC); 526 533 527 534 ieee80211_mps_frame_release(sta, elems); 528 535 out:
+67 -26
net/mac80211/mlme.c
··· 157 157 { 158 158 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 159 159 struct cfg80211_chan_def vht_chandef; 160 + struct ieee80211_sta_ht_cap sta_ht_cap; 160 161 u32 ht_cfreq, ret; 162 + 163 + memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); 164 + ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap); 161 165 162 166 chandef->chan = channel; 163 167 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 164 168 chandef->center_freq1 = channel->center_freq; 165 169 chandef->center_freq2 = 0; 166 170 167 - if (!ht_cap || !ht_oper || !sband->ht_cap.ht_supported) { 171 + if (!ht_cap || !ht_oper || !sta_ht_cap.ht_supported) { 168 172 ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 169 173 goto out; 170 174 } ··· 202 198 } 203 199 204 200 /* check 40 MHz support, if we have it */ 205 - if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { 201 + if (sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { 206 202 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { 207 203 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 208 204 chandef->width = NL80211_CHAN_WIDTH_40; ··· 1058 1054 sdata->csa_block_tx = false; 1059 1055 } 1060 1056 1061 - cfg80211_ch_switch_notify(sdata->dev, &sdata->reserved_chandef); 1062 - 1063 1057 sdata->vif.csa_active = false; 1064 1058 ifmgd->csa_waiting_bcn = false; 1065 1059 ··· 1069 1067 &ifmgd->csa_connection_drop_work); 1070 1068 return; 1071 1069 } 1070 + 1071 + cfg80211_ch_switch_notify(sdata->dev, &sdata->reserved_chandef); 1072 1072 } 1073 1073 1074 1074 void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) ··· 1288 1284 country_ie_len -= 3; 1289 1285 } 1290 1286 1291 - if (have_chan_pwr) 1287 + if (have_chan_pwr && pwr_constr_elem) 1292 1288 *pwr_reduction = *pwr_constr_elem; 1289 + else 1290 + *pwr_reduction = 0; 1291 + 1293 1292 return have_chan_pwr; 1294 1293 } 1295 1294 ··· 1321 1314 int chan_pwr = 0, pwr_reduction_80211h = 0; 1322 1315 int pwr_level_cisco, pwr_level_80211h; 1323 1316 int new_ap_level; 1317 + __le16 capab = mgmt->u.probe_resp.capab_info; 1324 1318 1325 - if (country_ie && pwr_constr_ie && 1326 - mgmt->u.probe_resp.capab_info & 1327 - cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT)) { 1319 + if (country_ie && 1320 + (capab & cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT) || 1321 + capab & cpu_to_le16(WLAN_CAPABILITY_RADIO_MEASURE))) { 1328 1322 has_80211h_pwr = ieee80211_find_80211h_pwr_constr( 1329 1323 sdata, channel, country_ie, country_ie_len, 1330 1324 pwr_constr_ie, &chan_pwr, &pwr_reduction_80211h); ··· 1604 1596 } else { 1605 1597 ieee80211_send_nullfunc(local, sdata, 1); 1606 1598 /* Flush to get the tx status of nullfunc frame */ 1607 - ieee80211_flush_queues(local, sdata); 1599 + ieee80211_flush_queues(local, sdata, false); 1608 1600 } 1609 1601 } 1610 1602 ··· 2011 2003 /* disable per-vif ps */ 2012 2004 ieee80211_recalc_ps_vif(sdata); 2013 2005 2014 - /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ 2006 + /* 2007 + * drop any frame before deauth/disassoc, this can be data or 2008 + * management frame. Since we are disconnecting, we should not 2009 + * insist sending these frames which can take time and delay 2010 + * the disconnection and possible the roaming. 2011 + */ 2015 2012 if (tx) 2016 - ieee80211_flush_queues(local, sdata); 2013 + ieee80211_flush_queues(local, sdata, true); 2017 2014 2018 2015 /* deauthenticate/disassociate now */ 2019 2016 if (tx || frame_buf) 2020 2017 ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype, 2021 2018 reason, tx, frame_buf); 2022 2019 2023 - /* flush out frame */ 2020 + /* flush out frame - make sure the deauth was actually sent */ 2024 2021 if (tx) 2025 - ieee80211_flush_queues(local, sdata); 2022 + ieee80211_flush_queues(local, sdata, false); 2026 2023 2027 2024 /* clear bssid only after building the needed mgmt frames */ 2028 2025 memset(ifmgd->bssid, 0, ETH_ALEN); ··· 2453 2440 sdata_assert_lock(sdata); 2454 2441 2455 2442 if (!assoc) { 2443 + /* 2444 + * we are not authenticated yet, the only timer that could be 2445 + * running is the timeout for the authentication response which 2446 + * which is not relevant anymore. 2447 + */ 2448 + del_timer_sync(&sdata->u.mgd.timer); 2456 2449 sta_info_destroy_addr(sdata, auth_data->bss->bssid); 2457 2450 2458 2451 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); ··· 2766 2747 sdata_assert_lock(sdata); 2767 2748 2768 2749 if (!assoc) { 2750 + /* 2751 + * we are not associated yet, the only timer that could be 2752 + * running is the timeout for the association response which 2753 + * which is not relevant anymore. 2754 + */ 2755 + del_timer_sync(&sdata->u.mgd.timer); 2769 2756 sta_info_destroy_addr(sdata, assoc_data->bss->bssid); 2770 2757 2771 2758 memset(sdata->u.mgd.bssid, 0, ETH_ALEN); ··· 4222 4197 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 4223 4198 struct ieee80211_bss *bss = (void *)cbss->priv; 4224 4199 struct sta_info *new_sta = NULL; 4225 - bool have_sta = false; 4200 + struct ieee80211_supported_band *sband; 4201 + struct ieee80211_sta_ht_cap sta_ht_cap; 4202 + bool have_sta = false, is_override = false; 4226 4203 int err; 4204 + 4205 + sband = local->hw.wiphy->bands[cbss->channel->band]; 4227 4206 4228 4207 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) 4229 4208 return -EINVAL; ··· 4243 4214 if (!new_sta) 4244 4215 return -ENOMEM; 4245 4216 } 4217 + 4218 + memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); 4219 + ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap); 4220 + 4221 + is_override = (sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 4222 + (sband->ht_cap.cap & 4223 + IEEE80211_HT_CAP_SUP_WIDTH_20_40); 4224 + 4225 + if (new_sta || is_override) { 4226 + err = ieee80211_prep_channel(sdata, cbss); 4227 + if (err) { 4228 + if (new_sta) 4229 + sta_info_free(local, new_sta); 4230 + return -EINVAL; 4231 + } 4232 + } 4233 + 4246 4234 if (new_sta) { 4247 4235 u32 rates = 0, basic_rates = 0; 4248 4236 bool have_higher_than_11mbit; 4249 4237 int min_rate = INT_MAX, min_rate_index = -1; 4250 4238 struct ieee80211_chanctx_conf *chanctx_conf; 4251 - struct ieee80211_supported_band *sband; 4252 4239 const struct cfg80211_bss_ies *ies; 4253 - int shift; 4240 + int shift = ieee80211_vif_get_shift(&sdata->vif); 4254 4241 u32 rate_flags; 4255 - 4256 - sband = local->hw.wiphy->bands[cbss->channel->band]; 4257 - 4258 - err = ieee80211_prep_channel(sdata, cbss); 4259 - if (err) { 4260 - sta_info_free(local, new_sta); 4261 - return -EINVAL; 4262 - } 4263 - shift = ieee80211_vif_get_shift(&sdata->vif); 4264 4242 4265 4243 rcu_read_lock(); 4266 4244 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); ··· 4704 4668 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; 4705 4669 rcu_read_unlock(); 4706 4670 4671 + if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && 4672 + (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK), 4673 + "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) 4674 + sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; 4675 + 4707 4676 if (bss->wmm_used && bss->uapsd_supported && 4708 - (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { 4677 + (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { 4709 4678 assoc_data->uapsd = true; 4710 4679 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; 4711 4680 } else {
+2 -2
net/mac80211/offchannel.c
··· 121 121 ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, 122 122 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 123 123 false); 124 - ieee80211_flush_queues(local, NULL); 124 + ieee80211_flush_queues(local, NULL, false); 125 125 126 126 mutex_lock(&local->iflist_mtx); 127 127 list_for_each_entry(sdata, &local->interfaces, list) { ··· 398 398 ieee80211_roc_notify_destroy(roc, !roc->abort); 399 399 400 400 if (started && !on_channel) { 401 - ieee80211_flush_queues(local, NULL); 401 + ieee80211_flush_queues(local, NULL, false); 402 402 403 403 local->tmp_channel = NULL; 404 404 ieee80211_hw_config(local, 0);
+1 -1
net/mac80211/pm.c
··· 41 41 /* flush out all packets */ 42 42 synchronize_net(); 43 43 44 - ieee80211_flush_queues(local, NULL); 44 + ieee80211_flush_queues(local, NULL, true); 45 45 46 46 local->quiescing = true; 47 47 /* make quiescing visible to timers everywhere */
+3 -3
net/mac80211/rc80211_minstrel.c
··· 263 263 minstrel_get_retry_count(struct minstrel_rate *mr, 264 264 struct ieee80211_tx_info *info) 265 265 { 266 - unsigned int retry = mr->adjusted_retry_count; 266 + u8 retry = mr->adjusted_retry_count; 267 267 268 268 if (info->control.use_rts) 269 - retry = max(2U, min(mr->stats.retry_count_rtscts, retry)); 269 + retry = max_t(u8, 2, min(mr->stats.retry_count_rtscts, retry)); 270 270 else if (info->control.use_cts_prot) 271 - retry = max(2U, min(mr->retry_count_cts, retry)); 271 + retry = max_t(u8, 2, min(mr->retry_count_cts, retry)); 272 272 return retry; 273 273 } 274 274
+8 -7
net/mac80211/rc80211_minstrel.h
··· 33 33 34 34 struct minstrel_rate_stats { 35 35 /* current / last sampling period attempts/success counters */ 36 - unsigned int attempts, last_attempts; 37 - unsigned int success, last_success; 36 + u16 attempts, last_attempts; 37 + u16 success, last_success; 38 38 39 39 /* total attempts/success counters */ 40 40 u64 att_hist, succ_hist; ··· 46 46 unsigned int cur_prob, probability; 47 47 48 48 /* maximum retry counts */ 49 - unsigned int retry_count; 50 - unsigned int retry_count_rtscts; 49 + u8 retry_count; 50 + u8 retry_count_rtscts; 51 51 52 52 u8 sample_skipped; 53 53 bool retry_updated; ··· 55 55 56 56 struct minstrel_rate { 57 57 int bitrate; 58 - int rix; 58 + 59 + s8 rix; 60 + u8 retry_count_cts; 61 + u8 adjusted_retry_count; 59 62 60 63 unsigned int perfect_tx_time; 61 64 unsigned int ack_time; 62 65 63 66 int sample_limit; 64 - unsigned int retry_count_cts; 65 - unsigned int adjusted_retry_count; 66 67 67 68 struct minstrel_rate_stats stats; 68 69 };
+17 -8
net/mac80211/rx.c
··· 361 361 u16 known = local->hw.radiotap_vht_details; 362 362 363 363 rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT); 364 - /* known field - how to handle 80+80? */ 365 - if (status->vht_flag & RX_VHT_FLAG_80P80MHZ) 366 - known &= ~IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; 367 364 put_unaligned_le16(known, pos); 368 365 pos += 2; 369 366 /* flags */ ··· 375 378 /* bandwidth */ 376 379 if (status->vht_flag & RX_VHT_FLAG_80MHZ) 377 380 *pos++ = 4; 378 - else if (status->vht_flag & RX_VHT_FLAG_80P80MHZ) 379 - *pos++ = 0; /* marked not known above */ 380 381 else if (status->vht_flag & RX_VHT_FLAG_160MHZ) 381 382 *pos++ = 11; 382 383 else if (status->flag & RX_FLAG_40MHZ) ··· 2309 2314 if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) 2310 2315 return RX_DROP_MONITOR; 2311 2316 2317 + if (rx->sta) { 2318 + /* The security index has the same property as needed 2319 + * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS 2320 + * for non-QoS-data frames. Here we know it's a data 2321 + * frame, so count MSDUs. 2322 + */ 2323 + rx->sta->rx_msdu[rx->security_idx]++; 2324 + } 2325 + 2312 2326 /* 2313 2327 * Send unexpected-4addr-frame event to hostapd. For older versions, 2314 2328 * also drop the frame to cooked monitor interfaces. ··· 2602 2598 case WLAN_HT_ACTION_NOTIFY_CHANWIDTH: { 2603 2599 struct ieee80211_supported_band *sband; 2604 2600 u8 chanwidth = mgmt->u.action.u.ht_notify_cw.chanwidth; 2605 - enum ieee80211_sta_rx_bandwidth new_bw; 2601 + enum ieee80211_sta_rx_bandwidth max_bw, new_bw; 2606 2602 2607 2603 /* If it doesn't support 40 MHz it can't change ... */ 2608 2604 if (!(rx->sta->sta.ht_cap.cap & ··· 2610 2606 goto handled; 2611 2607 2612 2608 if (chanwidth == IEEE80211_HT_CHANWIDTH_20MHZ) 2613 - new_bw = IEEE80211_STA_RX_BW_20; 2609 + max_bw = IEEE80211_STA_RX_BW_20; 2614 2610 else 2615 - new_bw = ieee80211_sta_cur_vht_bw(rx->sta); 2611 + max_bw = ieee80211_sta_cap_rx_bw(rx->sta); 2612 + 2613 + /* set cur_max_bandwidth and recalc sta bw */ 2614 + rx->sta->cur_max_bandwidth = max_bw; 2615 + new_bw = ieee80211_sta_cur_vht_bw(rx->sta); 2616 2616 2617 2617 if (rx->sta->sta.bandwidth == new_bw) 2618 2618 goto handled; 2619 2619 2620 + rx->sta->sta.bandwidth = new_bw; 2620 2621 sband = rx->local->hw.wiphy->bands[status->band]; 2621 2622 2622 2623 rate_control_rate_update(local, sband, rx->sta,
+4 -4
net/mac80211/scan.c
··· 416 416 ieee80211_offchannel_stop_vifs(local); 417 417 418 418 /* ensure nullfunc is transmitted before leaving operating channel */ 419 - ieee80211_flush_queues(local, NULL); 419 + ieee80211_flush_queues(local, NULL, false); 420 420 421 421 ieee80211_configure_filter(local); 422 422 ··· 432 432 static bool ieee80211_can_scan(struct ieee80211_local *local, 433 433 struct ieee80211_sub_if_data *sdata) 434 434 { 435 - if (local->radar_detect_enabled) 435 + if (ieee80211_is_radar_required(local)) 436 436 return false; 437 437 438 438 if (!list_empty(&local->roc_list)) ··· 505 505 506 506 lockdep_assert_held(&local->mtx); 507 507 508 - if (local->scan_req) 508 + if (local->scan_req || ieee80211_is_radar_required(local)) 509 509 return -EBUSY; 510 510 511 511 if (!ieee80211_can_scan(local, sdata)) { ··· 805 805 ieee80211_offchannel_stop_vifs(local); 806 806 807 807 if (local->ops->flush) { 808 - ieee80211_flush_queues(local, NULL); 808 + ieee80211_flush_queues(local, NULL, false); 809 809 *next_delay = 0; 810 810 } else 811 811 *next_delay = HZ / 10;
-4
net/mac80211/spectmgmt.c
··· 34 34 struct cfg80211_chan_def new_vht_chandef = {}; 35 35 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 36 36 const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 37 - const struct ieee80211_ht_operation *ht_oper; 38 37 int secondary_channel_offset = -1; 39 38 40 39 sec_chan_offs = elems->sec_chan_offs; 41 40 wide_bw_chansw_ie = elems->wide_bw_chansw_ie; 42 - ht_oper = elems->ht_operation; 43 41 44 42 if (sta_flags & (IEEE80211_STA_DISABLE_HT | 45 43 IEEE80211_STA_DISABLE_40MHZ)) { 46 44 sec_chan_offs = NULL; 47 45 wide_bw_chansw_ie = NULL; 48 - /* only used for bandwidth here */ 49 - ht_oper = NULL; 50 46 } 51 47 52 48 if (sta_flags & IEEE80211_STA_DISABLE_VHT)
+126 -49
net/mac80211/sta_info.c
··· 116 116 clear_sta_flag(sta, WLAN_STA_PS_DELIVER); 117 117 118 118 atomic_dec(&ps->num_sta_ps); 119 - sta_info_recalc_tim(sta); 120 119 } 121 120 122 121 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { ··· 624 625 } 625 626 } 626 627 627 - void sta_info_recalc_tim(struct sta_info *sta) 628 + static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending) 628 629 { 629 630 struct ieee80211_local *local = sta->local; 630 631 struct ps_data *ps; ··· 666 667 if (ignore_for_tim == BIT(IEEE80211_NUM_ACS) - 1) 667 668 ignore_for_tim = 0; 668 669 670 + if (ignore_pending) 671 + ignore_for_tim = BIT(IEEE80211_NUM_ACS) - 1; 672 + 669 673 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 670 674 unsigned long tids; 671 675 ··· 697 695 else 698 696 __bss_tim_clear(ps->tim, id); 699 697 700 - if (local->ops->set_tim) { 698 + if (local->ops->set_tim && !WARN_ON(sta->dead)) { 701 699 local->tim_in_locked_section = true; 702 700 drv_set_tim(local, &sta->sta, indicate_tim); 703 701 local->tim_in_locked_section = false; ··· 705 703 706 704 out_unlock: 707 705 spin_unlock_bh(&local->tim_lock); 706 + } 707 + 708 + void sta_info_recalc_tim(struct sta_info *sta) 709 + { 710 + __sta_info_recalc_tim(sta, false); 708 711 } 709 712 710 713 static bool sta_info_buffer_expired(struct sta_info *sta, struct sk_buff *skb) ··· 881 874 { 882 875 struct ieee80211_local *local = sta->local; 883 876 struct ieee80211_sub_if_data *sdata = sta->sdata; 877 + struct station_info sinfo = {}; 884 878 int ret; 885 879 886 880 /* ··· 894 886 895 887 /* now keys can no longer be reached */ 896 888 ieee80211_free_sta_keys(local, sta); 889 + 890 + /* disable TIM bit - last chance to tell driver */ 891 + __sta_info_recalc_tim(sta, true); 897 892 898 893 sta->dead = true; 899 894 ··· 919 908 920 909 sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr); 921 910 922 - cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); 911 + sta_set_sinfo(sta, &sinfo); 912 + cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); 923 913 924 914 rate_control_remove_sta_debugfs(sta); 925 915 ieee80211_sta_debugfs_remove(sta); ··· 1255 1243 * ends the poll/service period. 1256 1244 */ 1257 1245 info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER | 1258 - IEEE80211_TX_CTL_PS_RESPONSE | 1259 1246 IEEE80211_TX_STATUS_EOSP | 1260 1247 IEEE80211_TX_CTL_REQ_TX_STATUS; 1248 + 1249 + info->control.flags |= IEEE80211_TX_CTRL_PS_RESPONSE; 1261 1250 1262 1251 if (call_driver) 1263 1252 drv_allow_buffered_frames(local, sta, BIT(tid), 1, ··· 1408 1395 * STA may still remain is PS mode after this frame 1409 1396 * exchange. 1410 1397 */ 1411 - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER | 1412 - IEEE80211_TX_CTL_PS_RESPONSE; 1398 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; 1399 + info->control.flags |= IEEE80211_TX_CTRL_PS_RESPONSE; 1413 1400 1414 1401 /* 1415 1402 * Use MoreData flag to indicate whether there are ··· 1756 1743 struct ieee80211_local *local = sdata->local; 1757 1744 struct rate_control_ref *ref = NULL; 1758 1745 struct timespec uptime; 1759 - u64 packets = 0; 1760 1746 u32 thr = 0; 1761 1747 int i, ac; 1762 1748 ··· 1764 1752 1765 1753 sinfo->generation = sdata->local->sta_generation; 1766 1754 1767 - sinfo->filled = STATION_INFO_INACTIVE_TIME | 1768 - STATION_INFO_RX_BYTES64 | 1769 - STATION_INFO_TX_BYTES64 | 1770 - STATION_INFO_RX_PACKETS | 1771 - STATION_INFO_TX_PACKETS | 1772 - STATION_INFO_TX_RETRIES | 1773 - STATION_INFO_TX_FAILED | 1774 - STATION_INFO_TX_BITRATE | 1775 - STATION_INFO_RX_BITRATE | 1776 - STATION_INFO_RX_DROP_MISC | 1777 - STATION_INFO_BSS_PARAM | 1778 - STATION_INFO_CONNECTED_TIME | 1779 - STATION_INFO_STA_FLAGS | 1780 - STATION_INFO_BEACON_LOSS_COUNT; 1755 + drv_sta_statistics(local, sdata, &sta->sta, sinfo); 1756 + 1757 + sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME) | 1758 + BIT(NL80211_STA_INFO_STA_FLAGS) | 1759 + BIT(NL80211_STA_INFO_BSS_PARAM) | 1760 + BIT(NL80211_STA_INFO_CONNECTED_TIME) | 1761 + BIT(NL80211_STA_INFO_RX_DROP_MISC) | 1762 + BIT(NL80211_STA_INFO_BEACON_LOSS); 1781 1763 1782 1764 ktime_get_ts(&uptime); 1783 1765 sinfo->connected_time = uptime.tv_sec - sta->last_connected; 1784 - 1785 1766 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); 1786 - sinfo->tx_bytes = 0; 1787 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 1788 - sinfo->tx_bytes += sta->tx_bytes[ac]; 1789 - packets += sta->tx_packets[ac]; 1767 + 1768 + if (!(sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES64) | 1769 + BIT(NL80211_STA_INFO_TX_BYTES)))) { 1770 + sinfo->tx_bytes = 0; 1771 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1772 + sinfo->tx_bytes += sta->tx_bytes[ac]; 1773 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64); 1790 1774 } 1791 - sinfo->tx_packets = packets; 1792 - sinfo->rx_bytes = sta->rx_bytes; 1793 - sinfo->rx_packets = sta->rx_packets; 1794 - sinfo->tx_retries = sta->tx_retry_count; 1795 - sinfo->tx_failed = sta->tx_retry_failed; 1775 + 1776 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_PACKETS))) { 1777 + sinfo->tx_packets = 0; 1778 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1779 + sinfo->tx_packets += sta->tx_packets[ac]; 1780 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS); 1781 + } 1782 + 1783 + if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) | 1784 + BIT(NL80211_STA_INFO_RX_BYTES)))) { 1785 + sinfo->rx_bytes = sta->rx_bytes; 1786 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64); 1787 + } 1788 + 1789 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_PACKETS))) { 1790 + sinfo->rx_packets = sta->rx_packets; 1791 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS); 1792 + } 1793 + 1794 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_RETRIES))) { 1795 + sinfo->tx_retries = sta->tx_retry_count; 1796 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_RETRIES); 1797 + } 1798 + 1799 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_FAILED))) { 1800 + sinfo->tx_failed = sta->tx_retry_failed; 1801 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED); 1802 + } 1803 + 1796 1804 sinfo->rx_dropped_misc = sta->rx_dropped; 1797 1805 sinfo->beacon_loss_count = sta->beacon_loss_count; 1798 1806 1799 1807 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 1800 1808 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 1801 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 1802 - if (!local->ops->get_rssi || 1803 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal)) 1809 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL))) { 1804 1810 sinfo->signal = (s8)sta->last_signal; 1805 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 1811 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1812 + } 1813 + 1814 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) { 1815 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 1816 + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG); 1817 + } 1806 1818 } 1807 - if (sta->chains) { 1808 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL | 1809 - STATION_INFO_CHAIN_SIGNAL_AVG; 1819 + 1820 + if (sta->chains && 1821 + !(sinfo->filled & (BIT(NL80211_STA_INFO_CHAIN_SIGNAL) | 1822 + BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) { 1823 + sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL) | 1824 + BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); 1810 1825 1811 1826 sinfo->chains = sta->chains; 1812 1827 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { ··· 1843 1804 } 1844 1805 } 1845 1806 1846 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); 1847 - sta_set_rate_info_rx(sta, &sinfo->rxrate); 1807 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) { 1808 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); 1809 + sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 1810 + } 1811 + 1812 + if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) { 1813 + sta_set_rate_info_rx(sta, &sinfo->rxrate); 1814 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); 1815 + } 1816 + 1817 + sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS); 1818 + for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) { 1819 + struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i]; 1820 + 1821 + if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { 1822 + tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU); 1823 + tidstats->rx_msdu = sta->rx_msdu[i]; 1824 + } 1825 + 1826 + if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU))) { 1827 + tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU); 1828 + tidstats->tx_msdu = sta->tx_msdu[i]; 1829 + } 1830 + 1831 + if (!(tidstats->filled & 1832 + BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) && 1833 + local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1834 + tidstats->filled |= 1835 + BIT(NL80211_TID_STATS_TX_MSDU_RETRIES); 1836 + tidstats->tx_msdu_retries = sta->tx_msdu_retries[i]; 1837 + } 1838 + 1839 + if (!(tidstats->filled & 1840 + BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) && 1841 + local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1842 + tidstats->filled |= 1843 + BIT(NL80211_TID_STATS_TX_MSDU_FAILED); 1844 + tidstats->tx_msdu_failed = sta->tx_msdu_failed[i]; 1845 + } 1846 + } 1848 1847 1849 1848 if (ieee80211_vif_is_mesh(&sdata->vif)) { 1850 1849 #ifdef CONFIG_MAC80211_MESH 1851 - sinfo->filled |= STATION_INFO_LLID | 1852 - STATION_INFO_PLID | 1853 - STATION_INFO_PLINK_STATE | 1854 - STATION_INFO_LOCAL_PM | 1855 - STATION_INFO_PEER_PM | 1856 - STATION_INFO_NONPEER_PM; 1850 + sinfo->filled |= BIT(NL80211_STA_INFO_LLID) | 1851 + BIT(NL80211_STA_INFO_PLID) | 1852 + BIT(NL80211_STA_INFO_PLINK_STATE) | 1853 + BIT(NL80211_STA_INFO_LOCAL_PM) | 1854 + BIT(NL80211_STA_INFO_PEER_PM) | 1855 + BIT(NL80211_STA_INFO_NONPEER_PM); 1857 1856 1858 1857 sinfo->llid = sta->llid; 1859 1858 sinfo->plid = sta->plid; 1860 1859 sinfo->plink_state = sta->plink_state; 1861 1860 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { 1862 - sinfo->filled |= STATION_INFO_T_OFFSET; 1861 + sinfo->filled |= BIT(NL80211_STA_INFO_T_OFFSET); 1863 1862 sinfo->t_offset = sta->t_offset; 1864 1863 } 1865 1864 sinfo->local_pm = sta->local_pm; ··· 1946 1869 thr = drv_get_expected_throughput(local, &sta->sta); 1947 1870 1948 1871 if (thr != 0) { 1949 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT; 1872 + sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT); 1950 1873 sinfo->expected_throughput = thr; 1951 1874 } 1952 1875 }
+12
net/mac80211/sta_info.h
··· 346 346 * @cipher_scheme: optional cipher scheme for this station 347 347 * @last_tdls_pkt_time: holds the time in jiffies of last TDLS pkt ACKed 348 348 * @reserved_tid: reserved TID (if any, otherwise IEEE80211_TID_UNRESERVED) 349 + * @tx_msdu: MSDUs transmitted to this station, using IEEE80211_NUM_TID 350 + * entry for non-QoS frames 351 + * @tx_msdu_retries: MSDU retries for transmissions to to this station, 352 + * using IEEE80211_NUM_TID entry for non-QoS frames 353 + * @tx_msdu_failed: MSDU failures for transmissions to to this station, 354 + * using IEEE80211_NUM_TID entry for non-QoS frames 355 + * @rx_msdu: MSDUs received from this station, using IEEE80211_NUM_TID 356 + * entry for non-QoS frames 349 357 */ 350 358 struct sta_info { 351 359 /* General information, mostly static */ ··· 424 416 u32 last_rx_rate_vht_flag; 425 417 u8 last_rx_rate_vht_nss; 426 418 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; 419 + u64 tx_msdu[IEEE80211_NUM_TIDS + 1]; 420 + u64 tx_msdu_retries[IEEE80211_NUM_TIDS + 1]; 421 + u64 tx_msdu_failed[IEEE80211_NUM_TIDS + 1]; 422 + u64 rx_msdu[IEEE80211_NUM_TIDS + 1]; 427 423 428 424 /* 429 425 * Aggregation information, locked with lock.
+20 -6
net/mac80211/status.c
··· 664 664 struct ieee80211_supported_band *sband; 665 665 int retry_count; 666 666 int rates_idx; 667 - bool acked; 667 + bool acked, noack_success; 668 668 669 669 rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); 670 670 671 671 sband = hw->wiphy->bands[info->band]; 672 672 673 673 acked = !!(info->flags & IEEE80211_TX_STAT_ACK); 674 + noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED); 675 + 674 676 if (pubsta) { 675 677 struct sta_info *sta; 676 678 ··· 698 696 rate_control_tx_status_noskb(local, sband, sta, info); 699 697 } 700 698 701 - if (acked) { 699 + if (acked || noack_success) { 702 700 local->dot11TransmittedFrameCount++; 703 701 if (!pubsta) 704 702 local->dot11MulticastTransmittedFrameCount++; ··· 730 728 struct ieee80211_bar *bar; 731 729 int rtap_len; 732 730 int shift = 0; 731 + int tid = IEEE80211_NUM_TIDS; 733 732 734 733 rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); 735 734 ··· 774 771 775 772 if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && 776 773 (ieee80211_is_data_qos(fc))) { 777 - u16 tid, ssn; 774 + u16 ssn; 778 775 u8 *qc; 779 776 780 777 qc = ieee80211_get_qos_ctl(hdr); ··· 783 780 & IEEE80211_SCTL_SEQ); 784 781 ieee80211_send_bar(&sta->sdata->vif, hdr->addr1, 785 782 tid, ssn); 783 + } else if (ieee80211_is_data_qos(fc)) { 784 + u8 *qc = ieee80211_get_qos_ctl(hdr); 785 + 786 + tid = qc[0] & 0xf; 786 787 } 787 788 788 789 if (!acked && ieee80211_is_back_req(fc)) { 789 - u16 tid, control; 790 + u16 control; 790 791 791 792 /* 792 793 * BAR failed, store the last SSN and retry sending ··· 818 811 if (!acked) 819 812 sta->tx_retry_failed++; 820 813 sta->tx_retry_count += retry_count; 814 + 815 + if (ieee80211_is_data_present(fc)) { 816 + if (!acked) 817 + sta->tx_msdu_failed[tid]++; 818 + sta->tx_msdu_retries[tid] += retry_count; 819 + } 821 820 } 822 821 823 822 rate_control_tx_status(local, sband, sta, skb); ··· 869 856 * Fragments are passed to low-level drivers as separate skbs, so these 870 857 * are actually fragments, not frames. Update frame counters only for 871 858 * the first fragment of the frame. */ 872 - if (info->flags & IEEE80211_TX_STAT_ACK) { 859 + if ((info->flags & IEEE80211_TX_STAT_ACK) || 860 + (info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED)) { 873 861 if (ieee80211_is_first_frag(hdr->seq_ctrl)) { 874 862 local->dot11TransmittedFrameCount++; 875 - if (is_multicast_ether_addr(hdr->addr1)) 863 + if (is_multicast_ether_addr(ieee80211_get_DA(hdr))) 876 864 local->dot11MulticastTransmittedFrameCount++; 877 865 if (retry_count > 0) 878 866 local->dot11RetryCount++;
+24 -8
net/mac80211/tdls.c
··· 68 68 ch = ieee80211_get_channel(sdata->local->hw.wiphy, i); 69 69 if (ch) { 70 70 /* we will be active on the channel */ 71 - u32 flags = IEEE80211_CHAN_DISABLED | 72 - IEEE80211_CHAN_NO_IR; 73 71 cfg80211_chandef_create(&chandef, ch, 74 - NL80211_CHAN_HT20); 75 - if (cfg80211_chandef_usable(sdata->local->hw.wiphy, 76 - &chandef, flags)) { 72 + NL80211_CHAN_NO_HT); 73 + if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy, 74 + &chandef, 75 + sdata->wdev.iftype)) { 77 76 ch_cnt++; 77 + /* 78 + * check if the next channel is also part of 79 + * this allowed range 80 + */ 78 81 continue; 79 82 } 80 83 } 81 84 85 + /* 86 + * we've reached the end of a range, with allowed channels 87 + * found 88 + */ 82 89 if (ch_cnt) { 83 90 u8 *pos = skb_put(skb, 2); 84 91 *pos++ = ieee80211_frequency_to_channel(subband_start); ··· 94 87 subband_cnt++; 95 88 ch_cnt = 0; 96 89 } 90 + } 91 + 92 + /* all channels in the requested range are allowed - add them here */ 93 + if (ch_cnt) { 94 + u8 *pos = skb_put(skb, 2); 95 + *pos++ = ieee80211_frequency_to_channel(subband_start); 96 + *pos++ = ch_cnt; 97 + 98 + subband_cnt++; 97 99 } 98 100 99 101 return subband_cnt; ··· 928 912 rcu_read_unlock(); 929 913 } 930 914 931 - ieee80211_flush_queues(local, sdata); 915 + ieee80211_flush_queues(local, sdata, false); 932 916 933 917 ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer, action_code, 934 918 dialog_token, status_code, ··· 968 952 */ 969 953 ieee80211_stop_vif_queues(local, sdata, 970 954 IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN); 971 - ieee80211_flush_queues(local, sdata); 955 + ieee80211_flush_queues(local, sdata, false); 972 956 973 957 ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer, action_code, 974 958 dialog_token, status_code, ··· 1114 1098 */ 1115 1099 tasklet_kill(&local->tx_pending_tasklet); 1116 1100 /* flush a potentially queued teardown packet */ 1117 - ieee80211_flush_queues(local, sdata); 1101 + ieee80211_flush_queues(local, sdata, false); 1118 1102 1119 1103 ret = sta_info_destroy_addr(sdata, peer); 1120 1104 break;
+7 -26
net/mac80211/trace.h
··· 825 825 ) 826 826 ); 827 827 828 + DEFINE_EVENT(sta_event, drv_sta_statistics, 829 + TP_PROTO(struct ieee80211_local *local, 830 + struct ieee80211_sub_if_data *sdata, 831 + struct ieee80211_sta *sta), 832 + TP_ARGS(local, sdata, sta) 833 + ); 834 + 828 835 DEFINE_EVENT(sta_event, drv_sta_add, 829 836 TP_PROTO(struct ieee80211_local *local, 830 837 struct ieee80211_sub_if_data *sdata, ··· 1334 1327 bool more_data), 1335 1328 1336 1329 TP_ARGS(local, sta, tids, num_frames, reason, more_data) 1337 - ); 1338 - 1339 - TRACE_EVENT(drv_get_rssi, 1340 - TP_PROTO(struct ieee80211_local *local, struct ieee80211_sta *sta, 1341 - s8 rssi, int ret), 1342 - 1343 - TP_ARGS(local, sta, rssi, ret), 1344 - 1345 - TP_STRUCT__entry( 1346 - LOCAL_ENTRY 1347 - STA_ENTRY 1348 - __field(s8, rssi) 1349 - __field(int, ret) 1350 - ), 1351 - 1352 - TP_fast_assign( 1353 - LOCAL_ASSIGN; 1354 - STA_ASSIGN; 1355 - __entry->rssi = rssi; 1356 - __entry->ret = ret; 1357 - ), 1358 - 1359 - TP_printk( 1360 - LOCAL_PR_FMT STA_PR_FMT " rssi:%d ret:%d", 1361 - LOCAL_PR_ARG, STA_PR_ARG, __entry->rssi, __entry->ret 1362 - ) 1363 1330 ); 1364 1331 1365 1332 DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
+4 -1
net/mac80211/tx.c
··· 815 815 /* for pure STA mode without beacons, we can do it */ 816 816 hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number); 817 817 tx->sdata->sequence_number += 0x10; 818 + if (tx->sta) 819 + tx->sta->tx_msdu[IEEE80211_NUM_TIDS]++; 818 820 return TX_CONTINUE; 819 821 } 820 822 ··· 833 831 qc = ieee80211_get_qos_ctl(hdr); 834 832 tid = *qc & IEEE80211_QOS_CTL_TID_MASK; 835 833 seq = &tx->sta->tid_seq[tid]; 834 + tx->sta->tx_msdu[tid]++; 836 835 837 836 hdr->seq_ctrl = cpu_to_le16(*seq); 838 837 ··· 3155 3152 } 3156 3153 3157 3154 queues = BIT(sdata->vif.hw_queue[ieee802_1d_to_ac[tid]]); 3158 - __ieee80211_flush_queues(local, sdata, queues); 3155 + __ieee80211_flush_queues(local, sdata, queues, false); 3159 3156 3160 3157 sta->reserved_tid = tid; 3161 3158
+33 -23
net/mac80211/util.c
··· 578 578 579 579 void __ieee80211_flush_queues(struct ieee80211_local *local, 580 580 struct ieee80211_sub_if_data *sdata, 581 - unsigned int queues) 581 + unsigned int queues, bool drop) 582 582 { 583 583 if (!local->ops->flush) 584 584 return; ··· 594 594 IEEE80211_QUEUE_STOP_REASON_FLUSH, 595 595 false); 596 596 597 - drv_flush(local, sdata, queues, false); 597 + drv_flush(local, sdata, queues, drop); 598 598 599 599 ieee80211_wake_queues_by_reason(&local->hw, queues, 600 600 IEEE80211_QUEUE_STOP_REASON_FLUSH, ··· 602 602 } 603 603 604 604 void ieee80211_flush_queues(struct ieee80211_local *local, 605 - struct ieee80211_sub_if_data *sdata) 605 + struct ieee80211_sub_if_data *sdata, bool drop) 606 606 { 607 - __ieee80211_flush_queues(local, sdata, 0); 607 + __ieee80211_flush_queues(local, sdata, 0, drop); 608 608 } 609 609 610 610 void ieee80211_stop_vif_queues(struct ieee80211_local *local, ··· 1470 1470 1471 1471 /* Check if any channel in this sband supports at least 80 MHz */ 1472 1472 for (i = 0; i < sband->n_channels; i++) { 1473 - if (!(sband->channels[i].flags & IEEE80211_CHAN_NO_80MHZ)) { 1474 - have_80mhz = true; 1475 - break; 1476 - } 1473 + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | 1474 + IEEE80211_CHAN_NO_80MHZ)) 1475 + continue; 1476 + 1477 + have_80mhz = true; 1478 + break; 1477 1479 } 1478 1480 1479 1481 if (sband->vht_cap.vht_supported && have_80mhz) { ··· 1737 1735 struct cfg80211_sched_scan_request *sched_scan_req; 1738 1736 bool sched_scan_stopped = false; 1739 1737 1738 + /* nothing to do if HW shouldn't run */ 1739 + if (!local->open_count) 1740 + goto wake_up; 1741 + 1740 1742 #ifdef CONFIG_PM 1741 1743 if (local->suspended) 1742 1744 local->resuming = true; ··· 1762 1756 reconfig_due_to_wowlan = true; 1763 1757 } 1764 1758 #endif 1765 - /* everything else happens only if HW was up & running */ 1766 - if (!local->open_count) 1767 - goto wake_up; 1768 1759 1769 1760 /* 1770 1761 * Upon resume hardware can sometimes be goofy due to ··· 2045 2042 * If this is for hw restart things are still running. 2046 2043 * We may want to change that later, however. 2047 2044 */ 2048 - if (!local->suspended || reconfig_due_to_wowlan) 2045 + if (local->open_count && (!local->suspended || reconfig_due_to_wowlan)) 2049 2046 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART); 2050 2047 2051 2048 if (!local->suspended) ··· 2057 2054 mb(); 2058 2055 local->resuming = false; 2059 2056 2060 - if (!reconfig_due_to_wowlan) 2057 + if (local->open_count && !reconfig_due_to_wowlan) 2061 2058 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); 2062 2059 2063 2060 list_for_each_entry(sdata, &local->interfaces, list) { ··· 2541 2538 ri.mcs = status->rate_idx; 2542 2539 ri.flags |= RATE_INFO_FLAGS_MCS; 2543 2540 if (status->flag & RX_FLAG_40MHZ) 2544 - ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 2541 + ri.bw = RATE_INFO_BW_40; 2542 + else 2543 + ri.bw = RATE_INFO_BW_20; 2545 2544 if (status->flag & RX_FLAG_SHORT_GI) 2546 2545 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; 2547 2546 } else if (status->flag & RX_FLAG_VHT) { ··· 2551 2546 ri.mcs = status->rate_idx; 2552 2547 ri.nss = status->vht_nss; 2553 2548 if (status->flag & RX_FLAG_40MHZ) 2554 - ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 2555 - if (status->vht_flag & RX_VHT_FLAG_80MHZ) 2556 - ri.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 2557 - if (status->vht_flag & RX_VHT_FLAG_80P80MHZ) 2558 - ri.flags |= RATE_INFO_FLAGS_80P80_MHZ_WIDTH; 2559 - if (status->vht_flag & RX_VHT_FLAG_160MHZ) 2560 - ri.flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 2549 + ri.bw = RATE_INFO_BW_40; 2550 + else if (status->vht_flag & RX_VHT_FLAG_80MHZ) 2551 + ri.bw = RATE_INFO_BW_80; 2552 + else if (status->vht_flag & RX_VHT_FLAG_160MHZ) 2553 + ri.bw = RATE_INFO_BW_160; 2554 + else 2555 + ri.bw = RATE_INFO_BW_20; 2561 2556 if (status->flag & RX_FLAG_SHORT_GI) 2562 2557 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; 2563 2558 } else { ··· 2565 2560 int shift = 0; 2566 2561 int bitrate; 2567 2562 2568 - if (status->flag & RX_FLAG_10MHZ) 2563 + if (status->flag & RX_FLAG_10MHZ) { 2569 2564 shift = 1; 2570 - if (status->flag & RX_FLAG_5MHZ) 2565 + ri.bw = RATE_INFO_BW_10; 2566 + } else if (status->flag & RX_FLAG_5MHZ) { 2571 2567 shift = 2; 2568 + ri.bw = RATE_INFO_BW_5; 2569 + } else { 2570 + ri.bw = RATE_INFO_BW_20; 2571 + } 2572 2572 2573 2573 sband = local->hw.wiphy->bands[status->band]; 2574 2574 bitrate = sband->bitrates[status->rate_idx].bitrate;
+42 -39
net/mac80211/vht.c
··· 269 269 sta->sta.bandwidth = ieee80211_sta_cur_vht_bw(sta); 270 270 } 271 271 272 + enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta) 273 + { 274 + struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap; 275 + u32 cap_width; 276 + 277 + if (!vht_cap->vht_supported) 278 + return sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? 279 + IEEE80211_STA_RX_BW_40 : 280 + IEEE80211_STA_RX_BW_20; 281 + 282 + cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; 283 + 284 + if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ || 285 + cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) 286 + return IEEE80211_STA_RX_BW_160; 287 + 288 + return IEEE80211_STA_RX_BW_80; 289 + } 290 + 291 + static enum ieee80211_sta_rx_bandwidth 292 + ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width) 293 + { 294 + switch (width) { 295 + case NL80211_CHAN_WIDTH_20_NOHT: 296 + case NL80211_CHAN_WIDTH_20: 297 + return IEEE80211_STA_RX_BW_20; 298 + case NL80211_CHAN_WIDTH_40: 299 + return IEEE80211_STA_RX_BW_40; 300 + case NL80211_CHAN_WIDTH_80: 301 + return IEEE80211_STA_RX_BW_80; 302 + case NL80211_CHAN_WIDTH_160: 303 + case NL80211_CHAN_WIDTH_80P80: 304 + return IEEE80211_STA_RX_BW_160; 305 + default: 306 + WARN_ON_ONCE(1); 307 + return IEEE80211_STA_RX_BW_20; 308 + } 309 + } 310 + 272 311 enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta) 273 312 { 274 313 struct ieee80211_sub_if_data *sdata = sta->sdata; 275 - u32 cap = sta->sta.vht_cap.cap; 276 314 enum ieee80211_sta_rx_bandwidth bw; 277 315 278 - if (!sta->sta.vht_cap.vht_supported) { 279 - bw = sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? 280 - IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20; 281 - goto check_max; 282 - } 316 + bw = ieee80211_chan_width_to_rx_bw(sdata->vif.bss_conf.chandef.width); 317 + bw = min(bw, ieee80211_sta_cap_rx_bw(sta)); 318 + bw = min(bw, sta->cur_max_bandwidth); 283 319 284 - switch (sdata->vif.bss_conf.chandef.width) { 285 - default: 286 - WARN_ON_ONCE(1); 287 - /* fall through */ 288 - case NL80211_CHAN_WIDTH_20_NOHT: 289 - case NL80211_CHAN_WIDTH_20: 290 - bw = IEEE80211_STA_RX_BW_20; 291 - break; 292 - case NL80211_CHAN_WIDTH_40: 293 - bw = sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? 294 - IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20; 295 - break; 296 - case NL80211_CHAN_WIDTH_160: 297 - if ((cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) == 298 - IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ) { 299 - bw = IEEE80211_STA_RX_BW_160; 300 - break; 301 - } 302 - /* fall through */ 303 - case NL80211_CHAN_WIDTH_80P80: 304 - if ((cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) == 305 - IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) { 306 - bw = IEEE80211_STA_RX_BW_160; 307 - break; 308 - } 309 - /* fall through */ 310 - case NL80211_CHAN_WIDTH_80: 311 - bw = IEEE80211_STA_RX_BW_80; 312 - } 313 - 314 - check_max: 315 - if (bw > sta->cur_max_bandwidth) 316 - bw = sta->cur_max_bandwidth; 317 320 return bw; 318 321 } 319 322
+31 -3
net/wireless/core.c
··· 320 320 rtnl_unlock(); 321 321 } 322 322 323 + static void cfg80211_sched_scan_stop_wk(struct work_struct *work) 324 + { 325 + struct cfg80211_registered_device *rdev; 326 + 327 + rdev = container_of(work, struct cfg80211_registered_device, 328 + sched_scan_stop_wk); 329 + 330 + rtnl_lock(); 331 + 332 + __cfg80211_stop_sched_scan(rdev, false); 333 + 334 + rtnl_unlock(); 335 + } 336 + 323 337 /* exported functions */ 324 338 325 339 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, ··· 420 406 INIT_LIST_HEAD(&rdev->destroy_list); 421 407 spin_lock_init(&rdev->destroy_list_lock); 422 408 INIT_WORK(&rdev->destroy_work, cfg80211_destroy_iface_wk); 409 + INIT_WORK(&rdev->sched_scan_stop_wk, cfg80211_sched_scan_stop_wk); 423 410 424 411 #ifdef CONFIG_CFG80211_DEFAULT_PS 425 412 rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; ··· 574 559 BIT(NL80211_IFTYPE_AP_VLAN) | 575 560 BIT(NL80211_IFTYPE_MONITOR))) 576 561 wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; 562 + 563 + if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) && 564 + (wiphy->regulatory_flags & 565 + (REGULATORY_CUSTOM_REG | 566 + REGULATORY_STRICT_REG | 567 + REGULATORY_COUNTRY_IE_FOLLOW_POWER | 568 + REGULATORY_COUNTRY_IE_IGNORE)))) 569 + return -EINVAL; 577 570 578 571 if (WARN_ON(wiphy->coalesce && 579 572 (!wiphy->coalesce->n_rules || ··· 801 778 flush_work(&rdev->event_work); 802 779 cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); 803 780 flush_work(&rdev->destroy_work); 781 + flush_work(&rdev->sched_scan_stop_wk); 804 782 805 783 #ifdef CONFIG_PM 806 784 if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) ··· 882 858 struct wireless_dev *wdev) 883 859 { 884 860 struct net_device *dev = wdev->netdev; 861 + struct cfg80211_sched_scan_request *sched_scan_req; 885 862 886 863 ASSERT_RTNL(); 887 864 ASSERT_WDEV_LOCK(wdev); ··· 893 868 break; 894 869 case NL80211_IFTYPE_P2P_CLIENT: 895 870 case NL80211_IFTYPE_STATION: 896 - if (rdev->sched_scan_req && dev == rdev->sched_scan_req->dev) 871 + sched_scan_req = rtnl_dereference(rdev->sched_scan_req); 872 + if (sched_scan_req && dev == sched_scan_req->dev) 897 873 __cfg80211_stop_sched_scan(rdev, false); 898 874 899 875 #ifdef CONFIG_CFG80211_WEXT ··· 969 943 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 970 944 struct wireless_dev *wdev = dev->ieee80211_ptr; 971 945 struct cfg80211_registered_device *rdev; 946 + struct cfg80211_sched_scan_request *sched_scan_req; 972 947 973 948 if (!wdev) 974 949 return NOTIFY_DONE; ··· 1034 1007 ___cfg80211_scan_done(rdev, false); 1035 1008 } 1036 1009 1037 - if (WARN_ON(rdev->sched_scan_req && 1038 - rdev->sched_scan_req->dev == wdev->netdev)) { 1010 + sched_scan_req = rtnl_dereference(rdev->sched_scan_req); 1011 + if (WARN_ON(sched_scan_req && 1012 + sched_scan_req->dev == wdev->netdev)) { 1039 1013 __cfg80211_stop_sched_scan(rdev, false); 1040 1014 } 1041 1015
+10 -1
net/wireless/core.h
··· 36 36 * the country on the country IE changed. */ 37 37 char country_ie_alpha2[2]; 38 38 39 + /* 40 + * the driver requests the regulatory core to set this regulatory 41 + * domain as the wiphy's. Only used for %REGULATORY_WIPHY_SELF_MANAGED 42 + * devices using the regulatory_set_wiphy_regd() API 43 + */ 44 + const struct ieee80211_regdomain *requested_regd; 45 + 39 46 /* If a Country IE has been received this tells us the environment 40 47 * which its telling us its in. This defaults to ENVIRON_ANY */ 41 48 enum environment_cap env; ··· 70 63 u32 bss_generation; 71 64 struct cfg80211_scan_request *scan_req; /* protected by RTNL */ 72 65 struct sk_buff *scan_msg; 73 - struct cfg80211_sched_scan_request *sched_scan_req; 66 + struct cfg80211_sched_scan_request __rcu *sched_scan_req; 74 67 unsigned long suspend_at; 75 68 struct work_struct scan_done_wk; 76 69 struct work_struct sched_scan_results_wk; ··· 90 83 spinlock_t destroy_list_lock; 91 84 struct list_head destroy_list; 92 85 struct work_struct destroy_work; 86 + 87 + struct work_struct sched_scan_stop_wk; 93 88 94 89 /* must be last because of the way we do wiphy_priv(), 95 90 * and it should at least be aligned to NETDEV_ALIGN */
+456 -214
net/wireless/nl80211.c
··· 59 59 }; 60 60 61 61 static const struct genl_multicast_group nl80211_mcgrps[] = { 62 - [NL80211_MCGRP_CONFIG] = { .name = "config", }, 63 - [NL80211_MCGRP_SCAN] = { .name = "scan", }, 64 - [NL80211_MCGRP_REGULATORY] = { .name = "regulatory", }, 65 - [NL80211_MCGRP_MLME] = { .name = "mlme", }, 66 - [NL80211_MCGRP_VENDOR] = { .name = "vendor", }, 62 + [NL80211_MCGRP_CONFIG] = { .name = NL80211_MULTICAST_GROUP_CONFIG }, 63 + [NL80211_MCGRP_SCAN] = { .name = NL80211_MULTICAST_GROUP_SCAN }, 64 + [NL80211_MCGRP_REGULATORY] = { .name = NL80211_MULTICAST_GROUP_REG }, 65 + [NL80211_MCGRP_MLME] = { .name = NL80211_MULTICAST_GROUP_MLME }, 66 + [NL80211_MCGRP_VENDOR] = { .name = NL80211_MULTICAST_GROUP_VENDOR }, 67 67 #ifdef CONFIG_NL80211_TESTMODE 68 - [NL80211_MCGRP_TESTMODE] = { .name = "testmode", } 68 + [NL80211_MCGRP_TESTMODE] = { .name = NL80211_MULTICAST_GROUP_TESTMODE } 69 69 #endif 70 70 }; 71 71 ··· 396 396 [NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 }, 397 397 [NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 }, 398 398 [NL80211_ATTR_MAC_MASK] = { .len = ETH_ALEN }, 399 + [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG }, 399 400 }; 400 401 401 402 /* policy for the key attributes */ ··· 1088 1087 return -ENOBUFS; 1089 1088 } 1090 1089 1090 + if ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_NET_DETECT) && 1091 + nla_put_u32(msg, NL80211_WOWLAN_TRIG_NET_DETECT, 1092 + rdev->wiphy.wowlan->max_nd_match_sets)) 1093 + return -ENOBUFS; 1094 + 1091 1095 if (large && nl80211_send_wowlan_tcp_caps(rdev, msg)) 1092 1096 return -ENOBUFS; 1093 1097 ··· 1705 1699 if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH && 1706 1700 nla_put_u8(msg, NL80211_ATTR_MAX_CSA_COUNTERS, 1707 1701 rdev->wiphy.max_num_csa_counters)) 1702 + goto nla_put_failure; 1703 + 1704 + if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && 1705 + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) 1706 + goto nla_put_failure; 1707 + 1708 + if (nla_put(msg, NL80211_ATTR_EXT_FEATURES, 1709 + sizeof(rdev->wiphy.ext_features), 1710 + rdev->wiphy.ext_features)) 1708 1711 goto nla_put_failure; 1709 1712 1710 1713 /* done */ ··· 3578 3563 struct nlattr *rate; 3579 3564 u32 bitrate; 3580 3565 u16 bitrate_compat; 3566 + enum nl80211_attrs rate_flg; 3581 3567 3582 3568 rate = nla_nest_start(msg, attr); 3583 3569 if (!rate) ··· 3595 3579 nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) 3596 3580 return false; 3597 3581 3582 + switch (info->bw) { 3583 + case RATE_INFO_BW_5: 3584 + rate_flg = NL80211_RATE_INFO_5_MHZ_WIDTH; 3585 + break; 3586 + case RATE_INFO_BW_10: 3587 + rate_flg = NL80211_RATE_INFO_10_MHZ_WIDTH; 3588 + break; 3589 + default: 3590 + WARN_ON(1); 3591 + /* fall through */ 3592 + case RATE_INFO_BW_20: 3593 + rate_flg = 0; 3594 + break; 3595 + case RATE_INFO_BW_40: 3596 + rate_flg = NL80211_RATE_INFO_40_MHZ_WIDTH; 3597 + break; 3598 + case RATE_INFO_BW_80: 3599 + rate_flg = NL80211_RATE_INFO_80_MHZ_WIDTH; 3600 + break; 3601 + case RATE_INFO_BW_160: 3602 + rate_flg = NL80211_RATE_INFO_160_MHZ_WIDTH; 3603 + break; 3604 + } 3605 + 3606 + if (rate_flg && nla_put_flag(msg, rate_flg)) 3607 + return false; 3608 + 3598 3609 if (info->flags & RATE_INFO_FLAGS_MCS) { 3599 3610 if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) 3600 - return false; 3601 - if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && 3602 - nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) 3603 3611 return false; 3604 3612 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && 3605 3613 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) ··· 3632 3592 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_MCS, info->mcs)) 3633 3593 return false; 3634 3594 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) 3635 - return false; 3636 - if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && 3637 - nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) 3638 - return false; 3639 - if (info->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH && 3640 - nla_put_flag(msg, NL80211_RATE_INFO_80_MHZ_WIDTH)) 3641 - return false; 3642 - if (info->flags & RATE_INFO_FLAGS_80P80_MHZ_WIDTH && 3643 - nla_put_flag(msg, NL80211_RATE_INFO_80P80_MHZ_WIDTH)) 3644 - return false; 3645 - if (info->flags & RATE_INFO_FLAGS_160_MHZ_WIDTH && 3646 - nla_put_flag(msg, NL80211_RATE_INFO_160_MHZ_WIDTH)) 3647 3595 return false; 3648 3596 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && 3649 3597 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) ··· 3668 3640 return true; 3669 3641 } 3670 3642 3671 - static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, 3672 - int flags, 3643 + static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, 3644 + u32 seq, int flags, 3673 3645 struct cfg80211_registered_device *rdev, 3674 3646 struct net_device *dev, 3675 3647 const u8 *mac_addr, struct station_info *sinfo) ··· 3677 3649 void *hdr; 3678 3650 struct nlattr *sinfoattr, *bss_param; 3679 3651 3680 - hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_STATION); 3652 + hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); 3681 3653 if (!hdr) 3682 3654 return -1; 3683 3655 ··· 3689 3661 sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO); 3690 3662 if (!sinfoattr) 3691 3663 goto nla_put_failure; 3692 - if ((sinfo->filled & STATION_INFO_CONNECTED_TIME) && 3693 - nla_put_u32(msg, NL80211_STA_INFO_CONNECTED_TIME, 3694 - sinfo->connected_time)) 3695 - goto nla_put_failure; 3696 - if ((sinfo->filled & STATION_INFO_INACTIVE_TIME) && 3697 - nla_put_u32(msg, NL80211_STA_INFO_INACTIVE_TIME, 3698 - sinfo->inactive_time)) 3699 - goto nla_put_failure; 3700 - if ((sinfo->filled & (STATION_INFO_RX_BYTES | 3701 - STATION_INFO_RX_BYTES64)) && 3664 + 3665 + #define PUT_SINFO(attr, memb, type) do { \ 3666 + if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) && \ 3667 + nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr, \ 3668 + sinfo->memb)) \ 3669 + goto nla_put_failure; \ 3670 + } while (0) 3671 + 3672 + PUT_SINFO(CONNECTED_TIME, connected_time, u32); 3673 + PUT_SINFO(INACTIVE_TIME, inactive_time, u32); 3674 + 3675 + if (sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES) | 3676 + BIT(NL80211_STA_INFO_RX_BYTES64)) && 3702 3677 nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, 3703 3678 (u32)sinfo->rx_bytes)) 3704 3679 goto nla_put_failure; 3705 - if ((sinfo->filled & (STATION_INFO_TX_BYTES | 3706 - STATION_INFO_TX_BYTES64)) && 3680 + 3681 + if (sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES) | 3682 + BIT(NL80211_STA_INFO_TX_BYTES64)) && 3707 3683 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, 3708 3684 (u32)sinfo->tx_bytes)) 3709 3685 goto nla_put_failure; 3710 - if ((sinfo->filled & STATION_INFO_RX_BYTES64) && 3711 - nla_put_u64(msg, NL80211_STA_INFO_RX_BYTES64, 3712 - sinfo->rx_bytes)) 3713 - goto nla_put_failure; 3714 - if ((sinfo->filled & STATION_INFO_TX_BYTES64) && 3715 - nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64, 3716 - sinfo->tx_bytes)) 3717 - goto nla_put_failure; 3718 - if ((sinfo->filled & STATION_INFO_LLID) && 3719 - nla_put_u16(msg, NL80211_STA_INFO_LLID, sinfo->llid)) 3720 - goto nla_put_failure; 3721 - if ((sinfo->filled & STATION_INFO_PLID) && 3722 - nla_put_u16(msg, NL80211_STA_INFO_PLID, sinfo->plid)) 3723 - goto nla_put_failure; 3724 - if ((sinfo->filled & STATION_INFO_PLINK_STATE) && 3725 - nla_put_u8(msg, NL80211_STA_INFO_PLINK_STATE, 3726 - sinfo->plink_state)) 3727 - goto nla_put_failure; 3686 + 3687 + PUT_SINFO(RX_BYTES64, rx_bytes, u64); 3688 + PUT_SINFO(TX_BYTES64, tx_bytes, u64); 3689 + PUT_SINFO(LLID, llid, u16); 3690 + PUT_SINFO(PLID, plid, u16); 3691 + PUT_SINFO(PLINK_STATE, plink_state, u8); 3692 + 3728 3693 switch (rdev->wiphy.signal_type) { 3729 3694 case CFG80211_SIGNAL_TYPE_MBM: 3730 - if ((sinfo->filled & STATION_INFO_SIGNAL) && 3731 - nla_put_u8(msg, NL80211_STA_INFO_SIGNAL, 3732 - sinfo->signal)) 3733 - goto nla_put_failure; 3734 - if ((sinfo->filled & STATION_INFO_SIGNAL_AVG) && 3735 - nla_put_u8(msg, NL80211_STA_INFO_SIGNAL_AVG, 3736 - sinfo->signal_avg)) 3737 - goto nla_put_failure; 3695 + PUT_SINFO(SIGNAL, signal, u8); 3696 + PUT_SINFO(SIGNAL_AVG, signal_avg, u8); 3738 3697 break; 3739 3698 default: 3740 3699 break; 3741 3700 } 3742 - if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL) { 3701 + if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL)) { 3743 3702 if (!nl80211_put_signal(msg, sinfo->chains, 3744 3703 sinfo->chain_signal, 3745 3704 NL80211_STA_INFO_CHAIN_SIGNAL)) 3746 3705 goto nla_put_failure; 3747 3706 } 3748 - if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL_AVG) { 3707 + if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) { 3749 3708 if (!nl80211_put_signal(msg, sinfo->chains, 3750 3709 sinfo->chain_signal_avg, 3751 3710 NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) 3752 3711 goto nla_put_failure; 3753 3712 } 3754 - if (sinfo->filled & STATION_INFO_TX_BITRATE) { 3713 + if (sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE)) { 3755 3714 if (!nl80211_put_sta_rate(msg, &sinfo->txrate, 3756 3715 NL80211_STA_INFO_TX_BITRATE)) 3757 3716 goto nla_put_failure; 3758 3717 } 3759 - if (sinfo->filled & STATION_INFO_RX_BITRATE) { 3718 + if (sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE)) { 3760 3719 if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, 3761 3720 NL80211_STA_INFO_RX_BITRATE)) 3762 3721 goto nla_put_failure; 3763 3722 } 3764 - if ((sinfo->filled & STATION_INFO_RX_PACKETS) && 3765 - nla_put_u32(msg, NL80211_STA_INFO_RX_PACKETS, 3766 - sinfo->rx_packets)) 3767 - goto nla_put_failure; 3768 - if ((sinfo->filled & STATION_INFO_TX_PACKETS) && 3769 - nla_put_u32(msg, NL80211_STA_INFO_TX_PACKETS, 3770 - sinfo->tx_packets)) 3771 - goto nla_put_failure; 3772 - if ((sinfo->filled & STATION_INFO_TX_RETRIES) && 3773 - nla_put_u32(msg, NL80211_STA_INFO_TX_RETRIES, 3774 - sinfo->tx_retries)) 3775 - goto nla_put_failure; 3776 - if ((sinfo->filled & STATION_INFO_TX_FAILED) && 3777 - nla_put_u32(msg, NL80211_STA_INFO_TX_FAILED, 3778 - sinfo->tx_failed)) 3779 - goto nla_put_failure; 3780 - if ((sinfo->filled & STATION_INFO_EXPECTED_THROUGHPUT) && 3781 - nla_put_u32(msg, NL80211_STA_INFO_EXPECTED_THROUGHPUT, 3782 - sinfo->expected_throughput)) 3783 - goto nla_put_failure; 3784 - if ((sinfo->filled & STATION_INFO_BEACON_LOSS_COUNT) && 3785 - nla_put_u32(msg, NL80211_STA_INFO_BEACON_LOSS, 3786 - sinfo->beacon_loss_count)) 3787 - goto nla_put_failure; 3788 - if ((sinfo->filled & STATION_INFO_LOCAL_PM) && 3789 - nla_put_u32(msg, NL80211_STA_INFO_LOCAL_PM, 3790 - sinfo->local_pm)) 3791 - goto nla_put_failure; 3792 - if ((sinfo->filled & STATION_INFO_PEER_PM) && 3793 - nla_put_u32(msg, NL80211_STA_INFO_PEER_PM, 3794 - sinfo->peer_pm)) 3795 - goto nla_put_failure; 3796 - if ((sinfo->filled & STATION_INFO_NONPEER_PM) && 3797 - nla_put_u32(msg, NL80211_STA_INFO_NONPEER_PM, 3798 - sinfo->nonpeer_pm)) 3799 - goto nla_put_failure; 3800 - if (sinfo->filled & STATION_INFO_BSS_PARAM) { 3723 + 3724 + PUT_SINFO(RX_PACKETS, rx_packets, u32); 3725 + PUT_SINFO(TX_PACKETS, tx_packets, u32); 3726 + PUT_SINFO(TX_RETRIES, tx_retries, u32); 3727 + PUT_SINFO(TX_FAILED, tx_failed, u32); 3728 + PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); 3729 + PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); 3730 + PUT_SINFO(LOCAL_PM, local_pm, u32); 3731 + PUT_SINFO(PEER_PM, peer_pm, u32); 3732 + PUT_SINFO(NONPEER_PM, nonpeer_pm, u32); 3733 + 3734 + if (sinfo->filled & BIT(NL80211_STA_INFO_BSS_PARAM)) { 3801 3735 bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); 3802 3736 if (!bss_param) 3803 3737 goto nla_put_failure; ··· 3778 3788 3779 3789 nla_nest_end(msg, bss_param); 3780 3790 } 3781 - if ((sinfo->filled & STATION_INFO_STA_FLAGS) && 3791 + if ((sinfo->filled & BIT(NL80211_STA_INFO_STA_FLAGS)) && 3782 3792 nla_put(msg, NL80211_STA_INFO_STA_FLAGS, 3783 3793 sizeof(struct nl80211_sta_flag_update), 3784 3794 &sinfo->sta_flags)) 3785 3795 goto nla_put_failure; 3786 - if ((sinfo->filled & STATION_INFO_T_OFFSET) && 3787 - nla_put_u64(msg, NL80211_STA_INFO_T_OFFSET, 3788 - sinfo->t_offset)) 3789 - goto nla_put_failure; 3796 + 3797 + PUT_SINFO(T_OFFSET, t_offset, u64); 3798 + PUT_SINFO(RX_DROP_MISC, rx_dropped_misc, u64); 3799 + PUT_SINFO(BEACON_RX, rx_beacon, u64); 3800 + PUT_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8); 3801 + 3802 + #undef PUT_SINFO 3803 + 3804 + if (sinfo->filled & BIT(NL80211_STA_INFO_TID_STATS)) { 3805 + struct nlattr *tidsattr; 3806 + int tid; 3807 + 3808 + tidsattr = nla_nest_start(msg, NL80211_STA_INFO_TID_STATS); 3809 + if (!tidsattr) 3810 + goto nla_put_failure; 3811 + 3812 + for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) { 3813 + struct cfg80211_tid_stats *tidstats; 3814 + struct nlattr *tidattr; 3815 + 3816 + tidstats = &sinfo->pertid[tid]; 3817 + 3818 + if (!tidstats->filled) 3819 + continue; 3820 + 3821 + tidattr = nla_nest_start(msg, tid + 1); 3822 + if (!tidattr) 3823 + goto nla_put_failure; 3824 + 3825 + #define PUT_TIDVAL(attr, memb, type) do { \ 3826 + if (tidstats->filled & BIT(NL80211_TID_STATS_ ## attr) && \ 3827 + nla_put_ ## type(msg, NL80211_TID_STATS_ ## attr, \ 3828 + tidstats->memb)) \ 3829 + goto nla_put_failure; \ 3830 + } while (0) 3831 + 3832 + PUT_TIDVAL(RX_MSDU, rx_msdu, u64); 3833 + PUT_TIDVAL(TX_MSDU, tx_msdu, u64); 3834 + PUT_TIDVAL(TX_MSDU_RETRIES, tx_msdu_retries, u64); 3835 + PUT_TIDVAL(TX_MSDU_FAILED, tx_msdu_failed, u64); 3836 + 3837 + #undef PUT_TIDVAL 3838 + nla_nest_end(msg, tidattr); 3839 + } 3840 + 3841 + nla_nest_end(msg, tidsattr); 3842 + } 3843 + 3790 3844 nla_nest_end(msg, sinfoattr); 3791 3845 3792 - if ((sinfo->filled & STATION_INFO_ASSOC_REQ_IES) && 3846 + if (sinfo->assoc_req_ies_len && 3793 3847 nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, 3794 3848 sinfo->assoc_req_ies)) 3795 3849 goto nla_put_failure; ··· 3878 3844 if (err) 3879 3845 goto out_err; 3880 3846 3881 - if (nl80211_send_station(skb, 3847 + if (nl80211_send_station(skb, NL80211_CMD_NEW_STATION, 3882 3848 NETLINK_CB(cb->skb).portid, 3883 3849 cb->nlh->nlmsg_seq, NLM_F_MULTI, 3884 3850 rdev, wdev->netdev, mac_addr, ··· 3925 3891 if (!msg) 3926 3892 return -ENOMEM; 3927 3893 3928 - if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0, 3894 + if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, 3895 + info->snd_portid, info->snd_seq, 0, 3929 3896 rdev, dev, mac_addr, &sinfo) < 0) { 3930 3897 nlmsg_free(msg); 3931 3898 return -ENOBUFS; ··· 5362 5327 return err; 5363 5328 } 5364 5329 5365 - static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) 5330 + static int nl80211_put_regdom(const struct ieee80211_regdomain *regdom, 5331 + struct sk_buff *msg) 5366 5332 { 5367 - const struct ieee80211_regdomain *regdom; 5368 - struct sk_buff *msg; 5369 - void *hdr = NULL; 5370 5333 struct nlattr *nl_reg_rules; 5371 5334 unsigned int i; 5372 - 5373 - if (!cfg80211_regdomain) 5374 - return -EINVAL; 5375 - 5376 - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 5377 - if (!msg) 5378 - return -ENOBUFS; 5379 - 5380 - hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, 5381 - NL80211_CMD_GET_REG); 5382 - if (!hdr) 5383 - goto put_failure; 5384 - 5385 - if (reg_last_request_cell_base() && 5386 - nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE, 5387 - NL80211_USER_REG_HINT_CELL_BASE)) 5388 - goto nla_put_failure; 5389 - 5390 - rcu_read_lock(); 5391 - regdom = rcu_dereference(cfg80211_regdomain); 5392 5335 5393 5336 if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, regdom->alpha2) || 5394 5337 (regdom->dfs_region && 5395 5338 nla_put_u8(msg, NL80211_ATTR_DFS_REGION, regdom->dfs_region))) 5396 - goto nla_put_failure_rcu; 5339 + goto nla_put_failure; 5397 5340 5398 5341 nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES); 5399 5342 if (!nl_reg_rules) 5400 - goto nla_put_failure_rcu; 5343 + goto nla_put_failure; 5401 5344 5402 5345 for (i = 0; i < regdom->n_reg_rules; i++) { 5403 5346 struct nlattr *nl_reg_rule; ··· 5390 5377 5391 5378 nl_reg_rule = nla_nest_start(msg, i); 5392 5379 if (!nl_reg_rule) 5393 - goto nla_put_failure_rcu; 5380 + goto nla_put_failure; 5394 5381 5395 5382 max_bandwidth_khz = freq_range->max_bandwidth_khz; 5396 5383 if (!max_bandwidth_khz) ··· 5411 5398 power_rule->max_eirp) || 5412 5399 nla_put_u32(msg, NL80211_ATTR_DFS_CAC_TIME, 5413 5400 reg_rule->dfs_cac_ms)) 5414 - goto nla_put_failure_rcu; 5401 + goto nla_put_failure; 5415 5402 5416 5403 nla_nest_end(msg, nl_reg_rule); 5417 5404 } 5418 - rcu_read_unlock(); 5419 5405 5420 5406 nla_nest_end(msg, nl_reg_rules); 5407 + return 0; 5408 + 5409 + nla_put_failure: 5410 + return -EMSGSIZE; 5411 + } 5412 + 5413 + static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info) 5414 + { 5415 + const struct ieee80211_regdomain *regdom = NULL; 5416 + struct cfg80211_registered_device *rdev; 5417 + struct wiphy *wiphy = NULL; 5418 + struct sk_buff *msg; 5419 + void *hdr; 5420 + 5421 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 5422 + if (!msg) 5423 + return -ENOBUFS; 5424 + 5425 + hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, 5426 + NL80211_CMD_GET_REG); 5427 + if (!hdr) 5428 + goto put_failure; 5429 + 5430 + if (info->attrs[NL80211_ATTR_WIPHY]) { 5431 + bool self_managed; 5432 + 5433 + rdev = cfg80211_get_dev_from_info(genl_info_net(info), info); 5434 + if (IS_ERR(rdev)) { 5435 + nlmsg_free(msg); 5436 + return PTR_ERR(rdev); 5437 + } 5438 + 5439 + wiphy = &rdev->wiphy; 5440 + self_managed = wiphy->regulatory_flags & 5441 + REGULATORY_WIPHY_SELF_MANAGED; 5442 + regdom = get_wiphy_regdom(wiphy); 5443 + 5444 + /* a self-managed-reg device must have a private regdom */ 5445 + if (WARN_ON(!regdom && self_managed)) { 5446 + nlmsg_free(msg); 5447 + return -EINVAL; 5448 + } 5449 + 5450 + if (regdom && 5451 + nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy))) 5452 + goto nla_put_failure; 5453 + } 5454 + 5455 + if (!wiphy && reg_last_request_cell_base() && 5456 + nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE, 5457 + NL80211_USER_REG_HINT_CELL_BASE)) 5458 + goto nla_put_failure; 5459 + 5460 + rcu_read_lock(); 5461 + 5462 + if (!regdom) 5463 + regdom = rcu_dereference(cfg80211_regdomain); 5464 + 5465 + if (nl80211_put_regdom(regdom, msg)) 5466 + goto nla_put_failure_rcu; 5467 + 5468 + rcu_read_unlock(); 5421 5469 5422 5470 genlmsg_end(msg, hdr); 5423 5471 return genlmsg_reply(msg, info); ··· 5490 5416 put_failure: 5491 5417 nlmsg_free(msg); 5492 5418 return -EMSGSIZE; 5419 + } 5420 + 5421 + static int nl80211_send_regdom(struct sk_buff *msg, struct netlink_callback *cb, 5422 + u32 seq, int flags, struct wiphy *wiphy, 5423 + const struct ieee80211_regdomain *regdom) 5424 + { 5425 + void *hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, 5426 + NL80211_CMD_GET_REG); 5427 + 5428 + if (!hdr) 5429 + return -1; 5430 + 5431 + genl_dump_check_consistent(cb, hdr, &nl80211_fam); 5432 + 5433 + if (nl80211_put_regdom(regdom, msg)) 5434 + goto nla_put_failure; 5435 + 5436 + if (!wiphy && reg_last_request_cell_base() && 5437 + nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE, 5438 + NL80211_USER_REG_HINT_CELL_BASE)) 5439 + goto nla_put_failure; 5440 + 5441 + if (wiphy && 5442 + nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy))) 5443 + goto nla_put_failure; 5444 + 5445 + if (wiphy && wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && 5446 + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) 5447 + goto nla_put_failure; 5448 + 5449 + return genlmsg_end(msg, hdr); 5450 + 5451 + nla_put_failure: 5452 + genlmsg_cancel(msg, hdr); 5453 + return -EMSGSIZE; 5454 + } 5455 + 5456 + static int nl80211_get_reg_dump(struct sk_buff *skb, 5457 + struct netlink_callback *cb) 5458 + { 5459 + const struct ieee80211_regdomain *regdom = NULL; 5460 + struct cfg80211_registered_device *rdev; 5461 + int err, reg_idx, start = cb->args[2]; 5462 + 5463 + rtnl_lock(); 5464 + 5465 + if (cfg80211_regdomain && start == 0) { 5466 + err = nl80211_send_regdom(skb, cb, cb->nlh->nlmsg_seq, 5467 + NLM_F_MULTI, NULL, 5468 + rtnl_dereference(cfg80211_regdomain)); 5469 + if (err < 0) 5470 + goto out_err; 5471 + } 5472 + 5473 + /* the global regdom is idx 0 */ 5474 + reg_idx = 1; 5475 + list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 5476 + regdom = get_wiphy_regdom(&rdev->wiphy); 5477 + if (!regdom) 5478 + continue; 5479 + 5480 + if (++reg_idx <= start) 5481 + continue; 5482 + 5483 + err = nl80211_send_regdom(skb, cb, cb->nlh->nlmsg_seq, 5484 + NLM_F_MULTI, &rdev->wiphy, regdom); 5485 + if (err < 0) { 5486 + reg_idx--; 5487 + break; 5488 + } 5489 + } 5490 + 5491 + cb->args[2] = reg_idx; 5492 + err = skb->len; 5493 + out_err: 5494 + rtnl_unlock(); 5495 + return err; 5493 5496 } 5494 5497 5495 5498 static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ··· 6220 6069 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6221 6070 struct net_device *dev = info->user_ptr[1]; 6222 6071 struct wireless_dev *wdev = dev->ieee80211_ptr; 6072 + struct cfg80211_sched_scan_request *sched_scan_req; 6223 6073 int err; 6224 6074 6225 6075 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || ··· 6230 6078 if (rdev->sched_scan_req) 6231 6079 return -EINPROGRESS; 6232 6080 6233 - rdev->sched_scan_req = nl80211_parse_sched_scan(&rdev->wiphy, wdev, 6234 - info->attrs); 6235 - err = PTR_ERR_OR_ZERO(rdev->sched_scan_req); 6081 + sched_scan_req = nl80211_parse_sched_scan(&rdev->wiphy, wdev, 6082 + info->attrs); 6083 + 6084 + err = PTR_ERR_OR_ZERO(sched_scan_req); 6236 6085 if (err) 6237 6086 goto out_err; 6238 6087 6239 - err = rdev_sched_scan_start(rdev, dev, rdev->sched_scan_req); 6088 + err = rdev_sched_scan_start(rdev, dev, sched_scan_req); 6240 6089 if (err) 6241 6090 goto out_free; 6242 6091 6243 - rdev->sched_scan_req->dev = dev; 6244 - rdev->sched_scan_req->wiphy = &rdev->wiphy; 6092 + sched_scan_req->dev = dev; 6093 + sched_scan_req->wiphy = &rdev->wiphy; 6094 + 6095 + if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) 6096 + sched_scan_req->owner_nlportid = info->snd_portid; 6097 + 6098 + rcu_assign_pointer(rdev->sched_scan_req, sched_scan_req); 6245 6099 6246 6100 nl80211_send_sched_scan(rdev, dev, 6247 6101 NL80211_CMD_START_SCHED_SCAN); 6248 6102 return 0; 6249 6103 6250 6104 out_free: 6251 - kfree(rdev->sched_scan_req); 6105 + kfree(sched_scan_req); 6252 6106 out_err: 6253 - rdev->sched_scan_req = NULL; 6254 6107 return err; 6255 6108 } 6256 6109 ··· 6638 6481 } 6639 6482 6640 6483 static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, 6641 - int flags, struct net_device *dev, 6642 - struct survey_info *survey) 6484 + int flags, struct net_device *dev, 6485 + bool allow_radio_stats, 6486 + struct survey_info *survey) 6643 6487 { 6644 6488 void *hdr; 6645 6489 struct nlattr *infoattr; 6490 + 6491 + /* skip radio stats if userspace didn't request them */ 6492 + if (!survey->channel && !allow_radio_stats) 6493 + return 0; 6646 6494 6647 6495 hdr = nl80211hdr_put(msg, portid, seq, flags, 6648 6496 NL80211_CMD_NEW_SURVEY_RESULTS); ··· 6661 6499 if (!infoattr) 6662 6500 goto nla_put_failure; 6663 6501 6664 - if (nla_put_u32(msg, NL80211_SURVEY_INFO_FREQUENCY, 6502 + if (survey->channel && 6503 + nla_put_u32(msg, NL80211_SURVEY_INFO_FREQUENCY, 6665 6504 survey->channel->center_freq)) 6666 6505 goto nla_put_failure; 6667 6506 ··· 6672 6509 if ((survey->filled & SURVEY_INFO_IN_USE) && 6673 6510 nla_put_flag(msg, NL80211_SURVEY_INFO_IN_USE)) 6674 6511 goto nla_put_failure; 6675 - if ((survey->filled & SURVEY_INFO_CHANNEL_TIME) && 6676 - nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME, 6677 - survey->channel_time)) 6512 + if ((survey->filled & SURVEY_INFO_TIME) && 6513 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME, 6514 + survey->time)) 6678 6515 goto nla_put_failure; 6679 - if ((survey->filled & SURVEY_INFO_CHANNEL_TIME_BUSY) && 6680 - nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, 6681 - survey->channel_time_busy)) 6516 + if ((survey->filled & SURVEY_INFO_TIME_BUSY) && 6517 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_BUSY, 6518 + survey->time_busy)) 6682 6519 goto nla_put_failure; 6683 - if ((survey->filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY) && 6684 - nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, 6685 - survey->channel_time_ext_busy)) 6520 + if ((survey->filled & SURVEY_INFO_TIME_EXT_BUSY) && 6521 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_EXT_BUSY, 6522 + survey->time_ext_busy)) 6686 6523 goto nla_put_failure; 6687 - if ((survey->filled & SURVEY_INFO_CHANNEL_TIME_RX) && 6688 - nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX, 6689 - survey->channel_time_rx)) 6524 + if ((survey->filled & SURVEY_INFO_TIME_RX) && 6525 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_RX, 6526 + survey->time_rx)) 6690 6527 goto nla_put_failure; 6691 - if ((survey->filled & SURVEY_INFO_CHANNEL_TIME_TX) && 6692 - nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX, 6693 - survey->channel_time_tx)) 6528 + if ((survey->filled & SURVEY_INFO_TIME_TX) && 6529 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_TX, 6530 + survey->time_tx)) 6531 + goto nla_put_failure; 6532 + if ((survey->filled & SURVEY_INFO_TIME_SCAN) && 6533 + nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_SCAN, 6534 + survey->time_scan)) 6694 6535 goto nla_put_failure; 6695 6536 6696 6537 nla_nest_end(msg, infoattr); ··· 6706 6539 return -EMSGSIZE; 6707 6540 } 6708 6541 6709 - static int nl80211_dump_survey(struct sk_buff *skb, 6710 - struct netlink_callback *cb) 6542 + static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) 6711 6543 { 6712 6544 struct survey_info survey; 6713 6545 struct cfg80211_registered_device *rdev; 6714 6546 struct wireless_dev *wdev; 6715 6547 int survey_idx = cb->args[2]; 6716 6548 int res; 6549 + bool radio_stats; 6717 6550 6718 6551 res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); 6719 6552 if (res) 6720 6553 return res; 6554 + 6555 + /* prepare_wdev_dump parsed the attributes */ 6556 + radio_stats = nl80211_fam.attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS]; 6721 6557 6722 6558 if (!wdev->netdev) { 6723 6559 res = -EINVAL; ··· 6739 6569 if (res) 6740 6570 goto out_err; 6741 6571 6742 - /* Survey without a channel doesn't make sense */ 6743 - if (!survey.channel) { 6744 - res = -EINVAL; 6745 - goto out; 6746 - } 6747 - 6748 - if (survey.channel->flags & IEEE80211_CHAN_DISABLED) { 6572 + /* don't send disabled channels, but do send non-channel data */ 6573 + if (survey.channel && 6574 + survey.channel->flags & IEEE80211_CHAN_DISABLED) { 6749 6575 survey_idx++; 6750 6576 continue; 6751 6577 } ··· 6749 6583 if (nl80211_send_survey(skb, 6750 6584 NETLINK_CB(cb->skb).portid, 6751 6585 cb->nlh->nlmsg_seq, NLM_F_MULTI, 6752 - wdev->netdev, &survey) < 0) 6586 + wdev->netdev, radio_stats, &survey) < 0) 6753 6587 goto out; 6754 6588 survey_idx++; 6755 6589 } ··· 8765 8599 return 0; 8766 8600 } 8767 8601 8602 + static int nl80211_send_wowlan_nd(struct sk_buff *msg, 8603 + struct cfg80211_sched_scan_request *req) 8604 + { 8605 + struct nlattr *nd, *freqs, *matches, *match; 8606 + int i; 8607 + 8608 + if (!req) 8609 + return 0; 8610 + 8611 + nd = nla_nest_start(msg, NL80211_WOWLAN_TRIG_NET_DETECT); 8612 + if (!nd) 8613 + return -ENOBUFS; 8614 + 8615 + if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, req->interval)) 8616 + return -ENOBUFS; 8617 + 8618 + freqs = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES); 8619 + if (!freqs) 8620 + return -ENOBUFS; 8621 + 8622 + for (i = 0; i < req->n_channels; i++) 8623 + nla_put_u32(msg, i, req->channels[i]->center_freq); 8624 + 8625 + nla_nest_end(msg, freqs); 8626 + 8627 + if (req->n_match_sets) { 8628 + matches = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_MATCH); 8629 + for (i = 0; i < req->n_match_sets; i++) { 8630 + match = nla_nest_start(msg, i); 8631 + nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID, 8632 + req->match_sets[i].ssid.ssid_len, 8633 + req->match_sets[i].ssid.ssid); 8634 + nla_nest_end(msg, match); 8635 + } 8636 + nla_nest_end(msg, matches); 8637 + } 8638 + 8639 + nla_nest_end(msg, nd); 8640 + 8641 + return 0; 8642 + } 8643 + 8768 8644 static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) 8769 8645 { 8770 8646 struct cfg80211_registered_device *rdev = info->user_ptr[0]; ··· 8862 8654 8863 8655 if (nl80211_send_wowlan_tcp(msg, 8864 8656 rdev->wiphy.wowlan_config->tcp)) 8657 + goto nla_put_failure; 8658 + 8659 + if (nl80211_send_wowlan_nd( 8660 + msg, 8661 + rdev->wiphy.wowlan_config->nd_config)) 8865 8662 goto nla_put_failure; 8866 8663 8867 8664 nla_nest_end(msg, nl_wowlan); ··· 10438 10225 }, 10439 10226 { 10440 10227 .cmd = NL80211_CMD_GET_REG, 10441 - .doit = nl80211_get_reg, 10228 + .doit = nl80211_get_reg_do, 10229 + .dumpit = nl80211_get_reg_dump, 10442 10230 .policy = nl80211_policy, 10443 10231 .internal_flags = NL80211_FLAG_NEED_RTNL, 10444 10232 /* can be retrieved by unprivileged users */ ··· 11153 10939 NL80211_MCGRP_SCAN, GFP_KERNEL); 11154 10940 } 11155 10941 11156 - /* 11157 - * This can happen on global regulatory changes or device specific settings 11158 - * based on custom world regulatory domains. 11159 - */ 11160 - void nl80211_send_reg_change_event(struct regulatory_request *request) 10942 + static bool nl80211_reg_change_event_fill(struct sk_buff *msg, 10943 + struct regulatory_request *request) 11161 10944 { 11162 - struct sk_buff *msg; 11163 - void *hdr; 11164 - 11165 - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 11166 - if (!msg) 11167 - return; 11168 - 11169 - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_CHANGE); 11170 - if (!hdr) { 11171 - nlmsg_free(msg); 11172 - return; 11173 - } 11174 - 11175 10945 /* Userspace can always count this one always being set */ 11176 10946 if (nla_put_u8(msg, NL80211_ATTR_REG_INITIATOR, request->initiator)) 11177 10947 goto nla_put_failure; ··· 11181 10983 goto nla_put_failure; 11182 10984 } 11183 10985 11184 - if (request->wiphy_idx != WIPHY_IDX_INVALID && 11185 - nla_put_u32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx)) 10986 + if (request->wiphy_idx != WIPHY_IDX_INVALID) { 10987 + struct wiphy *wiphy = wiphy_idx_to_wiphy(request->wiphy_idx); 10988 + 10989 + if (wiphy && 10990 + nla_put_u32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx)) 10991 + goto nla_put_failure; 10992 + 10993 + if (wiphy && 10994 + wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && 10995 + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) 10996 + goto nla_put_failure; 10997 + } 10998 + 10999 + return true; 11000 + 11001 + nla_put_failure: 11002 + return false; 11003 + } 11004 + 11005 + /* 11006 + * This can happen on global regulatory changes or device specific settings 11007 + * based on custom regulatory domains. 11008 + */ 11009 + void nl80211_common_reg_change_event(enum nl80211_commands cmd_id, 11010 + struct regulatory_request *request) 11011 + { 11012 + struct sk_buff *msg; 11013 + void *hdr; 11014 + 11015 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 11016 + if (!msg) 11017 + return; 11018 + 11019 + hdr = nl80211hdr_put(msg, 0, 0, 0, cmd_id); 11020 + if (!hdr) { 11021 + nlmsg_free(msg); 11022 + return; 11023 + } 11024 + 11025 + if (nl80211_reg_change_event_fill(msg, request) == false) 11186 11026 goto nla_put_failure; 11187 11027 11188 11028 genlmsg_end(msg, hdr); ··· 11759 11523 if (!msg) 11760 11524 return; 11761 11525 11762 - if (nl80211_send_station(msg, 0, 0, 0, 11526 + if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, 0, 0, 0, 11763 11527 rdev, dev, mac_addr, sinfo) < 0) { 11764 11528 nlmsg_free(msg); 11765 11529 return; ··· 11770 11534 } 11771 11535 EXPORT_SYMBOL(cfg80211_new_sta); 11772 11536 11773 - void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp) 11537 + void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 11538 + struct station_info *sinfo, gfp_t gfp) 11774 11539 { 11775 11540 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; 11776 11541 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 11777 11542 struct sk_buff *msg; 11778 - void *hdr; 11543 + struct station_info empty_sinfo = {}; 11544 + 11545 + if (!sinfo) 11546 + sinfo = &empty_sinfo; 11779 11547 11780 11548 trace_cfg80211_del_sta(dev, mac_addr); 11781 11549 ··· 11787 11547 if (!msg) 11788 11548 return; 11789 11549 11790 - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DEL_STATION); 11791 - if (!hdr) { 11550 + if (nl80211_send_station(msg, NL80211_CMD_DEL_STATION, 0, 0, 0, 11551 + rdev, dev, mac_addr, sinfo) < 0) { 11792 11552 nlmsg_free(msg); 11793 11553 return; 11794 11554 } 11795 11555 11796 - if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || 11797 - nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) 11798 - goto nla_put_failure; 11799 - 11800 - genlmsg_end(msg, hdr); 11801 - 11802 11556 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, 11803 11557 NL80211_MCGRP_MLME, gfp); 11804 - return; 11805 - 11806 - nla_put_failure: 11807 - genlmsg_cancel(msg, hdr); 11808 - nlmsg_free(msg); 11809 11558 } 11810 - EXPORT_SYMBOL(cfg80211_del_sta); 11559 + EXPORT_SYMBOL(cfg80211_del_sta_sinfo); 11811 11560 11812 11561 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 11813 11562 enum nl80211_connect_failed_reason reason, ··· 12700 12471 12701 12472 list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { 12702 12473 bool schedule_destroy_work = false; 12474 + bool schedule_scan_stop = false; 12475 + struct cfg80211_sched_scan_request *sched_scan_req = 12476 + rcu_dereference(rdev->sched_scan_req); 12477 + 12478 + if (sched_scan_req && notify->portid && 12479 + sched_scan_req->owner_nlportid == notify->portid) 12480 + schedule_scan_stop = true; 12703 12481 12704 12482 list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) { 12705 12483 cfg80211_mlme_unregister_socket(wdev, notify->portid); ··· 12737 12501 spin_unlock(&rdev->destroy_list_lock); 12738 12502 schedule_work(&rdev->destroy_work); 12739 12503 } 12504 + } else if (schedule_scan_stop) { 12505 + sched_scan_req->owner_nlportid = 0; 12506 + 12507 + if (rdev->ops->sched_scan_stop && 12508 + rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) 12509 + schedule_work(&rdev->sched_scan_stop_wk); 12740 12510 } 12741 12511 } 12742 12512
+15 -1
net/wireless/nl80211.h
··· 17 17 struct net_device *netdev, u32 cmd); 18 18 void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, 19 19 struct net_device *netdev); 20 - void nl80211_send_reg_change_event(struct regulatory_request *request); 20 + void nl80211_common_reg_change_event(enum nl80211_commands cmd_id, 21 + struct regulatory_request *request); 22 + 23 + static inline void 24 + nl80211_send_reg_change_event(struct regulatory_request *request) 25 + { 26 + nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request); 27 + } 28 + 29 + static inline void 30 + nl80211_send_wiphy_reg_change_event(struct regulatory_request *request) 31 + { 32 + nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, request); 33 + } 34 + 21 35 void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, 22 36 struct net_device *netdev, 23 37 const u8 *buf, size_t len, gfp_t gfp);
+155 -5
net/wireless/reg.c
··· 109 109 * protected by RTNL (and can be accessed with RCU protection) 110 110 */ 111 111 static struct regulatory_request __rcu *last_request = 112 - (void __rcu *)&core_request_world; 112 + (void __force __rcu *)&core_request_world; 113 113 114 114 /* To trigger userspace events */ 115 115 static struct platform_device *reg_pdev; ··· 142 142 return rtnl_dereference(cfg80211_regdomain); 143 143 } 144 144 145 - static const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy) 145 + const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy) 146 146 { 147 147 return rtnl_dereference(wiphy->regd); 148 148 } ··· 1307 1307 { 1308 1308 struct regulatory_request *lr = get_last_request(); 1309 1309 1310 + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1311 + return true; 1312 + 1310 1313 if (!lr) { 1311 1314 REG_DBG_PRINT("Ignoring regulatory request set by %s " 1312 1315 "since last_request is not set\n", ··· 1686 1683 if (IS_ERR(reg_rule)) { 1687 1684 REG_DBG_PRINT("Disabling freq %d MHz as custom regd has no rule that fits it\n", 1688 1685 chan->center_freq); 1689 - chan->orig_flags |= IEEE80211_CHAN_DISABLED; 1690 - chan->flags = chan->orig_flags; 1686 + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { 1687 + chan->flags |= IEEE80211_CHAN_DISABLED; 1688 + } else { 1689 + chan->orig_flags |= IEEE80211_CHAN_DISABLED; 1690 + chan->flags = chan->orig_flags; 1691 + } 1691 1692 return; 1692 1693 } 1693 1694 ··· 1716 1709 chan->dfs_state = NL80211_DFS_USABLE; 1717 1710 1718 1711 chan->beacon_found = false; 1719 - chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; 1712 + 1713 + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1714 + chan->flags = chan->orig_flags | bw_flags | 1715 + map_regdom_flags(reg_rule->flags); 1716 + else 1717 + chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; 1718 + 1720 1719 chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); 1721 1720 chan->max_reg_power = chan->max_power = 1722 1721 (int) MBM_TO_DBM(power_rule->max_eirp); ··· 2108 2095 reg_free_request(reg_request); 2109 2096 } 2110 2097 2098 + static bool reg_only_self_managed_wiphys(void) 2099 + { 2100 + struct cfg80211_registered_device *rdev; 2101 + struct wiphy *wiphy; 2102 + bool self_managed_found = false; 2103 + 2104 + ASSERT_RTNL(); 2105 + 2106 + list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 2107 + wiphy = &rdev->wiphy; 2108 + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 2109 + self_managed_found = true; 2110 + else 2111 + return false; 2112 + } 2113 + 2114 + /* make sure at least one self-managed wiphy exists */ 2115 + return self_managed_found; 2116 + } 2117 + 2111 2118 /* 2112 2119 * Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* 2113 2120 * Regulatory hints come on a first come first serve basis and we ··· 2159 2126 2160 2127 spin_unlock(&reg_requests_lock); 2161 2128 2129 + if (reg_only_self_managed_wiphys()) { 2130 + reg_free_request(reg_request); 2131 + return; 2132 + } 2133 + 2162 2134 reg_process_hint(reg_request); 2163 2135 } 2164 2136 ··· 2191 2153 spin_unlock_bh(&reg_pending_beacons_lock); 2192 2154 } 2193 2155 2156 + static void reg_process_self_managed_hints(void) 2157 + { 2158 + struct cfg80211_registered_device *rdev; 2159 + struct wiphy *wiphy; 2160 + const struct ieee80211_regdomain *tmp; 2161 + const struct ieee80211_regdomain *regd; 2162 + enum ieee80211_band band; 2163 + struct regulatory_request request = {}; 2164 + 2165 + list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 2166 + wiphy = &rdev->wiphy; 2167 + 2168 + spin_lock(&reg_requests_lock); 2169 + regd = rdev->requested_regd; 2170 + rdev->requested_regd = NULL; 2171 + spin_unlock(&reg_requests_lock); 2172 + 2173 + if (regd == NULL) 2174 + continue; 2175 + 2176 + tmp = get_wiphy_regdom(wiphy); 2177 + rcu_assign_pointer(wiphy->regd, regd); 2178 + rcu_free_regdom(tmp); 2179 + 2180 + for (band = 0; band < IEEE80211_NUM_BANDS; band++) 2181 + handle_band_custom(wiphy, wiphy->bands[band], regd); 2182 + 2183 + reg_process_ht_flags(wiphy); 2184 + 2185 + request.wiphy_idx = get_wiphy_idx(wiphy); 2186 + request.alpha2[0] = regd->alpha2[0]; 2187 + request.alpha2[1] = regd->alpha2[1]; 2188 + request.initiator = NL80211_REGDOM_SET_BY_DRIVER; 2189 + 2190 + nl80211_send_wiphy_reg_change_event(&request); 2191 + } 2192 + 2193 + reg_check_channels(); 2194 + } 2195 + 2194 2196 static void reg_todo(struct work_struct *work) 2195 2197 { 2196 2198 rtnl_lock(); 2197 2199 reg_process_pending_hints(); 2198 2200 reg_process_pending_beacon_hints(); 2201 + reg_process_self_managed_hints(); 2199 2202 rtnl_unlock(); 2200 2203 } 2201 2204 ··· 2517 2438 world_alpha2[1] = cfg80211_world_regdom->alpha2[1]; 2518 2439 2519 2440 list_for_each_entry(rdev, &cfg80211_rdev_list, list) { 2441 + if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 2442 + continue; 2520 2443 if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG) 2521 2444 restore_custom_reg_settings(&rdev->wiphy); 2522 2445 } ··· 2922 2841 return 0; 2923 2842 } 2924 2843 2844 + static int __regulatory_set_wiphy_regd(struct wiphy *wiphy, 2845 + struct ieee80211_regdomain *rd) 2846 + { 2847 + const struct ieee80211_regdomain *regd; 2848 + const struct ieee80211_regdomain *prev_regd; 2849 + struct cfg80211_registered_device *rdev; 2850 + 2851 + if (WARN_ON(!wiphy || !rd)) 2852 + return -EINVAL; 2853 + 2854 + if (WARN(!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED), 2855 + "wiphy should have REGULATORY_WIPHY_SELF_MANAGED\n")) 2856 + return -EPERM; 2857 + 2858 + if (WARN(!is_valid_rd(rd), "Invalid regulatory domain detected\n")) { 2859 + print_regdomain_info(rd); 2860 + return -EINVAL; 2861 + } 2862 + 2863 + regd = reg_copy_regd(rd); 2864 + if (IS_ERR(regd)) 2865 + return PTR_ERR(regd); 2866 + 2867 + rdev = wiphy_to_rdev(wiphy); 2868 + 2869 + spin_lock(&reg_requests_lock); 2870 + prev_regd = rdev->requested_regd; 2871 + rdev->requested_regd = regd; 2872 + spin_unlock(&reg_requests_lock); 2873 + 2874 + kfree(prev_regd); 2875 + return 0; 2876 + } 2877 + 2878 + int regulatory_set_wiphy_regd(struct wiphy *wiphy, 2879 + struct ieee80211_regdomain *rd) 2880 + { 2881 + int ret = __regulatory_set_wiphy_regd(wiphy, rd); 2882 + 2883 + if (ret) 2884 + return ret; 2885 + 2886 + schedule_work(&reg_work); 2887 + return 0; 2888 + } 2889 + EXPORT_SYMBOL(regulatory_set_wiphy_regd); 2890 + 2891 + int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 2892 + struct ieee80211_regdomain *rd) 2893 + { 2894 + int ret; 2895 + 2896 + ASSERT_RTNL(); 2897 + 2898 + ret = __regulatory_set_wiphy_regd(wiphy, rd); 2899 + if (ret) 2900 + return ret; 2901 + 2902 + /* process the request immediately */ 2903 + reg_process_self_managed_hints(); 2904 + return 0; 2905 + } 2906 + EXPORT_SYMBOL(regulatory_set_wiphy_regd_sync_rtnl); 2907 + 2925 2908 void wiphy_regulatory_register(struct wiphy *wiphy) 2926 2909 { 2927 2910 struct regulatory_request *lr; 2911 + 2912 + /* self-managed devices ignore external hints */ 2913 + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 2914 + wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS | 2915 + REGULATORY_COUNTRY_IE_IGNORE; 2928 2916 2929 2917 if (!reg_dev_ignore_cell_hint(wiphy)) 2930 2918 reg_num_devs_support_basehint++;
+1
net/wireless/reg.h
··· 38 38 const struct ieee80211_reg_rule *rule); 39 39 40 40 bool reg_last_request_cell_base(void); 41 + const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy); 41 42 42 43 /** 43 44 * regulatory_hint_found_beacon - hints a beacon was found on a channel
+8 -5
net/wireless/scan.c
··· 257 257 258 258 rtnl_lock(); 259 259 260 - request = rdev->sched_scan_req; 260 + request = rtnl_dereference(rdev->sched_scan_req); 261 261 262 262 /* we don't have sched_scan_req anymore if the scan is stopping */ 263 263 if (request) { ··· 279 279 { 280 280 trace_cfg80211_sched_scan_results(wiphy); 281 281 /* ignore if we're not scanning */ 282 - if (wiphy_to_rdev(wiphy)->sched_scan_req) 282 + 283 + if (rcu_access_pointer(wiphy_to_rdev(wiphy)->sched_scan_req)) 283 284 queue_work(cfg80211_wq, 284 285 &wiphy_to_rdev(wiphy)->sched_scan_results_wk); 285 286 } ··· 309 308 int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, 310 309 bool driver_initiated) 311 310 { 311 + struct cfg80211_sched_scan_request *sched_scan_req; 312 312 struct net_device *dev; 313 313 314 314 ASSERT_RTNL(); ··· 317 315 if (!rdev->sched_scan_req) 318 316 return -ENOENT; 319 317 320 - dev = rdev->sched_scan_req->dev; 318 + sched_scan_req = rtnl_dereference(rdev->sched_scan_req); 319 + dev = sched_scan_req->dev; 321 320 322 321 if (!driver_initiated) { 323 322 int err = rdev_sched_scan_stop(rdev, dev); ··· 328 325 329 326 nl80211_send_sched_scan(rdev, dev, NL80211_CMD_SCHED_SCAN_STOPPED); 330 327 331 - kfree(rdev->sched_scan_req); 332 - rdev->sched_scan_req = NULL; 328 + RCU_INIT_POINTER(rdev->sched_scan_req, NULL); 329 + kfree_rcu(sched_scan_req, rcu_head); 333 330 334 331 return 0; 335 332 }
+17 -14
net/wireless/trace.h
··· 1604 1604 WIPHY_ENTRY 1605 1605 CHAN_ENTRY 1606 1606 __field(int, ret) 1607 - __field(u64, channel_time) 1608 - __field(u64, channel_time_busy) 1609 - __field(u64, channel_time_ext_busy) 1610 - __field(u64, channel_time_rx) 1611 - __field(u64, channel_time_tx) 1607 + __field(u64, time) 1608 + __field(u64, time_busy) 1609 + __field(u64, time_ext_busy) 1610 + __field(u64, time_rx) 1611 + __field(u64, time_tx) 1612 + __field(u64, time_scan) 1612 1613 __field(u32, filled) 1613 1614 __field(s8, noise) 1614 1615 ), ··· 1617 1616 WIPHY_ASSIGN; 1618 1617 CHAN_ASSIGN(info->channel); 1619 1618 __entry->ret = ret; 1620 - __entry->channel_time = info->channel_time; 1621 - __entry->channel_time_busy = info->channel_time_busy; 1622 - __entry->channel_time_ext_busy = info->channel_time_ext_busy; 1623 - __entry->channel_time_rx = info->channel_time_rx; 1624 - __entry->channel_time_tx = info->channel_time_tx; 1619 + __entry->time = info->time; 1620 + __entry->time_busy = info->time_busy; 1621 + __entry->time_ext_busy = info->time_ext_busy; 1622 + __entry->time_rx = info->time_rx; 1623 + __entry->time_tx = info->time_tx; 1624 + __entry->time_scan = info->time_scan; 1625 1625 __entry->filled = info->filled; 1626 1626 __entry->noise = info->noise; 1627 1627 ), 1628 1628 TP_printk(WIPHY_PR_FMT ", returned: %d, " CHAN_PR_FMT 1629 1629 ", channel time: %llu, channel time busy: %llu, " 1630 1630 "channel time extension busy: %llu, channel time rx: %llu, " 1631 - "channel time tx: %llu, filled: %u, noise: %d", 1631 + "channel time tx: %llu, scan time: %llu, filled: %u, noise: %d", 1632 1632 WIPHY_PR_ARG, __entry->ret, CHAN_PR_ARG, 1633 - __entry->channel_time, __entry->channel_time_busy, 1634 - __entry->channel_time_ext_busy, __entry->channel_time_rx, 1635 - __entry->channel_time_tx, __entry->filled, __entry->noise) 1633 + __entry->time, __entry->time_busy, 1634 + __entry->time_ext_busy, __entry->time_rx, 1635 + __entry->time_tx, __entry->time_scan, 1636 + __entry->filled, __entry->noise) 1636 1637 ); 1637 1638 1638 1639 TRACE_EVENT(rdev_tdls_oper,
+19 -6
net/wireless/util.c
··· 1073 1073 if (WARN_ON_ONCE(rate->mcs > 9)) 1074 1074 return 0; 1075 1075 1076 - idx = rate->flags & (RATE_INFO_FLAGS_160_MHZ_WIDTH | 1077 - RATE_INFO_FLAGS_80P80_MHZ_WIDTH) ? 3 : 1078 - rate->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH ? 2 : 1079 - rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH ? 1 : 0; 1076 + switch (rate->bw) { 1077 + case RATE_INFO_BW_160: 1078 + idx = 3; 1079 + break; 1080 + case RATE_INFO_BW_80: 1081 + idx = 2; 1082 + break; 1083 + case RATE_INFO_BW_40: 1084 + idx = 1; 1085 + break; 1086 + case RATE_INFO_BW_5: 1087 + case RATE_INFO_BW_10: 1088 + default: 1089 + WARN_ON(1); 1090 + /* fall through */ 1091 + case RATE_INFO_BW_20: 1092 + idx = 0; 1093 + } 1080 1094 1081 1095 bitrate = base[idx][rate->mcs]; 1082 1096 bitrate *= rate->nss; ··· 1121 1107 modulation = rate->mcs & 7; 1122 1108 streams = (rate->mcs >> 3) + 1; 1123 1109 1124 - bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ? 1125 - 13500000 : 6500000; 1110 + bitrate = (rate->bw == RATE_INFO_BW_40) ? 13500000 : 6500000; 1126 1111 1127 1112 if (modulation < 4) 1128 1113 bitrate *= (modulation + 1);
+5 -5
net/wireless/wext-compat.c
··· 1300 1300 if (err) 1301 1301 return err; 1302 1302 1303 - if (!(sinfo.filled & STATION_INFO_TX_BITRATE)) 1303 + if (!(sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))) 1304 1304 return -EOPNOTSUPP; 1305 1305 1306 1306 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); ··· 1340 1340 1341 1341 switch (rdev->wiphy.signal_type) { 1342 1342 case CFG80211_SIGNAL_TYPE_MBM: 1343 - if (sinfo.filled & STATION_INFO_SIGNAL) { 1343 + if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) { 1344 1344 int sig = sinfo.signal; 1345 1345 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; 1346 1346 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; ··· 1354 1354 break; 1355 1355 } 1356 1356 case CFG80211_SIGNAL_TYPE_UNSPEC: 1357 - if (sinfo.filled & STATION_INFO_SIGNAL) { 1357 + if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) { 1358 1358 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; 1359 1359 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; 1360 1360 wstats.qual.level = sinfo.signal; ··· 1367 1367 } 1368 1368 1369 1369 wstats.qual.updated |= IW_QUAL_NOISE_INVALID; 1370 - if (sinfo.filled & STATION_INFO_RX_DROP_MISC) 1370 + if (sinfo.filled & BIT(NL80211_STA_INFO_RX_DROP_MISC)) 1371 1371 wstats.discard.misc = sinfo.rx_dropped_misc; 1372 - if (sinfo.filled & STATION_INFO_TX_FAILED) 1372 + if (sinfo.filled & BIT(NL80211_STA_INFO_TX_FAILED)) 1373 1373 wstats.discard.retries = sinfo.tx_failed; 1374 1374 1375 1375 return &wstats;