aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
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 /net/wireless
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>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c133
-rw-r--r--net/wireless/wext-compat.c10
2 files changed, 53 insertions, 90 deletions
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;