From nobody Sat Aug 8 15:57:54 2026 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 4hHQdv19wFz6nrly for ; Sat, 08 Aug 2026 15:57:55 +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 4hHQdt6hbtz3pS0 for ; Sat, 08 Aug 2026 15:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786204674; 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=IHQHjzuS8f043oqgR6ICkPQb4ifOeJhz9ZOG6uTXjAg=; b=k0KZc+Lh9e4afUrKLrPXHI7TbEqBwPINI3Hc707WzK0hFJsdxDuzNQLdo9G4pOxG68dT/b XpKxt8JVVxAVOsc/8/dz9mR6XZWZjVjcG6O5g9c2gZOR41Xl1EJNxQGnMm3DDHj5HG0Vk+ eQFoSB6UDmlo46hdcvixpvEcoUtlyE/vCtJot6xJoU6U+36e2iYfalaEQrtJLqzQsJfQdE M9y+E+gFzjCV5UGLhlHtf1EqRsnx+KYiGUOFox4kCYzww+peTqRuSA2mFGzSG9hUPMHST/ 5d0D1u+Na3UAfrJPfwUafa2eVQQdb9xmQ5wewfBS4M36uHLIZ85ssb8Qj8PeGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786204674; a=rsa-sha256; cv=none; b=wr9pxS6E20NSR/ci2cOSxYvF6bOb+cZEjAeqrdVf8O4HXHTdTR6YQnwOdVyiXpGEKjipCq WpVD9Uq8TYj4ahVL1P61h1k5eaCgZtC9v0A7oYYMvGFQe44D/33+zHHMF2eMbNteJkoz2f 52hB+awneMA4c34yHzywLgrmEvr3EciNOJrRwP+CMzvjytLOhPSqeRUI6p6KEKjIEos29B 95fwOw8jmVh2/ZIB7zlA/uyHP9CIvWBIYYVjCwFWE4sbEY5NRS2opThAtZCIB5fxOeLDX7 Q/QBF2EJFq3K8AxDPWPMSu8pyLzHK45e3u18NbJJN6sVodZ2MfMVrJciJev6BQ== 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=1786204674; 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=IHQHjzuS8f043oqgR6ICkPQb4ifOeJhz9ZOG6uTXjAg=; b=Xn7EulazHefOllSo5bJct3CdVZy9UNBU99SKGb70rIS5PqjgsM9mZz3L3HmNVTjI+LboUF uGBl7/MWVFfFKlKAuEVStN6q0KA4Xe/EgeRyDTUGlLNjXTU3Dd2laYRg8FtpANVD8oQhiP TNfQO1blARtriz4yjmPN5qnDBxz7qoMDDS6H2ZWstoGUttL2UIa74Zfzbi04C/79yl4Uj6 3efxBOO0ioNELatVuivXRcsS2aB7zxY4/xs76VVR+hHoqaP8cBn5l1rwwxvt1w4O++9K6g NZqOAsFvUl2nQa10dwS0vLovS/iM5vNGFyOqT1c6jMcFLaBH9OX+AkRX4MsYVA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hHQdt5TdxzkRH for ; Sat, 08 Aug 2026 15:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31224 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 08 Aug 2026 15:57:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: abe22383f1b1 - main - e1000: Correct Rx descriptor threshold programming 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: abe22383f1b144f0868aa0654ec4514d36f7a4f5 Auto-Submitted: auto-generated Date: Sat, 08 Aug 2026 15:57:54 +0000 Message-Id: <6a775202.31224.5fa04768@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=abe22383f1b144f0868aa0654ec4514d36f7a4f5 commit abe22383f1b144f0868aa0654ec4514d36f7a4f5 Author: Kevin Bowling AuthorDate: 2026-08-08 12:26:23 +0000 Commit: Kevin Bowling CommitDate: 2026-08-08 15:37:01 +0000 e1000: Correct Rx descriptor threshold programming Jumbo receive tuning on integrated controllers enabled PTHRESH without a nonzero HTHRESH, contrary to the hardware programming requirements. It also covered only the integrated MAC generations present when the workaround was added. Enumerate every jumbo-capable ICH and PCH type and program PTHRESH=3 with HTHRESH=1. Linux fixed the same HTHRESH omission in b701cacdbcfb. The 82574 path combined threshold values with the reset values using bitwise OR. Requesting WTHRESH=4 while the reset value was one thus programmed five. Clear the complete threshold fields before installing the established PTHRESH=32, HTHRESH=4, WTHRESH=4 descriptor-granularity policy. MFC after: 2 weeks --- sys/dev/e1000/if_em.c | 50 ++++++++++++++++++++++++++++++++++++-------------- sys/dev/e1000/if_em.h | 13 +++++++++++++ 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index e7bc457ed1bd..b14087f2c88c 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -4419,6 +4419,27 @@ igb_initialize_receive_rings(if_ctx_t ctx, bool drop) } } +static bool +em_integrated_jumbo_rx(struct e1000_hw *hw) +{ + switch (hw->mac.type) { + 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: + return (true); + default: + return (false); + } +} + static void em_initialize_receive_unit(if_ctx_t ctx) { @@ -4562,24 +4583,25 @@ em_initialize_receive_unit(if_ctx_t ctx) E1000_WRITE_REG(hw, E1000_RDT(qid), 0); } - /* - * Set PTHRESH for improved jumbo performance - * According to 10.2.5.11 of Intel 82574 Datasheet, - * RXDCTL(1) is written whenever RXDCTL(0) is written. - * Only write to RXDCTL(1) if there is a need for different - * settings. - */ - if ((hw->mac.type == e1000_ich9lan || hw->mac.type == e1000_pch2lan || - hw->mac.type == e1000_ich10lan) && if_getmtu(ifp) > ETHERMTU) { + /* Increase receive-descriptor prefetching for integrated jumbo MACs. */ + if (em_integrated_jumbo_rx(hw) && if_getmtu(ifp) > ETHERMTU) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); - E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); + + rxdctl &= ~(EM_RXDCTL_PTHRESH_MASK | + EM_RXDCTL_HTHRESH_MASK); + rxdctl |= EM_JUMBO_RX_PTHRESH | + (EM_JUMBO_RX_HTHRESH << 8); + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl); } else if (hw->mac.type == e1000_82574) { + /* RXDCTL(0) writes are mirrored to RXDCTL(1) on 82574. */ for (int i = 0; i < sc->rx_num_queues; i++) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i)); - rxdctl |= 0x20; /* PTHRESH */ - rxdctl |= 4 << 8; /* HTHRESH */ - rxdctl |= 4 << 16;/* WTHRESH */ - rxdctl |= 1 << 24; /* Switch to granularity */ + + rxdctl &= ~EM_RXDCTL_THRESH_MASK; + rxdctl |= EM_82574_RX_PTHRESH | + (EM_82574_RX_HTHRESH << 8) | + (EM_82574_RX_WTHRESH << 16) | + E1000_RXDCTL_THRESH_UNIT_DESC; E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); } } else if (hw->mac.type >= igb_mac_min) { diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 5f53f4074fcf..99d4e9d02309 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -300,6 +300,19 @@ struct igb_vf_mac_filter; #define EM_TX_HTHRESH 1 #define EM_TX_WTHRESH 1 +#define EM_RXDCTL_PTHRESH_MASK 0x0000003F +#define EM_RXDCTL_HTHRESH_MASK 0x00003F00 +#define EM_RXDCTL_WTHRESH_MASK 0x003F0000 +#define EM_RXDCTL_THRESH_MASK (EM_RXDCTL_PTHRESH_MASK | \ + EM_RXDCTL_HTHRESH_MASK | \ + EM_RXDCTL_WTHRESH_MASK) + +#define EM_JUMBO_RX_PTHRESH 3 +#define EM_JUMBO_RX_HTHRESH 1 +#define EM_82574_RX_PTHRESH 32 +#define EM_82574_RX_HTHRESH 4 +#define EM_82574_RX_WTHRESH 4 + #define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ ((hw->mac.type <= e1000_82576) ? 16 : 8)) #define IGB_RX_HTHRESH 8