Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IAkcJ-0004ms-Gg for qemu-devel@nongnu.org; Tue, 17 Jul 2007 06:49:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IAkcI-0004mW-DL for qemu-devel@nongnu.org; Tue, 17 Jul 2007 06:49:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAkcI-0004mR-9b for qemu-devel@nongnu.org; Tue, 17 Jul 2007 06:49:18 -0400 Received: from 207.47.60.147.static.nextweb.net ([207.47.60.147] helo=rpc.xensource.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IAkcH-00042L-P5 for qemu-devel@nongnu.org; Tue, 17 Jul 2007 06:49:17 -0400 Date: Tue, 17 Jul 2007 11:27:03 +0100 From: Tim Deegan Message-ID: <20070717102703.GB4053@york.uk.xensource.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uAKRQypu60I7Lcqm" Content-Disposition: inline Subject: [Qemu-devel] [PATCH] RTL8139 rx-path fixes Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Two small changes: fix the buffer wraparound code for 64k ring-buffers, and enable (and fix) the crc32 checksum calculation. These changes are needed for the the Realtek driver that shipped with 32-bit Vista. Cheers, Tim. -- Tim Deegan , XenSource UK Limited Registered office c/o EC2Y 5EB, UK; company number 05334508 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=patch Index: hw/rtl8139.c =================================================================== RCS file: /sources/qemu/qemu/hw/rtl8139.c,v retrieving revision 1.10 diff -u -r1.10 rtl8139.c --- hw/rtl8139.c 11 Jul 2007 22:48:58 -0000 1.10 +++ hw/rtl8139.c 17 Jul 2007 10:09:03 -0000 @@ -53,9 +53,8 @@ /* debug RTL8139 card C+ mode only */ //#define DEBUG_RTL8139CP 1 -/* RTL8139 provides frame CRC with received packet, this feature seems to be - ignored by most drivers, disabled by default */ -//#define RTL8139_CALCULATE_RXCRC 1 +/* Calculate CRCs properly on Rx packets */ +#define RTL8139_CALCULATE_RXCRC 1 /* Uncomment to enable on-board timer interrupts */ //#define RTL8139_ONBOARD_TIMER 1 @@ -747,7 +746,7 @@ int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize); /* write packet data */ - if (wrapped && s->RxBufferSize < 65536 && !rtl8139_RxWrap(s)) + if (wrapped && !(s->RxBufferSize < 65536 && rtl8139_RxWrap(s))) { DEBUG_PRINT((">>> RTL8139: rx packet wrapped in buffer at %d\n", size-wrapped)); @@ -1023,7 +1022,7 @@ /* write checksum */ #if defined (RTL8139_CALCULATE_RXCRC) - val = cpu_to_le32(crc32(~0, buf, size)); + val = cpu_to_le32(crc32(0, buf, size)); #else val = 0; #endif @@ -1129,7 +1128,7 @@ /* write checksum */ #if defined (RTL8139_CALCULATE_RXCRC) - val = cpu_to_le32(crc32(~0, buf, size)); + val = cpu_to_le32(crc32(0, buf, size)); #else val = 0; #endif --uAKRQypu60I7Lcqm--