From nobody Sun Aug 16 10:21:53 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 4hNBpb18Qpz6nr3B for ; Sun, 16 Aug 2026 10:21:59 +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 4hNBpZ4FCtz3Zds for ; Sun, 16 Aug 2026 10:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786875718; 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=0Crotr/5pk2vomCJEKXb5D+/Gk0ygtvGto9veqLaY/Q=; b=gKlSo0ZRutg8TylLjiV1r2GvAGwmKwxb62JJevrek3uvVSWZw9J0ezculWKfhn1KPCwC8t 3ADQ2TrKcDkHqFhiSvOnFlFgfBMWTZ7EVkq7Fk08nHJVXFeOQGog1Cuq2oPW9AM+C5/vX2 ZlirduuhZM8TBNP847UQCbvsAjn5vf1yITxnJbXWf2IE+QDq35VKYXn+7H9k9Psu9doSHC mZn4EcpMoJ2wgHYZthYOOmBDC+qFblDj1MBPTaSroDN0AOLlluLvH/I8M+Hj+IklT0+4D4 XvisiWIoCn33RGsZ6XFCm0s0gWd94WaTDD6hB1z2I48Mw0blv8omPXIdIGqndA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786875718; a=rsa-sha256; cv=none; b=vrqXCpHACdjxCV2LYt/119xJT7/yiq+t6LNQpcFOmY/uD8AV/MTbZvYNpSs4yg5Y+mXT1z 6820m81tMoL3khhQpKmj88RGX2PRfsZoFc78yy0m/12+gXZ9S6DeuTw77x9CdNZGQBZUwW 6Vlg/fRWNfNdWF3KHGCw+hHBs0CIRq9aUCbiHp/hPpDU3Z+CimIUlWNnZ7AMZ742wuWVcR ji43F6BXqAsYNX2RAysUj8CFZ6jtUA5s4kGh4L0TxJVytlorj6wBtvmkn6mODlL8mfB73/ m2zCiXLedOhPYg0plf7DRGSP6OgCY3NYjwsJXvTJnaFsx2yzcypIMRtQkamZPQ== 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=1786875718; 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=0Crotr/5pk2vomCJEKXb5D+/Gk0ygtvGto9veqLaY/Q=; b=YTut0ZlTk9IUtUqXyqAaOMjuGQqwBp13AFidr94chqPirZGZREdompejlPeCrpEbpvdGD8 UOghEue8kpBDhV52LbBzu5ZIIrlcYwy3b24JXzyUGAMr6dY5iEiWfz5lXVCksjPeDRwLl8 FTv6vI1WTVi8jh3md0JPJX/SX0armTiztm9KaA0jVguFEUuNst7a/v/GkxLcS2GkhkFxhF UXBPinNL3Jn3dbWNqXo+iSB8qvVuNMf0ttK66dnhCXaQJ9MfVbRo0RqIlE7CC0MBgbJp5R x4dt60Ujyc2M/TYyifDNuyu2D+pMidJqKLjk3d/0AQTh4eNAA8WMVJd1wKcGNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hNBpZ314Mz7XL for ; Sun, 16 Aug 2026 10:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27033 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 16 Aug 2026 10:21:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: c82a015ede8d - main - 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/main X-Git-Reftype: branch X-Git-Commit: c82a015ede8d49aabc8bb253b7597b8db0f42524 Auto-Submitted: auto-generated Date: Sun, 16 Aug 2026 10:21:53 +0000 Message-Id: <6a818f41.27033.57205fea@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=c82a015ede8d49aabc8bb253b7597b8db0f42524 commit c82a015ede8d49aabc8bb253b7597b8db0f42524 Author: Kevin Bowling AuthorDate: 2026-08-16 07:56:03 +0000 Commit: Kevin Bowling CommitDate: 2026-08-16 10:21:15 +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. MFC after: 2 weeks Sponsored by: BBOX.io --- 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 7026a4e50bb9..0ac2d2a7cc20 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -116,7 +116,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); @@ -675,7 +675,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) { @@ -743,11 +748,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); @@ -760,14 +765,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); } @@ -877,11 +874,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; @@ -1606,12 +1603,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); } @@ -2115,7 +2118,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); @@ -2123,6 +2126,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); @@ -2169,14 +2173,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); @@ -2187,6 +2198,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); } /* @@ -2449,6 +2462,7 @@ igc_if_queues_free(if_ctx_t ctx) if (sc->mta != NULL) { free(sc->mta, M_DEVBUF); + sc->mta = NULL; } }