Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1750288pxb; Thu, 16 Sep 2021 14:49:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkerhhRTYdCMyjLVDFkXSc6GuBYQ2IijaGoQHyqO88e8s2t0RxTRZSVDyIe0dbER5exl6u X-Received: by 2002:a5d:9958:: with SMTP id v24mr6141452ios.201.1631828959260; Thu, 16 Sep 2021 14:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631828959; cv=none; d=google.com; s=arc-20160816; b=wemAtHiUE2zBRnvUBnKZrjJQAicRxMrGMeMoXpUaBKiZ604vy4AH29mXWPS8sYxj7m aQFyveZoB14ILSzzZ5thwL/cqbz9rEn+G00oeYjyBhorbCghto9k3qqG17BLRRbXmxX0 1CRIdVfFFPHXv1RmG1ryJFJMqU5Da8r5FnNx43JIfOUyUi4+1VIYKIT+CGpa13GoIKds NsT8WMibGJUNtgpjuT1xJAh3yeM1E41Mk5Ttk98Dla3N86SlfQ+u2GSJVGomUZMCLltb QyvYh5G3uv5SKzjmXtbPNs8P47eOW8AF1o5aX4LoBRFEMiigklt9Kdz6cE9c1vEbbcgc r2Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2/uvdpumGK202pQkmyjHm4UBVt9Hq88Gg9LgfMsutDY=; b=Liwftv4Vubf2qfvaH/bawQVRaYm6/TuQSLETZPlSAeQsLtihm5VDFOQAxOK16rT1Bs HPtpdKqG4WffFWocwyd3QEzLx17m3kacAy483SvmufKs/v71FHneRY8PqnAqkZLCJknw TwDGWOhcNrpiTaph5yc3YQJpFWZhzB+d69GvsTO5l5+IrUEwqvPw1XA/DTkPKMqVvfAT lR7vv8YabZVuT4Gx8Q3fo0tKV2dcZEYya2vLTRGYFKlMW6RDmVGA9rCPORaai8HugOtC dr4Jhi5pAZieEGVY1OmtDeoWIWnL3wfjSMhnUscP5ZIVjsOX4lnmSFokMuGuhRb2skeB 2o0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9LWaMH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si3549400ioo.6.2021.09.16.14.49.05; Thu, 16 Sep 2021 14:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9LWaMH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242900AbhIPQiE (ORCPT + 99 others); Thu, 16 Sep 2021 12:38:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242770AbhIPQ3c (ORCPT ); Thu, 16 Sep 2021 12:29:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A65B9613CD; Thu, 16 Sep 2021 16:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809116; bh=CZX9hFEuuv+TvcCH68DWtIHvUD6Zy5/Gc52/zDqW/9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9LWaMH2v3y90MwCeggvqlP5TtfZvITdsH+lb9YKfVhteOc/Haxv58I/kaf2/NBPR lPTAI6kOxwarbWCkxX7XtqOkOrbt7pr82Q7Q6jYuOBQlWh54hETO6XmTXaCHTcnAES xmhM9e4Z7hDd8MruG+gPF5ZG6GqkyDO6YKUUa954= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joseph Gates , Loic Poulain , Kalle Valo Subject: [PATCH 5.13 035/380] wcn36xx: Ensure finish scan is not requested before start scan Date: Thu, 16 Sep 2021 17:56:32 +0200 Message-Id: <20210916155805.156512644@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joseph Gates commit d195d7aac09bddabc2c8326fb02fcec2b0a2de02 upstream. If the operating channel is the first in the scan list, it was seen that a finish scan request would be sent before a start scan request was sent, causing the firmware to fail all future scans. Track the current channel being scanned to avoid requesting the scan finish before it starts. Cc: Fixes: 5973a2947430 ("wcn36xx: Fix software-driven scan") Signed-off-by: Joseph Gates Signed-off-by: Loic Poulain Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1629286303-13179-1-git-send-email-loic.poulain@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/wcn36xx/main.c | 5 ++++- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -405,13 +405,14 @@ static int wcn36xx_config(struct ieee802 wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n", ch); - if (wcn->sw_scan_opchannel == ch) { + if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) { /* If channel is the initial operating channel, we may * want to receive/transmit regular data packets, then * simply stop the scan session and exit PS mode. */ wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); + wcn->sw_scan_channel = 0; } else if (wcn->sw_scan) { /* A scan is ongoing, do not change the operating * channel, but start a scan session on the channel. @@ -419,6 +420,7 @@ static int wcn36xx_config(struct ieee802 wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); wcn36xx_smd_start_scan(wcn, ch); + wcn->sw_scan_channel = ch; } else { wcn36xx_change_opchannel(wcn, ch); } @@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct wcn->sw_scan = true; wcn->sw_scan_vif = vif; + wcn->sw_scan_channel = 0; if (vif_priv->sta_assoc) wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn); else --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -232,6 +232,7 @@ struct wcn36xx { struct cfg80211_scan_request *scan_req; bool sw_scan; u8 sw_scan_opchannel; + u8 sw_scan_channel; struct ieee80211_vif *sw_scan_vif; struct mutex scan_lock; bool scan_aborted;