From nobody Sun Aug 30 01:37: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 4hXZWR0wv8z6ptHF for ; Sun, 30 Aug 2026 01:37: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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hXZWQ3dNtz3sRc for ; Sun, 30 Aug 2026 01:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788053874; 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=BSIezwfXlwEp8kvY0zIaAq+qm10dkc3May2+O1b9XZA=; b=TsM3va6iXnQgUC7bT1FXuF/Gy/7Caoao0n+MAkYGok5LKe3JJHNTJKngohiMFCmdKJApWY kXoAzDhqTcQYin64hYad7ZqonByrQeC845OLcGb0SFU0tWcTdTKmfeuVbzD/44yRuY2N88 tcDJcB79T8w5zcGTN2BlTpYJqQozv70QkfExUCc0G0fVgjgUqKJrga8bNrXha0nD69Bai6 6ADR68OG2RwhXeKjHCh1640SmfWxmuHP1jk7OHMyZpQJpTyNaP5F/A/kqe3Ql3jb+y28jt ai7vRWHbNMIoDaVcvrBL8jI3mMgOY63XJiNFZ3dMzoQLTvuh+R2c1mE3MKgnQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788053874; a=rsa-sha256; cv=none; b=eLAnfdYn0R/dXyAczxaEzdDhkqKpl0NvwzUxGb6VnFJ5EjZrjthQ4fzVvRJuobmErUkM/C gRDiCYtJVTp5yKU9u/VN2QRhTS2p6lOrIlf9cBOQWOCAoYYkCjLluWu+sZCMfl7uidPuFO zsGTFqSImT6qrgJsrW1BarpVT7PihQg/CV8x9zi0wc7yF8PQ1leFb2WC1sQbEIbQAO+ekx Y0Nqz074OgcGcRfrlkf6Ax6RGQGu4X+HGIzBPpmqtJ40SJwElX0ZcZ+tpFrFCxJ38JRPdB 4IiownnXikC4kRS0oh/u0H/45MTSHrmY8Ve71InZXX41hv2Vxi2IcoajaDbSdQ== 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=1788053874; 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=BSIezwfXlwEp8kvY0zIaAq+qm10dkc3May2+O1b9XZA=; b=qsq6Iq9qEL2lUdxpYaO2+KQ2WNbq5QpjRdiYQyL0QVqt9/UWy1RSeY0q8qvPA2mkDOh4dL FGqm2X5h/McV9U9W060GYfCCmHCMCCUPF75cZlZLRpFGa+khJ5+bXm3nfEChz3A6eqTip6 H411GHUPOZhP+4bV9ztMr9KYuFhAdAXEi9LAllyPs4Qa7tXNKjRx/jVkTaWt/86Wxo6wpw ijpbQoPr+5kxE4qa5zn21D4docyK+bMr4O27YZ3ButwLTsx6B3cFm4pc6AjOHSTt9SF7Yo xlnytvKUZ2WVw37/KdgRc3RW5IgpwUtVi3x8qZAD/boUFcalcwR4lPoFYwp2uQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hXZWQ2BTXz149p for ; Sun, 30 Aug 2026 01:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fb22 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 30 Aug 2026 01:37:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: df5bdb59bc89 - stable/15 - e1000: Propagate hardware initialization failures 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/stable/15 X-Git-Reftype: branch X-Git-Commit: df5bdb59bc89365d06296cab813cad33807e94e1 Auto-Submitted: auto-generated Date: Sun, 30 Aug 2026 01:37:54 +0000 Message-Id: <6a938972.3fb22.1b4e0261@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=df5bdb59bc89365d06296cab813cad33807e94e1 commit df5bdb59bc89365d06296cab813cad33807e94e1 Author: Kevin Bowling AuthorDate: 2026-08-16 07:55:37 +0000 Commit: Kevin Bowling CommitDate: 2026-08-30 01:31:48 +0000 e1000: Propagate hardware initialization failures The reset helper discards reset_hw and init_hw errors. Runtime initialization then continues programming rings and filters, and iflib publishes the interface as running even though the controller did not reach a usable state. Initial attach similarly continues into NVM and MAC setup after a failed reset. Return errors from the reset helper. Fail attach when the controller cannot be reset or initialized, and report runtime failures through iflib_init_failed() so iflib leaves the interface stopped. Also stop register accesses and report the error when a stop-path reset fails. Sponsored by: BBOX.io (cherry picked from commit 41a0f7a0a447ef2092faadb35f6d4c3f80c088bf) --- sys/dev/e1000/if_em.c | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index b1b4fb6f6b1a..7f1da9fb7d3f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -427,7 +427,7 @@ static bool em_if_needs_restart(if_ctx_t, enum iflib_restart_event); static void em_identify_hardware(if_ctx_t); static int em_allocate_pci_resources(if_ctx_t); static void em_free_pci_resources(if_ctx_t); -static void em_reset(if_ctx_t); +static int em_reset(if_ctx_t); static int em_setup_interface(if_ctx_t); static int em_setup_msix(if_ctx_t); @@ -1346,7 +1346,12 @@ em_if_attach_pre(if_ctx_t ctx) ** important in reading the nvm and ** mac from that. */ - e1000_reset_hw(hw); + error = e1000_reset_hw(hw); + if (!sc->vf_ifp && error != E1000_SUCCESS) { + device_printf(dev, "Hardware reset failed: %d\n", error); + error = EIO; + goto err_late; + } /* Make sure we have a good EEPROM before we read from it */ if (e1000_validate_nvm_checksum(hw) < 0) { @@ -1424,7 +1429,12 @@ em_if_attach_post(if_ctx_t ctx) goto err_late; } - em_reset(ctx); + if (sc->vf_ifp) { + (void)em_reset(ctx); + } else if (em_reset(ctx) != E1000_SUCCESS) { + error = EIO; + goto err_late; + } /* Initialize statistics */ if (sc->vf_ifp) @@ -1608,7 +1618,12 @@ em_if_init(if_ctx_t ctx) } /* Initialize the hardware */ - em_reset(ctx); + if (sc->vf_ifp) { + (void)em_reset(ctx); + } else if (em_reset(ctx) != E1000_SUCCESS) { + iflib_init_failed(ctx); + return; + } /* Re-arm a link-up transition deferred for this reset. */ if (sc->link_state == EM_LINK_STATE_DOWN_RESET_PENDING || sc->link_state == EM_LINK_STATE_UP_RESET_PENDING) @@ -3058,6 +3073,7 @@ static void em_if_stop(if_ctx_t ctx) { struct e1000_softc *sc = iflib_get_softc(ctx); + s32 error; INIT_DEBUGOUT("em_if_stop: begin"); @@ -3066,7 +3082,12 @@ em_if_stop(if_ctx_t ctx) em_flush_desc_rings(sc); em_prepare_fatal_error_reset(sc); - e1000_reset_hw(&sc->hw); + error = e1000_reset_hw(&sc->hw); + if (!sc->vf_ifp && error != E1000_SUCCESS) { + device_printf(sc->dev, "Hardware reset failed while " + "stopping: %d\n", error); + return; + } if (sc->hw.mac.type >= e1000_82544 && !sc->vf_ifp) E1000_WRITE_REG(&sc->hw, E1000_WUFC, 0); @@ -3755,7 +3776,7 @@ em_flush_desc_rings(struct e1000_softc *sc) * sc structure. * **********************************************************************/ -static void +static int em_reset(if_ctx_t ctx) { device_t dev = iflib_get_dev(ctx); @@ -3764,6 +3785,7 @@ em_reset(if_ctx_t ctx) struct e1000_hw *hw = &sc->hw; u32 rx_buffer_size; u32 pba; + s32 error; INIT_DEBUGOUT("em_reset: begin"); /* Let the firmware know the OS is in control */ @@ -3995,7 +4017,12 @@ em_reset(if_ctx_t ctx) /* Issue a global reset */ em_prepare_fatal_error_reset(sc); - e1000_reset_hw(hw); + error = e1000_reset_hw(hw); + if (error != E1000_SUCCESS) { + if (!sc->vf_ifp) + device_printf(dev, "Hardware reset failed: %d\n", error); + return (error); + } if (!sc->vf_ifp) { if (hw->mac.type >= igb_mac_min) { E1000_WRITE_REG(hw, E1000_WUC, 0); @@ -4010,9 +4037,11 @@ em_reset(if_ctx_t ctx) sc->flags &= ~IGB_MEDIA_RESET; } /* and a re-init */ - if (e1000_init_hw(hw) < 0) { - device_printf(dev, "Hardware Initialization Failed\n"); - return; + error = e1000_init_hw(hw); + if (error != E1000_SUCCESS) { + device_printf(dev, "Hardware initialization failed: %d\n", + error); + return (error); } em_configure_82576_memory_errors(sc); em_finish_fatal_error_reset(sc); @@ -4025,6 +4054,8 @@ em_reset(if_ctx_t ctx) E1000_WRITE_REG(hw, E1000_VET, ETHERTYPE_VLAN); e1000_get_phy_info(hw); e1000_check_for_link(hw); + + return (E1000_SUCCESS); } /*