All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: allow hardware scan to fall back to software
@ 2018-10-18  8:35 Johannes Berg
  2018-10-18 10:42 ` Arend van Spriel
  2018-10-18 11:51 ` Siva Rebbagondla
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2018-10-18  8:35 UTC (permalink / raw)
  To: linux-wireless
  Cc: Sushant Kumar Mishra, Siva Rebbagondla, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi,
	Sushant Kumar Mishra, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

In some cases, like in the rsi driver hardware scan offload, there
may be scenarios in which hardware scan might not be available or
desirable.

Allow drivers to cope with this by letting them fall back to software
scan by returning the special value 1 from the hardware scan method.

Requested-by: Sushant Kumar Mishra <sushant2k1513@gmail.com>
Requested-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/mac80211.h |  5 +++++
 net/mac80211/scan.c    | 22 ++++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 71985e95d2d9..4631b3b6fc37 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3239,6 +3239,11 @@ enum ieee80211_reconfig_type {
  *	When the scan finishes, ieee80211_scan_completed() must be called;
  *	note that it also must be called when the scan cannot finish due to
  *	any error unless this callback returned a negative error code.
+ *	This callback is also allowed to return the special return value 1,
+ *	this indicates that hardware scan isn't desirable right now and a
+ *	software scan should be done instead. A driver wishing to use this
+ *	capability must ensure its (hardware) scan capabilities aren't
+ *	advertised as more capable than mac80211's software scan is.
  *	The callback can sleep.
  *
  * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan.
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 5d2a11777718..95413413f98c 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -356,7 +356,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
 static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
-	bool hw_scan = local->ops->hw_scan;
+	bool hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
 	bool was_scanning = local->scanning;
 	struct cfg80211_scan_request *scan_req;
 	struct ieee80211_sub_if_data *scan_sdata;
@@ -606,6 +606,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 				  struct cfg80211_scan_request *req)
 {
 	struct ieee80211_local *local = sdata->local;
+	bool hw_scan = local->ops->hw_scan;
 	int rc;
 
 	lockdep_assert_held(&local->mtx);
@@ -620,7 +621,8 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 		return 0;
 	}
 
-	if (local->ops->hw_scan) {
+ again:
+	if (hw_scan) {
 		u8 *ies;
 
 		local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
@@ -679,7 +681,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 	else
 		memcpy(local->scan_addr, sdata->vif.addr, ETH_ALEN);
 
-	if (local->ops->hw_scan) {
+	if (hw_scan) {
 		__set_bit(SCAN_HW_SCANNING, &local->scanning);
 	} else if ((req->n_channels == 1) &&
 		   (req->channels[0] == local->_oper_chandef.chan)) {
@@ -722,7 +724,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 
 	ieee80211_recalc_idle(local);
 
-	if (local->ops->hw_scan) {
+	if (hw_scan) {
 		WARN_ON(!ieee80211_prep_hw_scan(local));
 		rc = drv_hw_scan(local, sdata, local->hw_scan_req);
 	} else {
@@ -740,6 +742,18 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 		RCU_INIT_POINTER(local->scan_sdata, NULL);
 	}
 
+	if (hw_scan && rc == 1) {
+		/*
+		 * we can't fall back to software for P2P-GO
+		 * as it must update NoA etc.
+		 */
+		if (ieee80211_vif_type_p2p(&sdata->vif) ==
+				NL80211_IFTYPE_P2P_GO)
+			return -EOPNOTSUPP;
+		hw_scan = false;
+		goto again;
+	}
+
 	return rc;
 }
 
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-10-18  8:35 [PATCH] mac80211: allow hardware scan to fall back to software Johannes Berg
@ 2018-10-18 10:42 ` Arend van Spriel
  2018-10-18 11:07   ` Johannes Berg
  2018-10-18 11:51 ` Siva Rebbagondla
  1 sibling, 1 reply; 7+ messages in thread
From: Arend van Spriel @ 2018-10-18 10:42 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless
  Cc: Sushant Kumar Mishra, Siva Rebbagondla, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi,
	Sushant Kumar Mishra, Johannes Berg

On 10/18/2018 10:35 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> In some cases, like in the rsi driver hardware scan offload, there
> may be scenarios in which hardware scan might not be available or
> desirable.
>
> Allow drivers to cope with this by letting them fall back to software
> scan by returning the special value 1 from the hardware scan method.
>
> Requested-by: Sushant Kumar Mishra <sushant2k1513@gmail.com>
> Requested-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  include/net/mac80211.h |  5 +++++
>  net/mac80211/scan.c    | 22 ++++++++++++++++++----
>  2 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 71985e95d2d9..4631b3b6fc37 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -3239,6 +3239,11 @@ enum ieee80211_reconfig_type {
>   *	When the scan finishes, ieee80211_scan_completed() must be called;
>   *	note that it also must be called when the scan cannot finish due to
>   *	any error unless this callback returned a negative error code.
> + *	This callback is also allowed to return the special return value 1,
> + *	this indicates that hardware scan isn't desirable right now and a
> + *	software scan should be done instead. A driver wishing to use this
> + *	capability must ensure its (hardware) scan capabilities aren't
> + *	advertised as more capable than mac80211's software scan is.

Hi Johannes,

Not sure what is meant by the last sentence. What does "more capable" 
mean? What are (or where to find) the mac80211 software scan capabilities?

Regards,
Arend

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-10-18 10:42 ` Arend van Spriel
@ 2018-10-18 11:07   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2018-10-18 11:07 UTC (permalink / raw)
  To: Arend van Spriel, linux-wireless
  Cc: Sushant Kumar Mishra, Siva Rebbagondla, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi,
	Sushant Kumar Mishra

On Thu, 2018-10-18 at 12:42 +0200, Arend van Spriel wrote:
> 
> > + *	This callback is also allowed to return the special return value 1,
> > + *	this indicates that hardware scan isn't desirable right now and a
> > + *	software scan should be done instead. A driver wishing to use this
> > + *	capability must ensure its (hardware) scan capabilities aren't
> > + *	advertised as more capable than mac80211's software scan is.
> 
> Not sure what is meant by the last sentence. What does "more capable" 
> mean? What are (or where to find) the mac80211 software scan capabilities?

I was thinking in terms of the scan capabilities exposed to userspace
via nl80211. For example, mac80211 supports max 4 scan SSIDs (though
this is a soft limit, it doesn't really care later), and a maximum probe
request size. That's it though, so it doesn't support things like
NL80211_EXT_FEATURE_LOW_SPAN_SCAN, for example.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-10-18  8:35 [PATCH] mac80211: allow hardware scan to fall back to software Johannes Berg
  2018-10-18 10:42 ` Arend van Spriel
@ 2018-10-18 11:51 ` Siva Rebbagondla
  2018-11-09  6:18   ` Siva Rebbagondla
  1 sibling, 1 reply; 7+ messages in thread
From: Siva Rebbagondla @ 2018-10-18 11:51 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Linux Wireless, sushant kumar mishra, Siva Rebbagondla,
	Sanjay Kumar Konduri, prameela.j04cs, Sushant Mishra,
	johannes.berg

On Thu, Oct 18, 2018 at 2:06 PM Johannes Berg <johannes@sipsolutions.net> wrote:
>
> From: Johannes Berg <johannes.berg@intel.com>
>
> In some cases, like in the rsi driver hardware scan offload, there
> may be scenarios in which hardware scan might not be available or
> desirable.
>
> Allow drivers to cope with this by letting them fall back to software
> scan by returning the special value 1 from the hardware scan method.
>
Acked-and-Tested-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-10-18 11:51 ` Siva Rebbagondla
@ 2018-11-09  6:18   ` Siva Rebbagondla
  2018-11-09 11:19     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Siva Rebbagondla @ 2018-11-09  6:18 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Linux Wireless, sushant kumar mishra, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi, Sushant Mishra,
	johannes.berg

Hi,
Gentle Remainder..!!!.
Any update required for this patch?. If not, When can i expect this
patch to be available in wireless-next?.

Thank you,
Siva Rebbagondla

On Thu, Oct 18, 2018 at 5:21 PM Siva Rebbagondla <siva8118@gmail.com> wrote:
>
> On Thu, Oct 18, 2018 at 2:06 PM Johannes Berg <johannes@sipsolutions.net> wrote:
> >
> > From: Johannes Berg <johannes.berg@intel.com>
> >
> > In some cases, like in the rsi driver hardware scan offload, there
> > may be scenarios in which hardware scan might not be available or
> > desirable.
> >
> > Allow drivers to cope with this by letting them fall back to software
> > scan by returning the special value 1 from the hardware scan method.
> >
> Acked-and-Tested-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-11-09  6:18   ` Siva Rebbagondla
@ 2018-11-09 11:19     ` Johannes Berg
  2018-11-09 11:55       ` Siva Rebbagondla
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2018-11-09 11:19 UTC (permalink / raw)
  To: Siva Rebbagondla
  Cc: Linux Wireless, sushant kumar mishra, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi, Sushant Mishra

On Fri, 2018-11-09 at 11:48 +0530, Siva Rebbagondla wrote:
> Hi,
> Gentle Remainder..!!!.
> Any update required for this patch?. If not, When can i expect this
> patch to be available in wireless-next?.

Sorry, I hadn't been merging things for a while due to the merge window.

I just put it into mac80211-next, so I guess the answer should be
"soon".

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mac80211: allow hardware scan to fall back to software
  2018-11-09 11:19     ` Johannes Berg
@ 2018-11-09 11:55       ` Siva Rebbagondla
  0 siblings, 0 replies; 7+ messages in thread
From: Siva Rebbagondla @ 2018-11-09 11:55 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Linux Wireless, sushant kumar mishra, Siva Rebbagondla,
	Sanjay Kumar Konduri, Prameela Rani Garnepudi, Sushant Mishra

On Fri, Nov 9, 2018 at 4:49 PM Johannes Berg <johannes@sipsolutions.net> wrote:
>
> On Fri, 2018-11-09 at 11:48 +0530, Siva Rebbagondla wrote:
> > Hi,
> > Gentle Remainder..!!!.
> > Any update required for this patch?. If not, When can i expect this
> > patch to be available in wireless-next?.
>
> Sorry, I hadn't been merging things for a while due to the merge window.
>
> I just put it into mac80211-next, so I guess the answer should be
> "soon".
Thank you. I was waiting for a long time for this patch.

Best Regards,
Siva Rebbagondla
>
> johannes
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-09 11:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18  8:35 [PATCH] mac80211: allow hardware scan to fall back to software Johannes Berg
2018-10-18 10:42 ` Arend van Spriel
2018-10-18 11:07   ` Johannes Berg
2018-10-18 11:51 ` Siva Rebbagondla
2018-11-09  6:18   ` Siva Rebbagondla
2018-11-09 11:19     ` Johannes Berg
2018-11-09 11:55       ` Siva Rebbagondla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.