From patchwork Fri Mar 23 07:37:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10302803 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 0FD4B60384 for ; Fri, 23 Mar 2018 07:36:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F028928979 for ; Fri, 23 Mar 2018 07:36:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E464828C5C; Fri, 23 Mar 2018 07:36:39 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 8452728979 for ; Fri, 23 Mar 2018 07:36:39 +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: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:In-Reply-To: References:List-Owner; bh=vo946q6W/SG6CWtsnTftfFwDs5Uqqmc3ySxBMq14LnU=; b=e8f +2srdJETn22FNs35ecw+LeJLTML0c8Afqc05RHlU97b8tejttDotnqqPTP7nZF+sRYwIX49wmteWy meGysYIhBJEw3LEpbatAUPKwjCBjG+6C3IT/nSJtvRbVnVxgCEbr5JP3p0UWHw6wFdi4opqvuDyDq COh4GwaGX2gvDkeZF7hIO2+BTaWO9nItpR+DU35JWA0q3K0RSzozcL+jHqRZj17F9dS1aXMdUF0xx k9T/fOpWpkzxteBzyH4v6LXUlkofrK3aMoyPUjC92KCLJ2qY8F+qmtpUC5Xgv9+Ak4UJXtMVOBZng B1bPyw+YQZc24KMEwV2hWm1wc7X+hXg==; 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 1ezHFY-0001aQ-E8; Fri, 23 Mar 2018 07:36:32 +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 1ezHFV-0001Z3-4h for ath10k@lists.infradead.org; Fri, 23 Mar 2018 07:36:30 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BA7D960C54; Fri, 23 Mar 2018 07:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521790577; bh=gv8ZPwiU7QPmc+4JHK8PIdBoaSv+BWVTKgzxp6NAUJk=; h=From:To:Cc:Subject:Date:From; b=o8eWCcqe1lrYn9dgK6oUVPM/dvTJufOZ38ELWS4sAM8vEYUqjXgKiCN2yGhv0covF xohPPbShUNdlMkFLQPDAZaF9MU4LoL0HhddV+DfBhgSbCoK1zgKHXi+S2oJAXd5KPu yGE61AX23vfI/yKq1eUPE6fhz/Ohdn7us00hZb+I= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AEE4F60246; Fri, 23 Mar 2018 07:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521790577; bh=gv8ZPwiU7QPmc+4JHK8PIdBoaSv+BWVTKgzxp6NAUJk=; h=From:To:Cc:Subject:Date:From; b=o8eWCcqe1lrYn9dgK6oUVPM/dvTJufOZ38ELWS4sAM8vEYUqjXgKiCN2yGhv0covF xohPPbShUNdlMkFLQPDAZaF9MU4LoL0HhddV+DfBhgSbCoK1zgKHXi+S2oJAXd5KPu yGE61AX23vfI/yKq1eUPE6fhz/Ohdn7us00hZb+I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AEE4F60246 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=akolli@codeaurora.org From: Anilkumar Kolli To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: Implement get_expected_throughput callback Date: Fri, 23 Mar 2018 13:07:00 +0530 Message-Id: <1521790620-12267-1-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180323_003629_236858_6C3B4047 X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. 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: 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 Enable support for 'drv_get_expected_throughput' callback. Export expected throughput if available to cfg80211/nl80211. Signed-off-by: Anilkumar Kolli Signed-off-by: Tamizh chelvam --- drivers/net/wireless/ath/ath10k/core.h | 5 +++++ drivers/net/wireless/ath/ath10k/mac.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index fe6b30356d3b..8e10f7d83a79 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -37,6 +38,7 @@ #include "thermal.h" #include "wow.h" #include "swap.h" +#include #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) @@ -354,6 +356,8 @@ struct ath10k_txq { unsigned long num_push_allowed; }; +DECLARE_EWMA(sta_txrate, 4, 16) + struct ath10k_sta { struct ath10k_vif *arvif; @@ -367,6 +371,7 @@ struct ath10k_sta { struct work_struct update_wk; u64 rx_duration; + struct ewma_sta_txrate ave_sta_txrate; #ifdef CONFIG_MAC80211_DEBUGFS /* protected by conf_mutex */ diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7e02ca02b28e..e04fbe9ccfee 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -7686,6 +7686,22 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw, } sinfo->txrate.flags = arsta->txrate.flags; sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE; + + sinfo->expected_throughput = + ewma_sta_txrate_read(&arsta->ave_sta_txrate); + sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT); +} + +static u32 ath10k_get_expected_throughput(struct ieee80211_hw *hw, + struct ieee80211_sta *sta) +{ + struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; + u32 tx_bitrate; + + tx_bitrate = cfg80211_calculate_bitrate(&arsta->txrate); + ewma_sta_txrate_add(&arsta->ave_sta_txrate, tx_bitrate); + + return ewma_sta_txrate_read(&arsta->ave_sta_txrate); } static const struct ieee80211_ops ath10k_ops = { @@ -7730,6 +7746,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw, .switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx, .sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove, .sta_statistics = ath10k_sta_statistics, + .get_expected_throughput = ath10k_get_expected_throughput, CFG80211_TESTMODE_CMD(ath10k_tm_cmd)