From nobody Fri Sep 27 06:46:25 2024 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 4XFLbP5z52z5Xc0G; Fri, 27 Sep 2024 06:46:25 +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 4XFLbP53kgz4DHS; Fri, 27 Sep 2024 06:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727419585; 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=HkggrcomcFA6Uby2zosz7+Hl2TAEAWV/gbsocP24l74=; b=TZOyzDTVN0MaCx2uxBwK2IQVdJHqs5ctbNieNoUgtKRK0sC+uUCVnwlhdbIH6crJ2po2Zg f4lqCiW25hY/dukAc1RA+iplBNxAECs21nFTVP1OsuMug5r5Agj9fUW2iaK4RbuLHg46rS CJ23nS9QA0opITDtd0JKWGr1ghJhHxg1t88idCuyaHQ3GxhJD6BdlCz4yyQ8g1LSlJ2V8d eypVDm91sEua/6arkMsdQpBRz7ZH6WYOW4b7Ilyz1M+TFWHik1RIcgqTVc8FEMJN8UiF/2 T4Z2IpipCiqcsCDvT2JA7Md+nGiN0eeMZ8shGBRFbvX1JpzpreLeUhc/qM0Xyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727419585; 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=HkggrcomcFA6Uby2zosz7+Hl2TAEAWV/gbsocP24l74=; b=K41cAhONKDjCi9laHQWJXOZqvyODEHLXJpW1HxOQoyzi1Vf8Txii9hVpBK6p8UpUP+cuTF gL6i271TeJ9xuQdHCT4EXuNZDlAdPlRR5HTWI2Jy4ARdR/uLEL5hriQK8jX3pbzcAFIyXM cRDLQMCr2WeAcpRAF4pIpVjB7GArMXzZ1cfvcDurdNo9/tjjGrNS6WSUbFyvmZ9vx/ozIU tF7Jwb/T/RRLVst0eiRWulA2Pm0LELWYRCx3MOgb5ox5Rmk5gayZjqtPsMlCLQPOLI3lZ0 WHhDDYUhDUkJJTOK2VQ/7MsJQlteKFa278p0EYRivLOWhfr850zDmMFJkMxE2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727419585; a=rsa-sha256; cv=none; b=aScfqQw1MqDdkB40zXe8QMNi0gP6w18HI4uppOU/fwLCZSwBGlVRd3bkVcp95lkx0oIGEj JEIWRneSXCWxzEFLF+PjxqA6bYGP0rRO2UUt8iWj8SdPEaNO5yXeruDQ0DLaAB4XDx/j0W k+Q/0GvvH7aRy7eUVXS5LtU5Z+261z9Hn2N4BXSiE9ca8mOkaRNOC+d4biSVvi7GylpMGr KpBwi8zZ47n+j2fuqMbbl5rfTLoNiOQXK8W2vUvST+MmmkfRClV724DFu89pOyXvi3veul WkoOEpjjdnv8BspRfnItcAs/ZcD8+CGY1+1B9fq5o8ItrWryjSaQdQQPBDKSZQ== 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 4XFLbP4fvGzW5w; Fri, 27 Sep 2024 06:46:25 +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 48R6kPi1061054; Fri, 27 Sep 2024 06:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48R6kPPx061051; Fri, 27 Sep 2024 06:46:25 GMT (envelope-from git) Date: Fri, 27 Sep 2024 06:46:25 GMT Message-Id: <202409270646.48R6kPPx061051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 1c578f1c9311 - main - e1000: Clean up legacy absolute and packet timers 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 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: 1c578f1c93112d3d53820f8b6b411488b83f0ab2 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=1c578f1c93112d3d53820f8b6b411488b83f0ab2 commit 1c578f1c93112d3d53820f8b6b411488b83f0ab2 Author: Kevin Bowling AuthorDate: 2024-09-27 06:08:01 +0000 Commit: Kevin Bowling CommitDate: 2024-09-27 06:45:04 +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. MFC after: 1 week Sponsored by: BBOX.io --- 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 ad12171487f6..cdadec17e355 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1033,27 +1033,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; @@ -2287,18 +2285,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; @@ -3274,12 +3273,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)); @@ -3304,16 +3307,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. */ @@ -3381,17 +3381,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; @@ -3441,16 +3453,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 */