diff mbox series

[Xenial,SRU] UBUNTU: SAUCE: Redpine: resolve wifi scan stop issue in stress tests

Message ID 1521642759-3986-2-git-send-email-amitkarwar@gmail.com
State New
Headers show
Series [Xenial,SRU] UBUNTU: SAUCE: Redpine: resolve wifi scan stop issue in stress tests | expand

Commit Message

Amitkumar Karwar March 21, 2018, 2:32 p.m. UTC
From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435

We are disabling deep sleep before performing scan. In corner case,
it's observed that probe request is downloaded to firmware before
receiving deep sleep confirmation which leads to a scan stop issue

Race is resolved in this patch by waiting for the confirmation from
firmware

Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 ubuntu/rsi/rsi_91x_main.c | 1 +
 ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
 ubuntu/rsi/rsi_main.h     | 1 +
 3 files changed, 7 insertions(+)

Comments

Shrirang Bagul April 23, 2018, 5:36 a.m. UTC | #1
Hi Amit,

Looks like this patch slipped through the current SRU cycle, possibly because it was tagged with same message-ID as the firmware patch "[Xenial][PATCH] UBUNTU: linux-firmware: update firmware images
for Redpine 9113 chipset".
Unfortunately, it too late now for this cycle,  please resend this patch for SRU again, don't forget to add a 'RESEND' prefix to the subject. 

This will certainly delay the release of this feature to the customer.

To avoid such mishaps In future:
- Make sure patches for linux-firmware (firmware) package and linux (Xenial kernel) patches must have separate message-ID's, 
- Separate bugs must be filed against each of the packages, and
- Firmware patch must only include the BugLink to the bug in linux-firmware package; the same logic applies for the kernel SRU patch.

Thanks,
Shirang


On Wed, 2018-03-21 at 20:02 +0530, Amitkumar Karwar wrote:
> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435
> 
> We are disabling deep sleep before performing scan. In corner case,
> it's observed that probe request is downloaded to firmware before
> receiving deep sleep confirmation which leads to a scan stop issue
> 
> Race is resolved in this patch by waiting for the confirmation from
> firmware
> 
> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
> ---
>  ubuntu/rsi/rsi_91x_main.c | 1 +
>  ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
>  ubuntu/rsi/rsi_main.h     | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
> index 2350dbb61..49b98cd 100644
> --- a/ubuntu/rsi/rsi_91x_main.c
> +++ b/ubuntu/rsi/rsi_91x_main.c
> @@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
>  #ifdef CONFIG_HW_SCAN_OFFLOAD
>  	rsi_init_event(&common->chan_set_event);
>  	rsi_init_event(&common->probe_cfm_event);
> +	rsi_init_event(&common->mgmt_cfm_event);
>  	rsi_init_event(&common->chan_change_event);
>  	rsi_init_event(&common->cancel_hw_scan_event);
>  	common->scan_workqueue = 
> diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
> index 11b2046..58a9b69 100644
> --- a/ubuntu/rsi/rsi_91x_mgmt.c
> +++ b/ubuntu/rsi/rsi_91x_mgmt.c
> @@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
>  
>  	common->scan_in_prog = true;
>  	rsi_disable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  	
>  	for (ii =0; ii < scan_req->n_channels ; ii++) {
>  		if (common->iface_down)
> @@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
>  	del_timer(&common->scan_timer);
>  	common->scan_in_prog = false;
>  	rsi_enable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
>  	info.aborted = false;
>  	ieee80211_scan_completed(common->priv->hw, &info);
> @@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
>  
>  	case WAKEUP_SLEEP_REQUEST:
>  		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
> +		rsi_set_event(&common->mgmt_cfm_event);
>  		return rsi_handle_ps_confirm(adapter, msg);
>  
>  	case BG_SCAN_PROBE_REQ:
> diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
> index 2aad124..027e9d9 100644
> --- a/ubuntu/rsi/rsi_main.h
> +++ b/ubuntu/rsi/rsi_main.h
> @@ -376,6 +376,7 @@ struct rsi_common {
>  	struct work_struct scan_work;
>  	struct rsi_event chan_set_event;
>  	struct rsi_event probe_cfm_event;
> +	struct rsi_event mgmt_cfm_event;
>  	struct rsi_event chan_change_event;
>  	struct rsi_event cancel_hw_scan_event;
>  	struct timer_list scan_timer;
Siva Rebbagondla April 23, 2018, 5:48 a.m. UTC | #2
Hi Shrirang,

I will follow below instructions and send you the v2 patch.

Thank you
Siva Rebbagondla

On Monday 23 April 2018 11:06 AM, Shrirang Bagul wrote:
> Hi Amit,
>
> Looks like this patch slipped through the current SRU cycle, possibly because it was tagged with same message-ID as the firmware patch "[Xenial][PATCH] UBUNTU: linux-firmware: update firmware images
> for Redpine 9113 chipset".
> Unfortunately, it too late now for this cycle,  please resend this patch for SRU again, don't forget to add a 'RESEND' prefix to the subject. 
>
> This will certainly delay the release of this feature to the customer.
>
> To avoid such mishaps In future:
> - Make sure patches for linux-firmware (firmware) package and linux (Xenial kernel) patches must have separate message-ID's, 
> - Separate bugs must be filed against each of the packages, and
> - Firmware patch must only include the BugLink to the bug in linux-firmware package; the same logic applies for the kernel SRU patch.
>
> Thanks,
> Shirang
>
>
> On Wed, 2018-03-21 at 20:02 +0530, Amitkumar Karwar wrote:
>> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
>>
>> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435
>>
>> We are disabling deep sleep before performing scan. In corner case,
>> it's observed that probe request is downloaded to firmware before
>> receiving deep sleep confirmation which leads to a scan stop issue
>>
>> Race is resolved in this patch by waiting for the confirmation from
>> firmware
>>
>> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
>> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
>> ---
>>  ubuntu/rsi/rsi_91x_main.c | 1 +
>>  ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
>>  ubuntu/rsi/rsi_main.h     | 1 +
>>  3 files changed, 7 insertions(+)
>>
>> diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
>> index 2350dbb61..49b98cd 100644
>> --- a/ubuntu/rsi/rsi_91x_main.c
>> +++ b/ubuntu/rsi/rsi_91x_main.c
>> @@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
>>  #ifdef CONFIG_HW_SCAN_OFFLOAD
>>  	rsi_init_event(&common->chan_set_event);
>>  	rsi_init_event(&common->probe_cfm_event);
>> +	rsi_init_event(&common->mgmt_cfm_event);
>>  	rsi_init_event(&common->chan_change_event);
>>  	rsi_init_event(&common->cancel_hw_scan_event);
>>  	common->scan_workqueue = 
>> diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
>> index 11b2046..58a9b69 100644
>> --- a/ubuntu/rsi/rsi_91x_mgmt.c
>> +++ b/ubuntu/rsi/rsi_91x_mgmt.c
>> @@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
>>  
>>  	common->scan_in_prog = true;
>>  	rsi_disable_ps(common->priv);
>> +	rsi_reset_event(&common->mgmt_cfm_event);
>> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>>  	
>>  	for (ii =0; ii < scan_req->n_channels ; ii++) {
>>  		if (common->iface_down)
>> @@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
>>  	del_timer(&common->scan_timer);
>>  	common->scan_in_prog = false;
>>  	rsi_enable_ps(common->priv);
>> +	rsi_reset_event(&common->mgmt_cfm_event);
>> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>>  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
>>  	info.aborted = false;
>>  	ieee80211_scan_completed(common->priv->hw, &info);
>> @@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
>>  
>>  	case WAKEUP_SLEEP_REQUEST:
>>  		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
>> +		rsi_set_event(&common->mgmt_cfm_event);
>>  		return rsi_handle_ps_confirm(adapter, msg);
>>  
>>  	case BG_SCAN_PROBE_REQ:
>> diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
>> index 2aad124..027e9d9 100644
>> --- a/ubuntu/rsi/rsi_main.h
>> +++ b/ubuntu/rsi/rsi_main.h
>> @@ -376,6 +376,7 @@ struct rsi_common {
>>  	struct work_struct scan_work;
>>  	struct rsi_event chan_set_event;
>>  	struct rsi_event probe_cfm_event;
>> +	struct rsi_event mgmt_cfm_event;
>>  	struct rsi_event chan_change_event;
>>  	struct rsi_event cancel_hw_scan_event;
>>  	struct timer_list scan_timer;
<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><font size="-1">Hi Shrirang,</font></p>
    <p><font size="-1">I will follow below instructions and send you the
        v2 patch.</font></p>
    <pre class="moz-signature" cols="72">Thank you
Siva Rebbagondla</pre>
    <div class="moz-cite-prefix">On Monday 23 April 2018 11:06 AM,
      Shrirang Bagul wrote:<br>
    </div>
    <blockquote cite="mid:1524461789.28338.11.camel@canonical.com"
      type="cite">
      <pre wrap="">Hi Amit,

Looks like this patch slipped through the current SRU cycle, possibly because it was tagged with same message-ID as the firmware patch "[Xenial][PATCH] UBUNTU: linux-firmware: update firmware images
for Redpine 9113 chipset".
Unfortunately, it too late now for this cycle,  please resend this patch for SRU again, don't forget to add a 'RESEND' prefix to the subject. 

This will certainly delay the release of this feature to the customer.

To avoid such mishaps In future:
- Make sure patches for linux-firmware (firmware) package and linux (Xenial kernel) patches must have separate message-ID's, 
- Separate bugs must be filed against each of the packages, and
- Firmware patch must only include the BugLink to the bug in linux-firmware package; the same logic applies for the kernel SRU patch.

Thanks,
Shirang


On Wed, 2018-03-21 at 20:02 +0530, Amitkumar Karwar wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">From: Sanjay Kumar Konduri <a class="moz-txt-link-rfc2396E" href="mailto:sanjay.konduri@redpinesignals.com">&lt;sanjay.konduri@redpinesignals.com&gt;</a>

BugLink: <a class="moz-txt-link-freetext" href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435">https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435</a>

We are disabling deep sleep before performing scan. In corner case,
it's observed that probe request is downloaded to firmware before
receiving deep sleep confirmation which leads to a scan stop issue

Race is resolved in this patch by waiting for the confirmation from
firmware

Signed-off-by: Sanjay Kumar Konduri <a class="moz-txt-link-rfc2396E" href="mailto:sanjay.konduri@redpinesignals.com">&lt;sanjay.konduri@redpinesignals.com&gt;</a>
Signed-off-by: Amitkumar Karwar <a class="moz-txt-link-rfc2396E" href="mailto:amit.karwar@redpinesignals.com">&lt;amit.karwar@redpinesignals.com&gt;</a>
---
 ubuntu/rsi/rsi_91x_main.c | 1 +
 ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
 ubuntu/rsi/rsi_main.h     | 1 +
 3 files changed, 7 insertions(+)

diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
index 2350dbb61..49b98cd 100644
--- a/ubuntu/rsi/rsi_91x_main.c
+++ b/ubuntu/rsi/rsi_91x_main.c
@@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
 #ifdef CONFIG_HW_SCAN_OFFLOAD
 	rsi_init_event(&amp;common-&gt;chan_set_event);
 	rsi_init_event(&amp;common-&gt;probe_cfm_event);
+	rsi_init_event(&amp;common-&gt;mgmt_cfm_event);
 	rsi_init_event(&amp;common-&gt;chan_change_event);
 	rsi_init_event(&amp;common-&gt;cancel_hw_scan_event);
 	common-&gt;scan_workqueue = 
diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
index 11b2046..58a9b69 100644
--- a/ubuntu/rsi/rsi_91x_mgmt.c
+++ b/ubuntu/rsi/rsi_91x_mgmt.c
@@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
 
 	common-&gt;scan_in_prog = true;
 	rsi_disable_ps(common-&gt;priv);
+	rsi_reset_event(&amp;common-&gt;mgmt_cfm_event);
+	rsi_wait_event(&amp;common-&gt;mgmt_cfm_event, msecs_to_jiffies(2000));
 	
 	for (ii =0; ii &lt; scan_req-&gt;n_channels ; ii++) {
 		if (common-&gt;iface_down)
@@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
 	del_timer(&amp;common-&gt;scan_timer);
 	common-&gt;scan_in_prog = false;
 	rsi_enable_ps(common-&gt;priv);
+	rsi_reset_event(&amp;common-&gt;mgmt_cfm_event);
+	rsi_wait_event(&amp;common-&gt;mgmt_cfm_event, msecs_to_jiffies(2000));
 #if (LINUX_VERSION_CODE &gt;= KERNEL_VERSION(4, 9, 0))
 	info.aborted = false;
 	ieee80211_scan_completed(common-&gt;priv-&gt;hw, &amp;info);
@@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
 
 	case WAKEUP_SLEEP_REQUEST:
 		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
+		rsi_set_event(&amp;common-&gt;mgmt_cfm_event);
 		return rsi_handle_ps_confirm(adapter, msg);
 
 	case BG_SCAN_PROBE_REQ:
diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
index 2aad124..027e9d9 100644
--- a/ubuntu/rsi/rsi_main.h
+++ b/ubuntu/rsi/rsi_main.h
@@ -376,6 +376,7 @@ struct rsi_common {
 	struct work_struct scan_work;
 	struct rsi_event chan_set_event;
 	struct rsi_event probe_cfm_event;
+	struct rsi_event mgmt_cfm_event;
 	struct rsi_event chan_change_event;
 	struct rsi_event cancel_hw_scan_event;
 	struct timer_list scan_timer;</pre>
      </blockquote>
    </blockquote>
    <br>
  <BR />
<BR />
<br><BR />
</body>
</html>
Stefan Bader April 23, 2018, 12:11 p.m. UTC | #3
On 21.03.2018 15:32, Amitkumar Karwar wrote:
> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435
> 
> We are disabling deep sleep before performing scan. In corner case,
> it's observed that probe request is downloaded to firmware before
> receiving deep sleep confirmation which leads to a scan stop issue
> 
> Race is resolved in this patch by waiting for the confirmation from
> firmware
> 
> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>

> ---

I am acking the original patch here (should also count as valid if there is any
re-submission) to save a bit of time. Also like, Shrirang said, its better to
submit things for linux-firmware and the kernel either separately or try to make
it more obvious in the subject of the cover: like "[Xenial linux-kernel and
linux-firmware SRU] ...".
And also, if there is no response after a week, we won't bite when a reply to
the initial thread inquires about status.

-Stefan

>  ubuntu/rsi/rsi_91x_main.c | 1 +
>  ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
>  ubuntu/rsi/rsi_main.h     | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
> index 2350dbb61..49b98cd 100644
> --- a/ubuntu/rsi/rsi_91x_main.c
> +++ b/ubuntu/rsi/rsi_91x_main.c
> @@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
>  #ifdef CONFIG_HW_SCAN_OFFLOAD
>  	rsi_init_event(&common->chan_set_event);
>  	rsi_init_event(&common->probe_cfm_event);
> +	rsi_init_event(&common->mgmt_cfm_event);
>  	rsi_init_event(&common->chan_change_event);
>  	rsi_init_event(&common->cancel_hw_scan_event);
>  	common->scan_workqueue = 
> diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
> index 11b2046..58a9b69 100644
> --- a/ubuntu/rsi/rsi_91x_mgmt.c
> +++ b/ubuntu/rsi/rsi_91x_mgmt.c
> @@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
>  
>  	common->scan_in_prog = true;
>  	rsi_disable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  	
>  	for (ii =0; ii < scan_req->n_channels ; ii++) {
>  		if (common->iface_down)
> @@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
>  	del_timer(&common->scan_timer);
>  	common->scan_in_prog = false;
>  	rsi_enable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
>  	info.aborted = false;
>  	ieee80211_scan_completed(common->priv->hw, &info);
> @@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
>  
>  	case WAKEUP_SLEEP_REQUEST:
>  		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
> +		rsi_set_event(&common->mgmt_cfm_event);
>  		return rsi_handle_ps_confirm(adapter, msg);
>  
>  	case BG_SCAN_PROBE_REQ:
> diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
> index 2aad124..027e9d9 100644
> --- a/ubuntu/rsi/rsi_main.h
> +++ b/ubuntu/rsi/rsi_main.h
> @@ -376,6 +376,7 @@ struct rsi_common {
>  	struct work_struct scan_work;
>  	struct rsi_event chan_set_event;
>  	struct rsi_event probe_cfm_event;
> +	struct rsi_event mgmt_cfm_event;
>  	struct rsi_event chan_change_event;
>  	struct rsi_event cancel_hw_scan_event;
>  	struct timer_list scan_timer;
>
Kleber Sacilotto de Souza April 23, 2018, 12:16 p.m. UTC | #4
On 03/21/18 15:32, Amitkumar Karwar wrote:
> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435
> 
> We are disabling deep sleep before performing scan. In corner case,
> it's observed that probe request is downloaded to firmware before
> receiving deep sleep confirmation which leads to a scan stop issue
> 
> Race is resolved in this patch by waiting for the confirmation from
> firmware
> 
> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  ubuntu/rsi/rsi_91x_main.c | 1 +
>  ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
>  ubuntu/rsi/rsi_main.h     | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
> index 2350dbb61..49b98cd 100644
> --- a/ubuntu/rsi/rsi_91x_main.c
> +++ b/ubuntu/rsi/rsi_91x_main.c
> @@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
>  #ifdef CONFIG_HW_SCAN_OFFLOAD
>  	rsi_init_event(&common->chan_set_event);
>  	rsi_init_event(&common->probe_cfm_event);
> +	rsi_init_event(&common->mgmt_cfm_event);
>  	rsi_init_event(&common->chan_change_event);
>  	rsi_init_event(&common->cancel_hw_scan_event);
>  	common->scan_workqueue = 
> diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
> index 11b2046..58a9b69 100644
> --- a/ubuntu/rsi/rsi_91x_mgmt.c
> +++ b/ubuntu/rsi/rsi_91x_mgmt.c
> @@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
>  
>  	common->scan_in_prog = true;
>  	rsi_disable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  	
>  	for (ii =0; ii < scan_req->n_channels ; ii++) {
>  		if (common->iface_down)
> @@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
>  	del_timer(&common->scan_timer);
>  	common->scan_in_prog = false;
>  	rsi_enable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
>  	info.aborted = false;
>  	ieee80211_scan_completed(common->priv->hw, &info);
> @@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
>  
>  	case WAKEUP_SLEEP_REQUEST:
>  		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
> +		rsi_set_event(&common->mgmt_cfm_event);
>  		return rsi_handle_ps_confirm(adapter, msg);
>  
>  	case BG_SCAN_PROBE_REQ:
> diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
> index 2aad124..027e9d9 100644
> --- a/ubuntu/rsi/rsi_main.h
> +++ b/ubuntu/rsi/rsi_main.h
> @@ -376,6 +376,7 @@ struct rsi_common {
>  	struct work_struct scan_work;
>  	struct rsi_event chan_set_event;
>  	struct rsi_event probe_cfm_event;
> +	struct rsi_event mgmt_cfm_event;
>  	struct rsi_event chan_change_event;
>  	struct rsi_event cancel_hw_scan_event;
>  	struct timer_list scan_timer;
>
Stefan Bader April 23, 2018, 2:23 p.m. UTC | #5
On 21.03.2018 15:32, Amitkumar Karwar wrote:
> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1757435
> 
> We are disabling deep sleep before performing scan. In corner case,
> it's observed that probe request is downloaded to firmware before
> receiving deep sleep confirmation which leads to a scan stop issue
> 
> Race is resolved in this patch by waiting for the confirmation from
> firmware
> 
> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
> ---

Applied (with a grudge) for re-spin.

>  ubuntu/rsi/rsi_91x_main.c | 1 +
>  ubuntu/rsi/rsi_91x_mgmt.c | 5 +++++
>  ubuntu/rsi/rsi_main.h     | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
> index 2350dbb61..49b98cd 100644
> --- a/ubuntu/rsi/rsi_91x_main.c
> +++ b/ubuntu/rsi/rsi_91x_main.c
> @@ -382,6 +382,7 @@ struct rsi_hw *ven_rsi_91x_init(void)
>  #ifdef CONFIG_HW_SCAN_OFFLOAD
>  	rsi_init_event(&common->chan_set_event);
>  	rsi_init_event(&common->probe_cfm_event);
> +	rsi_init_event(&common->mgmt_cfm_event);
>  	rsi_init_event(&common->chan_change_event);
>  	rsi_init_event(&common->cancel_hw_scan_event);
>  	common->scan_workqueue = 
> diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
> index 11b2046..58a9b69 100644
> --- a/ubuntu/rsi/rsi_91x_mgmt.c
> +++ b/ubuntu/rsi/rsi_91x_mgmt.c
> @@ -2407,6 +2407,8 @@ void rsi_scan_start(struct work_struct *work)
>  
>  	common->scan_in_prog = true;
>  	rsi_disable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  	
>  	for (ii =0; ii < scan_req->n_channels ; ii++) {
>  		if (common->iface_down)
> @@ -2470,6 +2472,8 @@ void rsi_scan_start(struct work_struct *work)
>  	del_timer(&common->scan_timer);
>  	common->scan_in_prog = false;
>  	rsi_enable_ps(common->priv);
> +	rsi_reset_event(&common->mgmt_cfm_event);
> +	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
>  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
>  	info.aborted = false;
>  	ieee80211_scan_completed(common->priv->hw, &info);
> @@ -2693,6 +2697,7 @@ static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
>  
>  	case WAKEUP_SLEEP_REQUEST:
>  		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
> +		rsi_set_event(&common->mgmt_cfm_event);
>  		return rsi_handle_ps_confirm(adapter, msg);
>  
>  	case BG_SCAN_PROBE_REQ:
> diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
> index 2aad124..027e9d9 100644
> --- a/ubuntu/rsi/rsi_main.h
> +++ b/ubuntu/rsi/rsi_main.h
> @@ -376,6 +376,7 @@ struct rsi_common {
>  	struct work_struct scan_work;
>  	struct rsi_event chan_set_event;
>  	struct rsi_event probe_cfm_event;
> +	struct rsi_event mgmt_cfm_event;
>  	struct rsi_event chan_change_event;
>  	struct rsi_event cancel_hw_scan_event;
>  	struct timer_list scan_timer;
>
diff mbox series

Patch

diff --git a/ubuntu/rsi/rsi_91x_main.c b/ubuntu/rsi/rsi_91x_main.c
index 2350dbb61..49b98cd 100644
--- a/ubuntu/rsi/rsi_91x_main.c
+++ b/ubuntu/rsi/rsi_91x_main.c
@@ -382,6 +382,7 @@  struct rsi_hw *ven_rsi_91x_init(void)
 #ifdef CONFIG_HW_SCAN_OFFLOAD
 	rsi_init_event(&common->chan_set_event);
 	rsi_init_event(&common->probe_cfm_event);
+	rsi_init_event(&common->mgmt_cfm_event);
 	rsi_init_event(&common->chan_change_event);
 	rsi_init_event(&common->cancel_hw_scan_event);
 	common->scan_workqueue = 
diff --git a/ubuntu/rsi/rsi_91x_mgmt.c b/ubuntu/rsi/rsi_91x_mgmt.c
index 11b2046..58a9b69 100644
--- a/ubuntu/rsi/rsi_91x_mgmt.c
+++ b/ubuntu/rsi/rsi_91x_mgmt.c
@@ -2407,6 +2407,8 @@  void rsi_scan_start(struct work_struct *work)
 
 	common->scan_in_prog = true;
 	rsi_disable_ps(common->priv);
+	rsi_reset_event(&common->mgmt_cfm_event);
+	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
 	
 	for (ii =0; ii < scan_req->n_channels ; ii++) {
 		if (common->iface_down)
@@ -2470,6 +2472,8 @@  void rsi_scan_start(struct work_struct *work)
 	del_timer(&common->scan_timer);
 	common->scan_in_prog = false;
 	rsi_enable_ps(common->priv);
+	rsi_reset_event(&common->mgmt_cfm_event);
+	rsi_wait_event(&common->mgmt_cfm_event, msecs_to_jiffies(2000));
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
 	info.aborted = false;
 	ieee80211_scan_completed(common->priv->hw, &info);
@@ -2693,6 +2697,7 @@  static int rsi_handle_ta_confirm(struct rsi_common *common, u8 *msg)
 
 	case WAKEUP_SLEEP_REQUEST:
 		ven_rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
+		rsi_set_event(&common->mgmt_cfm_event);
 		return rsi_handle_ps_confirm(adapter, msg);
 
 	case BG_SCAN_PROBE_REQ:
diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
index 2aad124..027e9d9 100644
--- a/ubuntu/rsi/rsi_main.h
+++ b/ubuntu/rsi/rsi_main.h
@@ -376,6 +376,7 @@  struct rsi_common {
 	struct work_struct scan_work;
 	struct rsi_event chan_set_event;
 	struct rsi_event probe_cfm_event;
+	struct rsi_event mgmt_cfm_event;
 	struct rsi_event chan_change_event;
 	struct rsi_event cancel_hw_scan_event;
 	struct timer_list scan_timer;