From patchwork Wed Feb 1 15:27:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9550797 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7F3F604A7 for ; Wed, 1 Feb 2017 23:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FF3A2041F for ; Wed, 1 Feb 2017 23:26:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94A4428435; Wed, 1 Feb 2017 23:26:53 +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=-4.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D2AA2041F for ; Wed, 1 Feb 2017 23:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751927AbdBAX0h (ORCPT ); Wed, 1 Feb 2017 18:26:37 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:34571 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407AbdBAX0f (ORCPT ); Wed, 1 Feb 2017 18:26:35 -0500 Received: by mail-pg0-f43.google.com with SMTP id 14so112884479pgg.1 for ; Wed, 01 Feb 2017 15:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=agOCwFBnyEmHAqCz3FNnzYkownYemhRYB6cMg1mBRKA=; b=DRxtaVr7b4Ud0QC/fTSfw3JMAFCa3HRawCquVRbuDt4zP/OyYiFDcFxCa7LvVgrGYt xggeoGpxAOHWHefqYDZgDSOvvMw6hKFqaV1zzT3MRLdQoVjq3B1LOPU5g+u25aw4+n8H t8Ugzp/a3dW5ja7dnuGUVgDe6ybZOlWzOIeiA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=agOCwFBnyEmHAqCz3FNnzYkownYemhRYB6cMg1mBRKA=; b=BnVHa6TxZlW+Q0Ji2FHZLCtRAPISU5gYU6CNMhMl6KOmLmBB0rb411c/qF25y69WCW /a4Zbh7/NzV7P7vIxr34n3gY+k5DT3cmkaXR/sZidzWMPc27Vh9ROjHV74j1mTKKhjwG XeJU4M3XZKPHsgYWXaVmBTed7IdGLsxBQ73/us4cJ/s8gEQk4B/yf3w/fr4zTPS5tK0z kLIzlujQTzkTyrnuoDbC4CVpksYeaPf+7nZI0+RSvbUjKCEx7/XVft1+bO7cy8PzNK62 WnARGH79V+RbroW3aQrsMK0a9iooqgivo+y2xvyYLwg0A2Xo7i+y9al3/n5y9LCNtTPA EwLw== X-Gm-Message-State: AIkVDXL+Cg1dwvIa3CFDCYqu2Z+tA8PxR85/dsZV8W8Tn1cwo5soEQN9JDSxKs5z9lyOpGEG X-Received: by 10.84.224.133 with SMTP id s5mr8121372plj.130.1485991594811; Wed, 01 Feb 2017 15:26:34 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id m6sm52390574pfm.22.2017.02.01.15.26.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 15:26:33 -0800 (PST) From: Bjorn Andersson To: Eugene Krasnikov , Kalle Valo Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Mart Raudsepp Subject: [PATCH] wcn36xx: Implement cancel_hw_scan Date: Wed, 1 Feb 2017 07:27:47 -0800 Message-Id: <20170201152747.838-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the even that the wcn36xx interface is brought down while a hw_scan is active we must abort and wait for the ongoing scan to signal completion to mac80211. Reported-by: Mart Raudsepp Fixes: 886039036c20 ("wcn36xx: Implement firmware assisted scan") Signed-off-by: Bjorn Andersson Tested-by: Mart Raudsepp --- drivers/net/wireless/ath/wcn36xx/main.c | 25 ++++++++++++++++++++++++- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index a24edf33be93..bb7110f7fc86 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -574,6 +574,7 @@ static void wcn36xx_hw_scan_worker(struct work_struct *work) struct cfg80211_scan_request *req = wcn->scan_req; u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS_EX]; struct cfg80211_scan_info scan_info = {}; + bool aborted = false; int i; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 scan %d channels worker\n", req->n_channels); @@ -585,6 +586,13 @@ static void wcn36xx_hw_scan_worker(struct work_struct *work) wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN); for (i = 0; i < req->n_channels; i++) { + mutex_lock(&wcn->scan_lock); + aborted = wcn->scan_aborted; + mutex_unlock(&wcn->scan_lock); + + if (aborted) + break; + wcn->scan_freq = req->channels[i]->center_freq; wcn->scan_band = req->channels[i]->band; @@ -596,7 +604,7 @@ static void wcn36xx_hw_scan_worker(struct work_struct *work) } wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN); - scan_info.aborted = false; + scan_info.aborted = aborted; ieee80211_scan_completed(wcn->hw, &scan_info); mutex_lock(&wcn->scan_lock); @@ -615,6 +623,8 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw, mutex_unlock(&wcn->scan_lock); return -EBUSY; } + + wcn->scan_aborted = false; wcn->scan_req = &hw_req->req; mutex_unlock(&wcn->scan_lock); @@ -623,6 +633,18 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw, return 0; } +static void wcn36xx_cancel_hw_scan(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct wcn36xx *wcn = hw->priv; + + mutex_lock(&wcn->scan_lock); + wcn->scan_aborted = true; + mutex_unlock(&wcn->scan_lock); + + cancel_work_sync(&wcn->scan_work); +} + static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta, enum nl80211_band band) { @@ -1034,6 +1056,7 @@ static const struct ieee80211_ops wcn36xx_ops = { .tx = wcn36xx_tx, .set_key = wcn36xx_set_key, .hw_scan = wcn36xx_hw_scan, + .cancel_hw_scan = wcn36xx_cancel_hw_scan, .bss_info_changed = wcn36xx_bss_info_changed, .set_rts_threshold = wcn36xx_set_rts_threshold, .sta_add = wcn36xx_sta_add, diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 571e9f76da7e..b52b4da9a967 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -220,6 +220,7 @@ struct wcn36xx { int scan_freq; int scan_band; struct mutex scan_lock; + bool scan_aborted; /* DXE channels */ struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */