Skip to contentSkip to conversation

only check RCTL_EN in e1000_can_receive()

PATCH In review Charles Duffy 2 participants 2 messages Aug 5, 2008 – Aug 6, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 only check RCTL_EN in e1000_can_receive()

e1000_receive() has code to raise a receive overflow interrupt when the receive buffer head and tail match. However, with the present implementation of e1000_can_receive(), this code is unreachable -- and etherboot breaks as a result.

The attached quick-and-dirty patch fixes etherboot for e1000, and does not appear to break post-boot functionality.

e1000.c +1 -2
Index: hw/e1000.c
===================================================================
@@ -524,8 +524,7 @@
 {
     E1000State *s = opaque;
 
-    return (!(s->mac_reg[RCTL] & E1000_RCTL_EN) ||
-            s->mac_reg[RDH] != s->mac_reg[RDT]);
+    return (s->mac_reg[RCTL] & E1000_RCTL_EN);
 }
 
 static void
#1 lore raw
Quoted 3 lines · Charles Duffy

e1000_receive() has code to raise a receive overflow interrupt when the receive buffer head and tail match. However, with the present implementation of e1000_can_receive(), this code is unreachable -- and etherboot breaks as a result.

The attached quick-and-dirty patch fixes etherboot for e1000, and does not appear to break post-boot functionality.

While this is a legitimate bug, it's probably only present in KVM or when using the slirp rate limiting. Right in QEMU, a can_receive handler for a network card is largely ignored whereas in KVM, it is used to throttle receive for the tap device.

Nonetheless, the correct behaviour is to raise an interrupt when a packet could be received but no buffers are available so I've applied this patch. Thanks.

Regards,

Anthony Liguori