peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame qemu-0.9.0-rtl8139-checksum.patch

Daniel P. Berrange f4a1bb
Index: hw/rtl8139.c
Daniel P. Berrange f4a1bb
===================================================================
Daniel P. Berrange f4a1bb
RCS file: /sources/qemu/qemu/hw/rtl8139.c,v
Daniel P. Berrange f4a1bb
retrieving revision 1.10
Daniel P. Berrange f4a1bb
retrieving revision 1.11
Daniel P. Berrange f4a1bb
diff -u -r1.10 -r1.11
Daniel P. Berrange f4a1bb
--- hw/rtl8139.c	11 Jul 2007 22:48:58 -0000	1.10
Daniel P. Berrange f4a1bb
+++ hw/rtl8139.c	1 Aug 2007 13:10:29 -0000	1.11
Daniel P. Berrange f4a1bb
@@ -53,9 +53,8 @@
Daniel P. Berrange f4a1bb
 /* debug RTL8139 card C+ mode only */
Daniel P. Berrange f4a1bb
 //#define DEBUG_RTL8139CP 1
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
-/* RTL8139 provides frame CRC with received packet, this feature seems to be
Daniel P. Berrange f4a1bb
-   ignored by most drivers, disabled by default */
Daniel P. Berrange f4a1bb
-//#define RTL8139_CALCULATE_RXCRC 1
Daniel P. Berrange f4a1bb
+/* Calculate CRCs properly on Rx packets */
Daniel P. Berrange f4a1bb
+#define RTL8139_CALCULATE_RXCRC 1
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
 /* Uncomment to enable on-board timer interrupts */
Daniel P. Berrange f4a1bb
 //#define RTL8139_ONBOARD_TIMER 1
Daniel P. Berrange f4a1bb
@@ -747,7 +746,7 @@
Daniel P. Berrange f4a1bb
         int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize);
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
         /* write packet data */
Daniel P. Berrange f4a1bb
-        if (wrapped && s->RxBufferSize < 65536 && !rtl8139_RxWrap(s))
Daniel P. Berrange f4a1bb
+        if (wrapped && !(s->RxBufferSize < 65536 && rtl8139_RxWrap(s)))
Daniel P. Berrange f4a1bb
         {
Daniel P. Berrange f4a1bb
             DEBUG_PRINT((">>> RTL8139: rx packet wrapped in buffer at %d\n", size-wrapped));
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
@@ -1023,7 +1022,7 @@
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
         /* write checksum */
Daniel P. Berrange f4a1bb
 #if defined (RTL8139_CALCULATE_RXCRC)
Daniel P. Berrange f4a1bb
-        val = cpu_to_le32(crc32(~0, buf, size));
Daniel P. Berrange f4a1bb
+        val = cpu_to_le32(crc32(0, buf, size));
Daniel P. Berrange f4a1bb
 #else
Daniel P. Berrange f4a1bb
         val = 0;
Daniel P. Berrange f4a1bb
 #endif
Daniel P. Berrange f4a1bb
@@ -1129,7 +1128,7 @@
Daniel P. Berrange f4a1bb
 
Daniel P. Berrange f4a1bb
         /* write checksum */
Daniel P. Berrange f4a1bb
 #if defined (RTL8139_CALCULATE_RXCRC)
Daniel P. Berrange f4a1bb
-        val = cpu_to_le32(crc32(~0, buf, size));
Daniel P. Berrange f4a1bb
+        val = cpu_to_le32(crc32(0, buf, size));
Daniel P. Berrange f4a1bb
 #else
Daniel P. Berrange f4a1bb
         val = 0;
Daniel P. Berrange f4a1bb
 #endif