* [PATCH] mac80211: Prevent starting of hw scan if it is already in progress
@ 2010-04-08 11:23 Teemu Paasikivi
2010-04-09 7:44 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Teemu Paasikivi @ 2010-04-08 11:23 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Teemu Paasikivi
Added checking of status of scanning to ieee80211_scan_work when hw
scanning is used. It is possible to scan_work get executed while scan
has already been started. Previously this has led to a state where, when
the driver returned EBUSY, the stack aborted scan while hw was left
scanning. That has caused warnings from ieee80211_scan_completed when
the scan actually has been completed.
Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
---
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/scan.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 741fb8b..1d14f7c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -756,6 +756,7 @@ struct ieee80211_local {
/* Scanning and BSS list */
struct mutex scan_mtx;
unsigned long scanning;
+ bool hw_scan_continue;
struct cfg80211_ssid scan_ssid;
struct cfg80211_scan_request *int_scan_req;
struct cfg80211_scan_request *scan_req, *hw_scan_req;
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 75a8597..4e4bad0 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -265,12 +265,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
if (was_hw_scan && !aborted && ieee80211_prep_hw_scan(local)) {
+ local->hw_scan_continue = true;
ieee80211_queue_delayed_work(&local->hw,
&local->scan_work, 0);
mutex_unlock(&local->scan_mtx);
return;
}
+ local->hw_scan_continue = false;
kfree(local->hw_scan_req);
local->hw_scan_req = NULL;
@@ -652,7 +654,11 @@ void ieee80211_scan_work(struct work_struct *work)
}
if (local->hw_scan_req) {
- int rc = drv_hw_scan(local, local->hw_scan_req);
+ int rc = 0;
+
+ if (!local->scanning || local->hw_scan_continue)
+ rc = drv_hw_scan(local, local->hw_scan_req);
+
mutex_unlock(&local->scan_mtx);
if (rc)
ieee80211_scan_completed(&local->hw, true);
--
1.5.6.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: Prevent starting of hw scan if it is already in progress
2010-04-08 11:23 [PATCH] mac80211: Prevent starting of hw scan if it is already in progress Teemu Paasikivi
@ 2010-04-09 7:44 ` Johannes Berg
2010-04-09 8:30 ` Luis R. Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2010-04-09 7:44 UTC (permalink / raw)
To: Teemu Paasikivi; +Cc: linville, linux-wireless, Luis R. Rodriguez
On Thu, 2010-04-08 at 14:23 +0300, Teemu Paasikivi wrote:
> Added checking of status of scanning to ieee80211_scan_work when hw
> scanning is used. It is possible to scan_work get executed while scan
> has already been started. Previously this has led to a state where, when
> the driver returned EBUSY, the stack aborted scan while hw was left
> scanning. That has caused warnings from ieee80211_scan_completed when
> the scan actually has been completed.
>
> Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
> ---
> net/mac80211/ieee80211_i.h | 1 +
> net/mac80211/scan.c | 8 +++++++-
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 741fb8b..1d14f7c 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -756,6 +756,7 @@ struct ieee80211_local {
> /* Scanning and BSS list */
> struct mutex scan_mtx;
> unsigned long scanning;
> + bool hw_scan_continue;
> struct cfg80211_ssid scan_ssid;
> struct cfg80211_scan_request *int_scan_req;
> struct cfg80211_scan_request *scan_req, *hw_scan_req;
> diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
> index 75a8597..4e4bad0 100644
> --- a/net/mac80211/scan.c
> +++ b/net/mac80211/scan.c
> @@ -265,12 +265,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
>
> was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
> if (was_hw_scan && !aborted && ieee80211_prep_hw_scan(local)) {
> + local->hw_scan_continue = true;
> ieee80211_queue_delayed_work(&local->hw,
> &local->scan_work, 0);
> mutex_unlock(&local->scan_mtx);
> return;
> }
>
> + local->hw_scan_continue = false;
> kfree(local->hw_scan_req);
> local->hw_scan_req = NULL;
>
> @@ -652,7 +654,11 @@ void ieee80211_scan_work(struct work_struct *work)
> }
>
> if (local->hw_scan_req) {
> - int rc = drv_hw_scan(local, local->hw_scan_req);
> + int rc = 0;
> +
> + if (!local->scanning || local->hw_scan_continue)
> + rc = drv_hw_scan(local, local->hw_scan_req);
> +
So Luis says he can make something similar happen with SW scan, where we
call drv_sw_scan_start twice?
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: Prevent starting of hw scan if it is already in progress
2010-04-09 7:44 ` Johannes Berg
@ 2010-04-09 8:30 ` Luis R. Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-04-09 8:30 UTC (permalink / raw)
To: Johannes Berg; +Cc: Teemu Paasikivi, linville, linux-wireless
On Fri, Apr 9, 2010 at 12:44 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2010-04-08 at 14:23 +0300, Teemu Paasikivi wrote:
>> Added checking of status of scanning to ieee80211_scan_work when hw
>> scanning is used. It is possible to scan_work get executed while scan
>> has already been started. Previously this has led to a state where, when
>> the driver returned EBUSY, the stack aborted scan while hw was left
>> scanning. That has caused warnings from ieee80211_scan_completed when
>> the scan actually has been completed.
>>
>> Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
>> ---
>> net/mac80211/ieee80211_i.h | 1 +
>> net/mac80211/scan.c | 8 +++++++-
>> 2 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
>> index 741fb8b..1d14f7c 100644
>> --- a/net/mac80211/ieee80211_i.h
>> +++ b/net/mac80211/ieee80211_i.h
>> @@ -756,6 +756,7 @@ struct ieee80211_local {
>> /* Scanning and BSS list */
>> struct mutex scan_mtx;
>> unsigned long scanning;
>> + bool hw_scan_continue;
>> struct cfg80211_ssid scan_ssid;
>> struct cfg80211_scan_request *int_scan_req;
>> struct cfg80211_scan_request *scan_req, *hw_scan_req;
>> diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
>> index 75a8597..4e4bad0 100644
>> --- a/net/mac80211/scan.c
>> +++ b/net/mac80211/scan.c
>> @@ -265,12 +265,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
>>
>> was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
>> if (was_hw_scan && !aborted && ieee80211_prep_hw_scan(local)) {
>> + local->hw_scan_continue = true;
>> ieee80211_queue_delayed_work(&local->hw,
>> &local->scan_work, 0);
>> mutex_unlock(&local->scan_mtx);
>> return;
>> }
>>
>> + local->hw_scan_continue = false;
>> kfree(local->hw_scan_req);
>> local->hw_scan_req = NULL;
>>
>> @@ -652,7 +654,11 @@ void ieee80211_scan_work(struct work_struct *work)
>> }
>>
>> if (local->hw_scan_req) {
>> - int rc = drv_hw_scan(local, local->hw_scan_req);
>> + int rc = 0;
>> +
>> + if (!local->scanning || local->hw_scan_continue)
>> + rc = drv_hw_scan(local, local->hw_scan_req);
>> +
>
> So Luis says he can make something similar happen with SW scan, where we
> call drv_sw_scan_start twice?
Right, see the mac80211_hswim patch, it is possible.
Luis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-09 8:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 11:23 [PATCH] mac80211: Prevent starting of hw scan if it is already in progress Teemu Paasikivi
2010-04-09 7:44 ` Johannes Berg
2010-04-09 8:30 ` Luis R. Rodriguez
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).