Commit e6474c3c authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville

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: default avatarIvo van Doorn <IvDoorn@gmail.com>
Acked-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a5ea2f02
...@@ -2052,29 +2052,24 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) ...@@ -2052,29 +2052,24 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
struct txdone_entry_desc txdesc; struct txdone_entry_desc txdesc;
u32 word; u32 word;
u32 reg; u32 reg;
u32 old_reg;
int type; int type;
int index; int index;
int i;
/* /*
* During each loop we will compare the freshly read * TX_STA_FIFO is a stack of X entries, hence read TX_STA_FIFO
* STA_CSR4 register value with the value read from * at most X times and also stop processing once the TX_STA_FIFO_VALID
* the previous loop. If the 2 values are equal then * flag is not set anymore.
* we should stop processing because the chance is *
* quite big that the device has been unplugged and * The legacy drivers use X=TX_RING_SIZE but state in a comment
* we risk going into an endless loop. * that the TX_STA_FIFO stack has a size of 16. We stick to our
* tx ring size for now.
*/ */
old_reg = 0; for (i = 0; i < TX_ENTRIES; i++) {
while (1) {
rt2x00pci_register_read(rt2x00dev, STA_CSR4, &reg); rt2x00pci_register_read(rt2x00dev, STA_CSR4, &reg);
if (!rt2x00_get_field32(reg, STA_CSR4_VALID)) if (!rt2x00_get_field32(reg, STA_CSR4_VALID))
break; break;
if (old_reg == reg)
break;
old_reg = reg;
/* /*
* Skip this entry when it contains an invalid * Skip this entry when it contains an invalid
* queue identication number. * queue identication number.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment