From nobody Mon Aug 7 14:36:00 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RKJlh44bPz4pjml; Mon, 7 Aug 2023 14:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RKJlh3dyJz4QJw; Mon, 7 Aug 2023 14:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691418960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=szkqcWq3iI9WjPmsIX7ENC68YOIrzlGPcLLIAdjCBdk=; b=coOoPF3weWw/8XwDi2ezGjVQ7LkIpCrGYF+P/cm1+hdDjTxxlgYfVK9G1Sk0AsN8YwyAz1 YbvxjrGseDf1eY2muLLG7aHlcG6uWedLaWi2+EXBADYyYoYDE6Ur5TzwcoXLkzySlIRzzL LdTwV1AzO3c/Tc/Brj4XUeTKox74WTK3Ki9vnbVDwIgCR2AWcgEIA+2R0pKPjYL/FgBy1x +2pozc/JSHLM6Z8spo8CVjmDO5pstEqqnfDebI8zyomSYY/+iW+2PsgD07GrwtKfDZB0iO FUmkY0BZwth4xnXdGvTnhDZ+c4kqUvcNiWLlHLxbVhDP5JgNNr7ZJMciMxAgXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691418960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=szkqcWq3iI9WjPmsIX7ENC68YOIrzlGPcLLIAdjCBdk=; b=CYL3772ZH3tOaaAa0IvYpCgMQvlnMS7mu43YSVOLPqfUx2effy2aweRjFIdvPK2HqZ+a/6 CZGJV7QrMv+UeErI/7oWP9vHROrXVBKJ6Y8CMJqGjZOxUfvfl9Pn4dpOX75fgODPPvAgNa oPijfETWbcWrFIKP49YQnrRbZ0twm6bwmeRH9ajeTjfWIT9HN35fCR+o5Q9CR2Raf0mc73 C61Fs+MQ8OZZSCqeXN+n1yN+p3QpP7zUhXeRM/OQE+of3Kg41coa4CaRcIOq9+h/9+OPcH WxYahg8xChdpVqRMB8GCYt/3sNxtTH7rYZB8YFCtrRbkujHWnYcUTPm2ipqx2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691418960; a=rsa-sha256; cv=none; b=C7RUcFsnE+eKVA7RdifoiGZMf67HkdKnjNU7EeXTOtpupfgWGdNFMKbZF8OlxV7XS33N65 J0+LkU0OiKfRRwK74SyVBEARZ0BpiqMlkADuEM3cwy+SryGYfuby/1nqQqmS4WUdywK92j MOVoDIy1azmJionS7GQrHbnuHzGNmutyGnDoH0cxY7RlHHJ2SR+ZqKB8qJNMGCJgDtSyc7 UWO6gziHsXFbtPShY7hu+W3DeMfO78INJK7FIkwXLIY71OB+Jvjlf2lML7jcNOzIo+oPY6 hiR90ofYSEFGkCywvgT0r6Y7Ofl4+azW4CxihTmQiv44TaunrR3D9DzOCdNKZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RKJlh2jw6zw0L; Mon, 7 Aug 2023 14:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 377Ea0PS043321; Mon, 7 Aug 2023 14:36:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 377Ea02j043320; Mon, 7 Aug 2023 14:36:00 GMT (envelope-from git) Date: Mon, 7 Aug 2023 14:36:00 GMT Message-Id: <202308071436.377Ea02j043320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: e9cd4a8fee58 - stable/13 - e1000: Fix lem(4)/em(4) TSO6 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e9cd4a8fee5848adb7ba3dba70d3ad1db969263d Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e9cd4a8fee5848adb7ba3dba70d3ad1db969263d commit e9cd4a8fee5848adb7ba3dba70d3ad1db969263d Author: Kevin Bowling AuthorDate: 2023-07-31 15:16:24 +0000 Commit: Kevin Bowling CommitDate: 2023-08-07 14:35:51 +0000 e1000: Fix lem(4)/em(4) TSO6 * Fix TSO6 by specializing IP checksum insertion and following Intel SDM values for IPv6. * Remove unnecessary 82544 IP-bit handling * Remove TSO6 from lem(4) capabilitities Reviewed by: erj (earlier version) Differential Revision: https://reviews.freebsd.org/D41170 (cherry picked from commit e1353dcb63bbdb33be6a907ed6236c120518129e) --- sys/dev/e1000/em_txrx.c | 40 ++++++++++++++++++++++++---------------- sys/dev/e1000/if_em.c | 9 ++++----- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index 0e433f388ac5..b90ab21cd825 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -141,7 +141,6 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, uint32_t *txd_upper, if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; - struct e1000_hw *hw = &sc->hw; struct e1000_context_desc *TXD; int cur, hdr_len; uint32_t cmd_type_len; @@ -151,27 +150,39 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, uint32_t *txd_upper, E1000_TXD_DTYP_D | /* Data descr type */ E1000_TXD_CMD_TSE); /* Do TSE on this packet */ - /* IP and/or TCP header checksum calculation and insertion. */ - *txd_upper = (E1000_TXD_POPTS_IXSM | E1000_TXD_POPTS_TXSM) << 8; - cur = pi->ipi_pidx; TXD = (struct e1000_context_desc *)&txr->tx_base[cur]; /* - * Start offset for header checksum calculation. - * End offset for header checksum calculation. - * Offset of place put the checksum. + * ipcss - Start offset for header checksum calculation. + * ipcse - End offset for header checksum calculation. + * ipcso - Offset of place to put the checksum. */ + switch(pi->ipi_etype) { + case ETHERTYPE_IP: + /* IP and/or TCP header checksum calculation and insertion. */ + *txd_upper = (E1000_TXD_POPTS_IXSM | E1000_TXD_POPTS_TXSM) << 8; + + TXD->lower_setup.ip_fields.ipcse = + htole16(pi->ipi_ehdrlen + pi->ipi_ip_hlen - 1); + break; + case ETHERTYPE_IPV6: + /* TCP header checksum calculation and insertion. */ + *txd_upper = E1000_TXD_POPTS_TXSM << 8; + + TXD->lower_setup.ip_fields.ipcse = htole16(0); + break; + default: + break; + } TXD->lower_setup.ip_fields.ipcss = pi->ipi_ehdrlen; - TXD->lower_setup.ip_fields.ipcse = - htole16(pi->ipi_ehdrlen + pi->ipi_ip_hlen - 1); TXD->lower_setup.ip_fields.ipcso = pi->ipi_ehdrlen + offsetof(struct ip, ip_sum); /* - * Start offset for payload checksum calculation. - * End offset for payload checksum calculation. - * Offset of place to put the checksum. + * tucss - Start offset for payload checksum calculation. + * tucse - End offset for payload checksum calculation. + * tucso - Offset of place to put the checksum. */ TXD->upper_setup.tcp_fields.tucss = pi->ipi_ehdrlen + pi->ipi_ip_hlen; TXD->upper_setup.tcp_fields.tucse = 0; @@ -188,16 +199,13 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, uint32_t *txd_upper, /* * "PCI/PCI-X SDM 4.0" page 45, and "PCIe GbE SDM 2.5" page 63 * - Set up basic TUCMDs - * - Enable IP bit on 82544 * - For others IP bit on indicates IPv4, while off indicates IPv6 */ cmd_type_len = sc->txd_cmd | E1000_TXD_CMD_DEXT | /* Extended descr */ E1000_TXD_CMD_TSE | /* TSE context */ E1000_TXD_CMD_TCP; /* Do TCP checksum */ - if (hw->mac.type == e1000_82544) - cmd_type_len |= E1000_TXD_CMD_IP; - else if (pi->ipi_etype == ETHERTYPE_IP) + if (pi->ipi_etype == ETHERTYPE_IP) cmd_type_len |= E1000_TXD_CMD_IP; TXD->cmd_and_length = htole32(cmd_type_len | (pi->ipi_len - hdr_len)); /* Total len */ diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index ad1780e03fc5..88738e5f0a08 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -786,8 +786,7 @@ em_set_num_queues(if_ctx_t ctx) #define LEM_CAPS \ IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ - IFCAP_LRO | IFCAP_VLAN_HWTSO| IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 | \ - IFCAP_TSO6 + IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 #define EM_CAPS \ IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ @@ -939,14 +938,14 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_tx_tso_segments_max = EM_MAX_SCATTER; scctx->isc_tx_tso_size_max = EM_TSO_SIZE; scctx->isc_tx_tso_segsize_max = EM_TSO_SEG_SIZE; - scctx->isc_capabilities = scctx->isc_capenable = EM_CAPS; + scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; /* - * For LEM-class devices, don't enable IFCAP_{TSO4,VLAN_HWTSO,TSO6} + * For LEM-class devices, don't enable IFCAP_{TSO4,VLAN_HWTSO} * by default as we don't have workarounds for all associated * silicon errata. TSO4 may work on > 82544 but its status * is unknown by the authors. Please report any success or failures. */ - scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO | IFCAP_TSO6); + scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO); scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO | CSUM_IP6_TCP | CSUM_IP6_UDP;