Message ID | 1389154792-6651-3-git-send-email-roy.franz@linaro.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <patchwork-forward+bncBDUMZS5BTEOBB5VDWOLAKGQEXR7K4NQ@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF9E4202E0 for <linaro@patches.linaro.org>; Wed, 8 Jan 2014 04:20:07 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id m1sf4494579oag.8 for <linaro@patches.linaro.org>; Tue, 07 Jan 2014 20:20:06 -0800 (PST) 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=mm7MuNWm+em/INITKxkLkMFZ8s+wrA6EWbFAwwev8mA=; b=gxbGQsUUyxlz0XDt4Ehjfvpw9edyg8gj9fbKnUqt8nWGFZnw0/OjbAebfoGeDMj8uB mNfdWHmkNzBJmZY4sOjRgvA4O9CFfxzxvIpTpdbcJsU9Fl19EIton9MXBW2YOpKkxg7f nGYSB6/zBppKgfrBSmlgD6Kwx1AX/KNgMTqv4To7WfBUbS5ft3+ErQ7LBp8HqCJy6vRH /DBbxbzoCDMg7fHa3RRPr1cjjJeC1aj72amN61AqvLlEbsq4f32vD7r2K8I9sNLfChvc ZDDYJiP1kP0O0PleJH/51DWUaUidPdQDQ9CNJAwX8aAzKjrtOIHKb+jO45hW8a7ros6Q oP0g== X-Gm-Message-State: ALoCoQlXSpGa22d27ezWkZC6pwjV2aiE5Wl9cqjyAuX+Q1wRaR3SdQDNIwCW/iV3UoiJoV3hiI0t X-Received: by 10.50.47.18 with SMTP id z18mr14892806igm.1.1389154806886; Tue, 07 Jan 2014 20:20:06 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.86.136 with SMTP id p8ls417319qez.57.gmail; Tue, 07 Jan 2014 20:20:06 -0800 (PST) X-Received: by 10.58.4.4 with SMTP id g4mr6422224veg.23.1389154806764; Tue, 07 Jan 2014 20:20:06 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id vy2si8222729vec.77.2014.01.07.20.20.06 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Jan 2014 20:20:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id c14so866827vea.9 for <patchwork-forward@linaro.org>; Tue, 07 Jan 2014 20:20:06 -0800 (PST) X-Received: by 10.58.181.71 with SMTP id du7mr6291304vec.25.1389154806642; Tue, 07 Jan 2014 20:20:06 -0800 (PST) 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.59.13.131 with SMTP id ey3csp201980ved; Tue, 7 Jan 2014 20:20:06 -0800 (PST) X-Received: by 10.229.102.4 with SMTP id e4mr194960905qco.2.1389154806139; Tue, 07 Jan 2014 20:20:06 -0800 (PST) Received: from mail-qc0-f178.google.com (mail-qc0-f178.google.com [209.85.216.178]) by mx.google.com with ESMTPS id z3si20595495qev.97.2014.01.07.20.20.06 for <patches@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Jan 2014 20:20:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of roy.franz@linaro.org) client-ip=209.85.216.178; Received: by mail-qc0-f178.google.com with SMTP id i17so1029439qcy.23 for <patches@linaro.org>; Tue, 07 Jan 2014 20:20:06 -0800 (PST) X-Received: by 10.49.25.46 with SMTP id z14mr11865396qef.20.1389154805978; Tue, 07 Jan 2014 20:20:05 -0800 (PST) Received: from rfranz-v430.caveonetworks.com (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id g10sm108535412qaf.9.2014.01.07.20.20.03 for <multiple recipients> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 20:20:05 -0800 (PST) From: Roy Franz <roy.franz@linaro.org> To: qemu-devel@nongnu.org, peter.maydell@linaro.org, kwolf@redhat.com, stefanha@redhat.com Cc: peter.crosthwaite@xilinx.com, patches@linaro.org, Roy Franz <roy.franz@linaro.org> Subject: [PATCH V2 2/2] Fix lan9118 buffer length handling Date: Tue, 7 Jan 2014 20:19:52 -0800 Message-Id: <1389154792-6651-3-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389154792-6651-1-git-send-email-roy.franz@linaro.org> References: <1389154792-6651-1-git-send-email-roy.franz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: <patchwork-forward.linaro.org> X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe>, <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com> |
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index bb0c503..e528290 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -763,7 +763,7 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val) if (s->txp->buffer_size <= 0 && s->txp->pad != 0) { s->txp->pad--; } else { - n = 4; + n = MIN(4, s->txp->buffer_size + s->txp->offset); while (s->txp->offset) { val >>= 8; n--;
The 9118 ethernet controller supports transmission of multi-buffer packets with arbitrary byte alignment of the start and end bytes. All writes to the packet fifo are 32 bits, so the controller discards bytes at the beginning and end of each buffer based on the 'Data start offset' and 'Buffer size' of the TX command 'A' format. This patch uses the provided buffer length to limit the bytes transmitted. Previously all the bytes of the last 32-bit word written to the TX fifo were added to the internal transmit buffer structure resulting in more bytes being transmitted than were submitted to the hardware in the command. This resulted in extra bytes being inserted into the middle of multi-buffer packets when the non-final buffers had non-32bit aligned ending addresses. Signed-off-by: Roy Franz <roy.franz@linaro.org> --- hw/net/lan9118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)