Skip to contentSkip to conversation

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

Qemu-devel Anthony Liguori 1 participant 1 message Mar 20, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6867

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6867
Author:   aliguori
Date:     2009-03-20 16:18:39 +0000 (Fri, 20 Mar 2009)

Log Message:
-----------
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.

Modified Paths:
--------------

    branches/stable_0_10_0/hw/e1000.c

Modified: branches/stable_0_10_0/hw/e1000.c
===================================================================

stable_0_10_0/hw/e1000.c +2 -2
@@ -666,8 +666,8 @@
     n = E1000_ICS_RXT0;
     if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH])
         rdt += s->mac_reg[RDLEN] / sizeof(desc);
-    if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) << s->rxbuf_min_shift >=
-        s->mac_reg[RDLEN])
+    if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) <= s->mac_reg[RDLEN] >>
+        s->rxbuf_min_shift)
         n |= E1000_ICS_RXDMT0;
 
     set_ics(s, 0, n);