From nobody Sat Aug 8 15:57:53 2026 X-Original-To: dev-commits-src-main@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 4hHQds724cz6nrqk for ; Sat, 08 Aug 2026 15:57:53 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hHQds65Fkz3pPW for ; Sat, 08 Aug 2026 15:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786204673; 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=jMx4dD3+THf4CyL7eIDA3JvKohOCcdne5x9vCmxGFnw=; b=mVPK9LNNZIOMRBKO+6toGVDh/qSuYje2HBe2URVZRiKvNMPhykSvwWuysjPQF+dYWcxp75 X6PROq392O7vH3eAewu0Q+7vGdq2ehR//841da89Fikn92diSR5lzy4XXP5iRO6XCIAGoy PzCCDN3vLpZ7eY4JanCIDxEe3iUX4SDLajaJnlzpSsrIdqtRR4BuVGNio8lr6sHUYzlWlh fdGduE5pO7JgsVH2TV7LNm5+X9fnpurmuh5aXSvtlb3oMX65XtsCmRc2KljWoFdoyuS41i Ovig/xjnrmE65AQuRAA/9te6q13kp2TOZo9G7rwmquhsLXIlsykf50MLRBpAEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786204673; a=rsa-sha256; cv=none; b=bBo2ysmX5Q2x55aDh3OYi2zAxeFRp3Y50fMDiMv1peIWKkcER9dKHJ5xyB8xOVf8YEyPxo Aba0hBoY2JXH3sWYQRNzh2GXEYIP08qdTYDO5SKlXEMFipnu2QyMTJlWFJsgW3uwlHtZ9M aq2Sv/WMh92hQPUGA2N9uvSQVNqOQZH85Yq2j7Vhd4b0wpOJBCsx+kvFgINacjDpBVuwMw 8EYw2JgNU7xTk6q/7ehYtMlr7exuCr+09B1sy1GCZeOkSrMgiz7U7lqXLAtfr3EIo7Do6V EiPD5Maui7lSf9fqoeXLNp8uJzeBiV3BdZYtiizrUyJRbIxdz/BsVImlzNCKoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786204673; 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=jMx4dD3+THf4CyL7eIDA3JvKohOCcdne5x9vCmxGFnw=; b=FJOjthUdUTV5sIlvTWOdEqUg7ljNhJDTJdZZ9F0PBvkSMPP8jCd0nEUnbT6xVT1FdC95oy wvJcRJ2zMZI+7bmW7MW+CG2uoEi3mFTiUjkCMI6D0fKNlcr4lShPMD03prU8ZIMO3cy1SR RwFb/vroZq/RIV9MFlfYpuQI9NngAl9pyQ9g07ObDkV2Npaw2JJBa+Wq0Lzrwmi2tuNp7R xWGU1JZP0FJlaGS+8qa89O/ooPQS8ObGvQpq/S/KJci8JxZ8SMrhosR7xqWeDYgTHoRbFT lXQHjwAGQUJt/kGC8NL7W4zdu6SHviDjgIa6iHT2llznxhzUwJq3jFOrbjxUoA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hHQds4cwrzk6W for ; Sat, 08 Aug 2026 15:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 303c9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 08 Aug 2026 15:57:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 66baeec9f8a4 - main - e1000: Program Tx descriptor control by family List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/main X-Git-Reftype: branch X-Git-Commit: 66baeec9f8a4c4b1609d255b62e3572e0618747f Auto-Submitted: auto-generated Date: Sat, 08 Aug 2026 15:57:53 +0000 Message-Id: <6a775201.303c9.3554c0ce@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=66baeec9f8a4c4b1609d255b62e3572e0618747f commit 66baeec9f8a4c4b1609d255b62e3572e0618747f Author: Kevin Bowling AuthorDate: 2026-08-08 11:48:43 +0000 Commit: Kevin Bowling CommitDate: 2026-08-08 15:29:05 +0000 e1000: Program Tx descriptor control by family TXDCTL programming is family dependent. 82543 erratum 35 and 82544 erratum 20 require WTHRESH to remain zero; a nonzero value can corrupt descriptor writebacks and hang the controller. Leave all descriptor-control thresholds at their reset values on 82542, 82543, and 82544. On the remaining em controllers, retain the established PTHRESH=31, HTHRESH=1, WTHRESH=1, and descriptor granularity policy. Several legacy specification updates identify full descriptor writeback as a workaround for transmit descriptor-queue errata. TXDCTL bit 22 is also family dependent. It is COUNT_DESC on the 82571 family and 80003ES2LAN. Intel shared initialization explicitly sets raw bit 22 on both transmit queues of every supported ICH/PCH generation, although the integrated public documentation marks it reserved. Preserve that required setting when iflib programs the thresholds, as DPDK does. Clearing it caused a persistent I219 transmit stall under descriptor pressure. The combined em/igb setup also wrote LWTHRESH=1 on every em controller. The driver does not enable the TXD_LOW interrupt controlled by that field. Enumerate every supported em MAC type and leave the unused low-water threshold disabled. This keeps the legacy descriptor-writeback safety policies separate from igb sparse-RS operation while programming only the fields appropriate to each family. MFC after: 2 weeks --- sys/dev/e1000/if_em.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++----- sys/dev/e1000/if_em.h | 3 ++ 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 6ef36eb579b6..e7bc457ed1bd 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -4137,6 +4137,74 @@ em_if_queues_free(if_ctx_t ctx) } } +static u32 +em_legacy_txdctl(struct e1000_hw *hw) +{ + u32 txdctl; + + /* + * Start with the established full-descriptor writeback policy. + * Several generations have descriptor-queue errata for which it is + * a documented workaround. The unsafe early controllers are + * overridden below. + */ + txdctl = EM_TX_PTHRESH | (EM_TX_HTHRESH << 8) | + (EM_TX_WTHRESH << 16) | E1000_TXDCTL_GRAN; + + switch (hw->mac.type) { + case e1000_82571: + case e1000_82572: + case e1000_82573: + case e1000_82574: + case e1000_82583: + case e1000_80003es2lan: + /* Match the Intel shared-code policy for these families. */ + txdctl |= E1000_TXDCTL_COUNT_DESC; + break; + case e1000_ich8lan: + case e1000_ich9lan: + case e1000_ich10lan: + case e1000_pchlan: + case e1000_pch2lan: + case e1000_pch_lpt: + case e1000_pch_spt: + case e1000_pch_cnp: + case e1000_pch_tgp: + case e1000_pch_adp: + case e1000_pch_mtp: + case e1000_pch_ptp: + /* Preserve the required bit set by the integrated shared code. */ + txdctl |= (1U << 22); + break; + case e1000_82542: + case e1000_82543: + case e1000_82544: + /* + * 82543 erratum 35 and 82544 erratum 20 require + * WTHRESH=0. Leave all descriptor-control thresholds at + * their reset values on these early controllers. + */ + txdctl = 0; + break; + case e1000_82540: + case e1000_82545: + case e1000_82545_rev_3: + case e1000_82546: + case e1000_82546_rev_3: + case e1000_82541: + case e1000_82541_rev_2: + case e1000_82547: + case e1000_82547_rev_2: + break; + default: + KASSERT(0, ("%s: unsupported MAC type %d", __func__, + hw->mac.type)); + break; + } + + return (txdctl); +} + /********************************************************************* * * Enable transmit unit. @@ -4187,16 +4255,15 @@ em_initialize_transmit_rings(if_ctx_t ctx) E1000_READ_REG(hw, E1000_TDBAL(qid)), E1000_READ_REG(hw, E1000_TDLEN(qid))); - txdctl = 0; /* clear txdctl */ - txdctl |= 0x1f; /* PTHRESH */ - txdctl |= 1 << 8; /* HTHRESH */ - txdctl |= 1 << 16;/* WTHRESH */ if (hw->mac.type < igb_mac_min) { - txdctl |= 1 << 22; /* Reserved bit must always be 1 */ - txdctl |= E1000_TXDCTL_GRAN; - txdctl |= 1 << 25; /* LWTHRESH */ - } else + txdctl = em_legacy_txdctl(hw); + } else { + txdctl = 0; + txdctl |= 0x1f; /* PTHRESH */ + txdctl |= 1 << 8; /* HTHRESH */ + txdctl |= 1 << 16; /* WTHRESH */ txdctl |= E1000_TXDCTL_QUEUE_ENABLE; + } E1000_WRITE_REG(hw, E1000_TXDCTL(qid), txdctl); } diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 6d3f312715d4..5f53f4074fcf 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -296,6 +296,9 @@ struct igb_vf_mac_filter; #define PCICFG_DESC_RING_STATUS 0xe4 #define FLUSH_DESC_REQUIRED 0x100 +#define EM_TX_PTHRESH 31 +#define EM_TX_HTHRESH 1 +#define EM_TX_WTHRESH 1 #define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ ((hw->mac.type <= e1000_82576) ? 16 : 8))