rt2x00: Correctly set ACK bit in tx descriptors
authorMattias Nissler <mattias.nissler@gmx.de>
Sat, 27 Oct 2007 11:43:49 +0000 (13:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:03:04 +0000 (15:03 -0800)
Add a flag to struct txdata_entry_desc that specifies whether an ack for the
frame is to be expected. Use this flag to set the ACK bit in the tx descriptor.
Previously, the ACK bit could be set incorrectly on CTS-to-self frames, so they
caused retries and were reported to be failed in the txdone handlers.

Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00ring.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 8889f6d18dce33dc15c5a1803ff7469292ce5a84..d48b6ca9845a6e2aa8c723aac623524db528e4db 100644 (file)
@@ -1072,7 +1072,7 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_MORE_FRAG,
                           test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_ACK,
-                          !(control->flags & IEEE80211_TXCTL_NO_ACK));
+                          test_bit(ENTRY_TXD_ACK, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_RTS,
index 1dea9d800d4781f9710aea065f56d8a954382974..e6a0c37d919539b6a6263c8c9d876d1c9ca7061d 100644 (file)
@@ -1203,7 +1203,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_MORE_FRAG,
                           test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_ACK,
-                          !(control->flags & IEEE80211_TXCTL_NO_ACK));
+                          test_bit(ENTRY_TXD_ACK, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
index a00420e9626b65fd4670bedd2e7b7b79f86a8073..e9f99c48ef2df41df5b888f62586945312069691 100644 (file)
@@ -1058,7 +1058,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_MORE_FRAG,
                           test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_ACK,
-                          !(control->flags & IEEE80211_TXCTL_NO_ACK));
+                          test_bit(ENTRY_TXD_ACK, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
index 304830b8d16ddd9a2e63de1c81dbc78509183c33..3ab1fb993d6f2a717117da8e4a7520ed99b0a4e8 100644 (file)
@@ -628,13 +628,22 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 
        tx_rate = control->tx_rate;
 
+       /*
+        * Check whether this frame is to be acked
+        */
+       if (!(control->flags & IEEE80211_TXCTL_NO_ACK))
+               __set_bit(ENTRY_TXD_ACK, &desc.flags);
+
        /*
         * Check if this is a RTS/CTS frame
         */
        if (is_rts_frame(frame_control) || is_cts_frame(frame_control)) {
                __set_bit(ENTRY_TXD_BURST, &desc.flags);
-               if (is_rts_frame(frame_control))
+               if (is_rts_frame(frame_control)) {
                        __set_bit(ENTRY_TXD_RTS_FRAME, &desc.flags);
+                       __set_bit(ENTRY_TXD_ACK, &desc.flags);
+               } else
+                       __clear_bit(ENTRY_TXD_ACK, &desc.flags);
                if (control->rts_cts_rate)
                        tx_rate = control->rts_cts_rate;
        }
index ee6c423a53d98a3a705f79089348788bf6bd5c5d..5b871adfa22a53a4e1059f09075f65b70198d2f0 100644 (file)
@@ -52,6 +52,7 @@ struct txdata_entry_desc {
 #define ENTRY_TXD_MORE_FRAG    4
 #define ENTRY_TXD_REQ_TIMESTAMP        5
 #define ENTRY_TXD_BURST                6
+#define ENTRY_TXD_ACK          7
 
 /*
  * Queue ID. ID's 0-4 are data TX rings
index f3c4cbe734ec22deb3b33428344da7fb9f322ff9..606cf1299fff47bc19d91023526b14e117ac9f34 100644 (file)
@@ -1578,7 +1578,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_MORE_FRAG,
                           test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_ACK,
-                          !(control->flags & IEEE80211_TXCTL_NO_ACK));
+                          test_bit(ENTRY_TXD_ACK, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
index 7caa3639dadf3d495ca63df1f49d2ffab3b91dae..4d1227aef08950bb7b64c4b4aac2dc09f988f804 100644 (file)
@@ -1275,7 +1275,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_MORE_FRAG,
                           test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_ACK,
-                          !(control->flags & IEEE80211_TXCTL_NO_ACK));
+                          test_bit(ENTRY_TXD_ACK, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,