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: 10343163 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 6457A6039A for ; Mon, 16 Apr 2018 14:50:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5538F286B5 for ; Mon, 16 Apr 2018 14:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4896F28701; Mon, 16 Apr 2018 14:50:17 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78C3E286B5 for ; Mon, 16 Apr 2018 14:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jG9Dsu5BfeqMVMK19G8zfElkLsQ8jTs1wgd+fYuRguY=; b=ZARc/XFHVGnRiqi2Vy2rmo1u/f XoclYENeOsgvOTgJf5vG3DOvEafRbzHDLViqiNk+XxkVMnlBRgQu2nm3Vlb6ow/2LTWNHEkbY/lEJ m5TWIwhw72NbgT/l7hHQfYz06wbcTde9y/w8psMilYMhXMittLN4YtuFy0971rgehtaWHBEMenaC5 UthJFyl0T3dz5/IkZPNKTaU+4BQCQzAxxcxAoZdkZ3qLRlOJXlFxMcN/oCdAj8CE9L+HmVL8ekRgJ LbnZf7vGoXbnnsIINeSC558Bq8FIgdvPIacWJzSy6RcmZArBhvQEE1Gg+CCp2CWEajnm1k2z2MLXj MKsO6wcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f85SJ-00055l-PR; Mon, 16 Apr 2018 14:50:07 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f85Rf-0004RK-5H for ath10k@lists.infradead.org; Mon, 16 Apr 2018 14:49:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 43E3A60A00; 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180416_074927_254691_ABC4EADE X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bpothuno@codeaurora.org, linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.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)); } }