From patchwork Mon Mar 7 22:53:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 85842 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 EACEAB6EDF for ; Tue, 8 Mar 2011 10:35:31 +1100 (EST) Received: from localhost ([127.0.0.1]:36210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwjTp-0003Cj-Gz for incoming@patchwork.ozlabs.org; Mon, 07 Mar 2011 18:04:45 -0500 Received: from [140.186.70.92] (port=60504 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwjJO-0007m8-5r for qemu-devel@nongnu.org; Mon, 07 Mar 2011 17:53:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwjJN-0007Mo-3w for qemu-devel@nongnu.org; Mon, 07 Mar 2011 17:53:58 -0500 Received: from mail-iw0-f173.google.com ([209.85.214.173]:49447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwjJM-0007Mc-V3 for qemu-devel@nongnu.org; Mon, 07 Mar 2011 17:53:57 -0500 Received: by mail-iw0-f173.google.com with SMTP id 42so5287562iwl.4 for ; Mon, 07 Mar 2011 14:53:56 -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=p9dl1NmHXrCKBqFsQYX2h3Gd+Xkdc4vo5BDl3QAEi0PqKcvtF0oNWBIVDqGbTi+CEB JzrrpmRA0Ikbw08zZ0yj6p0y7Hewb8aMHoO9fqLxM4d5MWtQdTJjWGZZD22lnK1DeClt xNmm4JcY7FB40zEIS6qqkz6Wsxix99k8Xfozc= 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=F8mkNV23T5o/p1ZTBKEF5XzRaBciPSUgaKpFEcyrBaj2Jgi0yrEjzbdbObFJ3O1jzr vf/Z70GrGUHEPhqt9EXCWp6x44dcPe/Bw/eXHjV4WVz2Bxi2HIqwDg5mtvn8KVNKWkvU IQ+cwYATDbvgCKN6oxCMFHK/7VtFdSWtCEYe4= Received: by 10.42.221.71 with SMTP id ib7mr5723635icb.110.1299538436609; Mon, 07 Mar 2011 14:53:56 -0800 (PST) Received: from localhost.localdomain (193-84-252-216.dsl.colba.net [216.252.84.193]) by mx.google.com with ESMTPS id xa8sm42058icb.10.2011.03.07.14.53.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Mar 2011 14:53:56 -0800 (PST) From: Benjamin Poirier To: qemu-devel@nongnu.org Date: Mon, 7 Mar 2011 17:53:32 -0500 Message-Id: <1299538414-22208-2-git-send-email-benjamin.poirier@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1299538414-22208-1-git-send-email-benjamin.poirier@gmail.com> References: <1299538414-22208-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 v5 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 --- 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 */