From dcbw at redhat.com  Wed Nov  1 00:55:08 2006
From: dcbw at redhat.com (Dan Williams)
Date: Wed, 01 Nov 2006 00:55:08 -0500
Subject: [PATCH] libertas: update to WE-18
In-Reply-To: <1161401143.6095.3.camel@localhost.localdomain>
References: <1161401143.6095.3.camel@localhost.localdomain>
Message-ID: <1162360508.13764.1.camel@localhost.localdomain>

On Fri, 2006-10-20 at 23:25 -0400, Dan Williams wrote:
> Implement WE-18 handlers for WPA and consolidate security/encryption
> calls into a common set of functions and key structures.  Doesn't work
> with WPA yet due to the lack of deferred association, but it's no worse
> than before.
> 
> Signed-off-by: Dan Williams <dcbw at redhat.com>

The WE-18 patch had a slight omission that breaks WEP.  The attached
patch fixes that by passing the right argument to
wlan_cmd_802_11_set_wep.

Signed-off-by: Dan Williams <dcbw at redhat.com>

diff --git a/drivers/net/wireless/libertas/wlan_cmd.c b/drivers/net/wireless/libertas/wlan_cmd.c
index c1595e5..abcdce9 100644
--- a/drivers/net/wireless/libertas/wlan_cmd.c
+++ b/drivers/net/wireless/libertas/wlan_cmd.c
@@ -1466,7 +1466,7 @@ int libertas_prepare_and_send_command(wl
 		break;
 
 	case HostCmd_CMD_802_11_SET_WEP:
-		ret = wlan_cmd_802_11_set_wep(priv, CmdPtr, cmd_oid);
+		ret = wlan_cmd_802_11_set_wep(priv, CmdPtr, cmd_action);
 		break;
 
 	case HostCmd_CMD_802_11_AD_HOC_START:




From dcbw at redhat.com  Thu Nov  2 14:14:37 2006
From: dcbw at redhat.com (Dan Williams)
Date: Thu, 02 Nov 2006 14:14:37 -0500
Subject: [PATCH] libertas: don't oops on module unload after boot2 flash
Message-ID: <1162494877.3347.12.camel@localhost.localdomain>

if_usb_disconnect() was attempting to grab and dereference the usb
device private data, which under normal operation is a pointer to the
wlan_private structure for the card.  Under Boot2 operation, that
pointer is NULL because the card hasn't been set up for normal
operation.  The attached patch fixes this oops.

Signed-off-by: Dan Williams <dcbw at redhat.com>


diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 7bf979a..27818a9 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -359,17 +359,22 @@ static void if_usb_disconnect(struct usb
 {
 	struct usb_card_rec *cardp = usb_get_intfdata(intf);
 	wlan_private *priv = (wlan_private *) cardp->priv;
-	wlan_adapter *Adapter = priv->adapter;
+	wlan_adapter *Adapter = NULL;
 
 	ENTER();
 
 #ifdef SUPPORT_BOOT_COMMAND
 	if (UpdateStorage.u8DriverFunctionActive != DRIVER_NORMAL) {
 		us_usb_disconnect(intf);
-		LEAVE();
-		return ;
+		goto out;
 	}
 #endif
+
+	/* priv will only be allocated during normal operation,
+	 * but NOT doing a Boot2 firmware update.
+	 */
+	Adapter = priv->adapter;
+
 	/* 
 	 * Update Surprie removed to TRUE  
 	 *  Free all the URB's allocated 
@@ -388,6 +393,7 @@ #endif
 	usb_set_intfdata(intf, NULL);
 	usb_put_dev(interface_to_usbdev(intf));
 
+out:
 	LEAVE();
 	return;
 }




From marcelo at kvack.org  Thu Nov  9 11:54:07 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 9 Nov 2006 14:54:07 -0200
Subject: Boot2 v3104 still exhibits problems after shutdown
Message-ID: <20061109165407.GA21828@dmt>

Hi,

Boot2 v3104 was supposed to fix the shutdown issues which the device
appears dead after usage (its not properly shutdown, that is).

Apparently this is not the case, since the driver still fails to
communicate with the device which in turn causes it to forcely reset it.

http://dev.laptop.org/~marcelo/libertas/log-reset-3104.txt


From rchokshi at marvell.com  Thu Nov  9 14:05:15 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Thu, 9 Nov 2006 11:05:15 -0800
Subject: Boot2 v3104 still exhibits problems after shutdown
Message-ID: <D1575D47310FC94D902C8675241E8E3E02688A06@msiexch01.marvell.com>

Hi Marcelo,
Thanks for reporting this issue. There was a misunderstanding on our
side. The Boot2 v3104 does not fix this shutdown issue. There is a fix
for this in the firmware. 

We have actually seen this issue on the USB dongles on our side already
and have a fix for this already. This fix did not percolate in the
firmware that you are using.

We will fix this in the next release of the firmware. 

Thanks
Ronak

-----Original Message-----
From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
Sent: Thursday, November 09, 2006 8:54 AM
To: Ronak Chokshi; Alan Cunningham; libertas-dev at lists.infradead.org
Cc: Dan Williams
Subject: Boot2 v3104 still exhibits problems after shutdown

Hi,

Boot2 v3104 was supposed to fix the shutdown issues which the device
appears dead after usage (its not properly shutdown, that is).

Apparently this is not the case, since the driver still fails to
communicate with the device which in turn causes it to forcely reset it.

http://dev.laptop.org/~marcelo/libertas/log-reset-3104.txt


From marcelo at kvack.org  Thu Nov  9 22:18:18 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Fri, 10 Nov 2006 01:18:18 -0200
Subject: bcdDevice variation
Message-ID: <20061110031818.GA29016@dmt>

Can someone explain this Boot2 version variation?

Oct  9 11:14:55 localhost kernel: [  500.710096] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:15:00 localhost kernel: [  507.014307] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:15:21 localhost kernel: [  526.503215] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:15:24 localhost kernel: [  530.228437] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:15:30 localhost kernel: [  537.577436] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:15:53 localhost kernel: [  557.358723] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:15:56 localhost kernel: [  561.133990] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:16:22 localhost kernel: [  587.846111] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:16:27 localhost kernel: [  591.385894] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:16:52 localhost kernel: [  617.878692] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:16:56 localhost kernel: [  622.298855] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:17:01 localhost kernel: [  630.023878] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:17:24 localhost kernel: [  650.384814] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:17:27 localhost kernel: [  653.511716] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:18:03 localhost kernel: [  691.964761] VID/PID = 1286/2001, Boot2 version = 3006
Oct  9 11:18:08 localhost kernel: [  697.559584] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:18:37 localhost kernel: [  723.269844] VID/PID = 1286/2001, Boot2 version = 3104
Oct  9 11:18:40 localhost kernel: [  727.221746] VID/PID = 1286/2001, Boot2 version = 3006



From dwmw2 at infradead.org  Fri Nov 10 00:19:43 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Fri, 10 Nov 2006 13:19:43 +0800
Subject: bcdDevice variation
In-Reply-To: <20061110031818.GA29016@dmt>
References: <20061110031818.GA29016@dmt>
Message-ID: <1163135983.4727.15.camel@shinybook.infradead.org>

On Fri, 2006-11-10 at 01:18 -0200, Marcelo Tosatti wrote:
> Can someone explain this Boot2 version variation?
> 
> Oct  9 11:14:55 localhost kernel: [  500.710096] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:15:00 localhost kernel: [  507.014307] VID/PID = 1286/2001, Boot2 version = 3104

I suspect that 3006 is what the runtime firmware reports. If you boot,
load the driver (and hence firmware), then reboot Linux without cycling
USB power -- does Linux then see 3006?

-- 
dwmw2



From javier at cozybit.com  Fri Nov 10 01:31:14 2006
From: javier at cozybit.com (Javier Cardona)
Date: Thu, 9 Nov 2006 22:31:14 -0800
Subject: bcdDevice variation
In-Reply-To: <1163135983.4727.15.camel@shinybook.infradead.org>
References: <20061110031818.GA29016@dmt>
	<1163135983.4727.15.camel@shinybook.infradead.org>
Message-ID: <b211f6ec0611092231t78cf8759jf4c9edcc8d4165ae@mail.gmail.com>

David,

> I suspect that 3006 is what the runtime firmware reports. If you boot,
> load the driver (and hence firmware), then reboot Linux without cycling
> USB power -- does Linux then see 3006?

Good call. On a cold boot the boot2 code does the enumeration but on a
warm boot it is the firmware.  And the firmware seems to have the
boot2 version hardcoded:
#define BOOTLOADER_VERSION 0x3006.
Ronak has provided a patch that causes the boot2 code to be executed
even in warm reboots.  This will be resolved in the next firmware
release.  I have created ticket #376 for this.

Javier

On 11/9/06, David Woodhouse <dwmw2 at infradead.org> wrote:
> On Fri, 2006-11-10 at 01:18 -0200, Marcelo Tosatti wrote:
> > Can someone explain this Boot2 version variation?
> >
> > Oct  9 11:14:55 localhost kernel: [  500.710096] VID/PID = 1286/2001, Boot2 version = 3006
> > Oct  9 11:15:00 localhost kernel: [  507.014307] VID/PID = 1286/2001, Boot2 version = 3104
>
> I suspect that 3006 is what the runtime firmware reports. If you boot,
> load the driver (and hence firmware), then reboot Linux without cycling
> USB power -- does Linux then see 3006?
>
> --
> dwmw2
>
>
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev
>


-- 
Javier Cardona
cozybit Inc.
p 415 974 6770
f 415 974 6771
c 415 630 0627
e javier at cozybit.com


From dwmw2 at infradead.org  Fri Nov 10 01:53:49 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Fri, 10 Nov 2006 14:53:49 +0800
Subject: bcdDevice variation
In-Reply-To: <b211f6ec0611092231t78cf8759jf4c9edcc8d4165ae@mail.gmail.com>
References: <20061110031818.GA29016@dmt>
	<1163135983.4727.15.camel@shinybook.infradead.org>
	<b211f6ec0611092231t78cf8759jf4c9edcc8d4165ae@mail.gmail.com>
Message-ID: <1163141629.4727.45.camel@shinybook.infradead.org>

On Thu, 2006-11-09 at 22:31 -0800, Javier Cardona wrote:
> Good call. On a cold boot the boot2 code does the enumeration but on a
> warm boot it is the firmware.  And the firmware seems to have the
> boot2 version hardcoded:
> #define BOOTLOADER_VERSION 0x3006.
> Ronak has provided a patch that causes the boot2 code to be executed
> even in warm reboots.  This will be resolved in the next firmware
> release.  I have created ticket #376 for this. 

The firmware is behaving badly enough that we've had to modify the board
to let us do a hard reset by waggling the RESET# line -- so this
probably won't be seen any more on the B1 boards. But we should make
sure it's fixed anyway.

-- 
dwmw2



From marcelo at kvack.org  Wed Nov 15 16:41:32 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 15 Nov 2006 19:41:32 -0200
Subject: bcdDevice variation
In-Reply-To: <20061110031818.GA29016@dmt>
References: <20061110031818.GA29016@dmt>
Message-ID: <20061115214132.GA4673@dmt>

On Fri, Nov 10, 2006 at 01:18:18AM -0200, Marcelo Tosatti wrote:
> Can someone explain this Boot2 version variation?
> 
> Oct  9 11:14:55 localhost kernel: [  500.710096] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:15:00 localhost kernel: [  507.014307] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:15:21 localhost kernel: [  526.503215] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:15:24 localhost kernel: [  530.228437] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:15:30 localhost kernel: [  537.577436] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:15:53 localhost kernel: [  557.358723] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:15:56 localhost kernel: [  561.133990] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:16:22 localhost kernel: [  587.846111] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:16:27 localhost kernel: [  591.385894] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:16:52 localhost kernel: [  617.878692] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:16:56 localhost kernel: [  622.298855] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:17:01 localhost kernel: [  630.023878] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:17:24 localhost kernel: [  650.384814] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:17:27 localhost kernel: [  653.511716] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:18:03 localhost kernel: [  691.964761] VID/PID = 1286/2001, Boot2 version = 3006
> Oct  9 11:18:08 localhost kernel: [  697.559584] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:18:37 localhost kernel: [  723.269844] VID/PID = 1286/2001, Boot2 version = 3104
> Oct  9 11:18:40 localhost kernel: [  727.221746] VID/PID = 1286/2001, Boot2 version = 3006

OK, new firmware is working as expected:


-bash-3.1# grep Boot2 /root/kernlog
Oct 15 05:20:08 localhost kernel: [  746.874734] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:20:41 localhost kernel: [  781.164018] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:20:50 localhost kernel: [  786.264268] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:23:04 localhost kernel: [  117.944485] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:23:12 localhost kernel: [  123.072565] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:23:42 localhost kernel: [  156.435537] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:23:52 localhost kernel: [  162.639753] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:24:22 localhost kernel: [  196.587038] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:24:32 localhost kernel: [  203.207456] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:25:02 localhost kernel: [  236.789228] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:25:12 localhost kernel: [  243.066717] VID/PID = 1286/2001, Boot2 version = 3104
Oct 15 05:25:42 localhost kernel: [  276.670293] VID/PID = 1286/2001, Boot2 version = 3104



From marcelo at kvack.org  Wed Nov 15 20:28:52 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 15 Nov 2006 23:28:52 -0200
Subject: Length of MAC, BBP and RF registers
Message-ID: <20061116012852.GA20547@dmt>

Hi Ronak, Alan,

We're trying to get rid of the wlanconfig "tool" and its ioctl
interface.

A few commands (such as version and eeprom read) have been converted
to ethtool, while others can't (and thus must be converted to another
interface, debugfs being the best choice in my opinion).

I would like to put the mac, bbp and rf registers in files, so they can
easily be read/written to. But for that it would be necessary to know
the length of such registers.

Can you please make that information available? Its nowhere in the docs.

Another detail which I've asked in the past but got no reply is how to
know the length of the EEPROM. I've hardcoded it to 16k in the driver
by noticing it wraps at that length, but if it changes there will be
problems.

DESCRIPTION

those commands are used in Marvell speck applicaion called wlanconfig.

===========
rdmac 
rdbbp
rdrf	
	These commands are used to read the MAC, BBP and RF registers from the 
	card.  These commands take one parameter that specifies the offset 
	location that is to be read.  This parameter can be specified either in 
	decimal or in hexadecimal (by preceding the number with a "0x").
		
	Usage:	
		wlanconfig ethX rdmac 0xa123
		wlanconfig ethX rdbbp 0x0123
		wlanconfig ethX rdrf 0x0123

wrmac 
wrbbp
wrrf	
	These commands are used to write the MAC, BBP and RF registers in the 
	card.  These commands take two parameters that specify the offset 
	location and the value that is to be written. This parameters can be 
	specified either in decimal or in hexadecimal (by preceding the number 
	with a "0x").
	
	Usage:
		wlanconfig ethX wrmac 0xa123 0xaa
		wlanconfig ethX wrbbp 0x0123 0xaa
		wlanconfig ethX wrrf 0x0123 0xaa



From marcelo at kvack.org  Wed Nov 15 21:12:15 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 16 Nov 2006 00:12:15 -0200
Subject: CMD_802_11_SLEEP_PERIOD Command returns 0x2 error code
Message-ID: <20061116021215.GA21783@dmt>

Hi, 

While playing with the iwpriv ioctl's I've noticed that the sleeppd
parameter always returns error code 0x2 (CMD_STATUS_UNSUPPORTED).

Is there a plan to implement this command?



From rchokshi at marvell.com  Wed Nov 15 21:45:04 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Wed, 15 Nov 2006 18:45:04 -0800
Subject: CMD_802_11_SLEEP_PERIOD Command returns 0x2 error code
Message-ID: <D1575D47310FC94D902C8675241E8E3E02734072@msiexch01.marvell.com>

Marcelo,
There is no plan to implement this right now. You can go ahead and
remove any calls to this command.

Ronak

-----Original Message-----
From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
Sent: Wednesday, November 15, 2006 6:12 PM
To: Alan Cunningham; Ronak Chokshi
Cc: libertas-dev at lists.infradead.org
Subject: CMD_802_11_SLEEP_PERIOD Command returns 0x2 error code

Hi, 

While playing with the iwpriv ioctl's I've noticed that the sleeppd
parameter always returns error code 0x2 (CMD_STATUS_UNSUPPORTED).

Is there a plan to implement this command?



From marcelo at kvack.org  Thu Nov 16 00:26:02 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 16 Nov 2006 03:26:02 -0200
Subject: getscanlist command redundant?
Message-ID: <20061116052602.GA2189@dmt>

Ronak,

wlanconfig contains the "extscan/getscanlist" commands:

extscan
        This command is used to do a specific scan.

        Usage: wlanconfig ethX extscan <SSID>

        Example:
                wlanconfig ethX extscan LINKSYS-AP

        To see the results of use getscanlist command.

getscanlist
        This command is used to get the scan results.

        Usage: wlanconfig ethX getscanlist

        Example:
                wlanconfig ethX getscanlist

What is the purpose of the extscan command? One can achieve same results
by doing a "iwlist ethX scan" and looking for a specific SSID, right? Or
am I missing something? 

And about "getscanlist", I don't see how it provides any additional
information other than "iwlist ethX scan" and "getscantable" ?

-bash-3.1# ./wlanconfig eth0 getscanlist
Driver build with Wireless Extension 21

BSSID:   00:13:46:36:EB:48
SSID:    ult
NetMode: infra
Quality: 216
Privacy: disabled

No of AP's = 1

Thanks


From javier at cozybit.com  Thu Nov 16 01:00:43 2006
From: javier at cozybit.com (Javier Cardona)
Date: Wed, 15 Nov 2006 22:00:43 -0800
Subject: Length of MAC, BBP and RF registers
In-Reply-To: <20061116012852.GA20547@dmt>
References: <20061116012852.GA20547@dmt>
Message-ID: <b211f6ec0611152200x6fe7bdc0g8e14eb00a61da3f1@mail.gmail.com>

Marcelo,

This is what I could find out:

These commands each access a different bank of registers, the offset
parameter determines which
register.

BBP, band pass processor registers, uint8.
RF, RF PHY registers, uint8.
MAC, MAC registers, uint32.

Hope it helps.

Javier

On 11/15/06, Marcelo Tosatti <marcelo at kvack.org> wrote:
> Hi Ronak, Alan,
>
> We're trying to get rid of the wlanconfig "tool" and its ioctl
> interface.
>
> A few commands (such as version and eeprom read) have been converted
> to ethtool, while others can't (and thus must be converted to another
> interface, debugfs being the best choice in my opinion).
>
> I would like to put the mac, bbp and rf registers in files, so they can
> easily be read/written to. But for that it would be necessary to know
> the length of such registers.
>
> Can you please make that information available? Its nowhere in the docs.
>
> Another detail which I've asked in the past but got no reply is how to
> know the length of the EEPROM. I've hardcoded it to 16k in the driver
> by noticing it wraps at that length, but if it changes there will be
> problems.
>
> DESCRIPTION
>
> those commands are used in Marvell speck applicaion called wlanconfig.
>
> ===========
> rdmac
> rdbbp
> rdrf
>         These commands are used to read the MAC, BBP and RF registers from the
>         card.  These commands take one parameter that specifies the offset
>         location that is to be read.  This parameter can be specified either in
>         decimal or in hexadecimal (by preceding the number with a "0x").
>
>         Usage:
>                 wlanconfig ethX rdmac 0xa123
>                 wlanconfig ethX rdbbp 0x0123
>                 wlanconfig ethX rdrf 0x0123
>
> wrmac
> wrbbp
> wrrf
>         These commands are used to write the MAC, BBP and RF registers in the
>         card.  These commands take two parameters that specify the offset
>         location and the value that is to be written. This parameters can be
>         specified either in decimal or in hexadecimal (by preceding the number
>         with a "0x").
>
>         Usage:
>                 wlanconfig ethX wrmac 0xa123 0xaa
>                 wlanconfig ethX wrbbp 0x0123 0xaa
>                 wlanconfig ethX wrrf 0x0123 0xaa
>
>
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev
>


-- 
Javier Cardona
cozybit Inc.
p 415 974 6770
f 415 974 6771
c 415 630 0627
e javier at cozybit.com


From dcbw at redhat.com  Thu Nov 16 08:01:50 2006
From: dcbw at redhat.com (Dan Williams)
Date: Thu, 16 Nov 2006 08:01:50 -0500
Subject: getscanlist command redundant?
In-Reply-To: <20061116052602.GA2189@dmt>
References: <20061116052602.GA2189@dmt>
Message-ID: <1163682110.2889.16.camel@localhost.localdomain>

On Thu, 2006-11-16 at 03:26 -0200, Marcelo Tosatti wrote:
> Ronak,
> 
> wlanconfig contains the "extscan/getscanlist" commands:
> 
> extscan
>         This command is used to do a specific scan.
> 
>         Usage: wlanconfig ethX extscan <SSID>
> 
>         Example:
>                 wlanconfig ethX extscan LINKSYS-AP
> 
>         To see the results of use getscanlist command.
> 
> getscanlist
>         This command is used to get the scan results.
> 
>         Usage: wlanconfig ethX getscanlist
> 
>         Example:
>                 wlanconfig ethX getscanlist
> 
> What is the purpose of the extscan command? One can achieve same results
> by doing a "iwlist ethX scan" and looking for a specific SSID, right? Or
> am I missing something? 

Likely, yes.  iwlist doesn't let you scan for a particular SSID at all
at this time, but the SIOCSIWSCAN handler does allow this, and drivers
like the IPW cards implement the specific-SSID scan option.  We should
too if we don't already.

Other than that, there seems to be some redundancy here.

dan

> And about "getscanlist", I don't see how it provides any additional
> information other than "iwlist ethX scan" and "getscantable" ?
> 
> -bash-3.1# ./wlanconfig eth0 getscanlist
> Driver build with Wireless Extension 21
> 
> BSSID:   00:13:46:36:EB:48
> SSID:    ult
> NetMode: infra
> Quality: 216
> Privacy: disabled
> 
> No of AP's = 1
> 
> Thanks
> 
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev



From rchokshi at marvell.com  Thu Nov 16 13:04:13 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Thu, 16 Nov 2006 10:04:13 -0800
Subject: getscanlist command redundant?
Message-ID: <D1575D47310FC94D902C8675241E8E3E02734190@msiexch01.marvell.com>

Dan and Marcelo,
Your comments are pretty much accurate. extscan is used to scan for a
particular SSID and getscanlist is actually is get the latest scan
results from the scan buffers in the driver. Unlike, 'iwlist ethX scan',
issuing getscanlist does not really issue a scan - it just gets the
latest scan results from the drivers.

As you can probably envision, these commands are used for roaming use
cases. For example, application would use the getscanlist to get the
latest set of probe responses or would use the extscan to actually scan
for one particular AP.

Thanks 
Ronak

-----Original Message-----
From: Dan Williams [mailto:dcbw at redhat.com] 
Sent: Thursday, November 16, 2006 5:02 AM
To: Marcelo Tosatti
Cc: Ronak Chokshi; Alan Cunningham; libertas-dev at lists.infradead.org
Subject: Re: getscanlist command redundant?

On Thu, 2006-11-16 at 03:26 -0200, Marcelo Tosatti wrote:
> Ronak,
> 
> wlanconfig contains the "extscan/getscanlist" commands:
> 
> extscan
>         This command is used to do a specific scan.
> 
>         Usage: wlanconfig ethX extscan <SSID>
> 
>         Example:
>                 wlanconfig ethX extscan LINKSYS-AP
> 
>         To see the results of use getscanlist command.
> 
> getscanlist
>         This command is used to get the scan results.
> 
>         Usage: wlanconfig ethX getscanlist
> 
>         Example:
>                 wlanconfig ethX getscanlist
> 
> What is the purpose of the extscan command? One can achieve same
results
> by doing a "iwlist ethX scan" and looking for a specific SSID, right?
Or
> am I missing something? 

Likely, yes.  iwlist doesn't let you scan for a particular SSID at all
at this time, but the SIOCSIWSCAN handler does allow this, and drivers
like the IPW cards implement the specific-SSID scan option.  We should
too if we don't already.

Other than that, there seems to be some redundancy here.

dan

> And about "getscanlist", I don't see how it provides any additional
> information other than "iwlist ethX scan" and "getscantable" ?
> 
> -bash-3.1# ./wlanconfig eth0 getscanlist
> Driver build with Wireless Extension 21
> 
> BSSID:   00:13:46:36:EB:48
> SSID:    ult
> NetMode: infra
> Quality: 216
> Privacy: disabled
> 
> No of AP's = 1
> 
> Thanks
> 
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev



From rchokshi at marvell.com  Thu Nov 16 13:28:33 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Thu, 16 Nov 2006 10:28:33 -0800
Subject: Length of MAC, BBP and RF registers
Message-ID: <D1575D47310FC94D902C8675241E8E3E027341CB@msiexch01.marvell.com>

Hi Marcelo,
The lengths of registers stated by Javier are correct. For your other
question, the size of the EEPROMs used on the USB 8388 parts shipped
with the OLPC boards is indeed 16K. The contents keep changing with any
boot2 / calibration changes that we make but the size is constant - 16K.
This is the actual size of the EEPROM hardware. The contents are smaller
than 16K.

Thanks
Ronak

-----Original Message-----
From: javier.cardona at gmail.com [mailto:javier.cardona at gmail.com] On
Behalf Of Javier Cardona
Sent: Wednesday, November 15, 2006 10:01 PM
To: Marcelo Tosatti
Cc: Ronak Chokshi; Alan Cunningham; libertas-dev at lists.infradead.org;
mtosatti at redhat.com
Subject: Re: Length of MAC, BBP and RF registers

Marcelo,

This is what I could find out:

These commands each access a different bank of registers, the offset
parameter determines which
register.

BBP, band pass processor registers, uint8.
RF, RF PHY registers, uint8.
MAC, MAC registers, uint32.

Hope it helps.

Javier

On 11/15/06, Marcelo Tosatti <marcelo at kvack.org> wrote:
> Hi Ronak, Alan,
>
> We're trying to get rid of the wlanconfig "tool" and its ioctl
> interface.
>
> A few commands (such as version and eeprom read) have been converted
> to ethtool, while others can't (and thus must be converted to another
> interface, debugfs being the best choice in my opinion).
>
> I would like to put the mac, bbp and rf registers in files, so they
can
> easily be read/written to. But for that it would be necessary to know
> the length of such registers.
>
> Can you please make that information available? Its nowhere in the
docs.
>
> Another detail which I've asked in the past but got no reply is how to
> know the length of the EEPROM. I've hardcoded it to 16k in the driver
> by noticing it wraps at that length, but if it changes there will be
> problems.
>
> DESCRIPTION
>
> those commands are used in Marvell speck applicaion called wlanconfig.
>
> ===========
> rdmac
> rdbbp
> rdrf
>         These commands are used to read the MAC, BBP and RF registers
from the
>         card.  These commands take one parameter that specifies the
offset
>         location that is to be read.  This parameter can be specified
either in
>         decimal or in hexadecimal (by preceding the number with a
"0x").
>
>         Usage:
>                 wlanconfig ethX rdmac 0xa123
>                 wlanconfig ethX rdbbp 0x0123
>                 wlanconfig ethX rdrf 0x0123
>
> wrmac
> wrbbp
> wrrf
>         These commands are used to write the MAC, BBP and RF registers
in the
>         card.  These commands take two parameters that specify the
offset
>         location and the value that is to be written. This parameters
can be
>         specified either in decimal or in hexadecimal (by preceding
the number
>         with a "0x").
>
>         Usage:
>                 wlanconfig ethX wrmac 0xa123 0xaa
>                 wlanconfig ethX wrbbp 0x0123 0xaa
>                 wlanconfig ethX wrrf 0x0123 0xaa
>
>
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev
>


-- 
Javier Cardona
cozybit Inc.
p 415 974 6770
f 415 974 6771
c 415 630 0627
e javier at cozybit.com


From marcelo at kvack.org  Thu Nov 16 17:46:44 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 16 Nov 2006 20:46:44 -0200
Subject: getscanlist command redundant?
In-Reply-To: <1163682110.2889.16.camel@localhost.localdomain>
References: <20061116052602.GA2189@dmt>
	<1163682110.2889.16.camel@localhost.localdomain>
Message-ID: <20061116224644.GA18538@dmt>

On Thu, Nov 16, 2006 at 08:01:50AM -0500, Dan Williams wrote:
> On Thu, 2006-11-16 at 03:26 -0200, Marcelo Tosatti wrote:
> > Ronak,
> > 
> > wlanconfig contains the "extscan/getscanlist" commands:
> > 
> > extscan
> >         This command is used to do a specific scan.
> > 
> >         Usage: wlanconfig ethX extscan <SSID>
> > 
> >         Example:
> >                 wlanconfig ethX extscan LINKSYS-AP
> > 
> >         To see the results of use getscanlist command.
> > 
> > getscanlist
> >         This command is used to get the scan results.
> > 
> >         Usage: wlanconfig ethX getscanlist
> > 
> >         Example:
> >                 wlanconfig ethX getscanlist
> > 
> > What is the purpose of the extscan command? One can achieve same results
> > by doing a "iwlist ethX scan" and looking for a specific SSID, right? Or
> > am I missing something? 
> 
> Likely, yes.  iwlist doesn't let you scan for a particular SSID at all
> at this time, but the SIOCSIWSCAN handler does allow this, and drivers
> like the IPW cards implement the specific-SSID scan option.  We should
> too if we don't already.

I still fail to see the purpose of a specific SSID scan? Like I said, one can simply
scan all available SSID's and look for a particular one in that list.

include/linux/wireless.h shows:
        /*
         * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
         * the current ESSID. This allows scan requests for specific ESSID
         * without having to change the current ESSID and potentially breaking
         * the current association.
         */
        __u8            essid[IW_ESSID_MAX_SIZE];

The only scenario that I see it making sense is where a "global" scan
does not show a particular ESSID, where a specific one does. I wonder if
that can ever happen.

For now I'll just convert the specific SSID scan to debugfs (since as
you mentioned iwlist does not support it yet).

> Other than that, there seems to be some redundancy here.
> 
> dan
> 
> > And about "getscanlist", I don't see how it provides any additional
> > information other than "iwlist ethX scan" and "getscantable" ?
> > 
> > -bash-3.1# ./wlanconfig eth0 getscanlist
> > Driver build with Wireless Extension 21
> > 
> > BSSID:   00:13:46:36:EB:48
> > SSID:    ult
> > NetMode: infra
> > Quality: 216
> > Privacy: disabled
> > 
> > No of AP's = 1
> > 
> > Thanks
> > 
> > _______________________________________________
> > libertas-dev mailing list
> > libertas-dev at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/libertas-dev


From frankh at marvell.com  Thu Nov 16 18:03:24 2006
From: frankh at marvell.com (Frank Huang)
Date: Thu, 16 Nov 2006 15:03:24 -0800
Subject: getscanlist command redundant?
Message-ID: <63F3143EF3AB624D859BA91B48A9F89B02844BBE@msiexch01.marvell.com>


Marcelo.

Here is the difference between specific SCAN and broadcast SCAN:

In specific scan issued through wlanconfig, the SSID specified by user
will be included in probe request (this is done by firmware). This could
solve the problem for the AP which has hidden SSID feature enabled.

In broadcast SCAN issued through "iwlist", the SSID in probe request
will be broadcast SSID which length is 0. The AP with hidden SSID
feature enabled will not respond this probe request. So the scan by
"iwlist" can not find those APs which have hidden SSID feature enabled.

Regards,

Frank

-----Original Message-----
From: libertas-dev-bounces at lists.infradead.org
[mailto:libertas-dev-bounces at lists.infradead.org] On Behalf Of Marcelo
Tosatti
Sent: Thursday, November 16, 2006 2:47 PM
To: Dan Williams
Cc: Marcelo Tosatti; Ronak Chokshi; Alan Cunningham;
libertas-dev at lists.infradead.org
Subject: Re: getscanlist command redundant?

On Thu, Nov 16, 2006 at 08:01:50AM -0500, Dan Williams wrote:
> On Thu, 2006-11-16 at 03:26 -0200, Marcelo Tosatti wrote:
> > Ronak,
> > 
> > wlanconfig contains the "extscan/getscanlist" commands:
> > 
> > extscan
> >         This command is used to do a specific scan.
> > 
> >         Usage: wlanconfig ethX extscan <SSID>
> > 
> >         Example:
> >                 wlanconfig ethX extscan LINKSYS-AP
> > 
> >         To see the results of use getscanlist command.
> > 
> > getscanlist
> >         This command is used to get the scan results.
> > 
> >         Usage: wlanconfig ethX getscanlist
> > 
> >         Example:
> >                 wlanconfig ethX getscanlist
> > 
> > What is the purpose of the extscan command? One can achieve same
results
> > by doing a "iwlist ethX scan" and looking for a specific SSID,
right? Or
> > am I missing something? 
> 
> Likely, yes.  iwlist doesn't let you scan for a particular SSID at all
> at this time, but the SIOCSIWSCAN handler does allow this, and drivers
> like the IPW cards implement the specific-SSID scan option.  We should
> too if we don't already.

I still fail to see the purpose of a specific SSID scan? Like I said,
one can simply
scan all available SSID's and look for a particular one in that list.

include/linux/wireless.h shows:
        /*
         * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of
using
         * the current ESSID. This allows scan requests for specific
ESSID
         * without having to change the current ESSID and potentially
breaking
         * the current association.
         */
        __u8            essid[IW_ESSID_MAX_SIZE];

The only scenario that I see it making sense is where a "global" scan
does not show a particular ESSID, where a specific one does. I wonder if
that can ever happen.

For now I'll just convert the specific SSID scan to debugfs (since as
you mentioned iwlist does not support it yet).

> Other than that, there seems to be some redundancy here.
> 
> dan
> 
> > And about "getscanlist", I don't see how it provides any additional
> > information other than "iwlist ethX scan" and "getscantable" ?
> > 
> > -bash-3.1# ./wlanconfig eth0 getscanlist
> > Driver build with Wireless Extension 21
> > 
> > BSSID:   00:13:46:36:EB:48
> > SSID:    ult
> > NetMode: infra
> > Quality: 216
> > Privacy: disabled
> > 
> > No of AP's = 1
> > 
> > Thanks
> > 
> > _______________________________________________
> > libertas-dev mailing list
> > libertas-dev at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/libertas-dev

_______________________________________________
libertas-dev mailing list
libertas-dev at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev


From marcelo at kvack.org  Thu Nov 16 18:23:52 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 16 Nov 2006 21:23:52 -0200
Subject: getscanlist command redundant?
In-Reply-To: <D1575D47310FC94D902C8675241E8E3E02734190@msiexch01.marvell.com>
References: <D1575D47310FC94D902C8675241E8E3E02734190@msiexch01.marvell.com>
Message-ID: <20061116232352.GA20623@dmt>

On Thu, Nov 16, 2006 at 10:04:13AM -0800, Ronak Chokshi wrote:
> Dan and Marcelo,
> Your comments are pretty much accurate. extscan is used to scan for a
> particular SSID and getscanlist is actually is get the latest scan
> results from the scan buffers in the driver. Unlike, 'iwlist ethX scan',
> issuing getscanlist does not really issue a scan - it just gets the
> latest scan results from the drivers.
> 
> As you can probably envision, these commands are used for roaming use
> cases. For example, application would use the getscanlist to get the
> latest set of probe responses or would use the extscan to actually scan
> for one particular AP.

Ronak,

What is the functional difference between getscanlist and getscantable? 

They appear to provide the same information to me.

Thanks


From frankh at marvell.com  Thu Nov 16 18:36:04 2006
From: frankh at marvell.com (Frank Huang)
Date: Thu, 16 Nov 2006 15:36:04 -0800
Subject: getscanlist command redundant?
Message-ID: <63F3143EF3AB624D859BA91B48A9F89B02844BF3@msiexch01.marvell.com>

Marcelo,

getscanlist will get same result as "iwlist ethx scan" except that
"iwlist ethX scan" will trigger scanning before result is returned.

getscantable could get more information (e.g. TSF) than getscanlist. The
major purpose is for Roaming and CCX, as what Ronak mentioned early.

Regards,

Frank
-----Original Message-----
From: libertas-dev-bounces at lists.infradead.org
[mailto:libertas-dev-bounces at lists.infradead.org] On Behalf Of Marcelo
Tosatti
Sent: Thursday, November 16, 2006 3:24 PM
To: Ronak Chokshi
Cc: Dan Williams; Marcelo Tosatti; Alan Cunningham;
libertas-dev at lists.infradead.org
Subject: Re: getscanlist command redundant?

On Thu, Nov 16, 2006 at 10:04:13AM -0800, Ronak Chokshi wrote:
> Dan and Marcelo,
> Your comments are pretty much accurate. extscan is used to scan for a
> particular SSID and getscanlist is actually is get the latest scan
> results from the scan buffers in the driver. Unlike, 'iwlist ethX
scan',
> issuing getscanlist does not really issue a scan - it just gets the
> latest scan results from the drivers.
> 
> As you can probably envision, these commands are used for roaming use
> cases. For example, application would use the getscanlist to get the
> latest set of probe responses or would use the extscan to actually
scan
> for one particular AP.

Ronak,

What is the functional difference between getscanlist and getscantable? 

They appear to provide the same information to me.

Thanks

_______________________________________________
libertas-dev mailing list
libertas-dev at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev


From dwmw2 at infradead.org  Thu Nov 16 19:22:52 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Fri, 17 Nov 2006 08:22:52 +0800
Subject: getscanlist command redundant?
In-Reply-To: <20061116224644.GA18538@dmt>
References: <20061116052602.GA2189@dmt>
	<1163682110.2889.16.camel@localhost.localdomain>
	<20061116224644.GA18538@dmt>
Message-ID: <1163722972.21366.199.camel@shinybook.infradead.org>

On Thu, 2006-11-16 at 20:46 -0200, Marcelo Tosatti wrote:
> I still fail to see the purpose of a specific SSID scan? Like I said, one can simply
> scan all available SSID's and look for a particular one in that list.

Can't you do an active scan for a specific SSID, which will show results
even when a passive scan would not? If the AP is not broadcasting?

-- 
dwmw2



From marcelo at kvack.org  Thu Nov 16 20:41:53 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 16 Nov 2006 23:41:53 -0200
Subject: getscanlist command redundant?
In-Reply-To: <63F3143EF3AB624D859BA91B48A9F89B02844BF3@msiexch01.marvell.com>
References: <63F3143EF3AB624D859BA91B48A9F89B02844BF3@msiexch01.marvell.com>
Message-ID: <20061117014152.GA4331@dmt>

On Thu, Nov 16, 2006 at 03:36:04PM -0800, Frank Huang wrote:
> Marcelo,
> 
> getscanlist will get same result as "iwlist ethx scan" except that
> "iwlist ethX scan" will trigger scanning before result is returned.
> 
> getscantable could get more information (e.g. TSF) than getscanlist. The
> major purpose is for Roaming and CCX, as what Ronak mentioned early.

OK, I've added quality information to getscantable as follows:

-bash-3.1# cat /mnt/libertas_wireless/eth0/getscantable
------------------------------------------------------------------------------
# | ch  | ss  |       bssid       |   cap    |    TSF   | Qual | SSID
------------------------------------------------------------------------------
00| 003 | 039 | 02:16:6f:bb:5e:17 | 0022-A   | aaad1fc4ef | 217 | mynode
01| 006 | 040 | 00:13:46:36:eb:48 | 0401-I   | aaad23637b | 216 | default

-bash-3.1# /root/wlanconfig eth0 getscanlist
Driver build with Wireless Extension 21

BSSID:   02:16:6F:BB:5E:17
SSID:    de
NetMode: ad-hoc
Quality: 217
Privacy: disabled

BSSID:   00:13:46:36:EB:48
SSID:    ult
NetMode: infra
Quality: 216
Privacy: disabled

No of AP's = 2


Privacy is shown as a "P" flag in the "cap" field, when available.

This makes "getscanlist" redundant - it will die together with
wlanconfig. 

Any complaints or comments with reference to that?




From dcbw at redhat.com  Thu Nov 16 21:20:14 2006
From: dcbw at redhat.com (Dan Williams)
Date: Thu, 16 Nov 2006 21:20:14 -0500
Subject: getscanlist command redundant?
In-Reply-To: <1163722972.21366.199.camel@shinybook.infradead.org>
References: <20061116052602.GA2189@dmt>
	<1163682110.2889.16.camel@localhost.localdomain>
	<20061116224644.GA18538@dmt>
	<1163722972.21366.199.camel@shinybook.infradead.org>
Message-ID: <1163730014.2888.4.camel@localhost.localdomain>

On Fri, 2006-11-17 at 08:22 +0800, David Woodhouse wrote:
> On Thu, 2006-11-16 at 20:46 -0200, Marcelo Tosatti wrote:
> > I still fail to see the purpose of a specific SSID scan? Like I said, one can simply
> > scan all available SSID's and look for a particular one in that list.
> 
> Can't you do an active scan for a specific SSID, which will show results
> even when a passive scan would not? If the AP is not broadcasting?

Right; a specific SSID scan actually sends Probe frames out with that
SSID in the frame, which the AP of that SSID is required to respond to.
A passive scan does not do this because it's passive.  And for a
non-SSID specific Probe frame, I'm not sure all APs that hear it are
required to respond, whereas I'm fairly sure they if they see their own
SSID in the Probe request.

So it does have a pretty important use.

Dan



From marcelo at kvack.org  Sun Nov 19 00:29:36 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Sun, 19 Nov 2006 03:29:36 -0200
Subject: [PATCH] convert setuserscan to debugfs
Message-ID: <20061119052936.GA8783@dmt>

Guys,

I've converted setuserscan to debugfs interface. 

Would appreciate if you could test it and confirm that its working appropriately, all you have 
to do is:

# mount -t debugfs none /mnt
# echo "setuserscan parm" > /mnt/libertas_wireless/eth0/setuserscan

"setuserscan parm" accepts the exact same syntax as the "wlanconfig" setuserscan parameter.

c43fdd2363870e5ab09d92920708668435e4a607
diff --git a/drivers/net/wireless/libertas/wlan_debugfs.c b/drivers/net/wireless/libertas/wlan_debugfs.c
index 020e70a..17128d0 100644
--- a/drivers/net/wireless/libertas/wlan_debugfs.c
+++ b/drivers/net/wireless/libertas/wlan_debugfs.c
@@ -218,6 +218,195 @@ out_unlock:
 	return count;
 }
 
+int libertas_parse_chan(char *buf, size_t count,
+			struct wlan_ioctl_user_scan_cfg *scan_cfg, int dur)
+{
+	char *start, *end, *hold, *str;
+	int i = 0;
+
+	start = strstr(buf, "chan=");
+	if (!start)
+		return -EINVAL;
+	start += 5;
+	end = strstr(start, " ");
+	if (!end)
+		end = buf + count;
+	hold = kzalloc((end - start)+1, GFP_KERNEL);
+	if (!hold)
+		return -ENOMEM;
+	strncpy(hold, start, end - start);
+	hold[(end-start)+1] = '\0';
+	while(hold && (str = strsep(&hold, ","))) {
+		int chan;
+		char band, passive = 0;
+		sscanf(str, "%d%c%c", &chan, &band, &passive);
+		scan_cfg->chanList[i].chanNumber = chan;
+		scan_cfg->chanList[i].scanType = passive ? 1 : 0;
+		if (band == 'b' || band == 'g')
+			scan_cfg->chanList[i].radioType = 0;
+		else if (band == 'a')
+			scan_cfg->chanList[i].radioType = 1;
+
+		scan_cfg->chanList[i].scanTime = dur;
+		i++;
+	}
+
+	kfree(hold);
+	return i;
+}
+
+static void libertas_parse_bssid(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold;
+	unsigned int mac[ETH_ALEN];
+	int i;
+	
+	hold = strstr(buf, "bssid=");
+	if (!hold)
+		return;
+	hold += 6;
+	sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3, 
+			mac+4, mac+5);
+	for(i=0;i<ETH_ALEN;i++)
+		scan_cfg->specificBSSID[i] = mac[i];
+}
+
+static void libertas_parse_ssid(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold, *end;
+	ssize_t size;
+
+	hold = strstr(buf, "ssid=");
+	if (!hold)
+		return;
+	hold += 5;
+	end = strstr(hold, " ");
+	if (!end)
+		end = buf + count - 1;
+
+	size = min(IW_ESSID_MAX_SIZE, end - hold);
+	strncpy(scan_cfg->specificSSID, hold, size);
+
+	return;
+}	
+
+static void libertas_parse_keep(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold;
+	int val;
+
+	hold = strstr(buf, "keep=");
+	if (!hold)
+		return;
+	hold += 5;
+	sscanf(hold, "%d", &val);
+
+	if (val != 0)
+		val = 1;
+
+	scan_cfg->keepPreviousScan = val;
+	return;
+}
+
+static int libertas_parse_dur(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold;
+	int val;
+
+	hold = strstr(buf, "dur=");
+	if (!hold)
+		return 0;
+	hold += 4;
+	sscanf(hold, "%d", &val);
+
+	return val;
+}
+
+static void libertas_parse_probes(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold;
+	int val;
+
+	hold = strstr(buf, "probes=");
+	if (!hold)
+		return;
+	hold += 7;
+	sscanf(hold, "%d", &val);
+
+	scan_cfg->numProbes = val;
+
+	return;
+}
+
+static void libertas_parse_type(char *buf, size_t count,
+                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+{
+	char *hold;
+	int val;
+
+	hold = strstr(buf, "type=");
+	if (!hold)
+		return;
+	hold += 5;
+	sscanf(hold, "%d", &val);
+
+	/* type=1,2 or 3 */
+	if (val < 1 || val > 3)
+		return;
+
+	scan_cfg->bssType = val;
+	
+	return;
+}
+
+static ssize_t libertas_setuserscan(struct file *file, 
+				    const char __user *userbuf,
+				    size_t count, loff_t *ppos)
+{
+	wlan_private *priv = file->private_data;
+	char *buf = big_buffer;
+	ssize_t res, buf_size;
+	struct wlan_ioctl_user_scan_cfg *scan_cfg;
+	union iwreq_data wrqu;
+	int dur;
+
+	scan_cfg = kzalloc(sizeof(struct wlan_ioctl_user_scan_cfg), GFP_KERNEL);
+	if (!scan_cfg)
+		return -ENOMEM;
+
+	down(&big_buffer_sem);
+	buf_size = min(count, sizeof(big_buffer) - 1);
+	if (copy_from_user(buf, userbuf, buf_size)) {
+		res = -EFAULT;
+		goto out_unlock;
+	}
+
+	scan_cfg->bssType = WLAN_SCAN_BSS_TYPE_ANY;
+
+	dur = libertas_parse_dur(buf, count, scan_cfg);
+	libertas_parse_chan(buf, count, scan_cfg, dur);
+	libertas_parse_bssid(buf, count, scan_cfg);
+	libertas_parse_ssid(buf, count, scan_cfg);
+	libertas_parse_keep(buf, count, scan_cfg);
+	libertas_parse_probes(buf, count, scan_cfg);
+	libertas_parse_type(buf, count, scan_cfg);
+
+	wlan_scan_networks(priv, scan_cfg);
+
+	memset(&wrqu, 0x00, sizeof(union iwreq_data));
+	wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
+
+out_unlock:
+	up(&big_buffer_sem);
+	kfree(scan_cfg);
+	return count;
+}
+
 
 static struct file_operations libertas_devinfo_fops = { 
 	.owner = THIS_MODULE,
@@ -246,6 +435,12 @@ static struct file_operations libertas_e
 	.write = libertas_extscan,
 };
 
+static struct file_operations libertas_setuserscan_fops = { 
+	.owner = THIS_MODULE,
+	.open = open_file_generic,
+	.write = libertas_setuserscan,
+};
+
 void libertas_debugfs_init(void)
 {
 	if (!libertas_dir)
@@ -293,11 +488,15 @@ void libertas_debugfs_init_one(wlan_priv
 						    priv,
 						    &libertas_extscan_fops);
 
+	priv->debugfs_setuserscan = debugfs_create_file("setuserscan", 0600,
+						    priv->debugfs_dir,
+						    priv,
+						    &libertas_setuserscan_fops);
+
 
 #ifdef PROC_DEBUG
 	libertas_debug_init(priv, dev);
 #endif
-
 exit:
 	return;
 }
@@ -308,6 +507,10 @@ #ifdef PROC_DEBUG
 	debugfs_remove(priv->debugfs_debug);
 #endif
 	debugfs_remove(priv->debugfs_devinfo);
+	debugfs_remove(priv->debugfs_getscantable);
+	debugfs_remove(priv->debugfs_sleepparams);
+	debugfs_remove(priv->debugfs_extscan);
+	debugfs_remove(priv->debugfs_setuserscan);
 	debugfs_remove(priv->debugfs_dir);
 }
 
diff --git a/drivers/net/wireless/libertas/wlan_dev.h b/drivers/net/wireless/libertas/wlan_dev.h
index 1d75139..102e30d 100644
--- a/drivers/net/wireless/libertas/wlan_dev.h
+++ b/drivers/net/wireless/libertas/wlan_dev.h
@@ -175,6 +175,7 @@ struct _wlan_private {
 	struct dentry *debugfs_getscantable;
 	struct dentry *debugfs_sleepparams;
 	struct dentry *debugfs_extscan;
+	struct dentry *debugfs_setuserscan;
 
 	const struct firmware *firmware;
 	struct device *hotplug_device;
diff --git a/drivers/net/wireless/libertas/wlan_ioctl.c b/drivers/net/wireless/libertas/wlan_ioctl.c
index 17ff747..4c84863 100644
--- a/drivers/net/wireless/libertas/wlan_ioctl.c
+++ b/drivers/net/wireless/libertas/wlan_ioctl.c
@@ -2660,15 +2660,6 @@ #define MAX_U16_VAL	65535
 		}
 		break;
 
-	case WLAN_SET_GET_2K:
-		switch ((int)wrq->u.data.flags) {
-		case WLAN_SET_USER_SCAN:
-			ret = libertas_set_user_scan_ioctl(priv, wrq);
-			break;
-		default:
-			ret = -EOPNOTSUPP;
-		}
-		break;
 	default:
 		ret = -EINVAL;
 		break;
diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index 59d6dfd..d820651 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -790,7 +790,7 @@ static int wlan_scan_channel_list(wlan_p
  *
  *  @return              WLAN_STATUS_SUCCESS or < 0 if error
  */
-static int wlan_scan_networks(wlan_private * priv,
+int wlan_scan_networks(wlan_private * priv,
 			      const struct wlan_ioctl_user_scan_cfg * pUserScanIn)
 {
 	wlan_adapter *Adapter = priv->adapter;
diff --git a/drivers/net/wireless/libertas/wlan_scan.h b/drivers/net/wireless/libertas/wlan_scan.h
index da5fd91..ee85385 100644
--- a/drivers/net/wireless/libertas/wlan_scan.h
+++ b/drivers/net/wireless/libertas/wlan_scan.h
@@ -229,6 +229,9 @@ extern int libertas_cmd_80211_scan(wlan_
 extern int libertas_ret_80211_scan(wlan_private * priv,
 				struct HostCmd_DS_COMMAND *resp);
 
+int wlan_scan_networks(wlan_private * priv,
+                const struct wlan_ioctl_user_scan_cfg * pUserScanIn);
+
 struct ifreq;
 
 #ifdef __KERNEL__
diff --git a/drivers/net/wireless/libertas/wlan_wext.c b/drivers/net/wireless/libertas/wlan_wext.c
index 6688731..ff8c3b8 100644
--- a/drivers/net/wireless/libertas/wlan_wext.c
+++ b/drivers/net/wireless/libertas/wlan_wext.c
@@ -1675,18 +1675,6 @@ #endif				/* REASSOCIATION */
 	 IW_PRIV_TYPE_INT | 16,
 	 IW_PRIV_TYPE_INT | 16,
 	 "getrxinfo"},
-
-	{
-	 WLAN_SET_GET_2K,	/* IOCTL : 14 */
-	 IW_PRIV_TYPE_BYTE | 2000,
-	 IW_PRIV_TYPE_BYTE | 2000,
-	 ""},
-
-	{
-	 WLAN_SET_USER_SCAN,
-	 IW_PRIV_TYPE_BYTE | 2000,
-	 IW_PRIV_TYPE_BYTE | 2000,
-	 "setuserscan"},
 };
 
 /** 
diff --git a/drivers/net/wireless/libertas/wlan_wext.h b/drivers/net/wireless/libertas/wlan_wext.h
index 355a67d..f3054a3 100644
--- a/drivers/net/wireless/libertas/wlan_wext.h
+++ b/drivers/net/wireless/libertas/wlan_wext.h
@@ -74,9 +74,6 @@ #define GETLOG_BUFSIZE  300
 
 #define WLANSCAN_TYPE			(WLANIOCTL + 11)
 
-#define WLAN_SET_GET_2K         (WLANIOCTL + 13)
-#define WLAN_SET_USER_SCAN              1
-
 #define WLAN_SETNONE_GETONEINT		(WLANIOCTL + 15)
 #define WLANGETREGION				1
 #define WLAN_GET_LISTEN_INTERVAL		2


From marcelo at kvack.org  Wed Nov 29 02:11:09 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 29 Nov 2006 05:11:09 -0200
Subject: writing to mac,bbp or rf registers not supported?
Message-ID: <20061129071109.GA19845@dmt>

Hi Ronak,

Is the write operation to the MAC, BBP or RF registers supported?

Apparently it does not work, since the written values are not retained:

-bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
Driver build with Wireless Extension 21
MAC[0x0000] = 0x0033fa05
-bash-3.1# /home/marcelo/wlanconfig eth0 wrmac 0x0 0xffffffff
Driver build with Wireless Extension 21
Writing[ 2255.598546] 00  MAC Register 0x01 0000 with 0xffff00 ffff
00 00 ff ff ff ff
MAC[0x0000] = 0xffffffff
-bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
Driver build with Wireless Extension 21
MAC[0x0000] = 0x0033fa05

Any clues are appreciated.



From marcelo at kvack.org  Wed Nov 29 03:05:06 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 29 Nov 2006 06:05:06 -0200
Subject: Updated README reflecting ethtool/debugfs interface
Message-ID: <20061129080506.GA20895@dmt>

Hi folks,


Follows the updated README which contains usage information on the
debugfs/ethtool interfaces.

If there are no objections I will remove the "wlanconfig" tool (now
fully replaced by mentioned interfaces, as far as I can tell).

TIA

=========================
4) ETHTOOL
=========================


Use the -i option to retrieve version information from the driver.

# ethtool -i eth0
driver: libertas
version: COMM-USB8388-318.p4
firmware-version: 5.110.7
bus-info:

Use the -e option to read the EEPROM contents of the card.

	Usage:
	ethtool -e ethX [raw on|off] [offset N] [length N]

       -e     retrieves and prints an EEPROM dump for the  specified  ethernet
              device.   When raw is enabled, then it dumps the raw EEPROM data
              to stdout. The length and offset parameters allow  dumping  cer-
              tain portions of the EEPROM.  Default is to dump the entire EEP-
              ROM.

# ethtool -e eth0 offset 0 length 16
Offset          Values
------          ------
0x0000          38 33 30 58 00 00 34 f4 00 00 10 00 00 c4 17 00

========================
5) DEBUGFS COMMANDS
========================

those commands are used via debugfs interface

===========
rdmac 
rdbbp
rdrf	
	These commands are used to read the MAC, BBP and RF registers from the 
	card.  These commands take one parameter that specifies the offset 
	location that is to be read.  This parameter must be specified in 
	hexadecimal (its possible to preceed preceding the number with a "0x").

	Path: /debugfs/libertas_wireless/ethX/registers/
		
	Usage:	
		echo "0xa123" > rdmac ; cat rdmac
		echo "0xa123" > rdbbp ; cat rdbbp
		echo "0xa123" > rdrf ; cat rdrf
wrmac 
wrbbp
wrrf	
	These commands are used to write the MAC, BBP and RF registers in the 
	card.  These commands take two parameters that specify the offset 
	location and the value that is to be written. This parameters must 
	be specified in hexadecimal (its possible to preceed the number 
	with a "0x").
	
	Usage:
		echo "0xa123 0xaa" > wrmac
		echo "0xa123 0xaa" > wrbbp
		echo "0xa123 0xaa" > wrrf

sleepparams       
	This command is used to set the sleepclock configurations

	Path: /debugfs/libertas_wireless/ethX/
	
	Usage:
		cat sleepparams: reads the current sleepclock configuration

		echo "p1 p2 p3 p4 p5 p6" > sleepparams: writes the sleepclock configuration.
			
		where:
			p1 is Sleep clock error in ppm (0-65535)
			p2 is Wakeup offset in usec (0-65535)
			p3 is Clock stabilization time in usec (0-65535)
			p4 is Control periodic calibration (0-2)
			p5 is Control the use of external sleep clock (0-2)
			p6 is reserved for debug (0-65535)

subscribed_events

	The subscribed_events directory contains the interface for the
	subscribed events API.

	Path: /debugfs/libertas_wireless/ethX/subscribed_events/

	Each event is represented by a filename. Each filename consists of the
	following three fields:
	Value Frequency Subscribed

	To read the current values for a given event, do:
		cat event
	To set the current values, do:
		echo "60 2 1" > event

	Frequency field specifies the reporting frequency for this event.
	If it is set to 0, then the event is reported only once, and then
	automatically unsubscribed. If it is set to 1, then the event is
	reported every time it occurs. If it is set to N, then the event is
	reported every Nth time it occurs.

	beacon_missed 
	Value field specifies the number of consecutive missing beacons which
	triggers the LINK_LOSS event. This event is generated only once after
	which the firmware resets its state. At initialization, the LINK_LOSS
	event is subscribed by default. The default value of MissedBeacons is
	60.

	failure_count
	Value field specifies the consecutive failure count threshold which
	triggers the generation of the MAX_FAIL event. Once this event is
	generated, the consecutive failure count is reset to 0. 
	At initialization, the MAX_FAIL event is NOT subscribed by
	default.

	high_rssi
	This event is generated when the average received RSSI in beacons goes
	above a threshold, specified by Value.

	low_rssi
	This event is generated when the average received RSSI in beacons goes
	below a threshold, specified by Value.

	high_snr
	This event is generated when the average received SNR in beacons goes
	above a threshold, specified by Value.

	low_snr
	This event is generated when the average received SNR in beacons goes
	below a threshold, specified by Value.

extscan
	This command is used to do a specific scan.

	Path: /debugfs/libertas_wireless/ethX/
	
	Usage: echo "SSID" > extscan

	Example:
		echo "LINKSYS-AP" > extscan

	To see the results of use getscantable command.

getscantable

	Display the current contents of the driver scan table (ie. get the
	scan results).

	Path: /debugfs/libertas_wireless/ethX/

	Usage:
		cat getscantable

setuserscan
	Initiate a customized scan and retrieve the results


	Path: /debugfs/libertas_wireless/ethX/

    Usage:
       echo "[ARGS]" > setuserscan

         where [ARGS]: 

      chan=[chan#][band][mode] where band is [a,b,g] and mode is 
                               blank for active or 'p' for passive
      bssid=xx:xx:xx:xx:xx:xx  specify a BSSID filter for the scan
      ssid="[SSID]"            specify a SSID filter for the scan
      keep=[0 or 1]            keep the previous scan results (1), discard (0)
      dur=[scan time]          time to scan for each channel in milliseconds
      probes=[#]               number of probe requests to send on each chan
      type=[1,2,3]             BSS type: 1 (Infra), 2(Adhoc), 3(Any)
 
    Any combination of the above arguments can be supplied on the command line.
      If the chan token is absent, a full channel scan will be completed by 
      the driver.  If the dur or probes tokens are absent, the driver default
      setting will be used.  The bssid and ssid fields, if blank, 
      will produce an unfiltered scan. The type field will default to 3 (Any)
      and the keep field will default to 0 (Discard).

    Examples:
    1) Perform an active scan on channels 1, 6, and 11 in the 'g' band:
            echo "chan=1g,6g,11g" > setuserscan

    2) Perform a passive scan on channel 11 for 20 ms:
            echo "chan=11gp dur=20" > setuserscan

    3) Perform an active scan on channels 1, 6, and 11; and a passive scan on
       channel 36 in the 'a' band:
	
            echo "chan=1g,6g,11g,36ap" > setuserscan

    4) Perform an active scan on channel 6 and 36 for a specific SSID:
            echo "chan=6g,36a ssid="TestAP"" > setuserscan

    5) Scan all available channels (B/G, A bands) for a specific BSSID, keep
       the current scan table intact, update existing or append new scan data:
            echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan

    6) Scan channel 6, for all infrastructure networks, sending two probe 
       requests.  Keep the previous scan table intact. Update any duplicate
       BSSID/SSID matches with the new scan data:
            echo "chan=6g type=1 probes=2 keep=1" > 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.

==============================================================================


From rchokshi at marvell.com  Wed Nov 29 08:05:33 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Wed, 29 Nov 2006 05:05:33 -0800
Subject: writing to mac,bbp or rf registers not supported?
Message-ID: <D1575D47310FC94D902C8675241E8E3E02816EF5@msiexch01.marvell.com>

Marcelo,
Have you tried writing to any other MAC, BBP, RF register? What are the
other registers that you have tried writing?

Ronak

-----Original Message-----
From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
Sent: Tuesday, November 28, 2006 11:11 PM
To: Ronak Chokshi; Alan Cunningham
Cc: libertas-dev at lists.infradead.org
Subject: writing to mac,bbp or rf registers not supported?

Hi Ronak,

Is the write operation to the MAC, BBP or RF registers supported?

Apparently it does not work, since the written values are not retained:

-bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
Driver build with Wireless Extension 21
MAC[0x0000] = 0x0033fa05
-bash-3.1# /home/marcelo/wlanconfig eth0 wrmac 0x0 0xffffffff
Driver build with Wireless Extension 21
Writing[ 2255.598546] 00  MAC Register 0x01 0000 with 0xffff00 ffff
00 00 ff ff ff ff
MAC[0x0000] = 0xffffffff
-bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
Driver build with Wireless Extension 21
MAC[0x0000] = 0x0033fa05

Any clues are appreciated.



From marcelo at kvack.org  Thu Nov 30 13:08:50 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 30 Nov 2006 16:08:50 -0200
Subject: writing to mac,bbp or rf registers not supported?
In-Reply-To: <D1575D47310FC94D902C8675241E8E3E02816EF5@msiexch01.marvell.com>
References: <D1575D47310FC94D902C8675241E8E3E02816EF5@msiexch01.marvell.com>
Message-ID: <20061130180849.GA3593@dmt>


On Wed, Nov 29, 2006 at 05:05:33AM -0800, Ronak Chokshi wrote:
> Marcelo,
> Have you tried writing to any other MAC, BBP, RF register? What are the
> other registers that you have tried writing?

Ronak,

I've only tried these three. As far as I can tell there is no support
for any other register access.

There are some offsets of the BBP register which retain written values
(don't recall which offset, board is temporarily unavailable).

Were written values to MAC register supposed to be retained?

One point here is that the meaning of these registers is not documented
anywhere, which is unfortunate (ie. no one except Marvell can easily
understand whats going on).

These issues were present before, and this is a rather specialized
debugging feature, so I don't consider it high priority, but still.

> Ronak
> 
> -----Original Message-----
> From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
> Sent: Tuesday, November 28, 2006 11:11 PM
> To: Ronak Chokshi; Alan Cunningham
> Cc: libertas-dev at lists.infradead.org
> Subject: writing to mac,bbp or rf registers not supported?
> 
> Hi Ronak,
> 
> Is the write operation to the MAC, BBP or RF registers supported?
> 
> Apparently it does not work, since the written values are not retained:
> 
> -bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
> Driver build with Wireless Extension 21
> MAC[0x0000] = 0x0033fa05
> -bash-3.1# /home/marcelo/wlanconfig eth0 wrmac 0x0 0xffffffff
> Driver build with Wireless Extension 21
> Writing[ 2255.598546] 00  MAC Register 0x01 0000 with 0xffff00 ffff
> 00 00 ff ff ff ff
> MAC[0x0000] = 0xffffffff
> -bash-3.1# /home/marcelo/wlanconfig eth0 rdmac 0x0
> Driver build with Wireless Extension 21
> MAC[0x0000] = 0x0033fa05
> 
> Any clues are appreciated.


From marcelo at kvack.org  Thu Nov 30 22:29:13 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Fri, 1 Dec 2006 01:29:13 -0200
Subject: help: association failure
Message-ID: <20061201032913.GA8546@dmt>


Hi,

I'm running into a problem with test-A board association and clues are welcome.

Note that association with the exact same test-A board and this very same
Linksys AP used to work in the past. There were no significant changes
in the AP as far as I can tell.

Also note that an ipw2200 driven ThinkPad and an iMac associate normally
to said AP.

-bash-3.1# iwlist eth0 scan
eth0      Scan completed :
          Cell 01 - Address: 00:0C:41:F5:4D:26
                    ESSID:"linksys"
                    Mode:Managed
                    Frequency:2.437 GHz (Channel 6)
                    Quality=46/100  Signal level=-87 dBm  Noise level=-96 dBm
                    Encryption key:off
                    Bit Rates:48 Mb/s
          Cell 02 - Address: 00:0F:3D:66:BE:36
                    ESSID:"default"
                    Mode:Managed
                    Frequency:2.437 GHz (Channel 6)
                    Quality=33/100  Signal level=-92 dBm  Noise level=-96 dBm
                    Encryption key:off
                    Bit Rates:54 Mb/s
          Cell 03 - Address: 00:12:17:00:EA:06
                    ESSID:"casa"
                    Mode:Managed
                    Frequency:2.447 GHz (Channel 8)
                    Quality=52/100  Signal level=-84 dBm  Noise level=-96 dBm
                    Encryption key:off
                    Bit Rates:11 Mb/s

-bash-3.1# iwconfig eth0 essid linksys
-bash-3.1# iwconfig eth0 ap 00:0C:41:F5:4D:26
-bash-3.1# iwconfig eth0
eth0      MRVL-USB8388  ESSID:""
          Mode:Managed  Frequency:2.437 GHz  Access Point: Not-Associated
          Bit Rate:1 Mb/s   Tx-Power=13 dBm
          Retry limit:8   RTS thr=2347 B   Fragment thr=2346 B
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Both essid and AP association fail similarly.

Looking at the log, we see the association request:

DNLD_CMD: Sent command 0x50 @ 1
DNLD_CMD: Command: 50 00 3f 00
b9 01 00 00 00 0c 41 f5 4d 26 01 04 0a 00 00 00 00 00 00 07 00 6c 69 6e 6b 73 79
 73 03 00 01 00 06 04 00 06 00 00 00 00 00 00 00 01 00 0c 00 82 84 8b 96 0c 12 1
8 24 30 48 60 6c

and the failed association response:

CMD_RESP: @ 1289479
CMD_RESP:: 12 80 0e 00 b9 01 00 00 01 04 04 00 05 c0
CMD_RESP: 8012 Result: 0 Length: 14
ASSOC_RESP: Association Failed, status code = 4 

Using another AP (which is from an unknown neighbour), I get:

Association request:
DNLD_CMD: Sent command 0x50 @ 1
DNLD_CMD: Command: 50 00 34 00
76 01 00 00 00 12 17 00 ea 06 05 00 0a 00 00 00 00 00 00 04 00 63 61 73 61 03 00
 01 00 08 04 00 06 00 00 00 00 00 00 00 01 00 04 00 82 84 8b 96

Association response:
CMD_RESP: @ 1196977
CMD_RESP:: 12 80 0e 00 76 01 00
CMD_RESP: 8012 Result: 0 Length : 14
ASSOC_RESP: Association Failed, status code = 3

Looking at the IEEE 802.11 standard, association response management frame
status field description:

7.3.1.9 Status Code ?eld

The Status Code ?eld is used in a response management frame to
indicate the success or failure of a requested operation. The length
of the Status Code ?eld is 2 octets. If an operation is successful,
then the status code is set to 0. If an operation results in failure,
the status code indicates a failure cause. The failure cause codes are
de?ned in Table 19.

Table 19?Status codes

         Status code    Meaning
                0       Successful
                1       Unspeci?ed failure
              2?9       Reserved
               10       Cannot support all requested capabilities in the Capability Information ?eld
               11       Reassociation denied due to inability to con?rm that association exists
               12       Association denied due to reason outside the scope of this standard
               13       Responding station does not support the speci?ed authentication algorithm
               14       Received an Authentication frame with authentication transaction sequence number
                        out of expected sequence
               15       Authentication rejected because of challenge failure
               16       Authentication rejected due to timeout waiting for next frame in sequence
               17       Association denied because AP is unable to handle additional associated stations
               18       Association denied due to requesting station not supporting all of the data rates in the
                        BSSBasicRateSet parameter
          19?65 535     Reserved

So the status code response being seen are in the "Reserved" range.

I suppose that "Reserved" range is manufacturer specific?

If so, what could be the meaning for status codes 4 in association
response from Linksys WRT54G and status code 3 in reponse from "unknown
vendor at neighbour".

Some recent driver change could be causing it, should try an older build.

Useful datapoint is that it used to work before with exact same AP!

TIA


