aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2010-06-14 16:13:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-15 16:02:20 -0400
commite6474c3c6d4839c73f363a0f44a347d804534758 (patch)
treefece688bbb2d95a9c785ae175125b96d2b7c102e
parenta5ea2f0255fe48af4864b41385fc28b4bc785ba6 (diff)
rt2x00: Limit TX done looping to number of TX ring entries
Similar to rt2800pci, remove the check for duplicate register reading, and instead limit the for-loop to the maximum number of TX entries inside a queue. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index d1270118f7d3..7ca383478eeb 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2052,29 +2052,24 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
2052 struct txdone_entry_desc txdesc; 2052 struct txdone_entry_desc txdesc;
2053 u32 word; 2053 u32 word;
2054 u32 reg; 2054 u32 reg;
2055 u32 old_reg;
2056 int type; 2055 int type;
2057 int index; 2056 int index;
2057 int i;
2058 2058
2059 /* 2059 /*
2060 * During each loop we will compare the freshly read 2060 * TX_STA_FIFO is a stack of X entries, hence read TX_STA_FIFO
2061 * STA_CSR4 register value with the value read from 2061 * at most X times and also stop processing once the TX_STA_FIFO_VALID
2062 * the previous loop. If the 2 values are equal then 2062 * flag is not set anymore.
2063 * we should stop processing because the chance is 2063 *
2064 * quite big that the device has been unplugged and 2064 * The legacy drivers use X=TX_RING_SIZE but state in a comment
2065 * we risk going into an endless loop. 2065 * that the TX_STA_FIFO stack has a size of 16. We stick to our
2066 * tx ring size for now.
2066 */ 2067 */
2067 old_reg = 0; 2068 for (i = 0; i < TX_ENTRIES; i++) {
2068
2069 while (1) {
2070 rt2x00pci_register_read(rt2x00dev, STA_CSR4, &reg); 2069 rt2x00pci_register_read(rt2x00dev, STA_CSR4, &reg);
2071 if (!rt2x00_get_field32(reg, STA_CSR4_VALID)) 2070 if (!rt2x00_get_field32(reg, STA_CSR4_VALID))
2072 break; 2071 break;
2073 2072
2074 if (old_reg == reg)
2075 break;
2076 old_reg = reg;
2077
2078 /* 2073 /*
2079 * Skip this entry when it contains an invalid 2074 * Skip this entry when it contains an invalid
2080 * queue identication number. 2075 * queue identication number.