netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
@ 2008-01-09 11:02 Joonwoo Park
       [not found] ` <11998765783953-git-send-email-joonwpark81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Joonwoo Park @ 2008-01-09 11:02 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

Eleminiate task queuing of iwl_pci_probe, register hw to ieee80211 immediately

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   66 +++++++++++++++++---------
 1 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index f95f226..7e8d8b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6171,27 +6171,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
 	if (iwl_is_rfkill(priv))
 		return;
 
-	if (!priv->mac80211_registered) {
-		/* Unlock so any user space entry points can call back into
-		 * the driver without a deadlock... */
-		mutex_unlock(&priv->mutex);
-		iwl_rate_control_register(priv->hw);
-		rc = ieee80211_register_hw(priv->hw);
-		priv->hw->conf.beacon_int = 100;
-		mutex_lock(&priv->mutex);
-
-		if (rc) {
-			iwl_rate_control_unregister(priv->hw);
-			IWL_ERROR("Failed to register network "
-				  "device (error %d)\n", rc);
-			return;
-		}
-
-		priv->mac80211_registered = 1;
+	iwl_reset_channel_flag(priv);
 
-		iwl_reset_channel_flag(priv);
-	} else
-		ieee80211_start_queues(priv->hw);
+	ieee80211_start_queues(priv->hw);
 
 	priv->active_rate = priv->rates_mask;
 	priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
@@ -6369,7 +6351,8 @@ static int __iwl_up(struct iwl_priv *priv)
 
 	/* clear (again), then enable host interrupts */
 	iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-	iwl_enable_interrupts(priv);
+	if (priv->mac80211_registered)
+		iwl_enable_interrupts(priv);
 
 	/* really make sure rfkill handshake bits are cleared */
 	iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
@@ -6887,10 +6870,21 @@ static void iwl_bg_scan_completed(struct work_struct *work)
 
 static int iwl_mac_start(struct ieee80211_hw *hw)
 {
+	int ret;
 	struct iwl_priv *priv = hw->priv;
 
 	IWL_DEBUG_MAC80211("enter\n");
 
+	ret = wait_event_interruptible_timeout(priv->wait_command_queue,
+			iwl_is_ready(priv), HOST_COMPLETE_TIMEOUT);
+
+	if (ret == -ERESTARTSYS)
+		return ret;
+	else if (ret == 0 && !iwl_is_ready(priv)) {
+		IWL_ERROR("IWL ready timeout\n");
+		return -ETIMEDOUT;
+	}
+
 	/* we should be verifying the device is ready to be opened */
 	mutex_lock(&priv->mutex);
 
@@ -8299,6 +8293,19 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
 	cancel_work_sync(&priv->beacon_update);
 }
 
+static int iwl_register_hw(struct iwl_priv *priv)
+{
+	int err;
+	IWL_DEBUG_INFO("register_hw\n");
+	iwl_rate_control_register(priv->hw);
+	err = ieee80211_register_hw(priv->hw);
+	if (!err) {
+		priv->hw->conf.beacon_int = 100;
+		priv->mac80211_registered = 1;
+	}
+	return err;
+}
+
 static struct attribute *iwl_sysfs_entries[] = {
 	&dev_attr_antenna.attr,
 	&dev_attr_channels.attr,
@@ -8546,11 +8553,24 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto out_pci_alloc;
 	}
 
+	err = __iwl_up(priv);
+	if (err) {
+		IWL_ERROR("Could not make up interface : %d\n", err);
+		mutex_unlock(&priv->mutex);
+		goto out_pci_alloc;
+	}
+
 	mutex_unlock(&priv->mutex);
 
-	IWL_DEBUG_INFO("Queing UP work.\n");
+	err = iwl_register_hw(priv);
+	if (err) {
+		iwl_rate_control_unregister(priv->hw);
+		IWL_ERROR("Failed to register network "
+			  "device (error %d)\n", err);
+		goto out_pci_alloc;
+	}
 
-	queue_work(priv->workqueue, &priv->up);
+	iwl_enable_interrupts(priv);
 
 	return 0;
 
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* Re: [ipw3945-devel] [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
       [not found] ` <11998765783953-git-send-email-joonwpark81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2008-01-11  1:06   ` Zhu Yi
       [not found]     ` <1200013607.3530.128.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Yi @ 2008-01-11  1:06 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, lkml,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi Joonwoo,

We already did something similiar in our code base. Could you please
take a look at this patch?

http://intellinuxwireless.org/repos/?p=iwlwifi.git;a=commitdiff;h=57aa02255e9d7be5e2494683fc2793bd1d0707e2

Thanks,
-yi
On Wed, 2008-01-09 at 20:02 +0900, Joonwoo Park wrote:
> Eleminiate task queuing of iwl_pci_probe, register hw to ieee80211 immediately
> 
> Signed-off-by: Joonwoo Park <joonwpark81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/net/wireless/iwlwifi/iwl3945-base.c |   66 +++++++++++++++++---------
>  1 files changed, 43 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
> index f95f226..7e8d8b3 100644
> --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
> +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
> @@ -6171,27 +6171,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
>  	if (iwl_is_rfkill(priv))
>  		return;
>  
> -	if (!priv->mac80211_registered) {
> -		/* Unlock so any user space entry points can call back into
> -		 * the driver without a deadlock... */
> -		mutex_unlock(&priv->mutex);
> -		iwl_rate_control_register(priv->hw);
> -		rc = ieee80211_register_hw(priv->hw);
> -		priv->hw->conf.beacon_int = 100;
> -		mutex_lock(&priv->mutex);
> -
> -		if (rc) {
> -			iwl_rate_control_unregister(priv->hw);
> -			IWL_ERROR("Failed to register network "
> -				  "device (error %d)\n", rc);
> -			return;
> -		}
> -
> -		priv->mac80211_registered = 1;
> +	iwl_reset_channel_flag(priv);
>  
> -		iwl_reset_channel_flag(priv);
> -	} else
> -		ieee80211_start_queues(priv->hw);
> +	ieee80211_start_queues(priv->hw);
>  
>  	priv->active_rate = priv->rates_mask;
>  	priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
> @@ -6369,7 +6351,8 @@ static int __iwl_up(struct iwl_priv *priv)
>  
>  	/* clear (again), then enable host interrupts */
>  	iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
> -	iwl_enable_interrupts(priv);
> +	if (priv->mac80211_registered)
> +		iwl_enable_interrupts(priv);
>  
>  	/* really make sure rfkill handshake bits are cleared */
>  	iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
> @@ -6887,10 +6870,21 @@ static void iwl_bg_scan_completed(struct work_struct *work)
>  
>  static int iwl_mac_start(struct ieee80211_hw *hw)
>  {
> +	int ret;
>  	struct iwl_priv *priv = hw->priv;
>  
>  	IWL_DEBUG_MAC80211("enter\n");
>  
> +	ret = wait_event_interruptible_timeout(priv->wait_command_queue,
> +			iwl_is_ready(priv), HOST_COMPLETE_TIMEOUT);
> +
> +	if (ret == -ERESTARTSYS)
> +		return ret;
> +	else if (ret == 0 && !iwl_is_ready(priv)) {
> +		IWL_ERROR("IWL ready timeout\n");
> +		return -ETIMEDOUT;
> +	}
> +
>  	/* we should be verifying the device is ready to be opened */
>  	mutex_lock(&priv->mutex);
>  
> @@ -8299,6 +8293,19 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
>  	cancel_work_sync(&priv->beacon_update);
>  }
>  
> +static int iwl_register_hw(struct iwl_priv *priv)
> +{
> +	int err;
> +	IWL_DEBUG_INFO("register_hw\n");
> +	iwl_rate_control_register(priv->hw);
> +	err = ieee80211_register_hw(priv->hw);
> +	if (!err) {
> +		priv->hw->conf.beacon_int = 100;
> +		priv->mac80211_registered = 1;
> +	}
> +	return err;
> +}
> +
>  static struct attribute *iwl_sysfs_entries[] = {
>  	&dev_attr_antenna.attr,
>  	&dev_attr_channels.attr,
> @@ -8546,11 +8553,24 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  		goto out_pci_alloc;
>  	}
>  
> +	err = __iwl_up(priv);
> +	if (err) {
> +		IWL_ERROR("Could not make up interface : %d\n", err);
> +		mutex_unlock(&priv->mutex);
> +		goto out_pci_alloc;
> +	}
> +
>  	mutex_unlock(&priv->mutex);
>  
> -	IWL_DEBUG_INFO("Queing UP work.\n");
> +	err = iwl_register_hw(priv);
> +	if (err) {
> +		iwl_rate_control_unregister(priv->hw);
> +		IWL_ERROR("Failed to register network "
> +			  "device (error %d)\n", err);
> +		goto out_pci_alloc;
> +	}
>  
> -	queue_work(priv->workqueue, &priv->up);
> +	iwl_enable_interrupts(priv);
>  
>  	return 0;
>  

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

* Re: [ipw3945-devel] [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
       [not found]     ` <1200013607.3530.128.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
@ 2008-01-11  1:38       ` Joonwoo Park
       [not found]         ` <b25c3fa70801101738j512a6189i3e4541bf0348b91f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Joonwoo Park @ 2008-01-11  1:38 UTC (permalink / raw)
  To: Zhu Yi
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, lkml,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

2008/1/11, Zhu Yi <yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>:
> Hi Joonwoo,
>
> We already did something similiar in our code base. Could you please
> take a look at this patch?
>
> http://intellinuxwireless.org/repos/?p=iwlwifi.git;a=commitdiff;h=57aa02255e9d7be5e2494683fc2793bd1d0707e2
>
> Thanks,
> -yi

Ooops :-)
I should have checked code base, it's my fault.
it's seems very similar, but I could not made build unfortunately.
Can you introduce to me how to build it please?

my build error is here:
jason@ehus ~/SRC/DRIVERS/iwlwifi $ KSRC=/home/jason/SRC/LINUX/linux-2.6 make
make -C /home/jason/SRC/LINUX/linux-2.6 O=
M=/home/jason/SRC/DRIVERS/iwlwifi/compatible/
EXTRA_CFLAGS="-DCONFIG_IWL3945_DEBUG=y -DCONFIG_IWL4965_DEBUG=y
-DCONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
-DCONFIG_IWL4965_SPECTRUM_MEASUREMENT=y -DCONFIG_IWL4965_SENSITIVITY=y
-DCONFIG_IWL3945_QOS=y -DCONFIG_IWL4965_QOS=y" modules
make[1]: Entering directory `/home/jason/SRC/LINUX/linux-2.6'
  CC [M]  /home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.o
In file included from
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:51:
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl-3945.h:443: error:
expected specifier-qualifier-list before 'ieee80211_key_alg'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c: In function
'iwl3945_add_station':
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:539: error:
implicit declaration of function 'MAC_ARG'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:539:
warning: too few arguments for format
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c: In function
'iwl3945_commit_rxon':
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:1161:
warning: too few arguments for format
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c: In function
'iwl3945_update_sta_key_info':
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:1400: error:
'struct iwl3945_hw_key' has no member named 'alg'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:1401: error:
'struct iwl3945_hw_key' has no member named 'keylen'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:1402: error:
'struct iwl3945_hw_key' has no member named 'key'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:1402: error:
'struct iwl3945_hw_key' has no member named 'key'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c: In function
'iwl3945_build_tx_cmd_hwcrypto':
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2594: error:
'struct iwl3945_hw_key' has no member named 'alg'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2597: error:
'struct iwl3945_hw_key' has no member named 'keylen'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2597: error:
'struct iwl3945_hw_key' has no member named 'key'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2597: error:
'struct iwl3945_hw_key' has no member named 'keylen'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2597: error:
'struct iwl3945_hw_key' has no member named 'key'
/home/jason/SRC/DRIVERS/iwlwifi/compatible/iwl3945-base.c:2597: error:
'struct iwl3945_hw_key' has no member named 'keylen'


Thanks,
Joonwoo

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

* Re: [ipw3945-devel] [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
       [not found]         ` <b25c3fa70801101738j512a6189i3e4541bf0348b91f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-01-11  2:01           ` Zhu Yi
       [not found]             ` <1200016915.3530.161.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Yi @ 2008-01-11  2:01 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, lkml,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


On Fri, 2008-01-11 at 10:38 +0900, Joonwoo Park wrote:
> I should have checked code base, it's my fault.
> it's seems very similar, but I could not made build unfortunately.
> Can you introduce to me how to build it please?
> 
> my build error is here:
> jason@ehus ~/SRC/DRIVERS/iwlwifi $
> KSRC=/home/jason/SRC/LINUX/linux-2.6 make

The version doesn't work on a .24-rc kernel. Can you compile it
with .23?

Thanks,
-yi

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

* Re: [ipw3945-devel] [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
       [not found]             ` <1200016915.3530.161.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
@ 2008-01-11  2:22               ` Joonwoo Park
  0 siblings, 0 replies; 5+ messages in thread
From: Joonwoo Park @ 2008-01-11  2:22 UTC (permalink / raw)
  To: Zhu Yi
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, lkml,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

2008/1/11, Zhu Yi <yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>:
>
> The version doesn't work on a .24-rc kernel. Can you compile it
> with .23?
>

Thank you for your help, I built it.

Thanks,
Joonwoo

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

end of thread, other threads:[~2008-01-11  2:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-09 11:02 [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context Joonwoo Park
     [not found] ` <11998765783953-git-send-email-joonwpark81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-01-11  1:06   ` [ipw3945-devel] " Zhu Yi
     [not found]     ` <1200013607.3530.128.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
2008-01-11  1:38       ` Joonwoo Park
     [not found]         ` <b25c3fa70801101738j512a6189i3e4541bf0348b91f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-01-11  2:01           ` Zhu Yi
     [not found]             ` <1200016915.3530.161.camel-F7Q/YMNgnyhhZnBKgDE8z0EOCMrvLtNR@public.gmane.org>
2008-01-11  2:22               ` Joonwoo Park

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