From nobody Fri Oct 04 06:42:41 2024 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 4XKf9t1YxWz5Y1d6; Fri, 04 Oct 2024 06:42: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XKf9t11Nlz3y2h; Fri, 4 Oct 2024 06:42:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728024162; 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=RiFY/ZTCmc5Guae3nQc/cuR0cbF1EG9aiR2Bctvd3+Y=; b=nwNN5x+qRdRt54wVRtERElLroF2hdbFCrXmrJxxj3KGhLctaDT7pDyGASc20aboIGOin8c kRLBAuwcUVAU8ObMijcGnAoFV27XZH9JBxq7T95CMsuOEEpujTHB4zXLdbvZVs7reS/bzs ww0/HJGJn+BdeTDvuMZ/xTlCzI8cbYqZFrPeYPJINSlIXBZ5wQLiwZ9t3RPG956fUTfKQJ tWDH8AVnvWcEuI7QShsuWwB3y088kQVo3yzOoXOXwfkuqnY1RGfkTxVXAIaUQvRpMl/rr9 gjrLJirIJ5WFDeAgKsUyYxQyNyr2pgWLQbv3XPNo0VQYg1I7VRV+j7fpQ8W5/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728024162; 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=RiFY/ZTCmc5Guae3nQc/cuR0cbF1EG9aiR2Bctvd3+Y=; b=uc+N+jxAthn/3OaTXHOrXvMiLKCQjvMCCz6CpB2EJdhBRtBfNqWuD6xDl+RnLie6zz4z1r Yr2OZc5CrJR8hZhSx2UTm6OVphcD8wtViuX7cS0MtyOfRlkw8RcfG8P0g/BqaS10dzgCtQ MqTUTlb/vzxUPkdRvcp+6FHVOYCQpXj2N1z3Y3u10Rne57rEjHqUEvyAeeRSLFgsL1p7Ik kipcvTgWFTEQgbEkLRNVvsoHUGpg356uhZQw//UarsqiS/tHit0GgJNUAlL0+ERD1fDeGq wAKj3gM5c9QplUHYJXlevfVStENAfKXriorjbUpeLdYQtJ0BRfpZ8BhEzXHuEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728024162; a=rsa-sha256; cv=none; b=x0J9oHKqOKgog/KpPvefIWVAG/N45D20RLnmrw2mXSU1QKWeYYO0Sx535qy82zr55uJisF V0JcmoxQMcrnBpAiJaKij9048LbWy+EKQlOqIpkXLwo/YznzuSOSRtKsaFQPabA35DhI35 BkgfUABKlviJk2yfNKRmamp8onkn1AOmb9dFrJI+7Ly+qv9SwZZqtZ1Q4juh8XUlR1kz/C rQwV3i2DrsCOGe4u7cNVnNuLvtOiwBbBX/no2H8zJmq18soutiZO5PdN1eMISWdEugPrLy PHCtOy8J39EuBBrpzlRJ74LMgcEwUMwnHN74sYNTXyabyPWwgJ9c2jb/DATpJg== 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 4XKf9t044dzNJJ; Fri, 4 Oct 2024 06:42:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4946gf8V016634; Fri, 4 Oct 2024 06:42:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4946gfZC016631; Fri, 4 Oct 2024 06:42:41 GMT (envelope-from git) Date: Fri, 4 Oct 2024 06:42:41 GMT Message-Id: <202410040642.4946gfZC016631@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: 6ccd24f18376 - stable/13 - e1000: Clean up legacy absolute and packet timers 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 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: 6ccd24f18376fb44285509a2e3c6469bdebdc108 Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6ccd24f18376fb44285509a2e3c6469bdebdc108 commit 6ccd24f18376fb44285509a2e3c6469bdebdc108 Author: Kevin Bowling AuthorDate: 2024-09-27 06:08:01 +0000 Commit: Kevin Bowling CommitDate: 2024-10-04 06:42:10 +0000 e1000: Clean up legacy absolute and packet timers The absolute and packet timers only apply to lem and em with some only applying to the later. This cleans up the sysctl tree to only show these where applicable and stops writing to unexpected registers for igb. Sponsored by: BBOX.io (cherry picked from commit 1c578f1c93112d3d53820f8b6b411488b83f0ab2) --- sys/dev/e1000/if_em.c | 116 +++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 6d9eedae3df4..8a3178d737b2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1035,27 +1035,25 @@ em_if_attach_pre(if_ctx_t ctx) e1000_get_bus_info(hw); /* Set up some sysctls for the tunable interrupt delays */ - em_add_int_delay_sysctl(sc, "rx_int_delay", - "receive interrupt delay in usecs", &sc->rx_int_delay, - E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); - em_add_int_delay_sysctl(sc, "tx_int_delay", - "transmit interrupt delay in usecs", &sc->tx_int_delay, - E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); - em_add_int_delay_sysctl(sc, "rx_abs_int_delay", - "receive interrupt delay limit in usecs", - &sc->rx_abs_int_delay, - E1000_REGISTER(hw, E1000_RADV), - em_rx_abs_int_delay_dflt); - em_add_int_delay_sysctl(sc, "tx_abs_int_delay", - "transmit interrupt delay limit in usecs", - &sc->tx_abs_int_delay, - E1000_REGISTER(hw, E1000_TADV), - em_tx_abs_int_delay_dflt); - em_add_int_delay_sysctl(sc, "itr", - "interrupt delay limit in usecs/4", - &sc->tx_itr, - E1000_REGISTER(hw, E1000_ITR), - DEFAULT_ITR); + if (hw->mac.type < igb_mac_min) { + em_add_int_delay_sysctl(sc, "rx_int_delay", + "receive interrupt delay in usecs", &sc->rx_int_delay, + E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); + em_add_int_delay_sysctl(sc, "tx_int_delay", + "transmit interrupt delay in usecs", &sc->tx_int_delay, + E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); + } + if (hw->mac.type >= e1000_82540 && hw->mac.type < igb_mac_min) { + em_add_int_delay_sysctl(sc, "rx_abs_int_delay", + "receive interrupt delay limit in usecs", &sc->rx_abs_int_delay, + E1000_REGISTER(hw, E1000_RADV), em_rx_abs_int_delay_dflt); + em_add_int_delay_sysctl(sc, "tx_abs_int_delay", + "transmit interrupt delay limit in usecs", &sc->tx_abs_int_delay, + E1000_REGISTER(hw, E1000_TADV), em_tx_abs_int_delay_dflt); + em_add_int_delay_sysctl(sc, "itr", + "interrupt delay limit in usecs/4", &sc->tx_itr, + E1000_REGISTER(hw, E1000_ITR), DEFAULT_ITR); + } hw->mac.autoneg = DO_AUTO_NEG; hw->phy.autoneg_wait_to_complete = false; @@ -2289,18 +2287,19 @@ igb_configure_queues(struct e1000_softc *sc) break; } - /* Set the starting interrupt rate */ - if (em_max_interrupt_rate > 0) + /* Set the igb starting interrupt rate */ + if (em_max_interrupt_rate > 0) { newitr = (4000000 / em_max_interrupt_rate) & 0x7FFC; - if (hw->mac.type == e1000_82575) - newitr |= newitr << 16; - else - newitr |= E1000_EITR_CNT_IGNR; + if (hw->mac.type == e1000_82575) + newitr |= newitr << 16; + else + newitr |= E1000_EITR_CNT_IGNR; - for (int i = 0; i < sc->rx_num_queues; i++) { - rx_que = &sc->rx_queues[i]; - E1000_WRITE_REG(hw, E1000_EITR(rx_que->msix), newitr); + for (int i = 0; i < sc->rx_num_queues; i++) { + rx_que = &sc->rx_queues[i]; + E1000_WRITE_REG(hw, E1000_EITR(rx_que->msix), newitr); + } } return; @@ -3276,12 +3275,16 @@ em_initialize_transmit_unit(if_ctx_t ctx) tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; } - E1000_WRITE_REG(hw, E1000_TIPG, tipg); - E1000_WRITE_REG(hw, E1000_TIDV, sc->tx_int_delay.value); + if (hw->mac.type < igb_mac_min) { + E1000_WRITE_REG(hw, E1000_TIPG, tipg); + E1000_WRITE_REG(hw, E1000_TIDV, sc->tx_int_delay.value); + + if (sc->tx_int_delay.value > 0) + sc->txd_cmd |= E1000_TXD_CMD_IDE; + } - if(hw->mac.type >= e1000_82540) - E1000_WRITE_REG(hw, E1000_TADV, - sc->tx_abs_int_delay.value); + if (hw->mac.type >= e1000_82540) + E1000_WRITE_REG(hw, E1000_TADV, sc->tx_abs_int_delay.value); if (hw->mac.type == e1000_82571 || hw->mac.type == e1000_82572) { tarc = E1000_READ_REG(hw, E1000_TARC(0)); @@ -3306,16 +3309,13 @@ em_initialize_transmit_unit(if_ctx_t ctx) E1000_WRITE_REG(hw, E1000_TARC(0), tarc); } - if (sc->tx_int_delay.value > 0) - sc->txd_cmd |= E1000_TXD_CMD_IDE; - /* Program the Transmit Control Register */ tctl = E1000_READ_REG(hw, E1000_TCTL); tctl &= ~E1000_TCTL_CT; tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT)); - if (hw->mac.type >= e1000_82571) + if (hw->mac.type >= e1000_82571 && hw->mac.type < igb_mac_min) tctl |= E1000_TCTL_MULR; /* This write will effectively turn on the transmit unit. */ @@ -3383,17 +3383,29 @@ em_initialize_receive_unit(if_ctx_t ctx) if (!em_disable_crc_stripping) rctl |= E1000_RCTL_SECRC; - if (hw->mac.type >= e1000_82540) { - E1000_WRITE_REG(hw, E1000_RADV, - sc->rx_abs_int_delay.value); + /* lem/em default interrupt moderation */ + if (hw->mac.type < igb_mac_min) { + if (hw->mac.type >= e1000_82540) { + E1000_WRITE_REG(hw, E1000_RADV, sc->rx_abs_int_delay.value); - /* - * Set the interrupt throttling rate. Value is calculated - * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) + /* + * Set the interrupt throttling rate. Value is calculated + * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) + */ + E1000_WRITE_REG(hw, E1000_ITR, DEFAULT_ITR); + } + + /* XXX TEMPORARY WORKAROUND: on some systems with 82573 + * long latencies are observed, like Lenovo X60. This + * change eliminates the problem, but since having positive + * values in RDTR is a known source of problems on other + * platforms another solution is being sought. */ - E1000_WRITE_REG(hw, E1000_ITR, DEFAULT_ITR); + if (hw->mac.type == e1000_82573) + E1000_WRITE_REG(hw, E1000_RDTR, 0x20); + else + E1000_WRITE_REG(hw, E1000_RDTR, sc->rx_int_delay.value); } - E1000_WRITE_REG(hw, E1000_RDTR, sc->rx_int_delay.value); if (hw->mac.type >= em_mac_min) { uint32_t rfctl; @@ -3443,16 +3455,6 @@ em_initialize_receive_unit(if_ctx_t ctx) } E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); - /* - * XXX TEMPORARY WORKAROUND: on some systems with 82573 - * long latencies are observed, like Lenovo X60. This - * change eliminates the problem, but since having positive - * values in RDTR is a known source of problems on other - * platforms another solution is being sought. - */ - if (hw->mac.type == e1000_82573) - E1000_WRITE_REG(hw, E1000_RDTR, 0x20); - for (i = 0, que = sc->rx_queues; i < sc->rx_num_queues; i++, que++) { struct rx_ring *rxr = &que->rxr; /* Setup the Base and Length of the Rx Descriptor Ring */