cfg80211: add scan time to survey data
authorJohannes Berg <johannes.berg@intel.com>
Fri, 14 Nov 2014 15:44:11 +0000 (16:44 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Jan 2015 14:27:58 +0000 (15:27 +0100)
Add the time spent scanning to the survey data so it can be
reported by drivers that collect such information.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/trace.h

index 5a86144..f94f0d4 100644 (file)
@@ -525,6 +525,7 @@ ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
  * @SURVEY_INFO_TIME_RX: receive time was filled in
  * @SURVEY_INFO_TIME_TX: transmit time was filled in
+ * @SURVEY_INFO_TIME_SCAN: scan time was filled in
  *
  * Used by the driver to indicate which info in &struct survey_info
  * it has filled in during the get_survey().
@@ -537,6 +538,7 @@ enum survey_info_flags {
        SURVEY_INFO_TIME_EXT_BUSY       = BIT(4),
        SURVEY_INFO_TIME_RX             = BIT(5),
        SURVEY_INFO_TIME_TX             = BIT(6),
+       SURVEY_INFO_TIME_SCAN           = BIT(7),
 };
 
 /**
@@ -552,6 +554,7 @@ enum survey_info_flags {
  * @time_ext_busy: amount of time the extension channel was sensed busy
  * @time_rx: amount of time the radio spent receiving data
  * @time_tx: amount of time the radio spent transmitting data
+ * @time_scan: amount of time the radio spent for scanning
  *
  * Used by dump_survey() to report back per-channel survey information.
  *
@@ -565,6 +568,7 @@ struct survey_info {
        u64 time_ext_busy;
        u64 time_rx;
        u64 time_tx;
+       u64 time_scan;
        u32 filled;
        s8 noise;
 };
index 5e8b65f..2f549a2 100644 (file)
@@ -2835,6 +2835,8 @@ enum nl80211_user_reg_hint_type {
  *     receiving data (on channel or globally)
  * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent
  *     transmitting data (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
+ *     (on this channel or globally)
  * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  *     currently defined
  * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -2849,6 +2851,7 @@ enum nl80211_survey_info {
        NL80211_SURVEY_INFO_TIME_EXT_BUSY,
        NL80211_SURVEY_INFO_TIME_RX,
        NL80211_SURVEY_INFO_TIME_TX,
+       NL80211_SURVEY_INFO_TIME_SCAN,
 
        /* keep last */
        __NL80211_SURVEY_INFO_AFTER_LAST,
index 9555ef9..f56309b 100644 (file)
@@ -6667,6 +6667,10 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq,
            nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_TX,
                        survey->time_tx))
                goto nla_put_failure;
+       if ((survey->filled & SURVEY_INFO_TIME_SCAN) &&
+           nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_SCAN,
+                       survey->time_scan))
+               goto nla_put_failure;
 
        nla_nest_end(msg, infoattr);
 
index bbb7afc..b17b369 100644 (file)
@@ -1609,6 +1609,7 @@ TRACE_EVENT(rdev_return_int_survey_info,
                __field(u64, time_ext_busy)
                __field(u64, time_rx)
                __field(u64, time_tx)
+               __field(u64, time_scan)
                __field(u32, filled)
                __field(s8, noise)
        ),
@@ -1621,17 +1622,19 @@ TRACE_EVENT(rdev_return_int_survey_info,
                __entry->time_ext_busy = info->time_ext_busy;
                __entry->time_rx = info->time_rx;
                __entry->time_tx = info->time_tx;
+               __entry->time_scan = info->time_scan;
                __entry->filled = info->filled;
                __entry->noise = info->noise;
        ),
        TP_printk(WIPHY_PR_FMT ", returned: %d, " CHAN_PR_FMT
                  ", channel time: %llu, channel time busy: %llu, "
                  "channel time extension busy: %llu, channel time rx: %llu, "
-                 "channel time tx: %llu, filled: %u, noise: %d",
+                 "channel time tx: %llu, scan time: %llu, filled: %u, noise: %d",
                  WIPHY_PR_ARG, __entry->ret, CHAN_PR_ARG,
                  __entry->time, __entry->time_busy,
                  __entry->time_ext_busy, __entry->time_rx,
-                 __entry->time_tx, __entry->filled, __entry->noise)
+                 __entry->time_tx, __entry->time_scan,
+                 __entry->filled, __entry->noise)
 );
 
 TRACE_EVENT(rdev_tdls_oper,