Linux wireless drivers development
 help / color / mirror / Atom feed
* Problems with "cfg80211: fix SME connect" commit
From: Albert Herranz @ 2009-09-20 18:03 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless

Hello,

Patch "cfg80211: fix SME connect" breaks my setup (WPA2/AES-CCMP between my b43 card and my AP).

When the patch is applied, the usual kernel messages "direct probe" and "authenticate" never happen, and IP address adquisition via dhcp fails:

[   12.709769] b43-phy0 debug: Chip initialized
[   12.725621] b43-phy0 debug: PIO initialized
[   12.733015] b43-phy0 debug: QoS disabled
[   12.913516] b43-phy0 debug: Wireless interface started
[   13.021170] b43-phy0 debug: Adding Interface type 2

When the patch is reverted everything works again:

[   13.222940] b43-phy0 debug: Chip initialized
[   13.291359] b43-phy0 debug: PIO initialized
[   13.330116] b43-phy0 debug: QoS disabled
[   13.861636] b43-phy0 debug: Wireless interface started
[   13.969153] b43-phy0 debug: Adding Interface type 2
[   16.679249] wlan1: direct probe to AP 00:12:17:15:e7:79 (try 1)
[   16.700998] wlan1 direct probe responded
[   16.707013] wlan1: authenticate with AP 00:12:17:15:e7:79 (try 1)
[   16.720205] wlan1: authenticated
[   16.726261] wlan1: associate with AP 00:12:17:15:e7:79 (try 1)
[   16.740697] wlan1: RX AssocResp from 00:12:17:15:e7:79 (capab=0x431 status=0 aid=1)
[   16.758042] wlan1: associated

Any clues?

Thanks,
Albert



      

^ permalink raw reply

* Re: [RFC] compat-2.6: mangle symbols for driver-select
From: Luis R. Rodriguez @ 2009-09-20 17:28 UTC (permalink / raw)
  To: tim.gardner; +Cc: linux-wireless, Greg KH, Johannes Berg
In-Reply-To: <4AB65CFE.7090101@canonical.com>

On Sun, Sep 20, 2009 at 9:49 AM, Tim Gardner <tim.gardner@canonical.com> wrote:
> Luis R. Rodriguez wrote:
>>
>> On Sat, Sep 19, 2009 at 8:46 PM, Tim Gardner <tim.gardner@canonical.com>
>> wrote:
>>>
>>> Luis R. Rodriguez wrote:
>>>>
>>>> Today at the summit we spoke about mangling symbols for driver-slect.
>>>> Here's a quick nasty take on this but without doing this for
>>>> driver-select
>>>> specifically just for testing. It seems to compile, but someone more
>>>> motivated
>>>> may want to test and make this apply somehow only for driver-select or
>>>> perhaps
>>>> when a -D define is used.
>>>>
>>>> Reason for this is to help distributions / OEMs / ODMs who want to
>>>> replace
>>>> just *one* driver with compat-wireless.
>>>>
>>> I think it would be better to generate the list of mangled symbols
>>> dynamically.
>>
>> Agreed, that is the part I left out, as a TODO to someone interested.
>>
>
> I'm working on a patch (it works with 2.6.31), but I need to test with older
> kernels.

:D

>>> In older Ubuntu releases (before depmod behavior was
>>> corrected), we have to run a 'munge' script to preface all of the
>>> exported
>>> symbols so that a compat-wireless driver references the compat-wireless
>>> protocol stack symbols. See the attached munge script for compat-wireless
>>> on
>>> 2.6.24.
>>
>> Please correct me if I'm wrong but I believe the script seems to do
>> what I did just that it actually edited the files with the changes, I
>> prefer the way I did this as it requires less work to maintain and
>> understand IMHO.
>>
>
> I'm fine with that, in fact its a bit faster since my munge script is a bit
> slow. It'll also make dealing with kernel version dependent symbol munge
> exceptions a bit simpler.

Great.

> One thing that is worth mentioning is that the module names need to be
> changed for older user space environments, otherwise depmod mucks things up
> in interesting ways.

Can you elaborate on this? Perhaps its best we talk this over at the
summit in person.

>>> We can either do something like this for compat-wireless, or we
>>> could use a subset of this logic to generate the list of symbols
>>> contained
>>> within the '#ifdef CONFIG_COMPAT_WIRELESS_MANGLE' clause.
>>
>> So I was under the impression you would use this only if you are using
>> ./scripts/driver-select to select one driver out of the whole tree,
>> but it seems you actually use this for all the drivers on
>> compat-wireless for the Ubuntu linux-backports-modules package. I take
>> it you put lbm stuff then into some /lib/modules/$(uname)/compat/ and
>> use a sort of /etc/depmod.d/01-compat.conf to prefer compat over
>> updates/ or kernel/ ?
>
> For LBM I've taken a scorched earth approach, i.e., _all_ drivers in
> compat-wireless get built. The vast bulk of users that I deal with are only
> interested in one driver, but I don't know a priori _which_ driver. The use
> case where they would want to use a mainline driver at the same time as a
> different compat-wireless driver is fairly rare (which my approach makes
> impossible).

OK I have a few other questions so I'll poke you at the summit.

  Luis

^ permalink raw reply

* Re: [RFC] compat-2.6: mangle symbols for driver-select
From: Tim Gardner @ 2009-09-20 16:49 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, Greg KH, Johannes Berg
In-Reply-To: <43e72e890909200743h74934657nc056c9e6dcb14e90@mail.gmail.com>

Luis R. Rodriguez wrote:
> On Sat, Sep 19, 2009 at 8:46 PM, Tim Gardner <tim.gardner@canonical.com> wrote:
>> Luis R. Rodriguez wrote:
>>> Today at the summit we spoke about mangling symbols for driver-slect.
>>> Here's a quick nasty take on this but without doing this for driver-select
>>> specifically just for testing. It seems to compile, but someone more
>>> motivated
>>> may want to test and make this apply somehow only for driver-select or
>>> perhaps
>>> when a -D define is used.
>>>
>>> Reason for this is to help distributions / OEMs / ODMs who want to replace
>>> just *one* driver with compat-wireless.
>>>
>> I think it would be better to generate the list of mangled symbols
>> dynamically.
> 
> Agreed, that is the part I left out, as a TODO to someone interested.
> 

I'm working on a patch (it works with 2.6.31), but I need to test with 
older kernels.

>> In older Ubuntu releases (before depmod behavior was
>> corrected), we have to run a 'munge' script to preface all of the exported
>> symbols so that a compat-wireless driver references the compat-wireless
>> protocol stack symbols. See the attached munge script for compat-wireless on
>> 2.6.24.
> 
> Please correct me if I'm wrong but I believe the script seems to do
> what I did just that it actually edited the files with the changes, I
> prefer the way I did this as it requires less work to maintain and
> understand IMHO.
> 

I'm fine with that, in fact its a bit faster since my munge script is a 
bit slow. It'll also make dealing with kernel version dependent symbol 
munge exceptions a bit simpler.

One thing that is worth mentioning is that the module names need to be 
changed for older user space environments, otherwise depmod mucks things 
up in interesting ways.

>> We can either do something like this for compat-wireless, or we
>> could use a subset of this logic to generate the list of symbols contained
>> within the '#ifdef CONFIG_COMPAT_WIRELESS_MANGLE' clause.
> 
> So I was under the impression you would use this only if you are using
> ./scripts/driver-select to select one driver out of the whole tree,
> but it seems you actually use this for all the drivers on
> compat-wireless for the Ubuntu linux-backports-modules package. I take
> it you put lbm stuff then into some /lib/modules/$(uname)/compat/ and
> use a sort of /etc/depmod.d/01-compat.conf to prefer compat over
> updates/ or kernel/ ?

For LBM I've taken a scorched earth approach, i.e., _all_ drivers in 
compat-wireless get built. The vast bulk of users that I deal with are 
only interested in one driver, but I don't know a priori _which_ driver. 
The use case where they would want to use a mainline driver at the same 
time as a different compat-wireless driver is fairly rare (which my 
approach makes impossible).

rtg
-- 
Tim Gardner tim.gardner@canonical.com

^ permalink raw reply

* FW: Question about carrier sensing
From: Jinsung Lee @ 2009-09-20 16:34 UTC (permalink / raw)
  To: linux-wireless

Dear all,

Actually, I realized that the CW value must be assigned in a power of 2,
minus 1, e.g., 1,3,7,...,1023.
So, CW=0 seems to be equal to CW=1 in the chipset. 
I tested with above cases and observed the same performance. Am I correct?
If so, the below phenomenon is resolved easily.
Please give your knowledge to me.
Thanks.


--
Regards,
Jinsung Lee
--


-----Original Message-----
From: linux-wireless-owner@vger.kernel.org
[mailto:linux-wireless-owner@vger.kernel.org] On Behalf Of Jinsung Lee
Sent: Sunday, September 20, 2009 1:43 PM
To: linux-wireless@vger.kernel.org
Subject: Question about carrier sensing

Hi, all.


I'm experimenting using MadWifi driver and Wistron CM6/CM9 cards, which all
use the Atheros chipset.
But, I found that there is some strange phenomenon on carrier sensing, which
doesn't follow the standard.
I let the two nearby transmitters just transmit the packets: one transmitter
has zero cw value and the other has positive cw values: 10, 100, 1000 where
cw is the maximum contention window size, thus the device selects the
backoff counter randomly from [0, cw].
If the carrier sensing really works, we would observe that the transmitter
with zero cw value takes all while the other don't at all, right?
Interestingly, the experimental result shows that the transmitter with
positive value has very infrequent but chances to transmit once in a while
during the whole experiment, and further the larger cw value, the much less
chance the transmitter has to transmit. So, it seems to work though.
Do you have any idea or similar experience?
Thanks.


--
Regards,
Jinsung Lee
--



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply

* Re: Continuous monitoring of wifi stats
From: Andrey Yurovsky @ 2009-09-20 15:48 UTC (permalink / raw)
  To: Dan Williams; +Cc: John Goyette, linux-wireless
In-Reply-To: <1253459430.11702.62.camel@localhost.localdomain>

On Sun, Sep 20, 2009 at 8:10 AM, Dan Williams <dcbw@redhat.com> wrote:
> On Wed, 2009-09-16 at 13:24 -0400, John Goyette wrote:
>> Hello all,
>>
>>
>>
>> I am looking for some advice on a Libertas related issue.  I am having a problem with a recent feature we added to our embedded system that continuously monitors wifi statistics, i.e., signal strength.  We are using a Blackfin platform with a Marvell 8686 device in the G-SPI configuration.  Our kernel is based on a 2.6.28.6 release.
>
> Any chance you can grab the driver from 2.6.31 and rebuild it for your
> kernel?  There are a few fixes from earlier this summer for GSPI and
> Power Saving mode from Andrey Yurovsky that may fix your issue.  I'm
> thinking specifically of b3781c74373489fa325ce64efdf72f6c8567b783 and a
> few of the other PS cleanups from July.

I believe that John has the bug fixes in question -- John, can you
summarize your setup (which compat-wireless snapshot, etc)?

>> The problem occurs after pressing Ctrl-C to terminate a user space program that is polling the wireless stats in a loop.  A number of libertas error messages appear indicating a failure to download command 0x0000.  I am pretty sure there is no command 0x0000, so I do not know how it got queued.  Here is a sample of the error messages from dmesg:
>>
>>
>>
>> libertas: command 0x0000 timed out
>> libertas: requeueing command 0x0000 due to timeout (#1)
>> libertas: if_spi_host_to_card: invalid size requested: 0
>> libertas: DNLD_CMD: hw_host_to_card failed: -22
>> libertas: command 0x0000 timed out
>> libertas: requeueing command 0x0000 due to timeout (0000002 <http://schicksw/mantis/view.php?id=2> )
>> libertas: if_spi_host_to_card: invalid size requested: 0
>> libertas: DNLD_CMD: hw_host_to_card failed: -22
>> libertas: command 0x0000 timed out
>> libertas: requeueing command 0x0000 due to timeout (0000003 <http://schicksw/mantis/view.php?id=3> )
>> libertas: if_spi_host_to_card: invalid size requested: 0
>> libertas: DNLD_CMD: hw_host_to_card failed: -22
>> libertas: command 0x0000 timed out
>> libertas: Excessive timeouts submitting command 0x0000
>>
>>
>>
>>
>>
>> This can be reproduced by enabling IEEE Power Savings mode and flooding the card with wireless stats requests by running something like the following from a terminal:
>>
>> while true; do iwconfig eth1;done
>>
>>
>>
>> Let this run for 30-60 secs, and then press Ctrl-C.  With IEEE power savings off, it may take several minutes, but does eventually give the same problem.  I have downloaded the compat-wireless-2.6.30 release and was able to cross-compile it for our kernel.  It helped a little in that it seemed to take longer before the error messaged occurred after pressing ctrl-c, but it did not completely resolve the problem.
>>
>>
>>
>> Has anyone seen something similar?  Are there any more recent patches that may address this issue?
>>
>>
>>
>> Thanks.
>>
>>
>>
>> -John Goyette
>>
>> Schick Technologies, Inc.
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: Continuous monitoring of wifi stats
From: Dan Williams @ 2009-09-20 15:10 UTC (permalink / raw)
  To: John Goyette; +Cc: linux-wireless
In-Reply-To: <C6BB22C4F02E0E4AB5B55BD3B1FEDBCD056C4ABD@schickmail.schicknt.com>

On Wed, 2009-09-16 at 13:24 -0400, John Goyette wrote:
> Hello all,
> 
>  
> 
> I am looking for some advice on a Libertas related issue.  I am having a problem with a recent feature we added to our embedded system that continuously monitors wifi statistics, i.e., signal strength.  We are using a Blackfin platform with a Marvell 8686 device in the G-SPI configuration.  Our kernel is based on a 2.6.28.6 release.  

Any chance you can grab the driver from 2.6.31 and rebuild it for your
kernel?  There are a few fixes from earlier this summer for GSPI and
Power Saving mode from Andrey Yurovsky that may fix your issue.  I'm
thinking specifically of b3781c74373489fa325ce64efdf72f6c8567b783 and a
few of the other PS cleanups from July.

Dan

>  
> 
> The problem occurs after pressing Ctrl-C to terminate a user space program that is polling the wireless stats in a loop.  A number of libertas error messages appear indicating a failure to download command 0x0000.  I am pretty sure there is no command 0x0000, so I do not know how it got queued.  Here is a sample of the error messages from dmesg:
> 
>  
> 
> libertas: command 0x0000 timed out
> libertas: requeueing command 0x0000 due to timeout (#1)
> libertas: if_spi_host_to_card: invalid size requested: 0
> libertas: DNLD_CMD: hw_host_to_card failed: -22
> libertas: command 0x0000 timed out
> libertas: requeueing command 0x0000 due to timeout (0000002 <http://schicksw/mantis/view.php?id=2> )
> libertas: if_spi_host_to_card: invalid size requested: 0
> libertas: DNLD_CMD: hw_host_to_card failed: -22
> libertas: command 0x0000 timed out
> libertas: requeueing command 0x0000 due to timeout (0000003 <http://schicksw/mantis/view.php?id=3> )
> libertas: if_spi_host_to_card: invalid size requested: 0
> libertas: DNLD_CMD: hw_host_to_card failed: -22
> libertas: command 0x0000 timed out
> libertas: Excessive timeouts submitting command 0x0000
> 
>  
> 
> 
> 
> This can be reproduced by enabling IEEE Power Savings mode and flooding the card with wireless stats requests by running something like the following from a terminal:
> 
> while true; do iwconfig eth1;done
> 
>  
> 
> Let this run for 30-60 secs, and then press Ctrl-C.  With IEEE power savings off, it may take several minutes, but does eventually give the same problem.  I have downloaded the compat-wireless-2.6.30 release and was able to cross-compile it for our kernel.  It helped a little in that it seemed to take longer before the error messaged occurred after pressing ctrl-c, but it did not completely resolve the problem.
> 
>  
> 
> Has anyone seen something similar?  Are there any more recent patches that may address this issue?
> 
>  
> 
> Thanks.
> 
>  
> 
> -John Goyette
> 
> Schick Technologies, Inc.
> 
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply

* Re: [PATCH] libertas: Add auto deep sleep support for SD8385/SD8686/SD8688
From: Dan Williams @ 2009-09-20 14:58 UTC (permalink / raw)
  To: Bing Zhao; +Cc: libertas-dev, linux-wireless, Amitkumar Karwar
In-Reply-To: <1253058359-1934-1-git-send-email-bzhao@marvell.com>

On Tue, 2009-09-15 at 16:45 -0700, Bing Zhao wrote:
> From: Amitkumar Karwar <akarwar@marvell.com>
> 
> Add timer based auto deep sleep feature in libertas driver which can be
> configured through debugfs interface. This is tested on SD8688, SD8686 cards
> with firmware versions 10.38.1.p25, 9.70.4.p0 respectively on 32-bit and 64-bit
> platforms. Tests have been done for USB/CS cards to make sure that the patch
> won't break USB/CS code. We didn't test the if_spi driver.

So there's always:

#define IW_POWER_SAVING		0x4000	/* Value is relative (how aggressive)*/

iwconfig wlan0 power saving 10

That seems quite a bit better than a new debugfs parameter, until we can
conver the driver over cfg80211 and do this properly.  If the power
saving mode is higher than some number X, the chip gets put into deep
sleep mode, or it can be automatically placed in deep sleep mode by the
driver when there is no association like you have done with the timer
above.  I think you should pick reasonable defaults, and perhaps if the
'saving' value is larger, the timer value in the driver gets smaller.

Does that sound like an OK approach?  We really should be using debugfs
only for debugging stuff (obviously), and the real fix for this sort of
thing is to switch over to cfg80211 where we can actually extend the
configuration API instead of hacking it into debugfs/WEXT/etc.

Dan

> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> Signed-off-by: Bing Zhao <bzhao@marvell.com>
> ---
>  drivers/net/wireless/libertas/README    |   28 +++++-
>  drivers/net/wireless/libertas/cmd.c     |   72 +++++++++++++-
>  drivers/net/wireless/libertas/cmdresp.c |   12 +++
>  drivers/net/wireless/libertas/debugfs.c |  160 +++++++++++++++++++++++++++++++
>  drivers/net/wireless/libertas/decl.h    |    4 +
>  drivers/net/wireless/libertas/dev.h     |   18 ++++
>  drivers/net/wireless/libertas/host.h    |    1 +
>  drivers/net/wireless/libertas/if_cs.c   |    3 +
>  drivers/net/wireless/libertas/if_sdio.c |   56 +++++++++++
>  drivers/net/wireless/libertas/if_sdio.h |    3 +-
>  drivers/net/wireless/libertas/if_spi.c  |    3 +
>  drivers/net/wireless/libertas/if_usb.c  |    3 +
>  drivers/net/wireless/libertas/main.c    |  111 +++++++++++++++++++---
>  drivers/net/wireless/libertas/scan.c    |   11 ++
>  drivers/net/wireless/libertas/wext.c    |  138 ++++++++++++++++++++++++++
>  15 files changed, 604 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README
> index ab6a2d5..059ce8c 100644
> --- a/drivers/net/wireless/libertas/README
> +++ b/drivers/net/wireless/libertas/README
> @@ -1,5 +1,5 @@
>  ================================================================================
> -			README for USB8388
> +			README for Libertas
>  
>   (c) Copyright © 2003-2006, Marvell International Ltd.
>   All Rights Reserved
> @@ -226,4 +226,30 @@ setuserscan
>      All entries in the scan table (not just the new scan data when keep=1)
>      will be displayed upon completion by use of the getscantable ioctl.
>  
> +deepsleep
> +
> +	This command is used to configure the station in deep sleep mode/auto
> +	deep sleep mode. Command expects two parameters:
> +	'state'	'idle time period'
> +
> +	The timer is implemented to monitor the activities (command, event,
> +        data, etc.). When an activity is detected station will exit from deep
> +        sleep mode automatically and restart the timer. At timer expiry (no
> +        activity for defined time period) the deepsleep mode is entered
> +        automatically.
> +
> +	Note: this command is for SDIO interface only.
> +
> +	Path: /sys/kernel/debug/libertas_wireless/ethX/
> +
> +	Usage:
> +	To read the current status of deep sleep do:
> +		cat deepsleep
> +	To enable deep sleep mode do:
> +		echo '1 0' > deepsleep
> +	To enable auto deep sleep mode with idle time period 5 seconds do:
> +		echo '1 5000' > deepsleep
> +	To disable deep sleep/auto deep sleep mode do:
> +		echo '0 0' > deepsleep
> +
>  ==============================================================================
> diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
> index 6850981..3a3e894 100644
> --- a/drivers/net/wireless/libertas/cmd.c
> +++ b/drivers/net/wireless/libertas/cmd.c
> @@ -17,7 +17,6 @@
>  
>  static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv);
>  
> -
>  /**
>   *  @brief Simple callback that copies response back into command
>   *
> @@ -319,6 +318,60 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action,
>  	return 0;
>  }
>  
> +static int lbs_wait_for_ds_awake(struct lbs_private *priv)
> +{
> +	int ret = 0;
> +
> +	lbs_deb_enter(LBS_DEB_CMD);
> +
> +	if (priv->is_deep_sleep) {
> +		if (!wait_event_interruptible_timeout(priv->ds_awake_q,
> +					!priv->is_deep_sleep, (10 * HZ))) {
> +			lbs_pr_err("ds_awake_q: timer expired\n");
> +			ret = -1;
> +		}
> +	}
> +
> +	lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
> +	return ret;
> +}
> +
> +int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
> +{
> +	int ret =  0;
> +
> +	lbs_deb_enter(LBS_DEB_CMD);
> +
> +	if (deep_sleep) {
> +		if (priv->is_deep_sleep != 1) {
> +			lbs_deb_cmd("deep sleep: sleep\n");
> +			BUG_ON(!priv->enter_deep_sleep);
> +			ret = priv->enter_deep_sleep(priv);
> +			if (!ret) {
> +				netif_stop_queue(priv->dev);
> +				netif_carrier_off(priv->dev);
> +			}
> +		} else {
> +			lbs_pr_err("deep sleep: already enabled\n");
> +		}
> +	} else {
> +		if (priv->is_deep_sleep) {
> +			lbs_deb_cmd("deep sleep: wakeup\n");
> +			BUG_ON(!priv->exit_deep_sleep);
> +			ret = priv->exit_deep_sleep(priv);
> +			if (!ret) {
> +				ret = lbs_wait_for_ds_awake(priv);
> +				if (ret)
> +					lbs_pr_err("deep sleep: wakeup"
> +							"failed\n");
> +			}
> +		}
> +	}
> +
> +	lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
> +	return ret;
> +}
> +
>  int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
>  			   struct assoc_request *assoc)
>  {
> @@ -1242,8 +1295,17 @@ static void lbs_submit_command(struct lbs_private *priv,
>  		timeo = HZ/4;
>  	}
>  
> -	/* Setup the timer after transmit command */
> -	mod_timer(&priv->command_timer, jiffies + timeo);
> +	if (command == CMD_802_11_DEEP_SLEEP) {
> +		if (priv->is_auto_deep_sleep_enabled) {
> +			priv->wakeup_dev_required = 1;
> +			priv->dnld_sent = 0;
> +		}
> +		priv->is_deep_sleep = 1;
> +		lbs_complete_command(priv, cmdnode, 0);
> +	} else {
> +		/* Setup the timer after transmit command */
> +		mod_timer(&priv->command_timer, jiffies + timeo);
> +	}
>  
>  	lbs_deb_leave(LBS_DEB_HOST);
>  }
> @@ -1505,6 +1567,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
>  	case CMD_802_11_BEACON_CTRL:
>  		ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action);
>  		break;
> +	case CMD_802_11_DEEP_SLEEP:
> +		cmdptr->command = cpu_to_le16(CMD_802_11_DEEP_SLEEP);
> +		cmdptr->size = cpu_to_le16(S_DS_GEN);
> +		break;
>  	default:
>  		lbs_pr_err("PREP_CMD: unknown command 0x%04x\n", cmd_no);
>  		ret = -1;
> diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
> index c42d3fa..47d2b19 100644
> --- a/drivers/net/wireless/libertas/cmdresp.c
> +++ b/drivers/net/wireless/libertas/cmdresp.c
> @@ -504,9 +504,21 @@ int lbs_process_event(struct lbs_private *priv, u32 event)
>  
>  	case MACREG_INT_CODE_HOST_AWAKE:
>  		lbs_deb_cmd("EVENT: host awake\n");
> +		if (priv->reset_deep_sleep_wakeup)
> +			priv->reset_deep_sleep_wakeup(priv);
> +		priv->is_deep_sleep = 0;
>  		lbs_send_confirmwake(priv);
>  		break;
>  
> +	case MACREG_INT_CODE_DEEP_SLEEP_AWAKE:
> +		if (priv->reset_deep_sleep_wakeup)
> +			priv->reset_deep_sleep_wakeup(priv);
> +		lbs_deb_cmd("EVENT: ds awake\n");
> +		priv->is_deep_sleep = 0;
> +		priv->wakeup_dev_required = 0;
> +		wake_up_interruptible(&priv->ds_awake_q);
> +		break;
> +
>  	case MACREG_INT_CODE_PS_AWAKE:
>  		lbs_deb_cmd("EVENT: ps awake\n");
>  		/* handle unexpected PS AWAKE event */
> diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
> index 893a55c..624a438 100644
> --- a/drivers/net/wireless/libertas/debugfs.c
> +++ b/drivers/net/wireless/libertas/debugfs.c
> @@ -117,6 +117,11 @@ static ssize_t lbs_sleepparams_write(struct file *file,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out_unlock;
> +	}
> +
>  	buf_size = min(count, len - 1);
>  	if (copy_from_user(buf, user_buf, buf_size)) {
>  		ret = -EFAULT;
> @@ -157,6 +162,11 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out_unlock;
> +	}
> +
>  	ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp);
>  	if (ret)
>  		goto out_unlock;
> @@ -173,6 +183,118 @@ out_unlock:
>  	return ret;
>  }
>  
> +static ssize_t lbs_deepsleep_read(struct file *file, char __user *userbuf,
> +				  size_t count, loff_t *ppos)
> +{
> +	struct lbs_private *priv = file->private_data;
> +	ssize_t pos = 0;
> +	int ret;
> +	unsigned long addr = get_zeroed_page(GFP_KERNEL);
> +	char *buf = (char *)addr;
> +
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	if (!priv->enter_deep_sleep) {
> +		lbs_pr_err("deep sleep feature is not implemented "
> +				"for this interface driver\n");
> +		ret = -EINVAL;
> +		goto out_ds;
> +	}
> +
> +	if (priv->is_auto_deep_sleep_enabled)
> +		pos += snprintf(buf, len, "%d %d\n",
> +				priv->is_auto_deep_sleep_enabled,
> +				priv->auto_deep_sleep_timeout);
> +	else if (priv->is_deep_sleep)
> +		pos += snprintf(buf, len, "%d %d\n",
> +				priv->is_deep_sleep,
> +				priv->auto_deep_sleep_timeout);
> +	else
> +		pos += snprintf(buf, len, "%d %d\n",
> +				priv->is_deep_sleep,
> +				priv->auto_deep_sleep_timeout);
> +
> +	ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
> +
> +out_ds:
> +	free_page(addr);
> +	return ret;
> +}
> +
> +static ssize_t lbs_deepsleep_write(struct file *file,
> +				    const char __user *userbuf,
> +				    size_t count, loff_t *ppos)
> +{
> +	struct lbs_private *priv = file->private_data;
> +	ssize_t res, buf_size;
> +	int is_deep_sleep, auto_deep_sleep_timeout;
> +	unsigned long addr = get_zeroed_page(GFP_KERNEL);
> +	char *buf = (char *)addr;
> +
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	if (!priv->enter_deep_sleep) {
> +		lbs_pr_err("deep sleep feature is not implemented "
> +				"for this interface driver\n");
> +		res = -EINVAL;
> +		goto out_ds;
> +	}
> +
> +	if (priv->connect_status == LBS_CONNECTED) {
> +		lbs_pr_err("can't use deep sleep cmd in connected "
> +				"state\n");
> +		res = -EINVAL;
> +		goto out_ds;
> +	}
> +
> +	buf_size = min(count, len - 1);
> +	if (copy_from_user(buf, userbuf, buf_size)) {
> +		res = -EFAULT;
> +		goto out_ds;
> +	}
> +
> +	res = sscanf(buf, "%d %d", &is_deep_sleep, &auto_deep_sleep_timeout);
> +	if ((res != 2) || (!is_deep_sleep && auto_deep_sleep_timeout) ||
> +					!((is_deep_sleep == 1) ||
> +					(is_deep_sleep == 0))) {
> +		lbs_pr_err("unknown option\n");
> +		res = -EINVAL;
> +		goto out_ds;
> +	}
> +
> +	if (auto_deep_sleep_timeout) {
> +		if (!priv->is_auto_deep_sleep_enabled) {
> +			priv->is_activity_detected = 0;
> +			priv->auto_deep_sleep_timeout = auto_deep_sleep_timeout;
> +			lbs_enter_auto_deep_sleep(priv);
> +		} else {
> +			priv->auto_deep_sleep_timeout = auto_deep_sleep_timeout;
> +			lbs_deb_debugfs("auto deep sleep: already enabled\n");
> +		}
> +	} else {
> +		if (priv->is_auto_deep_sleep_enabled) {
> +			lbs_exit_auto_deep_sleep(priv);
> +			/* Try to exit deep sleep if auto deep sleep disabled */
> +			res = lbs_set_deep_sleep(priv, 0);
> +			if (res)
> +				goto out_ds;
> +		}
> +		if ((is_deep_sleep == 0) || (is_deep_sleep == 1)) {
> +			res = lbs_set_deep_sleep(priv, is_deep_sleep);
> +			if (res)
> +				goto out_ds;
> +		}
> +	}
> +
> +	res = count;
> +
> +out_ds:
> +	free_page(addr);
> +	return res;
> +}
> +
>  /*
>   * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might
>   * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the
> @@ -223,6 +345,9 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask,
>  	u8 freq;
>  	int events = 0;
>  
> +	if (!lbs_is_cmd_allowed(priv))
> +		return -EBUSY;
> +
>  	buf = (char *)get_zeroed_page(GFP_KERNEL);
>  	if (!buf)
>  		return -ENOMEM;
> @@ -275,6 +400,9 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
>  	char *buf;
>  	int ret;
>  
> +	if (!lbs_is_cmd_allowed(priv))
> +		return -EBUSY;
> +
>  	buf = (char *)get_zeroed_page(GFP_KERNEL);
>  	if (!buf)
>  		return -ENOMEM;
> @@ -444,6 +572,11 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		free_page(addr);
> +		return -EBUSY;
> +	}
> +
>  	offval.offset = priv->mac_offset;
>  	offval.value = 0;
>  
> @@ -496,6 +629,11 @@ static ssize_t lbs_wrmac_write(struct file *file,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		res = -EBUSY;
> +		goto out_unlock;
> +	}
> +
>  	buf_size = min(count, len - 1);
>  	if (copy_from_user(buf, userbuf, buf_size)) {
>  		res = -EFAULT;
> @@ -532,6 +670,11 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		free_page(addr);
> +		return -EBUSY;
> +	}
> +
>  	offval.offset = priv->bbp_offset;
>  	offval.value = 0;
>  
> @@ -585,6 +728,11 @@ static ssize_t lbs_wrbbp_write(struct file *file,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		res = -EBUSY;
> +		goto out_unlock;
> +	}
> +
>  	buf_size = min(count, len - 1);
>  	if (copy_from_user(buf, userbuf, buf_size)) {
>  		res = -EFAULT;
> @@ -621,6 +769,11 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		free_page(addr);
> +		return -EBUSY;
> +	}
> +
>  	offval.offset = priv->rf_offset;
>  	offval.value = 0;
>  
> @@ -674,6 +827,11 @@ static ssize_t lbs_wrrf_write(struct file *file,
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		res = -EBUSY;
> +		goto out_unlock;
> +	}
> +
>  	buf_size = min(count, len - 1);
>  	if (copy_from_user(buf, userbuf, buf_size)) {
>  		res = -EFAULT;
> @@ -717,6 +875,8 @@ static const struct lbs_debugfs_files debugfs_files[] = {
>  					write_file_dummy), },
>  	{ "sleepparams", 0644, FOPS(lbs_sleepparams_read,
>  				lbs_sleepparams_write), },
> +	{ "deepsleep", 0644, FOPS(lbs_deepsleep_read,
> +				lbs_deepsleep_write), },
>  };
>  
>  static const struct lbs_debugfs_files debugfs_events_files[] = {
> diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
> index 0b84bdc..34b475f 100644
> --- a/drivers/net/wireless/libertas/decl.h
> +++ b/drivers/net/wireless/libertas/decl.h
> @@ -33,6 +33,10 @@ int lbs_execute_next_command(struct lbs_private *priv);
>  int lbs_process_event(struct lbs_private *priv, u32 event);
>  void lbs_queue_event(struct lbs_private *priv, u32 event);
>  void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx);
> +int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep);
> +int lbs_is_cmd_allowed(struct lbs_private *priv);
> +int lbs_enter_auto_deep_sleep(struct lbs_private *priv);
> +int lbs_exit_auto_deep_sleep(struct lbs_private *priv);
>  
>  u32 lbs_fw_index_to_data_rate(u8 index);
>  u8 lbs_data_rate_to_fw_index(u32 rate);
> diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
> index 578c697..e2b4ef2 100644
> --- a/drivers/net/wireless/libertas/dev.h
> +++ b/drivers/net/wireless/libertas/dev.h
> @@ -129,6 +129,20 @@ struct lbs_private {
>  	u32 bbp_offset;
>  	u32 rf_offset;
>  
> +	/** Deep sleep flag */
> +	int is_deep_sleep;
> +	/** Auto deep sleep enabled flag */
> +	int is_auto_deep_sleep_enabled;
> +	/** Device wakeup required flag */
> +	int wakeup_dev_required;
> +	/** Auto deep sleep flag*/
> +	int is_activity_detected;
> +	/** Auto deep sleep timeout (in miliseconds) */
> +	int auto_deep_sleep_timeout;
> +
> +	/** Deep sleep wait queue */
> +	wait_queue_head_t       ds_awake_q;
> +
>  	/* Download sent:
>  	   bit0 1/0=data_sent/data_tx_done,
>  	   bit1 1/0=cmd_sent/cmd_tx_done,
> @@ -154,6 +168,9 @@ struct lbs_private {
>  	/** Hardware access */
>  	int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
>  	void (*reset_card) (struct lbs_private *priv);
> +	int (*enter_deep_sleep) (struct lbs_private *priv);
> +	int (*exit_deep_sleep) (struct lbs_private *priv);
> +	int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
>  
>  	/* Wake On LAN */
>  	uint32_t wol_criteria;
> @@ -204,6 +221,7 @@ struct lbs_private {
>  
>  	/** Timers */
>  	struct timer_list command_timer;
> +	struct timer_list auto_deepsleep_timer;
>  	int nr_retries;
>  	int cmd_timed_out;
>  
> diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
> index fe8f0cb..c055daa 100644
> --- a/drivers/net/wireless/libertas/host.h
> +++ b/drivers/net/wireless/libertas/host.h
> @@ -57,6 +57,7 @@
>  #define CMD_802_11_ENABLE_RSN			0x002f
>  #define CMD_802_11_SET_AFC			0x003c
>  #define CMD_802_11_GET_AFC			0x003d
> +#define CMD_802_11_DEEP_SLEEP                  0x003e
>  #define CMD_802_11_AD_HOC_STOP			0x0040
>  #define CMD_802_11_HOST_SLEEP_CFG		0x0043
>  #define CMD_802_11_WAKEUP_CONFIRM		0x0044
> diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
> index 6238176..465742f 100644
> --- a/drivers/net/wireless/libertas/if_cs.c
> +++ b/drivers/net/wireless/libertas/if_cs.c
> @@ -946,6 +946,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
>  	card->priv = priv;
>  	priv->card = card;
>  	priv->hw_host_to_card = if_cs_host_to_card;
> +	priv->enter_deep_sleep = NULL;
> +	priv->exit_deep_sleep = NULL;
> +	priv->reset_deep_sleep_wakeup = NULL;
>  	priv->fw_ready = 1;
>  
>  	/* Now actually get the IRQ */
> diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
> index 485a8d4..9716728 100644
> --- a/drivers/net/wireless/libertas/if_sdio.c
> +++ b/drivers/net/wireless/libertas/if_sdio.c
> @@ -831,6 +831,58 @@ out:
>  	return ret;
>  }
>  
> +static int if_sdio_enter_deep_sleep(struct lbs_private *priv)
> +{
> +	int ret = -1;
> +	struct cmd_header cmd;
> +
> +	memset(&cmd, 0, sizeof(cmd));
> +
> +	lbs_deb_sdio("send DEEP_SLEEP command\n");
> +	ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd),
> +			lbs_cmd_copyback, (unsigned long) &cmd);
> +	if (ret)
> +		lbs_pr_err("DEEP_SLEEP cmd failed\n");
> +
> +	mdelay(200);
> +	return ret;
> +}
> +
> +static int if_sdio_exit_deep_sleep(struct lbs_private *priv)
> +{
> +	struct if_sdio_card *card = priv->card;
> +	int ret = -1;
> +
> +	lbs_deb_enter(LBS_DEB_SDIO);
> +	sdio_claim_host(card->func);
> +
> +	sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret);
> +	if (ret)
> +		lbs_pr_err("sdio_writeb failed!\n");
> +
> +	sdio_release_host(card->func);
> +	lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
> +	return ret;
> +}
> +
> +static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv)
> +{
> +	struct if_sdio_card *card = priv->card;
> +	int ret = -1;
> +
> +	lbs_deb_enter(LBS_DEB_SDIO);
> +	sdio_claim_host(card->func);
> +
> +	sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret);
> +	if (ret)
> +		lbs_pr_err("sdio_writeb failed!\n");
> +
> +	sdio_release_host(card->func);
> +	lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
> +	return ret;
> +
> +}
> +
>  /*******************************************************************/
>  /* SDIO callbacks                                                  */
>  /*******************************************************************/
> @@ -859,6 +911,7 @@ static void if_sdio_interrupt(struct sdio_func *func)
>  	 * Ignore the define name, this really means the card has
>  	 * successfully received the command.
>  	 */
> +	card->priv->is_activity_detected = 1;
>  	if (cause & IF_SDIO_H_INT_DNLD)
>  		lbs_host_to_card_done(card->priv);
>  
> @@ -998,6 +1051,9 @@ static int if_sdio_probe(struct sdio_func *func,
>  
>  	priv->card = card;
>  	priv->hw_host_to_card = if_sdio_host_to_card;
> +	priv->enter_deep_sleep = if_sdio_enter_deep_sleep;
> +	priv->exit_deep_sleep = if_sdio_exit_deep_sleep;
> +	priv->reset_deep_sleep_wakeup = if_sdio_reset_deep_sleep_wakeup;
>  
>  	priv->fw_ready = 1;
>  
> diff --git a/drivers/net/wireless/libertas/if_sdio.h b/drivers/net/wireless/libertas/if_sdio.h
> index 60c9b2f..12179c1 100644
> --- a/drivers/net/wireless/libertas/if_sdio.h
> +++ b/drivers/net/wireless/libertas/if_sdio.h
> @@ -51,5 +51,6 @@
>  #define IF_SDIO_EVENT           0x80fc
>  
>  #define IF_SDIO_BLOCK_SIZE	256
> -
> +#define CONFIGURATION_REG               0x03
> +#define HOST_POWER_UP                   (0x1U << 1)
>  #endif
> diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
> index 446e327..e2fa657 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -1117,6 +1117,9 @@ static int __devinit if_spi_probe(struct spi_device *spi)
>  	card->priv = priv;
>  	priv->card = card;
>  	priv->hw_host_to_card = if_spi_host_to_card;
> +	priv->enter_deep_sleep = NULL;
> +	priv->exit_deep_sleep = NULL;
> +	priv->reset_deep_sleep_wakeup = NULL;
>  	priv->fw_ready = 1;
>  
>  	/* Initialize interrupt handling stuff. */
> diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
> index 92bc8c5..a8262de 100644
> --- a/drivers/net/wireless/libertas/if_usb.c
> +++ b/drivers/net/wireless/libertas/if_usb.c
> @@ -300,6 +300,9 @@ static int if_usb_probe(struct usb_interface *intf,
>  	cardp->priv->fw_ready = 1;
>  
>  	priv->hw_host_to_card = if_usb_host_to_card;
> +	priv->enter_deep_sleep = NULL;
> +	priv->exit_deep_sleep = NULL;
> +	priv->reset_deep_sleep_wakeup = NULL;
>  #ifdef CONFIG_OLPC
>  	if (machine_is_olpc())
>  		priv->reset_card = if_usb_reset_olpc_card;
> diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
> index 8df1cfd..3b14fcc 100644
> --- a/drivers/net/wireless/libertas/main.c
> +++ b/drivers/net/wireless/libertas/main.c
> @@ -574,8 +574,10 @@ void lbs_host_to_card_done(struct lbs_private *priv)
>  	priv->dnld_sent = DNLD_RES_RECEIVED;
>  
>  	/* Wake main thread if commands are pending */
> -	if (!priv->cur_cmd || priv->tx_pending_len > 0)
> -		wake_up_interruptible(&priv->waitq);
> +	if (!priv->cur_cmd || priv->tx_pending_len > 0) {
> +		if (!priv->wakeup_dev_required)
> +			wake_up_interruptible(&priv->waitq);
> +	}
>  
>  	spin_unlock_irqrestore(&priv->driver_lock, flags);
>  	lbs_deb_leave(LBS_DEB_THREAD);
> @@ -770,7 +772,8 @@ static int lbs_thread(void *data)
>  			shouldsleep = 0;	/* We have a command response */
>  		else if (priv->cur_cmd)
>  			shouldsleep = 1;	/* Can't send a command; one already running */
> -		else if (!list_empty(&priv->cmdpendingq))
> +		else if (!list_empty(&priv->cmdpendingq) &&
> +					!(priv->wakeup_dev_required))
>  			shouldsleep = 0;	/* We have a command to send */
>  		else if (__kfifo_len(priv->event_fifo))
>  			shouldsleep = 0;	/* We have an event to process */
> @@ -822,6 +825,26 @@ static int lbs_thread(void *data)
>  		}
>  		spin_unlock_irq(&priv->driver_lock);
>  
> +		/* Process hardware events, e.g. card removed, link lost */
> +		spin_lock_irq(&priv->driver_lock);
> +		while (__kfifo_len(priv->event_fifo)) {
> +			u32 event;
> +			__kfifo_get(priv->event_fifo, (unsigned char *) &event,
> +				sizeof(event));
> +			spin_unlock_irq(&priv->driver_lock);
> +			lbs_process_event(priv, event);
> +			spin_lock_irq(&priv->driver_lock);
> +		}
> +		spin_unlock_irq(&priv->driver_lock);
> +
> +		if (priv->wakeup_dev_required) {
> +			lbs_deb_thread("Waking up device...\n");
> +			/* Wake up device */
> +			if (priv->exit_deep_sleep(priv))
> +				lbs_deb_thread("Wakeup device failed\n");
> +			continue;
> +		}
> +
>  		/* command timeout stuff */
>  		if (priv->cmd_timed_out && priv->cur_cmd) {
>  			struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
> @@ -849,18 +872,7 @@ static int lbs_thread(void *data)
>  		}
>  		priv->cmd_timed_out = 0;
>  
> -		/* Process hardware events, e.g. card removed, link lost */
> -		spin_lock_irq(&priv->driver_lock);
> -		while (__kfifo_len(priv->event_fifo)) {
> -			u32 event;
>  
> -			__kfifo_get(priv->event_fifo, (unsigned char *) &event,
> -				sizeof(event));
> -			spin_unlock_irq(&priv->driver_lock);
> -			lbs_process_event(priv, event);
> -			spin_lock_irq(&priv->driver_lock);
> -		}
> -		spin_unlock_irq(&priv->driver_lock);
>  
>  		if (!priv->fw_ready)
>  			continue;
> @@ -894,6 +906,9 @@ static int lbs_thread(void *data)
>  		    (priv->psstate == PS_STATE_PRE_SLEEP))
>  			continue;
>  
> +		if (priv->is_deep_sleep)
> +			continue;
> +
>  		/* Execute the next command */
>  		if (!priv->dnld_sent && !priv->cur_cmd)
>  			lbs_execute_next_command(priv);
> @@ -928,6 +943,7 @@ static int lbs_thread(void *data)
>  	}
>  
>  	del_timer(&priv->command_timer);
> +	del_timer(&priv->auto_deepsleep_timer);
>  	wake_up_all(&priv->cmd_pending);
>  
>  	lbs_deb_leave(LBS_DEB_THREAD);
> @@ -1050,6 +1066,60 @@ out:
>  	lbs_deb_leave(LBS_DEB_CMD);
>  }
>  
> +/**
> + *  This function put the device back to deep sleep mode when timer expires
> + *  and no activity (command, event, data etc.) is detected.
> + */
> +static void auto_deepsleep_timer_fn(unsigned long data)
> +{
> +	struct lbs_private *priv = (struct lbs_private *)data;
> +	int ret;
> +
> +	lbs_deb_enter(LBS_DEB_CMD);
> +
> +	if (priv->is_activity_detected) {
> +		priv->is_activity_detected = 0;
> +	} else {
> +		if (priv->is_auto_deep_sleep_enabled &&
> +				(!priv->wakeup_dev_required) &&
> +				(priv->connect_status != LBS_CONNECTED)) {
> +			lbs_deb_main("Entering auto deep sleep mode...\n");
> +			ret = lbs_prepare_and_send_command(priv,
> +					CMD_802_11_DEEP_SLEEP, 0,
> +					0, 0, NULL);
> +		}
> +	}
> +	mod_timer(&priv->auto_deepsleep_timer , jiffies +
> +				(priv->auto_deep_sleep_timeout * HZ)/1000);
> +	lbs_deb_leave(LBS_DEB_CMD);
> +}
> +
> +int lbs_enter_auto_deep_sleep(struct lbs_private *priv)
> +{
> +	lbs_deb_enter(LBS_DEB_SDIO);
> +
> +	priv->is_auto_deep_sleep_enabled = 1;
> +	if (priv->is_deep_sleep)
> +		priv->wakeup_dev_required = 1;
> +	mod_timer(&priv->auto_deepsleep_timer ,
> +			jiffies + (priv->auto_deep_sleep_timeout * HZ)/1000);
> +
> +	lbs_deb_leave(LBS_DEB_SDIO);
> +	return 0;
> +}
> +
> +int lbs_exit_auto_deep_sleep(struct lbs_private *priv)
> +{
> +	lbs_deb_enter(LBS_DEB_SDIO);
> +
> +	priv->is_auto_deep_sleep_enabled = 0;
> +	priv->auto_deep_sleep_timeout = 0;
> +	del_timer(&priv->auto_deepsleep_timer);
> +
> +	lbs_deb_leave(LBS_DEB_SDIO);
> +	return 0;
> +}
> +
>  static void lbs_sync_channel_worker(struct work_struct *work)
>  {
>  	struct lbs_private *priv = container_of(work, struct lbs_private,
> @@ -1099,11 +1169,17 @@ static int lbs_init_adapter(struct lbs_private *priv)
>  	priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
>  	priv->psmode = LBS802_11POWERMODECAM;
>  	priv->psstate = PS_STATE_FULL_POWER;
> +	priv->is_deep_sleep = 0;
> +	priv->is_auto_deep_sleep_enabled = 0;
> +	priv->wakeup_dev_required = 0;
> +	init_waitqueue_head(&priv->ds_awake_q);
>  
>  	mutex_init(&priv->lock);
>  
>  	setup_timer(&priv->command_timer, command_timer_fn,
>  		(unsigned long)priv);
> +	setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn,
> +			(unsigned long)priv);
>  
>  	INIT_LIST_HEAD(&priv->cmdfreeq);
>  	INIT_LIST_HEAD(&priv->cmdpendingq);
> @@ -1142,6 +1218,7 @@ static void lbs_free_adapter(struct lbs_private *priv)
>  	if (priv->event_fifo)
>  		kfifo_free(priv->event_fifo);
>  	del_timer(&priv->command_timer);
> +	del_timer(&priv->auto_deepsleep_timer);
>  	kfree(priv->networks);
>  	priv->networks = NULL;
>  
> @@ -1272,6 +1349,11 @@ void lbs_remove_card(struct lbs_private *priv)
>  	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
>  	wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
>  
> +	if (priv->is_deep_sleep) {
> +		priv->is_deep_sleep = 0;
> +		wake_up_interruptible(&priv->ds_awake_q);
> +	}
> +
>  	/* Stop the thread servicing the interrupts */
>  	priv->surpriseremoved = 1;
>  	kthread_stop(priv->main_thread);
> @@ -1392,6 +1474,7 @@ void lbs_stop_card(struct lbs_private *priv)
>  
>  	/* Delete the timeout of the currently processing command */
>  	del_timer_sync(&priv->command_timer);
> +	del_timer_sync(&priv->auto_deepsleep_timer);
>  
>  	/* Flush pending command nodes */
>  	spin_lock_irqsave(&priv->driver_lock, flags);
> diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
> index 6c95af3..e468e15 100644
> --- a/drivers/net/wireless/libertas/scan.c
> +++ b/drivers/net/wireless/libertas/scan.c
> @@ -950,6 +950,11 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	if (!priv->radio_on) {
>  		ret = -EINVAL;
>  		goto out;
> @@ -1017,6 +1022,12 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		err = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err);
> +		return err;
> +	}
> +
>  	/* iwlist should wait until the current scan is finished */
>  	if (priv->scan_channel)
>  		return -EAGAIN;
> diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
> index be837a0..ef2b986 100644
> --- a/drivers/net/wireless/libertas/wext.c
> +++ b/drivers/net/wireless/libertas/wext.c
> @@ -45,6 +45,31 @@ static inline void lbs_cancel_association_work(struct lbs_private *priv)
>  	priv->pending_assoc_req = NULL;
>  }
>  
> +/**
> + *  @brief This function checks if the command is allowed.
> + *
> + *  @param priv         A pointer to lbs_private structure
> + *  @return             allowed or not allowed.
> + */
> +
> +int lbs_is_cmd_allowed(struct lbs_private *priv)
> +{
> +	int         ret = 1;
> +
> +	lbs_deb_enter(LBS_DEB_WEXT);
> +
> +	if (!priv->is_auto_deep_sleep_enabled) {
> +		if (priv->is_deep_sleep) {
> +			lbs_deb_wext("IOCTLS called when station"
> +					"is in deep sleep\n");
> +			ret = 0;
> +		}
> +	}
> +
> +	lbs_deb_leave(LBS_DEB_WEXT);
> +	return ret;
> +}
> +
>  
>  /**
>   *  @brief Find the channel frequency power info with specific channel
> @@ -168,6 +193,11 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		lbs_deb_leave(LBS_DEB_WEXT);
> +		return -EBUSY;
> +	}
> +
>  	cfp = lbs_find_cfp_by_band_and_channel(priv, 0,
>  					   priv->curbssparams.channel);
>  
> @@ -278,6 +308,12 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	if (vwrq->disabled)
>  		val = MRVDRV_RTS_MAX_VALUE;
>  
> @@ -299,6 +335,11 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val);
>  	if (ret)
>  		goto out;
> @@ -321,6 +362,12 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	if (vwrq->disabled)
>  		val = MRVDRV_FRAG_MAX_VALUE;
>  
> @@ -342,6 +389,11 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val);
>  	if (ret)
>  		goto out;
> @@ -391,6 +443,11 @@ static int lbs_get_txpow(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	if (!priv->radio_on) {
>  		lbs_deb_wext("tx power off\n");
>  		vwrq->value = 0;
> @@ -424,6 +481,11 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>          if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
>                  return -EOPNOTSUPP;
>  
> @@ -472,6 +534,11 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	vwrq->disabled = 0;
>  
>  	if (vwrq->flags & IW_RETRY_LONG) {
> @@ -712,6 +779,11 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		lbs_deb_leave(LBS_DEB_WEXT);
> +		return -EBUSY;
> +	}
> +
>  	if (!(priv->fwcapinfo & FW_CAPINFO_PS)) {
>  		if (vwrq->disabled)
>  			return 0;
> @@ -792,6 +864,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv))
> +		return NULL;
> +
>  	priv->wstats.status = priv->mode;
>  
>  	/* If we're not associated, all quality values are meaningless */
> @@ -892,6 +967,12 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	mutex_lock(&priv->lock);
>  	assoc_req = lbs_get_association_request(priv);
>  	if (!assoc_req) {
> @@ -1000,6 +1081,12 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
>  	u8 rates[MAX_RATES + 1];
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
> +
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	lbs_deb_wext("vwrq->value %d\n", vwrq->value);
>  	lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed);
>  
> @@ -1058,6 +1145,11 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		lbs_deb_leave(LBS_DEB_WEXT);
> +		return -EBUSY;
> +	}
> +
>  	if (priv->connect_status == LBS_CONNECTED) {
>  		vwrq->value = priv->cur_rate * 500000;
>  
> @@ -1084,6 +1176,11 @@ static int lbs_set_mode(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	if (   (*uwrq != IW_MODE_ADHOC)
>  	    && (*uwrq != IW_MODE_INFRA)
>  	    && (*uwrq != IW_MODE_AUTO)) {
> @@ -1325,6 +1422,12 @@ static int lbs_set_encode(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	mutex_lock(&priv->lock);
>  	assoc_req = lbs_get_association_request(priv);
>  	if (!assoc_req) {
> @@ -1508,6 +1611,12 @@ static int lbs_set_encodeext(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	mutex_lock(&priv->lock);
>  	assoc_req = lbs_get_association_request(priv);
>  	if (!assoc_req) {
> @@ -1720,6 +1829,12 @@ static int lbs_set_auth(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	mutex_lock(&priv->lock);
>  	assoc_req = lbs_get_association_request(priv);
>  	if (!assoc_req) {
> @@ -1822,6 +1937,12 @@ static int lbs_get_auth(struct net_device *dev,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	switch (dwrq->flags & IW_AUTH_INDEX) {
>  	case IW_AUTH_KEY_MGMT:
>  		dwrq->value = priv->secinfo.key_mgmt;
> @@ -1864,6 +1985,11 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
>  	if (vwrq->disabled) {
>  		lbs_set_radio(priv, RADIO_PREAMBLE_AUTO, 0);
>  		goto out;
> @@ -1983,6 +2109,12 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	if (!priv->radio_on) {
>  		ret = -EINVAL;
>  		goto out;
> @@ -2110,6 +2242,12 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
>  
>  	lbs_deb_enter(LBS_DEB_WEXT);
>  
> +	if (!lbs_is_cmd_allowed(priv)) {
> +		ret = -EBUSY;
> +		lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
> +		return ret;
> +	}
> +
>  	if (!priv->radio_on)
>  		return -EINVAL;
>  


^ permalink raw reply

* Re: [RFC] compat-2.6: mangle symbols for driver-select
From: Luis R. Rodriguez @ 2009-09-20 14:43 UTC (permalink / raw)
  To: tim.gardner; +Cc: linux-wireless, Greg KH, Johannes Berg
In-Reply-To: <4AB5A5A7.3020107@canonical.com>

On Sat, Sep 19, 2009 at 8:46 PM, Tim Gardner <tim.gardner@canonical.com> wrote:
> Luis R. Rodriguez wrote:
>>
>> Today at the summit we spoke about mangling symbols for driver-slect.
>> Here's a quick nasty take on this but without doing this for driver-select
>> specifically just for testing. It seems to compile, but someone more
>> motivated
>> may want to test and make this apply somehow only for driver-select or
>> perhaps
>> when a -D define is used.
>>
>> Reason for this is to help distributions / OEMs / ODMs who want to replace
>> just *one* driver with compat-wireless.
>>
>
> I think it would be better to generate the list of mangled symbols
> dynamically.

Agreed, that is the part I left out, as a TODO to someone interested.

> In older Ubuntu releases (before depmod behavior was
> corrected), we have to run a 'munge' script to preface all of the exported
> symbols so that a compat-wireless driver references the compat-wireless
> protocol stack symbols. See the attached munge script for compat-wireless on
> 2.6.24.

Please correct me if I'm wrong but I believe the script seems to do
what I did just that it actually edited the files with the changes, I
prefer the way I did this as it requires less work to maintain and
understand IMHO.

> We can either do something like this for compat-wireless, or we
> could use a subset of this logic to generate the list of symbols contained
> within the '#ifdef CONFIG_COMPAT_WIRELESS_MANGLE' clause.

So I was under the impression you would use this only if you are using
./scripts/driver-select to select one driver out of the whole tree,
but it seems you actually use this for all the drivers on
compat-wireless for the Ubuntu linux-backports-modules package. I take
it you put lbm stuff then into some /lib/modules/$(uname)/compat/ and
use a sort of /etc/depmod.d/01-compat.conf to prefer compat over
updates/ or kernel/ ?

  Luis

^ permalink raw reply

* Re: [RFC][PATCH] b43: Comment unused functions lpphy_restore_dig_flt_state and lpphy_disable_rx_gain_override
From: Gábor Stefanik @ 2009-09-20  9:28 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: John W. Linville, Michael Buesch, Stefano Brivio, linux-wireless
In-Reply-To: <1253434164.19515.5.camel@ht.satnam>

These will be needed for calibration. (My calibration RFC already
makes use of them.)

On Sun, Sep 20, 2009 at 10:09 AM, Jaswinder Singh Rajput
<jaswinder@kernel.org> wrote:
>
> Commenting unused functions lpphy_restore_dig_flt_state and
> lpphy_disable_rx_gain_override, may be we need these functions in future.
>
> This also fixed following compilation warnings :
>  CC [M]  drivers/net/wireless/b43/phy_lp.o
> drivers/net/wireless/b43/phy_lp.c:383: warning: ‘lpphy_restore_dig_flt_state’ defined but not used
> drivers/net/wireless/b43/phy_lp.c:891: warning: ‘lpphy_disable_rx_gain_override’ defined but not used
>
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
>  drivers/net/wireless/b43/phy_lp.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
> index 3e02d96..9c31462 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -379,6 +379,8 @@ static void lpphy_save_dig_flt_state(struct b43_wldev *dev)
>        }
>  }
>
> +/* lpphy_restore_dig_flt_state is unused but kept as a reference */
> +#if 0
>  static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
>  {
>        static const u16 addr[] = {
> @@ -399,6 +401,7 @@ static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
>        for (i = 0; i < ARRAY_SIZE(addr); i++)
>                b43_phy_write(dev, addr[i], lpphy->dig_flt_state[i]);
>  }
> +#endif
>
>  static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
>  {
> @@ -887,6 +890,8 @@ static void lpphy_rev2plus_set_rx_gain(struct b43_wldev *dev, u32 gain)
>        }
>  }
>
> +/* lpphy_disable_rx_gain_override is unused but kept as a reference */
> +#if 0
>  static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
>  {
>        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE);
> @@ -902,6 +907,7 @@ static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
>                b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFDFF);
>        }
>  }
> +#endif
>
>  static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
>  {
> --
> 1.6.4.4
>
>
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

^ permalink raw reply

* [RFC][PATCH] b43: Comment unused functions lpphy_restore_dig_flt_state and lpphy_disable_rx_gain_override
From: Jaswinder Singh Rajput @ 2009-09-20  8:09 UTC (permalink / raw)
  To: John W. Linville, Gábor Stefanik, Michael Buesch,
	Stefano Brivio, linux-wireless


Commenting unused functions lpphy_restore_dig_flt_state and
lpphy_disable_rx_gain_override, may be we need these functions in future.

This also fixed following compilation warnings :
  CC [M]  drivers/net/wireless/b43/phy_lp.o
drivers/net/wireless/b43/phy_lp.c:383: warning: ‘lpphy_restore_dig_flt_state’ defined but not used
drivers/net/wireless/b43/phy_lp.c:891: warning: ‘lpphy_disable_rx_gain_override’ defined but not used

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 drivers/net/wireless/b43/phy_lp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 3e02d96..9c31462 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -379,6 +379,8 @@ static void lpphy_save_dig_flt_state(struct b43_wldev *dev)
 	}
 }
 
+/* lpphy_restore_dig_flt_state is unused but kept as a reference */
+#if 0
 static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
 {
 	static const u16 addr[] = {
@@ -399,6 +401,7 @@ static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
 	for (i = 0; i < ARRAY_SIZE(addr); i++)
 		b43_phy_write(dev, addr[i], lpphy->dig_flt_state[i]);
 }
+#endif
 
 static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
 {
@@ -887,6 +890,8 @@ static void lpphy_rev2plus_set_rx_gain(struct b43_wldev *dev, u32 gain)
 	}
 }
 
+/* lpphy_disable_rx_gain_override is unused but kept as a reference */
+#if 0
 static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 {
 	b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE);
@@ -902,6 +907,7 @@ static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 		b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFDFF);
 	}
 }
+#endif
 
 static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
 {
-- 
1.6.4.4



^ permalink raw reply related

* Question about carrier sensing
From: Jinsung Lee @ 2009-09-20  4:42 UTC (permalink / raw)
  To: linux-wireless

Hi, all.


I'm experimenting using MadWifi driver and Wistron CM6/CM9 cards, which all
use the Atheros chipset.
But, I found that there is some strange phenomenon on carrier sensing, which
doesn't follow the standard.
I let the two nearby transmitters just transmit the packets: one transmitter
has zero cw value and the other has positive cw values: 10, 100, 1000 where
cw is the maximum contention window size, thus the device selects the
backoff counter randomly from [0, cw].
If the carrier sensing really works, we would observe that the transmitter
with zero cw value takes all while the other don't at all, right?
Interestingly, the experimental result shows that the transmitter with
positive value has very infrequent but chances to transmit once in a while
during the whole experiment, and further the larger cw value, the much less
chance the transmitter has to transmit. So, it seems to work though.
Do you have any idea or similar experience?
Thanks.


--
Regards,
Jinsung Lee
--




^ permalink raw reply

* Re: [RFC] compat-2.6: mangle symbols for driver-select
From: Tim Gardner @ 2009-09-20  3:46 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, Greg KH, Johannes Berg
In-Reply-To: <20090919205545.GA18080@bombadil.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

Luis R. Rodriguez wrote:
> Today at the summit we spoke about mangling symbols for driver-slect.
> Here's a quick nasty take on this but without doing this for driver-select
> specifically just for testing. It seems to compile, but someone more motivated
> may want to test and make this apply somehow only for driver-select or perhaps
> when a -D define is used.
> 
> Reason for this is to help distributions / OEMs / ODMs who want to replace
> just *one* driver with compat-wireless.
> 

I think it would be better to generate the list of mangled symbols 
dynamically. In older Ubuntu releases (before depmod behavior was 
corrected), we have to run a 'munge' script to preface all of the 
exported symbols so that a compat-wireless driver references the 
compat-wireless protocol stack symbols. See the attached munge script 
for compat-wireless on 2.6.24. We can either do something like this for 
compat-wireless, or we could use a subset of this logic to generate the 
list of symbols contained within the '#ifdef 
CONFIG_COMPAT_WIRELESS_MANGLE' clause.

rtg
-- 
Tim Gardner tim.gardner@canonical.com

[-- Attachment #2: munge --]
[-- Type: text/plain, Size: 885 bytes --]

#!/bin/bash
#
# Isolate the compat-wireless exported symbols and munge every occurence such that
# there is no possibility of conflict with the main kernel.
#
TL=token_list
FL=file_list
SL=sed_list
TL_EXCEPTIONS=token_list_exceptions

find compat-wireless-2.6 -name "*.[ch]" > ${FL}

rm -f ${TL_EXCEPTIONS}
for i in wireless_send_event iw_handler_set_spy wireless_spy_update iw_handler_get_thrspy iw_handler_get_spy iw_handler_set_thrspy
do
	echo ${i} >> ${TL_EXCEPTIONS}
done

cat ${FL} | \
egrep -v "compat\.[ch]" |\
xargs grep -h EXPORT_SYMBOL | \
grep -v -f ${TL_EXCEPTIONS} |\
sed -e 's/^.*EXPORT_SYMBOL_GPL(//' -e 's/);//' -e 's/^.*EXPORT_SYMBOL(//' -e 's/);//' |\
sort -r | uniq > ${TL}

rm -f ${SL}
cat ${TL} | while read token
do
	echo s/${token}/cw_${token}/g >> ${SL}
done

cat ${FL} | while read f
do
	sed -i -f ${SL} "${f}"
done

rm -f ${TL} ${FL} ${SL} ${TL_EXCEPTIONS}


^ permalink raw reply

* Re: Problem with "cfg80211: fix SME connect" (bisected)
From: Andrew Price @ 2009-09-19 22:31 UTC (permalink / raw)
  To: Sedat Dilek; +Cc: linux-wireless
In-Reply-To: <2d0a357f0909191512o2ad20b1ag3eb344948351cae3@mail.gmail.com>

On Sun, Sep 20, 2009 at 12:12:56AM +0200, Sedat Dilek wrote:
> Can you try "[PATCH] cfg80211: don't overwrite privacy setting" from [1]?
> 
> -Sedat
> 
> [1] http://marc.info/?l=linux-wireless&m=125323296617306&w=2

That fixes it, thanks.

Andrew

^ permalink raw reply

* Re: Problem with "cfg80211: fix SME connect" (bisected)
From: Sedat Dilek @ 2009-09-19 22:12 UTC (permalink / raw)
  To: Andrew Price; +Cc: linux-wireless
In-Reply-To: <20090919220805.GA2728@plato.andrewprice.me.uk>

Can you try "[PATCH] cfg80211: don't overwrite privacy setting" from [1]?

-Sedat

[1] http://marc.info/?l=linux-wireless&m=125323296617306&w=2

On Sun, Sep 20, 2009 at 12:08 AM, Andrew Price <andy@andrewprice.me.uk> wrote:
> Hi,
>
> After building today's mainline kernel (as of 78f28b7c) my wireless
> networking stopped working - the interface seems to come up but nothing
> can connect.  The output of dmesg was clean, no backtraces or anything
> unusual.
>
> I've bisected the problem down to commit bbac31f4 "cfg80211: fix SME
> connect".  Reverting that commit fixes the problem. I'm using
> wpa_supplicant v0.6.9. The bug occurs for my b43 card and my rt2500pci
> card, and reverting the commit fixes the problem for both cards.
>
> Please let me know if there's any more info I can provide or patches I
> can test.
>
> Andrew
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Problem with "cfg80211: fix SME connect" (bisected)
From: Andrew Price @ 2009-09-19 22:08 UTC (permalink / raw)
  To: linux-wireless

Hi,

After building today's mainline kernel (as of 78f28b7c) my wireless
networking stopped working - the interface seems to come up but nothing
can connect.  The output of dmesg was clean, no backtraces or anything
unusual.

I've bisected the problem down to commit bbac31f4 "cfg80211: fix SME
connect".  Reverting that commit fixes the problem. I'm using
wpa_supplicant v0.6.9. The bug occurs for my b43 card and my rt2500pci
card, and reverting the commit fixes the problem for both cards.

Please let me know if there's any more info I can provide or patches I
can test.

Andrew

^ permalink raw reply

* [RFC] compat-2.6: mangle symbols for driver-select
From: Luis R. Rodriguez @ 2009-09-19 20:55 UTC (permalink / raw)
  To: linux-wireless; +Cc: Greg KH, Johannes Berg, Tim Gardner

Today at the summit we spoke about mangling symbols for driver-slect.
Here's a quick nasty take on this but without doing this for driver-select
specifically just for testing. It seems to compile, but someone more motivated
may want to test and make this apply somehow only for driver-select or perhaps
when a -D define is used.

Reason for this is to help distributions / OEMs / ODMs who want to replace
just *one* driver with compat-wireless.

diff --git a/compat/compat.h b/compat/compat.h
index 05612b2..711a511 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -22,4 +22,159 @@
 #include <net/compat-2.6.31.h>
 #include <net/compat-2.6.32.h>
 
+#ifdef CONFIG_COMPAT_WIRELESS_MANGLE
+
+/* cfg80211 */
+
+#define wiphy_new					backport_wiphy_new
+#define wiphy_register					backport_wiphy_register
+#define wiphy_rfkill_start_polling			backport_wiphy_rfkill_start_polling
+#define wiphy_rfkill_stop_polling			backport_wiphy_rfkill_stop_polling
+#define wiphy_unregister				backport_wiphy_unregister
+#define wiphy_free					backport_wiphy_free
+#define wiphy_rfkill_set_hw_state			backport_wiphy_rfkill_set_hw_state
+#define cfg80211_ibss_joined				backport_cfg80211_ibss_joined
+#define print_ssid					backport_print_ssid
+#define lib80211_crypt_info_init			backport_lib80211_crypt_info_init
+#define lib80211_crypt_info_free			backport_lib80211_crypt_info_free
+#define lib80211_crypt_deinit_entries			backport_lib80211_crypt_deinit_entries
+#define lib80211_crypt_quiescing			backport_lib80211_crypt_quiescing
+#define lib80211_crypt_deinit_handler			backport_lib80211_crypt_deinit_handler
+#define lib80211_crypt_delayed_deinit			backport_lib80211_crypt_delayed_deinit
+#define lib80211_register_crypto_ops			backport_lib80211_register_crypto_ops
+#define lib80211_unregister_crypto_ops			backport_lib80211_unregister_crypto_ops
+#define lib80211_get_crypto_ops				backport_lib80211_get_crypto_ops
+#define cfg80211_send_rx_auth				backport_cfg80211_send_rx_auth
+#define cfg80211_send_rx_assoc				backport_cfg80211_send_rx_assoc
+#define cfg80211_send_deauth				backport_cfg80211_send_deauth
+#define cfg80211_send_disassoc				backport_cfg80211_send_disassoc
+#define cfg80211_send_auth_timeout			backport_cfg80211_send_auth_timeout
+#define cfg80211_send_assoc_timeout			backport_cfg80211_send_assoc_timeout
+#define cfg80211_michael_mic_failure			backport_cfg80211_michael_mic_failure
+#define cfg80211_testmode_alloc_reply_skb		backport_cfg80211_testmode_alloc_reply_skb
+#define cfg80211_testmode_reply				backport_cfg80211_testmode_reply
+#define cfg80211_testmode_alloc_event_skb		backport_cfg80211_testmode_alloc_event_skb
+#define cfg80211_testmode_event				backport_cfg80211_testmode_event
+#define ieee80211_radiotap_iterator_init		backport_ieee80211_radiotap_iterator_init
+#define ieee80211_radiotap_iterator_next		backport_ieee80211_radiotap_iterator_next
+#define freq_reg_info					backport_freq_reg_info
+#define wiphy_apply_custom_regulatory			backport_wiphy_apply_custom_regulatory
+#define regulatory_hint					backport_regulatory_hint
+#define cfg80211_scan_done				backport_cfg80211_scan_done
+#define cfg80211_get_bss				backport_cfg80211_get_bss
+#define cfg80211_get_mesh				backport_cfg80211_get_mesh
+#define cfg80211_inform_bss				backport_cfg80211_inform_bss
+#define cfg80211_inform_bss_frame			backport_cfg80211_inform_bss_frame
+#define cfg80211_put_bss				backport_cfg80211_put_bss
+#define cfg80211_unlink_bss				backport_cfg80211_unlink_bss
+#define cfg80211_wext_siwscan				backport_cfg80211_wext_siwscan
+#define cfg80211_wext_giwscan				backport_cfg80211_wext_giwscan
+#define cfg80211_connect_result				backport_cfg80211_connect_result
+#define cfg80211_roamed					backport_cfg80211_roamed
+#define cfg80211_disconnected				backport_cfg80211_disconnected
+#define ieee80211_get_response_rate			backport_ieee80211_get_response_rate
+#define ieee80211_channel_to_frequency			backport_ieee80211_channel_to_frequency
+#define ieee80211_frequency_to_channel			backport_ieee80211_frequency_to_channel
+#define __ieee80211_get_channel				backport___ieee80211_get_channel
+#define rfc1042_header					backport_rfc1042_header
+#define bridge_tunnel_header				backport_bridge_tunnel_header
+#define ieee80211_hdrlen				backport_ieee80211_hdrlen
+#define ieee80211_get_hdrlen_from_skb			backport_ieee80211_get_hdrlen_from_skb
+#define ieee80211_data_to_8023				backport_ieee80211_data_to_8023
+#define ieee80211_data_from_8023			backport_ieee80211_data_from_8023
+#define cfg80211_classify8021d				backport_cfg80211_classify8021d
+#define ieee80211_bss_get_ie				backport_ieee80211_bss_get_ie
+#define wireless_send_event				backport_wireless_send_event
+#define iw_handler_set_spy				backport_iw_handler_set_spy
+#define iw_handler_get_spy				backport_iw_handler_get_spy
+#define iw_handler_set_thrspy				backport_iw_handler_set_thrspy
+#define iw_handler_get_thrspy				backport_iw_handler_get_thrspy
+#define wireless_spy_update				backport_wireless_spy_update
+#define cfg80211_wext_giwname				backport_cfg80211_wext_giwname
+#define cfg80211_wext_siwmode				backport_cfg80211_wext_siwmode
+#define cfg80211_wext_giwmode				backport_cfg80211_wext_giwmode
+#define cfg80211_wext_giwrange				backport_cfg80211_wext_giwrange
+#define cfg80211_wext_siwrts				backport_cfg80211_wext_siwrts
+#define cfg80211_wext_giwrts				backport_cfg80211_wext_giwrts
+#define cfg80211_wext_siwfrag				backport_cfg80211_wext_siwfrag
+#define cfg80211_wext_giwfrag				backport_cfg80211_wext_giwfrag
+#define cfg80211_wext_siwretry				backport_cfg80211_wext_siwretry
+#define cfg80211_wext_giwretry				backport_cfg80211_wext_giwretry
+#define cfg80211_wext_siwencode				backport_cfg80211_wext_siwencode
+#define cfg80211_wext_siwencodeext			backport_cfg80211_wext_siwencodeext
+#define cfg80211_wext_giwencode				backport_cfg80211_wext_giwencode
+#define cfg80211_wext_siwfreq				backport_cfg80211_wext_siwfreq
+#define cfg80211_wext_giwfreq				backport_cfg80211_wext_giwfreq
+#define cfg80211_wext_siwtxpower			backport_cfg80211_wext_siwtxpower
+#define cfg80211_wext_giwtxpower			backport_cfg80211_wext_giwtxpower
+#define cfg80211_wext_siwauth				backport_cfg80211_wext_siwauth
+#define cfg80211_wext_giwauth				backport_cfg80211_wext_giwauth
+#define cfg80211_wext_siwpower				backport_cfg80211_wext_siwpower
+#define cfg80211_wext_giwpower				backport_cfg80211_wext_giwpower
+#define cfg80211_wext_siwrate				backport_cfg80211_wext_siwrate
+#define cfg80211_wext_giwrate				backport_cfg80211_wext_giwrate
+#define cfg80211_wireless_stats				backport_cfg80211_wireless_stats
+#define cfg80211_wext_siwap				backport_cfg80211_wext_siwap
+#define cfg80211_wext_giwap				backport_cfg80211_wext_giwap
+#define cfg80211_wext_siwessid				backport_cfg80211_wext_siwessid
+#define cfg80211_wext_giwessid				backport_cfg80211_wext_giwessid
+#define cfg80211_wext_siwgenie				backport_cfg80211_wext_siwgenie
+#define cfg80211_wext_siwmlme				backport_cfg80211_wext_siwmlme
+
+/* mac80211 */
+
+#define ieee80211_start_tx_ba_session			backport_ieee80211_start_tx_ba_session
+#define ieee80211_start_tx_ba_cb			backport_ieee80211_start_tx_ba_cb
+#define ieee80211_start_tx_ba_cb_irqsafe		backport_ieee80211_start_tx_ba_cb_irqsafe
+#define ieee80211_stop_tx_ba_session			backport_ieee80211_stop_tx_ba_session
+#define ieee80211_stop_tx_ba_cb				backport_ieee80211_stop_tx_ba_cb
+#define ieee80211_stop_tx_ba_cb_irqsafe			backport_ieee80211_stop_tx_ba_cb_irqsafe
+#define __ieee80211_get_radio_led_name			backport___ieee80211_get_radio_led_name
+#define __ieee80211_get_assoc_led_name			backport___ieee80211_get_assoc_led_name
+#define __ieee80211_get_tx_led_name			backport___ieee80211_get_tx_led_name
+#define __ieee80211_get_rx_led_name			backport___ieee80211_get_rx_led_name
+#define ieee80211_tx_status_irqsafe			backport_ieee80211_tx_status_irqsafe
+#define ieee80211_tx_status				backport_ieee80211_tx_status
+#define ieee80211_restart_hw				backport_ieee80211_restart_hw
+#define ieee80211_alloc_hw				backport_ieee80211_alloc_hw
+#define ieee80211_register_hw				backport_ieee80211_register_hw
+#define ieee80211_unregister_hw				backport_ieee80211_unregister_hw
+#define ieee80211_free_hw				backport_ieee80211_free_hw
+#define ieee80211_beacon_loss				backport_ieee80211_beacon_loss
+#define ieee80211_rate_control_register			backport_ieee80211_rate_control_register
+#define ieee80211_rate_control_unregister		backport_ieee80211_rate_control_unregister
+#define rate_control_send_low				backport_rate_control_send_low
+#define ieee80211_rx					backport_ieee80211_rx
+#define ieee80211_rx_irqsafe				backport_ieee80211_rx_irqsafe
+#define ieee80211_scan_completed			backport_ieee80211_scan_completed
+#define ieee80211_find_sta				backport_ieee80211_find_sta
+#define ieee80211_get_tkip_key				backport_ieee80211_get_tkip_key
+#define ieee80211_beacon_get				backport_ieee80211_beacon_get
+#define ieee80211_rts_get				backport_ieee80211_rts_get
+#define ieee80211_ctstoself_get				backport_ieee80211_ctstoself_get
+#define ieee80211_get_buffered_bc			backport_ieee80211_get_buffered_bc
+#define wiphy_to_ieee80211_hw				backport_wiphy_to_ieee80211_hw
+#define ieee80211_generic_frame_duration		backport_ieee80211_generic_frame_duration
+#define ieee80211_rts_duration				backport_ieee80211_rts_duration
+#define ieee80211_ctstoself_duration			backport_ieee80211_ctstoself_duration
+#define ieee80211_wake_queue				backport_ieee80211_wake_queue
+#define ieee80211_stop_queue				backport_ieee80211_stop_queue
+#define ieee80211_stop_queues				backport_ieee80211_stop_queues
+#define ieee80211_queue_stopped				backport_ieee80211_queue_stopped
+#define ieee80211_wake_queues				backport_ieee80211_wake_queues
+#define ieee80211_iterate_active_interfaces		backport_ieee80211_iterate_active_interfaces
+#define ieee80211_iterate_active_interfaces_atomic	backport_ieee80211_iterate_active_interfaces_atomic
+#define ieee80211_queue_work				backport_ieee80211_queue_work
+#define ieee80211_queue_delayed_work			backport_ieee80211_queue_delayed_work
+
+#endif /* CONFIG_COMPAT_WIRELESS_MANGLE */
+
+/* Atheros */
+
+#define ath_regd_init					backport_ath_regd_init
+#define ath_is_world_regd				backport_ath_is_world_regd
+#define ath_reg_notifier_apply				backport_ath_reg_notifier_apply
+#define ath_regd_get_band_ctl				backport_ath_regd_get_band_ctl
+#define ath_hw_setbssidmask				backport_ath_hw_setbssidmask
+
 #endif /* LINUX_26_COMPAT_H */
diff --git a/config.mk b/config.mk
index b482b68..2de37a1 100644
--- a/config.mk
+++ b/config.mk
@@ -4,6 +4,8 @@ export
 ## Make sure to have each variable declaration start
 ## in the first column, no whitespace allowed.
 
+CONFIG_COMPAT_WIRELESS_MANGLE=y
+
 ifeq ($(wildcard $(KLIB_BUILD)/.config),)
 # These will be ignored by compat autoconf
  CONFIG_PCI=y

^ permalink raw reply related

* About calculation of RSSI in iwlwifi 5300agn
From: kai zeng @ 2009-09-19 18:51 UTC (permalink / raw)
  To: linux-wireless

Hi,

Does any one know how the RSSI is calculated in iwlwifi 5300agn?
Specifically, what's the function used to map the actual signal
strength to RSSI?

Thanks,

Kai

^ permalink raw reply

* Re: [PATCH] ar9170: implement frequency calibration for one-stage/openfw
From: Joerg Albert @ 2009-09-19 12:21 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christian Lamparter, linux-wireless, linville, David S. Miller
In-Reply-To: <20090918170211.8acce2cc.akpm@linux-foundation.org>

On 09/19/2009 02:02 AM, Andrew Morton wrote:
> On Thu, 3 Sep 2009 20:25:31 +0200
> Christian Lamparter <chunkeey@googlemail.com> wrote:
> 
>> This patch ports some code from the vendor driver, which is
>> supposed to upload the right calibration values for the
>> chosen frequency.
>>
>> In theory, this should give a better range and throughput
>> for all users with the open, or one-stage firmware.
>>
>> ...
>>
>> +		for (i = 0; i < 76; i++) {
>> +			u32 phy_data;
>> +			u8 tmp;
>> +
>> +			if (i < 25) {
>> +				tmp = ar9170_interpolate_val(i, &pwrs[0][0],
>> +							     &vpds[0][0]);
>> +			} else {
>> +				tmp = ar9170_interpolate_val(i - 12,
>> +							     &pwrs[1][0],
>> +							     &vpds[1][0]);
>> +			}
>> +
>> +			phy_data |= tmp << ((i & 3) << 3);
> 
> Clearly buggy and the compiler warns.  The value of phy_data is unknown
> here.
> 
> How did this get all the way into mainline?

Strangely it compiles without any warning for me with the latest linux-wireless:

 joerg@nc10:~/src/wireless.gits/wireless-testing$ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
joerg@nc10:~/src/wireless.gits/wireless-testing$ git describe
v2.6.31-38258-g389ce02
joerg@nc10:~/src/wireless.gits/wireless-testing/drivers/net/wireless/ath/ar9170$ grep phy_data phy.c
                        u32 phy_data;
                        phy_data |= tmp << ((i & 3) << 3);
                                                (i & ~3), phy_data);
                                phy_data = 0;

joerg@nc10:~/src/wireless.gits/wireless-testing$ make modules
...
  CC [M]  drivers/net/wireless/ath/ar9170/mac.o
  CC [M]  drivers/net/wireless/ath/ar9170/phy.o
  CC [M]  drivers/net/wireless/ath/ar9170/led.o

make V=1 says:

  gcc -Wp,-MD,drivers/net/wireless/ath/ar9170/.phy.o.d  -nostdinc -isystem 
/usr/lib/gcc/i486-linux-gnu/4.3.3/include -Iinclude  
-I/home/joerg/src/wireless.gits/wireless-testing/arch/x86/include -include 
include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes 
-Wno-trigraphs -fno-strict-aliasing -fno-common 
-Werror-implicit-function-declaration -Wno-format-security 
-fno-delete-null-pointer-checks -O2 -m32 -msoft-float -mregparm=3 
-freg-struct-return -mpreferred-stack-boundary=2 -march=i686 -mtune=pentium3 
-mtune=generic -Wa,-mtune=generic32 -ffreestanding -pipe -Wno-sign-compare 
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow 
-fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -g 
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow  -DMODULE 
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(phy)"  
-D"KBUILD_MODNAME=KBUILD_STR(ar9170usb)"  -c -o 
drivers/net/wireless/ath/ar9170/.tmp_phy.o drivers/net/wireless/ath/ar9170/phy.c


Adding "-Wuninitialized" didn't help, acc. to the doc it is switched on
with -Wall for -O2.
Is this a regression of gcc?

Regards,
Jörg.

^ permalink raw reply

* Re: alloc skb based on a given data buffer
From: Johannes Berg @ 2009-09-19  5:56 UTC (permalink / raw)
  To: David Miller
  Cc: yi.zhu, mel, reinette.chatre, elendil, Larry.Finger, linville,
	penberg, linux-kernel, linux-wireless, ipw3945-devel, akpm, cl,
	assaf.krauss, mohamed.abbas, netdev
In-Reply-To: <20090915.141606.134994761.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Tue, 2009-09-15 at 14:16 -0700, David Miller wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> Date: Tue, 15 Sep 2009 08:30:31 -0700
> 
> > Hold, mac80211 can't cope with that at this point for sw crypto and
> > possibly other things.
> 
> Then it should skb_linearize() at input, or similar.

Not all that much won then since that again means an order-2 allocation.
Fewer, certainly, as most packets are actually much smaller than that.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply

* AR9285 not working after resume
From: Christopher @ 2009-09-19  1:29 UTC (permalink / raw)
  To: linux-wireless

hi, I'm using the ath9k-build 2009-09-15 with my Atheros AR9285.
After resuming from suspend-to-RAM, my connections are all disconnected
(as expected), but on reconnect wicd hangs on authenticating.
dmesg shows "ADDRCONF(NETDEV_UP): wlan0: link is not ready" and:


        ------------[ cut here ]------------
        WARNING:
        at /home/build/compat-wireless/compat-wireless-2009-09-15/net/wireless/mlme.c:96 cfg80211_send_rx_assoc+0x199/0x250 [cfg80211]()
        Hardware name: K50IJ               
        Modules linked in: aes_i586 aes_generic i915 drm i2c_algo_bit
        ath9k mac80211 ath cfg80211 rfkill ipv6 fuse fan
        cpufreq_powersave cpufreq_ondemand acpi_cpufreq uvcvideo
        freq_table arc4 ecb videodev usb_storage v4l1_compat
        snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
        snd_seq_device snd_pcm_oss snd_mixer_oss i2c_core
        snd_hda_codec_via snd_hda_intel snd_hda_codec snd_hwdep snd_pcm
        snd_timer uhci_hcd snd iTCO_wdt iTCO_vendor_support soundcore
        ehci_hcd snd_page_alloc intel_agp agpgart video psmouse atl1e
        usbcore asus_laptop output sr_mod serio_raw evdev cdrom pcspkr
        battery button processor thermal ac led_class sg rtc_cmos
        rtc_core rtc_lib ext4 mbcache jbd2 crc16 sd_mod ahci libata
        scsi_mod [last unloaded: rfkill]
        Pid: 1525, comm: phy0 Not tainted 2.6.31-ARCH #1
        Call Trace:
         [<c10466fa>] ? warn_slowpath_common+0x7a/0xc0
         [<f8cd5899>] ? cfg80211_send_rx_assoc+0x199/0x250 [cfg80211]
         [<c1046760>] ? warn_slowpath_null+0x20/0x40
         [<f8cd5899>] ? cfg80211_send_rx_assoc+0x199/0x250 [cfg80211]
         [<f8d3459e>] ? ieee80211_sta_work+0x8ee/0x15e0 [mac80211]
         [<c100239d>] ? __switch_to+0xbd/0x1a0
         [<c103bc94>] ? finish_task_switch+0xf4/0x130
         [<c1305309>] ? schedule+0x2d9/0x990
         [<f8d33cb0>] ? ieee80211_sta_work+0x0/0x15e0 [mac80211]
         [<c105d1ef>] ? worker_thread+0x11f/0x280
         [<c1062f90>] ? autoremove_wake_function+0x0/0x60
         [<c105d0d0>] ? worker_thread+0x0/0x280
         [<c1062b3c>] ? kthread+0x8c/0xa0
         [<c1062ab0>] ? kthread+0x0/0xa0
         [<c10048e7>] ? kernel_thread_helper+0x7/0x10
        ---[ end trace dca41fa40e008850 ]---
        ------------[ cut here ]------------

Arch Linux 2.6.31, Asus X5DIJ Laptop, Wifi running great at 150 Mbit/s.
Is this related to the connecting-error? I'd be glad to test anything
you throw at me.

DIDI2002


^ permalink raw reply

* Re: [PATCH] ar9170: implement frequency calibration for one-stage/openfw
From: Andrew Morton @ 2009-09-19  0:02 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless, linville, David S. Miller
In-Reply-To: <200909032025.31260.chunkeey@googlemail.com>

On Thu, 3 Sep 2009 20:25:31 +0200
Christian Lamparter <chunkeey@googlemail.com> wrote:

> This patch ports some code from the vendor driver, which is
> supposed to upload the right calibration values for the
> chosen frequency.
> 
> In theory, this should give a better range and throughput
> for all users with the open, or one-stage firmware.
> 
> ...
>
> +		for (i = 0; i < 76; i++) {
> +			u32 phy_data;
> +			u8 tmp;
> +
> +			if (i < 25) {
> +				tmp = ar9170_interpolate_val(i, &pwrs[0][0],
> +							     &vpds[0][0]);
> +			} else {
> +				tmp = ar9170_interpolate_val(i - 12,
> +							     &pwrs[1][0],
> +							     &vpds[1][0]);
> +			}
> +
> +			phy_data |= tmp << ((i & 3) << 3);

Clearly buggy and the compiler warns.  The value of phy_data is unknown
here.

How did this get all the way into mainline?


^ permalink raw reply

* Re: [PATCH] cfg80211: don't overwrite privacy setting
From: Sedat Dilek @ 2009-09-18 21:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless, ASIC Felix
In-Reply-To: <1253232931.23567.6.camel@johannes.local>

Quick Feedback:

Fixes also compat-wireless (2009-09-18) built against 2.6.31 with iwl3945.
ath5k driver on another machine is also OK.
With yesterday's c-w I had no connection to my AP (WPA2-PSK/CCMP).

$ sudo wpa_cli -iwlan0 status
bssid=$myBSSID
ssid=$mySSID
id=0
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=$myIPADDR


-Sedat

On Fri, Sep 18, 2009 at 2:15 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> When cfg80211 is instructed to connect, it always
> uses the default WEP key for the privacy setting,
> which clearly is wrong when using wpa_supplicant.
> Don't overwrite the setting, and rely on it being
> false when wpa_supplicant is not running, instead
> set it to true when we have keys.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
>
> --- wireless-testing.orig/net/wireless/wext-sme.c       2009-09-17 17:12:03.000000000 -0700
> +++ wireless-testing/net/wireless/wext-sme.c    2009-09-17 17:12:53.000000000 -0700
> @@ -26,11 +26,11 @@ int cfg80211_mgd_wext_connect(struct cfg
>
>        wdev->wext.connect.ie = wdev->wext.ie;
>        wdev->wext.connect.ie_len = wdev->wext.ie_len;
> -       wdev->wext.connect.privacy = wdev->wext.default_key != -1;
>
>        if (wdev->wext.keys) {
>                wdev->wext.keys->def = wdev->wext.default_key;
>                wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key;
> +               wdev->wext.connect.privacy = true;
>        }
>
>        if (!wdev->wext.connect.ssid_len)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: [PATCH] cfg80211: don't overwrite privacy setting
From: ASIC Felix @ 2009-09-18 20:52 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless
In-Reply-To: <1253232931.23567.6.camel@johannes.local>

On Thu, 2009-09-17 at 17:15 -0700, Johannes Berg wrote:
> When cfg80211 is instructed to connect, it always
> uses the default WEP key for the privacy setting,
> which clearly is wrong when using wpa_supplicant.
> Don't overwrite the setting, and rely on it being
> false when wpa_supplicant is not running, instead
> set it to true when we have keys.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> 
> --- wireless-testing.orig/net/wireless/wext-sme.c	2009-09-17 17:12:03.000000000 -0700
> +++ wireless-testing/net/wireless/wext-sme.c	2009-09-17 17:12:53.000000000 -0700
> @@ -26,11 +26,11 @@ int cfg80211_mgd_wext_connect(struct cfg
>  
>  	wdev->wext.connect.ie = wdev->wext.ie;
>  	wdev->wext.connect.ie_len = wdev->wext.ie_len;
> -	wdev->wext.connect.privacy = wdev->wext.default_key != -1;
>  
>  	if (wdev->wext.keys) {
>  		wdev->wext.keys->def = wdev->wext.default_key;
>  		wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key;
> +		wdev->wext.connect.privacy = true;
>  	}
>  
>  	if (!wdev->wext.connect.ssid_len)

This patch fixes my issue "Re: regression?  No connection with
master-2009-09-16 was fine until master-2009-09-14"

Best regards,
Felix


^ permalink raw reply

* Re: regression?  No connection with master-2009-09-16 was fine until master-2009-09-14
From: ASIC Felix @ 2009-09-18 20:51 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Luis R. Rodriguez
In-Reply-To: <1253232836.23567.4.camel@johannes.local>

On Thu, 2009-09-17 at 17:13 -0700, Johannes Berg wrote:
> On Thu, 2009-09-17 at 17:09 -0700, Johannes Berg wrote:
> > On Thu, 2009-09-17 at 17:05 -0700, ASIC Felix wrote:
> > 
> > > > and then describe your setup ... the patch works fine here and Holger
> > > > said it fixed his problem. hidden ssid by any chance?
> > > 
> > > Office network, can see about 50 APs, more 2G than 5G.
> > > 
> > > Main office ssid is available on most 2G channels 11g (no 11n), also on
> > > several 5G channels 11a (no 11n). Lots of other ssids are visible.
> > > WPA2/PSK.
> > 
> > I think wpa is the problem, seeing something like that here too, very
> > odd that it could connect otherwise tho.
> 
> yeah I've got it.
> 
> johannes

yes, fixed with your patch "Re: [PATCH] cfg80211: don't overwrite
privacy setting"

Thanks!
Best regards,
Felix


^ permalink raw reply

* Re: [Ilw] Re: WARNING: at net/mac80211/scan.c:267 ieee80211_scan_completed+0x299/0x2b0 [mac80211]()
From: Maciej Rutecki @ 2009-09-18 20:19 UTC (permalink / raw)
  To: reinette chatre
  Cc: ilw@linux.intel.com, Linux Wireless List,
	Linux Kernel Mailing List
In-Reply-To: <1253299494.26521.664.camel@rc-desk>

2009/9/18 reinette chatre <reinette.chatre@intel.com>:
> Hi Maciej,
>
> On Wed, 2009-09-16 at 23:32 -0700, Maciej Rutecki wrote:
>
>> [  249.340094] wlan0: direct probe to AP 00:1b:11:f6:0f:28 (try 1)
>> [  249.345339] wlan0 direct probe responded
>> [  249.345347] wlan0: authenticate with AP 00:1b:11:f6:0f:28 (try 1)
>> [  249.347122] wlan0: authenticated
>> [  249.347152] wlan0: associate with AP 00:1b:11:f6:0f:28 (try 1)
>> [  249.349703] wlan0: RX AssocResp from 00:1b:11:f6:0f:28 (capab=0x431
>> status=0 aid=1)
>> [  249.349711] wlan0: associated
>> [  253.411858] wlan0: deauthenticated from 00:1b:11:f6:0f:28 (Reason:
>> 6)
>
> This still appears to be the main issue here, that AP deauthenticates.
> Could you run wpa_supplicant with debugging (-dddt) ? When you have
> these logs, could you please open a bug report at
> http://bugzilla.intellinuxwireless.org/ to enable us to track it?

Sure, bug report:
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2089

Debug information also available:
http://unixy.pl/maciek/download/kernel/2.6.31-git4/wpa_debug.txt

Regards
-- 
Maciej Rutecki
http://www.maciek.unixy.pl

^ permalink raw reply


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