From patchwork Tue May 13 15:31:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 30063 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6940920369 for ; Tue, 13 May 2014 15:33:01 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wm4sf2230135obc.6 for ; Tue, 13 May 2014 08:33:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=V85CuL/L8iPcolqbmmtXGguM/Polg1+/ei/SEYsgpdk=; b=hdfhNMzNFp8rRYNIo19B5po5biSz2PJRIGJZVh8QLVWRDT4I9uMn0KQNd1jvshesIO AlZxxVhy8Pn9dhlURqhfq8xwIu2Vwd8KgSBySerSkrte/Iz2tGwy9DWWLgrPOaolzQmP pWysNV0B9Hfw35BsKvwCZrbDOPPofUchkCy+4Fn0ConR0U1aP6lpmQ3KDIfrqdSRPvTx iXt3DpTODvAy/hA3HVPuxMOBbBZ7iOAoKpXX6ahxMpUglFVDga8VF0IRMJQitxWfnjBd pLqfSV8prZb31xtG2pf5jF7Fl97aYkSu9kqcPfThIX88AWmWQXj/nFsUjci+FmHXFDSB f69A== X-Gm-Message-State: ALoCoQnytEGl+YB7f8B3/bHMy4KSgIvv7vkLbJbKeBNyJ2e2w2tQ89mzdVH5fe0iblAhQMv//FOq X-Received: by 10.43.79.196 with SMTP id zr4mr16030923icb.3.1399995181005; Tue, 13 May 2014 08:33:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.145 with SMTP id c17ls2062972qgd.60.gmail; Tue, 13 May 2014 08:33:00 -0700 (PDT) X-Received: by 10.58.134.101 with SMTP id pj5mr1086114veb.38.1399995180887; Tue, 13 May 2014 08:33:00 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id d12si2711922vco.83.2014.05.13.08.33.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 08:33:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ij19so669049vcb.14 for ; Tue, 13 May 2014 08:33:00 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr29701021vcb.0.1399995180795; Tue, 13 May 2014 08:33:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp160459vcb; Tue, 13 May 2014 08:33:00 -0700 (PDT) X-Received: by 10.15.68.132 with SMTP id w4mr4107587eex.90.1399995179229; Tue, 13 May 2014 08:32:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c6si13458059eem.180.2014.05.13.08.32.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 08:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:45856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEhN-0000k1-Q8 for patch@linaro.org; Tue, 13 May 2014 11:32:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEgJ-0007zy-1j for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkEgH-00069c-U4 for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:50 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEgH-00066p-OI for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:49 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WkEg7-0006xB-PB; Tue, 13 May 2014 16:31:39 +0100 From: Peter Maydell To: Anthony Liguori Date: Tue, 13 May 2014 16:31:34 +0100 Message-Id: <1399995099-26635-13-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> References: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 12/17] hw/net/cadence_gem: Remove dead code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Commit 191946c moved the code to handle padding to minimum length from after the handling of the CRC to before it. This means that the CRC code doesn't need to cope with the possibility that the size is less than 60; remove this dead code. Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite --- hw/net/cadence_gem.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index a779658..47e7038 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -717,7 +717,6 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) rxbuf_ptr = (void *)buf; } else { unsigned crc_val; - int crc_offset; /* The application wants the FCS field, which QEMU does not provide. * We must try and caclculate one. @@ -727,12 +726,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) memset(rxbuf + size, 0, sizeof(rxbuf) - size); rxbuf_ptr = rxbuf; crc_val = cpu_to_le32(crc32(0, rxbuf, MAX(size, 60))); - if (size < 60) { - crc_offset = 60; - } else { - crc_offset = size; - } - memcpy(rxbuf + crc_offset, &crc_val, sizeof(crc_val)); + memcpy(rxbuf + size, &crc_val, sizeof(crc_val)); bytes_to_copy += 4; size += 4;