From patchwork Fri Apr 13 11:34:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji Pothunoori X-Patchwork-Id: 10339929 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 56F636039A for ; Fri, 13 Apr 2018 11:34:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DDB728751 for ; Fri, 13 Apr 2018 11:34:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 501592874E; Fri, 13 Apr 2018 11:34:34 +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 DB4012874E for ; Fri, 13 Apr 2018 11:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491AbeDMLeX (ORCPT ); Fri, 13 Apr 2018 07:34:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39548 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754416AbeDMLeU (ORCPT ); Fri, 13 Apr 2018 07:34:20 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 32D0260F8E; Fri, 13 Apr 2018 11:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523619260; bh=hFsFgsrIHM6/W9MZTELjPkQsLPX24E+P/8IwfR6Y9ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7AKLn4WnpcqxXgxKaqpJ8E/zzB5HnePaw414pdb/tnrh70Aw0TXIeXa2PYoN+L1N mDIet+GTMj0EUurBC4Jq7bZoacB6DOKAAt6mETiT7T8VyGrV84Il6R8foNq5Boabbe LKmIQUdGsY93WK8RsDE+zKGbQ2Dpq4QXjuF3QF7s= 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 EA80360F94; Fri, 13 Apr 2018 11:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523619259; bh=hFsFgsrIHM6/W9MZTELjPkQsLPX24E+P/8IwfR6Y9ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWOWXs60737uB+KVOdRWcC3WDEQOfAiUJo1Sqt7RGL4FqvWIwi6Oy2OVpO9PFJANM QbSiLwSsZP5DxUSVUhiymKPOra+MzRzNR4811R1I03zQxwbKdUAXZiJsUCH8N3ND9p kOVHe/Dr7Pm+eAUy7qHyoF4Uq3tI7NIrv3e5ROOw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EA80360F94 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: linux-wireless@vger.kernel.org Cc: bpothuno@codeaurora.org Subject: [PATCH 2/3] mac80211: average ack rssi support for data frames Date: Fri, 13 Apr 2018 17:04:02 +0530 Message-Id: <1523619243-1898-3-git-send-email-bpothuno@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523619243-1898-2-git-send-email-bpothuno@codeaurora.org> References: <1523619243-1898-2-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)); } }