aboutsummaryrefslogtreecommitdiff
path: root/hw/e1000.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2010-07-26 08:05:27 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2010-07-26 08:05:27 -0500
commit7ed6184bf24dffe81e767ab449f90247bb38e204 (patch)
tree3d33efd6db0d79aa45d59329f17454b296fb12aa /hw/e1000.c
parentcdcf9153e5e17dde340135fee5dcc7c299f2d4f5 (diff)
parentd154e0bafbd51bfd029ade9f1362bdff612b0f55 (diff)
Merge remote branch 'mst/for_anthony' into staging
Diffstat (limited to 'hw/e1000.c')
-rw-r--r--hw/e1000.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index db9143d2bc..80b78bc618 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -343,6 +343,15 @@ is_vlan_txd(uint32_t txd_lower)
return ((txd_lower & E1000_TXD_CMD_VLE) != 0);
}
+/* 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. */
+static inline int
+fcs_len(E1000State *s)
+{
+ return (s->mac_reg[RCTL] & E1000_RCTL_SECRC) ? 0 : 4;
+}
+
static void
xmit_seg(E1000State *s)
{
@@ -648,7 +657,6 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
}
rdh_start = s->mac_reg[RDH];
- size += 4; // for the header
do {
if (s->mac_reg[RDH] == s->mac_reg[RDT] && s->check_rxov) {
set_ics(s, 0, E1000_ICS_RXO);
@@ -662,7 +670,7 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
if (desc.buffer_addr) {
cpu_physical_memory_write(le64_to_cpu(desc.buffer_addr),
(void *)(buf + vlan_offset), size);
- desc.length = cpu_to_le16(size);
+ desc.length = cpu_to_le16(size + fcs_len(s));
desc.status |= E1000_RXD_STAT_EOP|E1000_RXD_STAT_IXSM;
} else // as per intel docs; skip descriptors with null buf addr
DBGOUT(RX, "Null RX descriptor!!\n");