From patchwork Thu Sep 16 15:56:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 513017 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1419415jao; Thu, 16 Sep 2021 10:14:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4c+wPYIGNxzBi5RkWcHNAUiBluAX10D1iT9wEa28qdMQQ4AB8fM01SUqWDQ0gIZtB8Pds X-Received: by 2002:a05:6602:200f:: with SMTP id y15mr5240061iod.64.1631812488231; Thu, 16 Sep 2021 10:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631812488; cv=none; d=google.com; s=arc-20160816; b=YqsuGkkwPrfBygpyq48+oBBmDQN4cYPpuDfuVc7IhU0Kl5kmlGZfaIZ01gTufOlIE4 MxyKNgXcVXL5zdk4ZZsKK3AbAONpC4T95ViKJJhwT2bOtmQMnT/wEd/uxL+ZA6uTBsYx 6QW2ssghXWOu2VYEv0acMsEdWumDrteQs+nkVrV+TBb3YxG0xo8q7U8K016fttk63zPs yiHUFN5k7nmDv3CReJGSU0lRtfS/T0lNe77l7R7qmoj3h2PrCAlRVyTdZBHdmyqrkxqN FbTXp3MysBiiOh1I6+OzgCe8jajyMXmNKjoVD0QR+7e/aFvSzvbQWY1SOaxi9HkIwwtn NBaw== 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=LK6VslOeE88s611V1XteRNUU2OGPggdotiK5ONfIaB0=; b=NeHvffqT70LAGJ9O9mdo3VH05vq/KGp/MhKnJKnV4cqMYO3nVrBLLzM5VPJNQHWX2x cvzS2iIvXWLcp5NQNIRGXoX8Qj98/KOWV/0iC/tB/PDPMgD/1AjG89sKXgndLZdCMZ2q W0SUAvG1ZosHOLSTu2fMi2dW/J14j9fPAYEDHU3GAVoAwsgTsw065cqiWsVE7OwMqIJ8 wc8ADt3weoAX3K0s5tZFnSwuxgS+b743LUQwbXxa2xpEvvvBo2P0T7qYVKeYtBCMr1R3 LLxK8zfKr1H6iCu4pWg/aAn4mUhshEVG2X+G+LZx4yqi3LFwFcQIOKoF82MdCRK58WFd I02A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gMad0c+s; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 f24si2964490jaa.118.2021.09.16.10.14.47; Thu, 16 Sep 2021 10:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=gMad0c+s; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S242657AbhIPRPx (ORCPT + 11 others); Thu, 16 Sep 2021 13:15:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348494AbhIPRHU (ORCPT ); Thu, 16 Sep 2021 13:07:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1438E619A6; Thu, 16 Sep 2021 16:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810169; bh=EAyf2jJkKpNyVQn8baH9LqdwLIuSwECqxzBzNdR5l/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMad0c+sC3+CAMJXHawhk+2VPaYkdhNrg8EXbJ6TPvy9qWY2vlsSJQcIegNmzBvqp UnUVGN23U6+z3O4+VEDjOz31djiPijo7g4NdInpJdsLP4nT+tPbCRO+uAPI8EXlJV5 pjsh4BSrd1jZz0N/X6s7rb7txwcBUnr7nt+4parw= 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.14 042/432] wcn36xx: Ensure finish scan is not requested before start scan Date: Thu, 16 Sep 2021 17:56:31 +0200 Message-Id: <20210916155812.241335485@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -408,13 +408,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. @@ -422,6 +423,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); } @@ -702,6 +704,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 @@ -246,6 +246,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;