From patchwork Thu Jun 30 10:49:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9207181 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 7201560752 for ; Thu, 30 Jun 2016 10:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5824E284F2 for ; Thu, 30 Jun 2016 10:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A31C284F6; Thu, 30 Jun 2016 10:49:41 +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_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham 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 A9070284F2 for ; Thu, 30 Jun 2016 10:49:40 +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 1bIZXJ-0004rF-9A; Thu, 30 Jun 2016 10:49:33 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIZXH-0004p7-54 for ath10k@lists.infradead.org; Thu, 30 Jun 2016 10:49:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1467283771; x=1498819771; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=EHJrKGOzWtpJ6HSQyO+vX/oDUjrCSsWPs1Pn7aDinys=; b=IzjeKYlXA8u6VPj/ziV2+n73JAdWKA+NbOhOcEsvJoJlAODY2MJzPhCa U6QtxCESn8u3CjrKFJaS+Yag+OmiGIpMOWCg8Piu//b5+DBtQ/0qsC9bA Sf6lolgY1xaF45WeNr6Pv8yZ07/Ffy8WJZW8edLdQxNg3vpB4pDZ+4odM g=; X-IronPort-AV: E=Sophos;i="5.26,551,1459839600"; d="scan'208";a="299821725" Received: from unknown (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Jun 2016 03:49:09 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8211"; a="1154166544" Received: from nasanexm01h.na.qualcomm.com ([10.85.0.34]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 30 Jun 2016 03:49:09 -0700 Received: from APSANEXR01F.ap.qualcomm.com (10.85.0.39) by NASANEXM01H.na.qualcomm.com (10.85.0.34) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 30 Jun 2016 03:49:08 -0700 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by APSANEXR01F.ap.qualcomm.com (10.85.0.39) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 30 Jun 2016 03:49:04 -0700 Received: from euamsexm01a.eu.qualcomm.com ([10.251.127.40]) by euamsexm01a.eu.qualcomm.com ([10.251.127.40]) with mapi id 15.00.1178.000; Thu, 30 Jun 2016 12:49:03 +0200 From: "Valo, Kalle" To: "Shajakhan, Mohammed Shafi (Mohammed Shafi)" Subject: Re: [PATCH v3] ath10k: Fix 10.4 extended peer stats update Thread-Topic: [PATCH v3] ath10k: Fix 10.4 extended peer stats update Thread-Index: AQHR0r0DSGmxvNz92EGHAQsWzTzysw== Date: Thu, 30 Jun 2016 10:49:02 +0000 Message-ID: <87r3bf54v6.fsf@kamboji.qca.qualcomm.com> References: <1464851602-12969-1-git-send-email-mohammed@qca.qualcomm.com> <87vb0r5529.fsf@kamboji.qca.qualcomm.com> In-Reply-To: <87vb0r5529.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message of "Thu, 30 Jun 2016 13:44:46 +0300") Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.251.52.12] Content-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160630_034931_357162_0E4DB577 X-CRM114-Status: GOOD ( 14.68 ) 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@codeaurora.org" , "linux-wireless@vger.kernel.org" , "ath10k@lists.infradead.org" Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Kalle Valo writes: >> @@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { >> .board = QCA4019_HW_1_0_BOARD_DATA_FILE, >> .board_size = QCA4019_BOARD_DATA_SZ, >> .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ, >> + .extd_peer_stats = true, >> }, >> }, >> }; > > This is not a hardware feature so hw_params is not really the right > place to handle this. In the pending branch I tried to solve this a bit > differently: > > https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96 > > I added a bool "extended" to struct ath10k_fw_stats which is used to > detect if extended stats are used. Would that work? Please note that I > have only compile tested the patch. Here's a diff of what I did: diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 58932c09efc5..b734345ab598 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -180,7 +180,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .board = QCA99X0_HW_2_0_BOARD_DATA_FILE, .board_size = QCA99X0_BOARD_DATA_SZ, .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ, - .extd_peer_stats = true, }, }, { @@ -203,7 +202,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .board = QCA9984_HW_1_0_BOARD_DATA_FILE, .board_size = QCA99X0_BOARD_DATA_SZ, .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ, - .extd_peer_stats = true, }, }, { @@ -261,7 +259,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .board = QCA4019_HW_1_0_BOARD_DATA_FILE, .board_size = QCA4019_BOARD_DATA_SZ, .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ, - .extd_peer_stats = true, }, }, }; diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 73a0b1ae1559..3707d8a707a2 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -263,6 +263,7 @@ struct ath10k_fw_stats_pdev { }; struct ath10k_fw_stats { + bool extended; struct list_head pdevs; struct list_head vdevs; struct list_head peers; @@ -754,7 +755,6 @@ struct ath10k { const char *board; size_t board_size; size_t board_ext_size; - bool extd_peer_stats; } fw; } hw_params; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 001c0a144614..355e1ae665f9 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -327,6 +327,7 @@ 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); diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c index af3d49af9eab..0da8a57e0ba7 100644 --- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c @@ -19,14 +19,14 @@ #include "debug.h" static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar, - struct list_head *head) + struct ath10k_fw_stats *stats) { - struct ieee80211_sta *sta; struct ath10k_fw_extd_stats_peer *peer; + struct ieee80211_sta *sta; struct ath10k_sta *arsta; rcu_read_lock(); - list_for_each_entry(peer, head, list) { + list_for_each_entry(peer, &stats->peers_extd, list) { sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, NULL); if (!sta) @@ -38,13 +38,14 @@ static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar, } static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, - struct list_head *head) -{ struct ieee80211_sta *sta; + struct ath10k_fw_stats *stats) +{ struct ath10k_fw_stats_peer *peer; + struct ieee80211_sta *sta; struct ath10k_sta *arsta; rcu_read_lock(); - list_for_each_entry(peer, head, list) { + list_for_each_entry(peer, &stats->peers, list) { sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, NULL); if (!sta) @@ -58,11 +59,10 @@ static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, void ath10k_sta_update_rx_duration(struct ath10k *ar, struct ath10k_fw_stats *stats) { - if (ar->hw_params.fw.extd_peer_stats) - ath10k_sta_update_stats_rx_duration(ar, &stats->peers); + if (stats->extended) + ath10k_sta_update_extd_stats_rx_duration(ar, stats); else - ath10k_sta_update_extd_stats_rx_duration(ar, - &stats->peers_extd); + ath10k_sta_update_stats_rx_duration(ar, stats); } static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file, diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 5f2d423b1c33..16bd79716a6c 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3008,6 +3008,8 @@ 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;