]> git.karo-electronics.de Git - linux-beck.git/commitdiff
cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION
authorMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Thu, 7 Apr 2016 14:29:34 +0000 (19:59 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 26 Apr 2016 07:40:11 +0000 (09:40 +0200)
Add support for the a station statistics netlink attribute:
NL80211_STA_INFO_RX_DURATION.

If present, this attribute contains the aggregate PPDU duration (in
microseconds) for all the frames from the peer. This is useful to
help understand the total time spent transmitting to us by all of
the connected peers.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 183916e168f167ab3f580094c5fbf243f3d803ad..c8414962683d5941f6dbe9de3f36ffc7ac207276 100644 (file)
@@ -1045,11 +1045,12 @@ struct cfg80211_tid_stats {
  * @rx_beacon: number of beacons received from this peer
  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
  *     from this peer
+ * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
  *     (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
  */
 struct station_info {
-       u32 filled;
+       u64 filled;
        u32 connected_time;
        u32 inactive_time;
        u64 rx_bytes;
@@ -1088,6 +1089,7 @@ struct station_info {
        u32 expected_throughput;
 
        u64 rx_beacon;
+       u64 rx_duration;
        u8 rx_beacon_signal_avg;
        struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
 };
index 2c55dd1894c3e21e06c3dfe02d4e977267e71b82..51fc4abf649133da5929d598c752e6f068fc6cbf 100644 (file)
@@ -2513,6 +2513,8 @@ enum nl80211_sta_bss_param {
  *     TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  *     each one of those is again nested with &enum nl80211_tid_stats
  *     attributes carrying the actual values.
+ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
+ *     received from the station (u64, usec)
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2549,6 +2551,7 @@ enum nl80211_sta_info {
        NL80211_STA_INFO_BEACON_RX,
        NL80211_STA_INFO_BEACON_SIGNAL_AVG,
        NL80211_STA_INFO_TID_STATS,
+       NL80211_STA_INFO_RX_DURATION,
 
        /* keep last */
        __NL80211_STA_INFO_AFTER_LAST,
index afeb1ef1b1992a1fe2e4ff2772badeb1f7e83c24..5b0d2c8c2165d439ac0cb8bc05aa0a533f0f1c66 100644 (file)
@@ -3755,7 +3755,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
                goto nla_put_failure;
 
 #define PUT_SINFO(attr, memb, type) do {                               \
-       if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) &&           \
+       if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&      \
            nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,            \
                             sinfo->memb))                              \
                goto nla_put_failure;                                   \
@@ -3781,6 +3781,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
        PUT_SINFO(LLID, llid, u16);
        PUT_SINFO(PLID, plid, u16);
        PUT_SINFO(PLINK_STATE, plink_state, u8);
+       PUT_SINFO(RX_DURATION, rx_duration, u64);
 
        switch (rdev->wiphy.signal_type) {
        case CFG80211_SIGNAL_TYPE_MBM: