linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sushant Kumar Mishra <sushant2k1513@gmail.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org,
	Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>,
	Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>,
	Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>
Subject: [PATCH v3 1/2] mac80211: invoke sw_scan if hw_scan returns EPERM
Date: Thu,  2 Aug 2018 09:00:45 +0530	[thread overview]
Message-ID: <1533180646-8028-1-git-send-email-sushant2k1513@gmail.com> (raw)

From: Sanjay Kumar Koduri <sanjay.konduri@redpinesignals.com>

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 <sanjay.konduri@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>
---
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);
 	}
-- 
2.5.5

             reply	other threads:[~2018-08-02  5:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  3:30 Sushant Kumar Mishra [this message]
2018-08-02  3:30 ` [PATCH v3 2/2] rsi: add support for hardware scan offload Sushant Kumar Mishra
2018-08-14 11:33 ` [PATCH v3 1/2] mac80211: invoke sw_scan if hw_scan returns EPERM Johannes Berg
     [not found]   ` <5B83C2FE.90000@redpinesignals.com>
2018-08-29  7:24     ` Johannes Berg
2018-08-31 13:34       ` Siva Rebbagondla
     [not found]         ` <1535970059.3437.39.camel@sipsolutions.net>
     [not found]           ` <CANGSkXTPejV11TVpauXn+t6g+rUQ8cYik8KAz7W1P-2Y-8XebA@mail.gmail.com>
     [not found]             ` <CANGSkXR11ZxFoiZ7sbKTu8BnXSpTsiAhH=DOD=e9Zh8bquDC0A@mail.gmail.com>
2018-09-11 12:25               ` Johannes Berg
2018-09-11 13:20                 ` Siva Rebbagondla
2018-09-22  5:29                   ` Siva Rebbagondla
2018-09-28  7:21                     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533180646-8028-1-git-send-email-sushant2k1513@gmail.com \
    --to=sushant2k1513@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sanjay.konduri@redpinesignals.com \
    --cc=siva.rebbagondla@redpinesignals.com \
    --cc=sushant.mishra@redpinesignals.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).