linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT/RFC 1/2] b43legacy: Fixes for beacons
@ 2009-03-17  4:17 Larry Finger
  0 siblings, 0 replies; 5+ messages in thread
From: Larry Finger @ 2009-03-17  4:17 UTC (permalink / raw)
  To: david; +Cc: linux-wireless

This patch ports the beaconing fixes from commit a82d992261f "b43: Beaconing
fixes" to b43legacy. Basically it prevents the card from triggering the beacon
IRQ over and over again.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Index: wireless-testing/drivers/net/wireless/b43legacy/b43legacy.h
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43legacy/b43legacy.h
+++ wireless-testing/drivers/net/wireless/b43legacy/b43legacy.h
@@ -59,7 +59,8 @@
 #define B43legacy_MMIO_XMITSTAT_1		0x174
 #define B43legacy_MMIO_REV3PLUS_TSF_LOW	0x180 /* core rev >= 3 only */
 #define B43legacy_MMIO_REV3PLUS_TSF_HIGH	0x184 /* core rev >= 3 only */
-
+#define B43legacy_MMIO_TSF_CFP_REP	0x188
+#define B43legacy_MMIO_TSF_CFP_START	0x18C
 /* 32-bit DMA */
 #define B43legacy_MMIO_DMA32_BASE0	0x200
 #define B43legacy_MMIO_DMA32_BASE1	0x220
@@ -614,6 +615,7 @@ struct b43legacy_wl {
 	struct sk_buff *current_beacon;
 	bool beacon0_uploaded;
 	bool beacon1_uploaded;
+	struct work_struct beacon_update_trigger;
 };
 
 /* Pointers to the firmware data and meta information about it. */
Index: wireless-testing/drivers/net/wireless/b43legacy/main.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43legacy/main.c
+++ wireless-testing/drivers/net/wireless/b43legacy/main.c
@@ -1013,7 +1013,8 @@ static void b43legacy_write_beacon_templ
 		b43legacywarn(dev->wl, "Did not find a valid TIM IE in the "
 			      "beacon template packet. AP or IBSS operation "
 			      "may be broken.\n");
-	}
+	} else
+		b43legacydbg(dev->wl, "Updated beacon template\n");
 }
 
 static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev,
@@ -1133,6 +1134,27 @@ static void b43legacy_write_probe_resp_t
 	kfree(probe_resp_data);
 }
 
+static void b43legacy_beacon_update_trigger_work(struct work_struct *work)
+{
+	struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl,
+					 beacon_update_trigger);
+	struct b43legacy_wldev *dev;
+
+	mutex_lock(&wl->mutex);
+	dev = wl->current_dev;
+	if (likely(dev && (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED))) {
+		/* Force the microcode to trigger the
+		 * beacon update bottom-half IRQ. */
+		spin_lock_irq(&wl->irq_lock);
+		b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
+			    b43legacy_read32(dev, B43legacy_MMIO_MACCMD)
+			    | B43legacy_MACCMD_BEACON0_VALID
+			    | B43legacy_MACCMD_BEACON1_VALID);
+		spin_unlock_irq(&wl->irq_lock);
+	}
+	mutex_unlock(&wl->mutex);
+}
+
 /* Asynchronously update the packet templates in template RAM.
  * Locking: Requires wl->irq_lock to be locked. */
 static void b43legacy_update_templates(struct b43legacy_wl *wl)
@@ -1156,25 +1178,31 @@ static void b43legacy_update_templates(s
 	wl->current_beacon = beacon;
 	wl->beacon0_uploaded = 0;
 	wl->beacon1_uploaded = 0;
+	queue_work(wl->hw->workqueue, &wl->beacon_update_trigger);
 }
 
 static void b43legacy_set_beacon_int(struct b43legacy_wldev *dev,
 				     u16 beacon_int)
 {
 	b43legacy_time_lock(dev);
-	if (dev->dev->id.revision >= 3)
-		b43legacy_write32(dev, 0x188, (beacon_int << 16));
-	else {
+	if (dev->dev->id.revision >= 3) {
+		b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_REP,
+				 (beacon_int << 16));
+		b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_START,
+				 (beacon_int << 10));
+	} else {
 		b43legacy_write16(dev, 0x606, (beacon_int >> 6));
 		b43legacy_write16(dev, 0x610, beacon_int);
 	}
 	b43legacy_time_unlock(dev);
+	b43legacydbg(dev->wl, "Set beacon interval to %u\n", beacon_int);
 }
 
 static void handle_irq_beacon(struct b43legacy_wldev *dev)
 {
 	struct b43legacy_wl *wl = dev->wl;
 	u32 cmd;
+	u32 beacon0_valid, beacon1_valid;
 
 	if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP))
 		return;
@@ -1182,7 +1210,11 @@ static void handle_irq_beacon(struct b43
 	/* This is the bottom half of the asynchronous beacon update. */
 
 	cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD);
-	if (!(cmd & B43legacy_MACCMD_BEACON0_VALID)) {
+	beacon0_valid = (cmd & B43legacy_MACCMD_BEACON0_VALID);
+	beacon1_valid = (cmd & B43legacy_MACCMD_BEACON1_VALID);
+	cmd &= ~(B43legacy_MACCMD_BEACON0_VALID | B43legacy_MACCMD_BEACON1_VALID);
+
+	if (!beacon0_valid) {
 		if (!wl->beacon0_uploaded) {
 			b43legacy_write_beacon_template(dev, 0x68,
 							B43legacy_SHM_SH_BTL0,
@@ -1193,8 +1225,7 @@ static void handle_irq_beacon(struct b43
 			wl->beacon0_uploaded = 1;
 		}
 		cmd |= B43legacy_MACCMD_BEACON0_VALID;
-	}
-	if (!(cmd & B43legacy_MACCMD_BEACON1_VALID)) {
+	} else if (!beacon1_valid) {
 		if (!wl->beacon1_uploaded) {
 			b43legacy_write_beacon_template(dev, 0x468,
 							B43legacy_SHM_SH_BTL1,
@@ -3429,6 +3460,7 @@ static void b43legacy_op_stop(struct iee
 	struct b43legacy_wldev *dev = wl->current_dev;
 
 	b43legacy_rfkill_exit(dev);
+	cancel_work_sync(&(wl->beacon_update_trigger));
 
 	mutex_lock(&wl->mutex);
 	if (b43legacy_status(dev) >= B43legacy_STAT_STARTED)
@@ -3760,6 +3792,7 @@ static int b43legacy_wireless_init(struc
 	spin_lock_init(&wl->leds_lock);
 	mutex_init(&wl->mutex);
 	INIT_LIST_HEAD(&wl->devlist);
+	INIT_WORK(&wl->beacon_update_trigger, b43legacy_beacon_update_trigger_work);
 
 	ssb_set_devtypedata(dev, wl);
 	b43legacyinfo(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id);

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

* Re: [RFT/RFC 1/2] b43legacy: Fixes for beacons
@ 2009-03-26 19:58 Larry Finger
  2009-03-26 21:26 ` David Ellingsworth
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2009-03-26 19:58 UTC (permalink / raw)
  To: david; +Cc: linux-wireless

This patch ports the beaconing fixes from commit a82d992261f "b43: Beaconing
fixes" to b43legacy. Basically it prevents the card from triggering the beacon
IRQ over and over again.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Did these 2 patches work for you?

Larry




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

* Re: [RFT/RFC 1/2] b43legacy: Fixes for beacons
  2009-03-26 19:58 [RFT/RFC 1/2] b43legacy: Fixes for beacons Larry Finger
@ 2009-03-26 21:26 ` David Ellingsworth
  2009-03-26 22:48   ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: David Ellingsworth @ 2009-03-26 21:26 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

On Thu, Mar 26, 2009 at 3:58 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> This patch ports the beaconing fixes from commit a82d992261f "b43: Beaconing
> fixes" to b43legacy. Basically it prevents the card from triggering the beacon
> IRQ over and over again.
>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
>
> Did these 2 patches work for you?
>
> Larry
>

I haven't had a chance to test these as of yet. I had to wait a few
extra days in order for my new wireless card to come in (couldn't
really test in AP mode with only one card). I built a new kernel last
night with these patches, but I still need to setup and configure
hostapd. Hopefully, I'll know more later tonight. I'll run tests with
and without these patches.

Regards,

David Ellingsworth

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

* Re: [RFT/RFC 1/2] b43legacy: Fixes for beacons
  2009-03-26 21:26 ` David Ellingsworth
@ 2009-03-26 22:48   ` Larry Finger
  2009-03-31 22:29     ` David Ellingsworth
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2009-03-26 22:48 UTC (permalink / raw)
  To: David Ellingsworth; +Cc: linux-wireless

David Ellingsworth wrote:
> 
> I haven't had a chance to test these as of yet. I had to wait a few
> extra days in order for my new wireless card to come in (couldn't
> really test in AP mode with only one card). I built a new kernel last
> night with these patches, but I still need to setup and configure
> hostapd. Hopefully, I'll know more later tonight. I'll run tests with
> and without these patches.

OK. Please take whatever time you need. We already missed to 2.6.30 merge
window, thus we have a couple of months.

Larry

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

* Re: [RFT/RFC 1/2] b43legacy: Fixes for beacons
  2009-03-26 22:48   ` Larry Finger
@ 2009-03-31 22:29     ` David Ellingsworth
  0 siblings, 0 replies; 5+ messages in thread
From: David Ellingsworth @ 2009-03-31 22:29 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

On Thu, Mar 26, 2009 at 6:48 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> David Ellingsworth wrote:
>>
>> I haven't had a chance to test these as of yet. I had to wait a few
>> extra days in order for my new wireless card to come in (couldn't
>> really test in AP mode with only one card). I built a new kernel last
>> night with these patches, but I still need to setup and configure
>> hostapd. Hopefully, I'll know more later tonight. I'll run tests with
>> and without these patches.
>
> OK. Please take whatever time you need. We already missed to 2.6.30 merge
> window, thus we have a couple of months.
>
> Larry

I've had a chance to review these patches and while I haven't
experienced any crashes as a result of these patches, I haven't yet
been able to get hostapd to work properly with the b43legacy driver. I
haven't tried to set up an AP without the patches, but can test that
as well if the results might be useful. Below is the relevant
information:

Output from "hostapd -dddd ./hostap.conf":
------------------------------------------------
Configuration file: ./hostap.conf
Opening raw packet socket for ifindex -1211076240
BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
RATE[0] rate=10 flags=0x2
RATE[1] rate=20 flags=0x6
RATE[2] rate=55 flags=0x6
RATE[3] rate=110 flags=0x6
RATE[4] rate=60 flags=0x0
RATE[5] rate=90 flags=0x0
RATE[6] rate=120 flags=0x0
RATE[7] rate=180 flags=0x0
RATE[8] rate=240 flags=0x0
RATE[9] rate=360 flags=0x0
RATE[10] rate=480 flags=0x0
RATE[11] rate=540 flags=0x0
Passive scanning not supported
Flushing old station entries
Deauthenticate all stations
Mode: IEEE 802.11g  Channel: 1  Frequency: 2412 MHz
Using interface wlan0 with hwaddr ca:fe:ba:be:b0:0b and ssid 'test'
wlan0: Setup of interface done.
MGMT (TX callback) ACK
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
MGMT (TX callback) fail
mgmt::proberesp cb
MGMT (TX callback) fail
mgmt::proberesp cb
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
MGMT (TX callback) fail
mgmt::proberesp cb
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
MGMT (TX callback) fail
mgmt::proberesp cb
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
STA de:af:ca:fe:ba:be sent probe request for broadcast SSID
MGMT (TX callback) fail
mgmt::proberesp cb
^CSignal 2 received - terminating
Flushing old station entries
Deauthenticate all stations

Contents of hostap.conf:
------------------------------------------------
interface=wlan0
driver=nl80211

ssid=test
hw_mode=g
channel=1

wpa=0
auth_algs=1

Output from "wpa_supplicant -c ./wpa.conf -i wlan0 -dddd":
---------------------------------------------------
Initializing interface 'wlan0' conf './wpa.conf' driver 'default'
ctrl_interface 'N/A' bridge 'N/A'
Configuration file './wpa.conf' -> '/root/./wpa.conf'
Reading configuration file '/root/./wpa.conf'
ctrl_interface='/var/run/wpa_supplicant'
Line: 3 - start of a new network block
ssid - hexdump_ascii(len=8):
     74 65 73 74                           test
key_mgmt: 0x4
Priority group 0
   id=0 ssid='test'
Initializing interface (2) 'wlan0'
Interface wlan0 set UP - waiting a second for the driver to complete
initialization
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
  capabilities: key_mgmt 0xf enc 0xf flags 0x0
WEXT: Operstate: linkmode=1, operstate=5
Own MAC address: 00:1e:e5:20:1e:cd
wpa_driver_wext_set_wpa
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_countermeasures
wpa_driver_wext_set_drop_unencrypted
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Added interface wlan0
Ignore event for foreign ifindex 4
RTM_NEWLINK: operstate=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
Ignore event for foreign ifindex 4
RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
Wireless event: cmd=0x8b06 len=8
Ignore event for foreign ifindex 4
RTM_NEWLINK: operstate=0 ifi_flags=0x1043 ([UP][RUNNING])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Trying to get current scan results first without requesting a new scan
to speed up initial association
Received 0 bytes of scan results (0 BSSes)
CTRL-EVENT-SCAN-RESULTS
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 0 sec 0 usec
Starting AP scan (broadcast SSID)
Scan requested (ret=0) - scan timeout 5 seconds
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
Wireless event: cmd=0x8b19 len=8
Received 321 bytes of scan results (1 BSSes)
CTRL-EVENT-SCAN-RESULTS
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:1d:7e:37:73:09 ssid='*****' wpa_ie_len=24 rsn_ie_len=0 caps=0x11
   skip - SSID mismatch
Try to find non-WPA AP
0: 00:1d:7e:37:73:09 ssid='*****' wpa_ie_len=24 rsn_ie_len=0 caps=0x11
   skip - SSID mismatch
No suitable AP found.
Setting scan request: 5 sec 0 usec
EAPOL: disable timer tick
Starting AP scan (broadcast SSID)
Scan requested (ret=0) - scan timeout 30 seconds
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Contents of wpa.conf:
------------------------------------------------
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="test"
        key_mgmt=NONE
}

Leaving it run for an extended period of time exhibits the same
results. The client isn't ever able to locate the AP to connect to.
These tests were conducted using a b43 based card as the client and a
b43legacy card as the AP.

Regards,

David Ellingsworth

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

end of thread, other threads:[~2009-03-31 22:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 19:58 [RFT/RFC 1/2] b43legacy: Fixes for beacons Larry Finger
2009-03-26 21:26 ` David Ellingsworth
2009-03-26 22:48   ` Larry Finger
2009-03-31 22:29     ` David Ellingsworth
  -- strict thread matches above, loose matches on Subject: below --
2009-03-17  4:17 Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).