aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorAlban Browaeys <prahal@yahoo.com>2010-02-28 11:14:40 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-03-16 14:52:00 -0400
commitbf18723d50206a0b485e438f14c22faf91a3908f (patch)
tree94870a1a7f0b771bd3d6d0a6e4a084ecbde70cf7 /drivers/net/wireless/rt2x00
parent632dd959d13d7b96b8eeb2af77b4511053c04633 (diff)
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 Signed-off-by: Benoit Papillault <benoit.papillault@free.fr> Signed-off-by: Alban Browaeys <prahal@yahoo.com> Acked-by: Ivo van Doorn <ivdoorn@gmail.com> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 2f42e01eb99d..b1f5643f83fc 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -974,26 +974,36 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
974 * Obtain the status about this packet. 974 * Obtain the status about this packet.
975 */ 975 */
976 txdesc.flags = 0; 976 txdesc.flags = 0;
977 if (rt2x00_get_field32(reg, TX_STA_FIFO_TX_SUCCESS)) 977 rt2x00_desc_read(txwi, 0, &word);
978 __set_bit(TXDONE_SUCCESS, &txdesc.flags); 978 mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
979 else 979 real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
980 __set_bit(TXDONE_FAILURE, &txdesc.flags);
981 980
982 /* 981 /*
983 * Ralink has a retry mechanism using a global fallback 982 * Ralink has a retry mechanism using a global fallback
984 * table. We setup this fallback table to try immediate 983 * table. We setup this fallback table to try the immediate
985 * lower rate for all rates. In the TX_STA_FIFO, 984 * lower rate for all rates. In the TX_STA_FIFO, the MCS field
986 * the MCS field contains the MCS used for the successfull 985 * always contains the MCS used for the last transmission, be
987 * transmission. If the first transmission succeed, 986 * it successful or not.
988 * we have mcs == tx_mcs. On the second transmission,
989 * we have mcs = tx_mcs - 1. So the number of
990 * retry is (tx_mcs - mcs).
991 */ 987 */
992 rt2x00_desc_read(txwi, 0, &word); 988 if (rt2x00_get_field32(reg, TX_STA_FIFO_TX_SUCCESS)) {
993 mcs = rt2x00_get_field32(word, TXWI_W0_MCS); 989 /*
994 real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS); 990 * Transmission succeeded. The number of retries is
991 * mcs - real_mcs
992 */
993 __set_bit(TXDONE_SUCCESS, &txdesc.flags);
994 txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0);
995 } else {
996 /*
997 * Transmission failed. The number of retries is
998 * always 7 in this case (for a total number of 8
999 * frames sent).
1000 */
1001 __set_bit(TXDONE_FAILURE, &txdesc.flags);
1002 txdesc.retry = 7;
1003 }
1004
995 __set_bit(TXDONE_FALLBACK, &txdesc.flags); 1005 __set_bit(TXDONE_FALLBACK, &txdesc.flags);
996 txdesc.retry = mcs - min(mcs, real_mcs); 1006
997 1007
998 rt2x00lib_txdone(entry, &txdesc); 1008 rt2x00lib_txdone(entry, &txdesc);
999 } 1009 }