summary refs log tree commit diff stats
path: root/hw/e1000.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2010-09-08 14:26:14 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2010-09-08 14:26:14 -0500
commitdccbe6fbab47c9a2589f436e0592933b47cbe40b (patch)
treee5a851b48a3801dd28282eb17533975cade7ac23 /hw/e1000.c
parent630c26893d6dc7713c0fcfc3c09d6bfe536a6ce3 (diff)
parenta697a334b3c4d3250e6420f5d38550ea10eb5319 (diff)
downloadfocaccia-qemu-dccbe6fbab47c9a2589f436e0592933b47cbe40b.tar.gz
focaccia-qemu-dccbe6fbab47c9a2589f436e0592933b47cbe40b.zip
Merge remote branch 'mst/for_anthony' into staging
Diffstat (limited to 'hw/e1000.c')
-rw-r--r--hw/e1000.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index 80b78bc618..7d7d14002f 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -345,7 +345,7 @@ is_vlan_txd(uint32_t txd_lower)
 
 /* FCS aka Ethernet CRC-32. We don't get it from backends and can't
  * fill it in, just pad descriptor length by 4 bytes unless guest
- * told us to trip it off the packet. */
+ * told us to strip it off the packet. */
 static inline int
 fcs_len(E1000State *s)
 {
@@ -690,9 +690,14 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 
     s->mac_reg[GPRC]++;
     s->mac_reg[TPR]++;
-    n = s->mac_reg[TORL];
-    if ((s->mac_reg[TORL] += size) < n)
+    /* TOR - Total Octets Received:
+     * This register includes bytes received in a packet from the <Destination
+     * Address> field through the <CRC> field, inclusively.
+     */
+    n = s->mac_reg[TORL] + size + /* Always include FCS length. */ 4;
+    if (n < s->mac_reg[TORL])
         s->mac_reg[TORH]++;
+    s->mac_reg[TORL] = n;
 
     n = E1000_ICS_RXT0;
     if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH])