mac80211: Add tx ack signal support in sta info
authorVenkateswara Naralasetty <vnaralas@codeaurora.org>
Tue, 13 Feb 2018 05:34:46 +0000 (11:04 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 19 Feb 2018 12:22:28 +0000 (13:22 +0100)
This allows users to get ack signal strength of
last transmitted frame.

Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/sta_info.c
net/mac80211/sta_info.h
net/mac80211/status.c

index 906e902230662562c97f03a7ccd37e6339747eba..854037b8163e6fa41a89535eb7cff56b4919969d 100644 (file)
@@ -934,6 +934,7 @@ struct ieee80211_tx_info {
                        u8 ampdu_len;
                        u8 antenna;
                        u16 tx_time;
+                       bool is_valid_ack_signal;
                        void *status_driver_data[19 / sizeof(void *)];
                } status;
                struct {
index 0c5627f8a104e17fb54f55c09da597ef84af5be3..0bc40c719a5530505075d5769856659c525995d4 100644 (file)
@@ -2287,6 +2287,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
                sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
                sinfo->expected_throughput = thr;
        }
+
+       if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL)) &&
+           sta->status_stats.ack_signal_filled) {
+               sinfo->ack_signal = sta->status_stats.last_ack_signal;
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
+       }
 }
 
 u32 sta_get_expected_throughput(struct sta_info *sta)
index cd53619435b641c446ed4e0e69eda1d97714f54a..f64eb86ca64b03b24ec8f9dd145e795336dc3e2e 100644 (file)
@@ -548,6 +548,8 @@ struct sta_info {
                u64 msdu_retries[IEEE80211_NUM_TIDS + 1];
                u64 msdu_failed[IEEE80211_NUM_TIDS + 1];
                unsigned long last_ack;
+               s8 last_ack_signal;
+               bool ack_signal_filled;
        } status_stats;
 
        /* Updated from TX path only, no locking requirements */
index d74d44e65bd7a11e441f5234760f1fef3af10eeb..743e89c5926c4694ba31c212270b5ddb27b48789 100644 (file)
@@ -187,9 +187,16 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
        struct ieee80211_mgmt *mgmt = (void *) skb->data;
        struct ieee80211_local *local = sta->local;
        struct ieee80211_sub_if_data *sdata = sta->sdata;
+       struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
 
-       if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
+       if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
                sta->status_stats.last_ack = jiffies;
+               if (txinfo->status.is_valid_ack_signal) {
+                       sta->status_stats.last_ack_signal =
+                                        (s8)txinfo->status.ack_signal;
+                       sta->status_stats.ack_signal_filled = true;
+               }
+       }
 
        if (ieee80211_is_data_qos(mgmt->frame_control)) {
                struct ieee80211_hdr *hdr = (void *) skb->data;
@@ -486,7 +493,9 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,
                        if (ieee80211_is_nullfunc(hdr->frame_control) ||
                            ieee80211_is_qos_nullfunc(hdr->frame_control))
                                cfg80211_probe_status(sdata->dev, hdr->addr1,
-                                                     cookie, acked, 0, false,
+                                                     cookie, acked,
+                                                     info->status.ack_signal,
+                                                     info->status.is_valid_ack_signal,
                                                      GFP_ATOMIC);
                        else
                                cfg80211_mgmt_tx_status(&sdata->wdev, cookie,