From e299209ce82c2ee7ca71013bea914208eb9d479b Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin <mst@redhat.com> Date: Wed, 1 Sep 2010 17:21:40 -0300 Subject: [PATCH 4/7] bz 547276: e1000: secrc support RH-Author: Michael S. Tsirkin <mst@redhat.com> Message-id: <20100901172140.GA14191@redhat.com> Patchwork-id: 11677 O-Subject: [PATCH RHEL5.6] bz 547276: e1000: secrc support Bugzilla: 547276 RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com> RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> RH-Acked-by: Kevin Wolf <kwolf@redhat.com> Add support for secrc field. Reportedly needed by old RHEL guests. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Upstream commit: 55e8d1ce6b09300cc5f3adcd9a705156d168381d Note: This is not a straight backport from upstream because upstream also has commit b0b900070c7cb29bbefb732ec00397abe5de6d73. That one is cosmetic though and seems an unnecessary risk for 5.6. --- qemu/hw/e1000.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- qemu/hw/e1000.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/qemu/hw/e1000.c b/qemu/hw/e1000.c index a31db58..30dfb36 100644 --- a/qemu/hw/e1000.c +++ b/qemu/hw/e1000.c @@ -331,6 +331,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 strip 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) { @@ -635,7 +644,7 @@ e1000_receive(void *opaque, const uint8_t *buf, int size) } rdh_start = s->mac_reg[RDH]; - size += 4; // for the header + size += fcs_len(s); do { if (s->mac_reg[RDH] == s->mac_reg[RDT] && s->check_rxov) { set_ics(s, 0, E1000_ICS_RXO); -- 1.6.5.5