From patchwork Mon Apr 16 14:48:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji Pothunoori X-Patchwork-Id: 10343149 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 621216039A for ; Mon, 16 Apr 2018 14:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52A33286BC for ; Mon, 16 Apr 2018 14:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45A0B286F6; Mon, 16 Apr 2018 14:49:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2706286BC for ; Mon, 16 Apr 2018 14:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753021AbeDPOtS (ORCPT ); Mon, 16 Apr 2018 10:49:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38948 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbeDPOtR (ORCPT ); Mon, 16 Apr 2018 10:49:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 834FE60FF9; Mon, 16 Apr 2018 14:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523890156; bh=hFsFgsrIHM6/W9MZTELjPkQsLPX24E+P/8IwfR6Y9ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RlXwqNDGWIOHeS/PHGuFNKjp9hLpf1+rIZDSi5cBiMq9Hg6GwvcUNjO3pRcp6HbTs H72aWyk2qhnEdPrdk2VZj4faMJrMQqB6s+vXFSgdFO7aOFyd1GXR8XyUwHok9iLlNQ x/mai7+LA295+dMHb8Yvwdg730vX4p83y7bbuy6U= Received: from tejas.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bpothuno@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 593816071A; Mon, 16 Apr 2018 14:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523890155; bh=hFsFgsrIHM6/W9MZTELjPkQsLPX24E+P/8IwfR6Y9ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MT8Hn3BiJpHC672fIWFLxUq+P6+ypqB3hzycKwrqhz5IjkaiPB8b/a29djQd1+RbA HelRJ/62flHcamC4I9OAz+BxUqc4QOGrjNS6VdF+pvejJ/H99++xmTlvzg+lba7Y6b n4OpKywW3MgQzS/dNtFbm3V24lgPGus13pLiFyZA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 593816071A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=bpothuno@codeaurora.org From: Balaji Pothunoori 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 Message-Id: <1523890122-23952-3-git-send-email-bpothuno@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523890122-23952-1-git-send-email-bpothuno@codeaurora.org> References: <1523890122-23952-1-git-send-email-bpothuno@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)); } }