summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@toke.dk>2018-12-18 20:02:07 -0500
committerJohannes Berg <johannes.berg@intel.com>2019-01-19 03:31:35 -0500
commit36647055b37ec78e9068f470f14e7cd75c001c22 (patch)
tree5edec13644467b2c6c56d9e32a722b61800397ea /net/wireless
parent1866760096bf40bcf6977a9076b3026598bc12ee (diff)
cfg80211: Add airtime statistics and settings
This adds TX airtime statistics to the cfg80211 station dump (to go along with the RX info already present), and adds a new parameter to set the airtime weight of each station. The latter allows userspace to implement policies for different stations by varying their weights. Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> [rmanohar@codeaurora.org: fixed checkpatch warnings] Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org> [move airtime weight != 0 check into policy] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5e49492d5911..a89688929b16 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -557,6 +557,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
557 [NL80211_ATTR_PEER_MEASUREMENTS] = 557 [NL80211_ATTR_PEER_MEASUREMENTS] =
558 NLA_POLICY_NESTED(NL80211_PMSR_FTM_REQ_ATTR_MAX, 558 NLA_POLICY_NESTED(NL80211_PMSR_FTM_REQ_ATTR_MAX,
559 nl80211_pmsr_attr_policy), 559 nl80211_pmsr_attr_policy),
560 [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
560}; 561};
561 562
562/* policy for the key attributes */ 563/* policy for the key attributes */
@@ -4851,6 +4852,11 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
4851 PUT_SINFO(PLID, plid, u16); 4852 PUT_SINFO(PLID, plid, u16);
4852 PUT_SINFO(PLINK_STATE, plink_state, u8); 4853 PUT_SINFO(PLINK_STATE, plink_state, u8);
4853 PUT_SINFO_U64(RX_DURATION, rx_duration); 4854 PUT_SINFO_U64(RX_DURATION, rx_duration);
4855 PUT_SINFO_U64(TX_DURATION, tx_duration);
4856
4857 if (wiphy_ext_feature_isset(&rdev->wiphy,
4858 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
4859 PUT_SINFO(AIRTIME_WEIGHT, airtime_weight, u16);
4854 4860
4855 switch (rdev->wiphy.signal_type) { 4861 switch (rdev->wiphy.signal_type) {
4856 case CFG80211_SIGNAL_TYPE_MBM: 4862 case CFG80211_SIGNAL_TYPE_MBM:
@@ -5470,6 +5476,15 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
5470 nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); 5476 nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]);
5471 } 5477 }
5472 5478
5479 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
5480 params.airtime_weight =
5481 nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
5482
5483 if (params.airtime_weight &&
5484 !wiphy_ext_feature_isset(&rdev->wiphy,
5485 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
5486 return -EOPNOTSUPP;
5487
5473 /* Include parameters for TDLS peer (will check later) */ 5488 /* Include parameters for TDLS peer (will check later) */
5474 err = nl80211_set_station_tdls(info, &params); 5489 err = nl80211_set_station_tdls(info, &params);
5475 if (err) 5490 if (err)
@@ -5598,6 +5613,15 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
5598 params.plink_action = 5613 params.plink_action =
5599 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); 5614 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
5600 5615
5616 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
5617 params.airtime_weight =
5618 nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
5619
5620 if (params.airtime_weight &&
5621 !wiphy_ext_feature_isset(&rdev->wiphy,
5622 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
5623 return -EOPNOTSUPP;
5624
5601 err = nl80211_parse_sta_channel_info(info, &params); 5625 err = nl80211_parse_sta_channel_info(info, &params);
5602 if (err) 5626 if (err)
5603 return err; 5627 return err;