e1000: secrc support
RFC PATCH 1/1 e1000: secrc support
Add support for secrc field. Reportedly needed by old RHEL guests.
Signed-off-by Michael S. Tsirkin <[email protected]>
--- hw/e1000.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
Anthony, Alex, please review.
hw/e1000.c +10 -1
@@ -344,6 +344,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) {
@@ -662,7 +671,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 +4 /* for FCS */ ); + 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" );
Signature · 1 line
1.7.2.rc0.14.g41c1c
Quoted 8 lines · Michael S. Tsirkin
Add support for secrc field. Reportedly needed by old RHEL guests.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/e1000.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)Anthony, Alex, please review.
Acked-by Alex Williamson <[email protected]>
Quoted 29 lines
hw/e1000.c +10
-1@@ -344,6 +344,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) {@@ -662,7 +671,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 +4 /* for FCS */ ); + 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" );