Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] iwlagn: avoid sleep in softirq context
@ 2008-10-30 18:12 John W. Linville
  2008-10-30 20:41 ` reinette chatre
  2008-10-30 21:03 ` reinette chatre
  0 siblings, 2 replies; 5+ messages in thread
From: John W. Linville @ 2008-10-30 18:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: John W. Linville

__ieee80211_tasklet_handler -> __ieee80211_rx ->
	__ieee80211_rx_handle_packet -> ieee80211_invoke_rx_handlers ->
	ieee80211_rx_h_decrypt -> ieee80211_crypto_tkip_decrypt ->
	ieee80211_tkip_decrypt_data -> iwl4965_mac_update_tkip_key ->
	iwl_scan_cancel_timeout -> msleep

Ooops!

Avoid the sleep by changing iwl_scan_cancel_timeout with
iwl_scan_cancel and simply returning on failure if the scan persists.
This will cause hardware decryption to fail and we'll handle a few more
frames with software decryption.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 89450e3..12ffa04 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3247,7 +3247,11 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
 		return;
 	}
 
-	iwl_scan_cancel_timeout(priv, 100);
+	if (iwl_scan_cancel(priv)) {
+		/* cancel scan failed, just live w/ bad key and rely
+		   briefly on SW decrpyption */
+		return;
+	}
 
 	key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
 	key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
-- 
1.5.4.3


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

* Re: [PATCH] iwlagn: avoid sleep in softirq context
  2008-10-30 18:12 [PATCH] iwlagn: avoid sleep in softirq context John W. Linville
@ 2008-10-30 20:41 ` reinette chatre
  2008-10-31 17:58   ` John W. Linville
  2008-10-30 21:03 ` reinette chatre
  1 sibling, 1 reply; 5+ messages in thread
From: reinette chatre @ 2008-10-30 20:41 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless@vger.kernel.org

On Thu, 2008-10-30 at 11:12 -0700, John W. Linville wrote:
> __ieee80211_tasklet_handler -> __ieee80211_rx ->
> 	__ieee80211_rx_handle_packet -> ieee80211_invoke_rx_handlers ->
> 	ieee80211_rx_h_decrypt -> ieee80211_crypto_tkip_decrypt ->
> 	ieee80211_tkip_decrypt_data -> iwl4965_mac_update_tkip_key ->
> 	iwl_scan_cancel_timeout -> msleep
> 
> Ooops!
> 
> Avoid the sleep by changing iwl_scan_cancel_timeout with
> iwl_scan_cancel and simply returning on failure if the scan persists.
> This will cause hardware decryption to fail and we'll handle a few more
> frames with software decryption.
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>

Thank you very much

>  
> -	iwl_scan_cancel_timeout(priv, 100);
> +	if (iwl_scan_cancel(priv)) {
> +		/* cancel scan failed, just live w/ bad key and rely
> +		   briefly on SW decrpyption */

Could you please add some debugging (IWL_DEBUG_MAC80211 ) here to log
the problem? Also watch for the small typo. 

Reinette




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

* Re: [PATCH] iwlagn: avoid sleep in softirq context
  2008-10-30 18:12 [PATCH] iwlagn: avoid sleep in softirq context John W. Linville
  2008-10-30 20:41 ` reinette chatre
@ 2008-10-30 21:03 ` reinette chatre
  1 sibling, 0 replies; 5+ messages in thread
From: reinette chatre @ 2008-10-30 21:03 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless@vger.kernel.org

On Thu, 2008-10-30 at 11:12 -0700, John W. Linville wrote:
> __ieee80211_tasklet_handler -> __ieee80211_rx ->
> 	__ieee80211_rx_handle_packet -> ieee80211_invoke_rx_handlers ->
> 	ieee80211_rx_h_decrypt -> ieee80211_crypto_tkip_decrypt ->
> 	ieee80211_tkip_decrypt_data -> iwl4965_mac_update_tkip_key ->
> 	iwl_scan_cancel_timeout -> msleep
> 
> Ooops!
> 
> Avoid the sleep by changing iwl_scan_cancel_timeout with
> iwl_scan_cancel and simply returning on failure if the scan persists.
> This will cause hardware decryption to fail and we'll handle a few more
> frames with software decryption.
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-agn.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)

I forgot to mention that this patch will cause some trivial (name change) conflicts when merged together with one we submitted recently (http://marc.info/?l=linux-wireless&m=122531440910147&w=2 )

Reinette



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

* [PATCH] iwlagn: avoid sleep in softirq context
  2008-10-30 20:41 ` reinette chatre
@ 2008-10-31 17:58   ` John W. Linville
  2008-11-03 19:26     ` reinette chatre
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Linville @ 2008-10-31 17:58 UTC (permalink / raw)
  To: linux-wireless; +Cc: reinette chatre, John W. Linville

__ieee80211_tasklet_handler -> __ieee80211_rx ->
	__ieee80211_rx_handle_packet -> ieee80211_invoke_rx_handlers ->
	ieee80211_rx_h_decrypt -> ieee80211_crypto_tkip_decrypt ->
	ieee80211_tkip_decrypt_data -> iwl4965_mac_update_tkip_key ->
	iwl_scan_cancel_timeout -> msleep

Ooops!

Avoid the sleep by changing iwl_scan_cancel_timeout with
iwl_scan_cancel and simply returning on failure if the scan persists.
This will cause hardware decryption to fail and we'll handle a few more
frames with software decryption.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 89450e3..5cca7bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3247,7 +3247,12 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
 		return;
 	}
 
-	iwl_scan_cancel_timeout(priv, 100);
+	if (iwl_scan_cancel(priv)) {
+		/* cancel scan failed, just live w/ bad key and rely
+		   briefly on SW decrpyption */
+		IWL_DEBUG_MAC80211("leave - failed to cancel scan\n");
+		return;
+	}
 
 	key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
 	key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
-- 
1.5.4.3


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

* Re: [PATCH] iwlagn: avoid sleep in softirq context
  2008-10-31 17:58   ` John W. Linville
@ 2008-11-03 19:26     ` reinette chatre
  0 siblings, 0 replies; 5+ messages in thread
From: reinette chatre @ 2008-11-03 19:26 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless@vger.kernel.org

On Fri, 2008-10-31 at 10:58 -0700, John W. Linville wrote:
> __ieee80211_tasklet_handler -> __ieee80211_rx ->
> 	__ieee80211_rx_handle_packet -> ieee80211_invoke_rx_handlers ->
> 	ieee80211_rx_h_decrypt -> ieee80211_crypto_tkip_decrypt ->
> 	ieee80211_tkip_decrypt_data -> iwl4965_mac_update_tkip_key ->
> 	iwl_scan_cancel_timeout -> msleep
> 
> Ooops!
> 
> Avoid the sleep by changing iwl_scan_cancel_timeout with
> iwl_scan_cancel and simply returning on failure if the scan persists.
> This will cause hardware decryption to fail and we'll handle a few more
> frames with software decryption.
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-agn.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index 89450e3..5cca7bf 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -3247,7 +3247,12 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
>  		return;
>  	}
>  
> -	iwl_scan_cancel_timeout(priv, 100);
> +	if (iwl_scan_cancel(priv)) {
> +		/* cancel scan failed, just live w/ bad key and rely
> +		   briefly on SW decrpyption */
> +		IWL_DEBUG_MAC80211("leave - failed to cancel scan\n");
> +		return;
> +	}

Thanks for adding the debugging. The small typo is still there (in the
comments ... "decrpyption"). Could you please change it when you merge
this patch?

Acked-by: Reinette Chatre <reinette.chatre@intel.com>

Reinette



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

end of thread, other threads:[~2008-11-03 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-30 18:12 [PATCH] iwlagn: avoid sleep in softirq context John W. Linville
2008-10-30 20:41 ` reinette chatre
2008-10-31 17:58   ` John W. Linville
2008-11-03 19:26     ` reinette chatre
2008-10-30 21:03 ` reinette chatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox