From 463a4e04100a8f8cf00da91baaa7e91c3a52d849 Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Wed, 25 May 2011 05:32:17 -0300 Subject: [RHEL6 qemu-kvm PATCH 001/115] rtl8139: cleanup FCS calculation RH-Author: Xiao Wang Message-id: <20110525053217.26546.43258.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com> Patchwork-id: 25548 O-Subject: [RHEL6.2 qemu-kvm PATCH 1/3] rtl8139: cleanup FCS calculation Bugzilla: 583922 RH-Acked-by: Jes Sorensen RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Alex Williamson From: Benjamin Poirier Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=583922 Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=3346504 Upstream: 2c406b8fc8fc09853e74924d7067712d7a75108f Test status: Basic testing in my local desktop clean out ifdef's around ethernet checksum calculation Signed-off-by: Benjamin Poirier Acked-by: Igor V. Kovalenko Cc: Jason Wang Cc: Michael S. Tsirkin Cc: Blue Swirl Signed-off-by: Blue Swirl Signed-off-by: Jason Wang --- hw/rtl8139.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) Signed-off-by: Eduardo Habkost --- hw/rtl8139.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 95208ac..66fb497 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -43,6 +43,9 @@ * Added rx/tx buffer reset when enabling rx/tx operation */ +/* For crc32 */ +#include + #include "hw.h" #include "pci.h" #include "qemu-timer.h" @@ -58,17 +61,6 @@ /* debug RTL8139 card C+ mode only */ //#define DEBUG_RTL8139CP 1 -/* Calculate CRCs properly on Rx packets */ -#define RTL8139_CALCULATE_RXCRC 1 - -/* Uncomment to enable on-board timer interrupts */ -//#define RTL8139_ONBOARD_TIMER 1 - -#if defined(RTL8139_CALCULATE_RXCRC) -/* For crc32 */ -#include -#endif - #define SET_MASKED(input, mask, curr) \ ( ( (input) & ~(mask) ) | ( (curr) & (mask) ) ) @@ -1026,11 +1018,7 @@ static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_ } /* write checksum */ -#if defined (RTL8139_CALCULATE_RXCRC) val = cpu_to_le32(crc32(0, buf, size)); -#else - val = 0; -#endif cpu_physical_memory_write( rx_addr+size, (uint8_t *)&val, 4); /* first segment of received packet flag */ @@ -1132,12 +1120,7 @@ static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_ rtl8139_write_buffer(s, buf, size); /* write checksum */ -#if defined (RTL8139_CALCULATE_RXCRC) val = cpu_to_le32(crc32(0, buf, size)); -#else - val = 0; -#endif - rtl8139_write_buffer(s, (uint8_t *)&val, 4); /* correct buffer write pointer */ -- 1.7.3.2