From patchwork Thu May 30 03:49:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram R X-Patchwork-Id: 10968145 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC69A933 for ; Thu, 30 May 2019 03:49:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1F928A3D for ; Thu, 30 May 2019 03:49:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF37D28A7C; Thu, 30 May 2019 03:49:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48E8328A3D for ; Thu, 30 May 2019 03:49:32 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=pH2rXhG8f2edrR41ymZ6CGUsbyQ7Vp2qBW+cMsDYIL8=; b=MOg 1PsTFj3Np6neMgLHQjPLHJKd3bNBsYHDyTcpcYmcm/7FQ2wr2yzsLUpgmUALHMm0znEeuOts8G3Tp 0z1f8Ed0TppTp8KjxaI3PNGVL3PTJwzfUAwPiOi9x1noj81EjR2FLDl1BZBdTujMN58uXwDNHRXKf p8syhTFHYkLx/4is4fzHpOMkcB+0fpY8G5LxH84uFQRl2+sXzQXTsCVvyT4yfq1FrGLxDl7uPUldG eGQNgVtvHlwghQpnvTmBEPpmhSJCoG2TF6Fq+4oECT6KuUKWiC1GXFOXeLv5nZ7ByzwK6Gk9WUzk1 qWWyhlYGPrmKCDLPMDPH3r5ZHcRWsaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWC4J-0008Mg-4z; Thu, 30 May 2019 03:49:31 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWC4G-0008LY-K5 for ath11k@lists.infradead.org; Thu, 30 May 2019 03:49:30 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 941866019D; Thu, 30 May 2019 03:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559188165; bh=S+Fomafrm8q7adY9Vz+ZtdCrKhxpCYej9EUMnKGZLpY=; h=From:To:Cc:Subject:Date:From; b=O68TpsAwJk17jORWBycztawiw5i3a1BSZOuEDx3wZpCwZUMPT+vZ/mv2MqcSrEqSp 4Z6NZsQVsdDAVNFaPeJmwXPo1kYgT3pwGIqNv0VufGNShZQksycJy/9li10vKapXJi 45vE8pvshkeriEM2PJ8FRpqqN3w/4hjk8UOWzy58= Received: from checstp253621-lin.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srirrama@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1A7576019D; Thu, 30 May 2019 03:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559188165; bh=S+Fomafrm8q7adY9Vz+ZtdCrKhxpCYej9EUMnKGZLpY=; h=From:To:Cc:Subject:Date:From; b=O68TpsAwJk17jORWBycztawiw5i3a1BSZOuEDx3wZpCwZUMPT+vZ/mv2MqcSrEqSp 4Z6NZsQVsdDAVNFaPeJmwXPo1kYgT3pwGIqNv0VufGNShZQksycJy/9li10vKapXJi 45vE8pvshkeriEM2PJ8FRpqqN3w/4hjk8UOWzy58= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1A7576019D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=srirrama@codeaurora.org From: Sriram R To: ath11k@lists.infradead.org Subject: [PATCH v2] ath11k: Fix error received while aborting hw scan Date: Thu, 30 May 2019 09:19:12 +0530 Message-Id: <1559188152-4826-1-git-send-email-srirrama@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190529_204928_693707_43D254AF X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sriram R MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Set the appropriate scan cancel request param while stopping the hw scan. Also, when a interface is stopped, the SDATA_STATE_RUNNING flag will be cleared before cancelling the scan, hence the interface can't be found in active interfaces in corresponding scan cancellation event. Hence search the corresponding 'ar' by iterating through the active pdev's if the scan state is aborting. This will avoid 'failed to stop wmi scan' error received while aborting the scan. Signed-off-by: Sriram R --- v2 : Rebased on ToT. drivers/net/wireless/ath/ath11k/mac.c | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 38 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cb0de8e..1d2c14c 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1857,7 +1857,7 @@ void ath11k_scan_finish(struct ath11k *ar) static int ath11k_scan_stop(struct ath11k *ar) { struct scan_cancel_param arg = { - .req_type = WMI_SCAN_STOP_ONE, + .req_type = WLAN_SCAN_CANCEL_SINGLE, .scan_id = ATH11K_SCAN_ID, }; int ret; diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 9ca44c4..3e6b9c1 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -4969,6 +4969,30 @@ static void ath11k_mgmt_tx_compl_event(struct ath11k_base *ab, struct sk_buff *s rcu_read_unlock(); } +static struct ath11k *ath11k_get_ar_on_scan_abort(struct ath11k_base *ab, + u32 vdev_id) +{ + int i; + struct ath11k_pdev *pdev; + struct ath11k *ar; + + for (i = 0; i < ab->num_radios; i++) { + pdev = rcu_dereference(ab->pdevs_active[i]); + if (pdev && pdev->ar) { + ar = pdev->ar; + + spin_lock_bh(&ar->data_lock); + if (ar->scan.state == ATH11K_SCAN_ABORTING && + ar->scan.vdev_id == vdev_id) { + spin_unlock_bh(&ar->data_lock); + return ar; + } + spin_unlock_bh(&ar->data_lock); + } + } + return NULL; +} + static void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len) { struct ath11k *ar; @@ -4981,7 +5005,19 @@ static void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len) } rcu_read_lock(); - ar = ath11k_get_ar_by_vdev_id(ab, scan_ev.vdev_id); + + /* In case the scan was cancelled, ex. during interface teardown, + * the interface will not be found in active interfaces. + * Rather, in such scenarios, iterate over the active pdev's to + * search 'ar' if the corresponding 'ar' scan is ABORTING and the + * aborting scan's vdev id matches this event info. + */ + if (scan_ev.event_type == WMI_SCAN_EVENT_COMPLETED && + scan_ev.reason == WMI_SCAN_REASON_CANCELLED) + ar = ath11k_get_ar_on_scan_abort(ab, scan_ev.vdev_id); + else + ar = ath11k_get_ar_by_vdev_id(ab, scan_ev.vdev_id); + if (!ar) { ath11k_warn(ab, "Received scan event for unknown vdev"); rcu_read_unlock();