From patchwork Thu May 8 18:46:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 29852 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29A2920A67 for ; Thu, 8 May 2014 18:47:05 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf10120894yha.7 for ; Thu, 08 May 2014 11:47:04 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=C4pJ52F8xaGGD4HaVLwNzQA5S1Hm9fQFiSV0xsT2s6I=; b=d+O9z1jLVyRbpvxr9a8M5dgfiDbvhGiD/IOKjyQdNuLSm/za4H3HNO6veWwz4DlC0e HkTR48aR23V5TcfIlVHk2Ae4G6ljl7fmghA1MHyzojMAc1jFVcmG0sGWQwx9YpUjC5ez pL7jYcd/yuZDgBhaFgcxd4HebWYZW2inrvQXL66oCpbzKjT8FKlcpcbmY16mypPg2WIZ 4U8lIe3C3+AAcrL/UrhK82/yfpPN65d2U794EHFXc5cK8X5DTHR0Am5y7HxzdPYFa9nd cBT7zOryaj/tsINFwqKpWmL8XT+8aJB0HnZ4eU88uyO/XR+/P+ZLhmY4lcCjy8eq35Gi vcPA== X-Gm-Message-State: ALoCoQloDxsL1SxT8Zm7VEmcsfrNZ3d3U2gp/qSrUzXY1jU973JX/d6dfyn8GTNLYRObWmoM+qYK X-Received: by 10.58.210.2 with SMTP id mq2mr2544263vec.3.1399574824843; Thu, 08 May 2014 11:47:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.179 with SMTP id s48ls2114210qge.17.gmail; Thu, 08 May 2014 11:47:04 -0700 (PDT) X-Received: by 10.220.205.3 with SMTP id fo3mr2085836vcb.57.1399574824693; Thu, 08 May 2014 11:47:04 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id pu9si321813vec.47.2014.05.08.11.47.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 11:47:04 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so3791846veb.24 for ; Thu, 08 May 2014 11:47:04 -0700 (PDT) X-Received: by 10.58.126.4 with SMTP id mu4mr4411073veb.0.1399574824623; Thu, 08 May 2014 11:47:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp17016vcb; Thu, 8 May 2014 11:47:04 -0700 (PDT) X-Received: by 10.50.49.109 with SMTP id t13mr11665133ign.2.1399574822534; Thu, 08 May 2014 11:47:02 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id qq9si466775igb.40.2014.05.08.11.47.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 08 May 2014 11:47:02 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WiTLO-00052f-NE; Thu, 08 May 2014 19:46:58 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Peter Crosthwaite Subject: [PATCH 2/8] hw/net/cadence_gem: Remove dead code Date: Thu, 8 May 2014 19:46:52 +0100 Message-Id: <1399574818-19349-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399574818-19349-1-git-send-email-peter.maydell@linaro.org> References: <1399574818-19349-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 cdb1825..afddc8a 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;