From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511148957230830.3644822416663; Sun, 19 Nov 2017 19:35:57 -0800 (PST) Received: from localhost ([::1]:55260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcsG-0001ho-F3 for importer@patchew.org; Sun, 19 Nov 2017 22:35:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGco6-00075F-KV for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGco4-0000ql-7O for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGco4-0000qZ-0n for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:36 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E0915F742; Mon, 20 Nov 2017 03:31:35 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43741600C8; Mon, 20 Nov 2017 03:31:31 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:22 +0800 Message-Id: <1511148687-24909-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 20 Nov 2017 03:31:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/6] colo-compare: fix the dangerous assignment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mao Zhongyi , Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Cc: Peter Maydell Cc: Jason Wang Cc: Zhang Chen Cc: Li Zhijian Cc: Paolo Bonzini Fixes: 8ec14402029d783720f4312ed8a925548e1dad61 Reported-by: Peter Maydell Reported-by: Paolo Bonzini Signed-off-by: Mao Zhongyi Reviewed-by: Darren Kenny Signed-off-by: Jason Wang --- net/colo-compare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index ccdcba2..1ce195f 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -179,7 +179,7 @@ static int packet_enqueue(CompareState *s, int mode, Co= nnection **con) "drop packet"); } } - con =3D &conn; + *con =3D conn; =20 return 0; } --=20 2.7.4 From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511149090284221.70979485090766; Sun, 19 Nov 2017 19:38:10 -0800 (PST) Received: from localhost ([::1]:55270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcuK-0003Kt-Bs for importer@patchew.org; Sun, 19 Nov 2017 22:38:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcoA-00078r-F0 for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGco9-0000tx-9J for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11819) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGco9-0000su-10 for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:41 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F60952779; Mon, 20 Nov 2017 03:31:40 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE80A600C8; Mon, 20 Nov 2017 03:31:35 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:23 +0800 Message-Id: <1511148687-24909-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 20 Nov 2017 03:31:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/6] Revert "Add new PCI ID for i82559a" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , Jason Wang , "Michael S . Tsirkin" , Michael Nawrocki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit 5e89dc01133f8f5e621f6b66b356c6f37d31dafb since: - we should use ID in the spec instead the one used by OEM - in the future, we should allow changing id through either property or EEPROM file. Cc: Stefan Weil Cc: Michael Nawrocki Cc: Peter Maydell Cc: Michael S. Tsirkin Reviewed-by: Stefan Weil Signed-off-by: Jason Wang --- hw/net/eepro100.c | 13 ------------- include/hw/compat.h | 4 ---- include/hw/pci/pci.h | 1 - qemu-options.hx | 2 +- 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index a63ed2c..91dd058 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -132,7 +132,6 @@ typedef struct { const char *name; const char *desc; uint16_t device_id; - uint16_t alt_device_id; uint8_t revision; uint16_t subsystem_vendor_id; uint16_t subsystem_id; @@ -277,7 +276,6 @@ typedef struct { /* Quasi static device properties (no need to save them). */ uint16_t stats_size; bool has_extended_tcb_support; - bool use_alt_device_id; } EEPRO100State; =20 /* Word indices in EEPROM. */ @@ -1857,14 +1855,6 @@ static void e100_nic_realize(PCIDevice *pci_dev, Err= or **errp) =20 TRACE(OTHER, logout("\n")); =20 - /* By default, the i82559a adapter uses the legacy PCI ID (for the - * i82557). This allows the PCI ID to be changed to the alternate - * i82559 ID if needed. - */ - if (s->use_alt_device_id && strcmp(info->name, "i82559a") =3D=3D 0) { - pci_config_set_device_id(s->dev.config, info->alt_device_id); - } - s->device =3D info->device; =20 e100_pci_reset(s, &local_err); @@ -1984,7 +1974,6 @@ static E100PCIDeviceInfo e100_devices[] =3D { .desc =3D "Intel i82559A Ethernet", .device =3D i82559A, .device_id =3D PCI_DEVICE_ID_INTEL_82557, - .alt_device_id =3D PCI_DEVICE_ID_INTEL_82559, .revision =3D 0x06, .stats_size =3D 80, .has_extended_tcb_support =3D true, @@ -2078,8 +2067,6 @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100= State *s) =20 static Property e100_properties[] =3D { DEFINE_NIC_PROPERTIES(EEPRO100State, conf), - DEFINE_PROP_BOOL("x-use-alt-device-id", EEPRO100State, use_alt_device_= id, - true), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/compat.h b/include/hw/compat.h index f96212c..cf389b4 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -10,10 +10,6 @@ .driver =3D "virtio-tablet-device",\ .property =3D "wheel-axis",\ .value =3D "false",\ - },{\ - .driver =3D "i82559a",\ - .property =3D "x-use-alt-device-id",\ - .value =3D "false",\ }, =20 #define HW_COMPAT_2_9 \ diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index f30e2cf..8d02a0a 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -70,7 +70,6 @@ extern bool pci_available; /* Intel (0x8086) */ #define PCI_DEVICE_ID_INTEL_82551IT 0x1209 #define PCI_DEVICE_ID_INTEL_82557 0x1229 -#define PCI_DEVICE_ID_INTEL_82559 0x1030 #define PCI_DEVICE_ID_INTEL_82801IR 0x2922 =20 /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */ diff --git a/qemu-options.hx b/qemu-options.hx index a39c7e4..3728e9b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2047,7 +2047,7 @@ that the card should have; this option currently only= affects virtio cards; set @var{v} =3D 0 to disable MSI-X. If no @option{-net} option is specified, a= single NIC is created. QEMU can emulate several different models of network card. Valid values for @var{type} are -@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559a}, @code{i82559= er}, +@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er}, @code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139}, @code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}. Not all devices are supported on all targets. Use @code{-net nic,model=3D= help} --=20 2.7.4 From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511149123581212.7660329157186; Sun, 19 Nov 2017 19:38:43 -0800 (PST) Received: from localhost ([::1]:55271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcut-0003j2-Ui for importer@patchew.org; Sun, 19 Nov 2017 22:38:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcoC-0007AW-Ei for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGcoB-0000uu-Ku for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGcoB-0000ui-EO for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9DFFC5F798; Mon, 20 Nov 2017 03:31:42 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE671600C8; Mon, 20 Nov 2017 03:31:40 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:24 +0800 Message-Id: <1511148687-24909-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 20 Nov 2017 03:31:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/6] hw/net/eepro100: Fix endianness problem on big endian hosts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since commit 1865e288a823c764cd4344d ("Fix eepro100 simple transmission mode"), the test/pxe-test is broken for the eepro100 device on big endian hosts. However, it seems like that commit did not introduce the problem, but just uncovered it: The EEPRO100State->tx.tbd_array_addr and EEPRO100State->tx.tcb_bytes fields are already in host byte order, since they have already been byte-swapped in the read_cb() function. Thus byte-swapping them in tx_command() again results in the wrong endianness. Removing the byte-swapping here fixes the pxe-test. Signed-off-by: Thomas Huth Signed-off-by: Jason Wang --- hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 91dd058..1c0def5 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -754,8 +754,8 @@ static void read_cb(EEPRO100State *s) =20 static void tx_command(EEPRO100State *s) { - uint32_t tbd_array =3D le32_to_cpu(s->tx.tbd_array_addr); - uint16_t tcb_bytes =3D (le16_to_cpu(s->tx.tcb_bytes) & 0x3fff); + uint32_t tbd_array =3D s->tx.tbd_array_addr; + uint16_t tcb_bytes =3D s->tx.tcb_bytes & 0x3fff; /* Sends larger than MAX_ETH_FRAME_SIZE are allowed, up to 2600 bytes.= */ uint8_t buf[2600]; uint16_t size =3D 0; --=20 2.7.4 From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511149182116155.15921410251326; Sun, 19 Nov 2017 19:39:42 -0800 (PST) Received: from localhost ([::1]:55276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcvo-0004Mk-Bt for importer@patchew.org; Sun, 19 Nov 2017 22:39:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcoH-0007En-FE for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGcoE-0000vl-2x for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38026) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGcoD-0000vU-Sw for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19BF37EA90; Mon, 20 Nov 2017 03:31:45 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39E40600C8; Mon, 20 Nov 2017 03:31:42 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:25 +0800 Message-Id: <1511148687-24909-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 20 Nov 2017 03:31:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/6] MAINTAINERS: Add missing entry for eepro100 emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Weil Signed-off-by: Stefan Weil Signed-off-by: Jason Wang --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ffd77b4..83434e0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1183,6 +1183,11 @@ M: Dmitry Fleytman S: Maintained F: hw/net/e1000e* =20 +eepro100 +M: Stefan Weil +S: Maintained +F: hw/net/eepro100.c + Generic Loader M: Alistair Francis S: Maintained --=20 2.7.4 From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511149252299285.62030128360493; Sun, 19 Nov 2017 19:40:52 -0800 (PST) Received: from localhost ([::1]:55284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcwv-00053l-3U for importer@patchew.org; Sun, 19 Nov 2017 22:40:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcoH-0007F1-Mo for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGcoG-0000wE-Lk for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43602) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGcoG-0000w5-Cs for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:48 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89BEE356FF; Mon, 20 Nov 2017 03:31:47 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0C21600C8; Mon, 20 Nov 2017 03:31:45 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:26 +0800 Message-Id: <1511148687-24909-6-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 20 Nov 2017 03:31:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/6] net: Transmit zero UDP checksum as 0xFFFF X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Ed Swierk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ed Swierk The checksum algorithm used by IPv4, TCP and UDP allows a zero value to be represented by either 0x0000 and 0xFFFF. But per RFC 768, a zero UDP checksum must be transmitted as 0xFFFF because 0x0000 is a special value meaning no checksum. Substitute 0xFFFF whenever a checksum is computed as zero when modifying a UDP datagram header. Doing this on IPv4 and TCP checksums is unnecessary but legal. Add a wrapper for net_checksum_finish() that makes the substitution. (We can't just change net_checksum_finish(), as that function is also used by receivers to verify checksums, and in that case the expected value is always 0x0000.) Signed-off-by: Ed Swierk Signed-off-by: Jason Wang --- hw/net/e1000.c | 2 +- hw/net/net_rx_pkt.c | 2 +- hw/net/net_tx_pkt.c | 2 +- hw/net/vmxnet3.c | 3 ++- include/net/checksum.h | 6 ++++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index c0abee4..05a00cb 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -503,7 +503,7 @@ putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32= _t css, uint32_t cse) n =3D cse + 1; if (sloc < n-1) { sum =3D net_checksum_add(n-css, data+css); - stw_be_p(data + sloc, net_checksum_finish(sum)); + stw_be_p(data + sloc, net_checksum_finish_nozero(sum)); } } =20 diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index cef1c2e..98a5030 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -518,7 +518,7 @@ _net_rx_pkt_calc_l4_csum(struct NetRxPkt *pkt) cntr +=3D net_checksum_add_iov(pkt->vec, pkt->vec_len, pkt->l4hdr_off, csl, cso); =20 - csum =3D net_checksum_finish(cntr); + csum =3D net_checksum_finish_nozero(cntr); =20 trace_net_rx_pkt_l4_csum_calc_csum(pkt->l4hdr_off, csl, cntr, csum); =20 diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index 20b2549..e29c881 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -486,7 +486,7 @@ static void net_tx_pkt_do_sw_csum(struct NetTxPkt *pkt) net_checksum_add_iov(iov, iov_len, pkt->virt_hdr.csum_start, csl, = cso); =20 /* Put the checksum obtained into the packet */ - csum =3D cpu_to_be16(net_checksum_finish(csum_cntr)); + csum =3D cpu_to_be16(net_checksum_finish_nozero(csum_cntr)); iov_from_buf(iov, iov_len, csum_offset, &csum, sizeof csum); } =20 diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 8c4bae5..cdc307d 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -972,7 +972,8 @@ static void vmxnet3_rx_need_csum_calculate(struct NetRx= Pkt *pkt, data =3D (uint8_t *)pkt_data + vhdr->csum_start; len =3D pkt_len - vhdr->csum_start; /* Put the checksum obtained into the packet */ - stw_be_p(data + vhdr->csum_offset, net_raw_checksum(data, len)); + stw_be_p(data + vhdr->csum_offset, + net_checksum_finish_nozero(net_checksum_add(len, data))); =20 vhdr->flags &=3D ~VIRTIO_NET_HDR_F_NEEDS_CSUM; vhdr->flags |=3D VIRTIO_NET_HDR_F_DATA_VALID; diff --git a/include/net/checksum.h b/include/net/checksum.h index 7df472c..05a0d27 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -34,6 +34,12 @@ net_checksum_add(int len, uint8_t *buf) } =20 static inline uint16_t +net_checksum_finish_nozero(uint32_t sum) +{ + return net_checksum_finish(sum) ?: 0xFFFF; +} + +static inline uint16_t net_raw_checksum(uint8_t *data, int length) { return net_checksum_finish(net_checksum_add(length, data)); --=20 2.7.4 From nobody Sat Apr 27 13:33:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511149315851636.9058468394799; Sun, 19 Nov 2017 19:41:55 -0800 (PST) Received: from localhost ([::1]:55287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcy2-0005cV-TG for importer@patchew.org; Sun, 19 Nov 2017 22:41:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGcoL-0007IM-HS for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGcoJ-0000yo-Dz for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34766) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGcoJ-0000xk-3x for qemu-devel@nongnu.org; Sun, 19 Nov 2017 22:31:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4620481E09; Mon, 20 Nov 2017 03:31:50 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24ED0600C8; Mon, 20 Nov 2017 03:31:47 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 20 Nov 2017 11:31:27 +0800 Message-Id: <1511148687-24909-7-git-send-email-jasowang@redhat.com> In-Reply-To: <1511148687-24909-1-git-send-email-jasowang@redhat.com> References: <1511148687-24909-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 20 Nov 2017 03:31:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/6] hw/net/vmxnet3: Fix code to work on big endian hosts, too X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since commit ab06ec43577177a442e8 we test the vmxnet3 device in the pxe-tester, too (when running "make check SPEED=3Dslow"). This now revealed that the code is not working there if the host is a big endian machine (for example ppc64 or s390x) - "make check SPEED=3Dslow" is now failing on such hosts. The vmxnet3 code lacks endianness conversions in a couple of places. Interestingly, the bitfields in the structs in vmxnet3.h already tried to take care of the *bit* endianness of the C compilers - but the code missed to change the *byte* endianness when reading or writing the corresponding structs. So the bitfields are now wrapped into unions which allow to change the byte endianness during runtime with the non-bitfield member of the unio= n. With these changes, "make check SPEED=3Dslow" now properly works on big end= ian hosts, too. Reported-by: David Gibson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Gibson Signed-off-by: Thomas Huth Signed-off-by: Jason Wang --- hw/net/vmware_utils.h | 6 ++ hw/net/vmxnet3.c | 46 +++++++--- hw/net/vmxnet3.h | 230 ++++++++++++++++++++++++++++++----------------= ---- 3 files changed, 181 insertions(+), 101 deletions(-) diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h index 5500601..6b1e251 100644 --- a/hw/net/vmware_utils.h +++ b/hw/net/vmware_utils.h @@ -83,6 +83,7 @@ vmw_shmem_ld16(PCIDevice *d, hwaddr addr) { uint16_t res; pci_dma_read(d, addr, &res, 2); + res =3D le16_to_cpu(res); VMW_SHPRN("SHMEM load16: %" PRIx64 " (value 0x%X)", addr, res); return res; } @@ -91,6 +92,7 @@ static inline void vmw_shmem_st16(PCIDevice *d, hwaddr addr, uint16_t value) { VMW_SHPRN("SHMEM store16: %" PRIx64 " (value 0x%X)", addr, value); + value =3D cpu_to_le16(value); pci_dma_write(d, addr, &value, 2); } =20 @@ -99,6 +101,7 @@ vmw_shmem_ld32(PCIDevice *d, hwaddr addr) { uint32_t res; pci_dma_read(d, addr, &res, 4); + res =3D le32_to_cpu(res); VMW_SHPRN("SHMEM load32: %" PRIx64 " (value 0x%X)", addr, res); return res; } @@ -107,6 +110,7 @@ static inline void vmw_shmem_st32(PCIDevice *d, hwaddr addr, uint32_t value) { VMW_SHPRN("SHMEM store32: %" PRIx64 " (value 0x%X)", addr, value); + value =3D cpu_to_le32(value); pci_dma_write(d, addr, &value, 4); } =20 @@ -115,6 +119,7 @@ vmw_shmem_ld64(PCIDevice *d, hwaddr addr) { uint64_t res; pci_dma_read(d, addr, &res, 8); + res =3D le64_to_cpu(res); VMW_SHPRN("SHMEM load64: %" PRIx64 " (value %" PRIx64 ")", addr, res); return res; } @@ -123,6 +128,7 @@ static inline void vmw_shmem_st64(PCIDevice *d, hwaddr addr, uint64_t value) { VMW_SHPRN("SHMEM store64: %" PRIx64 " (value %" PRIx64 ")", addr, valu= e); + value =3D cpu_to_le64(value); pci_dma_write(d, addr, &value, 8); } =20 diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index cdc307d..b8404cb 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -222,7 +222,7 @@ vmxnet3_dump_tx_descr(struct Vmxnet3_TxDesc *descr) "addr %" PRIx64 ", len: %d, gen: %d, rsvd: %d, " "dtype: %d, ext1: %d, msscof: %d, hlen: %d, om: %d, " "eop: %d, cq: %d, ext2: %d, ti: %d, tci: %d", - le64_to_cpu(descr->addr), descr->len, descr->gen, descr->rsv= d, + descr->addr, descr->len, descr->gen, descr->rsvd, descr->dtype, descr->ext1, descr->msscof, descr->hlen, descr= ->om, descr->eop, descr->cq, descr->ext2, descr->ti, descr->tci); } @@ -241,7 +241,7 @@ vmxnet3_dump_rx_descr(struct Vmxnet3_RxDesc *descr) { VMW_PKPRN("RX DESCR: addr %" PRIx64 ", len: %d, gen: %d, rsvd: %d, " "dtype: %d, ext1: %d, btype: %d", - le64_to_cpu(descr->addr), descr->len, descr->gen, + descr->addr, descr->len, descr->gen, descr->rsvd, descr->dtype, descr->ext1, descr->btype); } =20 @@ -535,7 +535,8 @@ static void vmxnet3_complete_packet(VMXNET3State *s, in= t qidx, uint32_t tx_ridx) memset(&txcq_descr, 0, sizeof(txcq_descr)); txcq_descr.txdIdx =3D tx_ridx; txcq_descr.gen =3D vmxnet3_ring_curr_gen(&s->txq_descr[qidx].comp_ring= ); - + txcq_descr.val1 =3D cpu_to_le32(txcq_descr.val1); + txcq_descr.val2 =3D cpu_to_le32(txcq_descr.val2); vmxnet3_ring_write_curr_cell(d, &s->txq_descr[qidx].comp_ring, &txcq_d= escr); =20 /* Flush changes in TX descriptor before changing the counter value */ @@ -685,6 +686,16 @@ vmxnet3_on_rx_done_update_stats(VMXNET3State *s, } } =20 +static inline void +vmxnet3_ring_read_curr_txdesc(PCIDevice *pcidev, Vmxnet3Ring *ring, + struct Vmxnet3_TxDesc *txd) +{ + vmxnet3_ring_read_curr_cell(pcidev, ring, txd); + txd->addr =3D le64_to_cpu(txd->addr); + txd->val1 =3D le32_to_cpu(txd->val1); + txd->val2 =3D le32_to_cpu(txd->val2); +} + static inline bool vmxnet3_pop_next_tx_descr(VMXNET3State *s, int qidx, @@ -694,12 +705,12 @@ vmxnet3_pop_next_tx_descr(VMXNET3State *s, Vmxnet3Ring *ring =3D &s->txq_descr[qidx].tx_ring; PCIDevice *d =3D PCI_DEVICE(s); =20 - vmxnet3_ring_read_curr_cell(d, ring, txd); + vmxnet3_ring_read_curr_txdesc(d, ring, txd); if (txd->gen =3D=3D vmxnet3_ring_curr_gen(ring)) { /* Only read after generation field verification */ smp_rmb(); /* Re-read to be sure we got the latest version */ - vmxnet3_ring_read_curr_cell(d, ring, txd); + vmxnet3_ring_read_curr_txdesc(d, ring, txd); VMXNET3_RING_DUMP(VMW_RIPRN, "TX", qidx, ring); *descr_idx =3D vmxnet3_ring_curr_cell_idx(ring); vmxnet3_inc_tx_consumption_counter(s, qidx); @@ -749,7 +760,7 @@ static void vmxnet3_process_tx_queue(VMXNET3State *s, i= nt qidx) =20 if (!s->skip_current_tx_pkt) { data_len =3D (txd.len > 0) ? txd.len : VMXNET3_MAX_TX_BUF_SIZE; - data_pa =3D le64_to_cpu(txd.addr); + data_pa =3D txd.addr; =20 if (!net_tx_pkt_add_raw_fragment(s->tx_pkt, data_pa, @@ -792,6 +803,9 @@ vmxnet3_read_next_rx_descr(VMXNET3State *s, int qidx, i= nt ridx, Vmxnet3Ring *ring =3D &s->rxq_descr[qidx].rx_ring[ridx]; *didx =3D vmxnet3_ring_curr_cell_idx(ring); vmxnet3_ring_read_curr_cell(d, ring, dbuf); + dbuf->addr =3D le64_to_cpu(dbuf->addr); + dbuf->val1 =3D le32_to_cpu(dbuf->val1); + dbuf->ext1 =3D le32_to_cpu(dbuf->ext1); } =20 static inline uint8_t @@ -811,6 +825,9 @@ vmxnet3_pop_rxc_descr(VMXNET3State *s, int qidx, uint32= _t *descr_gen) =20 pci_dma_read(PCI_DEVICE(s), daddr, &rxcd, sizeof(struct Vmxnet3_RxCompDesc)); + rxcd.val1 =3D le32_to_cpu(rxcd.val1); + rxcd.val2 =3D le32_to_cpu(rxcd.val2); + rxcd.val3 =3D le32_to_cpu(rxcd.val3); ring_gen =3D vmxnet3_ring_curr_gen(&s->rxq_descr[qidx].comp_ring); =20 if (rxcd.gen !=3D ring_gen) { @@ -1061,6 +1078,16 @@ vmxnet3_pci_dma_writev(PCIDevice *pci_dev, } } =20 +static void +vmxnet3_pci_dma_write_rxcd(PCIDevice *pcidev, dma_addr_t pa, + struct Vmxnet3_RxCompDesc *rxcd) +{ + rxcd->val1 =3D cpu_to_le32(rxcd->val1); + rxcd->val2 =3D cpu_to_le32(rxcd->val2); + rxcd->val3 =3D cpu_to_le32(rxcd->val3); + pci_dma_write(pcidev, pa, rxcd, sizeof(*rxcd)); +} + static bool vmxnet3_indicate_packet(VMXNET3State *s) { @@ -1099,15 +1126,14 @@ vmxnet3_indicate_packet(VMXNET3State *s) } =20 chunk_size =3D MIN(bytes_left, rxd.len); - vmxnet3_pci_dma_writev(d, data, bytes_copied, - le64_to_cpu(rxd.addr), chunk_size); + vmxnet3_pci_dma_writev(d, data, bytes_copied, rxd.addr, chunk_size= ); bytes_copied +=3D chunk_size; bytes_left -=3D chunk_size; =20 vmxnet3_dump_rx_descr(&rxd); =20 if (ready_rxcd_pa !=3D 0) { - pci_dma_write(d, ready_rxcd_pa, &rxcd, sizeof(rxcd)); + vmxnet3_pci_dma_write_rxcd(d, ready_rxcd_pa, &rxcd); } =20 memset(&rxcd, 0, sizeof(struct Vmxnet3_RxCompDesc)); @@ -1139,7 +1165,7 @@ vmxnet3_indicate_packet(VMXNET3State *s) rxcd.eop =3D 1; rxcd.err =3D (bytes_left !=3D 0); =20 - pci_dma_write(d, ready_rxcd_pa, &rxcd, sizeof(rxcd)); + vmxnet3_pci_dma_write_rxcd(d, ready_rxcd_pa, &rxcd); =20 /* Flush RX descriptor changes */ smp_wmb(); diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h index f9352c4..5b3b76b 100644 --- a/hw/net/vmxnet3.h +++ b/hw/net/vmxnet3.h @@ -226,39 +226,49 @@ enum { struct Vmxnet3_TxDesc { __le64 addr; =20 + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 msscof:14; /* MSS, checksum offset, flags */ - u32 ext1:1; - u32 dtype:1; /* descriptor type */ - u32 rsvd:1; - u32 gen:1; /* generation bit */ - u32 len:14; + u32 msscof:14; /* MSS, checksum offset, flags */ + u32 ext1:1; + u32 dtype:1; /* descriptor type */ + u32 rsvd:1; + u32 gen:1; /* generation bit */ + u32 len:14; #else - u32 len:14; - u32 gen:1; /* generation bit */ - u32 rsvd:1; - u32 dtype:1; /* descriptor type */ - u32 ext1:1; - u32 msscof:14; /* MSS, checksum offset, flags */ + u32 len:14; + u32 gen:1; /* generation bit */ + u32 rsvd:1; + u32 dtype:1; /* descriptor type */ + u32 ext1:1; + u32 msscof:14; /* MSS, checksum offset, flags */ #endif /* __BIG_ENDIAN_BITFIELD */ - + }; + u32 val1; + }; + =20 + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 tci:16; /* Tag to Insert */ - u32 ti:1; /* VLAN Tag Insertion */ - u32 ext2:1; - u32 cq:1; /* completion request */ - u32 eop:1; /* End Of Packet */ - u32 om:2; /* offload mode */ - u32 hlen:10; /* header len */ + u32 tci:16; /* Tag to Insert */ + u32 ti:1; /* VLAN Tag Insertion */ + u32 ext2:1; + u32 cq:1; /* completion request */ + u32 eop:1; /* End Of Packet */ + u32 om:2; /* offload mode */ + u32 hlen:10; /* header len */ #else - u32 hlen:10; /* header len */ - u32 om:2; /* offload mode */ - u32 eop:1; /* End Of Packet */ - u32 cq:1; /* completion request */ - u32 ext2:1; - u32 ti:1; /* VLAN Tag Insertion */ - u32 tci:16; /* Tag to Insert */ + u32 hlen:10; /* header len */ + u32 om:2; /* offload mode */ + u32 eop:1; /* End Of Packet */ + u32 cq:1; /* completion request */ + u32 ext2:1; + u32 ti:1; /* VLAN Tag Insertion */ + u32 tci:16; /* Tag to Insert */ #endif /* __BIG_ENDIAN_BITFIELD */ + }; + u32 val2; + }; }; =20 /* TxDesc.OM values */ @@ -291,33 +301,57 @@ struct Vmxnet3_TxDataDesc { #define VMXNET3_TCD_GEN_DWORD_SHIFT 3 =20 struct Vmxnet3_TxCompDesc { - u32 txdIdx:12; /* Index of the EOP TxDesc */ - u32 ext1:20; - + union { + struct { +#ifdef __BIG_ENDIAN_BITFIELD + u32 ext1:20; + u32 txdIdx:12; /* Index of the EOP TxDesc */ +#else + u32 txdIdx:12; /* Index of the EOP TxDesc */ + u32 ext1:20; +#endif + }; + u32 val1; + }; __le32 ext2; __le32 ext3; =20 - u32 rsvd:24; - u32 type:7; /* completion type */ - u32 gen:1; /* generation bit */ + union { + struct { +#ifdef __BIG_ENDIAN_BITFIELD + u32 gen:1; /* generation bit */ + u32 type:7; /* completion type */ + u32 rsvd:24; +#else + u32 rsvd:24; + u32 type:7; /* completion type */ + u32 gen:1; /* generation bit */ +#endif + }; + u32 val2; + }; }; =20 struct Vmxnet3_RxDesc { __le64 addr; - + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 gen:1; /* Generation bit */ - u32 rsvd:15; - u32 dtype:1; /* Descriptor type */ - u32 btype:1; /* Buffer Type */ - u32 len:14; + u32 gen:1; /* Generation bit */ + u32 rsvd:15; + u32 dtype:1; /* Descriptor type */ + u32 btype:1; /* Buffer Type */ + u32 len:14; #else - u32 len:14; - u32 btype:1; /* Buffer Type */ - u32 dtype:1; /* Descriptor type */ - u32 rsvd:15; - u32 gen:1; /* Generation bit */ + u32 len:14; + u32 btype:1; /* Buffer Type */ + u32 dtype:1; /* Descriptor type */ + u32 rsvd:15; + u32 gen:1; /* Generation bit */ #endif + }; + u32 val1; + }; u32 ext1; }; =20 @@ -330,66 +364,80 @@ struct Vmxnet3_RxDesc { #define VMXNET3_RXD_GEN_SHIFT 31 =20 struct Vmxnet3_RxCompDesc { + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 ext2:1; - u32 cnc:1; /* Checksum Not Calculated */ - u32 rssType:4; /* RSS hash type used */ - u32 rqID:10; /* rx queue/ring ID */ - u32 sop:1; /* Start of Packet */ - u32 eop:1; /* End of Packet */ - u32 ext1:2; - u32 rxdIdx:12; /* Index of the RxDesc */ + u32 ext2:1; + u32 cnc:1; /* Checksum Not Calculated */ + u32 rssType:4; /* RSS hash type used */ + u32 rqID:10; /* rx queue/ring ID */ + u32 sop:1; /* Start of Packet */ + u32 eop:1; /* End of Packet */ + u32 ext1:2; + u32 rxdIdx:12; /* Index of the RxDesc */ #else - u32 rxdIdx:12; /* Index of the RxDesc */ - u32 ext1:2; - u32 eop:1; /* End of Packet */ - u32 sop:1; /* Start of Packet */ - u32 rqID:10; /* rx queue/ring ID */ - u32 rssType:4; /* RSS hash type used */ - u32 cnc:1; /* Checksum Not Calculated */ - u32 ext2:1; + u32 rxdIdx:12; /* Index of the RxDesc */ + u32 ext1:2; + u32 eop:1; /* End of Packet */ + u32 sop:1; /* Start of Packet */ + u32 rqID:10; /* rx queue/ring ID */ + u32 rssType:4; /* RSS hash type used */ + u32 cnc:1; /* Checksum Not Calculated */ + u32 ext2:1; #endif /* __BIG_ENDIAN_BITFIELD */ + }; + u32 val1; + }; =20 __le32 rssHash; /* RSS hash value */ =20 + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 tci:16; /* Tag stripped */ - u32 ts:1; /* Tag is stripped */ - u32 err:1; /* Error */ - u32 len:14; /* data length */ + u32 tci:16; /* Tag stripped */ + u32 ts:1; /* Tag is stripped */ + u32 err:1; /* Error */ + u32 len:14; /* data length */ #else - u32 len:14; /* data length */ - u32 err:1; /* Error */ - u32 ts:1; /* Tag is stripped */ - u32 tci:16; /* Tag stripped */ + u32 len:14; /* data length */ + u32 err:1; /* Error */ + u32 ts:1; /* Tag is stripped */ + u32 tci:16; /* Tag stripped */ #endif /* __BIG_ENDIAN_BITFIELD */ + }; + u32 val2; + }; =20 - + union { + struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 gen:1; /* generation bit */ - u32 type:7; /* completion type */ - u32 fcs:1; /* Frame CRC correct */ - u32 frg:1; /* IP Fragment */ - u32 v4:1; /* IPv4 */ - u32 v6:1; /* IPv6 */ - u32 ipc:1; /* IP Checksum Correct */ - u32 tcp:1; /* TCP packet */ - u32 udp:1; /* UDP packet */ - u32 tuc:1; /* TCP/UDP Checksum Correct */ - u32 csum:16; + u32 gen:1; /* generation bit */ + u32 type:7; /* completion type */ + u32 fcs:1; /* Frame CRC correct */ + u32 frg:1; /* IP Fragment */ + u32 v4:1; /* IPv4 */ + u32 v6:1; /* IPv6 */ + u32 ipc:1; /* IP Checksum Correct */ + u32 tcp:1; /* TCP packet */ + u32 udp:1; /* UDP packet */ + u32 tuc:1; /* TCP/UDP Checksum Correct */ + u32 csum:16; #else - u32 csum:16; - u32 tuc:1; /* TCP/UDP Checksum Correct */ - u32 udp:1; /* UDP packet */ - u32 tcp:1; /* TCP packet */ - u32 ipc:1; /* IP Checksum Correct */ - u32 v6:1; /* IPv6 */ - u32 v4:1; /* IPv4 */ - u32 frg:1; /* IP Fragment */ - u32 fcs:1; /* Frame CRC correct */ - u32 type:7; /* completion type */ - u32 gen:1; /* generation bit */ + u32 csum:16; + u32 tuc:1; /* TCP/UDP Checksum Correct */ + u32 udp:1; /* UDP packet */ + u32 tcp:1; /* TCP packet */ + u32 ipc:1; /* IP Checksum Correct */ + u32 v6:1; /* IPv6 */ + u32 v4:1; /* IPv4 */ + u32 frg:1; /* IP Fragment */ + u32 fcs:1; /* Frame CRC correct */ + u32 type:7; /* completion type */ + u32 gen:1; /* generation bit */ #endif /* __BIG_ENDIAN_BITFIELD */ + }; + u32 val3; + }; }; =20 /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */ --=20 2.7.4