From patchwork Fri May 22 08:18:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6461761 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4BE3C9F1CC for ; Fri, 22 May 2015 08:18:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D3AB2037F for ; Fri, 22 May 2015 08:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 421C520390 for ; Fri, 22 May 2015 08:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756822AbbEVISb (ORCPT ); Fri, 22 May 2015 04:18:31 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:38232 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756751AbbEVISX (ORCPT ); Fri, 22 May 2015 04:18:23 -0400 Received: by wichy4 with SMTP id hy4so39017535wic.1 for ; Fri, 22 May 2015 01:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ab/YKP9b6/9maqwsG1ihe2o5v9NHLKUboF/WMXBuLns=; b=UYHj7vauSlfORaXm1jrMc+rG9xILAGijzYruPCV2+twqGqjXrgxbeHn/of11LbWTZX JbEV8qXcGgmlvYJy9NtzwlXKE6yqcLOqZMJoXuILc0+fHU/lDfTv+aDF6QeQZJ95X4Mf JZzRO07w+XsvCgyLEYL9ji8hMV6G/em4lXunk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ab/YKP9b6/9maqwsG1ihe2o5v9NHLKUboF/WMXBuLns=; b=J+StHjQ9tVOh+20cRgX5VIkG4fgyVhOkniDokE0KVGlR3O/D/LiE5hY8zGkRy8ZRC+ Jp4eLXLeexOd1MVYgnuRr9UVRKKNpDRgSYOHLs9CtHZrUbi5IOklFDX9xaoY/1cVYsMJ MoF0DMmsIOEocf9AqUkNyfmq50kjLqX7/5sKbn7E+Y96xgm+pa6BcV6jAIqwkD3a20kH fHLKLcOs2bsWQK9PtaVs0DQq1ApP95ejotjzGaA4pxOeeKzeWymdD77EYNX+5caO+Pbr w6PtcN0e/j8YeIsKFdeo0giEqTOpIh0bg2Rc/4DRf+974asMpMd88F3ahbfHf1SuCWhI sQKQ== X-Gm-Message-State: ALoCoQn5OVuW+7MRIF48yY29mcH5QaRMBKdXtsCVx8LdBjcXl1PIGej1UGJv9jeqdOutQMyvyUYN6f7C+IiyZBpt1Eld97n1gZIp1Wj4fSnGL+rc1ctjZe7+29ZfTP/+6LYMihWkMVDp X-Received: by 10.195.13.113 with SMTP id ex17mr2040229wjd.17.1432282702138; Fri, 22 May 2015 01:18:22 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id l3sm6334770wik.16.2015.05.22.01.18.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 May 2015 01:18:21 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH v3 2/2] ath10k: fix inconsistent survey reports Date: Fri, 22 May 2015 10:18:13 +0200 Message-Id: <1432282693-4553-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432282693-4553-1-git-send-email-michal.kazior@tieto.com> References: <1432282693-4553-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In some cases some channel survey data was reported incorrect. Channel info events were expected to come in pairs without and with COMPLETE flag set respectively for each channel visit during scan. However there are deviations from this rule: * last scan chan info and first (next) scan chan info both have COMPLETE flag set. This was either programmed with the intent of providing BSS cycle count info or this is an artefact of firmware scan state machine. Either way this is useless due to short wraparound time and no overflow counters, * some channels are completed twice, e.g. I've seen chan info for freq 2462 come twice many times during scan. This may be some artefact of firmware scan state machine, e.g. during band switching. Data provided in either of the above is now ignored and not reported to avoid confusing the user. Survey dumps now include only data gathered during scan channel visits that can be computed correctly. This should help make hostapd ACS more reliable. Reported-by: Srinivasa Duvvuri Signed-off-by: Michal Kazior --- Notes: v3: * result of patch split up * rename the var so it matches more tightly with it's purpose * improve commit log drivers/net/wireless/ath/ath10k/core.h | 8 ++++++++ drivers/net/wireless/ath/ath10k/wmi.c | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index fb403972b1c5..d2978292b26c 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -696,6 +696,14 @@ struct ath10k { u32 survey_last_cycle_count; struct survey_info survey[ATH10K_NUM_CHANS]; + /* Channel info events are expected to come in pairs without and with + * COMPLETE flag set respectively for each channel visit during scan. + * + * However there are deviations from this rule. This flag is used to + * avoid reporting garbage data. + */ + bool ch_info_can_report_cc; + struct dfs_pattern_detector *dfs_detector; unsigned long tx_paused; /* see ATH10K_TX_PAUSE_ */ diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 52ed48b7e5f9..7485cc517802 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1636,10 +1636,6 @@ void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) } if (cmd_flags & WMI_CHAN_INFO_FLAG_COMPLETE) { - /* During scanning chan info is reported twice for each - * visited channel. The reported cycle count is global - * and per-channel cycle count must be calculated */ - /* Worst case wraparound time is approx 24 seconds (2**31 / * 88MHz). Since scan channel visit times are max 5 seconds * (offchannel case) it is guaranteed there's been at most 1 @@ -1660,6 +1656,18 @@ void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) survey->filled = SURVEY_INFO_TIME | SURVEY_INFO_TIME_BUSY | SURVEY_INFO_NOISE_DBM; + + if (!ar->ch_info_can_report_cc) { + /* Survey times can't be relied upon now but noise + * floor is still correct though. + */ + survey->filled &= ~(SURVEY_INFO_TIME | + SURVEY_INFO_TIME_BUSY); + } + + ar->ch_info_can_report_cc = false; + } else { + ar->ch_info_can_report_cc = true; } ar->survey_last_rx_clear_count = rx_clear_count;