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: 11526587 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 7E78517E8 for ; Mon, 4 May 2020 15:41:45 +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 54C5B206D7 for ; Mon, 4 May 2020 15:41:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sXGnYoZE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54C5B206D7 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=ath11k-bounces+patchwork-ath11k=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=8yZd2/hSxtVsshwwyyarVxUYvlngkEuqcp10VwBBAD0=; b=sXGnYoZEUXISYT ZVRZZrKYNI6GONb70yW8WOvoeD0/DSANP10TANYixKLpHBcRVdwL/cWFZzhT/IeUneGgK9+NMViSA aI9X86fd5fj8r9RtHdCW0IpJfwQMANVeWNXiD2vpW8dX8WpdYVJYDOvz/V6OpppSZLZcWF4kRmHwj zfcitVfs3D9NReIomyMXjMpvV7ZX1Gk+TG3in9op21YqC2gcFC3UsS4pm2PzoVnwTegOcYkzqbM1y wou6zdxXeqH6+nuzv7pcZSOCg2iF9M6dBYSX4k4DPPO3WbJ7w8jzDuc/e+xHgoccYj5CH4Tcs7zCY 9+FDgSxWWhNYySfBU8kA==; 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 1jVdDx-00065M-OX; Mon, 04 May 2020 15:41:41 +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: ath11k@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: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=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: 11526585 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 7CB3F17E8 for ; Mon, 4 May 2020 15:41:44 +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 4812A206D7 for ; Mon, 4 May 2020 15:41:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kpoL7LnO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4812A206D7 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=ath11k-bounces+patchwork-ath11k=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=DujTTfDN+h7ua3qMmMCt/oXNAH+utx4T3e20xGL53E0=; b=kpoL7LnO76GnJN hiw3u1R0MOUOqpQvZtNdWkK3K3JjsvaKa0BOZPPsr2wxBzA2q6DpJWrVFDTBLhHhg1eca7tp13LmL UDXDjjviZ69d23Pi97ljxBc2Hldzl/9PEzWbSLqEvcSHXgGKYdvkQEP6B7zCltIl7jrVP8KFtZlSP SZrPMbcY12VUkKMZPMLE/JygZyIBel0Vwt/85fvVYv5NXHbkRWCuOHKLl3cUnTLblKnVZXSduLeYe 3np2oytoPZZojGRpe8qd7UmI41rsBnyK9OT7OpcqgRwfA2PnaTdD3ppIJ1OEfswD+o2ERuvFTvc9w /JXqbeFL+hr9W4kNYT9A==; 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 1jVdDw-00063s-LF; Mon, 04 May 2020 15:41:40 +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: ath11k@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: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=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);