Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [Ilw] Re: Slow throughput on Ultimate-N 6300
From: Steve Freitas @ 2013-07-10  5:56 UTC (permalink / raw)
  To: Grumbach, Emmanuel; +Cc: ilw@linux.intel.com, linux-wireless@vger.kernel.org
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB3019FFE28@HASMSX103.ger.corp.intel.com>

Wonderful, thank you for the tips. I'll wade back into it tomorrow or 
the next day and let you know what I find.

Thank you,

Steve

On 07/09/13 22:55, Grumbach, Emmanuel wrote:
>> Emmanuel,
>>
>> Thank you for your quick response!
>>
>> It is a regression. I regularly had 300 Mbps speeds on this very access point,
>> but it was years ago, in the 2.6 kernel series. However, I believe, from
>> extensive online searches, that Intel has disabled the N functionality in the
>> firmware on Linux, ostensibly until they (you? :-)
>> ) can fix whatever problem they were seeing. With the demise of the Intel
>> Linux Wireless bug tracker, though, public tracking of the bug has been
>> impossible. There are now-dead links to the defunct bug tracker over this
>> very issue.
>>
> 11n hasn't been disabled in firmware, but rather in driver.
> There is a bug we know about the "fail to flush tx fifo" thing that people reports (through mailing list or bugzilla of RedHat).
> Can you please send the output of the kerne log (dmesg)?
>
>> Sadly I only get 2 MByte/s on N, and under 1 MByte/s G.
>>
>> I have not tried another access point in ages. Tired of replacing fried Netgears
>> and Dlinks and Belkins, I've converted all my friends and families to Apple's
>> access points. I'll try to locate something else and see how it goes.
> No need to. If you say that it worked, then it should still work. The issue I was thinking is the way they use some fancy feature of WiFi that no one implements (besides the wifi module of their devices of course).
> Also, can you please try different firmwares from http://wireless.kernel.org/en/users/Drivers/iwlwifi#Download ?
> I wonder if newer firmware has made things worse. You may want to try older firmware.
> To do so, open the tarball from that you'll download and copy iwlwifi-*.ucode to /lib/firmware.


^ permalink raw reply

* RE: [Ilw] Re: Slow throughput on Ultimate-N 6300
From: Grumbach, Emmanuel @ 2013-07-10  5:55 UTC (permalink / raw)
  To: Steve Freitas; +Cc: ilw@linux.intel.com, linux-wireless@vger.kernel.org
In-Reply-To: <51DCF4BF.5010900@newportit.com>

> 
> Emmanuel,
> 
> Thank you for your quick response!
> 
> It is a regression. I regularly had 300 Mbps speeds on this very access point,
> but it was years ago, in the 2.6 kernel series. However, I believe, from
> extensive online searches, that Intel has disabled the N functionality in the
> firmware on Linux, ostensibly until they (you? :-)
> ) can fix whatever problem they were seeing. With the demise of the Intel
> Linux Wireless bug tracker, though, public tracking of the bug has been
> impossible. There are now-dead links to the defunct bug tracker over this
> very issue.
> 

11n hasn't been disabled in firmware, but rather in driver.
There is a bug we know about the "fail to flush tx fifo" thing that people reports (through mailing list or bugzilla of RedHat).
Can you please send the output of the kerne log (dmesg)?

> Sadly I only get 2 MByte/s on N, and under 1 MByte/s G.
> 
> I have not tried another access point in ages. Tired of replacing fried Netgears
> and Dlinks and Belkins, I've converted all my friends and families to Apple's
> access points. I'll try to locate something else and see how it goes.

No need to. If you say that it worked, then it should still work. The issue I was thinking is the way they use some fancy feature of WiFi that no one implements (besides the wifi module of their devices of course).
Also, can you please try different firmwares from http://wireless.kernel.org/en/users/Drivers/iwlwifi#Download ?
I wonder if newer firmware has made things worse. You may want to try older firmware.
To do so, open the tarball from that you'll download and copy iwlwifi-*.ucode to /lib/firmware.

^ permalink raw reply

* Re: [Ilw] Re: Slow throughput on Ultimate-N 6300
From: Steve Freitas @ 2013-07-10  5:44 UTC (permalink / raw)
  To: Grumbach, Emmanuel; +Cc: ilw@linux.intel.com, linux-wireless@vger.kernel.org
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB3019FFDDF@HASMSX103.ger.corp.intel.com>

Emmanuel,

Thank you for your quick response!

It is a regression. I regularly had 300 Mbps speeds on this very access 
point, but it was years ago, in the 2.6 kernel series. However, I 
believe, from extensive online searches, that Intel has disabled the N 
functionality in the firmware on Linux, ostensibly until they (you? :-) 
) can fix whatever problem they were seeing. With the demise of the 
Intel Linux Wireless bug tracker, though, public tracking of the bug has 
been impossible. There are now-dead links to the defunct bug tracker 
over this very issue.

Sadly I only get 2 MByte/s on N, and under 1 MByte/s G.

I have not tried another access point in ages. Tired of replacing fried 
Netgears and Dlinks and Belkins, I've converted all my friends and 
families to Apple's access points. I'll try to locate something else and 
see how it goes.

Thanks again,

Steve

On 07/09/13 22:35, Grumbach, Emmanuel wrote:
>>> I understand that it's well-known that N is broken for Linux on this
>>> wireless chipset. You can add me to the list of those suffering under
>>> it. Can you provide me with a status update on work performed towards
>>> resolution of this issue?
>>>
>>> I'm on Debian unstable, kernel 3.9 amd64, using iwlwifi wireless
>>> firmware version 9.221.4.1 build 25532 on a Thinkpad T410, and I'm
>>> connected to an Apple Airport Extreme base station (3rd generation).
>>>
> Is this a regression?
> Has it worked better before?
>
> Also - did you try another access point? I seem to remember that we have had issues against Apple's access points.


^ permalink raw reply

* RE: [Ilw] Re: Slow throughput on Ultimate-N 6300
From: Grumbach, Emmanuel @ 2013-07-10  5:35 UTC (permalink / raw)
  To: Steve Freitas, ilw@linux.intel.com; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <51DCDD54.9090100@newportit.com>

> > I understand that it's well-known that N is broken for Linux on this
> > wireless chipset. You can add me to the list of those suffering under
> > it. Can you provide me with a status update on work performed towards
> > resolution of this issue?
> >
> > I'm on Debian unstable, kernel 3.9 amd64, using iwlwifi wireless
> > firmware version 9.221.4.1 build 25532 on a Thinkpad T410, and I'm
> > connected to an Apple Airport Extreme base station (3rd generation).
> >

Is this a regression?
Has it worked better before?

Also - did you try another access point? I seem to remember that we have had issues against Apple's access points.

^ permalink raw reply

* RE: [Ilw] Re: Performance regression in firmware-iwlwifi 0.38~bpo70+1
From: Grumbach, Emmanuel @ 2013-07-10  5:32 UTC (permalink / raw)
  To: Ben Hutchings, Intel Linux Wireless
  Cc: debian-backports@lists.debian.org, linux-wireless, Sergey Frolov
In-Reply-To: <1373425655.24446.7.camel@deadeye.wl.decadent.org.uk>

PiBPbiBUdWUsIDIwMTMtMDctMDkgYXQgMTU6MzEgKzAzMDAsIFNlcmdleSBGcm9sb3Ygd3JvdGU6
DQo+ID4gSGVsbG8uDQo+ID4NCj4gPiBJIHdvdWxkIGxpa2UgdG8gcmVwb3J0IGEgcGVyZm9ybWFu
Y2UgcmVncmVzc2lvbiBpbiB0aGUNCj4gPiBmaXJtd2FyZS1pd2x3aWZpIDAuMzh+YnBvNzArMSBw
YWNrYWdlLg0KPiA+IEFmdGVyIGluc3RhbGxpbmcgaXQgYW5kIHJlbG9hZGluZyBpd2x3aWZpIHdp
dGggYSBuZXcgZmlybXdhcmUNCj4gPiBpd2x3aWZpLTYwMDBnMmEtNi51Y29kZSwgbXkgYWRhcHRl
ciAiSW50ZWwgQ29ycG9yYXRpb24gQ2VudHJpbm8NCj4gPiBBZHZhbmNlZC1OIDYyMDUgW1RheWxv
ciBQZWFrXSAocmV2IDM0KSIgY2FuIG1hbmFnZSBvbmx5IGFib3V0IDIwMCBrYi9zDQo+ID4gREwg
c3BlZWQgdG9wcyByZWdhcmRsZXNzIG9mIHBvd2VyIHNhdmluZyBvcHRpb25zLg0KPiANCj4gVGhp
cyBwYWNrYWdlIGhhcyB2ZXJzaW9uIDE4LjE2OC42LjEgb2YgdGhpcyBmaXJtd2FyZS4NCj4gDQo+
ID4gUmV2ZXJ0aW5nIHRvIDAuMzYrd2hlZXp5LjEgYW5kIHJlbG9hZGluZyBtb2R1bGUgd2l0aA0K
PiA+IGl3bHdpZmktNjAwMGcyYS01LnVjb2RlIHJlc29sdmVzIHRoZSBpc3N1ZS4gVGhlIEFQIGlz
IGxvY2F0ZWQgaW4gdGhlDQo+ID4gc2FtZSByb29tLCBpdCdzIGFuIG9sZCAyLjRHaHogMTFnIEFT
VVMgV0wtMzIwZ0UgYWNjZXNzIHBvaW50LA0KPiA+IGNvbmZpZ3VyZWQgd2l0aCB3cGEtcHNrIGVu
Y3J5cHRpb24uDQo+IA0KPiBUaGlzIGhhcyB2ZXJzaW9uIDE3LjE2OC41LjMuDQo+IA0KPiA+IEkg
YW0gdXNpbmcgbGludXgtaW1hZ2UtMy45LTAuYnBvLjEtYW1kNjQga2VybmVsIGZyb20gYmFja3Bv
cnRzLg0KPiANCj4gVGhpcyBpcyBiYXNlZCBvbiBMaW51eCAzLjkuNi4NCj4NCg0KSnVzdCB0byBt
YWtlIHN1cmUgSSBwcm9wZXJseSB1bmRlcnN0YW5kIHdoYXQgeW91IGFyZSBzYXlpbmcgaGVyZTog
b25seSB0aGUgZmlybXdhcmUgaXMgY2hhbmdlZD8gTm90IHRoZSBkcml2ZXI/DQo=

^ permalink raw reply

* Re: Slow throughput on Ultimate-N 6300
From: Steve Freitas @ 2013-07-10  4:04 UTC (permalink / raw)
  To: ilw; +Cc: linux-wireless
In-Reply-To: <51BBF4F1.1050301@newportit.com>

Hello,

I sent this email three weeks ago and have seen no reply. I've checked 
my spam folder. Can anyone answer this email?

Thanks,

Steve

On 06/14/13 22:00, Steve Freitas wrote:
> Hi!
>
> I understand that it's well-known that N is broken for Linux on this 
> wireless chipset. You can add me to the list of those suffering under 
> it. Can you provide me with a status update on work performed towards 
> resolution of this issue?
>
> I'm on Debian unstable, kernel 3.9 amd64, using iwlwifi wireless 
> firmware version 9.221.4.1 build 25532 on a Thinkpad T410, and I'm 
> connected to an Apple Airport Extreme base station (3rd generation).
>
> Thanks,
>
> Steve


^ permalink raw reply

* Re: Performance regression in firmware-iwlwifi 0.38~bpo70+1
From: Ben Hutchings @ 2013-07-10  3:07 UTC (permalink / raw)
  To: Intel Linux Wireless; +Cc: debian-backports, Sergey Frolov, linux-wireless
In-Reply-To: <20130709153104.20718ebb@thinkpad>

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

On Tue, 2013-07-09 at 15:31 +0300, Sergey Frolov wrote:
> Hello.
> 
> I would like to report a performance regression in the
> firmware-iwlwifi 0.38~bpo70+1 package.
> After installing it and reloading iwlwifi with a new firmware
> iwlwifi-6000g2a-6.ucode, my adapter "Intel Corporation Centrino
> Advanced-N 6205 [Taylor Peak] (rev 34)" can manage only about 200 kb/s
> DL speed tops regardless of power saving options.

This package has version 18.168.6.1 of this firmware.

> Reverting to 0.36+wheezy.1 and reloading module with
> iwlwifi-6000g2a-5.ucode resolves the issue. The AP is located in the
> same room, it's an old 2.4Ghz 11g ASUS WL-320gE access point,
> configured with wpa-psk encryption.

This has version 17.168.5.3.

> I am using linux-image-3.9-0.bpo.1-amd64 kernel from backports.

This is based on Linux 3.9.6.

> If you need any more info, please CC me, as I am not subscribed to this
> list.

Do you recognise this bug?  Can you suggest any diagnostic information
Sergey can provide?

Ben.

-- 
Ben Hutchings
It is easier to write an incorrect program than to understand a correct one.

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

^ permalink raw reply

* Re: wl127x: Unable to associate with a WPA2-PSK AP
From: José Miguel Gonçalves @ 2013-07-09 23:59 UTC (permalink / raw)
  To: Arik Nemtsov; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <CA+XVXfd8WouC7UWwD5z=OAMT2AUaU25d13thinjRDe-JpTQCEw@mail.gmail.com>

Hi Arik,

On 09-07-2013 20:10, Arik Nemtsov wrote:
> On Tue, Jul 9, 2013 at 4:22 PM, José Miguel Gonçalves
> <jose.goncalves@inov.pt> wrote:
>> http://pastebin.com/XmEzqjHs
>>
>> The dmesg output with debug mask set to 0x63c20:
>>
>> http://pastebin.com/zGE0Gfp8
>>
>> Note that with debug activated I did not see the driver's "Beacon loss
>> detected" messages.
> You have this line in the log:
> [   72.435000] wlan0: deauthenticated from 88:43:e1:57:79:c0 (Reason: 23)
>
> This means:
> Association request rejected because the information in the Power
> Capability element is
> unacceptable
>
> In other words the AP is disconnecting you since your Tx power is
> inadequate (probably too high?). I'd try to limit it using iw, or just
> set a different regdomain where its limited.
> Also I'd try with a different AP.

I think that return code is a bogus caused by the driver debug code, 
because when I remove all the debug I see a different behaviour, i.e., 
after brief associating with the AP, I see 3 driver messages;

wlcore: Beacon loss detected. roles:0xff

and then receive from wpa_supplicant;

wlan0: CTRL-EVENT-DISCONNECTED bssid=88:43:e1:57:79:c0 reason=4 
locally_generated=1
wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="A. Guidance" 
auth_failures=1 duration=10

and I've not make any mistake on the pre-shared key.

Also I've used this AP for tests of different wireless adapters with 
success. Inclusive have use it with the same hardware platform and same 
kernel and sysapps (ifconfig, iw, wpa_supplicant, etc...) and a TP-Link 
TL-WN722N Wi-Fi adapter (ath9k_htc driver) and had no problems in 
associating that adapter.

Can my problems be related with an inadequate NVS file? I've generated 
it with the calibrate tool from ti-utils and the INI file TQS_D_1.7.ini 
with the command "calibrator plt calibrate". Is this the correct INI for 
my module (Jorjin's WG7350 - wl1273 based)?

Any ideas also why I can not get a complete APs list with the command 
"iw wlan0 scan"? No one as seen this behaviour before?

José Gonçalves


^ permalink raw reply

* Re: [PATCH] mwifiex: don't ignore SDIO interrupts during shutdown
From: Daniel Drake @ 2013-07-09 20:28 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: Bing Zhao, linux-wireless@vger.kernel.org, linville@tuxdriver.com
In-Reply-To: <5FF020A1CFFEEC49BD1E09530C4FF5951035636356@SC-VEXCH1.marvell.com>

On Sun, Jul 7, 2013 at 10:15 AM, Amitkumar Karwar <akarwar@marvell.com> wrote:
>
>>We didn't test the behavior of sdio_read/sdio_write API's when hardware is >not present. But they should just return an error.
>
> I ran some tests which confirmed that there is no harm in calling these API's when hardware is removed. They returned ENOMEDIUM error.
>
> Can you please review and verify attached patch?

I gave it a quick test, didn't see any crashes. Thanks.

However, I'm concerned that this patch is worsening the confusion in
this part of the driver.

Unless there is a reason to do otherwise, the norm here would be to
tightly couple the hardware bits that enable interrupts to the Linux
IRQ handler registration. i.e. sdio_claim_irq should be called
immediately before mwifiex_sdio_enable_host_int, and sdio_release_irq
should be called immediately after mwifiex_sdio_disable_host_int.
Right now these 2 steps are very separate (sdio_release_irq is being
called far too late, long after the point when the driver could sanely
handle an interrupt).

Although you would never expect an interrupt to arrive after
mwifiex_sdio_disable_host_int() has been called, the cleanliness and
readability has value here, and maybe damaged hardware would misbehave
and fire an interrupt anyway, which would cause the driver to go
wrong.

Secondly, it should be symmetrical. If the core mwifiex driver is the
thing that enables interrupts, it should be the component responsible
for disabling them as well. With your patch, the core mwifiex driver
enables interrupts, but it is up to the sdio sub-driver to disable
them.

Daniel

^ permalink raw reply

* Re: [PATCH] mac80211: fix 5/10 MHz tx_status regression
From: Simon Wunderlich @ 2013-07-09 19:56 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Simon Wunderlich, linux-wireless, Mathias Kretschmer,
	Simon Wunderlich
In-Reply-To: <1373397346.8241.9.camel@jlt4.sipsolutions.net>

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

On Tue, Jul 09, 2013 at 09:15:46PM +0200, Johannes Berg wrote:
> On Tue, 2013-07-09 at 21:13 +0200, Simon Wunderlich wrote:
> > sdata may be used uninitialized in ieee80211_tx_status() when adding the
> > radiotap header. It was added as parameter in "mac80211: select and
> > adjust bitrates according to channel mode" to find the current control
> > channel width (5/10/20+ MHz) and is used to report the bitrate
> > correctly. Fix this by identifing the required shift when cycling
> > through the interfaces.
> > 
> > Reported-by: kbuild test robot <fengguang.wu@intel.com>
> > Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> > Cc: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
> > ---
> > You might want to squash this into the offending patch before sending it
> > further upstream.
> 
> I was about to drop most of your patches again, but OK :)

Yeah I can imagine, and I would like to avoid that. :P

Thanks,
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* [RFC/RFT] rtlwifi: Fix build errors for unusual cases
From: Larry Finger @ 2013-07-09 19:18 UTC (permalink / raw)
  To: linville
  Cc: linux-wireless, Larry Finger, netdev, Ben Hutchings, Fengguang Wu

The present build configuration for the rtlwifi family of drivers will
fail under two known conditions:

(1) If rtlwifi is selected without selecting any of the dependent drivers,
    there are errors in the build.
(2) If the PCI drivers are built into the kernel and the USB drivers are modules,
    or vice versa, there are missing globals.

The first condition is fixed by never building rtlwifi unless at least one
of the device drivers is selected. The second failure is fixed by splitting
the PCI and USB codes out of rtlwifi, and creating their own mini drivers.
If the drivers that use them are modules, they will also be modules.

Although a number of files are touched by this patch, only Makefile and Kconfig
have undergone significant changes. The only modifications to the other files
were to export entry points needed by the new rtl_pci and rtl_usb units, or to
rename two variables that had names that were likely to cause namespace collisions.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>  [Condition 1]
Reported-by: Ben Hutchings <bhutchings@solarflare.com> [Condition 2]
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
---
 drivers/net/wireless/rtlwifi/Kconfig  |   72 ++++++++++++++++++++++++++++++++++++++++++---------------------
 drivers/net/wireless/rtlwifi/Makefile |   10 +++-----
 drivers/net/wireless/rtlwifi/base.c   |   19 ++++++++++++++--
 drivers/net/wireless/rtlwifi/base.h   |    2 -
 drivers/net/wireless/rtlwifi/core.c   |    1 
 drivers/net/wireless/rtlwifi/debug.c  |    1 
 drivers/net/wireless/rtlwifi/efuse.c  |    1 
 drivers/net/wireless/rtlwifi/pci.c    |    9 +++++++
 drivers/net/wireless/rtlwifi/ps.c     |    4 +++
 drivers/net/wireless/rtlwifi/usb.c    |    7 ++++++
 10 files changed, 91 insertions(+), 35 deletions(-)

Index: wireless-testing-save/drivers/net/wireless/rtlwifi/Kconfig
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/Kconfig
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/Kconfig
@@ -1,27 +1,20 @@
-config RTLWIFI
-	tristate "Realtek wireless card support"
-	depends on MAC80211
-	select FW_LOADER
-	---help---
-	  This is common code for RTL8192CE/RTL8192CU/RTL8192SE/RTL8723AE
-	  drivers.  This module does nothing by itself - the various front-end
-	  drivers need to be enabled to support any desired devices.
-
-	  If you choose to build as a module, it'll be called rtlwifi.
-
-config RTLWIFI_DEBUG
-	bool "Debugging output for rtlwifi driver family"
-	depends on RTLWIFI
+menuconfig RTL_CARDS
+	tristate "Realtek rtlwifi family of devices"
+	depends on MAC80211 && (PCI || USB)
 	default y
 	---help---
-	To use the module option that sets the dynamic-debugging level for,
-	the front-end driver, this parameter must be "Y". For memory-limited
-	systems, choose "N". If in doubt, choose "Y".
+	  This option will enable support for the Realtek mac80211-based
+	  wireless drivers. Drivers rtl8192ce, rtl8192cu, rtl8192se, rtl8192de,
+	  rtl8723eu, and rtl8188eu share some common code.
+
+if RTL_CARDS
 
 config RTL8192CE
 	tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter"
-	depends on RTLWIFI && PCI
+	depends on PCI
 	select RTL8192C_COMMON
+	select RTLWIFI
+	select RTLWIFI_PCI
 	---help---
 	This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe
 	wireless network adapters.
@@ -30,7 +23,9 @@ config RTL8192CE
 
 config RTL8192SE
 	tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter"
-	depends on RTLWIFI && PCI
+	depends on PCI
+	select RTLWIFI
+	select RTLWIFI_PCI
 	---help---
 	This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe
 	wireless network adapters.
@@ -39,7 +34,9 @@ config RTL8192SE
 
 config RTL8192DE
 	tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter"
-	depends on RTLWIFI && PCI
+	depends on PCI
+	select RTLWIFI
+	select RTLWIFI_PCI
 	---help---
 	This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe
 	wireless network adapters.
@@ -48,7 +45,9 @@ config RTL8192DE
 
 config RTL8723AE
 	tristate "Realtek RTL8723AE PCIe Wireless Network Adapter"
-	depends on RTLWIFI && PCI
+	depends on PCI
+	select RTLWIFI
+	select RTLWIFI_PCI
 	---help---
 	This is the driver for Realtek RTL8723AE 802.11n PCIe
 	wireless network adapters.
@@ -57,7 +56,9 @@ config RTL8723AE
 
 config RTL8188EE
 	tristate "Realtek RTL8188EE Wireless Network Adapter"
-	depends on RTLWIFI && PCI
+	depends on PCI
+	select RTLWIFI
+	select RTLWIFI_PCI
 	---help---
 	This is the driver for Realtek RTL8188EE 802.11n PCIe
 	wireless network adapters.
@@ -66,7 +67,9 @@ config RTL8188EE
 
 config RTL8192CU
 	tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter"
-	depends on RTLWIFI && USB
+	depends on USB
+	select RTLWIFI
+	select RTLWIFI_USB
 	select RTL8192C_COMMON
 	---help---
 	This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB
@@ -74,7 +77,28 @@ config RTL8192CU
 
 	If you choose to build it as a module, it will be called rtl8192cu
 
+config RTLWIFI
+	tristate
+	select FW_LOADER
+
+config RTLWIFI_PCI
+	tristate
+
+config RTLWIFI_USB
+	tristate
+
+config RTLWIFI_DEBUG
+	bool "Debugging output for rtlwifi driver family"
+	depends on RTLWIFI
+	default y
+	---help---
+	To use the module option that sets the dynamic-debugging level for,
+	the front-end driver, this parameter must be "Y". For memory-limited
+	systems, choose "N". If in doubt, choose "Y".
+
 config RTL8192C_COMMON
 	tristate
 	depends on RTL8192CE || RTL8192CU
-	default m
+	default y
+
+endif
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/Makefile
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/Makefile
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/Makefile
@@ -12,13 +12,11 @@ rtlwifi-objs	:=		\
 
 rtl8192c_common-objs +=		\
 
-ifneq ($(CONFIG_PCI),)
-rtlwifi-objs	+= pci.o
-endif
+obj-$(CONFIG_RTLWIFI_PCI)	+= rtl_pci.o
+rtl_pci-objs	:=		pci.o
 
-ifneq ($(CONFIG_USB),)
-rtlwifi-objs	+= usb.o
-endif
+obj-$(CONFIG_RTLWIFI_USB)	+= rtl_usb.o
+rtl_usb-objs	:=		usb.o
 
 obj-$(CONFIG_RTL8192C_COMMON)	+= rtl8192c/
 obj-$(CONFIG_RTL8192CE)		+= rtl8192ce/
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/base.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/base.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/base.c
@@ -172,6 +172,7 @@ u8 rtl_tid_to_ac(u8 tid)
 {
 	return tid_to_ac[tid];
 }
+EXPORT_SYMBOL_GPL(rtl_tid_to_ac);
 
 static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
 				  struct ieee80211_sta_ht_cap *ht_cap)
@@ -406,6 +407,7 @@ void rtl_deinit_deferred_work(struct iee
 	cancel_delayed_work(&rtlpriv->works.ps_rfon_wq);
 	cancel_delayed_work(&rtlpriv->works.fwevt_wq);
 }
+EXPORT_SYMBOL_GPL(rtl_deinit_deferred_work);
 
 void rtl_init_rfkill(struct ieee80211_hw *hw)
 {
@@ -439,6 +441,7 @@ void rtl_deinit_rfkill(struct ieee80211_
 {
 	wiphy_rfkill_stop_polling(hw->wiphy);
 }
+EXPORT_SYMBOL_GPL(rtl_deinit_rfkill);
 
 int rtl_init_core(struct ieee80211_hw *hw)
 {
@@ -489,10 +492,12 @@ int rtl_init_core(struct ieee80211_hw *h
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(rtl_init_core);
 
 void rtl_deinit_core(struct ieee80211_hw *hw)
 {
 }
+EXPORT_SYMBOL_GPL(rtl_deinit_core);
 
 void rtl_init_rx_config(struct ieee80211_hw *hw)
 {
@@ -501,6 +506,7 @@ void rtl_init_rx_config(struct ieee80211
 
 	rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf));
 }
+EXPORT_SYMBOL_GPL(rtl_init_rx_config);
 
 /*********************************************************
  *
@@ -879,6 +885,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_h
 
 	return true;
 }
+EXPORT_SYMBOL_GPL(rtl_tx_mgmt_proc);
 
 void rtl_get_tcb_desc(struct ieee80211_hw *hw,
 		      struct ieee80211_tx_info *info,
@@ -1052,6 +1059,7 @@ bool rtl_action_proc(struct ieee80211_hw
 
 	return true;
 }
+EXPORT_SYMBOL_GPL(rtl_action_proc);
 
 /*should call before software enc*/
 u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
@@ -1125,6 +1133,7 @@ u8 rtl_is_special_data(struct ieee80211_
 
 	return false;
 }
+EXPORT_SYMBOL_GPL(rtl_is_special_data);
 
 /*********************************************************
  *
@@ -1300,6 +1309,7 @@ void rtl_beacon_statistic(struct ieee802
 
 	rtlpriv->link_info.bcn_rx_inperiod++;
 }
+EXPORT_SYMBOL_GPL(rtl_beacon_statistic);
 
 void rtl_watchdog_wq_callback(void *data)
 {
@@ -1793,6 +1803,7 @@ void rtl_recognize_peer(struct ieee80211
 
 	mac->vendor = vendor;
 }
+EXPORT_SYMBOL_GPL(rtl_recognize_peer);
 
 /*********************************************************
  *
@@ -1849,6 +1860,7 @@ struct attribute_group rtl_attribute_gro
 	.name = "rtlsysfs",
 	.attrs = rtl_sysfs_entries,
 };
+EXPORT_SYMBOL_GPL(rtl_attribute_group);
 
 MODULE_AUTHOR("lizhaoming	<chaoming_li@realsil.com.cn>");
 MODULE_AUTHOR("Realtek WlanFAE	<wlanfae@realtek.com>");
@@ -1856,7 +1868,8 @@ MODULE_AUTHOR("Larry Finger	<Larry.FInge
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core");
 
-struct rtl_global_var global_var = {};
+struct rtl_global_var rtl_global_var = {};
+EXPORT_SYMBOL_GPL(rtl_global_var);
 
 static int __init rtl_core_module_init(void)
 {
@@ -1864,8 +1877,8 @@ static int __init rtl_core_module_init(v
 		pr_err("Unable to register rtl_rc, use default RC !!\n");
 
 	/* init some global vars */
-	INIT_LIST_HEAD(&global_var.glb_priv_list);
-	spin_lock_init(&global_var.glb_list_lock);
+	INIT_LIST_HEAD(&rtl_global_var.glb_priv_list);
+	spin_lock_init(&rtl_global_var.glb_list_lock);
 
 	return 0;
 }
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/base.h
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/base.h
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/base.h
@@ -147,7 +147,7 @@ void rtl_recognize_peer(struct ieee80211
 u8 rtl_tid_to_ac(u8 tid);
 extern struct attribute_group rtl_attribute_group;
 void rtl_easy_concurrent_retrytimer_callback(unsigned long data);
-extern struct rtl_global_var global_var;
+extern struct rtl_global_var rtl_global_var;
 int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
 			 bool isht, u8 desc_rate, bool first_ampdu);
 bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/core.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/core.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/core.c
@@ -1330,3 +1330,4 @@ const struct ieee80211_ops rtl_ops = {
 	.rfkill_poll = rtl_op_rfkill_poll,
 	.flush = rtl_op_flush,
 };
+EXPORT_SYMBOL_GPL(rtl_ops);
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/debug.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/debug.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/debug.c
@@ -51,3 +51,4 @@ void rtl_dbgp_flag_init(struct ieee80211
 
 	/*Init Debug flag enable condition */
 }
+EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init);
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/efuse.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/efuse.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/efuse.c
@@ -229,6 +229,7 @@ void read_efuse_byte(struct ieee80211_hw
 
 	*pbuf = (u8) (value32 & 0xff);
 }
+EXPORT_SYMBOL_GPL(read_efuse_byte);
 
 void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
 {
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/pci.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/pci.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/pci.c
@@ -35,6 +35,13 @@
 #include "efuse.h"
 #include <linux/export.h>
 #include <linux/kmemleak.h>
+#include <linux/module.h>
+
+MODULE_AUTHOR("lizhaoming	<chaoming_li@realsil.com.cn>");
+MODULE_AUTHOR("Realtek WlanFAE	<wlanfae@realtek.com>");
+MODULE_AUTHOR("Larry Finger	<Larry.FInger@lwfinger.net>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("PCI basic driver for rtlwifi");
 
 static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = {
 	PCI_VENDOR_ID_INTEL,
@@ -1886,7 +1893,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
 	rtlpriv->rtlhal.interface = INTF_PCI;
 	rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data);
 	rtlpriv->intf_ops = &rtl_pci_ops;
-	rtlpriv->glb_var = &global_var;
+	rtlpriv->glb_var = &rtl_global_var;
 
 	/*
 	 *init dbgp flags before all
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/ps.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/ps.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/ps.c
@@ -269,6 +269,7 @@ void rtl_ips_nic_on(struct ieee80211_hw
 
 	spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags);
 }
+EXPORT_SYMBOL_GPL(rtl_ips_nic_on);
 
 /*for FW LPS*/
 
@@ -518,6 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_h
 			 "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed);
 	}
 }
+EXPORT_SYMBOL_GPL(rtl_swlps_beacon);
 
 void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
 {
@@ -623,6 +625,7 @@ void rtl_lps_change_work_callback(struct
 	else
 		rtl_lps_leave(hw);
 }
+EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback);
 
 void rtl_swlps_wq_callback(void *data)
 {
@@ -934,3 +937,4 @@ void rtl_p2p_info(struct ieee80211_hw *h
 	else
 		rtl_p2p_noa_ie(hw, data, len - FCS_LEN);
 }
+EXPORT_SYMBOL_GPL(rtl_p2p_info);
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/usb.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/usb.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/usb.c
@@ -32,6 +32,13 @@
 #include "ps.h"
 #include "rtl8192c/fw_common.h"
 #include <linux/export.h>
+#include <linux/module.h>
+
+MODULE_AUTHOR("lizhaoming	<chaoming_li@realsil.com.cn>");
+MODULE_AUTHOR("Realtek WlanFAE	<wlanfae@realtek.com>");
+MODULE_AUTHOR("Larry Finger	<Larry.FInger@lwfinger.net>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("USB basic driver for rtlwifi");
 
 #define	REALTEK_USB_VENQT_READ			0xC0
 #define	REALTEK_USB_VENQT_WRITE			0x40

^ permalink raw reply

* Re: [PATCH] mac80211: fix 5/10 MHz tx_status regression
From: Johannes Berg @ 2013-07-09 19:15 UTC (permalink / raw)
  To: Simon Wunderlich; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373397200-23686-1-git-send-email-siwu@hrz.tu-chemnitz.de>

On Tue, 2013-07-09 at 21:13 +0200, Simon Wunderlich wrote:
> sdata may be used uninitialized in ieee80211_tx_status() when adding the
> radiotap header. It was added as parameter in "mac80211: select and
> adjust bitrates according to channel mode" to find the current control
> channel width (5/10/20+ MHz) and is used to report the bitrate
> correctly. Fix this by identifing the required shift when cycling
> through the interfaces.
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> Cc: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
> ---
> You might want to squash this into the offending patch before sending it
> further upstream.

I was about to drop most of your patches again, but OK :)

johannes


^ permalink raw reply

* [PATCH] mac80211: fix 5/10 MHz tx_status regression
From: Simon Wunderlich @ 2013-07-09 19:13 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich

sdata may be used uninitialized in ieee80211_tx_status() when adding the
radiotap header. It was added as parameter in "mac80211: select and
adjust bitrates according to channel mode" to find the current control
channel width (5/10/20+ MHz) and is used to report the bitrate
correctly. Fix this by identifing the required shift when cycling
through the interfaces.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
You might want to squash this into the offending patch before sending it
further upstream.
---
 net/mac80211/status.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 690138a..6ad4c14 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -253,10 +253,9 @@ static int ieee80211_tx_radiotap_len(struct ieee80211_tx_info *info)
 }
 
 static void
-ieee80211_add_tx_radiotap_header(struct ieee80211_sub_if_data *sdata,
-				 struct ieee80211_supported_band *sband,
+ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band *sband,
 				 struct sk_buff *skb, int retry_count,
-				 int rtap_len)
+				 int rtap_len, int shift)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -282,7 +281,6 @@ ieee80211_add_tx_radiotap_header(struct ieee80211_sub_if_data *sdata,
 	/* IEEE80211_RADIOTAP_RATE */
 	if (info->status.rates[0].idx >= 0 &&
 	    !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) {
-		int shift = ieee80211_vif_get_shift(&sdata->vif);
 		u16 rate;
 
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE);
@@ -430,6 +428,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 	bool acked;
 	struct ieee80211_bar *bar;
 	int rtap_len;
+	int shift = 0;
 
 	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
 		if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
@@ -464,6 +463,8 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 		if (!ether_addr_equal(hdr->addr2, sta->sdata->vif.addr))
 			continue;
 
+		shift = ieee80211_vif_get_shift(&sta->sdata->vif);
+
 		if (info->flags & IEEE80211_TX_STATUS_EOSP)
 			clear_sta_flag(sta, WLAN_STA_SP);
 
@@ -630,8 +631,8 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 		dev_kfree_skb(skb);
 		return;
 	}
-	ieee80211_add_tx_radiotap_header(sdata, sband, skb, retry_count,
-					 rtap_len);
+	ieee80211_add_tx_radiotap_header(sband, skb, retry_count, rtap_len,
+					 shift);
 
 	/* XXX: is this sufficient for BPF? */
 	skb_set_mac_header(skb, 0);
-- 
1.7.10.4


^ permalink raw reply related

* Re: wl127x: Unable to associate with a WPA2-PSK AP
From: Arik Nemtsov @ 2013-07-09 19:10 UTC (permalink / raw)
  To: José Miguel Gonçalves; +Cc: Luciano Coelho, linux-wireless
In-Reply-To: <51DC0E7C.9080306@inov.pt>

On Tue, Jul 9, 2013 at 4:22 PM, José Miguel Gonçalves
<jose.goncalves@inov.pt> wrote:
> http://pastebin.com/XmEzqjHs
>
> The dmesg output with debug mask set to 0x63c20:
>
> http://pastebin.com/zGE0Gfp8
>
> Note that with debug activated I did not see the driver's "Beacon loss
> detected" messages.

You have this line in the log:
[   72.435000] wlan0: deauthenticated from 88:43:e1:57:79:c0 (Reason: 23)

This means:
Association request rejected because the information in the Power
Capability element is
unacceptable

In other words the AP is disconnecting you since your Tx power is
inadequate (probably too high?). I'd try to limit it using iw, or just
set a different regdomain where its limited.
Also I'd try with a different AP.

Arik

^ permalink raw reply

* [PATCHv4 5/5] ath9k: enable CSA functionality in ath9k
From: Simon Wunderlich @ 2013-07-09 18:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373394424-23298-1-git-send-email-siwu@hrz.tu-chemnitz.de>

CSA is only enabled for one interface, but the same limitation applies
for mac80211 too. It checks whether the beacon has been sent (different
approaches for non-EDMA-enabled and EDMA-enabled devices), and completes
the channel switch after that.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
Changes to PATCHv2:
 * announce support for channel switch

Changes to PATCHv1:
 * complete channel switch after the last beacon has been sent
---
 drivers/net/wireless/ath/ath9k/ath9k.h  |    2 ++
 drivers/net/wireless/ath/ath9k/beacon.c |   21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/init.c   |    1 +
 drivers/net/wireless/ath/ath9k/main.c   |   17 +++++++++++++++++
 drivers/net/wireless/ath/ath9k/xmit.c   |    2 ++
 5 files changed, 43 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 579ed9c..3745487 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -424,6 +424,7 @@ void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
 void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
 void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif);
 void ath9k_set_beacon(struct ath_softc *sc);
+bool ath9k_csa_is_finished(struct ath_softc *sc);
 
 /*******************/
 /* Link Monitoring */
@@ -751,6 +752,7 @@ struct ath_softc {
 #endif
 
 	struct ath_descdma txsdma;
+	struct ieee80211_vif *csa_vif;
 
 	struct ath_ant_comb ant_comb;
 	u8 ant_tx, ant_rx;
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index fd1eeba..e400151 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -310,6 +310,23 @@ void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
 		(unsigned long long)tsfadjust, avp->av_bslot);
 }
 
+bool ath9k_csa_is_finished(struct ath_softc *sc)
+{
+	struct ieee80211_vif *vif;
+
+	vif = sc->csa_vif;
+	if (!vif || !vif->csa_active)
+		return false;
+
+	if (!ieee80211_csa_is_complete(vif))
+		return false;
+
+	ieee80211_csa_finish(vif);
+	vif->csa_active = 0;
+	sc->csa_vif = NULL;
+	return true;
+}
+
 void ath9k_beacon_tasklet(unsigned long data)
 {
 	struct ath_softc *sc = (struct ath_softc *)data;
@@ -355,6 +372,10 @@ void ath9k_beacon_tasklet(unsigned long data)
 		return;
 	}
 
+	/* EDMA devices check that in the tx completion function. */
+	if (!edma && ath9k_csa_is_finished(sc))
+		return;
+
 	slot = ath9k_beacon_choose_slot(sc);
 	vif = sc->beacon.bslot[slot];
 
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index f359b0d..3ce83c4 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -807,6 +807,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
 	hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
 	hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+	hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 
 #ifdef CONFIG_PM_SLEEP
 	if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) &&
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d1ce3da..6844968 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1026,6 +1026,9 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
 	if (ath9k_uses_beacons(vif->type))
 		ath9k_beacon_remove_slot(sc, vif);
 
+	if (sc->csa_vif == vif)
+		sc->csa_vif = NULL;
+
 	ath9k_ps_wakeup(sc);
 	ath9k_calculate_summary_state(hw, NULL);
 	ath9k_ps_restore(sc);
@@ -2319,6 +2322,19 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
 	clear_bit(SC_OP_SCANNING, &sc->sc_flags);
 }
 
+static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
+					struct ieee80211_vif *vif,
+					struct cfg80211_chan_def *chandef)
+{
+	struct ath_softc *sc = hw->priv;
+
+	/* mac80211 does not support CSA in multi-if cases (yet) */
+	if (WARN_ON(sc->csa_vif))
+		return;
+
+	sc->csa_vif = vif;
+}
+
 struct ieee80211_ops ath9k_ops = {
 	.tx 		    = ath9k_tx,
 	.start 		    = ath9k_start,
@@ -2366,4 +2382,5 @@ struct ieee80211_ops ath9k_ops = {
 #endif
 	.sw_scan_start	    = ath9k_sw_scan_start,
 	.sw_scan_complete   = ath9k_sw_scan_complete,
+	.channel_switch_beacon     = ath9k_channel_switch_beacon,
 };
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index eab0fcb..cec670d 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2282,6 +2282,8 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
 		if (ts.qid == sc->beacon.beaconq) {
 			sc->beacon.tx_processed = true;
 			sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
+
+			ath9k_csa_is_finished(sc);
 			continue;
 		}
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv4 4/5] mac80211: add channel switch command and beacon callbacks
From: Simon Wunderlich @ 2013-07-09 18:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373394424-23298-1-git-send-email-siwu@hrz.tu-chemnitz.de>

The count field in CSA must be decremented with each beacon
transmitted. This patch implements the functionality for drivers
using ieee80211_beacon_get(). Other drivers must call back manually
after reaching count == 0.

This patch also contains the handling and finish worker for the channel
switch command.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
Changes to PATCHv3:
 * forbid adding interfaces while CSA is running
 * forbid calling CSA multiple times
 * check for multiple channel contexts
 * abort channel switch when going down while doing CSA

Changes to PATCHv2:
 * fix documentation and style stuff
 * update tracing
 * change csa_active to bool
 * check if csa_active when assigning beacons
 * fix locking and access
 * use new ieee80211_vif_change_channel to change the channel

Changes to PATCHv1:
 * don't switch when CAC is active
 * add hw to parameters for driver

Changes to RFCv1:
 * use beacons as supplied from nl80211 without generating/parsing them
 * update beacons using offsets
 * report back by calling the channel switch event in cfg80211

squash mac80211: add channel switch command and beacon callbacks

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 include/net/mac80211.h     |   34 ++++++++++++
 net/mac80211/cfg.c         |  132 +++++++++++++++++++++++++++++++++++++++++++-
 net/mac80211/driver-ops.h  |   13 +++++
 net/mac80211/ieee80211_i.h |   13 +++++
 net/mac80211/iface.c       |    9 +++
 net/mac80211/trace.h       |   26 +++++++++
 net/mac80211/tx.c          |   80 +++++++++++++++++++++++++++
 7 files changed, 305 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2cc306c..1c1c18a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1088,6 +1088,7 @@ enum ieee80211_vif_flags {
  * @addr: address of this interface
  * @p2p: indicates whether this AP or STA interface is a p2p
  *	interface, i.e. a GO or p2p-sta respectively
+ * @csa_active: marks whether a channel switch is going on
  * @driver_flags: flags/capabilities the driver has for this interface,
  *	these need to be set (or cleared) when the interface is added
  *	or, if supported by the driver, the interface type is changed
@@ -1110,6 +1111,7 @@ struct ieee80211_vif {
 	struct ieee80211_bss_conf bss_conf;
 	u8 addr[ETH_ALEN];
 	bool p2p;
+	bool csa_active;
 
 	u8 cab_queue;
 	u8 hw_queue[IEEE80211_NUM_ACS];
@@ -2641,6 +2643,16 @@ enum ieee80211_roc_type {
  * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
  *	Currently, this is only called for managed or P2P client interfaces.
  *	This callback is optional; it must not sleep.
+ *
+ * @channel_switch_beacon: Starts a channel switch to a new channel.
+ *	Beacons are modified to include CSA or ECSA IEs before calling this
+ *	function. The corresponding count fields in these IEs must be
+ *	decremented, and when they reach zero the driver must call
+ *	ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
+ *	get the csa counter decremented by mac80211, but must check if it is
+ *	zero using ieee80211_csa_is_complete() after the beacon has been
+ *	transmitted and then call ieee80211_csa_finish().
+ *
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw,
@@ -2828,6 +2840,9 @@ struct ieee80211_ops {
 				 struct ieee80211_vif *vif,
 				 struct inet6_dev *idev);
 #endif
+	void (*channel_switch_beacon)(struct ieee80211_hw *hw,
+				      struct ieee80211_vif *vif,
+				      struct cfg80211_chan_def *chandef);
 };
 
 /**
@@ -3323,6 +3338,25 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
 }
 
 /**
+ * ieee80211_csa_finish - notify mac80211 about channel switch
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * After a channel switch announcement was scheduled and the counter in this
+ * announcement hit zero, this function must be called by the driver to
+ * notify mac80211 that the channel can be changed.
+ */
+void ieee80211_csa_finish(struct ieee80211_vif *vif);
+
+/**
+ * ieee80211_csa_is_complete - find out if counters reached zero
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * This function returns whether the channel switch counters reached zero.
+ */
+bool ieee80211_csa_is_complete(struct ieee80211_vif *vif);
+
+
+/**
  * ieee80211_proberesp_get - retrieve a Probe Response template
  * @hw: pointer obtained from ieee80211_alloc_hw().
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8e6c935..33bfd26 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -860,8 +860,8 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
 	return 0;
 }
 
-static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
-				   struct cfg80211_beacon_data *params)
+int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
+			    struct cfg80211_beacon_data *params)
 {
 	struct beacon_data *new, *old;
 	int new_head_len, new_tail_len;
@@ -1024,6 +1024,12 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
+	/* don't allow changing the beacon while CSA is in place - offset
+	 * of channel switch counter may change
+	 */
+	if (sdata->vif.csa_active)
+		return -EBUSY;
+
 	old = rtnl_dereference(sdata->u.ap.beacon);
 	if (!old)
 		return -ENOENT;
@@ -1048,6 +1054,10 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 		return -ENOENT;
 	old_probe_resp = rtnl_dereference(sdata->u.ap.probe_resp);
 
+	/* abort any running channel switch */
+	sdata->vif.csa_active = false;
+	cancel_work_sync(&sdata->csa_finalize_work);
+
 	/* turn off carrier for this interface and dependent VLANs */
 	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
 		netif_carrier_off(vlan->dev);
@@ -2831,6 +2841,123 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
 	return new_beacon;
 }
 
+void ieee80211_csa_finalize_work(struct work_struct *work)
+{
+	struct ieee80211_sub_if_data *sdata =
+		container_of(work, struct ieee80211_sub_if_data,
+			     csa_finalize_work);
+	struct ieee80211_local *local = sdata->local;
+	int err, changed;
+
+	if (!ieee80211_sdata_running(sdata))
+		return;
+
+	if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP))
+		return;
+
+	sdata->radar_required = sdata->csa_radar_required;
+	err = ieee80211_vif_change_channel(sdata, &local->csa_chandef,
+					   &changed);
+	if (WARN_ON(err < 0))
+		return;
+
+	err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
+	if (err < 0)
+		return;
+
+	changed |= err;
+	kfree(sdata->u.ap.next_beacon);
+	sdata->u.ap.next_beacon = NULL;
+
+	ieee80211_wake_queues_by_reason(&sdata->local->hw,
+					IEEE80211_MAX_QUEUE_MAP,
+					IEEE80211_QUEUE_STOP_REASON_CSA);
+
+	ieee80211_bss_info_change_notify(sdata, changed);
+
+	cfg80211_ch_switch_notify(sdata->dev, &local->csa_chandef);
+}
+
+static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
+				    struct cfg80211_csa_settings *params)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_chanctx_conf *chanctx_conf;
+	struct ieee80211_chanctx *chanctx;
+	int err, num_chanctx;
+
+	if (!list_empty(&local->roc_list) || local->scanning)
+		return -EBUSY;
+
+	if (sdata->wdev.cac_started)
+		return -EBUSY;
+
+	/* don't handle if chanctx is used */
+	if (local->use_chanctx)
+		return -EINVAL;
+
+	rcu_read_lock();
+	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+	if (!chanctx_conf) {
+		rcu_read_unlock();
+		return -EBUSY;
+	}
+
+	/* don't handle for multi-VIF cases */
+	chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf);
+	if (chanctx->refcount > 1) {
+		rcu_read_unlock();
+		return -EBUSY;
+	}
+	num_chanctx = 0;
+	list_for_each_entry_rcu(chanctx, &local->chanctx_list, list)
+		num_chanctx++;
+
+	if (num_chanctx > 1) {
+		rcu_read_unlock();
+		return -EBUSY;
+	}
+	rcu_read_unlock();
+
+	/* don't allow another channel switch if one is already active. */
+	if (sdata->vif.csa_active)
+		return -EBUSY;
+
+	/* only handle AP for now. */
+	switch (sdata->vif.type) {
+	case NL80211_IFTYPE_AP:
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	sdata->u.ap.next_beacon = cfg80211_beacon_dup(&params->beacon_after);
+	if (!sdata->u.ap.next_beacon)
+		return -ENOMEM;
+
+	sdata->csa_counter_offset_beacon = params->counter_offset_beacon;
+	sdata->csa_counter_offset_presp = params->counter_offset_presp;
+	sdata->csa_radar_required = params->radar_required;
+
+	if (params->block_tx)
+		ieee80211_stop_queues_by_reason(&local->hw,
+				IEEE80211_MAX_QUEUE_MAP,
+				IEEE80211_QUEUE_STOP_REASON_CSA);
+
+	err = ieee80211_assign_beacon(sdata, &params->beacon_csa);
+	if (err < 0)
+		return err;
+
+	local->csa_chandef = params->chandef;
+	sdata->vif.csa_active = true;
+
+	ieee80211_bss_info_change_notify(sdata, err);
+	drv_channel_switch_beacon(sdata, &params->chandef);
+
+	return 0;
+}
+
 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 			     struct ieee80211_channel *chan, bool offchan,
 			     unsigned int wait, const u8 *buf, size_t len,
@@ -3548,4 +3675,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_et_strings = ieee80211_get_et_strings,
 	.get_channel = ieee80211_cfg_get_channel,
 	.start_radar_detection = ieee80211_start_radar_detection,
+	.channel_switch = ieee80211_channel_switch,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index b931c96..b3ea11f 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1072,4 +1072,17 @@ static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
 }
 #endif
 
+static inline void
+drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
+			  struct cfg80211_chan_def *chandef)
+{
+	struct ieee80211_local *local = sdata->local;
+
+	if (local->ops->channel_switch_beacon) {
+		trace_drv_channel_switch_beacon(local, sdata, chandef);
+		local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
+						  chandef);
+	}
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 20dbc2d..73bcec3 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -259,6 +259,8 @@ struct ieee80211_if_ap {
 	struct beacon_data __rcu *beacon;
 	struct probe_resp __rcu *probe_resp;
 
+	/* to be used after channel switch. */
+	struct cfg80211_beacon_data *next_beacon;
 	struct list_head vlans;
 
 	struct ps_data ps;
@@ -716,6 +718,11 @@ struct ieee80211_sub_if_data {
 
 	struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
 
+	struct work_struct csa_finalize_work;
+	int csa_counter_offset_beacon;
+	int csa_counter_offset_presp;
+	bool csa_radar_required;
+
 	/* used to reconfigure hardware SM PS */
 	struct work_struct recalc_smps;
 
@@ -1373,6 +1380,9 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
 void ieee80211_sw_roc_work(struct work_struct *work);
 void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
 
+/* channel switch handling */
+void ieee80211_csa_finalize_work(struct work_struct *work);
+
 /* interface handling */
 int ieee80211_iface_init(void);
 void ieee80211_iface_exit(void);
@@ -1394,6 +1404,9 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
 
 bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
 void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
+int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
+			    struct cfg80211_beacon_data *params);
+
 
 static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
 {
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 093c34a..187c161 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -274,6 +274,12 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
 			if (iftype == NL80211_IFTYPE_ADHOC &&
 			    nsdata->vif.type == NL80211_IFTYPE_ADHOC)
 				return -EBUSY;
+			/*
+			 * will not add another interface while any channel
+			 * switch is active.
+			 */
+			if (nsdata->vif.csa_active)
+				return -EBUSY;
 
 			/*
 			 * The remaining checks are only performed for interfaces
@@ -804,6 +810,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 	cancel_work_sync(&local->dynamic_ps_enable_work);
 
 	cancel_work_sync(&sdata->recalc_smps);
+	sdata->vif.csa_active = false;
+	cancel_work_sync(&sdata->csa_finalize_work);
 
 	cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
 
@@ -1267,6 +1275,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
 	skb_queue_head_init(&sdata->skb_queue);
 	INIT_WORK(&sdata->work, ieee80211_iface_work);
 	INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
+	INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work);
 
 	switch (type) {
 	case NL80211_IFTYPE_P2P_GO:
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index c215fafd7..1aba645 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1906,6 +1906,32 @@ TRACE_EVENT(api_radar_detected,
 	)
 );
 
+TRACE_EVENT(drv_channel_switch_beacon,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata,
+		 struct cfg80211_chan_def *chandef),
+
+	TP_ARGS(local, sdata, chandef),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		VIF_ENTRY
+		CHANDEF_ENTRY
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		VIF_ASSIGN;
+		CHANDEF_ASSIGN(chandef);
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT VIF_PR_FMT " channel switch to " CHANDEF_PR_FMT,
+		LOCAL_PR_ARG, VIF_PR_ARG, CHANDEF_PR_ARG
+	)
+);
+
+
 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM mac80211_msg
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f82301b..1da252a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2335,6 +2335,83 @@ static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata,
 	return 0;
 }
 
+void ieee80211_csa_finish(struct ieee80211_vif *vif)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+	vif->csa_active = false;
+	ieee80211_queue_work(&sdata->local->hw,
+			     &sdata->csa_finalize_work);
+}
+EXPORT_SYMBOL(ieee80211_csa_finish);
+
+static void ieee80211_update_csa(struct ieee80211_sub_if_data *sdata,
+				 struct beacon_data *beacon)
+{
+	struct probe_resp *resp;
+	int counter_offset_beacon = sdata->csa_counter_offset_beacon;
+	int counter_offset_presp = sdata->csa_counter_offset_presp;
+
+	/* warn if the driver did not check for/react to csa completeness */
+	if (WARN_ON(((u8 *)beacon->tail)[counter_offset_beacon] == 0))
+		return;
+
+	((u8 *)beacon->tail)[counter_offset_beacon]--;
+
+	if (!counter_offset_presp)
+		return;
+
+	if (sdata->vif.type == NL80211_IFTYPE_AP) {
+		rcu_read_lock();
+		resp = rcu_dereference(sdata->u.ap.probe_resp);
+
+		/* if nl80211 accepted the offset, this should not happen. */
+		if (WARN_ON(!resp)) {
+			rcu_read_unlock();
+			return;
+		}
+		resp->data[counter_offset_presp]--;
+	}
+}
+
+bool ieee80211_csa_is_complete(struct ieee80211_vif *vif)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+	struct beacon_data *beacon = NULL;
+	u8 *beacon_data;
+	size_t beacon_data_len;
+	int counter_beacon = sdata->csa_counter_offset_beacon;
+	int ret = false;
+
+	if (!ieee80211_sdata_running(sdata))
+		return false;
+
+	rcu_read_lock();
+	if (vif->type == NL80211_IFTYPE_AP) {
+		struct ieee80211_if_ap *ap = &sdata->u.ap;
+
+		beacon = rcu_dereference(ap->beacon);
+		if (WARN_ON(!beacon || !beacon->tail))
+			goto out;
+		beacon_data = beacon->tail;
+		beacon_data_len = beacon->tail_len;
+	} else {
+		WARN_ON(1);
+		goto out;
+	}
+
+	if (WARN_ON(counter_beacon > beacon_data_len))
+		goto out;
+
+	if (beacon_data[counter_beacon] == 0)
+		ret = true;
+ out:
+	rcu_read_unlock();
+
+	return ret;
+}
+EXPORT_SYMBOL(ieee80211_csa_is_complete);
+
 struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 					 struct ieee80211_vif *vif,
 					 u16 *tim_offset, u16 *tim_length)
@@ -2365,6 +2442,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 		struct beacon_data *beacon = rcu_dereference(ap->beacon);
 
 		if (beacon) {
+			if (sdata->vif.csa_active)
+				ieee80211_update_csa(sdata, beacon);
+
 			/*
 			 * headroom, head length,
 			 * tail length and maximum TIM length
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv4 1/5] nl80211/cfg80211: add channel switch command
From: Simon Wunderlich @ 2013-07-09 18:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373394424-23298-1-git-send-email-siwu@hrz.tu-chemnitz.de>

To allow channel switch announcements within beacons, add
the channel switch command to nl80211/cfg80211. This is
implementation is intended for AP and (later) IBSS mode.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
Changes to PATCHv2:
 * define csa_ies as static to save stack size
 * add wiphy flag and cmd for channel_switch
 * move NL80211_ATTR_CSA_C_OFF_BEACON into csa_ies

Changes to RFCv1:
 * accept and pass CSA IEs and after-change IEs
 * use parameter structure instead of individual parameters
---
 include/net/cfg80211.h       |   30 ++++++++++
 include/uapi/linux/nl80211.h |   30 ++++++++++
 net/wireless/nl80211.c       |  126 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 185 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d3adcb4..bb954e9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -666,6 +666,30 @@ struct cfg80211_ap_settings {
 };
 
 /**
+ * struct cfg80211_csa_settings - channel switch settings
+ *
+ * Used for channel switch
+ *
+ * @chandef: defines the channel to use after the switch
+ * @beacon_csa: beacon data while performing the switch
+ * @counter_offset_beacon: offset for the counter within the beacon (tail)
+ * @counter_offset_presp: offset for the counter within the probe response
+ * @beacon_after: beacon data to be used on the new channel
+ * @radar_required: whether radar detection is required on the new channel
+ * @block_tx: whether transmissions should be blocked while changing
+ * @count: number of beacons until switch
+ */
+struct cfg80211_csa_settings {
+	struct cfg80211_chan_def chandef;
+	struct cfg80211_beacon_data beacon_csa;
+	u16 counter_offset_beacon, counter_offset_presp;
+	struct cfg80211_beacon_data beacon_after;
+	bool radar_required;
+	bool block_tx;
+	u8 count;
+};
+
+/**
  * enum station_parameters_apply_mask - station parameter values to apply
  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
@@ -2376,6 +2400,9 @@ struct cfg80211_ops {
 				   struct wireless_dev *wdev);
 	int	(*set_coalesce)(struct wiphy *wiphy,
 				struct cfg80211_coalesce *coalesce);
+	int	(*channel_switch)(struct wiphy *wiphy,
+				  struct net_device *dev,
+				  struct cfg80211_csa_settings *params);
 };
 
 /*
@@ -2441,6 +2468,8 @@ struct cfg80211_ops {
  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
+ * @WIPHY_FLAG_HAS_CHANNEL_SWITCH_BEACON: Device supports channel switch in
+ *	beaconing mode (AP, IBSS, Mesh, ...).
  */
 enum wiphy_flags {
 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
@@ -2465,6 +2494,7 @@ enum wiphy_flags {
 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
+	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index eb68735..de27feb 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -676,6 +676,16 @@
  * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
  * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
  *
+ * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the
+ *	the new channel information (Channel Switch Announcement - CSA)
+ *	in the beacon for some time (as defined in the
+ *	%NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the
+ *	new channel. Userspace provides the new channel information (using
+ *	%NL80211_ATTR_WIPHY_FREQ and the attributes determining channel
+ *	width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform
+ *	other station that transmission must be blocked until the channel
+ *	switch is complete.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -841,6 +851,7 @@ enum nl80211_commands {
 	NL80211_CMD_GET_COALESCE,
 	NL80211_CMD_SET_COALESCE,
 
+	NL80211_CMD_CHANNEL_SWITCH,
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1469,6 +1480,19 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
  *
+ * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's
+ *	until the channel switch event.
+ * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission
+ *	must be blocked on the current channel (before the channel switch
+ *	operation).
+ * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information
+ *	for the time while performing a channel switch.
+ * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter
+ *	field in the beacons tail (%NL80211_ATTR_BEACON_TAIL).
+ * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
+ *	field in the probe response (%NL80211_ATTR_PROBE_RESP).
+>>>>>>> 95492d0... nl80211/cfg80211: add channel switch command
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1771,6 +1795,12 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_COALESCE_RULE,
 
+	NL80211_ATTR_CH_SWITCH_COUNT,
+	NL80211_ATTR_CH_SWITCH_BLOCK_TX,
+	NL80211_ATTR_CSA_IES,
+	NL80211_ATTR_CSA_C_OFF_BEACON,
+	NL80211_ATTR_CSA_C_OFF_PRESP,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a9444cd..7781d40 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -349,6 +349,11 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 	[NL80211_ATTR_IE_RIC] = { .type = NLA_BINARY,
 				  .len = IEEE80211_MAX_DATA_LEN },
 	[NL80211_ATTR_PEER_AID] = { .type = NLA_U16 },
+	[NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 },
+	[NL80211_ATTR_CH_SWITCH_BLOCK_TX] = { .type = NLA_FLAG },
+	[NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED },
+	[NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 },
+	[NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 },
 };
 
 /* policy for the key attributes */
@@ -1422,6 +1427,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
 		if (state->split) {
 			CMD(crit_proto_start, CRIT_PROTOCOL_START);
 			CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
+			if (dev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)
+				CMD(channel_switch, CHANNEL_SWITCH);
 		}
 
 #ifdef CONFIG_NL80211_TESTMODE
@@ -5611,6 +5618,115 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
 	return err;
 }
 
+static int nl80211_channel_switch(struct sk_buff *skb,
+				  struct genl_info *info)
+{
+	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct net_device *dev = info->user_ptr[1];
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_csa_settings params;
+	/* csa_ies is defined static to avoid waste of stack size - this
+	 * function is called under RTNL lock, so this should not be a problem.
+	 */
+	static struct nlattr *csa_ies[NL80211_ATTR_MAX+1];
+	u8 radar_detect_width = 0;
+	int err;
+
+	if (!rdev->ops->channel_switch ||
+	    !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH))
+		return -EOPNOTSUPP;
+
+	/* may add IBSS support later */
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
+		return -EOPNOTSUPP;
+
+	memset(&params, 0, sizeof(params));
+
+	if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] ||
+	    !info->attrs[NL80211_ATTR_CH_SWITCH_COUNT])
+		return -EINVAL;
+
+	/* only important for AP, IBSS and mesh create IEs internally */
+	if (!info->attrs[NL80211_ATTR_CSA_IES])
+		return -EINVAL;
+
+	/* useless if AP is not running */
+	if (!wdev->beacon_interval)
+		return -EINVAL;
+
+	params.count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]);
+
+	err = nl80211_parse_beacon(info->attrs, &params.beacon_after);
+	if (err)
+		return err;
+
+	err = nla_parse_nested(csa_ies, NL80211_ATTR_MAX,
+			       info->attrs[NL80211_ATTR_CSA_IES],
+			       nl80211_policy);
+	if (err)
+		return err;
+
+	err = nl80211_parse_beacon(csa_ies, &params.beacon_csa);
+	if (err)
+		return err;
+
+	if (!csa_ies[NL80211_ATTR_CSA_C_OFF_BEACON])
+		return -EINVAL;
+
+	params.counter_offset_beacon =
+		nla_get_u16(csa_ies[NL80211_ATTR_CSA_C_OFF_BEACON]);
+	if (params.counter_offset_beacon > params.beacon_csa.tail_len)
+		return -EINVAL;
+
+	/* sanity check - counter should be the same this should be the same */
+	if (params.beacon_csa.tail[params.counter_offset_beacon] !=
+	    params.count)
+		return -EINVAL;
+
+	if (csa_ies[NL80211_ATTR_CSA_C_OFF_PRESP]) {
+		params.counter_offset_presp =
+			nla_get_u16(csa_ies[NL80211_ATTR_CSA_C_OFF_PRESP]);
+		if (params.counter_offset_presp >
+		    params.beacon_csa.probe_resp_len)
+			return -EINVAL;
+
+		if (params.beacon_csa.probe_resp[params.counter_offset_presp] !=
+		    params.count)
+			return -EINVAL;
+	}
+
+	err = nl80211_parse_chandef(rdev, info, &params.chandef);
+	if (err)
+		return err;
+
+	if (!cfg80211_reg_can_beacon(&rdev->wiphy, &params.chandef))
+		return -EINVAL;
+
+	err = cfg80211_chandef_dfs_required(wdev->wiphy, &params.chandef);
+	if (err < 0)
+		return err;
+
+	if (err)
+		radar_detect_width = BIT(params.chandef.width);
+	else
+		radar_detect_width = 0;
+
+	err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype,
+					   params.chandef.chan,
+					   CHAN_MODE_SHARED,
+					   radar_detect_width);
+	if (err)
+		return err;
+
+	if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX])
+		params.block_tx = true;
+
+	err = rdev->ops->channel_switch(&rdev->wiphy, dev, &params);
+
+	return err;
+}
+
 static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
 			    u32 seq, int flags,
 			    struct cfg80211_registered_device *rdev,
@@ -9359,7 +9475,15 @@ static struct genl_ops nl80211_ops[] = {
 		.flags = GENL_ADMIN_PERM,
 		.internal_flags = NL80211_FLAG_NEED_WIPHY |
 				  NL80211_FLAG_NEED_RTNL,
-	}
+	},
+	{
+		.cmd = NL80211_CMD_CHANNEL_SWITCH,
+		.doit = nl80211_channel_switch,
+		.policy = nl80211_policy,
+		.flags = GENL_ADMIN_PERM,
+		.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+				  NL80211_FLAG_NEED_RTNL,
+	},
 };
 
 static struct genl_multicast_group nl80211_mlme_mcgrp = {
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv4 2/5] mac80211: add functions to duplicate a cfg80211_beacon
From: Simon Wunderlich @ 2013-07-09 18:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373394424-23298-1-git-send-email-siwu@hrz.tu-chemnitz.de>

For the channel switch announcement, it is required to set a new beacon
after the driver arrived on the new channel. The new beacon will be set
by nl80211, but is required to duplicate the beacon as the original
memory within the netlink message will be gone.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
Changes to PATCHv2:
 * allocate only one memory chunk
---
 net/mac80211/cfg.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b82fff6..8e6c935 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2775,6 +2775,62 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
 	return 0;
 }
 
+static struct cfg80211_beacon_data *
+cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
+{
+	struct cfg80211_beacon_data *new_beacon;
+	u8 *pos;
+	int len;
+
+	len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len +
+	      beacon->proberesp_ies_len + beacon->assocresp_ies_len +
+	      beacon->probe_resp_len;
+
+	new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL);
+	if (!new_beacon)
+		return NULL;
+
+	pos = (u8 *)(new_beacon + 1);
+	if (beacon->head_len) {
+		new_beacon->head_len = beacon->head_len;
+		new_beacon->head = pos;
+		memcpy(pos, beacon->head, beacon->head_len);
+		pos += beacon->head_len;
+	}
+	if (beacon->tail_len) {
+		new_beacon->tail_len = beacon->tail_len;
+		new_beacon->tail = pos;
+		memcpy(pos, beacon->tail, beacon->tail_len);
+		pos += beacon->tail_len;
+	}
+	if (beacon->beacon_ies_len) {
+		new_beacon->beacon_ies_len = beacon->beacon_ies_len;
+		new_beacon->beacon_ies = pos;
+		memcpy(pos, beacon->beacon_ies, beacon->beacon_ies_len);
+		pos += beacon->beacon_ies_len;
+	}
+	if (beacon->proberesp_ies_len) {
+		new_beacon->proberesp_ies_len = beacon->proberesp_ies_len;
+		new_beacon->proberesp_ies = pos;
+		memcpy(pos, beacon->proberesp_ies, beacon->proberesp_ies_len);
+		pos += beacon->proberesp_ies_len;
+	}
+	if (beacon->assocresp_ies_len) {
+		new_beacon->assocresp_ies_len = beacon->assocresp_ies_len;
+		new_beacon->assocresp_ies = pos;
+		memcpy(pos, beacon->assocresp_ies, beacon->assocresp_ies_len);
+		pos += beacon->assocresp_ies_len;
+	}
+	if (beacon->probe_resp_len) {
+		new_beacon->probe_resp_len = beacon->probe_resp_len;
+		beacon->probe_resp = pos;
+		memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
+		pos += beacon->probe_resp_len;
+	}
+
+	return new_beacon;
+}
+
 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 			     struct ieee80211_channel *chan, bool offchan,
 			     unsigned int wait, const u8 *buf, size_t len,
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv4 3/5] mac80211: allow chanctx to change channels
From: Simon Wunderlich @ 2013-07-09 18:27 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1373394424-23298-1-git-send-email-siwu@hrz.tu-chemnitz.de>

This adds mac80211/chanctx code to allow to change a channel definition
of an active channel context. This will be used for the channel switch
command added later.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 include/net/mac80211.h     |    4 ++++
 net/mac80211/chan.c        |   55 ++++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h |    4 ++++
 3 files changed, 63 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3124036..2cc306c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -152,11 +152,13 @@ struct ieee80211_low_level_stats {
  * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
  * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
  * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed
+ * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel
  */
 enum ieee80211_chanctx_change {
 	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),
 	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(1),
 	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(2),
+	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3)
 };
 
 /**
@@ -222,6 +224,7 @@ struct ieee80211_chanctx_conf {
  * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
  *	note that this is only called when it changes after the channel
  *	context had been assigned.
+ * @BSS_CHANGED_CHANNEL: The operating channel of this interface changed.
  */
 enum ieee80211_bss_change {
 	BSS_CHANGED_ASSOC		= 1<<0,
@@ -246,6 +249,7 @@ enum ieee80211_bss_change {
 	BSS_CHANGED_P2P_PS		= 1<<19,
 	BSS_CHANGED_BEACON_INFO		= 1<<20,
 	BSS_CHANGED_BANDWIDTH		= 1<<21,
+	BSS_CHANGED_CHANNEL		= 1<<22,
 
 	/* when adding here, make sure to change ieee80211_reconfig */
 };
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 03e8d2e..7816703 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -410,6 +410,61 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
 	return ret;
 }
 
+int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
+				 const struct cfg80211_chan_def *chandef,
+				 u32 *changed)
+{
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_chanctx_conf *conf;
+	struct ieee80211_chanctx *ctx;
+	int ret;
+	u32 chanctx_changed = 0;
+
+	if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef,
+				     IEEE80211_CHAN_DISABLED))
+		return -EINVAL;
+
+	mutex_lock(&local->chanctx_mtx);
+	conf = rcu_dereference_protected(sdata->vif.chanctx_conf,
+					 lockdep_is_held(&local->chanctx_mtx));
+	if (!conf) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ctx = container_of(conf, struct ieee80211_chanctx, conf);
+	if (ctx->refcount != 1) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if (sdata->vif.bss_conf.chandef.width != chandef->width) {
+		chanctx_changed = IEEE80211_CHANCTX_CHANGE_WIDTH;
+		*changed |= BSS_CHANGED_BANDWIDTH;
+	}
+
+	sdata->vif.bss_conf.chandef = *chandef;
+	ctx->conf.def = *chandef;
+
+	chanctx_changed |= IEEE80211_CHANCTX_CHANGE_CHANNEL;
+	*changed |= BSS_CHANGED_CHANNEL;
+	drv_change_chanctx(local, ctx, chanctx_changed);
+
+	if (!local->use_chanctx) {
+		local->_oper_chandef = *chandef;
+		ieee80211_hw_config(local, 0);
+	}
+
+	ieee80211_recalc_chanctx_chantype(local, ctx);
+	ieee80211_recalc_smps_chanctx(local, ctx);
+	ieee80211_recalc_radar_chanctx(local, ctx);
+
+	ret = 0;
+ out:
+	mutex_unlock(&local->chanctx_mtx);
+	return ret;
+}
+
 int ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
 				   const struct cfg80211_chan_def *chandef,
 				   u32 *changed)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 23a191b..20dbc2d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1658,6 +1658,10 @@ int __must_check
 ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
 			       const struct cfg80211_chan_def *chandef,
 			       u32 *changed);
+int __must_check
+ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
+			     const struct cfg80211_chan_def *chandef,
+			     u32 *changed);
 void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
 void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
 void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv4 0/5] add master channel switch announcement support
From: Simon Wunderlich @ 2013-07-09 18:26 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich

This is the 4th edition of the CSA support patch series. This patchset adds
generic channel switch support for AP. This is required for DFS operation
(e.g. Wi-Fi Alliance requires this for 802.11h certification). This will also
be required for IBSS-DFS later.

Changes from PATCHv3:
 * check for more multi-interface stuff before starting CSA (thanks Michal
   for your suggestions)
 * fix problem if going down during CSA

The rough design is:
 * userspace asks kernel to switch a channel using the new NL80211_CMD_CHANNEL_SWITCH
   command. It supplies IE information for the time while staying on the old channel and
   announcing the switch, and IE information for after the switch to the new channel. 
 * IE information contains the beacon and optionally probe responses, which should
   include (E)CSA IEs for the CSA case. Furthermore an offset is provided (for beacon
   and probe response) to point to the counter field within the channel switch IEs.
 * The driver gets the new beacons passed and must set them, and decrement the
   counter field. When it reaches 0, the channel is changed and userspace notified.

As always, any comments are appreciated.

Cheers,
	Simon 

Simon Wunderlich (5):
  nl80211/cfg80211: add channel switch command
  mac80211: add functions to duplicate a cfg80211_beacon
  mac80211: allow chanctx to change channels
  mac80211: add channel switch command and beacon callbacks
  ath9k: enable CSA functionality in ath9k

 drivers/net/wireless/ath/ath9k/ath9k.h  |    2 +
 drivers/net/wireless/ath/ath9k/beacon.c |   21 ++++
 drivers/net/wireless/ath/ath9k/init.c   |    1 +
 drivers/net/wireless/ath/ath9k/main.c   |   17 +++
 drivers/net/wireless/ath/ath9k/xmit.c   |    2 +
 include/net/cfg80211.h                  |   30 +++++
 include/net/mac80211.h                  |   38 +++++++
 include/uapi/linux/nl80211.h            |   30 +++++
 net/mac80211/cfg.c                      |  188 ++++++++++++++++++++++++++++++-
 net/mac80211/chan.c                     |   55 +++++++++
 net/mac80211/driver-ops.h               |   13 +++
 net/mac80211/ieee80211_i.h              |   17 +++
 net/mac80211/iface.c                    |    9 ++
 net/mac80211/trace.h                    |   26 +++++
 net/mac80211/tx.c                       |   80 +++++++++++++
 net/wireless/nl80211.c                  |  126 ++++++++++++++++++++-
 16 files changed, 652 insertions(+), 3 deletions(-)

-- 
1.7.10.4


^ permalink raw reply

* Re: intel 4965 fails to set channel 12 or 13
From: Hendrik-Jan Heins @ 2013-07-09 18:00 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless
In-Reply-To: <20130709141312.GA3681@redhat.com>

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

As attached the requested output.

best regards,

Hendrik-Jan

2013/7/9 Stanislaw Gruszka <sgruszka@redhat.com>:
> On Tue, Jul 09, 2013 at 10:47:37AM +0200, Hendrik-Jan Heins wrote:
>> Dear list,
>>
>> On Debian Wheezy, kernel 3.2, I am trying to get my iwl4965 to
>> scan/find/connect on channels 13 and 13. As I am in Europe, this
>> should be no issue.
>> However: I can not get these channels activated on my card at all!
>> I tried the following:
>> - Using the regdom option, setting to EU, DE, or PL (I see the correct
>> setting in /sys/modules/cfg80211/parameters/ieee_regdom...
>> - Completely disabling CRDA, and manually loading regdom through iw
>> reg set EU/DE/PL/US
>>
>> In all cases, I see some changes in the channels listed, but I never
>> get 12 and 13 enabled.
>>
>> Does anyone has an idea on this?
>
> Please provide output of "iw phy" and "iw dev wlan0 scan".
>
> Stanislaw

[-- Attachment #2: iwdevwlan0scan.txt --]
[-- Type: text/plain, Size: 19538 bytes --]

BSS 4c:72:b9:35:47:5e (on wlan0)
	TSF: 201729027766 usec (2d, 08:02:09)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortSlotTime (0x0411)
	signal: -69.00 dBm
	last seen: 6208 ms ago
	Information elements from Probe Response frame:
	SSID: vnet-485EDE
	Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
	DS Parameter set: channel 1
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
		 * Capabilities: 16-PTKSA-RC (0x000c)
	Extended supported rates: 6.0 9.0 12.0 48.0 
	HT capabilities:
		Capabilities: 0x187c
			HT20
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 1
		 * HT protection: nonmember
		 * non-GF present: 0
		 * OBSS non-GF present: 1
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
		 * Capabilities: 16-PTKSA-RC (0x000c)
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:12:2a:68:63:48 (on wlan0)
	TSF: 9224143739734455661 usec (106760922d, 21:55:34)
	freq: 2427
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -78.00 dBm
	last seen: 1636 ms ago
	Information elements from Probe Response frame:
	SSID: NETIASPOT-686340
	Supported rates: 1.0* 2.0* 5.5* 11.0* 
	DS Parameter set: channel 4
	Country: PL	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 18 dBm
	Power constraint: 0 dB
	ERP: <no flags>
	ERP: <no flags>
	HT capabilities:
		Capabilities: 0x2c
			HT20
			SM Power Save disabled
			RX HT20 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
		Minimum RX AMPDU time spacing: 16 usec (0x07)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	Extended supported rates: 6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 
	HT operation:
		 * primary channel: 4
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: no
		 * non-GF present: 1
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Extended capabilities:
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
		 * AP setup locked: 0x00
		 * Selected Registrar: 0x0
		 * Response Type: 3 (AP)
		 * UUID: 0000000e-0e00-010f-000d-000f00000000
		 * Manufacturer: Jungo Software Technologies
		 * Model: OpenRG Platform
		 * Model Number: 34.5
		 * Serial Number: ND501036980
		 * Primary Device Type: 6-0050f204-1
		 * Device name: NETIASPOT
		 * Config methods: Label, PBC
		 * RF Bands: 0x1
BSS 00:12:2a:68:63:4a (on wlan0)
	TSF: 9224143739734429705 usec (106760922d, 21:55:34)
	freq: 2427
	beacon interval: 100
	capability: ESS ShortPreamble ShortSlotTime (0x0421)
	signal: -82.00 dBm
	last seen: 1624 ms ago
	Information elements from Probe Response frame:
	SSID: FON_NETIA_FREE_INTERNET
	Supported rates: 1.0* 2.0* 5.5* 11.0* 
	DS Parameter set: channel 4
	Country: PL	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 18 dBm
	Power constraint: 0 dB
	ERP: <no flags>
	ERP: <no flags>
	HT capabilities:
		Capabilities: 0x2c
			HT20
			SM Power Save disabled
			RX HT20 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
		Minimum RX AMPDU time spacing: 16 usec (0x07)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	Extended supported rates: 6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 
	HT operation:
		 * primary channel: 4
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: no
		 * non-GF present: 1
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Extended capabilities:
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS c8:64:c7:24:63:7c (on wlan0)
	TSF: 127664665396 usec (1d, 11:27:44)
	freq: 2462
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -69.00 dBm
	last seen: 1536 ms ago
	Information elements from Probe Response frame:
	SSID: Livebox-637C
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 11
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
	ERP: <no flags>
	Extended supported rates: 24.0 36.0 48.0 54.0 
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	HT capabilities:
		Capabilities: 0x104c
			HT20
			SM Power Save disabled
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 11
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: non-HT mixed
		 * non-GF present: 0
		 * OBSS non-GF present: 1
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Country: PL	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 20 dBm
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
		 * Response Type: 3 (AP)
		 * UUID: 00000000-0000-1000-0000-c864c724637c
		 * Manufacturer: ZTE
		 * Model: Livebox FTTH v2
		 * Model Number: ad6836_ADSL_PHY_0x00000000
		 * Serial Number: L20Z110
		 * Primary Device Type: 6-0050f204-1
		 * Device name: FTFRSA3.681217
		 * Config methods: Ethernet, Display, PBC
		 * RF Bands: 0x1
BSS 38:46:08:b7:c6:d0 (on wlan0)
	TSF: 769137267903 usec (8d, 21:38:57)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -86.00 dBm
	last seen: 1668 ms ago
	Information elements from Probe Response frame:
	SSID: Kuba
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 1
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP TKIP
		 * Authentication suites: PSK
	ERP: <no flags>
	Extended supported rates: 24.0 36.0 48.0 54.0 
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	HT capabilities:
		Capabilities: 0x104c
			HT20
			SM Power Save disabled
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: nonmember
		 * non-GF present: 0
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Country: PL	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 20 dBm
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
		 * Response Type: 3 (AP)
		 * UUID: 00000000-0000-1000-0000-384608b7c6d0
		 * Manufacturer: ZTE
		 * Model: Livebox FTTH v2
		 * Model Number: ad6836_ADSL_PHY_0x00000000
		 * Serial Number: L20Z111
		 * Primary Device Type: 6-0050f204-1
		 * Device name: FTFRSA3.681217
		 * Config methods: Ethernet, Display, PBC
		 * RF Bands: 0x1
BSS b0:48:7a:bc:57:00 (on wlan0)
	TSF: 201772960099 usec (2d, 08:02:52)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -89.00 dBm
	last seen: 6216 ms ago
	Information elements from Probe Response frame:
	SSID: KAPSELEK
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 1
	Country: US	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 20 dBm
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	Extended supported rates: 24.0 36.0 48.0 54.0 
	WPA:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:23:54:56:84:9f (on wlan0)
	TSF: 637462937925 usec (7d, 09:04:22)
	freq: 2457
	beacon interval: 100
	capability: ESS Privacy ShortSlotTime (0x0411)
	signal: -82.00 dBm
	last seen: 12736 ms ago
	Information elements from Probe Response frame:
	SSID: SZYMCIOR_Network
	Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0 
	DS Parameter set: channel 10
	ERP: Barker_Preamble_Mode
	Extended supported rates: 6.0 12.0 24.0 48.0 
	HT capabilities:
		Capabilities: 0x11ee
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT RX MCS rate indexes supported: 0-15, 32
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 10
		 * secondary channel offset: below
		 * STA channel width: any
		 * RIFS: 0
		 * HT protection: nonmember
		 * non-GF present: 1
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: TKIP CCMP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	Extended capabilities: HT Information Exchange Supported
	Country: GB	Environment: Indoor/Outdoor
		Channels [1 - 14] @ 16 dBm
BSS e0:91:f5:6c:71:a0 (on wlan0)
	TSF: 1813116928390 usec (20d, 23:38:36)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortSlotTime (0x0411)
	signal: -88.00 dBm
	last seen: 12912 ms ago
	SSID: DOM
	Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
	DS Parameter set: channel 1
	TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: 16-PTKSA-RC (0x000c)
	Extended supported rates: 6.0 9.0 12.0 48.0 
	HT capabilities:
		Capabilities: 0x187c
			HT20
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 1
		 * HT protection: no
		 * non-GF present: 1
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 00:25:9c:b3:0c:eb (on wlan0)
	TSF: 1284917913984 usec (14d, 20:55:17)
	freq: 2462
	beacon interval: 75
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -89.00 dBm
	last seen: 12704 ms ago
	SSID: bcn
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 11
	TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
	ERP: <no flags>
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: TKIP
		 * Authentication suites: PSK
	Extended supported rates: 24.0 36.0 48.0 54.0 
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
BSS f8:d1:11:48:92:10 (on wlan0)
	TSF: 2724264384005 usec (31d, 12:44:24)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortSlotTime (0x0411)
	signal: -90.00 dBm
	last seen: 6200 ms ago
	SSID: a46
	Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
	DS Parameter set: channel 1
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: 16-PTKSA-RC (0x000c)
	Extended supported rates: 6.0 9.0 12.0 48.0 
	HT capabilities:
		Capabilities: 0x187c
			HT20
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 1
		 * HT protection: nonmember
		 * non-GF present: 1
		 * OBSS non-GF present: 1
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
		 * Selected Registrar: 0x0
		 * Response Type: 3 (AP)
		 * UUID: 729d0618-112d-b327-077c-52d51e0bd1dc
		 * Manufacturer: TP-LINK
		 * Model: TP-LINK
		 * Model Number: 123456
		 * Serial Number: 1234
		 * Primary Device Type: 6-0050f204-1
		 * Device name: TD-W8960N
		 * Config methods: Display, PBC
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS e0:91:f5:5a:70:be (on wlan0)
	TSF: 1566370509184 usec (18d, 03:06:10)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -70.00 dBm
	last seen: 6192 ms ago
	SSID: Sphere13
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 1
	TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: (0x0000)
	Extended supported rates: 24.0 36.0 48.0 54.0 
	WMM:	 * Parameter version 1
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
	HT capabilities:
		Capabilities: 0x104c
			HT20
			SM Power Save disabled
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 1
		 * HT protection: no
		 * non-GF present: 0
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	Country: GB	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 20 dBm
BSS 54:e6:fc:96:72:cc (on wlan0)
	TSF: 2724241408385 usec (31d, 12:44:01)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
	signal: -90.00 dBm
	last seen: 1700 ms ago
	SSID: dom
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 12.0 24.0 36.0 
	DS Parameter set: channel 1
	TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
	ERP: <no flags>
	Extended supported rates: 9.0 18.0 48.0 54.0 
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: TKIP CCMP
		 * Authentication suites: PSK
		 * Capabilities: PreAuth (0x0001)
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: TKIP CCMP
		 * Authentication suites: PSK
BSS d0:66:7b:9d:f8:74 (on wlan0)
	TSF: 7799091587 usec (0d, 02:09:59)
	freq: 2412
	beacon interval: 100
	capability: ESS Privacy SpectrumMgmt ShortSlotTime (0x0511)
	signal: -88.00 dBm
	last seen: 1656 ms ago
	SSID: SEC_LinkShare_9564dd
	Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
	DS Parameter set: channel 1
	TIM: DTIM Count 0 DTIM Period 3 Bitmap Control 0x0 Bitmap[0] 0x0
	Country: XU	Environment: Indoor/Outdoor
		Channels [1 - 13] @ 20 dBm
	Power constraint: 0 dB
	ERP: <no flags>
	RSN:	 * Version: 1
		 * Group cipher: CCMP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: 16-PTKSA-RC (0x000c)
	Extended supported rates: 6.0 9.0 12.0 48.0 
	HT capabilities:
		Capabilities: 0x186c
			HT20
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
		Minimum RX AMPDU time spacing: 8 usec (0x06)
		HT RX MCS rate indexes supported: 0-15
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 1
		 * HT protection: no
		 * non-GF present: 0
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 2 (Configured)
	WMM:	 * Parameter version 1
		 * u-APSD
		 * BE: CW 15-1023, AIFSN 3
		 * BK: CW 15-1023, AIFSN 7
		 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
		 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec

[-- Attachment #3: iwphy.txt --]
[-- Type: text/plain, Size: 4201 bytes --]

Wiphy phy0
	Band 1:
		Capabilities: 0x820
			HT20
			Static SM Power Save
			RX HT20 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT RX MCS rate indexes supported: 0-23
		TX unequal modulation not supported
		HT TX Max spatial streams: 2
		HT TX MCS rate indexes supported may differ
		Frequencies:
			* 2412 MHz [1] (14.0 dBm)
			* 2417 MHz [2] (14.0 dBm)
			* 2422 MHz [3] (14.0 dBm)
			* 2427 MHz [4] (14.0 dBm)
			* 2432 MHz [5] (14.0 dBm)
			* 2437 MHz [6] (14.0 dBm)
			* 2442 MHz [7] (14.0 dBm)
			* 2447 MHz [8] (14.0 dBm)
			* 2452 MHz [9] (14.0 dBm)
			* 2457 MHz [10] (14.0 dBm)
			* 2462 MHz [11] (14.0 dBm)
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
	Band 2:
		Capabilities: 0x862
			HT20/HT40
			Static SM Power Save
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT RX MCS rate indexes supported: 0-23, 32
		TX unequal modulation not supported
		HT TX Max spatial streams: 2
		HT TX MCS rate indexes supported may differ
		Frequencies:
			* 5180 MHz [36] (15.0 dBm) (passive scanning, no IBSS)
			* 5200 MHz [40] (15.0 dBm) (passive scanning, no IBSS)
			* 5220 MHz [44] (15.0 dBm) (passive scanning, no IBSS)
			* 5240 MHz [48] (15.0 dBm) (passive scanning, no IBSS)
			* 5260 MHz [52] (15.0 dBm) (passive scanning, no IBSS, radar detection)
			* 5280 MHz [56] (15.0 dBm) (passive scanning, no IBSS, radar detection)
			* 5300 MHz [60] (15.0 dBm) (passive scanning, no IBSS, radar detection)
			* 5320 MHz [64] (15.0 dBm) (passive scanning, no IBSS, radar detection)
			* 5745 MHz [149] (16.0 dBm) (passive scanning, no IBSS)
			* 5765 MHz [153] (16.0 dBm) (passive scanning, no IBSS)
			* 5785 MHz [157] (16.0 dBm) (passive scanning, no IBSS)
			* 5805 MHz [161] (16.0 dBm) (passive scanning, no IBSS)
			* 5825 MHz [165] (16.0 dBm) (passive scanning, no IBSS)
		Bitrates (non-HT):
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
	max # scan SSIDs: 20
	max scan IEs length: 127 bytes
	Coverage class: 0 (up to 0m)
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP (00-0f-ac:4)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * monitor
	software interface modes (can always be added):
		 * monitor
	interface combinations are not supported
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * new_beacon
		 * new_station
		 * new_mpath
		 * set_mesh_params
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * remain_on_channel
		 * set_tx_bitrate_mask
		 * action
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * connect
		 * disconnect
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0

^ permalink raw reply

* Re: Replacement for local->hw.conf.channel
From: Ben Greear @ 2013-07-09 16:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1373380545.8241.1.camel@jlt4.sipsolutions.net>

On 07/09/2013 07:35 AM, Johannes Berg wrote:
>
>>> No, don't use that in any new code. It's purely for compatibility with
>>> drivers that aren't converted to channel contexts (yet).
>>>
>>>> In 3.9, ath9k_htc was giving me a null channel in the code below:
>>>>
>>>> 	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
>>>> 	if (chanctx_conf)
>>>> 		channel = chanctx_conf->def.chan;
>>>> 	else
>>>> 		channel = NULL;
>>>
>>> Well that of course happens if the vif isn't bound to a channel context.
>>
>> Any opinions on what to return in ethtool stats for frequency if
>> there is no channel context?
>
> Why even bother doing so? "iw dev" shows the frequency and channel width
> just fine, no?

Ethtool API can be a lot easier to code to than netlink (or parsing
iw text output), but it's a small issue.

If iw does return the results I'd be looking for, then maybe I can
go figure out how it gets that info in the kernel and use that
in the netlink code.

>> If there is a quick way to just return whatever the hardware is
>> currently using, I think that is best, but if there is not
>> a reliable way to do this then, some hard coded default
>> like 0 is probably best.
>
> Well there's no such concept as "what the hardware is currently using"
> in this case, the channel is completely pointless when there's no
> channel context at all. There might be something like the current scan
> channel, but what value would there be in returning that?

Ok, it's not a big deal either way...and I can work around it in user-space
by walking the list of all VIFs on a radio and grab the channel of any
that are actually associated and returning good info...

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: [PATCH v13 2/2] cfg80211: P2P find phase offload
From: Vladimir Kondratiev @ 2013-07-09 16:04 UTC (permalink / raw)
  To: Johannes Berg, Jouni Malinen
  Cc: linux-wireless, Luis R . Rodriguez, John W . Linville,
	Arend van Spriel, Ilan Peer
In-Reply-To: <1373383341.8241.8.camel@jlt4.sipsolutions.net>

On Tuesday, July 09, 2013 05:22:21 PM Johannes Berg wrote:
> 
> A few nits, since you're going to have to resend anyway (this patch is
> also line-wrapped)
> 
> 
> > NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD
> 
> Is that actually needed at all? Now that we have the "replied" flag in
> the first patch, it seems like this wouldn't be used at all?

I was thinking about it; and argument to keep this flag is:
It is hint for wpa_s, indicating that it may be that frame was answered by
card and not reported. Imagine card that answer everything in firmware and
don't report any probes at all. Without this hint, wpa_s may mis-interpret
this as complete silence.

But, to be honest, I am not absolutely sure it is required. If Jouni say he
don't need this indication, I'll remove it.

Jouni: could you please comment?

> 
> >  			CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
> > +			CMD(start_p2p_find, START_P2P_FIND);
> > +			CMD(stop_p2p_find, STOP_P2P_FIND);
> 
> That'll probably have to be changed when mac80211 supports this, but we
> don't have to worry about it right now.
> 
> > +}
> > +static int nl80211_start_p2p_find(struct sk_buff *skb, struct genl_info 
> > *info)
> 
> There should be a blank line between the two functions

:) checkpatch was silent about it

> 
> > +	params.channels = kzalloc(n_channels * sizeof(*params.channels),
> > +				  GFP_KERNEL);
> 
> kcalloc? Probably doesn't matter much though.
Good point. Why not?

> 
> > +	attr = info->attrs[NL80211_ATTR_MIN_DISCOVERABLE_INTERVAL];
> > +	if (attr)
> > +		params.min_discoverable_interval = nla_get_u32(attr);
> > +
> > +	attr = info->attrs[NL80211_ATTR_MAX_DISCOVERABLE_INTERVAL];
> > +	if (attr)
> > +		params.max_discoverable_interval = nla_get_u32(attr);
> 
> No validation at all? What if I pass 7/3 for min/max (yes, in that
> order)?
Yes, need to validate all data from user space.
> 
> johannes
> 

^ permalink raw reply

* Re: [PATCH v13 1/2] cfg80211: add 'flags' to cfg80211_rx_mgmt()
From: Vladimir Kondratiev @ 2013-07-09 15:41 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, Luis R . Rodriguez, John W . Linville,
	Jouni Malinen, Arend van Spriel, Ilan Peer
In-Reply-To: <1373382929.8241.3.camel@jlt4.sipsolutions.net>

On Tuesday, July 09, 2013 05:15:29 PM Johannes Berg wrote:
> On Wed, 2013-07-03 at 17:37 +0300, Vladimir Kondratiev wrote:
> > Flags intended to report various auxiliary information.
> > Introduced flag NL80211_RXMGMT_FLAG_REPLIED to report
> > whether frame was replied by the device/driver.
> 
> This looks fine to me, but the patch is line-wrapped and won't apply:
> 
> > @@ -608,8 +608,7 @@ static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, 
> > u8 *datap, int len,
> 
> 
> 
> You also sent me at least three versions of it and I don't really want
> to figure out what that meant.
> 
> johannes
> 
My mailing system went crazy for couple of days. Sorry for this.
All versions should be the same. I'll resend anyway,
as patch 2 require some edition.

Thanks, Vladimir

^ permalink raw reply

* Re: [PATCHv6 00/18] Add support for 5 and 10 MHz channels
From: Simon Wunderlich @ 2013-07-09 15:29 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Simon Wunderlich, linux-wireless, Mathias Kretschmer,
	Simon Wunderlich
In-Reply-To: <1373382510.8241.2.camel@jlt4.sipsolutions.net>

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

On Tue, Jul 09, 2013 at 05:08:30PM +0200, Johannes Berg wrote:
> On Mon, 2013-07-08 at 16:55 +0200, Simon Wunderlich wrote:
> > This patchset adds support for 5 and 10 MHz in nl80211/cfg80211/mac80211
> > and enables support in ath5k and ath9k, which already support this feature
> > on the driver side. 5 and 10 MHz wide channels might be useful for:
> > 
> >  * long shot links, as the transmissions are more robust
> >  * future support for 802.11y which allows some 5 and 10 MHz channels in
> >    3.6 GHz range
> >  * future support for 802.11p which uses 10 MHz in 5.9 GHz range
> >  * ... and more "special" applications.
> > 
> > This patchset enables 5 and 10 MHz channels only for OFDM, and without
> > HT/MIMO/aggregation (for now). Support may be added later.
> 
> I've applied patches 1-10, not going to take the ath patches.

Thanks! I'll ask John to merge them when pulls mac80211-next, you might want
to mention that in your pull request too.

Thanks again,
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ 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