aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-11-17 08:08:11 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-08 09:28:10 -0500
commit319090bf6c75e3ad42a8c74973be5e78ae4f948f (patch)
tree499fe25951bd986948c2b0e0552dfeca0784ae3a
parent2b9a7e1bac24df8ddb0713ad1e5807a7243bcab0 (diff)
cfg80211: remove enum station_info_flags
This is really just duplicating the list of information that's already available in the nl80211 attribute, so remove the list. Two small changes are needed: * remove STATION_INFO_ASSOC_REQ_IES complete, but the length (assoc_req_ies_len) can be used instead * add NL80211_STA_INFO_RX_DROP_MISC which exists internally but not in nl80211 yet This gets rid of the duplicate maintenance of the two lists. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c14
-rw-r--r--drivers/net/wireless/ath/ath6kl/main.c1
-rw-r--r--drivers/net/wireless/ath/wil6210/cfg80211.c18
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.c1
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c11
-rw-r--r--drivers/net/wireless/libertas/cfg.c12
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c10
-rw-r--r--drivers/net/wireless/mwifiex/uap_event.c1
-rw-r--r--drivers/net/wireless/rndis_wlan.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c2
-rw-r--r--drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c9
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c4
-rw-r--r--include/net/cfg80211.h77
-rw-r--r--include/uapi/linux/nl80211.h3
-rw-r--r--net/mac80211/ethtool.c6
-rw-r--r--net/mac80211/sta_info.c80
-rw-r--r--net/wireless/nl80211.c133
-rw-r--r--net/wireless/wext-compat.c10
18 files changed, 142 insertions, 254 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 7a5337877a0c..44dd6ef923cd 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1799,20 +1799,20 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1799 1799
1800 if (vif->target_stats.rx_byte) { 1800 if (vif->target_stats.rx_byte) {
1801 sinfo->rx_bytes = vif->target_stats.rx_byte; 1801 sinfo->rx_bytes = vif->target_stats.rx_byte;
1802 sinfo->filled |= STATION_INFO_RX_BYTES64; 1802 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
1803 sinfo->rx_packets = vif->target_stats.rx_pkt; 1803 sinfo->rx_packets = vif->target_stats.rx_pkt;
1804 sinfo->filled |= STATION_INFO_RX_PACKETS; 1804 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
1805 } 1805 }
1806 1806
1807 if (vif->target_stats.tx_byte) { 1807 if (vif->target_stats.tx_byte) {
1808 sinfo->tx_bytes = vif->target_stats.tx_byte; 1808 sinfo->tx_bytes = vif->target_stats.tx_byte;
1809 sinfo->filled |= STATION_INFO_TX_BYTES64; 1809 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64);
1810 sinfo->tx_packets = vif->target_stats.tx_pkt; 1810 sinfo->tx_packets = vif->target_stats.tx_pkt;
1811 sinfo->filled |= STATION_INFO_TX_PACKETS; 1811 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
1812 } 1812 }
1813 1813
1814 sinfo->signal = vif->target_stats.cs_rssi; 1814 sinfo->signal = vif->target_stats.cs_rssi;
1815 sinfo->filled |= STATION_INFO_SIGNAL; 1815 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
1816 1816
1817 rate = vif->target_stats.tx_ucast_rate; 1817 rate = vif->target_stats.tx_ucast_rate;
1818 1818
@@ -1844,12 +1844,12 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1844 return 0; 1844 return 0;
1845 } 1845 }
1846 1846
1847 sinfo->filled |= STATION_INFO_TX_BITRATE; 1847 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
1848 1848
1849 if (test_bit(CONNECTED, &vif->flags) && 1849 if (test_bit(CONNECTED, &vif->flags) &&
1850 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) && 1850 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) &&
1851 vif->nw_type == INFRA_NETWORK) { 1851 vif->nw_type == INFRA_NETWORK) {
1852 sinfo->filled |= STATION_INFO_BSS_PARAM; 1852 sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
1853 sinfo->bss_param.flags = 0; 1853 sinfo->bss_param.flags = 0;
1854 sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period; 1854 sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period;
1855 sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int; 1855 sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int;
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index 933aef025698..b42ba46b5030 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -488,7 +488,6 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,
488 488
489 sinfo.assoc_req_ies = ies; 489 sinfo.assoc_req_ies = ies;
490 sinfo.assoc_req_ies_len = ies_len; 490 sinfo.assoc_req_ies_len = ies_len;
491 sinfo.filled |= STATION_INFO_ASSOC_REQ_IES;
492 491
493 cfg80211_new_sta(vif->ndev, mac_addr, &sinfo, GFP_KERNEL); 492 cfg80211_new_sta(vif->ndev, mac_addr, &sinfo, GFP_KERNEL);
494 493
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 38332a6dfb3a..e72a95d1ced6 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -142,14 +142,14 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
142 142
143 sinfo->generation = wil->sinfo_gen; 143 sinfo->generation = wil->sinfo_gen;
144 144
145 sinfo->filled = STATION_INFO_RX_BYTES | 145 sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) |
146 STATION_INFO_TX_BYTES | 146 BIT(NL80211_STA_INFO_TX_BYTES) |
147 STATION_INFO_RX_PACKETS | 147 BIT(NL80211_STA_INFO_RX_PACKETS) |
148 STATION_INFO_TX_PACKETS | 148 BIT(NL80211_STA_INFO_TX_PACKETS) |
149 STATION_INFO_RX_BITRATE | 149 BIT(NL80211_STA_INFO_RX_BITRATE) |
150 STATION_INFO_TX_BITRATE | 150 BIT(NL80211_STA_INFO_TX_BITRATE) |
151 STATION_INFO_RX_DROP_MISC | 151 BIT(NL80211_STA_INFO_RX_DROP_MISC) |
152 STATION_INFO_TX_FAILED; 152 BIT(NL80211_STA_INFO_TX_FAILED);
153 153
154 sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; 154 sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G;
155 sinfo->txrate.mcs = le16_to_cpu(reply.evt.bf_mcs); 155 sinfo->txrate.mcs = le16_to_cpu(reply.evt.bf_mcs);
@@ -163,7 +163,7 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
163 sinfo->tx_failed = stats->tx_errors; 163 sinfo->tx_failed = stats->tx_errors;
164 164
165 if (test_bit(wil_status_fwconnected, &wil->status)) { 165 if (test_bit(wil_status_fwconnected, &wil->status)) {
166 sinfo->filled |= STATION_INFO_SIGNAL; 166 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
167 sinfo->signal = reply.evt.sqi; 167 sinfo->signal = reply.evt.sqi;
168 } 168 }
169 169
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 63476c86cd0e..899754920955 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -457,7 +457,6 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
457 if (assoc_req_ie) { 457 if (assoc_req_ie) {
458 sinfo.assoc_req_ies = assoc_req_ie; 458 sinfo.assoc_req_ies = assoc_req_ie;
459 sinfo.assoc_req_ies_len = assoc_req_ielen; 459 sinfo.assoc_req_ies_len = assoc_req_ielen;
460 sinfo.filled |= STATION_INFO_ASSOC_REQ_IES;
461 } 460 }
462 461
463 cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL); 462 cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index 3aecc5f48719..4a88b2381a68 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -2333,10 +2333,10 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2333 brcmf_err("GET STA INFO failed, %d\n", err); 2333 brcmf_err("GET STA INFO failed, %d\n", err);
2334 goto done; 2334 goto done;
2335 } 2335 }
2336 sinfo->filled = STATION_INFO_INACTIVE_TIME; 2336 sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
2337 sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; 2337 sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
2338 if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) { 2338 if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
2339 sinfo->filled |= STATION_INFO_CONNECTED_TIME; 2339 sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
2340 sinfo->connected_time = le32_to_cpu(sta_info_le.in); 2340 sinfo->connected_time = le32_to_cpu(sta_info_le.in);
2341 } 2341 }
2342 brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n", 2342 brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
@@ -2354,7 +2354,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2354 brcmf_err("Could not get rate (%d)\n", err); 2354 brcmf_err("Could not get rate (%d)\n", err);
2355 goto done; 2355 goto done;
2356 } else { 2356 } else {
2357 sinfo->filled |= STATION_INFO_TX_BITRATE; 2357 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
2358 sinfo->txrate.legacy = rate * 5; 2358 sinfo->txrate.legacy = rate * 5;
2359 brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2); 2359 brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
2360 } 2360 }
@@ -2369,7 +2369,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2369 goto done; 2369 goto done;
2370 } else { 2370 } else {
2371 rssi = le32_to_cpu(scb_val.val); 2371 rssi = le32_to_cpu(scb_val.val);
2372 sinfo->filled |= STATION_INFO_SIGNAL; 2372 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
2373 sinfo->signal = rssi; 2373 sinfo->signal = rssi;
2374 brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); 2374 brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
2375 } 2375 }
@@ -2396,7 +2396,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2396 brcmf_dbg(CONN, "DTIM peroid %d\n", 2396 brcmf_dbg(CONN, "DTIM peroid %d\n",
2397 dtim_period); 2397 dtim_period);
2398 } 2398 }
2399 sinfo->filled |= STATION_INFO_BSS_PARAM; 2399 sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
2400 } 2400 }
2401 } else 2401 } else
2402 err = -EPERM; 2402 err = -EPERM;
@@ -4778,7 +4778,6 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
4778 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && 4778 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
4779 (reason == BRCMF_E_STATUS_SUCCESS)) { 4779 (reason == BRCMF_E_STATUS_SUCCESS)) {
4780 memset(&sinfo, 0, sizeof(sinfo)); 4780 memset(&sinfo, 0, sizeof(sinfo));
4781 sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
4782 if (!data) { 4781 if (!data) {
4783 brcmf_err("No IEs present in ASSOC/REASSOC_IND"); 4782 brcmf_err("No IEs present in ASSOC/REASSOC_IND");
4784 return -EINVAL; 4783 return -EINVAL;
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 34f09ef90bb3..a92985a6ea21 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1616,10 +1616,10 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev,
1616 1616
1617 lbs_deb_enter(LBS_DEB_CFG80211); 1617 lbs_deb_enter(LBS_DEB_CFG80211);
1618 1618
1619 sinfo->filled |= STATION_INFO_TX_BYTES | 1619 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES) |
1620 STATION_INFO_TX_PACKETS | 1620 BIT(NL80211_STA_INFO_TX_PACKETS) |
1621 STATION_INFO_RX_BYTES | 1621 BIT(NL80211_STA_INFO_RX_BYTES) |
1622 STATION_INFO_RX_PACKETS; 1622 BIT(NL80211_STA_INFO_RX_PACKETS);
1623 sinfo->tx_bytes = priv->dev->stats.tx_bytes; 1623 sinfo->tx_bytes = priv->dev->stats.tx_bytes;
1624 sinfo->tx_packets = priv->dev->stats.tx_packets; 1624 sinfo->tx_packets = priv->dev->stats.tx_packets;
1625 sinfo->rx_bytes = priv->dev->stats.rx_bytes; 1625 sinfo->rx_bytes = priv->dev->stats.rx_bytes;
@@ -1629,14 +1629,14 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev,
1629 ret = lbs_get_rssi(priv, &signal, &noise); 1629 ret = lbs_get_rssi(priv, &signal, &noise);
1630 if (ret == 0) { 1630 if (ret == 0) {
1631 sinfo->signal = signal; 1631 sinfo->signal = signal;
1632 sinfo->filled |= STATION_INFO_SIGNAL; 1632 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
1633 } 1633 }
1634 1634
1635 /* Convert priv->cur_rate from hw_value to NL80211 value */ 1635 /* Convert priv->cur_rate from hw_value to NL80211 value */
1636 for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) { 1636 for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) {
1637 if (priv->cur_rate == lbs_rates[i].hw_value) { 1637 if (priv->cur_rate == lbs_rates[i].hw_value) {
1638 sinfo->txrate.legacy = lbs_rates[i].bitrate; 1638 sinfo->txrate.legacy = lbs_rates[i].bitrate;
1639 sinfo->filled |= STATION_INFO_TX_BITRATE; 1639 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
1640 break; 1640 break;
1641 } 1641 }
1642 } 1642 }
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 8bd446b69658..71312ff52703 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -910,10 +910,10 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
910{ 910{
911 u32 rate; 911 u32 rate;
912 912
913 sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | 913 sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) | BIT(NL80211_STA_INFO_TX_BYTES) |
914 STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | 914 BIT(NL80211_STA_INFO_RX_PACKETS) | BIT(NL80211_STA_INFO_TX_PACKETS) |
915 STATION_INFO_TX_BITRATE | 915 BIT(NL80211_STA_INFO_TX_BITRATE) |
916 STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 916 BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_SIGNAL_AVG);
917 917
918 /* Get signal information from the firmware */ 918 /* Get signal information from the firmware */
919 if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO, 919 if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
@@ -944,7 +944,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
944 sinfo->txrate.legacy = rate * 5; 944 sinfo->txrate.legacy = rate * 5;
945 945
946 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 946 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
947 sinfo->filled |= STATION_INFO_BSS_PARAM; 947 sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
948 sinfo->bss_param.flags = 0; 948 sinfo->bss_param.flags = 0;
949 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & 949 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap &
950 WLAN_CAPABILITY_SHORT_PREAMBLE) 950 WLAN_CAPABILITY_SHORT_PREAMBLE)
diff --git a/drivers/net/wireless/mwifiex/uap_event.c b/drivers/net/wireless/mwifiex/uap_event.c
index c54a537e31fb..3b3a970e2086 100644
--- a/drivers/net/wireless/mwifiex/uap_event.c
+++ b/drivers/net/wireless/mwifiex/uap_event.c
@@ -68,7 +68,6 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
68 len = ETH_ALEN; 68 len = ETH_ALEN;
69 69
70 if (len != -1) { 70 if (len != -1) {
71 sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
72 sinfo.assoc_req_ies = &event->data[len]; 71 sinfo.assoc_req_ies = &event->data[len];
73 len = (u8 *)sinfo.assoc_req_ies - 72 len = (u8 *)sinfo.assoc_req_ies -
74 (u8 *)&event->frame_control; 73 (u8 *)&event->frame_control;
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 1a4facd1fbf3..60d44ce9c017 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2478,7 +2478,7 @@ static void rndis_fill_station_info(struct usbnet *usbdev,
2478 ret = rndis_query_oid(usbdev, RNDIS_OID_GEN_LINK_SPEED, &linkspeed, &len); 2478 ret = rndis_query_oid(usbdev, RNDIS_OID_GEN_LINK_SPEED, &linkspeed, &len);
2479 if (ret == 0) { 2479 if (ret == 0) {
2480 sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000; 2480 sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000;
2481 sinfo->filled |= STATION_INFO_TX_BITRATE; 2481 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
2482 } 2482 }
2483 2483
2484 len = sizeof(rssi); 2484 len = sizeof(rssi);
@@ -2486,7 +2486,7 @@ static void rndis_fill_station_info(struct usbnet *usbdev,
2486 &rssi, &len); 2486 &rssi, &len);
2487 if (ret == 0) { 2487 if (ret == 0) {
2488 sinfo->signal = level_to_qual(le32_to_cpu(rssi)); 2488 sinfo->signal = level_to_qual(le32_to_cpu(rssi));
2489 sinfo->filled |= STATION_INFO_SIGNAL; 2489 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
2490 } 2490 }
2491} 2491}
2492 2492
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 8d11b0ca412c..a2133b1fd631 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5401,7 +5401,7 @@ static void wlcore_op_sta_statistics(struct ieee80211_hw *hw,
5401 if (ret < 0) 5401 if (ret < 0)
5402 goto out_sleep; 5402 goto out_sleep;
5403 5403
5404 sinfo->filled |= STATION_INFO_SIGNAL; 5404 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
5405 sinfo->signal = rssi_dbm; 5405 sinfo->signal = rssi_dbm;
5406 5406
5407out_sleep: 5407out_sleep:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 3d26955da724..c76874d72a22 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1092,17 +1092,17 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
1092 goto exit; 1092 goto exit;
1093 } 1093 }
1094 1094
1095 sinfo->filled |= STATION_INFO_SIGNAL; 1095 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
1096 sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv. 1096 sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.
1097 signal_strength); 1097 signal_strength);
1098 1098
1099 sinfo->filled |= STATION_INFO_TX_BITRATE; 1099 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
1100 sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); 1100 sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
1101 1101
1102 sinfo->filled |= STATION_INFO_RX_PACKETS; 1102 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
1103 sinfo->rx_packets = sta_rx_data_pkts(psta); 1103 sinfo->rx_packets = sta_rx_data_pkts(psta);
1104 1104
1105 sinfo->filled |= STATION_INFO_TX_PACKETS; 1105 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
1106 sinfo->tx_packets = psta->sta_stats.tx_pkts; 1106 sinfo->tx_packets = psta->sta_stats.tx_pkts;
1107 } 1107 }
1108 1108
@@ -2365,7 +2365,6 @@ void rtw_cfg80211_indicate_sta_assoc(struct rtw_adapter *padapter,
2365 u.reassoc_req.variable); 2365 u.reassoc_req.variable);
2366 2366
2367 sinfo.filled = 0; 2367 sinfo.filled = 0;
2368 sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
2369 sinfo.assoc_req_ies = pmgmt_frame + ie_offset; 2368 sinfo.assoc_req_ies = pmgmt_frame + ie_offset;
2370 sinfo.assoc_req_ies_len = frame_len - ie_offset; 2369 sinfo.assoc_req_ies_len = frame_len - ie_offset;
2371 cfg80211_new_sta(ndev, hdr->addr2, &sinfo, GFP_ATOMIC); 2370 cfg80211_new_sta(ndev, hdr->addr2, &sinfo, GFP_ATOMIC);
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 8942dcb44180..7c87aecf4744 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -325,9 +325,9 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
325 325
326 if (result == 0) { 326 if (result == 0) {
327 sinfo->txrate.legacy = quality.txrate.data; 327 sinfo->txrate.legacy = quality.txrate.data;
328 sinfo->filled |= STATION_INFO_TX_BITRATE; 328 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
329 sinfo->signal = quality.level.data; 329 sinfo->signal = quality.level.data;
330 sinfo->filled |= STATION_INFO_SIGNAL; 330 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
331 } 331 }
332 332
333 return result; 333 return result;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 42e3d74f1906..91c133626c32 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -866,75 +866,6 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
866 enum cfg80211_station_type statype); 866 enum cfg80211_station_type statype);
867 867
868/** 868/**
869 * enum station_info_flags - station information flags
870 *
871 * Used by the driver to indicate which info in &struct station_info
872 * it has filled in during get_station() or dump_station().
873 *
874 * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
875 * @STATION_INFO_RX_BYTES: @rx_bytes filled
876 * @STATION_INFO_TX_BYTES: @tx_bytes filled
877 * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value
878 * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value
879 * @STATION_INFO_LLID: @llid filled
880 * @STATION_INFO_PLID: @plid filled
881 * @STATION_INFO_PLINK_STATE: @plink_state filled
882 * @STATION_INFO_SIGNAL: @signal filled
883 * @STATION_INFO_TX_BITRATE: @txrate fields are filled
884 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
885 * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value
886 * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value
887 * @STATION_INFO_TX_RETRIES: @tx_retries filled
888 * @STATION_INFO_TX_FAILED: @tx_failed filled
889 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
890 * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
891 * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
892 * @STATION_INFO_BSS_PARAM: @bss_param filled
893 * @STATION_INFO_CONNECTED_TIME: @connected_time filled
894 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
895 * @STATION_INFO_STA_FLAGS: @sta_flags filled
896 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
897 * @STATION_INFO_T_OFFSET: @t_offset filled
898 * @STATION_INFO_LOCAL_PM: @local_pm filled
899 * @STATION_INFO_PEER_PM: @peer_pm filled
900 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
901 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
902 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
903 * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled
904 */
905enum station_info_flags {
906 STATION_INFO_INACTIVE_TIME = BIT(0),
907 STATION_INFO_RX_BYTES = BIT(1),
908 STATION_INFO_TX_BYTES = BIT(2),
909 STATION_INFO_LLID = BIT(3),
910 STATION_INFO_PLID = BIT(4),
911 STATION_INFO_PLINK_STATE = BIT(5),
912 STATION_INFO_SIGNAL = BIT(6),
913 STATION_INFO_TX_BITRATE = BIT(7),
914 STATION_INFO_RX_PACKETS = BIT(8),
915 STATION_INFO_TX_PACKETS = BIT(9),
916 STATION_INFO_TX_RETRIES = BIT(10),
917 STATION_INFO_TX_FAILED = BIT(11),
918 STATION_INFO_RX_DROP_MISC = BIT(12),
919 STATION_INFO_SIGNAL_AVG = BIT(13),
920 STATION_INFO_RX_BITRATE = BIT(14),
921 STATION_INFO_BSS_PARAM = BIT(15),
922 STATION_INFO_CONNECTED_TIME = BIT(16),
923 STATION_INFO_ASSOC_REQ_IES = BIT(17),
924 STATION_INFO_STA_FLAGS = BIT(18),
925 STATION_INFO_BEACON_LOSS_COUNT = BIT(19),
926 STATION_INFO_T_OFFSET = BIT(20),
927 STATION_INFO_LOCAL_PM = BIT(21),
928 STATION_INFO_PEER_PM = BIT(22),
929 STATION_INFO_NONPEER_PM = BIT(23),
930 STATION_INFO_RX_BYTES64 = BIT(24),
931 STATION_INFO_TX_BYTES64 = BIT(25),
932 STATION_INFO_CHAIN_SIGNAL = BIT(26),
933 STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27),
934 STATION_INFO_EXPECTED_THROUGHPUT = BIT(28),
935};
936
937/**
938 * enum station_info_rate_flags - bitrate info flags 869 * enum station_info_rate_flags - bitrate info flags
939 * 870 *
940 * Used by the driver to indicate the specific rate transmission 871 * Used by the driver to indicate the specific rate transmission
@@ -1015,7 +946,8 @@ struct sta_bss_parameters {
1015 * 946 *
1016 * Station information filled by driver for get_station() and dump_station. 947 * Station information filled by driver for get_station() and dump_station.
1017 * 948 *
1018 * @filled: bitflag of flags from &enum station_info_flags 949 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
950 * indicate the relevant values in this struct for them
1019 * @connected_time: time(in secs) since a station is last connected 951 * @connected_time: time(in secs) since a station is last connected
1020 * @inactive_time: time since last station activity (tx/rx) in milliseconds 952 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1021 * @rx_bytes: bytes received from this station 953 * @rx_bytes: bytes received from this station
@@ -1094,11 +1026,6 @@ struct station_info {
1094 enum nl80211_mesh_power_mode nonpeer_pm; 1026 enum nl80211_mesh_power_mode nonpeer_pm;
1095 1027
1096 u32 expected_throughput; 1028 u32 expected_throughput;
1097
1098 /*
1099 * Note: Add a new enum station_info_flags value for each new field and
1100 * use it to check which fields are initialized.
1101 */
1102}; 1029};
1103 1030
1104/** 1031/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 2f549a253138..e48ca0bbd07b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2373,6 +2373,8 @@ enum nl80211_sta_bss_param {
2373 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. 2373 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
2374 * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the 2374 * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the
2375 * 802.11 header (u32, kbps) 2375 * 802.11 header (u32, kbps)
2376 * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons
2377 * (u64)
2376 * @__NL80211_STA_INFO_AFTER_LAST: internal 2378 * @__NL80211_STA_INFO_AFTER_LAST: internal
2377 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2379 * @NL80211_STA_INFO_MAX: highest possible station info attribute
2378 */ 2380 */
@@ -2405,6 +2407,7 @@ enum nl80211_sta_info {
2405 NL80211_STA_INFO_CHAIN_SIGNAL, 2407 NL80211_STA_INFO_CHAIN_SIGNAL,
2406 NL80211_STA_INFO_CHAIN_SIGNAL_AVG, 2408 NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
2407 NL80211_STA_INFO_EXPECTED_THROUGHPUT, 2409 NL80211_STA_INFO_EXPECTED_THROUGHPUT,
2410 NL80211_STA_INFO_RX_DROP_MISC,
2408 2411
2409 /* keep last */ 2412 /* keep last */
2410 __NL80211_STA_INFO_AFTER_LAST, 2413 __NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
index eea742710c0a..52bcea6ad9e8 100644
--- a/net/mac80211/ethtool.c
+++ b/net/mac80211/ethtool.c
@@ -117,16 +117,16 @@ static void ieee80211_get_stats(struct net_device *dev,
117 data[i++] = sta->sta_state; 117 data[i++] = sta->sta_state;
118 118
119 119
120 if (sinfo.filled & STATION_INFO_TX_BITRATE) 120 if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))
121 data[i] = 100000 * 121 data[i] = 100000 *
122 cfg80211_calculate_bitrate(&sinfo.txrate); 122 cfg80211_calculate_bitrate(&sinfo.txrate);
123 i++; 123 i++;
124 if (sinfo.filled & STATION_INFO_RX_BITRATE) 124 if (sinfo.filled & BIT(NL80211_STA_INFO_RX_BITRATE))
125 data[i] = 100000 * 125 data[i] = 100000 *
126 cfg80211_calculate_bitrate(&sinfo.rxrate); 126 cfg80211_calculate_bitrate(&sinfo.rxrate);
127 i++; 127 i++;
128 128
129 if (sinfo.filled & STATION_INFO_SIGNAL_AVG) 129 if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))
130 data[i] = (u8)sinfo.signal_avg; 130 data[i] = (u8)sinfo.signal_avg;
131 i++; 131 i++;
132 } else { 132 } else {
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 967b42eae5c2..64b53b943d98 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1756,51 +1756,51 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1756 1756
1757 drv_sta_statistics(local, sdata, &sta->sta, sinfo); 1757 drv_sta_statistics(local, sdata, &sta->sta, sinfo);
1758 1758
1759 sinfo->filled |= STATION_INFO_INACTIVE_TIME | 1759 sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME) |
1760 STATION_INFO_STA_FLAGS | 1760 BIT(NL80211_STA_INFO_STA_FLAGS) |
1761 STATION_INFO_BSS_PARAM | 1761 BIT(NL80211_STA_INFO_BSS_PARAM) |
1762 STATION_INFO_CONNECTED_TIME | 1762 BIT(NL80211_STA_INFO_CONNECTED_TIME) |
1763 STATION_INFO_RX_DROP_MISC | 1763 BIT(NL80211_STA_INFO_RX_DROP_MISC) |
1764 STATION_INFO_BEACON_LOSS_COUNT; 1764 BIT(NL80211_STA_INFO_BEACON_LOSS);
1765 1765
1766 ktime_get_ts(&uptime); 1766 ktime_get_ts(&uptime);
1767 sinfo->connected_time = uptime.tv_sec - sta->last_connected; 1767 sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1768 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); 1768 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1769 1769
1770 if (!(sinfo->filled & (STATION_INFO_TX_BYTES64 | 1770 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES64) |
1771 STATION_INFO_TX_BYTES))) { 1771 BIT(NL80211_STA_INFO_TX_BYTES)))) {
1772 sinfo->tx_bytes = 0; 1772 sinfo->tx_bytes = 0;
1773 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1773 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
1774 sinfo->tx_bytes += sta->tx_bytes[ac]; 1774 sinfo->tx_bytes += sta->tx_bytes[ac];
1775 sinfo->filled |= STATION_INFO_TX_BYTES64; 1775 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64);
1776 } 1776 }
1777 1777
1778 if (!(sinfo->filled & STATION_INFO_TX_PACKETS)) { 1778 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_PACKETS))) {
1779 sinfo->tx_packets = 0; 1779 sinfo->tx_packets = 0;
1780 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 1780 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
1781 sinfo->tx_packets += sta->tx_packets[ac]; 1781 sinfo->tx_packets += sta->tx_packets[ac];
1782 sinfo->filled |= STATION_INFO_TX_PACKETS; 1782 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
1783 } 1783 }
1784 1784
1785 if (!(sinfo->filled & (STATION_INFO_RX_BYTES64 | 1785 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) |
1786 STATION_INFO_RX_BYTES))) { 1786 BIT(NL80211_STA_INFO_RX_BYTES)))) {
1787 sinfo->rx_bytes = sta->rx_bytes; 1787 sinfo->rx_bytes = sta->rx_bytes;
1788 sinfo->filled |= STATION_INFO_RX_BYTES64; 1788 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
1789 } 1789 }
1790 1790
1791 if (!(sinfo->filled & STATION_INFO_RX_PACKETS)) { 1791 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_PACKETS))) {
1792 sinfo->rx_packets = sta->rx_packets; 1792 sinfo->rx_packets = sta->rx_packets;
1793 sinfo->filled |= STATION_INFO_RX_PACKETS; 1793 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
1794 } 1794 }
1795 1795
1796 if (!(sinfo->filled & STATION_INFO_TX_RETRIES)) { 1796 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_RETRIES))) {
1797 sinfo->tx_retries = sta->tx_retry_count; 1797 sinfo->tx_retries = sta->tx_retry_count;
1798 sinfo->filled |= STATION_INFO_TX_RETRIES; 1798 sinfo->filled |= BIT(NL80211_STA_INFO_TX_RETRIES);
1799 } 1799 }
1800 1800
1801 if (!(sinfo->filled & STATION_INFO_TX_FAILED)) { 1801 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_FAILED))) {
1802 sinfo->tx_failed = sta->tx_retry_failed; 1802 sinfo->tx_failed = sta->tx_retry_failed;
1803 sinfo->filled |= STATION_INFO_TX_FAILED; 1803 sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
1804 } 1804 }
1805 1805
1806 sinfo->rx_dropped_misc = sta->rx_dropped; 1806 sinfo->rx_dropped_misc = sta->rx_dropped;
@@ -1808,22 +1808,22 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1808 1808
1809 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 1809 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1810 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 1810 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1811 if (!(sinfo->filled & STATION_INFO_SIGNAL)) { 1811 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL))) {
1812 sinfo->signal = (s8)sta->last_signal; 1812 sinfo->signal = (s8)sta->last_signal;
1813 sinfo->filled |= STATION_INFO_SIGNAL; 1813 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
1814 } 1814 }
1815 1815
1816 if (!(sinfo->filled & STATION_INFO_SIGNAL_AVG)) { 1816 if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) {
1817 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 1817 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1818 sinfo->filled |= STATION_INFO_SIGNAL_AVG; 1818 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG);
1819 } 1819 }
1820 } 1820 }
1821 1821
1822 if (sta->chains && 1822 if (sta->chains &&
1823 !(sinfo->filled & (STATION_INFO_CHAIN_SIGNAL | 1823 !(sinfo->filled & (BIT(NL80211_STA_INFO_CHAIN_SIGNAL) |
1824 STATION_INFO_CHAIN_SIGNAL_AVG))) { 1824 BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) {
1825 sinfo->filled |= STATION_INFO_CHAIN_SIGNAL | 1825 sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL) |
1826 STATION_INFO_CHAIN_SIGNAL_AVG; 1826 BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
1827 1827
1828 sinfo->chains = sta->chains; 1828 sinfo->chains = sta->chains;
1829 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { 1829 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
@@ -1833,30 +1833,30 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1833 } 1833 }
1834 } 1834 }
1835 1835
1836 if (!(sinfo->filled & STATION_INFO_TX_BITRATE)) { 1836 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) {
1837 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); 1837 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1838 sinfo->filled |= STATION_INFO_TX_BITRATE; 1838 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
1839 } 1839 }
1840 1840
1841 if (!(sinfo->filled & STATION_INFO_RX_BITRATE)) { 1841 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) {
1842 sta_set_rate_info_rx(sta, &sinfo->rxrate); 1842 sta_set_rate_info_rx(sta, &sinfo->rxrate);
1843 sinfo->filled |= STATION_INFO_RX_BITRATE; 1843 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
1844 } 1844 }
1845 1845
1846 if (ieee80211_vif_is_mesh(&sdata->vif)) { 1846 if (ieee80211_vif_is_mesh(&sdata->vif)) {
1847#ifdef CONFIG_MAC80211_MESH 1847#ifdef CONFIG_MAC80211_MESH
1848 sinfo->filled |= STATION_INFO_LLID | 1848 sinfo->filled |= BIT(NL80211_STA_INFO_LLID) |
1849 STATION_INFO_PLID | 1849 BIT(NL80211_STA_INFO_PLID) |
1850 STATION_INFO_PLINK_STATE | 1850 BIT(NL80211_STA_INFO_PLINK_STATE) |
1851 STATION_INFO_LOCAL_PM | 1851 BIT(NL80211_STA_INFO_LOCAL_PM) |
1852 STATION_INFO_PEER_PM | 1852 BIT(NL80211_STA_INFO_PEER_PM) |
1853 STATION_INFO_NONPEER_PM; 1853 BIT(NL80211_STA_INFO_NONPEER_PM);
1854 1854
1855 sinfo->llid = sta->llid; 1855 sinfo->llid = sta->llid;
1856 sinfo->plid = sta->plid; 1856 sinfo->plid = sta->plid;
1857 sinfo->plink_state = sta->plink_state; 1857 sinfo->plink_state = sta->plink_state;
1858 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { 1858 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1859 sinfo->filled |= STATION_INFO_T_OFFSET; 1859 sinfo->filled |= BIT(NL80211_STA_INFO_T_OFFSET);
1860 sinfo->t_offset = sta->t_offset; 1860 sinfo->t_offset = sta->t_offset;
1861 } 1861 }
1862 sinfo->local_pm = sta->local_pm; 1862 sinfo->local_pm = sta->local_pm;
@@ -1905,7 +1905,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1905 thr = drv_get_expected_throughput(local, &sta->sta); 1905 thr = drv_get_expected_throughput(local, &sta->sta);
1906 1906
1907 if (thr != 0) { 1907 if (thr != 0) {
1908 sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT; 1908 sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
1909 sinfo->expected_throughput = thr; 1909 sinfo->expected_throughput = thr;
1910 } 1910 }
1911} 1911}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a75dc91976d3..68faf8a2aa43 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3671,115 +3671,77 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
3671 sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO); 3671 sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO);
3672 if (!sinfoattr) 3672 if (!sinfoattr)
3673 goto nla_put_failure; 3673 goto nla_put_failure;
3674 if ((sinfo->filled & STATION_INFO_CONNECTED_TIME) && 3674
3675 nla_put_u32(msg, NL80211_STA_INFO_CONNECTED_TIME, 3675#define PUT_SINFO(attr, memb, type) do { \
3676 sinfo->connected_time)) 3676 if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) && \
3677 goto nla_put_failure; 3677 nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr, \
3678 if ((sinfo->filled & STATION_INFO_INACTIVE_TIME) && 3678 sinfo->memb)) \
3679 nla_put_u32(msg, NL80211_STA_INFO_INACTIVE_TIME, 3679 goto nla_put_failure; \
3680 sinfo->inactive_time)) 3680 } while (0)
3681 goto nla_put_failure; 3681
3682 if ((sinfo->filled & (STATION_INFO_RX_BYTES | 3682 PUT_SINFO(CONNECTED_TIME, connected_time, u32);
3683 STATION_INFO_RX_BYTES64)) && 3683 PUT_SINFO(INACTIVE_TIME, inactive_time, u32);
3684
3685 if (sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES) |
3686 BIT(NL80211_STA_INFO_RX_BYTES64)) &&
3684 nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, 3687 nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES,
3685 (u32)sinfo->rx_bytes)) 3688 (u32)sinfo->rx_bytes))
3686 goto nla_put_failure; 3689 goto nla_put_failure;
3687 if ((sinfo->filled & (STATION_INFO_TX_BYTES | 3690
3688 STATION_INFO_TX_BYTES64)) && 3691 if (sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES) |
3692 BIT(NL80211_STA_INFO_TX_BYTES64)) &&
3689 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, 3693 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
3690 (u32)sinfo->tx_bytes)) 3694 (u32)sinfo->tx_bytes))
3691 goto nla_put_failure; 3695 goto nla_put_failure;
3692 if ((sinfo->filled & STATION_INFO_RX_BYTES64) && 3696
3693 nla_put_u64(msg, NL80211_STA_INFO_RX_BYTES64, 3697 PUT_SINFO(RX_BYTES64, rx_bytes, u64);
3694 sinfo->rx_bytes)) 3698 PUT_SINFO(TX_BYTES64, tx_bytes, u64);
3695 goto nla_put_failure; 3699 PUT_SINFO(LLID, llid, u16);
3696 if ((sinfo->filled & STATION_INFO_TX_BYTES64) && 3700 PUT_SINFO(PLID, plid, u16);
3697 nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64, 3701 PUT_SINFO(PLINK_STATE, plink_state, u8);
3698 sinfo->tx_bytes)) 3702
3699 goto nla_put_failure;
3700 if ((sinfo->filled & STATION_INFO_LLID) &&
3701 nla_put_u16(msg, NL80211_STA_INFO_LLID, sinfo->llid))
3702 goto nla_put_failure;
3703 if ((sinfo->filled & STATION_INFO_PLID) &&
3704 nla_put_u16(msg, NL80211_STA_INFO_PLID, sinfo->plid))
3705 goto nla_put_failure;
3706 if ((sinfo->filled & STATION_INFO_PLINK_STATE) &&
3707 nla_put_u8(msg, NL80211_STA_INFO_PLINK_STATE,
3708 sinfo->plink_state))
3709 goto nla_put_failure;
3710 switch (rdev->wiphy.signal_type) { 3703 switch (rdev->wiphy.signal_type) {
3711 case CFG80211_SIGNAL_TYPE_MBM: 3704 case CFG80211_SIGNAL_TYPE_MBM:
3712 if ((sinfo->filled & STATION_INFO_SIGNAL) && 3705 PUT_SINFO(SIGNAL, signal, u8);
3713 nla_put_u8(msg, NL80211_STA_INFO_SIGNAL, 3706 PUT_SINFO(SIGNAL_AVG, signal_avg, u8);
3714 sinfo->signal))
3715 goto nla_put_failure;
3716 if ((sinfo->filled & STATION_INFO_SIGNAL_AVG) &&
3717 nla_put_u8(msg, NL80211_STA_INFO_SIGNAL_AVG,
3718 sinfo->signal_avg))
3719 goto nla_put_failure;
3720 break; 3707 break;
3721 default: 3708 default:
3722 break; 3709 break;
3723 } 3710 }
3724 if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL) { 3711 if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL)) {
3725 if (!nl80211_put_signal(msg, sinfo->chains, 3712 if (!nl80211_put_signal(msg, sinfo->chains,
3726 sinfo->chain_signal, 3713 sinfo->chain_signal,
3727 NL80211_STA_INFO_CHAIN_SIGNAL)) 3714 NL80211_STA_INFO_CHAIN_SIGNAL))
3728 goto nla_put_failure; 3715 goto nla_put_failure;
3729 } 3716 }
3730 if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL_AVG) { 3717 if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) {
3731 if (!nl80211_put_signal(msg, sinfo->chains, 3718 if (!nl80211_put_signal(msg, sinfo->chains,
3732 sinfo->chain_signal_avg, 3719 sinfo->chain_signal_avg,
3733 NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) 3720 NL80211_STA_INFO_CHAIN_SIGNAL_AVG))
3734 goto nla_put_failure; 3721 goto nla_put_failure;
3735 } 3722 }
3736 if (sinfo->filled & STATION_INFO_TX_BITRATE) { 3723 if (sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE)) {
3737 if (!nl80211_put_sta_rate(msg, &sinfo->txrate, 3724 if (!nl80211_put_sta_rate(msg, &sinfo->txrate,
3738 NL80211_STA_INFO_TX_BITRATE)) 3725 NL80211_STA_INFO_TX_BITRATE))
3739 goto nla_put_failure; 3726 goto nla_put_failure;
3740 } 3727 }
3741 if (sinfo->filled & STATION_INFO_RX_BITRATE) { 3728 if (sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE)) {
3742 if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, 3729 if (!nl80211_put_sta_rate(msg, &sinfo->rxrate,
3743 NL80211_STA_INFO_RX_BITRATE)) 3730 NL80211_STA_INFO_RX_BITRATE))
3744 goto nla_put_failure; 3731 goto nla_put_failure;
3745 } 3732 }
3746 if ((sinfo->filled & STATION_INFO_RX_PACKETS) && 3733
3747 nla_put_u32(msg, NL80211_STA_INFO_RX_PACKETS, 3734 PUT_SINFO(RX_PACKETS, rx_packets, u32);
3748 sinfo->rx_packets)) 3735 PUT_SINFO(TX_PACKETS, tx_packets, u32);
3749 goto nla_put_failure; 3736 PUT_SINFO(TX_RETRIES, tx_retries, u32);
3750 if ((sinfo->filled & STATION_INFO_TX_PACKETS) && 3737 PUT_SINFO(TX_FAILED, tx_failed, u32);
3751 nla_put_u32(msg, NL80211_STA_INFO_TX_PACKETS, 3738 PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32);
3752 sinfo->tx_packets)) 3739 PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32);
3753 goto nla_put_failure; 3740 PUT_SINFO(LOCAL_PM, local_pm, u32);
3754 if ((sinfo->filled & STATION_INFO_TX_RETRIES) && 3741 PUT_SINFO(PEER_PM, peer_pm, u32);
3755 nla_put_u32(msg, NL80211_STA_INFO_TX_RETRIES, 3742 PUT_SINFO(NONPEER_PM, nonpeer_pm, u32);
3756 sinfo->tx_retries)) 3743
3757 goto nla_put_failure; 3744 if (sinfo->filled & BIT(NL80211_STA_INFO_BSS_PARAM)) {
3758 if ((sinfo->filled & STATION_INFO_TX_FAILED) &&
3759 nla_put_u32(msg, NL80211_STA_INFO_TX_FAILED,
3760 sinfo->tx_failed))
3761 goto nla_put_failure;
3762 if ((sinfo->filled & STATION_INFO_EXPECTED_THROUGHPUT) &&
3763 nla_put_u32(msg, NL80211_STA_INFO_EXPECTED_THROUGHPUT,
3764 sinfo->expected_throughput))
3765 goto nla_put_failure;
3766 if ((sinfo->filled & STATION_INFO_BEACON_LOSS_COUNT) &&
3767 nla_put_u32(msg, NL80211_STA_INFO_BEACON_LOSS,
3768 sinfo->beacon_loss_count))
3769 goto nla_put_failure;
3770 if ((sinfo->filled & STATION_INFO_LOCAL_PM) &&
3771 nla_put_u32(msg, NL80211_STA_INFO_LOCAL_PM,
3772 sinfo->local_pm))
3773 goto nla_put_failure;
3774 if ((sinfo->filled & STATION_INFO_PEER_PM) &&
3775 nla_put_u32(msg, NL80211_STA_INFO_PEER_PM,
3776 sinfo->peer_pm))
3777 goto nla_put_failure;
3778 if ((sinfo->filled & STATION_INFO_NONPEER_PM) &&
3779 nla_put_u32(msg, NL80211_STA_INFO_NONPEER_PM,
3780 sinfo->nonpeer_pm))
3781 goto nla_put_failure;
3782 if (sinfo->filled & STATION_INFO_BSS_PARAM) {
3783 bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); 3745 bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM);
3784 if (!bss_param) 3746 if (!bss_param)
3785 goto nla_put_failure; 3747 goto nla_put_failure;
@@ -3798,18 +3760,19 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
3798 3760
3799 nla_nest_end(msg, bss_param); 3761 nla_nest_end(msg, bss_param);
3800 } 3762 }
3801 if ((sinfo->filled & STATION_INFO_STA_FLAGS) && 3763 if ((sinfo->filled & BIT(NL80211_STA_INFO_STA_FLAGS)) &&
3802 nla_put(msg, NL80211_STA_INFO_STA_FLAGS, 3764 nla_put(msg, NL80211_STA_INFO_STA_FLAGS,
3803 sizeof(struct nl80211_sta_flag_update), 3765 sizeof(struct nl80211_sta_flag_update),
3804 &sinfo->sta_flags)) 3766 &sinfo->sta_flags))
3805 goto nla_put_failure; 3767 goto nla_put_failure;
3806 if ((sinfo->filled & STATION_INFO_T_OFFSET) && 3768
3807 nla_put_u64(msg, NL80211_STA_INFO_T_OFFSET, 3769 PUT_SINFO(T_OFFSET, t_offset, u64);
3808 sinfo->t_offset)) 3770 PUT_SINFO(RX_DROP_MISC, rx_dropped_misc, u64);
3809 goto nla_put_failure; 3771
3772#undef PUT_SINFO
3810 nla_nest_end(msg, sinfoattr); 3773 nla_nest_end(msg, sinfoattr);
3811 3774
3812 if ((sinfo->filled & STATION_INFO_ASSOC_REQ_IES) && 3775 if (sinfo->assoc_req_ies_len &&
3813 nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, 3776 nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
3814 sinfo->assoc_req_ies)) 3777 sinfo->assoc_req_ies))
3815 goto nla_put_failure; 3778 goto nla_put_failure;
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 0f47948c572f..5b24d39d7903 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1300,7 +1300,7 @@ static int cfg80211_wext_giwrate(struct net_device *dev,
1300 if (err) 1300 if (err)
1301 return err; 1301 return err;
1302 1302
1303 if (!(sinfo.filled & STATION_INFO_TX_BITRATE)) 1303 if (!(sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE)))
1304 return -EOPNOTSUPP; 1304 return -EOPNOTSUPP;
1305 1305
1306 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); 1306 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
@@ -1340,7 +1340,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1340 1340
1341 switch (rdev->wiphy.signal_type) { 1341 switch (rdev->wiphy.signal_type) {
1342 case CFG80211_SIGNAL_TYPE_MBM: 1342 case CFG80211_SIGNAL_TYPE_MBM:
1343 if (sinfo.filled & STATION_INFO_SIGNAL) { 1343 if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) {
1344 int sig = sinfo.signal; 1344 int sig = sinfo.signal;
1345 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; 1345 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1346 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; 1346 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
@@ -1354,7 +1354,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1354 break; 1354 break;
1355 } 1355 }
1356 case CFG80211_SIGNAL_TYPE_UNSPEC: 1356 case CFG80211_SIGNAL_TYPE_UNSPEC:
1357 if (sinfo.filled & STATION_INFO_SIGNAL) { 1357 if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) {
1358 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; 1358 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1359 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; 1359 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
1360 wstats.qual.level = sinfo.signal; 1360 wstats.qual.level = sinfo.signal;
@@ -1367,9 +1367,9 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1367 } 1367 }
1368 1368
1369 wstats.qual.updated |= IW_QUAL_NOISE_INVALID; 1369 wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
1370 if (sinfo.filled & STATION_INFO_RX_DROP_MISC) 1370 if (sinfo.filled & BIT(NL80211_STA_INFO_RX_DROP_MISC))
1371 wstats.discard.misc = sinfo.rx_dropped_misc; 1371 wstats.discard.misc = sinfo.rx_dropped_misc;
1372 if (sinfo.filled & STATION_INFO_TX_FAILED) 1372 if (sinfo.filled & BIT(NL80211_STA_INFO_TX_FAILED))
1373 wstats.discard.retries = sinfo.tx_failed; 1373 wstats.discard.retries = sinfo.tx_failed;
1374 1374
1375 return &wstats; 1375 return &wstats;