Commit bf16cc8f97ff57db191eec73346ba0333ade342b

Authored by aliguori
1 parent dc1ded53

e1000: Fix RX descriptor low threshold interrupt logic (Alex Williamson)

The RXDMT0 interrupt is supposed to fire when the number of free
RX descriptors drops to some fraction of the total descriptors.
However in practice, it seems like we're adding this interrupt
cause on every RX.  Fix the logic to treat (tail - head) as the
number of free entries rather than the number of used entries.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6864 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 2 additions and 2 deletions
hw/e1000.c
... ... @@ -666,8 +666,8 @@ e1000_receive(void *opaque, const uint8_t *buf, int size)
666 666 n = E1000_ICS_RXT0;
667 667 if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH])
668 668 rdt += s->mac_reg[RDLEN] / sizeof(desc);
669   - if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) << s->rxbuf_min_shift >=
670   - s->mac_reg[RDLEN])
  669 + if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) <= s->mac_reg[RDLEN] >>
  670 + s->rxbuf_min_shift)
671 671 n |= E1000_ICS_RXDMT0;
672 672  
673 673 set_ics(s, 0, n);
... ...