[rt2x00-users] RT73 (and others): Beacon interval problem

Bertold Van den Bergh vandenbergh at bertold.org
Thu Sep 22 03:17:22 AEST 2011


I have observed the following bug:
When hostapd is being started the first time, the beacons are
transmitted at the specified interval, now hostapd is restarted
without doing anything to its config or touching the rt2x00 module,
beacons are now transmitted insanely fast (1000 per second or
something along those lines). When the beacon interval in the hostapd
config file is changed to something else and hostapd restarted, proper
timing is again achieved.

I have tracked down the problem, and found that mac80211 does not call
rt2x00mac_bss_info_changed with changes set to BSS_CHANGED_BEACON_INT,
because the beacon interval has not changed between restarts, but the
interface has been disabled and reenabled by hostapd, thus executing
this code
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_INTERVAL, 0);
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, 0);
which sets the beacon interval to zero, causing the very fast
transmission. Changing the beacon interval in hostapd makes the
function to set the interval be called at startup and fixes the

This patch resolved the issue for rt73, but the same code is present
in the drivers for the other cards aswell, so it might be better to
call .config_erp with the previous beacon_interval whenever the first
beacon is loaded after the interface was disabled.

--- a/drivers/net/wireless/rt2x00/rt73usb.c     2011-09-21
18:43:24.964247635 +0200
+++ b/drivers/net/wireless/rt2x00/rt73usb.c     2011-09-21
18:45:05.867789002 +0200
@@ -1211,14 +1212,15 @@
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR8, reg);

        rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
-       rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_INTERVAL, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0);
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);

        rt2x00usb_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f);

        rt2x00usb_register_read(rt2x00dev, MAC_CSR6, &reg);
@@ -1375,12 +1377,18 @@

 static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev)
+       u32 reg;
        rt2x00usb_register_write(rt2x00dev, MAC_CSR10, 0x00001818);

         * Disable synchronisation.
-       rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, 0);
+       rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
+       rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
+       rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);


Bertold Van den Bergh

More information about the users mailing list