rt2x00: Fix beacon de-synchronization while update beacon
authorIgor Perminov <igor.perminov@inbox.ru>
Sun, 9 Aug 2009 22:58:54 +0000 (00:58 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Aug 2009 13:13:55 +0000 (09:13 -0400)
When beacon is being updated to refresh TIM (AP mode), beacon frames are
de-synchronizing (i.e. two neighbor beacon frames - before and after
update - are being transmitted with a wrong time interval).
That is because xxx_write_beacon should disable beacon generation only
while beacon data are being uploaded to the device, but it should not
disable the beacon clock.

Signed-off-by: Igor Perminov <igor.perminov@inbox.ru>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 30185ad28d9321ab887f08e3c757417430497b05..164df9347a2f9762367889495dacf1378bd8e95c 100644 (file)
@@ -1069,8 +1069,6 @@ static void rt2400pci_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
-       rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
-       rt2x00_set_field32(&reg, CSR14_TBCN, 0);
        rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
        rt2x00pci_register_write(rt2x00dev, CSR14, reg);
 
index 3b3171578b1445952987f28fdd7a64f53c1ada8b..4186582f2770df1cc6e1ee98a947973d169c3d7b 100644 (file)
@@ -1227,8 +1227,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
-       rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
-       rt2x00_set_field32(&reg, CSR14_TBCN, 0);
        rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
        rt2x00pci_register_write(rt2x00dev, CSR14, reg);
 
index de48c5c68eff59148cb34fc95f32852233e1eb7e..09a589432dabf11731aef04318c42e7c5f576a69 100644 (file)
@@ -1238,8 +1238,6 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg);
-       rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 0);
-       rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 0);
        rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
        rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
 
@@ -1287,7 +1285,7 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry)
 static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
                                    const enum data_queue_qid queue)
 {
-       u16 reg;
+       u16 reg, reg0;
 
        if (queue != QID_BEACON) {
                rt2x00usb_kick_tx_queue(rt2x00dev, queue);
@@ -1298,16 +1296,19 @@ static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        if (!rt2x00_get_field16(reg, TXRX_CSR19_BEACON_GEN)) {
                rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 1);
                rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 1);
+               reg0 = reg;
                rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 1);
                /*
                 * Beacon generation will fail initially.
-                * To prevent this we need to register the TXRX_CSR19
-                * register several times.
+                * To prevent this we need to change the TXRX_CSR19
+                * register several times (reg0 is the same as reg
+                * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0
+                * and 1 in reg).
                 */
                rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
-               rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0);
+               rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
                rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
-               rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0);
+               rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0);
                rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
        }
 }
index 2de0389d823d0ba5024805100f6a162f9c73a2e1..3856f06fdca7a610b163ffe9d5da1307f7f2744e 100644 (file)
@@ -2050,8 +2050,6 @@ static void rt2800usb_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
-       rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
-       rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
        rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
        rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 
index 3447997fc71a077b9a8c036085399e36a705cafb..f4b4b86da4da5b1e7f8935982b4731ac99bc1685 100644 (file)
@@ -1855,8 +1855,6 @@ static void rt61pci_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, &reg);
-       rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
-       rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
        rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
 
index 4b9955b1c70e565b5899c0ab901f3f6851ea2c31..4d94b65943f19b71e798fc26d2b30cffab32cdb5 100644 (file)
@@ -1527,8 +1527,6 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
         * otherwise we might be sending out invalid data.
         */
        rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
-       rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
-       rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);