From nobody Mon May 6 07:10:11 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 1513909240553329.60817724135416; Thu, 21 Dec 2017 18:20:40 -0800 (PST) Received: from localhost ([::1]:53509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCwx-0002Hu-Be for importer@patchew.org; Thu, 21 Dec 2017 21:20:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsH-0007Eu-CD for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsF-000088-Sw for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43258) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsF-000075-Fv for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:47 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 936BC81DFA; Fri, 22 Dec 2017 02:15:46 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF36860C9F; Fri, 22 Dec 2017 02:15:42 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:20 +0800 Message-Id: <1513908937-16034-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 22 Dec 2017 02:15:46 +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 01/18] e1000, e1000e: Move per-packet TX offload flags out of context state 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 via Qemu-devel sum_needed and cptse flags are received from the guest within each transmit data descriptor. They are not part of the offload context; instead, they determine how to apply a previously received context to the packet being transmitted: - If cptse is set, perform both segmentation and checksum offload using the parameters in the TSO context; otherwise just do checksum offload. (Currently the e1000 device incorrectly stores only one context, which will be fixed in a subsequent patch.) - Depending on the bits set in sum_needed, possibly perform L4 checksum offload and/or IP checksum offload, using the parameters in the appropriate context. Move these flags out of struct e1000x_txd_props, which is otherwise dedicated to storing values from a context descriptor, and into the per-packet TX struct. Signed-off-by: Ed Swierk Signed-off-by: Jason Wang --- hw/net/e1000.c | 30 ++++++++++++++++-------------- hw/net/e1000e.c | 4 ++-- hw/net/e1000e_core.c | 16 ++++++++-------- hw/net/e1000e_core.h | 2 ++ hw/net/e1000x_common.h | 2 -- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 05a00cb..30aef93 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -98,6 +98,8 @@ typedef struct E1000State_st { unsigned char data[0x10000]; uint16_t size; unsigned char vlan_needed; + unsigned char sum_needed; + bool cptse; e1000x_txd_props props; uint16_t tso_frames; } tx; @@ -540,7 +542,7 @@ xmit_seg(E1000State *s) unsigned int frames =3D s->tx.tso_frames, css, sofar; struct e1000_tx *tp =3D &s->tx; =20 - if (tp->props.tse && tp->props.cptse) { + if (tp->props.tse && tp->cptse) { css =3D tp->props.ipcss; DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); @@ -564,7 +566,7 @@ xmit_seg(E1000State *s) } } else /* UDP */ stw_be_p(tp->data+css+4, len); - if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { + if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int phsum; // add pseudo-header length before checksum calculation void *sp =3D tp->data + tp->props.tucso; @@ -576,11 +578,11 @@ xmit_seg(E1000State *s) tp->tso_frames++; } =20 - if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { + if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { putsum(tp->data, tp->size, tp->props.tucso, tp->props.tucss, tp->props.tucse); } - if (tp->props.sum_needed & E1000_TXD_POPTS_IXSM) { + if (tp->sum_needed & E1000_TXD_POPTS_IXSM) { putsum(tp->data, tp->size, tp->props.ipcso, tp->props.ipcss, tp->props.ipcse); } @@ -624,17 +626,17 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *= dp) } else if (dtype =3D=3D (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { // data descriptor if (tp->size =3D=3D 0) { - tp->props.sum_needed =3D le32_to_cpu(dp->upper.data) >> 8; + tp->sum_needed =3D le32_to_cpu(dp->upper.data) >> 8; } - tp->props.cptse =3D (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; + tp->cptse =3D (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; } else { // legacy descriptor - tp->props.cptse =3D 0; + tp->cptse =3D 0; } =20 if (e1000x_vlan_enabled(s->mac_reg) && e1000x_is_vlan_txd(txd_lower) && - (tp->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) { + (tp->cptse || txd_lower & E1000_TXD_CMD_EOP)) { tp->vlan_needed =3D 1; stw_be_p(tp->vlan_header, le16_to_cpu(s->mac_reg[VET])); @@ -643,7 +645,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) } =20 addr =3D le64_to_cpu(dp->buffer_addr); - if (tp->props.tse && tp->props.cptse) { + if (tp->props.tse && tp->cptse) { msh =3D tp->props.hdr_len + tp->props.mss; do { bytes =3D split_size; @@ -665,7 +667,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) } split_size -=3D bytes; } while (bytes && split_size); - } else if (!tp->props.tse && tp->props.cptse) { + } else if (!tp->props.tse && tp->cptse) { // context descriptor TSE is not set, while data descriptor TSE is= set DBGOUT(TXERR, "TCP segmentation error\n"); } else { @@ -676,14 +678,14 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *= dp) =20 if (!(txd_lower & E1000_TXD_CMD_EOP)) return; - if (!(tp->props.tse && tp->props.cptse && tp->size < tp->props.hdr_len= )) { + if (!(tp->props.tse && tp->cptse && tp->size < tp->props.hdr_len)) { xmit_seg(s); } tp->tso_frames =3D 0; - tp->props.sum_needed =3D 0; + tp->sum_needed =3D 0; tp->vlan_needed =3D 0; tp->size =3D 0; - tp->props.cptse =3D 0; + tp->cptse =3D 0; } =20 static uint32_t @@ -1461,7 +1463,7 @@ static const VMStateDescription vmstate_e1000 =3D { VMSTATE_UINT16(tx.props.mss, E1000State), VMSTATE_UINT16(tx.size, E1000State), VMSTATE_UINT16(tx.tso_frames, E1000State), - VMSTATE_UINT8(tx.props.sum_needed, E1000State), + VMSTATE_UINT8(tx.sum_needed, E1000State), VMSTATE_INT8(tx.props.ip, E1000State), VMSTATE_INT8(tx.props.tcp, E1000State), VMSTATE_BUFFER(tx.header, E1000State), diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index f1af279..191398a 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -556,7 +556,7 @@ static const VMStateDescription e1000e_vmstate_tx =3D { .version_id =3D 1, .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { - VMSTATE_UINT8(props.sum_needed, struct e1000e_tx), + VMSTATE_UINT8(sum_needed, struct e1000e_tx), VMSTATE_UINT8(props.ipcss, struct e1000e_tx), VMSTATE_UINT8(props.ipcso, struct e1000e_tx), VMSTATE_UINT16(props.ipcse, struct e1000e_tx), @@ -569,7 +569,7 @@ static const VMStateDescription e1000e_vmstate_tx =3D { VMSTATE_INT8(props.ip, struct e1000e_tx), VMSTATE_INT8(props.tcp, struct e1000e_tx), VMSTATE_BOOL(props.tse, struct e1000e_tx), - VMSTATE_BOOL(props.cptse, struct e1000e_tx), + VMSTATE_BOOL(cptse, struct e1000e_tx), VMSTATE_BOOL(skip_cp, struct e1000e_tx), VMSTATE_END_OF_LIST() } diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 43a8d89..c93c466 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -632,18 +632,18 @@ e1000e_rss_parse_packet(E1000ECore *core, static void e1000e_setup_tx_offloads(E1000ECore *core, struct e1000e_tx *tx) { - if (tx->props.tse && tx->props.cptse) { + if (tx->props.tse && tx->cptse) { net_tx_pkt_build_vheader(tx->tx_pkt, true, true, tx->props.mss); net_tx_pkt_update_ip_checksums(tx->tx_pkt); e1000x_inc_reg_if_not_full(core->mac, TSCTC); return; } =20 - if (tx->props.sum_needed & E1000_TXD_POPTS_TXSM) { + if (tx->sum_needed & E1000_TXD_POPTS_TXSM) { net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0); } =20 - if (tx->props.sum_needed & E1000_TXD_POPTS_IXSM) { + if (tx->sum_needed & E1000_TXD_POPTS_IXSM) { net_tx_pkt_update_ip_hdr_checksum(tx->tx_pkt); } } @@ -715,13 +715,13 @@ e1000e_process_tx_desc(E1000ECore *core, return; } else if (dtype =3D=3D (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { /* data descriptor */ - tx->props.sum_needed =3D le32_to_cpu(dp->upper.data) >> 8; - tx->props.cptse =3D (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; + tx->sum_needed =3D le32_to_cpu(dp->upper.data) >> 8; + tx->cptse =3D (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(core, dp); } else { /* legacy descriptor */ e1000e_process_ts_option(core, dp); - tx->props.cptse =3D 0; + tx->cptse =3D 0; } =20 addr =3D le64_to_cpu(dp->buffer_addr); @@ -747,8 +747,8 @@ e1000e_process_tx_desc(E1000ECore *core, tx->skip_cp =3D false; net_tx_pkt_reset(tx->tx_pkt); =20 - tx->props.sum_needed =3D 0; - tx->props.cptse =3D 0; + tx->sum_needed =3D 0; + tx->cptse =3D 0; } } =20 diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h index 1ff6978..7d8ff41 100644 --- a/hw/net/e1000e_core.h +++ b/hw/net/e1000e_core.h @@ -71,6 +71,8 @@ struct E1000Core { e1000x_txd_props props; =20 bool skip_cp; + unsigned char sum_needed; + bool cptse; struct NetTxPkt *tx_pkt; } tx[E1000E_NUM_QUEUES]; =20 diff --git a/hw/net/e1000x_common.h b/hw/net/e1000x_common.h index 3072ce9..0268884 100644 --- a/hw/net/e1000x_common.h +++ b/hw/net/e1000x_common.h @@ -193,7 +193,6 @@ void e1000x_update_regs_on_autoneg_done(uint32_t *mac, = uint16_t *phy); void e1000x_increase_size_stats(uint32_t *mac, const int *size_regs, int s= ize); =20 typedef struct e1000x_txd_props { - unsigned char sum_needed; uint8_t ipcss; uint8_t ipcso; uint16_t ipcse; @@ -206,7 +205,6 @@ typedef struct e1000x_txd_props { int8_t ip; int8_t tcp; bool tse; - bool cptse; } e1000x_txd_props; =20 void e1000x_read_tx_ctx_descr(struct e1000_context_desc *d, --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909411018489.1349327769833; Thu, 21 Dec 2017 18:23:31 -0800 (PST) Received: from localhost ([::1]:53570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCzc-0004xs-CE for importer@patchew.org; Thu, 21 Dec 2017 21:23:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsK-0007Iy-Hg for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsI-0000Ag-IQ for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsI-00009v-8j for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 855DA477; Fri, 22 Dec 2017 02:15:49 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56B7251C36; Fri, 22 Dec 2017 02:15:46 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:21 +0800 Message-Id: <1513908937-16034-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 22 Dec 2017 02:15:49 +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 02/18] e1000: Separate TSO and non-TSO contexts, fixing UDP TX corruption 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 via Qemu-devel The device is supposed to maintain two distinct contexts for transmit offloads: one has parameters for both segmentation and checksum offload, the other only for checksum offload. The guest driver can send two context descriptors, one for each context (the TSE flag specifies which). Then the guest can refer to one or the other context in subsequent transmit data descriptors, depending on what offloads it wants applied to each packet. Currently the e1000 device stores just one context, and misinterprets the TSE flags in the context and data descriptors. This is often okay: Linux happens to send a fresh context descriptor before every data descriptor, so forgetting the other context doesn't matter. Windows does rely on separate contexts for TSO vs. non-TSO packets, but for mostly-TCP traffic the two contexts have identical TCP-specific offload parameters so confusing them doesn't matter. One case where this confusion matters is when a Windows guest sets up a TSO context for TCP and a non-TSO context for UDP, and then transmits both TCP and UDP traffic in parallel. The e1000 device sometimes ends up using TCP-specific parameters while doing checksum offload on a UDP datagram: it writes the checksum to offset 16 (the correct location for a TCP checksum), stomping on two bytes of UDP data, and leaving the wrong value in the actual UDP checksum field at offset 6. (Even worse, the host network stack may then recompute the UDP checksum, "correcting" it to match the corrupt data before sending it out a physical interface.) Correct this by tracking the TSO context independently of the non-TSO context, and selecting the appropriate context based on the TSE flag in each transmit data descriptor. Signed-off-by: Ed Swierk Signed-off-by: Jason Wang --- hw/net/e1000.c | 70 +++++++++++++++++++++++++++++++++---------------------= ---- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 30aef93..804ec08 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -101,6 +101,7 @@ typedef struct E1000State_st { unsigned char sum_needed; bool cptse; e1000x_txd_props props; + e1000x_txd_props tso_props; uint16_t tso_frames; } tx; =20 @@ -541,35 +542,37 @@ xmit_seg(E1000State *s) uint16_t len; unsigned int frames =3D s->tx.tso_frames, css, sofar; struct e1000_tx *tp =3D &s->tx; + struct e1000x_txd_props *props =3D tp->cptse ? &tp->tso_props : &tp->p= rops; =20 - if (tp->props.tse && tp->cptse) { - css =3D tp->props.ipcss; + if (tp->cptse) { + css =3D props->ipcss; DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); - if (tp->props.ip) { /* IPv4 */ + if (props->ip) { /* IPv4 */ stw_be_p(tp->data+css+2, tp->size - css); stw_be_p(tp->data+css+4, lduw_be_p(tp->data + css + 4) + frames); } else { /* IPv6 */ stw_be_p(tp->data+css+4, tp->size - css); } - css =3D tp->props.tucss; + css =3D props->tucss; len =3D tp->size - css; - DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->props.tcp, css, len); - if (tp->props.tcp) { - sofar =3D frames * tp->props.mss; + DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", props->tcp, css, len); + if (props->tcp) { + sofar =3D frames * props->mss; stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); /* s= eq */ - if (tp->props.paylen - sofar > tp->props.mss) { + if (props->paylen - sofar > props->mss) { tp->data[css + 13] &=3D ~9; /* PSH, FIN */ } else if (frames) { e1000x_inc_reg_if_not_full(s->mac_reg, TSCTC); } - } else /* UDP */ + } else { /* UDP */ stw_be_p(tp->data+css+4, len); + } if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int phsum; // add pseudo-header length before checksum calculation - void *sp =3D tp->data + tp->props.tucso; + void *sp =3D tp->data + props->tucso; =20 phsum =3D lduw_be_p(sp) + len; phsum =3D (phsum >> 16) + (phsum & 0xffff); @@ -579,12 +582,10 @@ xmit_seg(E1000State *s) } =20 if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { - putsum(tp->data, tp->size, tp->props.tucso, - tp->props.tucss, tp->props.tucse); + putsum(tp->data, tp->size, props->tucso, props->tucss, props->tucs= e); } if (tp->sum_needed & E1000_TXD_POPTS_IXSM) { - putsum(tp->data, tp->size, tp->props.ipcso, - tp->props.ipcss, tp->props.ipcse); + putsum(tp->data, tp->size, props->ipcso, props->ipcss, props->ipcs= e); } if (tp->vlan_needed) { memmove(tp->vlan, tp->data, 4); @@ -616,11 +617,11 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *= dp) =20 s->mit_ide |=3D (txd_lower & E1000_TXD_CMD_IDE); if (dtype =3D=3D E1000_TXD_CMD_DEXT) { /* context descriptor */ - e1000x_read_tx_ctx_descr(xp, &tp->props); - tp->tso_frames =3D 0; - if (tp->props.tucso =3D=3D 0) { /* this is probably wrong */ - DBGOUT(TXSUM, "TCP/UDP: cso 0!\n"); - tp->props.tucso =3D tp->props.tucss + (tp->props.tcp ? 16 : 6); + if (le32_to_cpu(xp->cmd_and_length) & E1000_TXD_CMD_TSE) { + e1000x_read_tx_ctx_descr(xp, &tp->tso_props); + tp->tso_frames =3D 0; + } else { + e1000x_read_tx_ctx_descr(xp, &tp->props); } return; } else if (dtype =3D=3D (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { @@ -645,8 +646,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) } =20 addr =3D le64_to_cpu(dp->buffer_addr); - if (tp->props.tse && tp->cptse) { - msh =3D tp->props.hdr_len + tp->props.mss; + if (tp->cptse) { + msh =3D tp->tso_props.hdr_len + tp->tso_props.mss; do { bytes =3D split_size; if (tp->size + bytes > msh) @@ -655,21 +656,19 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *= dp) bytes =3D MIN(sizeof(tp->data) - tp->size, bytes); pci_dma_read(d, addr, tp->data + tp->size, bytes); sz =3D tp->size + bytes; - if (sz >=3D tp->props.hdr_len && tp->size < tp->props.hdr_len)= { - memmove(tp->header, tp->data, tp->props.hdr_len); + if (sz >=3D tp->tso_props.hdr_len + && tp->size < tp->tso_props.hdr_len) { + memmove(tp->header, tp->data, tp->tso_props.hdr_len); } tp->size =3D sz; addr +=3D bytes; if (sz =3D=3D msh) { xmit_seg(s); - memmove(tp->data, tp->header, tp->props.hdr_len); - tp->size =3D tp->props.hdr_len; + memmove(tp->data, tp->header, tp->tso_props.hdr_len); + tp->size =3D tp->tso_props.hdr_len; } split_size -=3D bytes; } while (bytes && split_size); - } else if (!tp->props.tse && tp->cptse) { - // context descriptor TSE is not set, while data descriptor TSE is= set - DBGOUT(TXERR, "TCP segmentation error\n"); } else { split_size =3D MIN(sizeof(tp->data) - tp->size, split_size); pci_dma_read(d, addr, tp->data + tp->size, split_size); @@ -678,7 +677,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) =20 if (!(txd_lower & E1000_TXD_CMD_EOP)) return; - if (!(tp->props.tse && tp->cptse && tp->size < tp->props.hdr_len)) { + if (!(tp->cptse && tp->size < tp->tso_props.hdr_len)) { xmit_seg(s); } tp->tso_frames =3D 0; @@ -1437,7 +1436,7 @@ static const VMStateDescription vmstate_e1000_full_ma= c_state =3D { =20 static const VMStateDescription vmstate_e1000 =3D { .name =3D "e1000", - .version_id =3D 2, + .version_id =3D 3, .minimum_version_id =3D 1, .pre_save =3D e1000_pre_save, .post_load =3D e1000_post_load, @@ -1510,6 +1509,17 @@ static const VMStateDescription vmstate_e1000 =3D { VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, RA, 32), VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, MTA, 128), VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, VFTA, 128), + VMSTATE_UINT8_V(tx.tso_props.ipcss, E1000State, 3), + VMSTATE_UINT8_V(tx.tso_props.ipcso, E1000State, 3), + VMSTATE_UINT16_V(tx.tso_props.ipcse, E1000State, 3), + VMSTATE_UINT8_V(tx.tso_props.tucss, E1000State, 3), + VMSTATE_UINT8_V(tx.tso_props.tucso, E1000State, 3), + VMSTATE_UINT16_V(tx.tso_props.tucse, E1000State, 3), + VMSTATE_UINT32_V(tx.tso_props.paylen, E1000State, 3), + VMSTATE_UINT8_V(tx.tso_props.hdr_len, E1000State, 3), + VMSTATE_UINT16_V(tx.tso_props.mss, E1000State, 3), + VMSTATE_INT8_V(tx.tso_props.ip, E1000State, 3), + VMSTATE_INT8_V(tx.tso_props.tcp, E1000State, 3), VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription*[]) { --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909540556325.18872866542245; Thu, 21 Dec 2017 18:25:40 -0800 (PST) Received: from localhost ([::1]:53699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD1n-0007Is-I0 for importer@patchew.org; Thu, 21 Dec 2017 21:25:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsN-0007KX-BC for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsL-0000EB-Rk for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsL-0000DR-IY for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:53 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C82FE79704; Fri, 22 Dec 2017 02:15:52 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DC6B51C36; Fri, 22 Dec 2017 02:15:49 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:22 +0800 Message-Id: <1513908937-16034-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 22 Dec 2017 02:15:52 +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 03/18] net: move CRC32 calculation from compute_mcast_idx() into its own net_crc32() function 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 , Mark Cave-Ayland 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: Mark Cave-Ayland Separate out the standard ethernet CRC32 calculation into a new net_crc32() function, renaming the constant POLYNOMIAL to POLYNOMIAL_BE to make it clear that this is a big-endian CRC32 calculation. As part of the constant rename, remove the duplicate definition of POLYNOMI= AL from eepro100.c and use the new POLYNOMIAL_BE constant instead. Once this is complete remove the existing CRC32 implementation from compute_mcast_idx() and call the new net_crc32() function in its place. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/eepro100.c | 4 +--- include/net/net.h | 3 ++- net/net.c | 16 +++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 1c0def5..71cddfe 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -323,8 +323,6 @@ static const uint16_t eepro100_mdi_mask[] =3D { 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; =20 -#define POLYNOMIAL 0x04c11db6 - static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s); =20 /* From FreeBSD (locally modified). */ @@ -342,7 +340,7 @@ static unsigned e100_compute_mcast_idx(const uint8_t *e= p) crc <<=3D 1; b >>=3D 1; if (carry) { - crc =3D ((crc ^ POLYNOMIAL) | carry); + crc =3D ((crc ^ POLYNOMIAL_BE) | carry); } } } diff --git a/include/net/net.h b/include/net/net.h index 1c55a93..586098c 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -227,7 +227,8 @@ NetClientState *net_hub_port_find(int hub_id); =20 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd); =20 -#define POLYNOMIAL 0x04c11db6 +#define POLYNOMIAL_BE 0x04c11db6 +uint32_t net_crc32(const uint8_t *p, int len); unsigned compute_mcast_idx(const uint8_t *ep); =20 #define vmstate_offset_macaddr(_state, _field) \ diff --git a/net/net.c b/net/net.c index 39ef546..a14dc99 100644 --- a/net/net.c +++ b/net/net.c @@ -1581,25 +1581,31 @@ int net_client_parse(QemuOptsList *opts_list, const= char *optarg) =20 /* From FreeBSD */ /* XXX: optimize */ -unsigned compute_mcast_idx(const uint8_t *ep) +uint32_t net_crc32(const uint8_t *p, int len) { uint32_t crc; int carry, i, j; uint8_t b; =20 crc =3D 0xffffffff; - for (i =3D 0; i < 6; i++) { - b =3D *ep++; + for (i =3D 0; i < len; i++) { + b =3D *p++; for (j =3D 0; j < 8; j++) { carry =3D ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01); crc <<=3D 1; b >>=3D 1; if (carry) { - crc =3D ((crc ^ POLYNOMIAL) | carry); + crc =3D ((crc ^ POLYNOMIAL_BE) | carry); } } } - return crc >> 26; + + return crc; +} + +unsigned compute_mcast_idx(const uint8_t *ep) +{ + return net_crc32(ep, ETH_ALEN) >> 26; } =20 QemuOptsList qemu_netdev_opts =3D { --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909099512127.58193929510435; Thu, 21 Dec 2017 18:18:19 -0800 (PST) Received: from localhost ([::1]:53482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCub-0000E1-6w for importer@patchew.org; Thu, 21 Dec 2017 21:18:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsQ-0007Mu-T9 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsQ-0000HH-14 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsP-0000GP-Qn for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:15:57 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 038C16A7C3; Fri, 22 Dec 2017 02:15:57 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9240419694; Fri, 22 Dec 2017 02:15:53 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:23 +0800 Message-Id: <1513908937-16034-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 22 Dec 2017 02:15:57 +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 04/18] net: introduce net_crc32_le() function 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 , Mark Cave-Ayland 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: Mark Cave-Ayland This provides a standard ethernet CRC32 little-endian implementation. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- include/net/net.h | 2 ++ net/net.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 586098c..4afac1a 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -228,7 +228,9 @@ NetClientState *net_hub_port_find(int hub_id); void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd); =20 #define POLYNOMIAL_BE 0x04c11db6 +#define POLYNOMIAL_LE 0xedb88320 uint32_t net_crc32(const uint8_t *p, int len); +uint32_t net_crc32_le(const uint8_t *p, int len); unsigned compute_mcast_idx(const uint8_t *ep); =20 #define vmstate_offset_macaddr(_state, _field) \ diff --git a/net/net.c b/net/net.c index a14dc99..4ecaf80 100644 --- a/net/net.c +++ b/net/net.c @@ -1603,6 +1603,28 @@ uint32_t net_crc32(const uint8_t *p, int len) return crc; } =20 +uint32_t net_crc32_le(const uint8_t *p, int len) +{ + uint32_t crc; + int carry, i, j; + uint8_t b; + + crc =3D 0xffffffff; + for (i =3D 0; i < len; i++) { + b =3D *p++; + for (j =3D 0; j < 8; j++) { + carry =3D (crc & 0x1) ^ (b & 0x01); + crc >>=3D 1; + b >>=3D 1; + if (carry) { + crc ^=3D POLYNOMIAL_LE; + } + } + } + + return crc; +} + unsigned compute_mcast_idx(const uint8_t *ep) { return net_crc32(ep, ETH_ALEN) >> 26; --=20 2.7.4 From nobody Mon May 6 07:10:11 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 151390926608312.910621903819106; Thu, 21 Dec 2017 18:21:06 -0800 (PST) Received: from localhost ([::1]:53514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCxM-0002hR-VU for importer@patchew.org; Thu, 21 Dec 2017 21:21:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsY-0007St-NI for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsW-0000Nn-0B for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsV-0000M7-Qd for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:03 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11BD1BDFD; Fri, 22 Dec 2017 02:16:03 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id C316060C9F; Fri, 22 Dec 2017 02:15:57 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:24 +0800 Message-Id: <1513908937-16034-6-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 22 Dec 2017 02:16:03 +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 05/18] pcnet: switch pcnet over to use net_crc32_le() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland Instead of lnc_mchash() using its own implementation, we can simply call net_crc32_le() directly and apply the bit shift inline. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/pcnet.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c index 6544553..39d5d93 100644 --- a/hw/net/pcnet.c +++ b/hw/net/pcnet.c @@ -38,6 +38,7 @@ #include "qemu/osdep.h" #include "hw/qdev.h" #include "net/net.h" +#include "net/eth.h" #include "qemu/timer.h" #include "qemu/sockets.h" #include "sysemu/sysemu.h" @@ -522,25 +523,6 @@ static inline void pcnet_rmd_store(PCNetState *s, stru= ct pcnet_RMD *rmd, be16_to_cpu(hdr->ether_type)); \ } while (0) =20 -#define MULTICAST_FILTER_LEN 8 - -static inline uint32_t lnc_mchash(const uint8_t *ether_addr) -{ -#define LNC_POLYNOMIAL 0xEDB88320UL - uint32_t crc =3D 0xFFFFFFFF; - int idx, bit; - uint8_t data; - - for (idx =3D 0; idx < 6; idx++) { - for (data =3D *ether_addr++, bit =3D 0; bit < MULTICAST_FILTER_LEN= ; bit++) { - crc =3D (crc >> 1) ^ (((crc ^ data) & 1) ? LNC_POLYNOMIAL : 0); - data >>=3D 1; - } - } - return crc; -#undef LNC_POLYNOMIAL -} - #define CRC(crc, ch) (crc =3D (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) =20 /* generated using the AUTODIN II polynomial @@ -656,7 +638,7 @@ static inline int ladr_match(PCNetState *s, const uint8= _t *buf, int size) s->csr[10] & 0xff, s->csr[10] >> 8, s->csr[11] & 0xff, s->csr[11] >> 8 }; - int index =3D lnc_mchash(hdr->ether_dhost) >> 26; + int index =3D net_crc32_le(hdr->ether_dhost, ETH_ALEN) >> 26; return !!(ladr[index >> 3] & (1 << (index & 7))); } return 0; --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909112311481.9425651600583; Thu, 21 Dec 2017 18:18:32 -0800 (PST) Received: from localhost ([::1]:53483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCuq-0000Rs-6C for importer@patchew.org; Thu, 21 Dec 2017 21:18:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsa-0007UR-GN for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsZ-0000RQ-Dj for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsZ-0000Qc-5N for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5764C128B; Fri, 22 Dec 2017 02:16:06 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC19719694; Fri, 22 Dec 2017 02:16:03 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:25 +0800 Message-Id: <1513908937-16034-7-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 22 Dec 2017 02:16:06 +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 06/18] eepro100: switch eepro100 e100_compute_mcast_idx() over to use net_crc32() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland Instead of e100_compute_mcast_idx() using its own implementation, we can simply call net_crc32() directly and apply the bit shift inline. Signed-off-by: Mark Cave-Ayland Reviewed-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/eepro100.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 71cddfe..e30fed8 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -44,6 +44,7 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "net/net.h" +#include "net/eth.h" #include "hw/nvram/eeprom93xx.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h" @@ -325,28 +326,6 @@ static const uint16_t eepro100_mdi_mask[] =3D { =20 static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s); =20 -/* From FreeBSD (locally modified). */ -static unsigned e100_compute_mcast_idx(const uint8_t *ep) -{ - uint32_t crc; - int carry, i, j; - uint8_t b; - - crc =3D 0xffffffff; - for (i =3D 0; i < 6; i++) { - b =3D *ep++; - for (j =3D 0; j < 8; j++) { - carry =3D ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01); - crc <<=3D 1; - b >>=3D 1; - if (carry) { - crc =3D ((crc ^ POLYNOMIAL_BE) | carry); - } - } - } - return (crc & BITS(7, 2)) >> 2; -} - /* Read a 16 bit control/status (CSR) register. */ static uint16_t e100_read_reg2(EEPRO100State *s, E100RegisterOffset addr) { @@ -843,7 +822,8 @@ static void set_multicast_list(EEPRO100State *s) uint8_t multicast_addr[6]; pci_dma_read(&s->dev, s->cb_address + 10 + i, multicast_addr, 6); TRACE(OTHER, logout("multicast entry %s\n", nic_dump(multicast_add= r, 6))); - unsigned mcast_idx =3D e100_compute_mcast_idx(multicast_addr); + unsigned mcast_idx =3D (net_crc32(multicast_addr, ETH_ALEN) & + BITS(7, 2)) >> 2; assert(mcast_idx < 64); s->mult[mcast_idx >> 3] |=3D (1 << (mcast_idx & 7)); } @@ -1679,7 +1659,7 @@ static ssize_t nic_receive(NetClientState *nc, const = uint8_t * buf, size_t size) if (s->configuration[21] & BIT(3)) { /* Multicast all bit is set, receive all multicast frames. */ } else { - unsigned mcast_idx =3D e100_compute_mcast_idx(buf); + unsigned mcast_idx =3D (net_crc32(buf, ETH_ALEN) & BITS(7, 2)) >= > 2; assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { /* Multicast frame is allowed in hash table. */ --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909435073135.57392581915747; Thu, 21 Dec 2017 18:23:55 -0800 (PST) Received: from localhost ([::1]:53572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCzy-0005Hm-9x for importer@patchew.org; Thu, 21 Dec 2017 21:23:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsd-0007Vd-DH for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsc-0000T5-BA for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsc-0000Sh-4f for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:10 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63BA94A6E9; Fri, 22 Dec 2017 02:16:09 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2633B60C9F; Fri, 22 Dec 2017 02:16:06 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:26 +0800 Message-Id: <1513908937-16034-8-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Dec 2017 02:16:09 +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 07/18] sunhme: switch sunhme over to use net_crc32_le() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland Instead of sunhme_crc32_le() using its own implementation, we can simply ca= ll net_crc32_le() directly and apply the bit shift inline. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/sunhme.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index b1efa1b..7558fca 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -698,29 +698,6 @@ static inline void sunhme_set_rx_ring_nr(SunHMEState *= s, int i) s->erxregs[HME_ERXI_RING >> 2] =3D ring; } =20 -#define POLYNOMIAL_LE 0xedb88320 -static uint32_t sunhme_crc32_le(const uint8_t *p, int len) -{ - uint32_t crc; - int carry, i, j; - uint8_t b; - - crc =3D 0xffffffff; - for (i =3D 0; i < len; i++) { - b =3D *p++; - for (j =3D 0; j < 8; j++) { - carry =3D (crc & 0x1) ^ (b & 0x01); - crc >>=3D 1; - b >>=3D 1; - if (carry) { - crc =3D crc ^ POLYNOMIAL_LE; - } - } - } - - return crc; -} - #define MIN_BUF_SIZE 60 =20 static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf, @@ -761,7 +738,7 @@ static ssize_t sunhme_receive(NetClientState *nc, const= uint8_t *buf, trace_sunhme_rx_filter_bcast_match(); } else if (s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_HENABLE= ) { /* Didn't match local address, check hash filter */ - int mcast_idx =3D sunhme_crc32_le(buf, 6) >> 26; + int mcast_idx =3D net_crc32_le(buf, ETH_ALEN) >> 26; if (!(s->macregs[(HME_MACI_HASHTAB0 >> 2) - (mcast_idx >> 4)] & (1 << (mcast_idx & 0xf)))) { /* Didn't match hash filter */ --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909643962247.75090756202508; Thu, 21 Dec 2017 18:27:23 -0800 (PST) Received: from localhost ([::1]:53736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD3S-0000El-V2 for importer@patchew.org; Thu, 21 Dec 2017 21:27:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsj-0007Zv-7Y for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsg-0000Vb-D8 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsg-0000VD-61 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:14 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A542C058EBC; Fri, 22 Dec 2017 02:16:13 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DBC760C9F; Fri, 22 Dec 2017 02:16:09 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:27 +0800 Message-Id: <1513908937-16034-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Dec 2017 02:16:13 +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 08/18] sungem: fix multicast filter CRC calculation 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 , Mark Cave-Ayland 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: Mark Cave-Ayland From the Linux sungem driver, we know that the multicast filter CRC is implemented using ether_crc_le() which isn't the same as calling zlib's crc32() function (the zlib implementation requires a complemented initial v= alue and also returns the complemented result). Fix the multicast filter by simply using the new net_crc32_le() function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jason Wang --- hw/net/sungem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/net/sungem.c b/hw/net/sungem.c index 6aa8d11..60f1e47 100644 --- a/hw/net/sungem.c +++ b/hw/net/sungem.c @@ -11,12 +11,11 @@ #include "hw/pci/pci.h" #include "qemu/log.h" #include "net/net.h" +#include "net/eth.h" #include "net/checksum.h" #include "hw/net/mii.h" #include "sysemu/sysemu.h" #include "trace.h" -/* For crc32 */ -#include =20 #define TYPE_SUNGEM "sungem" =20 @@ -595,7 +594,7 @@ static ssize_t sungem_receive(NetClientState *nc, const= uint8_t *buf, } =20 /* Get MAC crc */ - mac_crc =3D crc32(~0, buf, 6); + mac_crc =3D net_crc32_le(buf, ETH_ALEN); =20 /* Packet isn't for me ? */ rx_cond =3D sungem_check_rx_mac(s, buf, mac_crc); --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909116554975.2680799789604; Thu, 21 Dec 2017 18:18:36 -0800 (PST) Received: from localhost ([::1]:53484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCux-0000ZN-Gc for importer@patchew.org; Thu, 21 Dec 2017 21:18:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsl-0007bn-6v for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsk-0000Yn-Gm for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsk-0000Y2-C9 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:18 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A0EC4A6E9; Fri, 22 Dec 2017 02:16:17 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CBB860C9F; Fri, 22 Dec 2017 02:16:13 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:28 +0800 Message-Id: <1513908937-16034-10-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Dec 2017 02:16:17 +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 09/18] eepro100: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/eepro100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index e30fed8..a07a632 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1679,7 +1679,7 @@ static ssize_t nic_receive(NetClientState *nc, const = uint8_t * buf, size_t size) rfd_status |=3D 0x0004; } else if (s->configuration[20] & BIT(6)) { /* Multiple IA bit set. */ - unsigned mcast_idx =3D compute_mcast_idx(buf); + unsigned mcast_idx =3D net_crc32(buf, ETH_ALEN) >> 26; assert(mcast_idx < 64); if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { TRACE(RXTX, logout("%p accepted, multiple IA bit set\n", s)); --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909557318282.2599041397797; Thu, 21 Dec 2017 18:25:57 -0800 (PST) Received: from localhost ([::1]:53705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD23-0007UE-C5 for importer@patchew.org; Thu, 21 Dec 2017 21:25:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsp-0007gC-Kq for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCso-0000fD-QA for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39376) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCso-0000dR-Js for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5323C047B72; Fri, 22 Dec 2017 02:16:21 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DB4419694; Fri, 22 Dec 2017 02:16:17 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:29 +0800 Message-Id: <1513908937-16034-11-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 22 Dec 2017 02:16:21 +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 10/18] opencores_eth: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/opencores_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c index 268d6a7..d42b79c 100644 --- a/hw/net/opencores_eth.c +++ b/hw/net/opencores_eth.c @@ -36,6 +36,7 @@ #include "hw/net/mii.h" #include "hw/sysbus.h" #include "net/net.h" +#include "net/eth.h" #include "sysemu/sysemu.h" #include "trace.h" =20 @@ -373,7 +374,7 @@ static ssize_t open_eth_receive(NetClientState *nc, if (memcmp(buf, bcast_addr, sizeof(bcast_addr)) =3D=3D 0) { miss =3D GET_REGBIT(s, MODER, BRO); } else if ((buf[0] & 0x1) || GET_REGBIT(s, MODER, IAM)) { - unsigned mcast_idx =3D compute_mcast_idx(buf); + unsigned mcast_idx =3D net_crc32(buf, ETH_ALEN) >> 26; miss =3D !(s->regs[HASH0 + mcast_idx / 32] & (1 << (mcast_idx % 32))); trace_open_eth_receive_mcast( --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909661339580.1252412069359; Thu, 21 Dec 2017 18:27:41 -0800 (PST) Received: from localhost ([::1]:53742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD3k-0000SB-CV for importer@patchew.org; Thu, 21 Dec 2017 21:27:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsu-0007i7-Ev for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCst-0000kf-IZ for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCst-0000jN-D7 for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:27 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 937ABC00E8F8; Fri, 22 Dec 2017 02:16:26 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5BAA60C9F; Fri, 22 Dec 2017 02:16:22 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:30 +0800 Message-Id: <1513908937-16034-12-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 22 Dec 2017 02:16:26 +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 11/18] lan9118: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/lan9118.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 3db8937..b9032da 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" #include "net/net.h" +#include "net/eth.h" #include "hw/devices.h" #include "sysemu/sysemu.h" #include "hw/ptimer.h" @@ -504,7 +505,7 @@ static int lan9118_filter(lan9118_state *s, const uint8= _t *addr) } } else { /* Hash matching */ - hash =3D compute_mcast_idx(addr); + hash =3D net_crc32(addr, ETH_ALEN) >> 26; if (hash & 0x20) { return (s->mac_hashh >> (hash & 0x1f)) & 1; } else { --=20 2.7.4 From nobody Mon May 6 07:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 151390976406745.66578690970721; Thu, 21 Dec 2017 18:29:24 -0800 (PST) Received: from localhost ([::1]:53838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD57-0001ki-S9 for importer@patchew.org; Thu, 21 Dec 2017 21:29:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCsy-0007jt-FF for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCsx-0000r9-Na for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36044) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCsx-0000po-Hh for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C58A64A6E9; Fri, 22 Dec 2017 02:16:30 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4925119694; Fri, 22 Dec 2017 02:16:26 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:31 +0800 Message-Id: <1513908937-16034-13-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Dec 2017 02:16:30 +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 12/18] ftgmac100: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/ftgmac100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 3c36ab9..704f452 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -762,7 +762,7 @@ static int ftgmac100_filter(FTGMAC100State *s, const ui= nt8_t *buf, size_t len) } =20 /* TODO: this does not seem to work for ftgmac100 */ - mcast_idx =3D compute_mcast_idx(buf); + mcast_idx =3D net_crc32(buf, ETH_ALEN) >> 26; if (!(s->math[mcast_idx / 32] & (1 << (mcast_idx % 32)))) { return 0; } --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909282357749.0341129049051; Thu, 21 Dec 2017 18:21:22 -0800 (PST) Received: from localhost ([::1]:53516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCxd-0002yB-9b for importer@patchew.org; Thu, 21 Dec 2017 21:21:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCt3-0007oJ-0c for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCt1-0000xX-WD for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58368) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCt1-0000wI-PW for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:35 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB60B128B; Fri, 22 Dec 2017 02:16:34 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92AB419694; Fri, 22 Dec 2017 02:16:31 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:32 +0800 Message-Id: <1513908937-16034-14-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 22 Dec 2017 02:16:34 +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 13/18] ne2000: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland 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: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/ne2000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index 6874c8c..687ef84 100644 --- a/hw/net/ne2000.c +++ b/hw/net/ne2000.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "hw/pci/pci.h" +#include "net/net.h" +#include "net/eth.h" #include "ne2000.h" #include "hw/loader.h" #include "sysemu/sysemu.h" @@ -199,7 +201,7 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_= t *buf, size_t size_) /* multicast */ if (!(s->rxcr & 0x08)) return size; - mcast_idx =3D compute_mcast_idx(buf); + mcast_idx =3D net_crc32(buf, ETH_ALEN) >> 26; if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) return size; } else if (s->mem[0] =3D=3D buf[0] && --=20 2.7.4 From nobody Mon May 6 07:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1513909835150590.3305770124998; Thu, 21 Dec 2017 18:30:35 -0800 (PST) Received: from localhost ([::1]:53937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD6M-0002iv-69 for importer@patchew.org; Thu, 21 Dec 2017 21:30:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCt7-0007ry-3M for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCt6-00010p-8C for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35816) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCt6-00010D-1r for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:40 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47257C0587C0; Fri, 22 Dec 2017 02:16:39 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9667C19694; Fri, 22 Dec 2017 02:16:36 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:33 +0800 Message-Id: <1513908937-16034-15-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Dec 2017 02:16:39 +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 14/18] rtl8139: use inline net_crc32() and bitshift instead of compute_mcast_idx() 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 , Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This makes it much easier to compare the multicast CRC calculation endian a= nd bitshift against the Linux driver implementation. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- hw/net/rtl8139.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index a6b2a9f..1cc95b8 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -882,7 +882,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, c= onst uint8_t *buf, size_t return size; } =20 - int mcast_idx =3D compute_mcast_idx(buf); + int mcast_idx =3D net_crc32(buf, ETH_ALEN) >> 26; =20 if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) { --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909905126862.3847410097788; Thu, 21 Dec 2017 18:31:45 -0800 (PST) Received: from localhost ([::1]:53976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD7c-0003Uk-7L for importer@patchew.org; Thu, 21 Dec 2017 21:31:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCtB-0007uY-6g for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCtA-00013l-9s for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39448) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCtA-00013D-3d for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 552EBC047B97; Fri, 22 Dec 2017 02:16:43 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC23A19694; Fri, 22 Dec 2017 02:16:39 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:34 +0800 Message-Id: <1513908937-16034-16-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 22 Dec 2017 02:16:43 +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 15/18] net: remove unused compute_mcast_idx() function 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 , Mark Cave-Ayland 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: Mark Cave-Ayland Now that all of the callers have been converted to compute the multicast in= dex inline using new net CRC functions, this function can now be dropped. Signed-off-by: Mark Cave-Ayland Signed-off-by: Jason Wang --- net/net.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/net.c b/net/net.c index 4ecaf80..5bc0a34 100644 --- a/net/net.c +++ b/net/net.c @@ -1625,11 +1625,6 @@ uint32_t net_crc32_le(const uint8_t *p, int len) return crc; } =20 -unsigned compute_mcast_idx(const uint8_t *ep) -{ - return net_crc32(ep, ETH_ALEN) >> 26; -} - QemuOptsList qemu_netdev_opts =3D { .name =3D "netdev", .implied_opt_name =3D "type", --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909279444158.6563439177761; Thu, 21 Dec 2017 18:21:19 -0800 (PST) Received: from localhost ([::1]:53515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCxa-0002tW-BU for importer@patchew.org; Thu, 21 Dec 2017 21:21:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCtE-0007vY-NG for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCtD-00015z-KD for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43510) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCtD-00015V-BA for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:47 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CB5481DE1; Fri, 22 Dec 2017 02:16:46 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1528E60C9F; Fri, 22 Dec 2017 02:16:43 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:35 +0800 Message-Id: <1513908937-16034-17-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 22 Dec 2017 02:16:46 +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 16/18] net: Remove the legacy "-net channel" parameter 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 It has never been documented, so hardly anybody knows about this parameter, and it is marked as deprecated since QEMU v2.6. Time to let it go now. Reviewed-by: Samuel Thibault Signed-off-by: Thomas Huth Signed-off-by: Jason Wang --- include/net/slirp.h | 2 -- net/net.c | 7 ------- net/slirp.c | 34 ---------------------------------- qemu-doc.texi | 5 ----- 4 files changed, 48 deletions(-) diff --git a/include/net/slirp.h b/include/net/slirp.h index 64b795c..0c98e46 100644 --- a/include/net/slirp.h +++ b/include/net/slirp.h @@ -36,8 +36,6 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict); =20 int net_slirp_redir(const char *redir_str); =20 -int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, in= t *ret); - int net_slirp_smb(const char *exported_dir); =20 void hmp_info_usernet(Monitor *mon, const QDict *qdict); diff --git a/net/net.c b/net/net.c index 5bc0a34..2b81c93 100644 --- a/net/net.c +++ b/net/net.c @@ -1565,13 +1565,6 @@ int net_init_clients(void) =20 int net_client_parse(QemuOptsList *opts_list, const char *optarg) { -#if defined(CONFIG_SLIRP) - int ret; - if (net_slirp_parse_legacy(opts_list, optarg, &ret)) { - return ret; - } -#endif - if (!qemu_opts_parse_noisily(opts_list, optarg, true)) { return -1; } diff --git a/net/slirp.c b/net/slirp.c index 318a26e..cb8ca23 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -956,37 +956,3 @@ int net_init_slirp(const Netdev *netdev, const char *n= ame, =20 return ret; } - -int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, in= t *ret) -{ - if (strcmp(opts_list->name, "net") !=3D 0 || - strncmp(optarg, "channel,", strlen("channel,")) !=3D 0) { - return 0; - } - - error_report("The '-net channel' option is deprecated. " - "Please use '-netdev user,guestfwd=3D...' instead."); - - /* handle legacy -net channel,port:chr */ - optarg +=3D strlen("channel,"); - - if (QTAILQ_EMPTY(&slirp_stacks)) { - struct slirp_config_str *config; - - config =3D g_malloc(sizeof(*config)); - pstrcpy(config->str, sizeof(config->str), optarg); - config->flags =3D SLIRP_CFG_LEGACY; - config->next =3D slirp_configs; - slirp_configs =3D config; - *ret =3D 0; - } else { - Error *err =3D NULL; - *ret =3D slirp_guestfwd(QTAILQ_FIRST(&slirp_stacks), optarg, 1, &e= rr); - if (*ret < 0) { - error_report_err(err); - } - } - - return 1; -} - diff --git a/qemu-doc.texi b/qemu-doc.texi index 90bea73..140659a 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2670,11 +2670,6 @@ The ``-smb /some/dir'' argument is now a synonym for= setting the ``-netdev user,smb=3D/some/dir'' argument instead. The new syntax allows different settings to be provided per NIC. =20 -@subsection -net channel (since 2.6.0) - -The ``--net channel,ARGS'' argument is now a synonym for setting -the ``-netdev user,guestfwd=3DARGS'' argument instead. - @subsection -net vlan (since 2.9.0) =20 The ``-net vlan=3DNN'' argument is partially replaced with the --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909984952152.59480048449586; Thu, 21 Dec 2017 18:33:04 -0800 (PST) Received: from localhost ([::1]:54012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD8w-0004KB-2P for importer@patchew.org; Thu, 21 Dec 2017 21:33:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCtJ-000824-Oc for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCtH-000181-2k for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43518) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCtG-00017Y-SF for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1688C81DF1; Fri, 22 Dec 2017 02:16:50 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58AA45E9C0; Fri, 22 Dec 2017 02:16:46 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:36 +0800 Message-Id: <1513908937-16034-18-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 22 Dec 2017 02:16:50 +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 17/18] qemu-doc: The "-net nic" option can be used with "netdev=...", 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Looks like we missed to document that it is also possible to specify a netdev with "-net nic" - which is very useful if you want to configure your on-board NIC to use a backend that has been specified with "-netdev". Signed-off-by: Thomas Huth Signed-off-by: Jason Wang --- qemu-options.hx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 94647e2..9f4dd3a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2035,9 +2035,10 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev hubport,id=3Dstr,hubid=3Dn\n" " configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_A= LL) DEF("net", HAS_ARG, QEMU_OPTION_net, - "-net nic[,vlan=3Dn][,macaddr=3Dmac][,model=3Dtype][,name=3Dstr][,addr= =3Dstr][,vectors=3Dv]\n" - " old way to create a new NIC and connect it to VLAN 'n= '\n" - " (use the '-device devtype,netdev=3Dstr' option if pos= sible instead)\n" + "-net nic[,vlan=3Dn][,netdev=3Dnd][,macaddr=3Dmac][,model=3Dtype][,nam= e=3Dstr][,addr=3Dstr][,vectors=3Dv]\n" + " configure or create an on-board (or machine default) = NIC and\n" + " connect it either to VLAN 'n' or the netdev 'nd' (for= pluggable\n" + " NICs please use '-device devtype,netdev=3Dnd' instead= )\n" "-net dump[,vlan=3Dn][,file=3Df][,len=3Dn]\n" " dump traffic on vlan 'n' to file 'f' (max n bytes per= packet)\n" "-net none use it alone to have zero network devices. If no -net= option\n" @@ -2058,10 +2059,11 @@ DEF("net", HAS_ARG, QEMU_OPTION_net, " old way to initialize a host network interface\n" " (use the -netdev option if possible instead)\n", QEMU= _ARCH_ALL) STEXI -@item -net nic[,vlan=3D@var{n}][,macaddr=3D@var{mac}][,model=3D@var{type}]= [,name=3D@var{name}][,addr=3D@var{addr}][,vectors=3D@var{v}] +@item -net nic[,vlan=3D@var{n}][,netdev=3D@var{nd}][,macaddr=3D@var{mac}][= ,model=3D@var{type}] [,name=3D@var{name}][,addr=3D@var{addr}][,vectors=3D@v= ar{v}] @findex -net -Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} -=3D 0 is the default). The NIC is an e1000 by default on the PC +Configure or create an on-board (or machine default) Network Interface Card +(NIC) and connect it either to VLAN @var{n} (@var{n} =3D 0 is the default)= , or +to the netdev @var{nd}. The NIC is an e1000 by default on the PC target. Optionally, the MAC address can be changed to @var{mac}, the device address set to @var{addr} (PCI cards only), and a @var{name} can be assigned for use in monitor commands. --=20 2.7.4 From nobody Mon May 6 07:10:11 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 1513909443106277.6452322684246; Thu, 21 Dec 2017 18:24:03 -0800 (PST) Received: from localhost ([::1]:53573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSD0D-0005Uv-U3 for importer@patchew.org; Thu, 21 Dec 2017 21:24:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSCtM-00084c-7f for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSCtL-0001AV-4B for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSCtK-00019x-Tz for qemu-devel@nongnu.org; Thu, 21 Dec 2017 21:16:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26DE681DE1; Fri, 22 Dec 2017 02:16:54 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-132.pek2.redhat.com [10.72.12.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0FFE19694; Fri, 22 Dec 2017 02:16:50 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 10:15:37 +0800 Message-Id: <1513908937-16034-19-git-send-email-jasowang@redhat.com> In-Reply-To: <1513908937-16034-1-git-send-email-jasowang@redhat.com> References: <1513908937-16034-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 22 Dec 2017 02:16:54 +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 18/18] qemu-doc: Update the deprecation information of -tftp, -bootp, -redir and -smb 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 The information how to update the deprecated parameters was too scarce, so that some people did not update to the new syntax yet. Provide some more information to make sure that it is clear how to update from the old syntax to the new one. Signed-off-by: Thomas Huth Signed-off-by: Jason Wang --- qemu-doc.texi | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 140659a..ae90f71 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2648,27 +2648,36 @@ combined with ``-vnc tls-creds=3Dtls0' =20 @subsection -tftp (since 2.6.0) =20 -The ``-tftp /some/dir'' argument is now a synonym for setting -the ``-netdev user,tftp=3D/some/dir' argument. The new syntax -allows different settings to be provided per NIC. +The ``-tftp /some/dir'' argument is replaced by +``-netdev user,id=3Dx,tftp=3D/some/dir'', either accompanied with +``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +(for embedded NICs). The new syntax allows different settings to be +provided per NIC. =20 @subsection -bootp (since 2.6.0) =20 -The ``-bootp /some/file'' argument is now a synonym for setting -the ``-netdev user,bootp=3D/some/file' argument. The new syntax -allows different settings to be provided per NIC. +The ``-bootp /some/file'' argument is replaced by +``-netdev user,id=3Dx,bootp=3D/some/file'', either accompanied with +``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +(for embedded NICs). The new syntax allows different settings to be +provided per NIC. =20 @subsection -redir (since 2.6.0) =20 -The ``-redir ARGS'' argument is now a synonym for setting -the ``-netdev user,hostfwd=3DARGS'' argument instead. The new -syntax allows different settings to be provided per NIC. +The ``-redir [tcp|udp]:hostport:[guestaddr]:guestport'' argument is +replaced by ``-netdev +user,id=3Dx,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport'= ', +either accompanied with ``-device ...,netdev=3Dx'' (for pluggable NICs) or +``-net nic,netdev=3Dx'' (for embedded NICs). The new syntax allows differe= nt +settings to be provided per NIC. =20 @subsection -smb (since 2.6.0) =20 -The ``-smb /some/dir'' argument is now a synonym for setting -the ``-netdev user,smb=3D/some/dir'' argument instead. The new -syntax allows different settings to be provided per NIC. +The ``-smb /some/dir'' argument is replaced by +``-netdev user,id=3Dx,smb=3D/some/dir'', either accompanied with +``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +(for embedded NICs). The new syntax allows different settings to be +provided per NIC. =20 @subsection -net vlan (since 2.9.0) =20 --=20 2.7.4