From nobody Fri Aug 04 01:11:41 2023 X-Original-To: dev-commits-src-all@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 4RH7320CsqzZWxg; Fri, 4 Aug 2023 01:11:42 +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 4RH7316dPsz4X2d; Fri, 4 Aug 2023 01:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691111501; 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=JLMr1DNsUylg8Fzdqs1HZ2krt9spYhbUOo6GakaTQn0=; b=nw6p6TxK0aw/faJgrfNvtF67owyZK5Z3NzaI6LET+58t0goUckv5X2mPt5oeXZhjgQ2yA6 rG6k8yvEUIC4lSAuCJLrvH02s1zPqRpgVwK+wAc17JjSkFswRj+DPXCWR1XMxQWJ5SZPU9 yypy4V9vYIexnk4Dtgz8UscfFygpXMdLiRgYnV/mKsMuK72a+oUah3g8r74jJ1D2cQIvJD GO8d62gHgsnqHV+s26pEc0kPye7Om6QpYNz92hhb9sjOPL2m/e+XoKvB4gEaJhDKBqdTq6 BoRi4MXXAoSS+XbwJQDJjYFjdXBoZsqKps3VGlGd4Hc0nPqyned5+kB2go7ASg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691111501; 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=JLMr1DNsUylg8Fzdqs1HZ2krt9spYhbUOo6GakaTQn0=; b=DUQ/P3qHgeGwF9+6wRyaq43P/DL6pBaRuW/bqR0VKkbE21dRdHBIsfBuUHszo9P8CBJ61a anasrftGGLxTI91d5iruwHc8s06TnSUpoHTKrLljs5Ny6EZ0uWnaX9aokhHiPBYOHvL2F9 llmeI1aQqFPmZBBVFPgJiMReUp7u2sxFRr1/KdgTNHjBdo5CZuJ3FA9/VN9wHLTSSpLb0X zZoiBgdEh7YU4Fc9wmfCH6WUuyeRdgFn+3RMVkZxPfbDJdXpOBN72vAyvJz6g3VFPus2Vt bzLPkzVArzW3b4t4OdUTgFrHB9m3aXl4FYtjwyCVJofWJsYEBYcFmTzE84WU2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691111501; a=rsa-sha256; cv=none; b=Ypa5RyWbu5Yom/PYQl3ZjpFSIJMpDZfTU0DtMMSNq2Cfpbtdf6OB/nozpkc8wiCmlpTsjW L3AjZsVBXoo49IYFwgbkHVKFGJ94CHqi3buHSlkXyD23PozQBovlPNx1Plof6yDFaY+mm0 QwSffiBRzj+NEv9rCmyZiTZ/9zs9DxBG+czd/IQLsBt9pfh7G8Dmo9w2sToBg2E0CF31MH FEhMVGK622aPAlrhjHHBvCLF4yR9UIqLTq2O+OyKdhkGfZNxYIuwSsICEKeT1CSWjktxwW Gd0RWev+tU3jt1OuEgBLVqC9+Mp8cdv9b8pWy+Aa1ZwUGSKvGHbQjkke9wjpMw== 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 4RH7315MVYzjmC; Fri, 4 Aug 2023 01:11:41 +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 3741BfKW002820; Fri, 4 Aug 2023 01:11:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3741BfWh002819; Fri, 4 Aug 2023 01:11:41 GMT (envelope-from git) Date: Fri, 4 Aug 2023 01:11:41 GMT Message-Id: <202308040111.3741BfWh002819@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: bd07d5c45199 - stable/13 - e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: bd07d5c451995353cbf1d86f97c5264232ea401b Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=bd07d5c451995353cbf1d86f97c5264232ea401b commit bd07d5c451995353cbf1d86f97c5264232ea401b Author: Kevin Bowling AuthorDate: 2023-07-21 03:30:00 +0000 Commit: Kevin Bowling CommitDate: 2023-08-04 01:11:30 +0000 e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes * em(4) obey administrative ifcaps for using hwcsum offload * em(4) obey administrative ifcaps for hw vlan receive tagging * em(4) add additional TSO6 ifcap, but disabled by default as is TSO4 * lem(4) obey administrative ifcaps for using hwcsum offload * lem(4) add support for hw vlan receive tagging * lem(4) Add ifcaps for TSO offload experimentation, but disabled by default due to errata and possibly missing txrx code. * lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around full duplex links. It may still be administratively enabled. Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D30072 (cherry picked from commit 95f7b36e8fac45092b9a4eea5e32732e979989f0) --- sys/dev/e1000/em_txrx.c | 15 ++++++++------- sys/dev/e1000/if_em.c | 48 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index 47f9b187aa14..069a1c00a4b2 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -674,12 +674,12 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) i++; } while (!eop); - /* XXX add a faster way to look this up */ - if (sc->hw.mac.type >= e1000_82543) + if (scctx->isc_capenable & IFCAP_RXCSUM) em_receive_checksum(status, errors, ri); - if (status & E1000_RXD_STAT_VP) { - ri->iri_vtag = le16toh(rxd->special); + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && + status & E1000_RXD_STAT_VP) { + ri->iri_vtag = le16toh(rxd->special & E1000_RXD_SPC_VLAN_MASK); ri->iri_flags |= M_VLANTAG; } @@ -699,11 +699,11 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) uint16_t len; uint32_t pkt_info; - uint32_t staterr = 0; + uint32_t staterr; bool eop; int i, cidx; - i = 0; + staterr = i = 0; cidx = ri->iri_cidx; do { @@ -739,7 +739,8 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if (scctx->isc_capenable & IFCAP_RXCSUM) em_receive_checksum(staterr, staterr >> 24, ri); - if (staterr & E1000_RXD_STAT_VP) { + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && + staterr & E1000_RXD_STAT_VP) { ri->iri_vtag = le16toh(rxd->wb.upper.vlan); ri->iri_flags |= M_VLANTAG; } diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 09a063191107..1338206e5ed0 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -783,19 +783,21 @@ em_set_num_queues(if_ctx_t ctx) return (maxqueues); } -#define LEM_CAPS \ - IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ - IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER - -#define EM_CAPS \ - IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ - IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ - IFCAP_LRO | IFCAP_VLAN_HWTSO - -#define IGB_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 |\ +#define LEM_CAPS \ + IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ + IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ + IFCAP_LRO | IFCAP_JUMBO_MTU + +#define EM_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 + +#define IGB_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 /********************************************************************* @@ -899,7 +901,7 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_tx_tso_segsize_max = EM_TSO_SEG_SIZE; scctx->isc_capabilities = scctx->isc_capenable = EM_CAPS; /* - * For EM-class devices, don't enable IFCAP_{TSO4,VLAN_HWTSO} + * For EM-class devices, don't enable IFCAP_{TSO4,VLAN_HWTSO,TSO6} * by default as we don't have workarounds for all associated * silicon errata. E. g., with several MACs such as 82573E, * TSO only works at Gigabit speed and otherwise can cause the @@ -914,8 +916,9 @@ em_if_attach_pre(if_ctx_t ctx) * work for a few MACs of this class - at least when sticking * with Gigabit - in which case users may enable TSO manually. */ - scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO); - scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO; + scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO | IFCAP_TSO6); + scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO | + CSUM_IP6_TCP | CSUM_IP6_UDP; /* * We support MSI-X with 82574 only, but indicate to iflib(4) * that it shall give MSI at least a try with other devices. @@ -934,6 +937,19 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP; scctx->isc_txrx = &lem_txrx; scctx->isc_capabilities = LEM_CAPS; + + /* + * 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); + + /* 8254x SDM4.0 page 33 - FDX requirement on these chips */ + if (hw->mac.type == e1000_82547 || hw->mac.type == e1000_82547_rev_2) + scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); + if (hw->mac.type < e1000_82543) scctx->isc_capabilities &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); /* 82541ER doesn't do HW tagging */