From patchwork Mon Mar 7 20:04:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 85795 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 4DDB8B6F0B for ; Tue, 8 Mar 2011 07:05:08 +1100 (EST) Received: from localhost ([127.0.0.1]:42082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwgfx-0007pr-I6 for incoming@patchwork.ozlabs.org; Mon, 07 Mar 2011 15:05:05 -0500 Received: from [140.186.70.92] (port=46618 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwgfR-0007p4-P1 for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:04:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwgfP-0005MT-Vm for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:04:33 -0500 Received: from mtagate5.uk.ibm.com ([194.196.100.165]:50984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwgfP-0005MB-Oi for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:04:31 -0500 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p27K4TKg026492 for ; Mon, 7 Mar 2011 20:04:29 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p27K4gO42019530 for ; Mon, 7 Mar 2011 20:04:42 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p27K4SuF009275 for ; Mon, 7 Mar 2011 13:04:29 -0700 Received: from stefanha-thinkpad.ibm.com (sig-9-145-191-250.de.ibm.com [9.145.191.250]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p27K4RZ5009272; Mon, 7 Mar 2011 13:04:28 -0700 From: Stefan Hajnoczi To: Date: Mon, 7 Mar 2011 20:04:07 +0000 Message-Id: <1299528247-22545-1-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.2.3 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by mtagate5.uk.ibm.com id p27K4TKg026492 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.165 Cc: Alex Williamson , Bug 638955 <638955@bugs.launchpad.net>, Stefan Hajnoczi , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v2] e1000: Fix multi-descriptor packet checksum offload 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 The PCI/PCI-X Family of Gigabit Ethernet Controllers Software Developer’s Manual states the following about the POPTS field: Provides a number of options which control the handling of this packet. This field is ignored except on the first data descriptor of a packet. The current implementation always loads the field and its checksum offload flags. This patch uses only the first descriptor's POPTS field in order to comply with the specification. When Solaris sends multi-descriptor packets it fills in POPTS for the first descriptor only. Therefore this patch is necessary in order to perform checksum offload correctly for multi-descriptor packets. Reported-by: Daniel Pecka Reported-by: Gabriele A. Trombetti Signed-off-by: Stefan Hajnoczi --- v2: * Fix Reported-by: details hw/e1000.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 0a4574c..2a4d5c7 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -446,7 +446,9 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { // data descriptor - tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8; + if (tp->size == 0) { + tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8; + } tp->cptse = ( txd_lower & E1000_TXD_CMD_TSE ) ? 1 : 0; } else { // legacy descriptor