linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Balaji Pothunoori <bpothuno@codeaurora.org>
To: johannes@sipsolutions.net, ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, bpothuno@codeaurora.org
Subject: [PATCHv2 2/3] mac80211: average ack rssi support for data frames
Date: Mon, 16 Apr 2018 20:18:41 +0530	[thread overview]
Message-ID: <1523890122-23952-3-git-send-email-bpothuno@codeaurora.org> (raw)
In-Reply-To: <1523890122-23952-1-git-send-email-bpothuno@codeaurora.org>

The driver will process the RSSI if available and send it to mac80211.
mac80211 will compute the weighted average of ack RSSI for stations.

Signed-off-by: Balaji Pothunoori <bpothuno@codeaurora.org>
---
 net/mac80211/sta_info.c | 10 ++++++++++
 net/mac80211/sta_info.h |  2 ++
 net/mac80211/status.c   |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 655c3d8..fad6a84 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -357,6 +357,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 
 	sta->last_connected = ktime_get_seconds();
 	ewma_signal_init(&sta->rx_stats_avg.signal);
+	ewma_avg_signal_init(&sta->avg_ack_signal);
 	for (i = 0; i < ARRAY_SIZE(sta->rx_stats_avg.chain_signal); i++)
 		ewma_signal_init(&sta->rx_stats_avg.chain_signal[i]);
 
@@ -2294,6 +2295,15 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 		sinfo->ack_signal = sta->status_stats.last_ack_signal;
 		sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
 	}
+	if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS)) {
+		if (!(sinfo->filled &
+			BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG))) {
+			sinfo->avg_ack_signal =
+			-(s8)ewma_avg_signal_read(&sta->avg_ack_signal);
+			sinfo->filled |=
+				BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
+		}
+	}
 }
 
 u32 sta_get_expected_throughput(struct sta_info *sta)
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index f64eb86..1028924 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -119,6 +119,7 @@ enum ieee80211_sta_info_flags {
 #define HT_AGG_STATE_START_CB		6
 #define HT_AGG_STATE_STOP_CB		7
 
+DECLARE_EWMA(avg_signal, 10, 8)
 enum ieee80211_agg_stop_reason {
 	AGG_STOP_DECLINED,
 	AGG_STOP_LOCAL_REQUEST,
@@ -581,6 +582,7 @@ struct sta_info {
 
 	struct cfg80211_chan_def tdls_chandef;
 
+	struct ewma_avg_signal avg_ack_signal;
 	/* keep last! */
 	struct ieee80211_sta sta;
 };
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 743e89c..93dc971 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -195,6 +195,8 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
 			sta->status_stats.last_ack_signal =
 					 (s8)txinfo->status.ack_signal;
 			sta->status_stats.ack_signal_filled = true;
+			ewma_avg_signal_add(&sta->avg_ack_signal,
+					    -(txinfo->status.ack_signal));
 		}
 	}
 
-- 
2.7.4

  parent reply	other threads:[~2018-04-16 14:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 14:48 [PATCHv2 0/3]: cfg80211/mac80211/ath10k: average ack rssi support for data frames Balaji Pothunoori
2018-04-16 14:48 ` [PATCHv2 1/3] cfg80211: " Balaji Pothunoori
2018-04-16 14:48 ` Balaji Pothunoori [this message]
2018-04-16 14:48 ` [PATCHv2 3/3] ath10k: " Balaji Pothunoori
2018-05-08 15:10   ` [PATCHv2,3/3] " Kalle Valo
2018-09-05  4:50   ` [PATCHv2 3/3] " Kalle Valo
2018-09-05  7:23     ` Balaji Pothunoori
2018-09-06 16:05   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523890122-23952-3-git-send-email-bpothuno@codeaurora.org \
    --to=bpothuno@codeaurora.org \
    --cc=ath10k@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).