From patchwork Thu Aug 2 03:30:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sushant Kumar Mishra X-Patchwork-Id: 10553241 X-Patchwork-Delegate: johannes@sipsolutions.net 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 2371E9093 for ; Thu, 2 Aug 2018 03:51:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1450B2B279 for ; Thu, 2 Aug 2018 03:51:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08A062B2DD; Thu, 2 Aug 2018 03:51:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 A0BD52B279 for ; Thu, 2 Aug 2018 03:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbeHBFko (ORCPT ); Thu, 2 Aug 2018 01:40:44 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35779 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeHBFko (ORCPT ); Thu, 2 Aug 2018 01:40:44 -0400 Received: by mail-pf1-f193.google.com with SMTP id p12-v6so503063pfh.2 for ; Wed, 01 Aug 2018 20:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DhSpaj+0s/264jlJ0LypnsmJ7d7GLy4rPBICWgWs9/o=; b=EENqAqpUSWiGrIu7WUV0Fcyvcut/sGgHNqYbpAzqDSr1JUlRVJhmJ6IhekzOt3oMph nyMNMuzWP7csXbYyArXw7Dd8v4Y3y57/1BtJ8T+HDf5nV3wNGupQHXm2urUB0fBbilX1 huw+uaQ5cgLUoe1TWTt52ITLzsj4g9ikWTBq1aO7qMLEqaGObT859D6T2LtgYIGCK2xB gCyDyKf3uEyN/yyxHwHqVIMoGIgGl7ywxcqIvHlnX6A4o6n1t5htI+PxgDa8HBfopb1v GMRjjsbwvYwM61h1O4TnhaVrteqUzRwQuhdKNP0wPSz18mMqRZPk2CKTofXbn5CPHs7v 2jjw== 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=DhSpaj+0s/264jlJ0LypnsmJ7d7GLy4rPBICWgWs9/o=; b=iYPjtRF3nMnWSL5VpUakx49elOPcebaCUhWBdS8TWpa08TjWQZTG+FlQY5iNIn/x19 a/eDfjBLTwYn5gbvK6OgzM0KRoi1PeuO96B7/54KD45dilipXWm7ZrhjONYU83S5cmRD UZJzP1Xv44P2jAhjPuejA1MxkcoEhewpm9XnFtIIoiRkH5mPL+fWR6bJPhupLFFJ4ugq I8Asla3e5K3E10V//tBuuGlq+VA4NwqH2zTHgB63dRPH1YUcYPE0aZa3/8GMszU6z3Im ZFR4Z0U1oinfhnODRbMCX2daJYkAsg0LXauUZgAQ0I7EKn3SN1rwMIsZK8n1GXo8r4gn hqBA== X-Gm-Message-State: AOUpUlF93puZyNMDsitFBEaftgOi1Dy3aCFJPR+k9PQhvz8M+c0sGlEf BC+ghlL66WtjA6YcE1AhKQk6+oPZ46g= X-Google-Smtp-Source: AAOMgpcSFxpsK4ZxnvG9RrZbw5SyWVVfhjAs1KYaoIbCB+I6A4aqWS2R8cMFxiZNdSJfHNstZ4/o4Q== X-Received: by 2002:a62:3d86:: with SMTP id x6-v6mr1134585pfj.192.1533181898603; Wed, 01 Aug 2018 20:51:38 -0700 (PDT) Received: from cpu188.localdomain ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id g7-v6sm668099pfi.175.2018.08.01.20.51.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 20:51:37 -0700 (PDT) From: Sushant Kumar Mishra To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Siva Rebbagondla , Sanjay Kumar Konduri , Sushant Kumar Mishra Subject: [PATCH v3 1/2] mac80211: invoke sw_scan if hw_scan returns EPERM Date: Thu, 2 Aug 2018 09:00:45 +0530 Message-Id: <1533180646-8028-1-git-send-email-sushant2k1513@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sanjay Kumar Koduri Currently, software scan in mac80211 is used by drivers, which don't implement hardware scan. However some drivers which have implemented hardware scan may also sometimes want to use software scan in mac80211. Such drivers can return '-EPERM' and ask mac80211 to fallback to software scan with this patch. Signed-off-by: Sanjay Kumar konduri Signed-off-by: Siva Rebbagondla Signed-off-by: Sushant Kumar Mishra --- changes in v3: Set SCAN_HW_CANCELLED bit, before SW_SCAN triggered. changes in v2: Nothing --- net/mac80211/scan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 2e917a6..bb1029b 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -412,7 +412,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) /* Set power back to normal operating levels. */ ieee80211_hw_config(local, 0); - if (!hw_scan) { + if (!test_bit(SCAN_SW_SCANNING, &local->scanning)) { ieee80211_configure_filter(local); drv_sw_scan_complete(local, scan_sdata); ieee80211_offchannel_return(local); @@ -686,6 +686,11 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, if (local->ops->hw_scan) { WARN_ON(!ieee80211_prep_hw_scan(local)); rc = drv_hw_scan(local, sdata, local->hw_scan_req); + if (rc == -EPERM) { + set_bit(SCAN_HW_CANCELLED, &local->scanning); + __set_bit(SCAN_SW_SCANNING, &local->scanning); + rc = ieee80211_start_sw_scan(local, sdata); + } } else { rc = ieee80211_start_sw_scan(local, sdata); }