diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 40 |
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 | } |