From patchwork Mon May 25 12:06:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6474141 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45391C0020 for ; Mon, 25 May 2015 12:07:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8625D20125 for ; Mon, 25 May 2015 12:07:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A54F52041C for ; Mon, 25 May 2015 12:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752404AbbEYMHd (ORCPT ); Mon, 25 May 2015 08:07:33 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:34281 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322AbbEYMHa (ORCPT ); Mon, 25 May 2015 08:07:30 -0400 Received: by wghq2 with SMTP id q2so71500492wgh.1 for ; Mon, 25 May 2015 05:07:28 -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=IlyDXTVNB+tJzxw7dQ+XCLwZITI/wKec4BlHWywBpUU=; b=CLeQ1zhXN/0YZ+rA61YiOqDsZd9aAGajn4sCWXuQJq5yBCN6aew5oGEhddQ8+ZiFkZ IOd9C0MCsajEq34WbdRwGf1xWAOImS4YtAeTt4YtUGrYu8fmepEW9YCm4R9mxAqx3auH 2Yzihxg9hanqQCZUe/+YePFqChZkb/sVhO6IA= 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=IlyDXTVNB+tJzxw7dQ+XCLwZITI/wKec4BlHWywBpUU=; b=Qu5T6N4lAY1dl37LbWqRF6IEv0QWSglWWYHExKTzfUvwcPWe4KJrNEA/G8h0/tuATW yHd/NlxMy1gJMvz+Lo3XFCUcc0pdy2rOUn1cH5EOYI9Bqqthpkpcwa37XjDWsAEa2iqH 6L5ow8qY9ebTxaAS7ec/XukrtFIw74M+YZH4CSm7aGqrulO+1V8QidcqHnm52n3M7QJK 4MhsjEcNrOYcovVb9wp8xEqrOC/d/iOxNrZYVHhqGCH50pICx91qwZ2lcI4Psli+V6He /wu9eJBe7ZMqS/uT1Hdut8Qo3UlqyhJb2DFej/CUpIgmOD8zHNiuu31FFwMREIrQ0A5A XKag== X-Gm-Message-State: ALoCoQlGqnkVgfYEovXsXfyEvHSbNlApro0/z6jHJGjdjnyF1Ghp9EEpbKw4BfpX8oqTRauPtQuzhyhcEyAoThTNm3/CGS6nh3BkVusqbowzwJZEL8ivZjnH8F+h7Dc2shBRLWTTAhFZ X-Received: by 10.180.72.176 with SMTP id e16mr5675825wiv.12.1432555648747; Mon, 25 May 2015 05:07:28 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id q10sm16459307wjo.38.2015.05.25.05.07.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 May 2015 05:07:28 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH v4 3/3] ath10k: fix inconsistent survey reports Date: Mon, 25 May 2015 14:06:19 +0200 Message-Id: <1432555579-18347-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432555579-18347-1-git-send-email-michal.kazior@tieto.com> References: <1432282693-4553-1-git-send-email-michal.kazior@tieto.com> <1432555579-18347-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. The known deviation from this is rule for 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, wraparound quirks and no overflow notification. Survey dumps now include only data gathered during scan channel visits that can be computed correctly. This should improve hostapd ACS a little bit. Reported-by: Srinivasa Duvvuri Signed-off-by: Michal Kazior --- Notes: v4: * rebased * dont overwrite survey data needlessly * rename var * update commit log 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 | 26 ++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 729b366e2a18..2d28cfae5c94 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_survey; + 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 70e6efa2c071..77220b0f0e89 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1637,20 +1637,22 @@ 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 */ + if (ar->ch_info_can_report_survey) { + survey = &ar->survey[idx]; + survey->noise = noise_floor; + survey->filled = SURVEY_INFO_NOISE_DBM; - survey = &ar->survey[idx]; - survey->noise = noise_floor; - survey->filled = SURVEY_INFO_NOISE_DBM; + ath10k_hw_fill_survey_time(ar, + survey, + cycle_count, + rx_clear_count, + ar->survey_last_cycle_count, + ar->survey_last_rx_clear_count); + } - ath10k_hw_fill_survey_time(ar, - survey, - cycle_count, - rx_clear_count, - ar->survey_last_cycle_count, - ar->survey_last_rx_clear_count); + ar->ch_info_can_report_survey = false; + } else { + ar->ch_info_can_report_survey = true; } ar->survey_last_rx_clear_count = rx_clear_count;