From patchwork Mon May 4 15:41:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11526579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F39592A for ; Mon, 4 May 2020 15:41:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5092206D7 for ; Mon, 4 May 2020 15:41:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Qs8o/AuT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5092206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tu-ilmenau.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=2OPv8YAHTGKA1OOPoT53ctjCmV9GKbBGLdzOcoZqMes=; b=Qs8o/AuTVqK/sk 6SdPvE9rmMx4ywqJooHfaZEzEhR/5MkSZtDzuvM8Om7nxXn7D8QVOzPSoR0uwlg/ACnUvxcIt0Cox L4p11wrlOqtDXGnpN8B2k6+x0rTDheOaje8+QkrifTQaSe9va4LjAF/IGB46UFU6/FSvtI2EAh+Bl 1vmEgptUDkNugufj1ityJbJAD7PmqwMHjNTPBPfDLvqLFh9ydfId9uf5NPBTs35UiLMi24W+hx4z/ o/d+mEWdR1nUeB7c5qoJ5DSAobJ5EMTsNEHJD43OS2ss0849azLf2ZdWnlHuQYcr78qIW0kFyYz8/ +zbaYmYCgx3JOMXoeLkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdDu-00060j-QU; Mon, 04 May 2020 15:41:38 +0000 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdDq-0005wf-5c; Mon, 04 May 2020 15:41:35 +0000 Received: from legolas.fritz.box (unknown [87.147.56.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id EA08E580065; Mon, 4 May 2020 17:41:23 +0200 (CEST) From: Markus Theil To: linux-wireless@vger.kernel.org Subject: [PATCH 1/2] ath10k: use cumulative survey statistics Date: Mon, 4 May 2020 17:41:21 +0200 Message-Id: <20200504154122.91862-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_084134_362539_68C0D059 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [141.24.186.67 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Theil , ath10k@lists.infradead.org, kvalo@codeaurora.org, ath11k@lists.infradead.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org ath10k currently reports survey results for the last interval between each invocation of NL80211_CMD_GET_SURVEY. For concurrent invocations, this can lead to unexpectedly small results, e.g. when hostapd uses survey data and iw survey dump is invoked in parallel. Fix this by returning cumulative results, that don't depend on the last invocation. Other drivers, e.g. ath9k or mt76 also use this behavior. Signed-off-by: Markus Theil --- drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index a81a1ab2de19..451c8275d07b 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -5802,16 +5802,16 @@ static int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar, survey = &ar->survey[idx]; - survey->noise = noise_floor; - survey->time = div_u64(total, cc_freq_hz); - survey->time_busy = div_u64(busy, cc_freq_hz); - survey->time_rx = div_u64(rx_bss, cc_freq_hz); - survey->time_tx = div_u64(tx, cc_freq_hz); - survey->filled |= (SURVEY_INFO_NOISE_DBM | - SURVEY_INFO_TIME | - SURVEY_INFO_TIME_BUSY | - SURVEY_INFO_TIME_RX | - SURVEY_INFO_TIME_TX); + survey->noise = noise_floor; + survey->time += div_u64(total, cc_freq_hz); + survey->time_busy += div_u64(busy, cc_freq_hz); + survey->time_rx += div_u64(rx_bss, cc_freq_hz); + survey->time_tx += div_u64(tx, cc_freq_hz); + survey->filled |= (SURVEY_INFO_NOISE_DBM | + SURVEY_INFO_TIME | + SURVEY_INFO_TIME_BUSY | + SURVEY_INFO_TIME_RX | + SURVEY_INFO_TIME_TX); exit: spin_unlock_bh(&ar->data_lock); complete(&ar->bss_survey_done); From patchwork Mon May 4 15:41:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11526581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68AEC17EF for ; Mon, 4 May 2020 15:41:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 471AC206D7 for ; Mon, 4 May 2020 15:41:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fdOfvdJ4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 471AC206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tu-ilmenau.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=t1OU3JkTk8Pdw5swES1TDNjEDTiWqSWuCnj5POFacio=; b=fdOfvdJ4bIwKR/ 3Lav18YK0SESg+tVsh2Ch1vnumARnEsSc7L5+JWcP3U5JzAseLL2TzH2oLsXszMMIlili7mSpdRak 6rgCmJrUmys2TEFhvy2CWDdA+0Q7buNk+bmhU3ExHt1Vb2MF5CMfCVC4+V7fydEo0o8HNuw1eqc8T MjfPuI9EXw1o2roIQp62vdebOwJn/Sbml7M1Bhe8+yXE8/178xv0iMLHysiQ8Dm2T66j45n2TGd+X G6JS2krd9qCorLIBMdJqzS/7iZ5rR8x7Vaf2S8Vy96qifSoEQvNeOul4d/PQqNeNwKfwkcp3vfH0G dN19MsjmrR/6HsDCSweg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdDt-0005zb-OY; Mon, 04 May 2020 15:41:37 +0000 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdDq-0005wg-6p; Mon, 04 May 2020 15:41:35 +0000 Received: from legolas.fritz.box (unknown [87.147.56.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 25687580242; Mon, 4 May 2020 17:41:24 +0200 (CEST) From: Markus Theil To: linux-wireless@vger.kernel.org Subject: [PATCH 2/2] ath11k: use cumulative survey statistics Date: Mon, 4 May 2020 17:41:22 +0200 Message-Id: <20200504154122.91862-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200504154122.91862-1-markus.theil@tu-ilmenau.de> References: <20200504154122.91862-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_084134_396721_034AFF0A X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [141.24.186.67 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Theil , ath10k@lists.infradead.org, kvalo@codeaurora.org, ath11k@lists.infradead.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org ath11k currently reports survey results for the last interval between each invocation of NL80211_CMD_GET_SURVEY. For concurrent invocations, this can lead to unexpectedly small results, e.g. when hostapd uses survey data and iw survey dump is invoked in parallel. Fix this by returning cumulative results, that don't depend on the last invocation. Other drivers, e.g. ath9k or mt76 also use this behavior. Signed-off-by: Markus Theil --- drivers/net/wireless/ath/ath11k/wmi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index c2a972377687..322ddfda5bfd 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5610,16 +5610,16 @@ ath11k_pdev_bss_chan_info_event(struct ath11k_base *ab, struct sk_buff *skb) survey = &ar->survey[idx]; - survey->noise = bss_ch_info_ev.noise_floor; - survey->time = div_u64(total, cc_freq_hz); - survey->time_busy = div_u64(busy, cc_freq_hz); - survey->time_rx = div_u64(rx_bss, cc_freq_hz); - survey->time_tx = div_u64(tx, cc_freq_hz); - survey->filled |= (SURVEY_INFO_NOISE_DBM | - SURVEY_INFO_TIME | - SURVEY_INFO_TIME_BUSY | - SURVEY_INFO_TIME_RX | - SURVEY_INFO_TIME_TX); + survey->noise = bss_ch_info_ev.noise_floor; + survey->time += div_u64(total, cc_freq_hz); + survey->time_busy += div_u64(busy, cc_freq_hz); + survey->time_rx += div_u64(rx_bss, cc_freq_hz); + survey->time_tx += div_u64(tx, cc_freq_hz); + survey->filled |= (SURVEY_INFO_NOISE_DBM | + SURVEY_INFO_TIME | + SURVEY_INFO_TIME_BUSY | + SURVEY_INFO_TIME_RX | + SURVEY_INFO_TIME_TX); exit: spin_unlock_bh(&ar->data_lock); complete(&ar->bss_survey_done);