From patchwork Fri Mar 11 00:35:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 86345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 64707B6F9F for ; Fri, 11 Mar 2011 11:37:58 +1100 (EST) Received: from localhost ([127.0.0.1]:41447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxqML-0002hs-2M for incoming@patchwork.ozlabs.org; Thu, 10 Mar 2011 19:37:37 -0500 Received: from [140.186.70.92] (port=51083 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxqLQ-0002hX-V2 for qemu-devel@nongnu.org; Thu, 10 Mar 2011 19:36:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxqLO-0003bh-Fi for qemu-devel@nongnu.org; Thu, 10 Mar 2011 19:36:40 -0500 Received: from mail-iw0-f173.google.com ([209.85.214.173]:60505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxqLO-0003ba-92 for qemu-devel@nongnu.org; Thu, 10 Mar 2011 19:36:38 -0500 Received: by iwl42 with SMTP id 42so2476970iwl.4 for ; Thu, 10 Mar 2011 16:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=BZv8hggm8k9SaX4egjAyzjq6S84rT+HQhjBLNt988iU=; b=uBcn/CrV2Oa1LBcllYeSCRO87mHW9WjmjotiO/r/mo+LpNfcyQHrB31I1wZWLyfitS GhBBs8U6wCv4mmf2I7IFe0W+0hNiPiEISvNvpEMP3P/+GZoBnrnQL0fzMDVjU9tmhD5B m0YgGToK8mpebeFmd6oadaZvFiB9wSz2RmEcQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=XS1ZrmO+3fkaI3AREbSiyC7jDqLbb4EaG7wCIZe8TruZyyRXbMLYPeASBGhWvg1DuL BP3qn3CyuoKL6ONPdI2C41Varf0x39eMbBHLGl7V0qBPZlEgQdm45UUXHlZqPHAZQhhq 7IBzke1p2rIcoroiRtl9IKvbykdjtROME5rZY= Received: by 10.42.230.5 with SMTP id jk5mr1188027icb.382.1299803797614; Thu, 10 Mar 2011 16:36:37 -0800 (PST) Received: from localhost.localdomain ([216.252.89.211]) by mx.google.com with ESMTPS id vm9sm2612388icb.0.2011.03.10.16.36.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Mar 2011 16:36:36 -0800 (PST) From: Benjamin Poirier To: qemu-devel@nongnu.org Date: Thu, 10 Mar 2011 19:35:55 -0500 Message-Id: <1299803757-26812-2-git-send-email-benjamin.poirier@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1299803757-26812-1-git-send-email-benjamin.poirier@gmail.com> References: <1299803757-26812-1-git-send-email-benjamin.poirier@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.173 Cc: Blue Swirl , Jason Wang , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v6 1/3] rtl8139: cleanup FCS calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org clean out ifdef's around ethernet checksum calculation Signed-off-by: Benjamin Poirier Cc: Igor V. Kovalenko Cc: Jason Wang Cc: Michael S. Tsirkin Cc: Blue Swirl Signed-off-by: Igor V. Kovalenko Acked-by: Igor V. Kovalenko --- hw/rtl8139.c | 20 +++----------------- 1 files changed, 3 insertions(+), 17 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index a22530c..3772ac1 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -47,6 +47,9 @@ * Darwin) */ +/* For crc32 */ +#include + #include "hw.h" #include "pci.h" #include "qemu-timer.h" @@ -62,14 +65,6 @@ /* debug RTL8139 card C+ mode only */ //#define DEBUG_RTL8139CP 1 -/* Calculate CRCs properly on Rx packets */ -#define RTL8139_CALCULATE_RXCRC 1 - -#if defined(RTL8139_CALCULATE_RXCRC) -/* For crc32 */ -#include -#endif - #define SET_MASKED(input, mask, curr) \ ( ( (input) & ~(mask) ) | ( (curr) & (mask) ) ) @@ -1030,11 +1025,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 */ @@ -1136,12 +1127,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 */