From nobody Sun Aug 30 01:37:55 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 4hXZWR6NlKz6ptKx 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 4hXZWR3jQsz3sVG for ; Sun, 30 Aug 2026 01:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788053875; 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=TtjbhKYun4UvC28yxFqR+qTW7V2bj/LuazONIskgsFk=; b=iAcGKAFjDs9wX1eJFnaROT0+aKR7U1CL5b5yMFDrhsodaQfN0r3LxXGxRSG4B5kJQ5/LTM hN/orMnSNt5Ik6sEne6XZi/yRE1OGSQByZDVufos/nOznRRhnyfe4Vos6X8zBiahOmVbHI m1SppkBZnWDTWFfjRpb874BfGlCn96qYJS11NNYn9fpSjSYYGttHzW6hbQtMvT27i+HyRm KvyYWfAqCVckaWEr57a8gZJlkNofw73+AI8cvgsgMkXkNm4h/Rmym21/x3JpiOJQIQ9Zdb 4RTqN3cEsHvHEr1nrKWifnGu8kFgyp8JtgD+/n/uoYE/dYtSc6TuxWh8mkFvaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788053875; a=rsa-sha256; cv=none; b=DSctcaWNZTswnllgDedsrLEQKsCXJRqgR/TOvH49r2252gIOK/5PC1Na5yPlUydLDXdg5V HGqEc/DWDHs2m6SakPTB2nUOx6OIhkzqFvucd7cAuE6y7S+3llGF7LqZGuLqbJVoPn5B6q OiYBgwZB7gLgEU6PUMgJoMjrLsmpHDp7ozRHh6mowfZsl/onuddrVj67woGSqySYFfNzci irFqrU+pg/E2pTXVI7d3Cs/Pyu4DmB1rmCBPzZuMX9Y4E1ftQQd8ohWwQ4QJ+1FH0Ih5EK UYjUa26lul30BVbKrE4EVo5ldJhWBe4x3qqivwJDfNKLZ23ifEdydS94kdw2eA== 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=1788053875; 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=TtjbhKYun4UvC28yxFqR+qTW7V2bj/LuazONIskgsFk=; b=cpF74uLZhLCAkcA1aUijtihTfFXP0eldqSBPgv4Ycom3bQlyaQfSjbTS1E0WFRPVGM+Wsj 07PYMasm1j7oD+t8esNEL7L3/d/MRabvyq8sZ/zpHn4vYjVoYPOyeB0AniQJ0DyPxTdOyY n8rSU+N4nDxrM1CrDet1OdsEVKPj1ufGEf3ckYwuyIZtRTNWCzfTai+mnrUikRv4K0BD7l s506J/RhsfzkK0QL6iwq0hoSgvMUAPIq7y8Bibj605FHi0DBXp3LDrA1CixEiOoNMOdw2i KXQaJojZpcfbXwAacX0EYSsiV4HMFmm4mtOIbAodExlXrxqy0GHCIgKlJHUcdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hXZWR2cvqz149q for ; Sun, 30 Aug 2026 01:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e33b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 30 Aug 2026 01:37:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 640916dc50a6 - stable/15 - igc: 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: 640916dc50a6fd88eddad312f9e0e21404211f52 Auto-Submitted: auto-generated Date: Sun, 30 Aug 2026 01:37:55 +0000 Message-Id: <6a938973.3e33b.63b8292b@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=640916dc50a6fd88eddad312f9e0e21404211f52 commit 640916dc50a6fd88eddad312f9e0e21404211f52 Author: Kevin Bowling AuthorDate: 2026-08-16 07:56:03 +0000 Commit: Kevin Bowling CommitDate: 2026-08-30 01:32:08 +0000 igc: Propagate hardware initialization failures The reset helper discards igc_reset_hw and igc_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. A later successful initialization completes pending fatal error cleanup and re-arms FER. Cache a requested MAC address before reset, but let init_hw program RAR0 after reset succeeds. Let iflib perform its normal attach-post failure cleanup instead of releasing the same driver resources from both layers, and make queue cleanup idempotent. Sponsored by: BBOX.io (cherry picked from commit c82a015ede8d49aabc8bb253b7597b8db0f42524) --- sys/dev/igc/if_igc.c | 62 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index eae83a673786..3ea000509c6e 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -118,7 +118,7 @@ static void igc_identify_hardware(if_ctx_t); static int igc_allocate_pci_resources(if_ctx_t); static void igc_free_pci_resources(if_ctx_t); static void igc_disable_broken_l1_2(if_ctx_t); -static void igc_reset(if_ctx_t); +static int igc_reset(if_ctx_t); static int igc_setup_interface(if_ctx_t); static int igc_setup_msix(if_ctx_t); @@ -678,7 +678,12 @@ igc_if_attach_pre(if_ctx_t ctx) ** important in reading the nvm and ** mac from that. */ - igc_reset_hw(hw); + error = igc_reset_hw(hw); + if (error != IGC_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 (igc_validate_nvm_checksum(hw) < 0) { @@ -746,11 +751,11 @@ igc_if_attach_post(if_ctx_t ctx) /* Setup OS specific network interface */ error = igc_setup_interface(ctx); - if (error != 0) { - goto err_late; - } + if (error != 0) + return (error); - igc_reset(ctx); + if (igc_reset(ctx) != IGC_SUCCESS) + return (EIO); /* Initialize statistics */ igc_update_stats_counters(sc); @@ -763,14 +768,6 @@ igc_if_attach_post(if_ctx_t ctx) INIT_DEBUGOUT("igc_if_attach_post: end"); - return (error); - -err_late: - igc_release_hw_control(sc); - igc_free_pci_resources(ctx); - igc_if_queues_free(ctx); - free(sc->mta, M_DEVBUF); - return (error); } @@ -880,11 +877,11 @@ igc_if_init(if_ctx_t ctx) bcopy(if_getlladdr(ifp), sc->hw.mac.addr, ETHER_ADDR_LEN); - /* Put the address into the Receive Address Array */ - igc_rar_set(&sc->hw, sc->hw.mac.addr, 0); - /* Initialize the hardware */ - igc_reset(ctx); + if (igc_reset(ctx) != IGC_SUCCESS) { + iflib_init_failed(ctx); + return; + } igc_if_update_admin_status(ctx); for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; @@ -1621,12 +1618,18 @@ static void igc_if_stop(if_ctx_t ctx) { struct igc_softc *sc = iflib_get_softc(ctx); + s32 error; INIT_DEBUGOUT("igc_if_stop: begin"); igc_led_restore(sc); igc_prepare_fatal_error_reset(sc); - igc_reset_hw(&sc->hw); + error = igc_reset_hw(&sc->hw); + if (error != IGC_SUCCESS) { + device_printf(sc->dev, "Hardware reset failed while stopping: " + "%d\n", error); + return; + } igc_finish_fatal_error_reset(sc); IGC_WRITE_REG(&sc->hw, IGC_WUC, 0); } @@ -2130,7 +2133,7 @@ igc_init_dmac(struct igc_softc *sc, u32 pba) * softc structure. * **********************************************************************/ -static void +static int igc_reset(if_ctx_t ctx) { device_t dev = iflib_get_dev(ctx); @@ -2138,6 +2141,7 @@ igc_reset(if_ctx_t ctx) struct igc_hw *hw = &sc->hw; u32 rx_buffer_size; u32 pba; + s32 error; INIT_DEBUGOUT("igc_reset: begin"); igc_led_restore(sc); @@ -2184,14 +2188,21 @@ igc_reset(if_ctx_t ctx) hw->fc.send_xon = true; /* Issue a global reset */ - igc_reset_hw(hw); + error = igc_reset_hw(hw); + if (error != IGC_SUCCESS) { + device_printf(dev, "Hardware reset failed: %d\n", error); + return (error); + } IGC_WRITE_REG(hw, IGC_WUC, 0); /* and a re-init */ - if (igc_init_hw(hw) < 0) { - device_printf(dev, "Hardware Initialization Failed\n"); - return; + error = igc_init_hw(hw); + if (error != IGC_SUCCESS) { + device_printf(dev, "Hardware initialization failed: %d\n", + error); + return (error); } + igc_finish_fatal_error_reset(sc); /* Setup DMA Coalescing */ igc_init_dmac(sc, pba); @@ -2202,6 +2213,8 @@ igc_reset(if_ctx_t ctx) IGC_WRITE_REG(hw, IGC_VET, ETHERTYPE_VLAN); igc_get_phy_info(hw); igc_check_for_link(hw); + + return (IGC_SUCCESS); } /* @@ -2468,6 +2481,7 @@ igc_if_queues_free(if_ctx_t ctx) if (sc->mta != NULL) { free(sc->mta, M_DEVBUF); + sc->mta = NULL; } }