From patchwork Sat Dec 17 17:46:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 9479079 X-Patchwork-Delegate: kvalo@adurom.com 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 2068060827 for ; Sat, 17 Dec 2016 17:47:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1360C284F5 for ; Sat, 17 Dec 2016 17:47:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06E892852A; Sat, 17 Dec 2016 17:47:28 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61A01284F5 for ; Sat, 17 Dec 2016 17:47:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIJ4X-00089h-Ey; Sat, 17 Dec 2016 17:47:01 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIJ4U-000897-AH for ath10k@lists.infradead.org; Sat, 17 Dec 2016 17:46:59 +0000 Received: by mail-wm0-x242.google.com with SMTP id u144so11125822wmu.0 for ; Sat, 17 Dec 2016 09:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fM6XTsSCrTdhBzNdWOWxfgjplNYDM/y93LVl6+VEPXM=; b=Acds1zRWHiTZ4iThWdUubEY8T/bFkZfA8UE9JhFEt+cXS1GGtYZx0GHhFsc/1XwPy2 3HSFh1FUruO+oZNse8XsGz/VGehrtR6d6TPxk6QdVJWiGSg8AAY/qKHFkhsF7WQuU8jR tgzMGOaGjXNuAl3f5OpMa1dxBrqlo6DdaDbAwdcnW+b6HvxLlvZPavBJ+1tky0PX2Ln0 oib7H4K0xVfYzHOhCnbN491l7ncKgQFA4WCFfDIzRplywzGoT6CZ3e0/L3cuM7BoyC40 NMsYcHKr4AJJAcoPuTn5QWLtBZWkjbvlhwdzDAi3Lspm6G1o+fbCio6nMhBDDqIcgqDT 4ivQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fM6XTsSCrTdhBzNdWOWxfgjplNYDM/y93LVl6+VEPXM=; b=kAy4F/U0mPLyzaOt05bAh0glDi3NhRuaYRFgz3jKCHPWXO5+IhJQrTcwoou3O94bki 9ks8rVz/QZx6CKWjFJUC0msBg98ToAVg0paAkd05EgHEHOgxUJGK5ZMpi3QdmSFYV144 xHq/vYrKyuT/d3E+gYlmMmwwVgny7Cv/BElFxHWRnoil6KxiQHCPT8tOGM6gHXvNGnIL 02S4Q64wi1IUGbQnMh9Yt+00DBCsm1ve8n/99xWNObCXIh3VLOW7c6i+ep0suIRThgW7 SlfgIR2txJiSfNBPtjnGjgLys6P0a1x3R71FqhiheNisEEUsQoVJtpNo1e2NylWsTloj T1nA== X-Gm-Message-State: AIkVDXK7Dt6PyOjespV8Rz//uFF0kAOB90qgWgzhW2RQUT1b3tgBNXQ2Gv/YUvV85AGhAg== X-Received: by 10.28.161.129 with SMTP id k123mr7868023wme.66.1481996796098; Sat, 17 Dec 2016 09:46:36 -0800 (PST) Received: from debian64.daheim (pD9F88396.dip0.t-ipconnect.de. [217.248.131.150]) by smtp.gmail.com with ESMTPSA id l187sm8975104wml.6.2016.12.17.09.46.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Dec 2016 09:46:34 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.88) (envelope-from ) id 1cIJ46-0001Bm-5V; Sat, 17 Dec 2016 18:46:34 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH] ath10k: merge extended peer info data with existing peers info Date: Sat, 17 Dec 2016 18:46:34 +0100 Message-Id: <20161217174634.4531-1-chunkeey@googlemail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161216052418.GA8936@atheros-ThinkPad-T61> References: <20161216052418.GA8936@atheros-ThinkPad-T61> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161217_094658_567314_11EB75E0 X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mohammed Shafi Shajakhan , Kalle Valo 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 10.4 firmware adds extended peer information to the firmware's statistics payload. This additional info is stored as a separate data field. During review of "ath10k: add accounting for the extended peer statistics" [0] Mohammed Shafi Shajakhan commented that the extended peer statistics lists are of little use:"... there is not much use in appending the extended peer stats (which gets periodically updated) to the linked list '&ar->debug.fw_stats.peers_extd)' and should we get rid of the below (and the required cleanup as well) list_splice_tail_init(&stats.peers_extd, &ar->debug.fw_stats.peers_extd); since rx_duration is getting updated periodically to the per sta information." This patch replaces the extended peers list with a lookup and puts the retrieved data (rx_duration) into the existing ath10k_fw_stats_peer entry that was created earlier. [0] Cc: Mohammed Shafi Shajakhan Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/ath10k/core.h | 2 -- drivers/net/wireless/ath/ath10k/debug.c | 17 -------------- drivers/net/wireless/ath/ath10k/debugfs_sta.c | 32 ++----------------------- drivers/net/wireless/ath/ath10k/wmi.c | 34 ++++++++++++++++++++------- 4 files changed, 28 insertions(+), 57 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 09ff8b8a6441..3fffbbb18c25 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -268,11 +268,9 @@ struct ath10k_fw_stats_pdev { }; struct ath10k_fw_stats { - bool extended; struct list_head pdevs; struct list_head vdevs; struct list_head peers; - struct list_head peers_extd; }; #define ATH10K_TPC_TABLE_TYPE_FLAG 1 diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 82a4c67f3672..89f7fde77cdf 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -315,25 +315,13 @@ static void ath10k_fw_stats_peers_free(struct list_head *head) } } -static void ath10k_fw_extd_stats_peers_free(struct list_head *head) -{ - struct ath10k_fw_extd_stats_peer *i, *tmp; - - list_for_each_entry_safe(i, tmp, head, list) { - list_del(&i->list); - kfree(i); - } -} - static void ath10k_debug_fw_stats_reset(struct ath10k *ar) { spin_lock_bh(&ar->data_lock); ar->debug.fw_stats_done = false; - ar->debug.fw_stats.extended = false; ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs); ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); - ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); spin_unlock_bh(&ar->data_lock); } @@ -348,7 +336,6 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) INIT_LIST_HEAD(&stats.pdevs); INIT_LIST_HEAD(&stats.vdevs); INIT_LIST_HEAD(&stats.peers); - INIT_LIST_HEAD(&stats.peers_extd); spin_lock_bh(&ar->data_lock); ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats); @@ -411,8 +398,6 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers); list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs); - list_splice_tail_init(&stats.peers_extd, - &ar->debug.fw_stats.peers_extd); } complete(&ar->debug.fw_stats_complete); @@ -424,7 +409,6 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) ath10k_fw_stats_pdevs_free(&stats.pdevs); ath10k_fw_stats_vdevs_free(&stats.vdevs); ath10k_fw_stats_peers_free(&stats.peers); - ath10k_fw_extd_stats_peers_free(&stats.peers_extd); spin_unlock_bh(&ar->data_lock); } @@ -2347,7 +2331,6 @@ int ath10k_debug_create(struct ath10k *ar) INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); INIT_LIST_HEAD(&ar->debug.fw_stats.peers); - INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); return 0; } diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c index fce6f8137d33..bf2d49cbb3bb 100644 --- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c @@ -18,27 +18,8 @@ #include "wmi-ops.h" #include "debug.h" -static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar, - struct ath10k_fw_stats *stats) -{ - struct ath10k_fw_extd_stats_peer *peer; - struct ieee80211_sta *sta; - struct ath10k_sta *arsta; - - rcu_read_lock(); - list_for_each_entry(peer, &stats->peers_extd, list) { - sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, - NULL); - if (!sta) - continue; - arsta = (struct ath10k_sta *)sta->drv_priv; - arsta->rx_duration += (u64)peer->rx_duration; - } - rcu_read_unlock(); -} - -static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, - struct ath10k_fw_stats *stats) +void ath10k_sta_update_rx_duration(struct ath10k *ar, + struct ath10k_fw_stats *stats) { struct ath10k_fw_stats_peer *peer; struct ieee80211_sta *sta; @@ -56,15 +37,6 @@ static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, rcu_read_unlock(); } -void ath10k_sta_update_rx_duration(struct ath10k *ar, - struct ath10k_fw_stats *stats) -{ - if (stats->extended) - ath10k_sta_update_extd_stats_rx_duration(ar, stats); - else - ath10k_sta_update_stats_rx_duration(ar, stats); -} - void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct station_info *sinfo) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index c893314a191f..c7ec7b9e9b55 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3044,23 +3044,41 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, if ((stats_id & WMI_10_4_STAT_PEER_EXTD) == 0) return 0; - stats->extended = true; - for (i = 0; i < num_peer_stats; i++) { const struct wmi_10_4_peer_extd_stats *src; - struct ath10k_fw_extd_stats_peer *dst; + struct ath10k_fw_stats_peer *dst; src = (void *)skb->data; if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); - if (!dst) - continue; + /* Because the stat data may exceed htc-wmi buffer + * limit the firmware might split the stats data + * and delivers it in multiple update events. + * if we can't find the entry in the current event + * payload, we have to look in main list as well. + */ + list_for_each_entry(dst, &stats->peers, list) { + if (ether_addr_equal(dst->peer_macaddr, + src->peer_macaddr.addr)) + goto found; + } + +#ifdef CONFIG_ATH10K_DEBUGFS + list_for_each_entry(dst, &ar->debug.fw_stats.peers, list) { + if (ether_addr_equal(dst->peer_macaddr, + src->peer_macaddr.addr)) + goto found; + } +#endif + + ath10k_dbg(ar, ATH10K_DBG_WMI, + "Orphaned extended stats entry for station %pM.\n", + src->peer_macaddr.addr); + continue; - ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr); +found: dst->rx_duration = __le32_to_cpu(src->rx_duration); - list_add_tail(&dst->list, &stats->peers_extd); } return 0;