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

Merge tag 'mac80211-next-for-davem-2015-10-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
Here's another set of patches for the current cycle:
* I merged net-next back to avoid a conflict with the
* cfg80211 scheduled scan API extensions
* preparations for better scan result timestamping
* regulatory cleanups
* mac80211 statistics cleanups
* a few other small cleanups and fixes
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+911 -660
+3 -2
Documentation/DocBook/80211.tmpl
··· 154 154 !Finclude/net/cfg80211.h cfg80211_scan_request 155 155 !Finclude/net/cfg80211.h cfg80211_scan_done 156 156 !Finclude/net/cfg80211.h cfg80211_bss 157 - !Finclude/net/cfg80211.h cfg80211_inform_bss_width_frame 158 - !Finclude/net/cfg80211.h cfg80211_inform_bss_width 157 + !Finclude/net/cfg80211.h cfg80211_inform_bss 158 + !Finclude/net/cfg80211.h cfg80211_inform_bss_frame_data 159 + !Finclude/net/cfg80211.h cfg80211_inform_bss_data 159 160 !Finclude/net/cfg80211.h cfg80211_unlink_bss 160 161 !Finclude/net/cfg80211.h cfg80211_find_ie 161 162 !Finclude/net/cfg80211.h ieee80211_bss_get_ie
+1 -1
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 3312 3312 } 3313 3313 3314 3314 /* fw uses seconds, also make sure that it's >0 */ 3315 - interval = max_t(u16, 1, request->interval / 1000); 3315 + interval = max_t(u16, 1, request->scan_plans[0].interval); 3316 3316 3317 3317 ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 3318 3318 interval, interval,
+1
drivers/net/wireless/iwlwifi/mvm/ops.c
··· 630 630 kfree(mvm->d3_resume_sram); 631 631 if (mvm->nd_config) { 632 632 kfree(mvm->nd_config->match_sets); 633 + kfree(mvm->nd_config->scan_plans); 633 634 kfree(mvm->nd_config); 634 635 mvm->nd_config = NULL; 635 636 }
+2 -2
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 1271 1271 1272 1272 params.type = iwl_mvm_get_scan_type(mvm, vif, &params); 1273 1273 1274 - if (req->interval > U16_MAX) { 1274 + if (req->scan_plans[0].interval > U16_MAX) { 1275 1275 IWL_DEBUG_SCAN(mvm, 1276 1276 "interval value is > 16-bits, set to max possible\n"); 1277 1277 params.interval = U16_MAX; 1278 1278 } else { 1279 - params.interval = req->interval / MSEC_PER_SEC; 1279 + params.interval = req->scan_plans[0].interval; 1280 1280 } 1281 1281 1282 1282 /* In theory, LMAC scans can handle a 32-bit delay, but since
+1 -1
drivers/net/wireless/rt2x00/rt2x00config.c
··· 266 266 if (beacon_diff > beacon_int) 267 267 beacon_diff = 0; 268 268 269 - autowake_timeout = (conf->max_sleep_period * beacon_int) - beacon_diff; 269 + autowake_timeout = (conf->ps_dtim_period * beacon_int) - beacon_diff; 270 270 queue_delayed_work(rt2x00dev->workqueue, 271 271 &rt2x00dev->autowakeup_work, 272 272 autowake_timeout - 15);
+2 -1
drivers/net/wireless/ti/wl12xx/scan.c
··· 350 350 cfg->bss_type = SCAN_BSS_TYPE_ANY; 351 351 /* currently NL80211 supports only a single interval */ 352 352 for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) 353 - cfg->intervals[i] = cpu_to_le32(req->interval); 353 + cfg->intervals[i] = cpu_to_le32(req->scan_plans[0].interval * 354 + MSEC_PER_SEC); 354 355 355 356 cfg->ssid_len = 0; 356 357 ret = wlcore_scan_sched_scan_ssid_list(wl, wlvif, req);
+5 -3
drivers/net/wireless/ti/wl18xx/scan.c
··· 228 228 wl18xx_adjust_channels(cmd, cmd_channels); 229 229 230 230 if (c->num_short_intervals && c->long_interval && 231 - c->long_interval > req->interval) { 232 - cmd->short_cycles_msec = cpu_to_le16(req->interval); 231 + c->long_interval > req->scan_plans[0].interval * MSEC_PER_SEC) { 232 + cmd->short_cycles_msec = 233 + cpu_to_le16(req->scan_plans[0].interval * MSEC_PER_SEC); 233 234 cmd->long_cycles_msec = cpu_to_le16(c->long_interval); 234 235 cmd->short_cycles_count = c->num_short_intervals; 235 236 } else { 236 237 cmd->short_cycles_msec = 0; 237 - cmd->long_cycles_msec = cpu_to_le16(req->interval); 238 + cmd->long_cycles_msec = 239 + cpu_to_le16(req->scan_plans[0].interval * MSEC_PER_SEC); 238 240 cmd->short_cycles_count = 0; 239 241 } 240 242 wl1271_debug(DEBUG_SCAN, "short_interval: %d, long_interval: %d, num_short: %d",
+5
include/linux/ieee80211.h
··· 1932 1932 WLAN_CATEGORY_HT = 7, 1933 1933 WLAN_CATEGORY_SA_QUERY = 8, 1934 1934 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1935 + WLAN_CATEGORY_WNM = 10, 1936 + WLAN_CATEGORY_WNM_UNPROTECTED = 11, 1935 1937 WLAN_CATEGORY_TDLS = 12, 1936 1938 WLAN_CATEGORY_MESH_ACTION = 13, 1937 1939 WLAN_CATEGORY_MULTIHOP_ACTION = 14, ··· 2398 2396 category = ((u8 *) hdr) + 24; 2399 2397 return *category != WLAN_CATEGORY_PUBLIC && 2400 2398 *category != WLAN_CATEGORY_HT && 2399 + *category != WLAN_CATEGORY_WNM_UNPROTECTED && 2401 2400 *category != WLAN_CATEGORY_SELF_PROTECTED && 2401 + *category != WLAN_CATEGORY_UNPROT_DMG && 2402 + *category != WLAN_CATEGORY_VHT && 2402 2403 *category != WLAN_CATEGORY_VENDOR_SPECIFIC; 2403 2404 } 2404 2405
+105 -21
include/net/cfg80211.h
··· 5 5 * 6 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * Copyright 2013-2014 Intel Mobile Communications GmbH 8 + * Copyright 2015 Intel Deutschland GmbH 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify 10 11 * it under the terms of the GNU General Public License version 2 as ··· 1502 1501 }; 1503 1502 1504 1503 /** 1504 + * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 1505 + * 1506 + * @interval: interval between scheduled scan iterations. In seconds. 1507 + * @iterations: number of scan iterations in this scan plan. Zero means 1508 + * infinite loop. 1509 + * The last scan plan will always have this parameter set to zero, 1510 + * all other scan plans will have a finite number of iterations. 1511 + */ 1512 + struct cfg80211_sched_scan_plan { 1513 + u32 interval; 1514 + u32 iterations; 1515 + }; 1516 + 1517 + /** 1505 1518 * struct cfg80211_sched_scan_request - scheduled scan request description 1506 1519 * 1507 1520 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1508 1521 * @n_ssids: number of SSIDs 1509 1522 * @n_channels: total number of channels to scan 1510 1523 * @scan_width: channel width for scanning 1511 - * @interval: interval between each scheduled scan cycle 1512 1524 * @ie: optional information element(s) to add into Probe Request or %NULL 1513 1525 * @ie_len: length of ie in octets 1514 1526 * @flags: bit field of flags controlling operation ··· 1540 1526 * @mac_addr_mask: MAC address mask used with randomisation, bits that 1541 1527 * are 0 in the mask should be randomised, bits that are 1 should 1542 1528 * be taken from the @mac_addr 1529 + * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 1530 + * index must be executed first. 1531 + * @n_scan_plans: number of scan plans, at least 1. 1543 1532 * @rcu_head: RCU callback used to free the struct 1544 1533 * @owner_nlportid: netlink portid of owner (if this should is a request 1545 1534 * owned by a particular socket) ··· 1556 1539 int n_ssids; 1557 1540 u32 n_channels; 1558 1541 enum nl80211_bss_scan_width scan_width; 1559 - u32 interval; 1560 1542 const u8 *ie; 1561 1543 size_t ie_len; 1562 1544 u32 flags; ··· 1563 1547 int n_match_sets; 1564 1548 s32 min_rssi_thold; 1565 1549 u32 delay; 1550 + struct cfg80211_sched_scan_plan *scan_plans; 1551 + int n_scan_plans; 1566 1552 1567 1553 u8 mac_addr[ETH_ALEN] __aligned(2); 1568 1554 u8 mac_addr_mask[ETH_ALEN] __aligned(2); ··· 1591 1573 CFG80211_SIGNAL_TYPE_NONE, 1592 1574 CFG80211_SIGNAL_TYPE_MBM, 1593 1575 CFG80211_SIGNAL_TYPE_UNSPEC, 1576 + }; 1577 + 1578 + /** 1579 + * struct cfg80211_inform_bss - BSS inform data 1580 + * @chan: channel the frame was received on 1581 + * @scan_width: scan width that was used 1582 + * @signal: signal strength value, according to the wiphy's 1583 + * signal type 1584 + * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 1585 + * received; should match the time when the frame was actually 1586 + * received by the device (not just by the host, in case it was 1587 + * buffered on the device) and be accurate to about 10ms. 1588 + * If the frame isn't buffered, just passing the return value of 1589 + * ktime_get_boot_ns() is likely appropriate. 1590 + */ 1591 + struct cfg80211_inform_bss { 1592 + struct ieee80211_channel *chan; 1593 + enum nl80211_bss_scan_width scan_width; 1594 + s32 signal; 1595 + u64 boottime_ns; 1594 1596 }; 1595 1597 1596 1598 /** ··· 3094 3056 * include fixed IEs like supported rates 3095 3057 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 3096 3058 * scans 3059 + * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 3060 + * of iterations) for scheduled scan supported by the device. 3061 + * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 3062 + * single scan plan supported by the device. 3063 + * @max_sched_scan_plan_iterations: maximum number of iterations for a single 3064 + * scan plan supported by the device. 3097 3065 * @coverage_class: current coverage class 3098 3066 * @fw_version: firmware version for ethtool reporting 3099 3067 * @hw_version: hardware version for ethtool reporting ··· 3207 3163 u8 max_match_sets; 3208 3164 u16 max_scan_ie_len; 3209 3165 u16 max_sched_scan_ie_len; 3166 + u32 max_sched_scan_plans; 3167 + u32 max_sched_scan_plan_interval; 3168 + u32 max_sched_scan_plan_iterations; 3210 3169 3211 3170 int n_cipher_suites; 3212 3171 const u32 *cipher_suites; ··· 4005 3958 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 4006 3959 4007 3960 /** 4008 - * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 4009 - * 3961 + * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 4010 3962 * @wiphy: the wiphy reporting the BSS 4011 - * @rx_channel: The channel the frame was received on 4012 - * @scan_width: width of the control channel 3963 + * @data: the BSS metadata 4013 3964 * @mgmt: the management frame (probe response or beacon) 4014 3965 * @len: length of the management frame 4015 - * @signal: the signal strength, type depends on the wiphy's signal_type 4016 3966 * @gfp: context flags 4017 3967 * 4018 3968 * This informs cfg80211 that BSS information was found and ··· 4019 3975 * Or %NULL on error. 4020 3976 */ 4021 3977 struct cfg80211_bss * __must_check 3978 + cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 3979 + struct cfg80211_inform_bss *data, 3980 + struct ieee80211_mgmt *mgmt, size_t len, 3981 + gfp_t gfp); 3982 + 3983 + static inline struct cfg80211_bss * __must_check 4022 3984 cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 4023 3985 struct ieee80211_channel *rx_channel, 4024 3986 enum nl80211_bss_scan_width scan_width, 4025 3987 struct ieee80211_mgmt *mgmt, size_t len, 4026 - s32 signal, gfp_t gfp); 3988 + s32 signal, gfp_t gfp) 3989 + { 3990 + struct cfg80211_inform_bss data = { 3991 + .chan = rx_channel, 3992 + .scan_width = scan_width, 3993 + .signal = signal, 3994 + }; 3995 + 3996 + return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 3997 + } 4027 3998 4028 3999 static inline struct cfg80211_bss * __must_check 4029 4000 cfg80211_inform_bss_frame(struct wiphy *wiphy, ··· 4046 3987 struct ieee80211_mgmt *mgmt, size_t len, 4047 3988 s32 signal, gfp_t gfp) 4048 3989 { 4049 - return cfg80211_inform_bss_width_frame(wiphy, rx_channel, 4050 - NL80211_BSS_CHAN_WIDTH_20, 4051 - mgmt, len, signal, gfp); 3990 + struct cfg80211_inform_bss data = { 3991 + .chan = rx_channel, 3992 + .scan_width = NL80211_BSS_CHAN_WIDTH_20, 3993 + .signal = signal, 3994 + }; 3995 + 3996 + return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4052 3997 } 4053 3998 4054 3999 /** ··· 4069 4006 }; 4070 4007 4071 4008 /** 4072 - * cfg80211_inform_bss_width - inform cfg80211 of a new BSS 4009 + * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4073 4010 * 4074 4011 * @wiphy: the wiphy reporting the BSS 4075 - * @rx_channel: The channel the frame was received on 4076 - * @scan_width: width of the control channel 4012 + * @data: the BSS metadata 4077 4013 * @ftype: frame type (if known) 4078 4014 * @bssid: the BSSID of the BSS 4079 4015 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) ··· 4080 4018 * @beacon_interval: the beacon interval announced by the peer 4081 4019 * @ie: additional IEs sent by the peer 4082 4020 * @ielen: length of the additional IEs 4083 - * @signal: the signal strength, type depends on the wiphy's signal_type 4084 4021 * @gfp: context flags 4085 4022 * 4086 4023 * This informs cfg80211 that BSS information was found and ··· 4089 4028 * Or %NULL on error. 4090 4029 */ 4091 4030 struct cfg80211_bss * __must_check 4031 + cfg80211_inform_bss_data(struct wiphy *wiphy, 4032 + struct cfg80211_inform_bss *data, 4033 + enum cfg80211_bss_frame_type ftype, 4034 + const u8 *bssid, u64 tsf, u16 capability, 4035 + u16 beacon_interval, const u8 *ie, size_t ielen, 4036 + gfp_t gfp); 4037 + 4038 + static inline struct cfg80211_bss * __must_check 4092 4039 cfg80211_inform_bss_width(struct wiphy *wiphy, 4093 4040 struct ieee80211_channel *rx_channel, 4094 4041 enum nl80211_bss_scan_width scan_width, 4095 4042 enum cfg80211_bss_frame_type ftype, 4096 4043 const u8 *bssid, u64 tsf, u16 capability, 4097 4044 u16 beacon_interval, const u8 *ie, size_t ielen, 4098 - s32 signal, gfp_t gfp); 4045 + s32 signal, gfp_t gfp) 4046 + { 4047 + struct cfg80211_inform_bss data = { 4048 + .chan = rx_channel, 4049 + .scan_width = scan_width, 4050 + .signal = signal, 4051 + }; 4052 + 4053 + return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 4054 + capability, beacon_interval, ie, ielen, 4055 + gfp); 4056 + } 4099 4057 4100 4058 static inline struct cfg80211_bss * __must_check 4101 4059 cfg80211_inform_bss(struct wiphy *wiphy, ··· 4124 4044 u16 beacon_interval, const u8 *ie, size_t ielen, 4125 4045 s32 signal, gfp_t gfp) 4126 4046 { 4127 - return cfg80211_inform_bss_width(wiphy, rx_channel, 4128 - NL80211_BSS_CHAN_WIDTH_20, ftype, 4129 - bssid, tsf, capability, 4130 - beacon_interval, ie, ielen, signal, 4131 - gfp); 4047 + struct cfg80211_inform_bss data = { 4048 + .chan = rx_channel, 4049 + .scan_width = NL80211_BSS_CHAN_WIDTH_20, 4050 + .signal = signal, 4051 + }; 4052 + 4053 + return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 4054 + capability, beacon_interval, ie, ielen, 4055 + gfp); 4132 4056 } 4133 4057 4134 4058 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
+2 -6
include/net/mac80211.h
··· 1241 1241 * @flags: configuration flags defined above 1242 1242 * 1243 1243 * @listen_interval: listen interval in units of beacon interval 1244 - * @max_sleep_period: the maximum number of beacon intervals to sleep for 1245 - * before checking the beacon for a TIM bit (managed mode only); this 1246 - * value will be only achievable between DTIM frames, the hardware 1247 - * needs to check for the multicast traffic bit in DTIM beacons. 1248 - * This variable is valid only when the CONF_PS flag is set. 1249 1244 * @ps_dtim_period: The DTIM period of the AP we're connected to, for use 1250 1245 * in power saving. Power saving will not be enabled until a beacon 1251 1246 * has been received and the DTIM period is known. ··· 1270 1275 struct ieee80211_conf { 1271 1276 u32 flags; 1272 1277 int power_level, dynamic_ps_timeout; 1273 - int max_sleep_period; 1274 1278 1275 1279 u16 listen_interval; 1276 1280 u8 ps_dtim_period; ··· 1677 1683 * @tdls: indicates whether the STA is a TDLS peer 1678 1684 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only 1679 1685 * valid if the STA is a TDLS peer in the first place. 1686 + * @mfp: indicates whether the STA uses management frame protection or not. 1680 1687 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) 1681 1688 */ 1682 1689 struct ieee80211_sta { ··· 1695 1700 struct ieee80211_sta_rates __rcu *rates; 1696 1701 bool tdls; 1697 1702 bool tdls_initiator; 1703 + bool mfp; 1698 1704 1699 1705 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS]; 1700 1706
+56 -1
include/uapi/linux/nl80211.h
··· 10 10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> 11 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 12 12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 13 + * Copyright 2015 Intel Deutschland GmbH 13 14 * 14 15 * Permission to use, copy, modify, and/or distribute this software for any 15 16 * purpose with or without fee is hereby granted, provided that the above ··· 329 328 * partial scan results may be available 330 329 * 331 330 * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain 332 - * intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL. 331 + * intervals and certain number of cycles, as specified by 332 + * %NL80211_ATTR_SCHED_SCAN_PLANS. If %NL80211_ATTR_SCHED_SCAN_PLANS is 333 + * not specified and only %NL80211_ATTR_SCHED_SCAN_INTERVAL is specified, 334 + * scheduled scan will run in an infinite loop with the specified interval. 335 + * These attributes are mutually exculsive, 336 + * i.e. NL80211_ATTR_SCHED_SCAN_INTERVAL must not be passed if 337 + * NL80211_ATTR_SCHED_SCAN_PLANS is defined. 338 + * If for some reason scheduled scan is aborted by the driver, all scan 339 + * plans are canceled (including scan plans that did not start yet). 333 340 * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) 334 341 * are passed, they are used in the probe requests. For 335 342 * broadcast, a broadcast SSID must be passed (ie. an empty ··· 1770 1761 * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device 1771 1762 * is operating in an indoor environment. 1772 1763 * 1764 + * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS: maximum number of scan plans for 1765 + * scheduled scan supported by the device (u32), a wiphy attribute. 1766 + * @NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL: maximum interval (in seconds) for 1767 + * a scan plan (u32), a wiphy attribute. 1768 + * @NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS: maximum number of iterations in 1769 + * a scan plan (u32), a wiphy attribute. 1770 + * @NL80211_ATTR_SCHED_SCAN_PLANS: a list of scan plans for scheduled scan. 1771 + * Each scan plan defines the number of scan iterations and the interval 1772 + * between scans. The last scan plan will always run infinitely, 1773 + * thus it must not specify the number of iterations, only the interval 1774 + * between scans. The scan plans are executed sequentially. 1775 + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. 1776 + * 1773 1777 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 1774 1778 * @NL80211_ATTR_MAX: highest attribute number currently defined 1775 1779 * @__NL80211_ATTR_AFTER_LAST: internal use ··· 2151 2129 NL80211_ATTR_SCHED_SCAN_DELAY, 2152 2130 2153 2131 NL80211_ATTR_REG_INDOOR, 2132 + 2133 + NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, 2134 + NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, 2135 + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, 2136 + NL80211_ATTR_SCHED_SCAN_PLANS, 2154 2137 2155 2138 /* add attributes here, update the policy in nl80211.c */ 2156 2139 ··· 3391 3364 * (not present if no beacon frame has been received yet) 3392 3365 * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and 3393 3366 * @NL80211_BSS_TSF is known to be from a probe response (flag attribute) 3367 + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry 3368 + * was last updated by a received frame. The value is expected to be 3369 + * accurate to about 10ms. (u64, nanoseconds) 3394 3370 * @__NL80211_BSS_AFTER_LAST: internal 3395 3371 * @NL80211_BSS_MAX: highest BSS attribute 3396 3372 */ ··· 3413 3383 NL80211_BSS_CHAN_WIDTH, 3414 3384 NL80211_BSS_BEACON_TSF, 3415 3385 NL80211_BSS_PRESP_DATA, 3386 + NL80211_BSS_LAST_SEEN_BOOTTIME, 3416 3387 3417 3388 /* keep last */ 3418 3389 __NL80211_BSS_AFTER_LAST, ··· 4618 4587 NL80211_TDLS_PEER_HT = 1<<0, 4619 4588 NL80211_TDLS_PEER_VHT = 1<<1, 4620 4589 NL80211_TDLS_PEER_WMM = 1<<2, 4590 + }; 4591 + 4592 + /** 4593 + * enum nl80211_sched_scan_plan - scanning plan for scheduled scan 4594 + * @__NL80211_SCHED_SCAN_PLAN_INVALID: attribute number 0 is reserved 4595 + * @NL80211_SCHED_SCAN_PLAN_INTERVAL: interval between scan iterations. In 4596 + * seconds (u32). 4597 + * @NL80211_SCHED_SCAN_PLAN_ITERATIONS: number of scan iterations in this 4598 + * scan plan (u32). The last scan plan must not specify this attribute 4599 + * because it will run infinitely. A value of zero is invalid as it will 4600 + * make the scan plan meaningless. 4601 + * @NL80211_SCHED_SCAN_PLAN_MAX: highest scheduled scan plan attribute number 4602 + * currently defined 4603 + * @__NL80211_SCHED_SCAN_PLAN_AFTER_LAST: internal use 4604 + */ 4605 + enum nl80211_sched_scan_plan { 4606 + __NL80211_SCHED_SCAN_PLAN_INVALID, 4607 + NL80211_SCHED_SCAN_PLAN_INTERVAL, 4608 + NL80211_SCHED_SCAN_PLAN_ITERATIONS, 4609 + 4610 + /* keep last */ 4611 + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST, 4612 + NL80211_SCHED_SCAN_PLAN_MAX = 4613 + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1 4621 4614 }; 4622 4615 4623 4616 #endif /* __LINUX_NL80211_H */
-1
net/mac80211/Makefile
··· 27 27 key.o \ 28 28 util.o \ 29 29 wme.o \ 30 - event.o \ 31 30 chan.o \ 32 31 trace.o mlme.o \ 33 32 tdls.o \
+3 -42
net/mac80211/cfg.c
··· 17 17 #include <net/cfg80211.h> 18 18 #include "ieee80211_i.h" 19 19 #include "driver-ops.h" 20 - #include "cfg.h" 21 20 #include "rate.h" 22 21 #include "mesh.h" 23 22 #include "wme.h" ··· 466 467 rinfo->bw = RATE_INFO_BW_20; 467 468 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) 468 469 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 469 - } 470 - 471 - void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) 472 - { 473 - rinfo->flags = 0; 474 - 475 - if (sta->last_rx_rate_flag & RX_FLAG_HT) { 476 - rinfo->flags |= RATE_INFO_FLAGS_MCS; 477 - rinfo->mcs = sta->last_rx_rate_idx; 478 - } else if (sta->last_rx_rate_flag & RX_FLAG_VHT) { 479 - rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; 480 - rinfo->nss = sta->last_rx_rate_vht_nss; 481 - rinfo->mcs = sta->last_rx_rate_idx; 482 - } else { 483 - struct ieee80211_supported_band *sband; 484 - int shift = ieee80211_vif_get_shift(&sta->sdata->vif); 485 - u16 brate; 486 - 487 - sband = sta->local->hw.wiphy->bands[ 488 - ieee80211_get_sdata_band(sta->sdata)]; 489 - brate = sband->bitrates[sta->last_rx_rate_idx].bitrate; 490 - rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 491 - } 492 - 493 - if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) 494 - rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 495 - 496 - if (sta->last_rx_rate_flag & RX_FLAG_5MHZ) 497 - rinfo->bw = RATE_INFO_BW_5; 498 - else if (sta->last_rx_rate_flag & RX_FLAG_10MHZ) 499 - rinfo->bw = RATE_INFO_BW_10; 500 - else if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) 501 - rinfo->bw = RATE_INFO_BW_40; 502 - else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) 503 - rinfo->bw = RATE_INFO_BW_80; 504 - else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) 505 - rinfo->bw = RATE_INFO_BW_160; 506 - else 507 - rinfo->bw = RATE_INFO_BW_20; 508 470 } 509 471 510 472 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, ··· 1098 1138 } 1099 1139 1100 1140 if (mask & BIT(NL80211_STA_FLAG_MFP)) { 1141 + sta->sta.mfp = !!(set & BIT(NL80211_STA_FLAG_MFP)); 1101 1142 if (set & BIT(NL80211_STA_FLAG_MFP)) 1102 1143 set_sta_flag(sta, WLAN_STA_MFP); 1103 1144 else ··· 1388 1427 1389 1428 if (sdata->vif.type == NL80211_IFTYPE_STATION && 1390 1429 params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { 1391 - ieee80211_recalc_ps(local, -1); 1430 + ieee80211_recalc_ps(local); 1392 1431 ieee80211_recalc_ps_vif(sdata); 1393 1432 } 1394 1433 ··· 2423 2462 if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) 2424 2463 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); 2425 2464 2426 - ieee80211_recalc_ps(local, -1); 2465 + ieee80211_recalc_ps(local); 2427 2466 ieee80211_recalc_ps_vif(sdata); 2428 2467 2429 2468 return 0;
-9
net/mac80211/cfg.h
··· 1 - /* 2 - * mac80211 configuration hooks for cfg80211 3 - */ 4 - #ifndef __CFG_H 5 - #define __CFG_H 6 - 7 - extern const struct cfg80211_ops mac80211_config_ops; 8 - 9 - #endif /* __CFG_H */
+3 -5
net/mac80211/debugfs_sta.c
··· 50 50 STA_OPS(name) 51 51 52 52 STA_FILE(aid, sta.aid, D); 53 - STA_FILE(last_ack_signal, last_ack_signal, D); 54 53 55 54 static ssize_t sta_flags_read(struct file *file, char __user *userbuf, 56 55 size_t count, loff_t *ppos) ··· 365 366 DEBUGFS_ADD(agg_status); 366 367 DEBUGFS_ADD(ht_capa); 367 368 DEBUGFS_ADD(vht_capa); 368 - DEBUGFS_ADD(last_ack_signal); 369 369 370 - DEBUGFS_ADD_COUNTER(rx_duplicates, num_duplicates); 371 - DEBUGFS_ADD_COUNTER(rx_fragments, rx_fragments); 372 - DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count); 370 + DEBUGFS_ADD_COUNTER(rx_duplicates, rx_stats.num_duplicates); 371 + DEBUGFS_ADD_COUNTER(rx_fragments, rx_stats.fragments); 372 + DEBUGFS_ADD_COUNTER(tx_filtered, status_stats.filtered); 373 373 374 374 if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) 375 375 debugfs_create_x32("driver_buffered_tids", 0400,
+14 -15
net/mac80211/ethtool.c
··· 40 40 "rx_duplicates", "rx_fragments", "rx_dropped", 41 41 "tx_packets", "tx_bytes", 42 42 "tx_filtered", "tx_retry_failed", "tx_retries", 43 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal", 43 + "sta_state", "txrate", "rxrate", "signal", 44 44 "channel", "noise", "ch_time", "ch_time_busy", 45 45 "ch_time_ext_busy", "ch_time_rx", "ch_time_tx" 46 46 }; ··· 77 77 78 78 memset(data, 0, sizeof(u64) * STA_STATS_LEN); 79 79 80 - #define ADD_STA_STATS(sta) \ 81 - do { \ 82 - data[i++] += sta->rx_packets; \ 83 - data[i++] += sta->rx_bytes; \ 84 - data[i++] += sta->num_duplicates; \ 85 - data[i++] += sta->rx_fragments; \ 86 - data[i++] += sta->rx_dropped; \ 87 - \ 88 - data[i++] += sinfo.tx_packets; \ 89 - data[i++] += sinfo.tx_bytes; \ 90 - data[i++] += sta->tx_filtered_count; \ 91 - data[i++] += sta->tx_retry_failed; \ 92 - data[i++] += sta->tx_retry_count; \ 93 - data[i++] += sta->beacon_loss_count; \ 80 + #define ADD_STA_STATS(sta) \ 81 + do { \ 82 + data[i++] += sta->rx_stats.packets; \ 83 + data[i++] += sta->rx_stats.bytes; \ 84 + data[i++] += sta->rx_stats.num_duplicates; \ 85 + data[i++] += sta->rx_stats.fragments; \ 86 + data[i++] += sta->rx_stats.dropped; \ 87 + \ 88 + data[i++] += sinfo.tx_packets; \ 89 + data[i++] += sinfo.tx_bytes; \ 90 + data[i++] += sta->status_stats.filtered; \ 91 + data[i++] += sta->status_stats.retry_failed; \ 92 + data[i++] += sta->status_stats.retry_count; \ 94 93 } while (0) 95 94 96 95 /* For Managed stations, find the single station based on BSSID
-27
net/mac80211/event.c
··· 1 - /* 2 - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 as 6 - * published by the Free Software Foundation. 7 - * 8 - * mac80211 - events 9 - */ 10 - #include <net/cfg80211.h> 11 - #include "ieee80211_i.h" 12 - 13 - /* 14 - * Indicate a failed Michael MIC to userspace. If the caller knows the TSC of 15 - * the frame that generated the MIC failure (i.e., if it was provided by the 16 - * driver or is still in the frame), it should provide that information. 17 - */ 18 - void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 19 - struct ieee80211_hdr *hdr, const u8 *tsc, 20 - gfp_t gfp) 21 - { 22 - cfg80211_michael_mic_failure(sdata->dev, hdr->addr2, 23 - (hdr->addr1[0] & 0x01) ? 24 - NL80211_KEYTYPE_GROUP : 25 - NL80211_KEYTYPE_PAIRWISE, 26 - keyidx, tsc, gfp); 27 - }
+13 -11
net/mac80211/ibss.c
··· 229 229 struct cfg80211_chan_def chandef; 230 230 struct ieee80211_channel *chan; 231 231 struct beacon_data *presp; 232 - enum nl80211_bss_scan_width scan_width; 232 + struct cfg80211_inform_bss bss_meta = {}; 233 233 bool have_higher_than_11mbit; 234 234 bool radar_required; 235 235 int err; ··· 383 383 mod_timer(&ifibss->timer, 384 384 round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); 385 385 386 - scan_width = cfg80211_chandef_to_scan_width(&chandef); 387 - bss = cfg80211_inform_bss_width_frame(local->hw.wiphy, chan, 388 - scan_width, mgmt, 389 - presp->head_len, 0, GFP_KERNEL); 386 + bss_meta.chan = chan; 387 + bss_meta.scan_width = cfg80211_chandef_to_scan_width(&chandef); 388 + bss = cfg80211_inform_bss_frame_data(local->hw.wiphy, &bss_meta, mgmt, 389 + presp->head_len, GFP_KERNEL); 390 + 390 391 cfg80211_put_bss(local->hw.wiphy, bss); 391 392 netif_carrier_on(sdata->dev); 392 393 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, chan, GFP_KERNEL); ··· 647 646 return NULL; 648 647 } 649 648 650 - sta->last_rx = jiffies; 649 + sta->rx_stats.last_rx = jiffies; 651 650 652 651 /* make sure mandatory rates are always added */ 653 652 sband = local->hw.wiphy->bands[band]; ··· 669 668 670 669 list_for_each_entry_rcu(sta, &local->sta_list, list) { 671 670 if (sta->sdata == sdata && 672 - time_after(sta->last_rx + IEEE80211_IBSS_MERGE_INTERVAL, 671 + time_after(sta->rx_stats.last_rx + 672 + IEEE80211_IBSS_MERGE_INTERVAL, 673 673 jiffies)) { 674 674 active++; 675 675 break; ··· 1236 1234 if (!sta) 1237 1235 return; 1238 1236 1239 - sta->last_rx = jiffies; 1237 + sta->rx_stats.last_rx = jiffies; 1240 1238 1241 1239 /* make sure mandatory rates are always added */ 1242 1240 sband = local->hw.wiphy->bands[band]; ··· 1254 1252 struct ieee80211_local *local = sdata->local; 1255 1253 struct sta_info *sta, *tmp; 1256 1254 unsigned long exp_time = IEEE80211_IBSS_INACTIVITY_LIMIT; 1257 - unsigned long exp_rsn_time = IEEE80211_IBSS_RSN_INACTIVITY_LIMIT; 1255 + unsigned long exp_rsn = IEEE80211_IBSS_RSN_INACTIVITY_LIMIT; 1258 1256 1259 1257 mutex_lock(&local->sta_mtx); 1260 1258 ··· 1262 1260 if (sdata != sta->sdata) 1263 1261 continue; 1264 1262 1265 - if (time_after(jiffies, sta->last_rx + exp_time) || 1266 - (time_after(jiffies, sta->last_rx + exp_rsn_time) && 1263 + if (time_after(jiffies, sta->rx_stats.last_rx + exp_time) || 1264 + (time_after(jiffies, sta->rx_stats.last_rx + exp_rsn) && 1267 1265 sta->sta_state != IEEE80211_STA_AUTHORIZED)) { 1268 1266 sta_dbg(sta->sdata, "expiring inactive %sSTA %pM\n", 1269 1267 sta->sta_state != IEEE80211_STA_AUTHORIZED ?
+6 -7
net/mac80211/ieee80211_i.h
··· 34 34 #include "sta_info.h" 35 35 #include "debug.h" 36 36 37 + extern const struct cfg80211_ops mac80211_config_ops; 38 + 37 39 struct ieee80211_local; 38 40 39 41 /* Maximum number of broadcast/multicast frames to buffer when some of the ··· 502 500 * only on couple of received frames. 503 501 */ 504 502 unsigned int count_beacon_signal; 503 + 504 + /* Number of times beacon loss was invoked. */ 505 + unsigned int beacon_loss_count; 505 506 506 507 /* 507 508 * Last Beacon frame signal strength average (ave_beacon_signal / 16) ··· 1310 1305 struct work_struct dynamic_ps_enable_work; 1311 1306 struct work_struct dynamic_ps_disable_work; 1312 1307 struct timer_list dynamic_ps_timer; 1313 - struct notifier_block network_latency_notifier; 1314 1308 struct notifier_block ifa_notifier; 1315 1309 struct notifier_block ifa6_notifier; 1316 1310 ··· 1495 1491 struct cfg80211_disassoc_request *req); 1496 1492 void ieee80211_send_pspoll(struct ieee80211_local *local, 1497 1493 struct ieee80211_sub_if_data *sdata); 1498 - void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 1494 + void ieee80211_recalc_ps(struct ieee80211_local *local); 1499 1495 void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 1500 - int ieee80211_max_network_latency(struct notifier_block *nb, 1501 - unsigned long data, void *dummy); 1502 1496 int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 1503 1497 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 1504 1498 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, ··· 1768 1766 int ieee80211_frame_duration(enum ieee80211_band band, size_t len, 1769 1767 int rate, int erp, int short_preamble, 1770 1768 int shift); 1771 - void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1772 - struct ieee80211_hdr *hdr, const u8 *tsc, 1773 - gfp_t gfp); 1774 1769 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, 1775 1770 bool bss_notify); 1776 1771 void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
+2 -2
net/mac80211/iface.c
··· 709 709 if (hw_reconf_flags) 710 710 ieee80211_hw_config(local, hw_reconf_flags); 711 711 712 - ieee80211_recalc_ps(local, -1); 712 + ieee80211_recalc_ps(local); 713 713 714 714 if (sdata->vif.type == NL80211_IFTYPE_MONITOR || 715 715 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { ··· 1016 1016 drv_remove_interface(local, sdata); 1017 1017 } 1018 1018 1019 - ieee80211_recalc_ps(local, -1); 1019 + ieee80211_recalc_ps(local); 1020 1020 1021 1021 if (cancel_scan) 1022 1022 flush_delayed_work(&local->scan_work);
-14
net/mac80211/main.c
··· 20 20 #include <linux/if_arp.h> 21 21 #include <linux/rtnetlink.h> 22 22 #include <linux/bitmap.h> 23 - #include <linux/pm_qos.h> 24 23 #include <linux/inetdevice.h> 25 24 #include <net/net_namespace.h> 26 25 #include <net/cfg80211.h> ··· 31 32 #include "mesh.h" 32 33 #include "wep.h" 33 34 #include "led.h" 34 - #include "cfg.h" 35 35 #include "debugfs.h" 36 36 37 37 void ieee80211_configure_filter(struct ieee80211_local *local) ··· 1081 1083 1082 1084 rtnl_unlock(); 1083 1085 1084 - local->network_latency_notifier.notifier_call = 1085 - ieee80211_max_network_latency; 1086 - result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY, 1087 - &local->network_latency_notifier); 1088 - if (result) 1089 - goto fail_pm_qos; 1090 - 1091 1086 #ifdef CONFIG_INET 1092 1087 local->ifa_notifier.notifier_call = ieee80211_ifa_changed; 1093 1088 result = register_inetaddr_notifier(&local->ifa_notifier); ··· 1105 1114 #endif 1106 1115 #if defined(CONFIG_INET) || defined(CONFIG_IPV6) 1107 1116 fail_ifa: 1108 - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY, 1109 - &local->network_latency_notifier); 1110 1117 #endif 1111 - fail_pm_qos: 1112 1118 rtnl_lock(); 1113 1119 rate_control_deinitialize(local); 1114 1120 ieee80211_remove_interfaces(local); ··· 1131 1143 tasklet_kill(&local->tx_pending_tasklet); 1132 1144 tasklet_kill(&local->tasklet); 1133 1145 1134 - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY, 1135 - &local->network_latency_notifier); 1136 1146 #ifdef CONFIG_INET 1137 1147 unregister_inetaddr_notifier(&local->ifa_notifier); 1138 1148 #endif
+1 -1
net/mac80211/mesh_hwmp.c
··· 329 329 if (sta->mesh->fail_avg >= 100) 330 330 return MAX_METRIC; 331 331 332 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &rinfo); 332 + sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); 333 333 rate = cfg80211_calculate_bitrate(&rinfo); 334 334 if (WARN_ON(!rate)) 335 335 return MAX_METRIC;
+4 -2
net/mac80211/mesh_plink.c
··· 60 60 { 61 61 s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold; 62 62 return rssi_threshold == 0 || 63 - (sta && (s8) -ewma_signal_read(&sta->avg_signal) > rssi_threshold); 63 + (sta && 64 + (s8)-ewma_signal_read(&sta->rx_stats.avg_signal) > 65 + rssi_threshold); 64 66 } 65 67 66 68 /** ··· 392 390 rates = ieee80211_sta_get_rates(sdata, elems, band, &basic_rates); 393 391 394 392 spin_lock_bh(&sta->mesh->plink_lock); 395 - sta->last_rx = jiffies; 393 + sta->rx_stats.last_rx = jiffies; 396 394 397 395 /* rates and capabilities don't change during peering */ 398 396 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB &&
+20 -63
net/mac80211/mlme.c
··· 20 20 #include <linux/etherdevice.h> 21 21 #include <linux/moduleparam.h> 22 22 #include <linux/rtnetlink.h> 23 - #include <linux/pm_qos.h> 24 23 #include <linux/crc32.h> 25 24 #include <linux/slab.h> 26 25 #include <linux/export.h> ··· 1475 1476 } 1476 1477 1477 1478 /* need to hold RTNL or interface lock */ 1478 - void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) 1479 + void ieee80211_recalc_ps(struct ieee80211_local *local) 1479 1480 { 1480 1481 struct ieee80211_sub_if_data *sdata, *found = NULL; 1481 1482 int count = 0; ··· 1504 1505 } 1505 1506 1506 1507 if (count == 1 && ieee80211_powersave_allowed(found)) { 1508 + u8 dtimper = found->u.mgd.dtim_period; 1507 1509 s32 beaconint_us; 1508 - 1509 - if (latency < 0) 1510 - latency = pm_qos_request(PM_QOS_NETWORK_LATENCY); 1511 1510 1512 1511 beaconint_us = ieee80211_tu_to_usec( 1513 1512 found->vif.bss_conf.beacon_int); 1514 1513 1515 1514 timeout = local->dynamic_ps_forced_timeout; 1516 - if (timeout < 0) { 1517 - /* 1518 - * Go to full PSM if the user configures a very low 1519 - * latency requirement. 1520 - * The 2000 second value is there for compatibility 1521 - * until the PM_QOS_NETWORK_LATENCY is configured 1522 - * with real values. 1523 - */ 1524 - if (latency > (1900 * USEC_PER_MSEC) && 1525 - latency != (2000 * USEC_PER_SEC)) 1526 - timeout = 0; 1527 - else 1528 - timeout = 100; 1529 - } 1515 + if (timeout < 0) 1516 + timeout = 100; 1530 1517 local->hw.conf.dynamic_ps_timeout = timeout; 1531 1518 1532 - if (beaconint_us > latency) { 1533 - local->ps_sdata = NULL; 1534 - } else { 1535 - int maxslp = 1; 1536 - u8 dtimper = found->u.mgd.dtim_period; 1519 + /* If the TIM IE is invalid, pretend the value is 1 */ 1520 + if (!dtimper) 1521 + dtimper = 1; 1537 1522 1538 - /* If the TIM IE is invalid, pretend the value is 1 */ 1539 - if (!dtimper) 1540 - dtimper = 1; 1541 - else if (dtimper > 1) 1542 - maxslp = min_t(int, dtimper, 1543 - latency / beaconint_us); 1544 - 1545 - local->hw.conf.max_sleep_period = maxslp; 1546 - local->hw.conf.ps_dtim_period = dtimper; 1547 - local->ps_sdata = found; 1548 - } 1523 + local->hw.conf.ps_dtim_period = dtimper; 1524 + local->ps_sdata = found; 1549 1525 } else { 1550 1526 local->ps_sdata = NULL; 1551 1527 } ··· 1971 1997 ieee80211_bss_info_change_notify(sdata, bss_info_changed); 1972 1998 1973 1999 mutex_lock(&local->iflist_mtx); 1974 - ieee80211_recalc_ps(local, -1); 2000 + ieee80211_recalc_ps(local); 1975 2001 mutex_unlock(&local->iflist_mtx); 1976 2002 1977 2003 ieee80211_recalc_smps(sdata); ··· 2139 2165 __ieee80211_stop_poll(sdata); 2140 2166 2141 2167 mutex_lock(&local->iflist_mtx); 2142 - ieee80211_recalc_ps(local, -1); 2168 + ieee80211_recalc_ps(local); 2143 2169 mutex_unlock(&local->iflist_mtx); 2144 2170 2145 2171 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) ··· 2315 2341 goto out; 2316 2342 2317 2343 mutex_lock(&sdata->local->iflist_mtx); 2318 - ieee80211_recalc_ps(sdata->local, -1); 2344 + ieee80211_recalc_ps(sdata->local); 2319 2345 mutex_unlock(&sdata->local->iflist_mtx); 2320 2346 2321 2347 ifmgd->probe_send_count = 0; ··· 2420 2446 container_of(work, struct ieee80211_sub_if_data, 2421 2447 u.mgd.beacon_connection_loss_work); 2422 2448 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2423 - struct sta_info *sta; 2424 2449 2425 - if (ifmgd->associated) { 2426 - rcu_read_lock(); 2427 - sta = sta_info_get(sdata, ifmgd->bssid); 2428 - if (sta) 2429 - sta->beacon_loss_count++; 2430 - rcu_read_unlock(); 2431 - } 2450 + if (ifmgd->associated) 2451 + ifmgd->beacon_loss_count++; 2432 2452 2433 2453 if (ifmgd->connection_loss) { 2434 2454 sdata_info(sdata, "Connection to AP %pM lost\n", ··· 3012 3044 3013 3045 rate_control_rate_init(sta); 3014 3046 3015 - if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) 3047 + if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { 3016 3048 set_sta_flag(sta, WLAN_STA_MFP); 3049 + sta->sta.mfp = true; 3050 + } else { 3051 + sta->sta.mfp = false; 3052 + } 3017 3053 3018 3054 sta->sta.wme = elems.wmm_param && local->hw.queues >= IEEE80211_NUM_ACS; 3019 3055 ··· 3516 3544 ifmgd->have_beacon = true; 3517 3545 3518 3546 mutex_lock(&local->iflist_mtx); 3519 - ieee80211_recalc_ps(local, -1); 3547 + ieee80211_recalc_ps(local); 3520 3548 mutex_unlock(&local->iflist_mtx); 3521 3549 3522 3550 ieee80211_recalc_ps_vif(sdata); ··· 4118 4146 ieee80211_restart_sta_timer(sdata); 4119 4147 } 4120 4148 rcu_read_unlock(); 4121 - } 4122 - 4123 - int ieee80211_max_network_latency(struct notifier_block *nb, 4124 - unsigned long data, void *dummy) 4125 - { 4126 - s32 latency_usec = (s32) data; 4127 - struct ieee80211_local *local = 4128 - container_of(nb, struct ieee80211_local, 4129 - network_latency_notifier); 4130 - 4131 - mutex_lock(&local->iflist_mtx); 4132 - ieee80211_recalc_ps(local, latency_usec); 4133 - mutex_unlock(&local->iflist_mtx); 4134 - 4135 - return NOTIFY_OK; 4136 4149 } 4137 4150 4138 4151 static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
+1 -1
net/mac80211/ocb.c
··· 75 75 if (!sta) 76 76 return; 77 77 78 - sta->last_rx = jiffies; 78 + sta->rx_stats.last_rx = jiffies; 79 79 80 80 /* Add only mandatory rates for now */ 81 81 sband = local->hw.wiphy->bands[band];
+43 -38
net/mac80211/rx.c
··· 1113 1113 is_multicast_ether_addr(hdr->addr1)) 1114 1114 return RX_CONTINUE; 1115 1115 1116 - if (rx->sta) { 1117 - if (unlikely(ieee80211_has_retry(hdr->frame_control) && 1118 - rx->sta->last_seq_ctrl[rx->seqno_idx] == 1119 - hdr->seq_ctrl)) { 1120 - I802_DEBUG_INC(rx->local->dot11FrameDuplicateCount); 1121 - rx->sta->num_duplicates++; 1122 - return RX_DROP_UNUSABLE; 1123 - } else if (!(status->flag & RX_FLAG_AMSDU_MORE)) { 1124 - rx->sta->last_seq_ctrl[rx->seqno_idx] = hdr->seq_ctrl; 1125 - } 1116 + if (!rx->sta) 1117 + return RX_CONTINUE; 1118 + 1119 + if (unlikely(ieee80211_has_retry(hdr->frame_control) && 1120 + rx->sta->last_seq_ctrl[rx->seqno_idx] == hdr->seq_ctrl)) { 1121 + I802_DEBUG_INC(rx->local->dot11FrameDuplicateCount); 1122 + rx->sta->rx_stats.num_duplicates++; 1123 + return RX_DROP_UNUSABLE; 1124 + } else if (!(status->flag & RX_FLAG_AMSDU_MORE)) { 1125 + rx->sta->last_seq_ctrl[rx->seqno_idx] = hdr->seq_ctrl; 1126 1126 } 1127 1127 1128 1128 return RX_CONTINUE; ··· 1396 1396 NL80211_IFTYPE_ADHOC); 1397 1397 if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) && 1398 1398 test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { 1399 - sta->last_rx = jiffies; 1399 + sta->rx_stats.last_rx = jiffies; 1400 1400 if (ieee80211_is_data(hdr->frame_control) && 1401 1401 !is_multicast_ether_addr(hdr->addr1)) { 1402 - sta->last_rx_rate_idx = status->rate_idx; 1403 - sta->last_rx_rate_flag = status->flag; 1404 - sta->last_rx_rate_vht_flag = status->vht_flag; 1405 - sta->last_rx_rate_vht_nss = status->vht_nss; 1402 + sta->rx_stats.last_rate_idx = 1403 + status->rate_idx; 1404 + sta->rx_stats.last_rate_flag = 1405 + status->flag; 1406 + sta->rx_stats.last_rate_vht_flag = 1407 + status->vht_flag; 1408 + sta->rx_stats.last_rate_vht_nss = 1409 + status->vht_nss; 1406 1410 } 1407 1411 } 1408 1412 } else if (rx->sdata->vif.type == NL80211_IFTYPE_OCB) { 1409 - sta->last_rx = jiffies; 1413 + sta->rx_stats.last_rx = jiffies; 1410 1414 } else if (!is_multicast_ether_addr(hdr->addr1)) { 1411 1415 /* 1412 1416 * Mesh beacons will update last_rx when if they are found to 1413 1417 * match the current local configuration when processed. 1414 1418 */ 1415 - sta->last_rx = jiffies; 1419 + sta->rx_stats.last_rx = jiffies; 1416 1420 if (ieee80211_is_data(hdr->frame_control)) { 1417 - sta->last_rx_rate_idx = status->rate_idx; 1418 - sta->last_rx_rate_flag = status->flag; 1419 - sta->last_rx_rate_vht_flag = status->vht_flag; 1420 - sta->last_rx_rate_vht_nss = status->vht_nss; 1421 + sta->rx_stats.last_rate_idx = status->rate_idx; 1422 + sta->rx_stats.last_rate_flag = status->flag; 1423 + sta->rx_stats.last_rate_vht_flag = status->vht_flag; 1424 + sta->rx_stats.last_rate_vht_nss = status->vht_nss; 1421 1425 } 1422 1426 } 1423 1427 1424 1428 if (rx->sdata->vif.type == NL80211_IFTYPE_STATION) 1425 1429 ieee80211_sta_rx_notify(rx->sdata, hdr); 1426 1430 1427 - sta->rx_fragments++; 1428 - sta->rx_bytes += rx->skb->len; 1431 + sta->rx_stats.fragments++; 1432 + sta->rx_stats.bytes += rx->skb->len; 1429 1433 if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { 1430 - sta->last_signal = status->signal; 1431 - ewma_signal_add(&sta->avg_signal, -status->signal); 1434 + sta->rx_stats.last_signal = status->signal; 1435 + ewma_signal_add(&sta->rx_stats.avg_signal, -status->signal); 1432 1436 } 1433 1437 1434 1438 if (status->chains) { 1435 - sta->chains = status->chains; 1439 + sta->rx_stats.chains = status->chains; 1436 1440 for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) { 1437 1441 int signal = status->chain_signal[i]; 1438 1442 1439 1443 if (!(status->chains & BIT(i))) 1440 1444 continue; 1441 1445 1442 - sta->chain_signal_last[i] = signal; 1443 - ewma_signal_add(&sta->chain_signal_avg[i], -signal); 1446 + sta->rx_stats.chain_signal_last[i] = signal; 1447 + ewma_signal_add(&sta->rx_stats.chain_signal_avg[i], 1448 + -signal); 1444 1449 } 1445 1450 } 1446 1451 ··· 1505 1500 * Update counter and free packet here to avoid 1506 1501 * counting this as a dropped packed. 1507 1502 */ 1508 - sta->rx_packets++; 1503 + sta->rx_stats.packets++; 1509 1504 dev_kfree_skb(rx->skb); 1510 1505 return RX_QUEUED; 1511 1506 } ··· 1927 1922 ieee80211_led_rx(rx->local); 1928 1923 out_no_led: 1929 1924 if (rx->sta) 1930 - rx->sta->rx_packets++; 1925 + rx->sta->rx_stats.packets++; 1931 1926 return RX_CONTINUE; 1932 1927 } 1933 1928 ··· 2381 2376 * for non-QoS-data frames. Here we know it's a data 2382 2377 * frame, so count MSDUs. 2383 2378 */ 2384 - rx->sta->rx_msdu[rx->seqno_idx]++; 2379 + rx->sta->rx_stats.msdu[rx->seqno_idx]++; 2385 2380 } 2386 2381 2387 2382 /* ··· 2418 2413 skb_queue_tail(&local->skb_queue_tdls_chsw, rx->skb); 2419 2414 schedule_work(&local->tdls_chsw_work); 2420 2415 if (rx->sta) 2421 - rx->sta->rx_packets++; 2416 + rx->sta->rx_stats.packets++; 2422 2417 2423 2418 return RX_QUEUED; 2424 2419 } ··· 2880 2875 2881 2876 handled: 2882 2877 if (rx->sta) 2883 - rx->sta->rx_packets++; 2878 + rx->sta->rx_stats.packets++; 2884 2879 dev_kfree_skb(rx->skb); 2885 2880 return RX_QUEUED; 2886 2881 ··· 2889 2884 skb_queue_tail(&sdata->skb_queue, rx->skb); 2890 2885 ieee80211_queue_work(&local->hw, &sdata->work); 2891 2886 if (rx->sta) 2892 - rx->sta->rx_packets++; 2887 + rx->sta->rx_stats.packets++; 2893 2888 return RX_QUEUED; 2894 2889 } 2895 2890 ··· 2916 2911 if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, 2917 2912 rx->skb->data, rx->skb->len, 0)) { 2918 2913 if (rx->sta) 2919 - rx->sta->rx_packets++; 2914 + rx->sta->rx_stats.packets++; 2920 2915 dev_kfree_skb(rx->skb); 2921 2916 return RX_QUEUED; 2922 2917 } ··· 3035 3030 skb_queue_tail(&sdata->skb_queue, rx->skb); 3036 3031 ieee80211_queue_work(&rx->local->hw, &sdata->work); 3037 3032 if (rx->sta) 3038 - rx->sta->rx_packets++; 3033 + rx->sta->rx_stats.packets++; 3039 3034 3040 3035 return RX_QUEUED; 3041 3036 } ··· 3117 3112 case RX_DROP_MONITOR: 3118 3113 I802_DEBUG_INC(rx->sdata->local->rx_handlers_drop); 3119 3114 if (rx->sta) 3120 - rx->sta->rx_dropped++; 3115 + rx->sta->rx_stats.dropped++; 3121 3116 /* fall through */ 3122 3117 case RX_CONTINUE: { 3123 3118 struct ieee80211_rate *rate = NULL; ··· 3137 3132 case RX_DROP_UNUSABLE: 3138 3133 I802_DEBUG_INC(rx->sdata->local->rx_handlers_drop); 3139 3134 if (rx->sta) 3140 - rx->sta->rx_dropped++; 3135 + rx->sta->rx_stats.dropped++; 3141 3136 dev_kfree_skb(rx->skb); 3142 3137 break; 3143 3138 case RX_QUEUED:
+9 -11
net/mac80211/scan.c
··· 16 16 #include <linux/if_arp.h> 17 17 #include <linux/etherdevice.h> 18 18 #include <linux/rtnetlink.h> 19 - #include <linux/pm_qos.h> 20 19 #include <net/sch_generic.h> 21 20 #include <linux/slab.h> 22 21 #include <linux/export.h> ··· 66 67 struct cfg80211_bss *cbss; 67 68 struct ieee80211_bss *bss; 68 69 int clen, srlen; 69 - enum nl80211_bss_scan_width scan_width; 70 - s32 signal = 0; 70 + struct cfg80211_inform_bss bss_meta = {}; 71 71 bool signal_valid; 72 72 73 73 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) 74 - signal = rx_status->signal * 100; 74 + bss_meta.signal = rx_status->signal * 100; 75 75 else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) 76 - signal = (rx_status->signal * 100) / local->hw.max_signal; 76 + bss_meta.signal = (rx_status->signal * 100) / local->hw.max_signal; 77 77 78 - scan_width = NL80211_BSS_CHAN_WIDTH_20; 78 + bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_20; 79 79 if (rx_status->flag & RX_FLAG_5MHZ) 80 - scan_width = NL80211_BSS_CHAN_WIDTH_5; 80 + bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_5; 81 81 if (rx_status->flag & RX_FLAG_10MHZ) 82 - scan_width = NL80211_BSS_CHAN_WIDTH_10; 82 + bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_10; 83 83 84 - cbss = cfg80211_inform_bss_width_frame(local->hw.wiphy, channel, 85 - scan_width, mgmt, len, signal, 86 - GFP_ATOMIC); 84 + bss_meta.chan = channel; 85 + cbss = cfg80211_inform_bss_frame_data(local->hw.wiphy, &bss_meta, 86 + mgmt, len, GFP_ATOMIC); 87 87 if (!cbss) 88 88 return NULL; 89 89 /* In case the signal is invalid update the status */
+74 -27
net/mac80211/sta_info.c
··· 331 331 memcpy(sta->sta.addr, addr, ETH_ALEN); 332 332 sta->local = local; 333 333 sta->sdata = sdata; 334 - sta->last_rx = jiffies; 334 + sta->rx_stats.last_rx = jiffies; 335 335 336 336 sta->sta_state = IEEE80211_STA_NONE; 337 337 ··· 339 339 sta->reserved_tid = IEEE80211_TID_UNRESERVED; 340 340 341 341 sta->last_connected = ktime_get_seconds(); 342 - ewma_signal_init(&sta->avg_signal); 343 - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) 344 - ewma_signal_init(&sta->chain_signal_avg[i]); 342 + ewma_signal_init(&sta->rx_stats.avg_signal); 343 + for (i = 0; i < ARRAY_SIZE(sta->rx_stats.chain_signal_avg); i++) 344 + ewma_signal_init(&sta->rx_stats.chain_signal_avg[i]); 345 345 346 346 if (local->ops->wake_tx_queue) { 347 347 void *txq_data; ··· 1066 1066 if (sdata != sta->sdata) 1067 1067 continue; 1068 1068 1069 - if (time_after(jiffies, sta->last_rx + exp_time)) { 1069 + if (time_after(jiffies, sta->rx_stats.last_rx + exp_time)) { 1070 1070 sta_dbg(sta->sdata, "expiring inactive STA %pM\n", 1071 1071 sta->sta.addr); 1072 1072 ··· 1806 1806 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1; 1807 1807 } 1808 1808 1809 + static void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) 1810 + { 1811 + rinfo->flags = 0; 1812 + 1813 + if (sta->rx_stats.last_rate_flag & RX_FLAG_HT) { 1814 + rinfo->flags |= RATE_INFO_FLAGS_MCS; 1815 + rinfo->mcs = sta->rx_stats.last_rate_idx; 1816 + } else if (sta->rx_stats.last_rate_flag & RX_FLAG_VHT) { 1817 + rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; 1818 + rinfo->nss = sta->rx_stats.last_rate_vht_nss; 1819 + rinfo->mcs = sta->rx_stats.last_rate_idx; 1820 + } else { 1821 + struct ieee80211_supported_band *sband; 1822 + int shift = ieee80211_vif_get_shift(&sta->sdata->vif); 1823 + u16 brate; 1824 + 1825 + sband = sta->local->hw.wiphy->bands[ 1826 + ieee80211_get_sdata_band(sta->sdata)]; 1827 + brate = sband->bitrates[sta->rx_stats.last_rate_idx].bitrate; 1828 + rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 1829 + } 1830 + 1831 + if (sta->rx_stats.last_rate_flag & RX_FLAG_SHORT_GI) 1832 + rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 1833 + 1834 + if (sta->rx_stats.last_rate_flag & RX_FLAG_5MHZ) 1835 + rinfo->bw = RATE_INFO_BW_5; 1836 + else if (sta->rx_stats.last_rate_flag & RX_FLAG_10MHZ) 1837 + rinfo->bw = RATE_INFO_BW_10; 1838 + else if (sta->rx_stats.last_rate_flag & RX_FLAG_40MHZ) 1839 + rinfo->bw = RATE_INFO_BW_40; 1840 + else if (sta->rx_stats.last_rate_vht_flag & RX_VHT_FLAG_80MHZ) 1841 + rinfo->bw = RATE_INFO_BW_80; 1842 + else if (sta->rx_stats.last_rate_vht_flag & RX_VHT_FLAG_160MHZ) 1843 + rinfo->bw = RATE_INFO_BW_160; 1844 + else 1845 + rinfo->bw = RATE_INFO_BW_20; 1846 + } 1847 + 1809 1848 void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 1810 1849 { 1811 1850 struct ieee80211_sub_if_data *sdata = sta->sdata; ··· 1871 1832 BIT(NL80211_STA_INFO_STA_FLAGS) | 1872 1833 BIT(NL80211_STA_INFO_BSS_PARAM) | 1873 1834 BIT(NL80211_STA_INFO_CONNECTED_TIME) | 1874 - BIT(NL80211_STA_INFO_RX_DROP_MISC) | 1875 - BIT(NL80211_STA_INFO_BEACON_LOSS); 1835 + BIT(NL80211_STA_INFO_RX_DROP_MISC); 1836 + 1837 + if (sdata->vif.type == NL80211_IFTYPE_STATION) { 1838 + sinfo->beacon_loss_count = sdata->u.mgd.beacon_loss_count; 1839 + sinfo->filled |= BIT(NL80211_STA_INFO_BEACON_LOSS); 1840 + } 1876 1841 1877 1842 sinfo->connected_time = ktime_get_seconds() - sta->last_connected; 1878 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); 1843 + sinfo->inactive_time = 1844 + jiffies_to_msecs(jiffies - sta->rx_stats.last_rx); 1879 1845 1880 1846 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES64) | 1881 1847 BIT(NL80211_STA_INFO_TX_BYTES)))) { 1882 1848 sinfo->tx_bytes = 0; 1883 1849 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1884 - sinfo->tx_bytes += sta->tx_bytes[ac]; 1850 + sinfo->tx_bytes += sta->tx_stats.bytes[ac]; 1885 1851 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64); 1886 1852 } 1887 1853 1888 1854 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_PACKETS))) { 1889 1855 sinfo->tx_packets = 0; 1890 1856 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1891 - sinfo->tx_packets += sta->tx_packets[ac]; 1857 + sinfo->tx_packets += sta->tx_stats.packets[ac]; 1892 1858 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS); 1893 1859 } 1894 1860 1895 1861 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) | 1896 1862 BIT(NL80211_STA_INFO_RX_BYTES)))) { 1897 - sinfo->rx_bytes = sta->rx_bytes; 1863 + sinfo->rx_bytes = sta->rx_stats.bytes; 1898 1864 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64); 1899 1865 } 1900 1866 1901 1867 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_PACKETS))) { 1902 - sinfo->rx_packets = sta->rx_packets; 1868 + sinfo->rx_packets = sta->rx_stats.packets; 1903 1869 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS); 1904 1870 } 1905 1871 1906 1872 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_RETRIES))) { 1907 - sinfo->tx_retries = sta->tx_retry_count; 1873 + sinfo->tx_retries = sta->status_stats.retry_count; 1908 1874 sinfo->filled |= BIT(NL80211_STA_INFO_TX_RETRIES); 1909 1875 } 1910 1876 1911 1877 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_FAILED))) { 1912 - sinfo->tx_failed = sta->tx_retry_failed; 1878 + sinfo->tx_failed = sta->status_stats.retry_failed; 1913 1879 sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED); 1914 1880 } 1915 1881 1916 - sinfo->rx_dropped_misc = sta->rx_dropped; 1917 - sinfo->beacon_loss_count = sta->beacon_loss_count; 1882 + sinfo->rx_dropped_misc = sta->rx_stats.dropped; 1918 1883 1919 1884 if (sdata->vif.type == NL80211_IFTYPE_STATION && 1920 1885 !(sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)) { ··· 1930 1887 if (ieee80211_hw_check(&sta->local->hw, SIGNAL_DBM) || 1931 1888 ieee80211_hw_check(&sta->local->hw, SIGNAL_UNSPEC)) { 1932 1889 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL))) { 1933 - sinfo->signal = (s8)sta->last_signal; 1890 + sinfo->signal = (s8)sta->rx_stats.last_signal; 1934 1891 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); 1935 1892 } 1936 1893 1937 1894 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) { 1938 1895 sinfo->signal_avg = 1939 - (s8) -ewma_signal_read(&sta->avg_signal); 1896 + -ewma_signal_read(&sta->rx_stats.avg_signal); 1940 1897 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG); 1941 1898 } 1942 1899 } 1943 1900 1944 - if (sta->chains && 1901 + if (sta->rx_stats.chains && 1945 1902 !(sinfo->filled & (BIT(NL80211_STA_INFO_CHAIN_SIGNAL) | 1946 1903 BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) { 1947 1904 sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL) | 1948 1905 BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); 1949 1906 1950 - sinfo->chains = sta->chains; 1907 + sinfo->chains = sta->rx_stats.chains; 1951 1908 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { 1952 - sinfo->chain_signal[i] = sta->chain_signal_last[i]; 1909 + sinfo->chain_signal[i] = 1910 + sta->rx_stats.chain_signal_last[i]; 1953 1911 sinfo->chain_signal_avg[i] = 1954 - (s8) -ewma_signal_read(&sta->chain_signal_avg[i]); 1912 + -ewma_signal_read(&sta->rx_stats.chain_signal_avg[i]); 1955 1913 } 1956 1914 } 1957 1915 1958 1916 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) { 1959 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); 1917 + sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, 1918 + &sinfo->txrate); 1960 1919 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); 1961 1920 } 1962 1921 ··· 1973 1928 1974 1929 if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { 1975 1930 tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU); 1976 - tidstats->rx_msdu = sta->rx_msdu[i]; 1931 + tidstats->rx_msdu = sta->rx_stats.msdu[i]; 1977 1932 } 1978 1933 1979 1934 if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU))) { 1980 1935 tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU); 1981 - tidstats->tx_msdu = sta->tx_msdu[i]; 1936 + tidstats->tx_msdu = sta->tx_stats.msdu[i]; 1982 1937 } 1983 1938 1984 1939 if (!(tidstats->filled & ··· 1986 1941 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { 1987 1942 tidstats->filled |= 1988 1943 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES); 1989 - tidstats->tx_msdu_retries = sta->tx_msdu_retries[i]; 1944 + tidstats->tx_msdu_retries = 1945 + sta->status_stats.msdu_retries[i]; 1990 1946 } 1991 1947 1992 1948 if (!(tidstats->filled & ··· 1995 1949 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { 1996 1950 tidstats->filled |= 1997 1951 BIT(NL80211_TID_STATS_TX_MSDU_FAILED); 1998 - tidstats->tx_msdu_failed = sta->tx_msdu_failed[i]; 1952 + tidstats->tx_msdu_failed = 1953 + sta->status_stats.msdu_failed[i]; 1999 1954 } 2000 1955 } 2001 1956
+36 -67
net/mac80211/sta_info.h
··· 344 344 * @rate_ctrl_lock: spinlock used to protect rate control data 345 345 * (data inside the algorithm, so serializes calls there) 346 346 * @rate_ctrl_priv: rate control private per-STA pointer 347 - * @last_tx_rate: rate used for last transmit, to report to userspace as 348 - * "the" transmit rate 349 - * @last_rx_rate_idx: rx status rate index of the last data packet 350 - * @last_rx_rate_flag: rx status flag of the last data packet 351 - * @last_rx_rate_vht_flag: rx status vht flag of the last data packet 352 - * @last_rx_rate_vht_nss: rx status nss of last data packet 353 347 * @lock: used for locking all fields that require locking, see comments 354 348 * in the header file. 355 349 * @drv_deliver_wk: used for delivering frames after driver PS unblocking ··· 358 364 * the station when it leaves powersave or polls for frames 359 365 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on 360 366 * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on 361 - * @rx_packets: Number of MSDUs received from this STA 362 - * @rx_bytes: Number of bytes received from this STA 363 - * @last_rx: time (in jiffies) when last frame was received from this STA 364 367 * @last_connected: time (in seconds) when a station got connected 365 - * @num_duplicates: number of duplicate frames received from this STA 366 - * @rx_fragments: number of received MPDUs 367 - * @rx_dropped: number of dropped MPDUs from this STA 368 - * @last_signal: signal of last received frame from this STA 369 - * @avg_signal: moving average of signal of received frames from this STA 370 - * @last_ack_signal: signal of last received Ack frame from this STA 371 368 * @last_seq_ctrl: last received seq/frag number from this STA (per TID 372 369 * plus one for non-QoS frames) 373 - * @tx_filtered_count: number of frames the hardware filtered for this STA 374 - * @tx_retry_failed: number of frames that failed retry 375 - * @tx_retry_count: total number of retries for frames to this STA 376 - * @tx_packets: number of RX/TX MSDUs 377 - * @tx_bytes: number of bytes transmitted to this STA 378 370 * @tid_seq: per-TID sequence numbers for sending to this STA 379 371 * @ampdu_mlme: A-MPDU state machine state 380 372 * @timer_to_tid: identity mapping to ID timers ··· 368 388 * @debugfs: debug filesystem info 369 389 * @dead: set to true when sta is unlinked 370 390 * @uploaded: set to true when sta is uploaded to the driver 371 - * @lost_packets: number of consecutive lost packets 372 391 * @sta: station information we share with the driver 373 392 * @sta_state: duplicates information about station state (for debug) 374 393 * @beacon_loss_count: number of times beacon loss has triggered 375 394 * @rcu_head: RCU head used for freeing this station struct 376 395 * @cur_max_bandwidth: maximum bandwidth to use for TX to the station, 377 396 * taken from HT/VHT capabilities or VHT operating mode notification 378 - * @chains: chains ever used for RX from this station 379 - * @chain_signal_last: last signal (per chain) 380 - * @chain_signal_avg: signal average (per chain) 381 397 * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for 382 398 * AP only. 383 399 * @cipher_scheme: optional cipher scheme for this station 384 - * @last_tdls_pkt_time: holds the time in jiffies of last TDLS pkt ACKed 385 400 * @reserved_tid: reserved TID (if any, otherwise IEEE80211_TID_UNRESERVED) 386 - * @tx_msdu: MSDUs transmitted to this station, using IEEE80211_NUM_TID 387 - * entry for non-QoS frames 388 - * @tx_msdu_retries: MSDU retries for transmissions to to this station, 389 - * using IEEE80211_NUM_TID entry for non-QoS frames 390 - * @tx_msdu_failed: MSDU failures for transmissions to to this station, 391 - * using IEEE80211_NUM_TID entry for non-QoS frames 392 - * @rx_msdu: MSDUs received from this station, using IEEE80211_NUM_TID 393 - * entry for non-QoS frames 394 401 * @fast_tx: TX fastpath information 395 402 * @tdls_chandef: a TDLS peer can have a wider chandef that is compatible to 396 403 * the BSS one. 404 + * @tx_stats: TX statistics 405 + * @rx_stats: RX statistics 406 + * @status_stats: TX status statistics 397 407 */ 398 408 struct sta_info { 399 409 /* General information, mostly static */ ··· 427 457 unsigned long driver_buffered_tids; 428 458 unsigned long txq_buffered_tids; 429 459 430 - /* Updated from RX path only, no locking requirements */ 431 - unsigned long rx_packets; 432 - u64 rx_bytes; 433 - unsigned long last_rx; 434 460 long last_connected; 435 - unsigned long num_duplicates; 436 - unsigned long rx_fragments; 437 - unsigned long rx_dropped; 438 - int last_signal; 439 - struct ewma_signal avg_signal; 440 - int last_ack_signal; 441 461 442 - u8 chains; 443 - s8 chain_signal_last[IEEE80211_MAX_CHAINS]; 444 - struct ewma_signal chain_signal_avg[IEEE80211_MAX_CHAINS]; 462 + /* Updated from RX path only, no locking requirements */ 463 + struct { 464 + unsigned long packets; 465 + u64 bytes; 466 + unsigned long last_rx; 467 + unsigned long num_duplicates; 468 + unsigned long fragments; 469 + unsigned long dropped; 470 + int last_signal; 471 + struct ewma_signal avg_signal; 472 + u8 chains; 473 + s8 chain_signal_last[IEEE80211_MAX_CHAINS]; 474 + struct ewma_signal chain_signal_avg[IEEE80211_MAX_CHAINS]; 475 + int last_rate_idx; 476 + u32 last_rate_flag; 477 + u32 last_rate_vht_flag; 478 + u8 last_rate_vht_nss; 479 + u64 msdu[IEEE80211_NUM_TIDS + 1]; 480 + } rx_stats; 445 481 446 482 /* Plus 1 for non-QoS frames */ 447 483 __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; 448 484 449 485 /* Updated from TX status path only, no locking requirements */ 450 - unsigned long tx_filtered_count; 451 - unsigned long tx_retry_failed, tx_retry_count; 486 + struct { 487 + unsigned long filtered; 488 + unsigned long retry_failed, retry_count; 489 + unsigned int lost_packets; 490 + unsigned long last_tdls_pkt_time; 491 + u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; 492 + u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; 493 + } status_stats; 452 494 453 495 /* Updated from TX path only, no locking requirements */ 454 - u64 tx_packets[IEEE80211_NUM_ACS]; 455 - u64 tx_bytes[IEEE80211_NUM_ACS]; 456 - struct ieee80211_tx_rate last_tx_rate; 457 - int last_rx_rate_idx; 458 - u32 last_rx_rate_flag; 459 - u32 last_rx_rate_vht_flag; 460 - u8 last_rx_rate_vht_nss; 496 + struct { 497 + u64 packets[IEEE80211_NUM_ACS]; 498 + u64 bytes[IEEE80211_NUM_ACS]; 499 + struct ieee80211_tx_rate last_rate; 500 + u64 msdu[IEEE80211_NUM_TIDS + 1]; 501 + } tx_stats; 461 502 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; 462 - u64 tx_msdu[IEEE80211_NUM_TIDS + 1]; 463 - u64 tx_msdu_retries[IEEE80211_NUM_TIDS + 1]; 464 - u64 tx_msdu_failed[IEEE80211_NUM_TIDS + 1]; 465 - u64 rx_msdu[IEEE80211_NUM_TIDS + 1]; 466 503 467 504 /* 468 505 * Aggregation information, locked with lock. ··· 486 509 487 510 enum ieee80211_sta_rx_bandwidth cur_max_bandwidth; 488 511 489 - unsigned int lost_packets; 490 - unsigned int beacon_loss_count; 491 - 492 512 enum ieee80211_smps_mode known_smps_mode; 493 513 const struct ieee80211_cipher_scheme *cipher_scheme; 494 - 495 - /* TDLS timeout data */ 496 - unsigned long last_tdls_pkt_time; 497 514 498 515 u8 reserved_tid; 499 516 ··· 658 687 659 688 void sta_set_rate_info_tx(struct sta_info *sta, 660 689 const struct ieee80211_tx_rate *rate, 661 - struct rate_info *rinfo); 662 - void sta_set_rate_info_rx(struct sta_info *sta, 663 690 struct rate_info *rinfo); 664 691 void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo); 665 692
+28 -25
net/mac80211/status.c
··· 67 67 IEEE80211_TX_INTFL_RETRANSMISSION; 68 68 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; 69 69 70 - sta->tx_filtered_count++; 70 + sta->status_stats.filtered++; 71 71 72 72 /* 73 73 * Clear more-data bit on filtered frames, it might be set ··· 183 183 struct ieee80211_sub_if_data *sdata = sta->sdata; 184 184 185 185 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) 186 - sta->last_rx = jiffies; 186 + sta->rx_stats.last_rx = jiffies; 187 187 188 188 if (ieee80211_is_data_qos(mgmt->frame_control)) { 189 189 struct ieee80211_hdr *hdr = (void *) skb->data; ··· 557 557 !(info->flags & IEEE80211_TX_STAT_AMPDU)) 558 558 return; 559 559 560 - sta->lost_packets++; 561 - if (!sta->sta.tdls && sta->lost_packets < STA_LOST_PKT_THRESHOLD) 560 + sta->status_stats.lost_packets++; 561 + if (!sta->sta.tdls && 562 + sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD) 562 563 return; 563 564 564 565 /* ··· 569 568 * mechanism. 570 569 */ 571 570 if (sta->sta.tdls && 572 - (sta->lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || 571 + (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || 573 572 time_before(jiffies, 574 - sta->last_tdls_pkt_time + STA_LOST_TDLS_PKT_TIME))) 573 + sta->status_stats.last_tdls_pkt_time + 574 + STA_LOST_TDLS_PKT_TIME))) 575 575 return; 576 576 577 577 cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, 578 - sta->lost_packets, GFP_ATOMIC); 579 - sta->lost_packets = 0; 578 + sta->status_stats.lost_packets, GFP_ATOMIC); 579 + sta->status_stats.lost_packets = 0; 580 580 } 581 581 582 582 static int ieee80211_tx_get_rates(struct ieee80211_hw *hw, ··· 638 636 sta = container_of(pubsta, struct sta_info, sta); 639 637 640 638 if (!acked) 641 - sta->tx_retry_failed++; 642 - sta->tx_retry_count += retry_count; 639 + sta->status_stats.retry_failed++; 640 + sta->status_stats.retry_count += retry_count; 643 641 644 642 if (acked) { 645 - sta->last_rx = jiffies; 643 + sta->rx_stats.last_rx = jiffies; 646 644 647 - if (sta->lost_packets) 648 - sta->lost_packets = 0; 645 + if (sta->status_stats.lost_packets) 646 + sta->status_stats.lost_packets = 0; 649 647 650 648 /* Track when last TDLS packet was ACKed */ 651 649 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) 652 - sta->last_tdls_pkt_time = jiffies; 650 + sta->status_stats.last_tdls_pkt_time = jiffies; 653 651 } else { 654 652 ieee80211_lost_packet(sta, info); 655 653 } ··· 786 784 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) && 787 785 (ieee80211_is_data(hdr->frame_control)) && 788 786 (rates_idx != -1)) 789 - sta->last_tx_rate = info->status.rates[rates_idx]; 787 + sta->tx_stats.last_rate = 788 + info->status.rates[rates_idx]; 790 789 791 790 if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && 792 791 (ieee80211_is_data_qos(fc))) { ··· 833 830 return; 834 831 } else { 835 832 if (!acked) 836 - sta->tx_retry_failed++; 837 - sta->tx_retry_count += retry_count; 833 + sta->status_stats.retry_failed++; 834 + sta->status_stats.retry_count += retry_count; 838 835 839 836 if (ieee80211_is_data_present(fc)) { 840 837 if (!acked) 841 - sta->tx_msdu_failed[tid]++; 842 - sta->tx_msdu_retries[tid] += retry_count; 838 + sta->status_stats.msdu_failed[tid]++; 839 + 840 + sta->status_stats.msdu_retries[tid] += 841 + retry_count; 843 842 } 844 843 } 845 844 ··· 859 854 860 855 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { 861 856 if (info->flags & IEEE80211_TX_STAT_ACK) { 862 - if (sta->lost_packets) 863 - sta->lost_packets = 0; 857 + if (sta->status_stats.lost_packets) 858 + sta->status_stats.lost_packets = 0; 864 859 865 860 /* Track when last TDLS packet was ACKed */ 866 861 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) 867 - sta->last_tdls_pkt_time = jiffies; 862 + sta->status_stats.last_tdls_pkt_time = 863 + jiffies; 868 864 } else { 869 865 ieee80211_lost_packet(sta, info); 870 866 } 871 867 } 872 - 873 - if (acked) 874 - sta->last_ack_signal = info->status.ack_signal; 875 868 } 876 869 877 870 rcu_read_unlock();
-2
net/mac80211/trace.h
··· 325 325 __field(u32, flags) 326 326 __field(int, power_level) 327 327 __field(int, dynamic_ps_timeout) 328 - __field(int, max_sleep_period) 329 328 __field(u16, listen_interval) 330 329 __field(u8, long_frame_max_tx_count) 331 330 __field(u8, short_frame_max_tx_count) ··· 338 339 __entry->flags = local->hw.conf.flags; 339 340 __entry->power_level = local->hw.conf.power_level; 340 341 __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; 341 - __entry->max_sleep_period = local->hw.conf.max_sleep_period; 342 342 __entry->listen_interval = local->hw.conf.listen_interval; 343 343 __entry->long_frame_max_tx_count = 344 344 local->hw.conf.long_frame_max_tx_count;
+10 -10
net/mac80211/tx.c
··· 757 757 if (txrc.reported_rate.idx < 0) { 758 758 txrc.reported_rate = tx->rate; 759 759 if (tx->sta && ieee80211_is_data(hdr->frame_control)) 760 - tx->sta->last_tx_rate = txrc.reported_rate; 760 + tx->sta->tx_stats.last_rate = txrc.reported_rate; 761 761 } else if (tx->sta) 762 - tx->sta->last_tx_rate = txrc.reported_rate; 762 + tx->sta->tx_stats.last_rate = txrc.reported_rate; 763 763 764 764 if (ratetbl) 765 765 return TX_CONTINUE; ··· 824 824 hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number); 825 825 tx->sdata->sequence_number += 0x10; 826 826 if (tx->sta) 827 - tx->sta->tx_msdu[IEEE80211_NUM_TIDS]++; 827 + tx->sta->tx_stats.msdu[IEEE80211_NUM_TIDS]++; 828 828 return TX_CONTINUE; 829 829 } 830 830 ··· 840 840 841 841 qc = ieee80211_get_qos_ctl(hdr); 842 842 tid = *qc & IEEE80211_QOS_CTL_TID_MASK; 843 - tx->sta->tx_msdu[tid]++; 843 + tx->sta->tx_stats.msdu[tid]++; 844 844 845 845 if (!tx->sta->sta.txq[0]) 846 846 hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); ··· 994 994 995 995 skb_queue_walk(&tx->skbs, skb) { 996 996 ac = skb_get_queue_mapping(skb); 997 - tx->sta->tx_bytes[ac] += skb->len; 997 + tx->sta->tx_stats.bytes[ac] += skb->len; 998 998 } 999 999 if (ac >= 0) 1000 - tx->sta->tx_packets[ac]++; 1000 + tx->sta->tx_stats.packets[ac]++; 1001 1001 1002 1002 return TX_CONTINUE; 1003 1003 } ··· 2779 2779 } 2780 2780 2781 2781 if (skb_shinfo(skb)->gso_size) 2782 - sta->tx_msdu[tid] += 2782 + sta->tx_stats.msdu[tid] += 2783 2783 DIV_ROUND_UP(skb->len, skb_shinfo(skb)->gso_size); 2784 2784 else 2785 - sta->tx_msdu[tid]++; 2785 + sta->tx_stats.msdu[tid]++; 2786 2786 2787 2787 info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; 2788 2788 ··· 2813 2813 /* statistics normally done by ieee80211_tx_h_stats (but that 2814 2814 * has to consider fragmentation, so is more complex) 2815 2815 */ 2816 - sta->tx_bytes[skb_get_queue_mapping(skb)] += skb->len; 2817 - sta->tx_packets[skb_get_queue_mapping(skb)]++; 2816 + sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; 2817 + sta->tx_stats.packets[skb_get_queue_mapping(skb)]++; 2818 2818 2819 2819 if (fast_tx->pn_offs) { 2820 2820 u64 pn;
+9 -3
net/mac80211/util.c
··· 1951 1951 } 1952 1952 } 1953 1953 1954 - ieee80211_recalc_ps(local, -1); 1954 + ieee80211_recalc_ps(local); 1955 1955 1956 1956 /* 1957 1957 * The sta might be in psm against the ap (e.g. because ··· 2042 2042 if (sched_scan_sdata && sched_scan_req) 2043 2043 /* 2044 2044 * Sched scan stopped, but we don't want to report it. Instead, 2045 - * we're trying to reschedule. 2045 + * we're trying to reschedule. However, if more than one scan 2046 + * plan was set, we cannot reschedule since we don't know which 2047 + * scan plan was currently running (and some scan plans may have 2048 + * already finished). 2046 2049 */ 2047 - if (__ieee80211_request_sched_scan_start(sched_scan_sdata, 2050 + if (sched_scan_req->n_scan_plans > 1 || 2051 + __ieee80211_request_sched_scan_start(sched_scan_sdata, 2048 2052 sched_scan_req)) 2049 2053 sched_scan_stopped = true; 2050 2054 mutex_unlock(&local->mtx); ··· 3305 3301 if (sta) { 3306 3302 txqi->txq.sta = &sta->sta; 3307 3303 sta->sta.txq[tid] = &txqi->txq; 3304 + txqi->txq.tid = tid; 3308 3305 txqi->txq.ac = ieee802_1d_to_ac[tid & 7]; 3309 3306 } else { 3310 3307 sdata->vif.txq = &txqi->txq; 3308 + txqi->txq.tid = 0; 3311 3309 txqi->txq.ac = IEEE80211_AC_BE; 3312 3310 } 3313 3311 }
+6 -3
net/mac80211/wpa.c
··· 174 174 * a driver that supports HW encryption. Send up the key idx only if 175 175 * the key is set. 176 176 */ 177 - mac80211_ev_michael_mic_failure(rx->sdata, 178 - rx->key ? rx->key->conf.keyidx : -1, 179 - (void *) skb->data, NULL, GFP_ATOMIC); 177 + cfg80211_michael_mic_failure(rx->sdata->dev, hdr->addr2, 178 + is_multicast_ether_addr(hdr->addr1) ? 179 + NL80211_KEYTYPE_GROUP : 180 + NL80211_KEYTYPE_PAIRWISE, 181 + rx->key ? rx->key->conf.keyidx : -1, 182 + NULL, GFP_ATOMIC); 180 183 return RX_DROP_UNUSABLE; 181 184 } 182 185
+10
net/wireless/Kconfig
··· 174 174 175 175 Most distributions have a CRDA package. So if unsure, say N. 176 176 177 + config CFG80211_CRDA_SUPPORT 178 + bool "support CRDA" if CFG80211_INTERNAL_REGDB 179 + default y 180 + depends on CFG80211 181 + help 182 + You should enable this option unless you know for sure you have no 183 + need for it, for example when using internal regdb (above.) 184 + 185 + If unsure, say Y. 186 + 177 187 config CFG80211_WEXT 178 188 bool "cfg80211 wireless extensions compatibility" if !CFG80211_WEXT_EXPORT 179 189 depends on CFG80211
+4 -1
net/wireless/core.c
··· 461 461 462 462 rdev->wiphy.max_num_csa_counters = 1; 463 463 464 + rdev->wiphy.max_sched_scan_plans = 1; 465 + rdev->wiphy.max_sched_scan_plan_interval = U32_MAX; 466 + 464 467 return &rdev->wiphy; 465 468 } 466 469 EXPORT_SYMBOL(wiphy_new_nm); ··· 639 636 if (WARN_ON(!sband->n_channels)) 640 637 return -EINVAL; 641 638 /* 642 - * on 60gHz band, there are no legacy rates, so 639 + * on 60GHz band, there are no legacy rates, so 643 640 * n_bitrates is 0 644 641 */ 645 642 if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
+1
net/wireless/core.h
··· 137 137 struct list_head list; 138 138 struct list_head hidden_list; 139 139 struct rb_node rbn; 140 + u64 ts_boottime; 140 141 unsigned long ts; 141 142 unsigned long refcount; 142 143 atomic_t hold;
+225 -63
net/wireless/nl80211.c
··· 479 479 [NL80211_SCHED_SCAN_MATCH_ATTR_RSSI] = { .type = NLA_U32 }, 480 480 }; 481 481 482 + static const struct nla_policy 483 + nl80211_plan_policy[NL80211_SCHED_SCAN_PLAN_MAX + 1] = { 484 + [NL80211_SCHED_SCAN_PLAN_INTERVAL] = { .type = NLA_U32 }, 485 + [NL80211_SCHED_SCAN_PLAN_ITERATIONS] = { .type = NLA_U32 }, 486 + }; 487 + 482 488 static int nl80211_prepare_wdev_dump(struct sk_buff *skb, 483 489 struct netlink_callback *cb, 484 490 struct cfg80211_registered_device **rdev, ··· 1310 1304 nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, 1311 1305 rdev->wiphy.max_sched_scan_ie_len) || 1312 1306 nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS, 1313 - rdev->wiphy.max_match_sets)) 1307 + rdev->wiphy.max_match_sets) || 1308 + nla_put_u32(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, 1309 + rdev->wiphy.max_sched_scan_plans) || 1310 + nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, 1311 + rdev->wiphy.max_sched_scan_plan_interval) || 1312 + nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, 1313 + rdev->wiphy.max_sched_scan_plan_iterations)) 1314 1314 goto nla_put_failure; 1315 1315 1316 1316 if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) && ··· 4944 4932 return err; 4945 4933 } 4946 4934 4947 - static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = { 4948 - [NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 }, 4949 - [NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 }, 4950 - [NL80211_ATTR_FREQ_RANGE_END] = { .type = NLA_U32 }, 4951 - [NL80211_ATTR_FREQ_RANGE_MAX_BW] = { .type = NLA_U32 }, 4952 - [NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN] = { .type = NLA_U32 }, 4953 - [NL80211_ATTR_POWER_RULE_MAX_EIRP] = { .type = NLA_U32 }, 4954 - [NL80211_ATTR_DFS_CAC_TIME] = { .type = NLA_U32 }, 4955 - }; 4956 - 4957 - static int parse_reg_rule(struct nlattr *tb[], 4958 - struct ieee80211_reg_rule *reg_rule) 4959 - { 4960 - struct ieee80211_freq_range *freq_range = &reg_rule->freq_range; 4961 - struct ieee80211_power_rule *power_rule = &reg_rule->power_rule; 4962 - 4963 - if (!tb[NL80211_ATTR_REG_RULE_FLAGS]) 4964 - return -EINVAL; 4965 - if (!tb[NL80211_ATTR_FREQ_RANGE_START]) 4966 - return -EINVAL; 4967 - if (!tb[NL80211_ATTR_FREQ_RANGE_END]) 4968 - return -EINVAL; 4969 - if (!tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) 4970 - return -EINVAL; 4971 - if (!tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]) 4972 - return -EINVAL; 4973 - 4974 - reg_rule->flags = nla_get_u32(tb[NL80211_ATTR_REG_RULE_FLAGS]); 4975 - 4976 - freq_range->start_freq_khz = 4977 - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]); 4978 - freq_range->end_freq_khz = 4979 - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]); 4980 - freq_range->max_bandwidth_khz = 4981 - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]); 4982 - 4983 - power_rule->max_eirp = 4984 - nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]); 4985 - 4986 - if (tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]) 4987 - power_rule->max_antenna_gain = 4988 - nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]); 4989 - 4990 - if (tb[NL80211_ATTR_DFS_CAC_TIME]) 4991 - reg_rule->dfs_cac_ms = 4992 - nla_get_u32(tb[NL80211_ATTR_DFS_CAC_TIME]); 4993 - 4994 - return 0; 4995 - } 4996 - 4997 4935 static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) 4998 4936 { 4999 4937 char *data = NULL; ··· 5575 5613 return err; 5576 5614 } 5577 5615 5616 + #ifdef CONFIG_CFG80211_CRDA_SUPPORT 5617 + static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = { 5618 + [NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 }, 5619 + [NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 }, 5620 + [NL80211_ATTR_FREQ_RANGE_END] = { .type = NLA_U32 }, 5621 + [NL80211_ATTR_FREQ_RANGE_MAX_BW] = { .type = NLA_U32 }, 5622 + [NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN] = { .type = NLA_U32 }, 5623 + [NL80211_ATTR_POWER_RULE_MAX_EIRP] = { .type = NLA_U32 }, 5624 + [NL80211_ATTR_DFS_CAC_TIME] = { .type = NLA_U32 }, 5625 + }; 5626 + 5627 + static int parse_reg_rule(struct nlattr *tb[], 5628 + struct ieee80211_reg_rule *reg_rule) 5629 + { 5630 + struct ieee80211_freq_range *freq_range = &reg_rule->freq_range; 5631 + struct ieee80211_power_rule *power_rule = &reg_rule->power_rule; 5632 + 5633 + if (!tb[NL80211_ATTR_REG_RULE_FLAGS]) 5634 + return -EINVAL; 5635 + if (!tb[NL80211_ATTR_FREQ_RANGE_START]) 5636 + return -EINVAL; 5637 + if (!tb[NL80211_ATTR_FREQ_RANGE_END]) 5638 + return -EINVAL; 5639 + if (!tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) 5640 + return -EINVAL; 5641 + if (!tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]) 5642 + return -EINVAL; 5643 + 5644 + reg_rule->flags = nla_get_u32(tb[NL80211_ATTR_REG_RULE_FLAGS]); 5645 + 5646 + freq_range->start_freq_khz = 5647 + nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]); 5648 + freq_range->end_freq_khz = 5649 + nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]); 5650 + freq_range->max_bandwidth_khz = 5651 + nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]); 5652 + 5653 + power_rule->max_eirp = 5654 + nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]); 5655 + 5656 + if (tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]) 5657 + power_rule->max_antenna_gain = 5658 + nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]); 5659 + 5660 + if (tb[NL80211_ATTR_DFS_CAC_TIME]) 5661 + reg_rule->dfs_cac_ms = 5662 + nla_get_u32(tb[NL80211_ATTR_DFS_CAC_TIME]); 5663 + 5664 + return 0; 5665 + } 5666 + 5578 5667 static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) 5579 5668 { 5580 5669 struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1]; ··· 5702 5689 kfree(rd); 5703 5690 return r; 5704 5691 } 5692 + #endif /* CONFIG_CFG80211_CRDA_SUPPORT */ 5705 5693 5706 5694 static int validate_scan_freqs(struct nlattr *freqs) 5707 5695 { ··· 5988 5974 return err; 5989 5975 } 5990 5976 5977 + static int 5978 + nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, 5979 + struct cfg80211_sched_scan_request *request, 5980 + struct nlattr **attrs) 5981 + { 5982 + int tmp, err, i = 0; 5983 + struct nlattr *attr; 5984 + 5985 + if (!attrs[NL80211_ATTR_SCHED_SCAN_PLANS]) { 5986 + u32 interval; 5987 + 5988 + /* 5989 + * If scan plans are not specified, 5990 + * %NL80211_ATTR_SCHED_SCAN_INTERVAL must be specified. In this 5991 + * case one scan plan will be set with the specified scan 5992 + * interval and infinite number of iterations. 5993 + */ 5994 + if (!attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) 5995 + return -EINVAL; 5996 + 5997 + interval = nla_get_u32(attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]); 5998 + if (!interval) 5999 + return -EINVAL; 6000 + 6001 + request->scan_plans[0].interval = 6002 + DIV_ROUND_UP(interval, MSEC_PER_SEC); 6003 + if (!request->scan_plans[0].interval) 6004 + return -EINVAL; 6005 + 6006 + if (request->scan_plans[0].interval > 6007 + wiphy->max_sched_scan_plan_interval) 6008 + request->scan_plans[0].interval = 6009 + wiphy->max_sched_scan_plan_interval; 6010 + 6011 + return 0; 6012 + } 6013 + 6014 + nla_for_each_nested(attr, attrs[NL80211_ATTR_SCHED_SCAN_PLANS], tmp) { 6015 + struct nlattr *plan[NL80211_SCHED_SCAN_PLAN_MAX + 1]; 6016 + 6017 + if (WARN_ON(i >= n_plans)) 6018 + return -EINVAL; 6019 + 6020 + err = nla_parse(plan, NL80211_SCHED_SCAN_PLAN_MAX, 6021 + nla_data(attr), nla_len(attr), 6022 + nl80211_plan_policy); 6023 + if (err) 6024 + return err; 6025 + 6026 + if (!plan[NL80211_SCHED_SCAN_PLAN_INTERVAL]) 6027 + return -EINVAL; 6028 + 6029 + request->scan_plans[i].interval = 6030 + nla_get_u32(plan[NL80211_SCHED_SCAN_PLAN_INTERVAL]); 6031 + if (!request->scan_plans[i].interval || 6032 + request->scan_plans[i].interval > 6033 + wiphy->max_sched_scan_plan_interval) 6034 + return -EINVAL; 6035 + 6036 + if (plan[NL80211_SCHED_SCAN_PLAN_ITERATIONS]) { 6037 + request->scan_plans[i].iterations = 6038 + nla_get_u32(plan[NL80211_SCHED_SCAN_PLAN_ITERATIONS]); 6039 + if (!request->scan_plans[i].iterations || 6040 + (request->scan_plans[i].iterations > 6041 + wiphy->max_sched_scan_plan_iterations)) 6042 + return -EINVAL; 6043 + } else if (i < n_plans - 1) { 6044 + /* 6045 + * All scan plans but the last one must specify 6046 + * a finite number of iterations 6047 + */ 6048 + return -EINVAL; 6049 + } 6050 + 6051 + i++; 6052 + } 6053 + 6054 + /* 6055 + * The last scan plan must not specify the number of 6056 + * iterations, it is supposed to run infinitely 6057 + */ 6058 + if (request->scan_plans[n_plans - 1].iterations) 6059 + return -EINVAL; 6060 + 6061 + return 0; 6062 + } 6063 + 5991 6064 static struct cfg80211_sched_scan_request * 5992 6065 nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, 5993 6066 struct nlattr **attrs) 5994 6067 { 5995 6068 struct cfg80211_sched_scan_request *request; 5996 6069 struct nlattr *attr; 5997 - int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i; 5998 - u32 interval; 6070 + int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i, n_plans = 0; 5999 6071 enum ieee80211_band band; 6000 6072 size_t ie_len; 6001 6073 struct nlattr *tb[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1]; 6002 6074 s32 default_match_rssi = NL80211_SCAN_RSSI_THOLD_OFF; 6003 6075 6004 6076 if (!is_valid_ie_attr(attrs[NL80211_ATTR_IE])) 6005 - return ERR_PTR(-EINVAL); 6006 - 6007 - if (!attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) 6008 - return ERR_PTR(-EINVAL); 6009 - 6010 - interval = nla_get_u32(attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]); 6011 - if (interval == 0) 6012 6077 return ERR_PTR(-EINVAL); 6013 6078 6014 6079 if (attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { ··· 6153 6060 if (ie_len > wiphy->max_sched_scan_ie_len) 6154 6061 return ERR_PTR(-EINVAL); 6155 6062 6063 + if (attrs[NL80211_ATTR_SCHED_SCAN_PLANS]) { 6064 + /* 6065 + * NL80211_ATTR_SCHED_SCAN_INTERVAL must not be specified since 6066 + * each scan plan already specifies its own interval 6067 + */ 6068 + if (attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) 6069 + return ERR_PTR(-EINVAL); 6070 + 6071 + nla_for_each_nested(attr, 6072 + attrs[NL80211_ATTR_SCHED_SCAN_PLANS], tmp) 6073 + n_plans++; 6074 + } else { 6075 + /* 6076 + * The scan interval attribute is kept for backward 6077 + * compatibility. If no scan plans are specified and sched scan 6078 + * interval is specified, one scan plan will be set with this 6079 + * scan interval and infinite number of iterations. 6080 + */ 6081 + if (!attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) 6082 + return ERR_PTR(-EINVAL); 6083 + 6084 + n_plans = 1; 6085 + } 6086 + 6087 + if (!n_plans || n_plans > wiphy->max_sched_scan_plans) 6088 + return ERR_PTR(-EINVAL); 6089 + 6156 6090 request = kzalloc(sizeof(*request) 6157 6091 + sizeof(*request->ssids) * n_ssids 6158 6092 + sizeof(*request->match_sets) * n_match_sets 6093 + + sizeof(*request->scan_plans) * n_plans 6159 6094 + sizeof(*request->channels) * n_channels 6160 6095 + ie_len, GFP_KERNEL); 6161 6096 if (!request) ··· 6210 6089 (void *)(request->channels + n_channels); 6211 6090 } 6212 6091 request->n_match_sets = n_match_sets; 6092 + 6093 + if (n_match_sets) 6094 + request->scan_plans = (void *)(request->match_sets + 6095 + n_match_sets); 6096 + else if (request->ie) 6097 + request->scan_plans = (void *)(request->ie + ie_len); 6098 + else if (n_ssids) 6099 + request->scan_plans = (void *)(request->ssids + n_ssids); 6100 + else 6101 + request->scan_plans = (void *)(request->channels + n_channels); 6102 + 6103 + request->n_scan_plans = n_plans; 6213 6104 6214 6105 i = 0; 6215 6106 if (attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { ··· 6385 6252 request->delay = 6386 6253 nla_get_u32(attrs[NL80211_ATTR_SCHED_SCAN_DELAY]); 6387 6254 6388 - request->interval = interval; 6255 + err = nl80211_parse_sched_scan_plans(wiphy, n_plans, request, attrs); 6256 + if (err) 6257 + goto out_free; 6258 + 6389 6259 request->scan_start = jiffies; 6390 6260 6391 6261 return request; ··· 6739 6603 nla_put_u32(msg, NL80211_BSS_CHAN_WIDTH, res->scan_width) || 6740 6604 nla_put_u32(msg, NL80211_BSS_SEEN_MS_AGO, 6741 6605 jiffies_to_msecs(jiffies - intbss->ts))) 6606 + goto nla_put_failure; 6607 + 6608 + if (intbss->ts_boottime && 6609 + nla_put_u64(msg, NL80211_BSS_LAST_SEEN_BOOTTIME, 6610 + intbss->ts_boottime)) 6742 6611 goto nla_put_failure; 6743 6612 6744 6613 switch (rdev->wiphy.signal_type) { ··· 8986 8845 static int nl80211_send_wowlan_nd(struct sk_buff *msg, 8987 8846 struct cfg80211_sched_scan_request *req) 8988 8847 { 8989 - struct nlattr *nd, *freqs, *matches, *match; 8848 + struct nlattr *nd, *freqs, *matches, *match, *scan_plans, *scan_plan; 8990 8849 int i; 8991 8850 8992 8851 if (!req) ··· 8996 8855 if (!nd) 8997 8856 return -ENOBUFS; 8998 8857 8999 - if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, req->interval)) 8858 + if (req->n_scan_plans == 1 && 8859 + nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, 8860 + req->scan_plans[0].interval * 1000)) 9000 8861 return -ENOBUFS; 9001 8862 9002 8863 if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_DELAY, req->delay)) ··· 9024 8881 } 9025 8882 nla_nest_end(msg, matches); 9026 8883 } 8884 + 8885 + scan_plans = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_PLANS); 8886 + if (!scan_plans) 8887 + return -ENOBUFS; 8888 + 8889 + for (i = 0; i < req->n_scan_plans; i++) { 8890 + scan_plan = nla_nest_start(msg, i + 1); 8891 + if (!scan_plan || 8892 + nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_INTERVAL, 8893 + req->scan_plans[i].interval) || 8894 + (req->scan_plans[i].iterations && 8895 + nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_ITERATIONS, 8896 + req->scan_plans[i].iterations))) 8897 + return -ENOBUFS; 8898 + nla_nest_end(msg, scan_plan); 8899 + } 8900 + nla_nest_end(msg, scan_plans); 9027 8901 9028 8902 nla_nest_end(msg, nd); 9029 8903 ··· 10897 10737 .internal_flags = NL80211_FLAG_NEED_RTNL, 10898 10738 /* can be retrieved by unprivileged users */ 10899 10739 }, 10740 + #ifdef CONFIG_CFG80211_CRDA_SUPPORT 10900 10741 { 10901 10742 .cmd = NL80211_CMD_SET_REG, 10902 10743 .doit = nl80211_set_reg, ··· 10905 10744 .flags = GENL_ADMIN_PERM, 10906 10745 .internal_flags = NL80211_FLAG_NEED_RTNL, 10907 10746 }, 10747 + #endif 10908 10748 { 10909 10749 .cmd = NL80211_CMD_REQ_SET_REG, 10910 10750 .doit = nl80211_req_set_reg,
+164 -131
net/wireless/reg.c
··· 135 135 /* Used to track the userspace process controlling the indoor setting */ 136 136 static u32 reg_is_indoor_portid; 137 137 138 - /* Max number of consecutive attempts to communicate with CRDA */ 139 - #define REG_MAX_CRDA_TIMEOUTS 10 140 - 141 - static u32 reg_crda_timeouts; 138 + static void restore_regulatory_settings(bool reset_user); 142 139 143 140 static const struct ieee80211_regdomain *get_cfg80211_regdom(void) 144 141 { ··· 223 226 static void reg_todo(struct work_struct *work); 224 227 static DECLARE_WORK(reg_work, reg_todo); 225 228 226 - static void reg_timeout_work(struct work_struct *work); 227 - static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work); 228 - 229 229 /* We keep a static world regulatory domain in case of the absence of CRDA */ 230 230 static const struct ieee80211_regdomain world_regdom = { 231 231 .n_reg_rules = 8, ··· 256 262 REG_RULE(5745-10, 5825+10, 80, 6, 20, 257 263 NL80211_RRF_NO_IR), 258 264 259 - /* IEEE 802.11ad (60gHz), channels 1..3 */ 265 + /* IEEE 802.11ad (60GHz), channels 1..3 */ 260 266 REG_RULE(56160+2160*1-1080, 56160+2160*3+1080, 2160, 0, 0, 0), 261 267 } 262 268 }; ··· 273 279 274 280 static void reg_free_request(struct regulatory_request *request) 275 281 { 282 + if (request == &core_request_world) 283 + return; 284 + 276 285 if (request != get_last_request()) 277 286 kfree(request); 278 287 } ··· 450 453 } 451 454 452 455 #ifdef CONFIG_CFG80211_INTERNAL_REGDB 453 - struct reg_regdb_search_request { 454 - char alpha2[2]; 456 + struct reg_regdb_apply_request { 455 457 struct list_head list; 458 + const struct ieee80211_regdomain *regdom; 456 459 }; 457 460 458 - static LIST_HEAD(reg_regdb_search_list); 459 - static DEFINE_MUTEX(reg_regdb_search_mutex); 461 + static LIST_HEAD(reg_regdb_apply_list); 462 + static DEFINE_MUTEX(reg_regdb_apply_mutex); 460 463 461 - static void reg_regdb_search(struct work_struct *work) 464 + static void reg_regdb_apply(struct work_struct *work) 462 465 { 463 - struct reg_regdb_search_request *request; 464 - const struct ieee80211_regdomain *curdom, *regdom = NULL; 465 - int i; 466 + struct reg_regdb_apply_request *request; 466 467 467 468 rtnl_lock(); 468 469 469 - mutex_lock(&reg_regdb_search_mutex); 470 - while (!list_empty(&reg_regdb_search_list)) { 471 - request = list_first_entry(&reg_regdb_search_list, 472 - struct reg_regdb_search_request, 470 + mutex_lock(&reg_regdb_apply_mutex); 471 + while (!list_empty(&reg_regdb_apply_list)) { 472 + request = list_first_entry(&reg_regdb_apply_list, 473 + struct reg_regdb_apply_request, 473 474 list); 474 475 list_del(&request->list); 475 476 476 - for (i = 0; i < reg_regdb_size; i++) { 477 - curdom = reg_regdb[i]; 478 - 479 - if (alpha2_equal(request->alpha2, curdom->alpha2)) { 480 - regdom = reg_copy_regd(curdom); 481 - break; 482 - } 483 - } 484 - 477 + set_regdom(request->regdom, REGD_SOURCE_INTERNAL_DB); 485 478 kfree(request); 486 479 } 487 - mutex_unlock(&reg_regdb_search_mutex); 488 - 489 - if (!IS_ERR_OR_NULL(regdom)) 490 - set_regdom(regdom, REGD_SOURCE_INTERNAL_DB); 480 + mutex_unlock(&reg_regdb_apply_mutex); 491 481 492 482 rtnl_unlock(); 493 483 } 494 484 495 - static DECLARE_WORK(reg_regdb_work, reg_regdb_search); 485 + static DECLARE_WORK(reg_regdb_work, reg_regdb_apply); 496 486 497 - static void reg_regdb_query(const char *alpha2) 487 + static int reg_query_builtin(const char *alpha2) 498 488 { 499 - struct reg_regdb_search_request *request; 489 + const struct ieee80211_regdomain *regdom = NULL; 490 + struct reg_regdb_apply_request *request; 491 + unsigned int i; 500 492 501 - if (!alpha2) 502 - return; 493 + for (i = 0; i < reg_regdb_size; i++) { 494 + if (alpha2_equal(alpha2, reg_regdb[i]->alpha2)) { 495 + regdom = reg_regdb[i]; 496 + break; 497 + } 498 + } 503 499 504 - request = kzalloc(sizeof(struct reg_regdb_search_request), GFP_KERNEL); 500 + if (!regdom) 501 + return -ENODATA; 502 + 503 + request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL); 505 504 if (!request) 506 - return; 505 + return -ENOMEM; 507 506 508 - memcpy(request->alpha2, alpha2, 2); 507 + request->regdom = reg_copy_regd(regdom); 508 + if (IS_ERR_OR_NULL(request->regdom)) { 509 + kfree(request); 510 + return -ENOMEM; 511 + } 509 512 510 - mutex_lock(&reg_regdb_search_mutex); 511 - list_add_tail(&request->list, &reg_regdb_search_list); 512 - mutex_unlock(&reg_regdb_search_mutex); 513 + mutex_lock(&reg_regdb_apply_mutex); 514 + list_add_tail(&request->list, &reg_regdb_apply_list); 515 + mutex_unlock(&reg_regdb_apply_mutex); 513 516 514 517 schedule_work(&reg_regdb_work); 518 + 519 + return 0; 515 520 } 516 521 517 522 /* Feel free to add any other sanity checks here */ ··· 524 525 } 525 526 #else 526 527 static inline void reg_regdb_size_check(void) {} 527 - static inline void reg_regdb_query(const char *alpha2) {} 528 + static inline int reg_query_builtin(const char *alpha2) 529 + { 530 + return -ENODATA; 531 + } 528 532 #endif /* CONFIG_CFG80211_INTERNAL_REGDB */ 533 + 534 + #ifdef CONFIG_CFG80211_CRDA_SUPPORT 535 + /* Max number of consecutive attempts to communicate with CRDA */ 536 + #define REG_MAX_CRDA_TIMEOUTS 10 537 + 538 + static u32 reg_crda_timeouts; 539 + 540 + static void crda_timeout_work(struct work_struct *work); 541 + static DECLARE_DELAYED_WORK(crda_timeout, crda_timeout_work); 542 + 543 + static void crda_timeout_work(struct work_struct *work) 544 + { 545 + REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); 546 + rtnl_lock(); 547 + reg_crda_timeouts++; 548 + restore_regulatory_settings(true); 549 + rtnl_unlock(); 550 + } 551 + 552 + static void cancel_crda_timeout(void) 553 + { 554 + cancel_delayed_work(&crda_timeout); 555 + } 556 + 557 + static void cancel_crda_timeout_sync(void) 558 + { 559 + cancel_delayed_work_sync(&crda_timeout); 560 + } 561 + 562 + static void reset_crda_timeouts(void) 563 + { 564 + reg_crda_timeouts = 0; 565 + } 529 566 530 567 /* 531 568 * This lets us keep regulatory code which is updated on a regulatory ··· 571 536 { 572 537 char country[12]; 573 538 char *env[] = { country, NULL }; 539 + int ret; 574 540 575 541 snprintf(country, sizeof(country), "COUNTRY=%c%c", 576 542 alpha2[0], alpha2[1]); 577 - 578 - /* query internal regulatory database (if it exists) */ 579 - reg_regdb_query(alpha2); 580 543 581 544 if (reg_crda_timeouts > REG_MAX_CRDA_TIMEOUTS) { 582 545 pr_debug("Exceeded CRDA call max attempts. Not calling CRDA\n"); ··· 587 554 else 588 555 pr_debug("Calling CRDA to update world regulatory domain\n"); 589 556 590 - return kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, env); 591 - } 592 - 593 - static enum reg_request_treatment 594 - reg_call_crda(struct regulatory_request *request) 595 - { 596 - if (call_crda(request->alpha2)) 597 - return REG_REQ_IGNORE; 557 + ret = kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, env); 558 + if (ret) 559 + return ret; 598 560 599 561 queue_delayed_work(system_power_efficient_wq, 600 - &reg_timeout, msecs_to_jiffies(3142)); 601 - return REG_REQ_OK; 562 + &crda_timeout, msecs_to_jiffies(3142)); 563 + return 0; 564 + } 565 + #else 566 + static inline void cancel_crda_timeout(void) {} 567 + static inline void cancel_crda_timeout_sync(void) {} 568 + static inline void reset_crda_timeouts(void) {} 569 + static inline int call_crda(const char *alpha2) 570 + { 571 + return -ENODATA; 572 + } 573 + #endif /* CONFIG_CFG80211_CRDA_SUPPORT */ 574 + 575 + static bool reg_query_database(struct regulatory_request *request) 576 + { 577 + /* query internal regulatory database (if it exists) */ 578 + if (reg_query_builtin(request->alpha2) == 0) 579 + return true; 580 + 581 + if (call_crda(request->alpha2) == 0) 582 + return true; 583 + 584 + return false; 602 585 } 603 586 604 587 bool reg_is_valid_request(const char *alpha2) ··· 1130 1081 } 1131 1082 EXPORT_SYMBOL(reg_initiator_name); 1132 1083 1133 - #ifdef CONFIG_CFG80211_REG_DEBUG 1134 1084 static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, 1135 1085 struct ieee80211_channel *chan, 1136 1086 const struct ieee80211_reg_rule *reg_rule) 1137 1087 { 1088 + #ifdef CONFIG_CFG80211_REG_DEBUG 1138 1089 const struct ieee80211_power_rule *power_rule; 1139 1090 const struct ieee80211_freq_range *freq_range; 1140 1091 char max_antenna_gain[32], bw[32]; ··· 1145 1096 if (!power_rule->max_antenna_gain) 1146 1097 snprintf(max_antenna_gain, sizeof(max_antenna_gain), "N/A"); 1147 1098 else 1148 - snprintf(max_antenna_gain, sizeof(max_antenna_gain), "%d", 1099 + snprintf(max_antenna_gain, sizeof(max_antenna_gain), "%d mBi", 1149 1100 power_rule->max_antenna_gain); 1150 1101 1151 1102 if (reg_rule->flags & NL80211_RRF_AUTO_BW) ··· 1159 1110 REG_DBG_PRINT("Updating information on frequency %d MHz with regulatory rule:\n", 1160 1111 chan->center_freq); 1161 1112 1162 - REG_DBG_PRINT("%d KHz - %d KHz @ %s), (%s mBi, %d mBm)\n", 1113 + REG_DBG_PRINT("(%d KHz - %d KHz @ %s), (%s, %d mBm)\n", 1163 1114 freq_range->start_freq_khz, freq_range->end_freq_khz, 1164 1115 bw, max_antenna_gain, 1165 1116 power_rule->max_eirp); 1166 - } 1167 - #else 1168 - static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, 1169 - struct ieee80211_channel *chan, 1170 - const struct ieee80211_reg_rule *reg_rule) 1171 - { 1172 - return; 1173 - } 1174 1117 #endif 1118 + } 1175 1119 1176 1120 /* 1177 1121 * Note that right now we assume the desired channel bandwidth ··· 1353 1311 return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS); 1354 1312 } 1355 1313 #else 1356 - static int reg_ignore_cell_hint(struct regulatory_request *pending_request) 1314 + static enum reg_request_treatment 1315 + reg_ignore_cell_hint(struct regulatory_request *pending_request) 1357 1316 { 1358 1317 return REG_REQ_IGNORE; 1359 1318 } ··· 1889 1846 need_more_processing = true; 1890 1847 spin_unlock(&reg_requests_lock); 1891 1848 1892 - cancel_delayed_work(&reg_timeout); 1849 + cancel_crda_timeout(); 1893 1850 1894 1851 if (need_more_processing) 1895 1852 schedule_work(&reg_work); ··· 1901 1858 * 1902 1859 * The wireless subsystem can use this function to process 1903 1860 * a regulatory request issued by the regulatory core. 1904 - * 1905 - * Returns one of the different reg request treatment values. 1906 1861 */ 1907 1862 static enum reg_request_treatment 1908 1863 reg_process_hint_core(struct regulatory_request *core_request) 1909 1864 { 1865 + if (reg_query_database(core_request)) { 1866 + core_request->intersect = false; 1867 + core_request->processed = false; 1868 + reg_update_last_request(core_request); 1869 + return REG_REQ_OK; 1870 + } 1910 1871 1911 - core_request->intersect = false; 1912 - core_request->processed = false; 1913 - 1914 - reg_update_last_request(core_request); 1915 - 1916 - return reg_call_crda(core_request); 1872 + return REG_REQ_IGNORE; 1917 1873 } 1918 1874 1919 1875 static enum reg_request_treatment ··· 1957 1915 * 1958 1916 * The wireless subsystem can use this function to process 1959 1917 * a regulatory request initiated by userspace. 1960 - * 1961 - * Returns one of the different reg request treatment values. 1962 1918 */ 1963 1919 static enum reg_request_treatment 1964 1920 reg_process_hint_user(struct regulatory_request *user_request) ··· 1965 1925 1966 1926 treatment = __reg_process_hint_user(user_request); 1967 1927 if (treatment == REG_REQ_IGNORE || 1968 - treatment == REG_REQ_ALREADY_SET) { 1969 - reg_free_request(user_request); 1970 - return treatment; 1971 - } 1928 + treatment == REG_REQ_ALREADY_SET) 1929 + return REG_REQ_IGNORE; 1972 1930 1973 1931 user_request->intersect = treatment == REG_REQ_INTERSECT; 1974 1932 user_request->processed = false; 1975 1933 1976 - reg_update_last_request(user_request); 1934 + if (reg_query_database(user_request)) { 1935 + reg_update_last_request(user_request); 1936 + user_alpha2[0] = user_request->alpha2[0]; 1937 + user_alpha2[1] = user_request->alpha2[1]; 1938 + return REG_REQ_OK; 1939 + } 1977 1940 1978 - user_alpha2[0] = user_request->alpha2[0]; 1979 - user_alpha2[1] = user_request->alpha2[1]; 1980 - 1981 - return reg_call_crda(user_request); 1941 + return REG_REQ_IGNORE; 1982 1942 } 1983 1943 1984 1944 static enum reg_request_treatment ··· 2026 1986 case REG_REQ_OK: 2027 1987 break; 2028 1988 case REG_REQ_IGNORE: 2029 - reg_free_request(driver_request); 2030 - return treatment; 1989 + return REG_REQ_IGNORE; 2031 1990 case REG_REQ_INTERSECT: 2032 - /* fall through */ 2033 1991 case REG_REQ_ALREADY_SET: 2034 1992 regd = reg_copy_regd(get_cfg80211_regdom()); 2035 - if (IS_ERR(regd)) { 2036 - reg_free_request(driver_request); 1993 + if (IS_ERR(regd)) 2037 1994 return REG_REQ_IGNORE; 2038 - } 2039 1995 2040 1996 tmp = get_wiphy_regdom(wiphy); 2041 1997 rcu_assign_pointer(wiphy->regd, regd); ··· 2042 2006 driver_request->intersect = treatment == REG_REQ_INTERSECT; 2043 2007 driver_request->processed = false; 2044 2008 2045 - reg_update_last_request(driver_request); 2046 - 2047 2009 /* 2048 2010 * Since CRDA will not be called in this case as we already 2049 2011 * have applied the requested regulatory domain before we just ··· 2049 2015 */ 2050 2016 if (treatment == REG_REQ_ALREADY_SET) { 2051 2017 nl80211_send_reg_change_event(driver_request); 2018 + reg_update_last_request(driver_request); 2052 2019 reg_set_request_processed(); 2053 - return treatment; 2020 + return REG_REQ_ALREADY_SET; 2054 2021 } 2055 2022 2056 - return reg_call_crda(driver_request); 2023 + if (reg_query_database(driver_request)) { 2024 + reg_update_last_request(driver_request); 2025 + return REG_REQ_OK; 2026 + } 2027 + 2028 + return REG_REQ_IGNORE; 2057 2029 } 2058 2030 2059 2031 static enum reg_request_treatment ··· 2125 2085 case REG_REQ_OK: 2126 2086 break; 2127 2087 case REG_REQ_IGNORE: 2128 - /* fall through */ 2088 + return REG_REQ_IGNORE; 2129 2089 case REG_REQ_ALREADY_SET: 2130 2090 reg_free_request(country_ie_request); 2131 - return treatment; 2091 + return REG_REQ_ALREADY_SET; 2132 2092 case REG_REQ_INTERSECT: 2133 - reg_free_request(country_ie_request); 2134 2093 /* 2135 2094 * This doesn't happen yet, not sure we 2136 2095 * ever want to support it for this case. ··· 2141 2102 country_ie_request->intersect = false; 2142 2103 country_ie_request->processed = false; 2143 2104 2144 - reg_update_last_request(country_ie_request); 2105 + if (reg_query_database(country_ie_request)) { 2106 + reg_update_last_request(country_ie_request); 2107 + return REG_REQ_OK; 2108 + } 2145 2109 2146 - return reg_call_crda(country_ie_request); 2110 + return REG_REQ_IGNORE; 2147 2111 } 2148 2112 2149 2113 /* This processes *all* regulatory hints */ ··· 2160 2118 2161 2119 switch (reg_request->initiator) { 2162 2120 case NL80211_REGDOM_SET_BY_CORE: 2163 - reg_process_hint_core(reg_request); 2164 - return; 2121 + treatment = reg_process_hint_core(reg_request); 2122 + break; 2165 2123 case NL80211_REGDOM_SET_BY_USER: 2166 - reg_process_hint_user(reg_request); 2167 - return; 2124 + treatment = reg_process_hint_user(reg_request); 2125 + break; 2168 2126 case NL80211_REGDOM_SET_BY_DRIVER: 2169 2127 if (!wiphy) 2170 2128 goto out_free; ··· 2179 2137 WARN(1, "invalid initiator %d\n", reg_request->initiator); 2180 2138 goto out_free; 2181 2139 } 2140 + 2141 + if (treatment == REG_REQ_IGNORE) 2142 + goto out_free; 2143 + 2144 + WARN(treatment != REG_REQ_OK && treatment != REG_REQ_ALREADY_SET, 2145 + "unexpected treatment value %d\n", treatment); 2182 2146 2183 2147 /* This is required so that the orig_* parameters are saved. 2184 2148 * NOTE: treatment must be set for any case that reaches here! ··· 2393 2345 request->user_reg_hint_type = user_reg_hint_type; 2394 2346 2395 2347 /* Allow calling CRDA again */ 2396 - reg_crda_timeouts = 0; 2348 + reset_crda_timeouts(); 2397 2349 2398 2350 queue_regulatory_request(request); 2399 2351 ··· 2465 2417 request->initiator = NL80211_REGDOM_SET_BY_DRIVER; 2466 2418 2467 2419 /* Allow calling CRDA again */ 2468 - reg_crda_timeouts = 0; 2420 + reset_crda_timeouts(); 2469 2421 2470 2422 queue_regulatory_request(request); 2471 2423 ··· 2521 2473 request->country_ie_env = env; 2522 2474 2523 2475 /* Allow calling CRDA again */ 2524 - reg_crda_timeouts = 0; 2476 + reset_crda_timeouts(); 2525 2477 2526 2478 queue_regulatory_request(request); 2527 2479 request = NULL; ··· 2922 2874 } 2923 2875 2924 2876 request_wiphy = wiphy_idx_to_wiphy(driver_request->wiphy_idx); 2925 - if (!request_wiphy) { 2926 - queue_delayed_work(system_power_efficient_wq, 2927 - &reg_timeout, 0); 2877 + if (!request_wiphy) 2928 2878 return -ENODEV; 2929 - } 2930 2879 2931 2880 if (!driver_request->intersect) { 2932 2881 if (request_wiphy->regd) ··· 2980 2935 } 2981 2936 2982 2937 request_wiphy = wiphy_idx_to_wiphy(country_ie_request->wiphy_idx); 2983 - if (!request_wiphy) { 2984 - queue_delayed_work(system_power_efficient_wq, 2985 - &reg_timeout, 0); 2938 + if (!request_wiphy) 2986 2939 return -ENODEV; 2987 - } 2988 2940 2989 2941 if (country_ie_request->intersect) 2990 2942 return -EINVAL; ··· 3008 2966 } 3009 2967 3010 2968 if (regd_src == REGD_SOURCE_CRDA) 3011 - reg_crda_timeouts = 0; 2969 + reset_crda_timeouts(); 3012 2970 3013 2971 lr = get_last_request(); 3014 2972 ··· 3165 3123 lr->country_ie_env = ENVIRON_ANY; 3166 3124 } 3167 3125 3168 - static void reg_timeout_work(struct work_struct *work) 3169 - { 3170 - REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); 3171 - rtnl_lock(); 3172 - reg_crda_timeouts++; 3173 - restore_regulatory_settings(true); 3174 - rtnl_unlock(); 3175 - } 3176 - 3177 3126 /* 3178 3127 * See http://www.fcc.gov/document/5-ghz-unlicensed-spectrum-unii, for 3179 3128 * UNII band definitions ··· 3250 3217 struct reg_beacon *reg_beacon, *btmp; 3251 3218 3252 3219 cancel_work_sync(&reg_work); 3253 - cancel_delayed_work_sync(&reg_timeout); 3220 + cancel_crda_timeout_sync(); 3254 3221 cancel_delayed_work_sync(&reg_check_chans); 3255 3222 3256 3223 /* Lock to suppress warnings */
+31 -30
net/wireless/scan.c
··· 266 266 spin_lock_bh(&rdev->bss_lock); 267 267 __cfg80211_bss_expire(rdev, request->scan_start); 268 268 spin_unlock_bh(&rdev->bss_lock); 269 - request->scan_start = 270 - jiffies + msecs_to_jiffies(request->interval); 269 + request->scan_start = jiffies; 271 270 } 272 271 nl80211_send_sched_scan_results(rdev, request->dev); 273 272 } ··· 838 839 found->pub.signal = tmp->pub.signal; 839 840 found->pub.capability = tmp->pub.capability; 840 841 found->ts = tmp->ts; 842 + found->ts_boottime = tmp->ts_boottime; 841 843 } else { 842 844 struct cfg80211_internal_bss *new; 843 845 struct cfg80211_internal_bss *hidden; ··· 938 938 } 939 939 940 940 /* Returned bss is reference counted and must be cleaned up appropriately. */ 941 - struct cfg80211_bss* 942 - cfg80211_inform_bss_width(struct wiphy *wiphy, 943 - struct ieee80211_channel *rx_channel, 944 - enum nl80211_bss_scan_width scan_width, 945 - enum cfg80211_bss_frame_type ftype, 946 - const u8 *bssid, u64 tsf, u16 capability, 947 - u16 beacon_interval, const u8 *ie, size_t ielen, 948 - s32 signal, gfp_t gfp) 941 + struct cfg80211_bss * 942 + cfg80211_inform_bss_data(struct wiphy *wiphy, 943 + struct cfg80211_inform_bss *data, 944 + enum cfg80211_bss_frame_type ftype, 945 + const u8 *bssid, u64 tsf, u16 capability, 946 + u16 beacon_interval, const u8 *ie, size_t ielen, 947 + gfp_t gfp) 949 948 { 950 949 struct cfg80211_bss_ies *ies; 951 950 struct ieee80211_channel *channel; ··· 956 957 return NULL; 957 958 958 959 if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && 959 - (signal < 0 || signal > 100))) 960 + (data->signal < 0 || data->signal > 100))) 960 961 return NULL; 961 962 962 - channel = cfg80211_get_bss_channel(wiphy, ie, ielen, rx_channel); 963 + channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan); 963 964 if (!channel) 964 965 return NULL; 965 966 966 967 memcpy(tmp.pub.bssid, bssid, ETH_ALEN); 967 968 tmp.pub.channel = channel; 968 - tmp.pub.scan_width = scan_width; 969 - tmp.pub.signal = signal; 969 + tmp.pub.scan_width = data->scan_width; 970 + tmp.pub.signal = data->signal; 970 971 tmp.pub.beacon_interval = beacon_interval; 971 972 tmp.pub.capability = capability; 973 + tmp.ts_boottime = data->boottime_ns; 974 + 972 975 /* 973 976 * If we do not know here whether the IEs are from a Beacon or Probe 974 977 * Response frame, we need to pick one of the options and only use it ··· 1000 999 } 1001 1000 rcu_assign_pointer(tmp.pub.ies, ies); 1002 1001 1003 - signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= 1002 + signal_valid = abs(data->chan->center_freq - channel->center_freq) <= 1004 1003 wiphy->max_adj_channel_rssi_comp; 1005 1004 res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid); 1006 1005 if (!res) ··· 1020 1019 /* cfg80211_bss_update gives us a referenced result */ 1021 1020 return &res->pub; 1022 1021 } 1023 - EXPORT_SYMBOL(cfg80211_inform_bss_width); 1022 + EXPORT_SYMBOL(cfg80211_inform_bss_data); 1024 1023 1025 - /* Returned bss is reference counted and must be cleaned up appropriately. */ 1024 + /* cfg80211_inform_bss_width_frame helper */ 1026 1025 struct cfg80211_bss * 1027 - cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 1028 - struct ieee80211_channel *rx_channel, 1029 - enum nl80211_bss_scan_width scan_width, 1030 - struct ieee80211_mgmt *mgmt, size_t len, 1031 - s32 signal, gfp_t gfp) 1026 + cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 1027 + struct cfg80211_inform_bss *data, 1028 + struct ieee80211_mgmt *mgmt, size_t len, 1029 + gfp_t gfp) 1030 + 1032 1031 { 1033 1032 struct cfg80211_internal_bss tmp = {}, *res; 1034 1033 struct cfg80211_bss_ies *ies; ··· 1041 1040 BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) != 1042 1041 offsetof(struct ieee80211_mgmt, u.beacon.variable)); 1043 1042 1044 - trace_cfg80211_inform_bss_width_frame(wiphy, rx_channel, scan_width, mgmt, 1045 - len, signal); 1043 + trace_cfg80211_inform_bss_frame(wiphy, data, mgmt, len); 1046 1044 1047 1045 if (WARN_ON(!mgmt)) 1048 1046 return NULL; ··· 1050 1050 return NULL; 1051 1051 1052 1052 if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && 1053 - (signal < 0 || signal > 100))) 1053 + (data->signal < 0 || data->signal > 100))) 1054 1054 return NULL; 1055 1055 1056 1056 if (WARN_ON(len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable))) 1057 1057 return NULL; 1058 1058 1059 1059 channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable, 1060 - ielen, rx_channel); 1060 + ielen, data->chan); 1061 1061 if (!channel) 1062 1062 return NULL; 1063 1063 ··· 1077 1077 1078 1078 memcpy(tmp.pub.bssid, mgmt->bssid, ETH_ALEN); 1079 1079 tmp.pub.channel = channel; 1080 - tmp.pub.scan_width = scan_width; 1081 - tmp.pub.signal = signal; 1080 + tmp.pub.scan_width = data->scan_width; 1081 + tmp.pub.signal = data->signal; 1082 1082 tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); 1083 1083 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 1084 + tmp.ts_boottime = data->boottime_ns; 1084 1085 1085 - signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= 1086 + signal_valid = abs(data->chan->center_freq - channel->center_freq) <= 1086 1087 wiphy->max_adj_channel_rssi_comp; 1087 1088 res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid); 1088 1089 if (!res) ··· 1103 1102 /* cfg80211_bss_update gives us a referenced result */ 1104 1103 return &res->pub; 1105 1104 } 1106 - EXPORT_SYMBOL(cfg80211_inform_bss_width_frame); 1105 + EXPORT_SYMBOL(cfg80211_inform_bss_frame_data); 1107 1106 1108 1107 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) 1109 1108 {
+11 -11
net/wireless/trace.h
··· 2670 2670 __entry->privacy) 2671 2671 ); 2672 2672 2673 - TRACE_EVENT(cfg80211_inform_bss_width_frame, 2674 - TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel, 2675 - enum nl80211_bss_scan_width scan_width, 2676 - struct ieee80211_mgmt *mgmt, size_t len, 2677 - s32 signal), 2678 - TP_ARGS(wiphy, channel, scan_width, mgmt, len, signal), 2673 + TRACE_EVENT(cfg80211_inform_bss_frame, 2674 + TP_PROTO(struct wiphy *wiphy, struct cfg80211_inform_bss *data, 2675 + struct ieee80211_mgmt *mgmt, size_t len), 2676 + TP_ARGS(wiphy, data, mgmt, len), 2679 2677 TP_STRUCT__entry( 2680 2678 WIPHY_ENTRY 2681 2679 CHAN_ENTRY 2682 2680 __field(enum nl80211_bss_scan_width, scan_width) 2683 2681 __dynamic_array(u8, mgmt, len) 2684 2682 __field(s32, signal) 2683 + __field(u64, ts_boottime) 2685 2684 ), 2686 2685 TP_fast_assign( 2687 2686 WIPHY_ASSIGN; 2688 - CHAN_ASSIGN(channel); 2689 - __entry->scan_width = scan_width; 2687 + CHAN_ASSIGN(data->chan); 2688 + __entry->scan_width = data->scan_width; 2690 2689 if (mgmt) 2691 2690 memcpy(__get_dynamic_array(mgmt), mgmt, len); 2692 - __entry->signal = signal; 2691 + __entry->signal = data->signal; 2692 + __entry->ts_boottime = data->boottime_ns; 2693 2693 ), 2694 - TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT "(scan_width: %d) signal: %d", 2694 + TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT "(scan_width: %d) signal: %d, tsb:%llu", 2695 2695 WIPHY_PR_ARG, CHAN_PR_ARG, __entry->scan_width, 2696 - __entry->signal) 2696 + __entry->signal, (unsigned long long)__entry->ts_boottime) 2697 2697 ); 2698 2698 2699 2699 DECLARE_EVENT_CLASS(cfg80211_bss_evt,