Skip to contentSkip to conversation

rt2x00: Fix TX status reporting for rt2800pci.

PATCH In review Alban Browaeys 3 participants 3 messages Feb 28, 2010 – Mar 1, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00: Fix TX status reporting for rt2800pci.

After testing, we found that TX_STA_FIFO_MCS is the last MCS value tried. If the transmission failed, 8 frames have been transmitted. If the transmission succeed, we can easily compute the number of retry. This patch fix the way status is reported to mac80211 rate control. It has 2 bugs :

1. mcs can contain the short preamble flag and it will lead to wrong computations.

2. minstrel nearly always say that 54 Mbits is the best rate, even if we are very far from the AP

---

This patch applies above : "rt2x00: txdone implementation supporting hw encryption." This is trimmed down compared to the previous version. It removes anything not specific to rt2800pci as the why notes were lost I kept only the fix and not the more in depth rewrite.

 drivers/net/wireless/rt2x00/rt2800pci.c |   40 +++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 15 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +25 -15
index 7049c74..316beb0 100644
@@ -974,26 +974,36 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
 		 * Obtain the status about this packet.
 		 */
 		txdesc.flags = 0;
-		if (rt2x00_get_field32(reg, TX_STA_FIFO_TX_SUCCESS))
-			__set_bit(TXDONE_SUCCESS, &txdesc.flags);
-		else
-			__set_bit(TXDONE_FAILURE, &txdesc.flags);
+		rt2x00_desc_read(txwi, 0, &word);
+		mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
+		real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
 
 		/*
 		 * Ralink has a retry mechanism using a global fallback
-		 * table. We setup this fallback table to try immediate
-		 * lower rate for all rates. In the TX_STA_FIFO,
-		 * the MCS field contains the MCS used for the successfull
-		 * transmission. If the first transmission succeed,
-		 * we have mcs == tx_mcs. On the second transmission,
-		 * we have mcs = tx_mcs - 1. So the number of
-		 * retry is (tx_mcs - mcs).
+		 * table. We setup this fallback table to try the immediate
+		 * lower rate for all rates. In the TX_STA_FIFO, the MCS field
+		 * always contains the MCS used for the last transmission, be
+		 * it successful or not.
 		 */
-		rt2x00_desc_read(txwi, 0, &word);
-		mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
-		real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
+		if (rt2x00_get_field32(reg, TX_STA_FIFO_TX_SUCCESS)) {
+			/*
+			 * Transmission succeeded. The number of retries is
+			 * mcs - real_mcs
+			 */
+			__set_bit(TXDONE_SUCCESS, &txdesc.flags);
+			txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0);
+		} else {
+			/*
+			 * Transmission failed. The number of retries is
+			 * always 7 in this case (for a total number of 8
+			 * frames sent).
+			 */
+			__set_bit(TXDONE_FAILURE, &txdesc.flags);
+			txdesc.retry = 7;
+		}
+
 		__set_bit(TXDONE_FALLBACK, &txdesc.flags);
-		txdesc.retry = mcs - min(mcs, real_mcs);
+
 
 		rt2x00lib_txdone(entry, &txdesc);
 	}
Signature · 1 line
1.7.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alban Browaeys

After testing, we found that TX_STA_FIFO_MCS is the last MCS value tried. If the transmission failed, 8 frames have been transmitted. If the transmission succeed, we can easily compute the number of retry. This patch fix
the way status is reported to mac80211 rate control. It has 2 bugs :

1. mcs can contain the short preamble flag and it will lead to wrong computations.

Quoted 7 lines

2. minstrel nearly always say that 54 Mbits is the best rate, even if we are
very far from the AP

---

Acked-by on v1 1/1
#2 lore raw
In reply to Alban Browaeys
Quoted 5 lines · Alban Browaeys

After testing, we found that TX_STA_FIFO_MCS is the last MCS value tried. If the transmission failed, 8 frames have been transmitted. If the transmission succeed, we can easily compute the number of retry. This patch fix the way status is reported to mac80211 rate control. It has 2 bugs :

Quoted 8 lines

1. mcs can contain the short preamble flag and it will lead to wrong computations.

2. minstrel nearly always say that 54 Mbits is the best rate, even if we are very far from the AP