linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wcn36xx: Fix packet drop on resume
@ 2021-10-25  8:28 Loic Poulain
  2021-10-25  8:40 ` Bryan O'Donoghue
  2021-10-27  7:45 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Loic Poulain @ 2021-10-25  8:28 UTC (permalink / raw)
  To: kvalo; +Cc: wcn36xx, linux-wireless, bryan.odonoghue, Loic Poulain

If the system is resumed because of an incoming packet, the wcn36xx RX
interrupts is fired before actual resuming of the wireless/mac80211
stack, causing any received packets to be simply dropped. E.g. a ping
request causes a system resume, but is dropped and so never forwarded
to the IP stack.

This change fixes that, disabling DMA interrupts on suspend to no pass
packets until mac80211 is resumed and ready to handle them.

Note that it's not incompatible with RX irq wake.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index a42eae6..a650b9e 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1137,6 +1137,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
 			goto out;
 		ret = wcn36xx_smd_wlan_host_suspend_ind(wcn);
 	}
+
+	/* Disable IRQ, we don't want to handle any packet before mac80211 is
+	 * resumed and ready to receive packets.
+	 */
+	disable_irq(wcn->tx_irq);
+	disable_irq(wcn->rx_irq);
+
 out:
 	mutex_unlock(&wcn->conf_mutex);
 	return ret;
@@ -1159,6 +1166,10 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)
 		wcn36xx_smd_ipv6_ns_offload(wcn, vif, false);
 		wcn36xx_smd_arp_offload(wcn, vif, false);
 	}
+
+	enable_irq(wcn->tx_irq);
+	enable_irq(wcn->rx_irq);
+
 	mutex_unlock(&wcn->conf_mutex);
 
 	return 0;
-- 
2.7.4


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

* Re: [PATCH] wcn36xx: Fix packet drop on resume
  2021-10-25  8:28 [PATCH] wcn36xx: Fix packet drop on resume Loic Poulain
@ 2021-10-25  8:40 ` Bryan O'Donoghue
  2021-10-27  7:45 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2021-10-25  8:40 UTC (permalink / raw)
  To: Loic Poulain, kvalo; +Cc: wcn36xx, linux-wireless

On 25/10/2021 09:28, Loic Poulain wrote:
> If the system is resumed because of an incoming packet, the wcn36xx RX
> interrupts is fired before actual resuming of the wireless/mac80211
> stack, causing any received packets to be simply dropped. E.g. a ping
> request causes a system resume, but is dropped and so never forwarded
> to the IP stack.
> 
> This change fixes that, disabling DMA interrupts on suspend to no pass
> packets until mac80211 is resumed and ready to handle them.
> 
> Note that it's not incompatible with RX irq wake.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>   drivers/net/wireless/ath/wcn36xx/main.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index a42eae6..a650b9e 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1137,6 +1137,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
>   			goto out;
>   		ret = wcn36xx_smd_wlan_host_suspend_ind(wcn);
>   	}
> +
> +	/* Disable IRQ, we don't want to handle any packet before mac80211 is
> +	 * resumed and ready to receive packets.
> +	 */
> +	disable_irq(wcn->tx_irq);
> +	disable_irq(wcn->rx_irq);
> +
>   out:
>   	mutex_unlock(&wcn->conf_mutex);
>   	return ret;
> @@ -1159,6 +1166,10 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)
>   		wcn36xx_smd_ipv6_ns_offload(wcn, vif, false);
>   		wcn36xx_smd_arp_offload(wcn, vif, false);
>   	}
> +
> +	enable_irq(wcn->tx_irq);
> +	enable_irq(wcn->rx_irq);
> +
>   	mutex_unlock(&wcn->conf_mutex);
>   
>   	return 0;
> 

LGTM

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

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

* Re: [PATCH] wcn36xx: Fix packet drop on resume
  2021-10-25  8:28 [PATCH] wcn36xx: Fix packet drop on resume Loic Poulain
  2021-10-25  8:40 ` Bryan O'Donoghue
@ 2021-10-27  7:45 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-10-27  7:45 UTC (permalink / raw)
  To: Loic Poulain; +Cc: wcn36xx, linux-wireless, bryan.odonoghue, Loic Poulain

Loic Poulain <loic.poulain@linaro.org> wrote:

> If the system is resumed because of an incoming packet, the wcn36xx RX
> interrupts is fired before actual resuming of the wireless/mac80211
> stack, causing any received packets to be simply dropped. E.g. a ping
> request causes a system resume, but is dropped and so never forwarded
> to the IP stack.
> 
> This change fixes that, disabling DMA interrupts on suspend to no pass
> packets until mac80211 is resumed and ready to handle them.
> 
> Note that it's not incompatible with RX irq wake.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

df0697801d8a wcn36xx: Fix packet drop on resume

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1635150496-19290-1-git-send-email-loic.poulain@linaro.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-10-27  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  8:28 [PATCH] wcn36xx: Fix packet drop on resume Loic Poulain
2021-10-25  8:40 ` Bryan O'Donoghue
2021-10-27  7:45 ` Kalle Valo

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).