From nobody Thu Sep 24 19:23:13 2026 Received: from mail-oi2-f13.google.com (mail-oi2-f13.google.com [74.125.231.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8408F4E01E9 for ; Mon, 21 Sep 2026 16:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009649; cv=none; b=n/mAUc5MWuU7DTmkssEXuAVct1zAgLlHLRcASrFIFsCxXRU7Ra/o75lVTM3cgYIfgst26bHAmXAVKL+xW5MMxgiZ+3g4lbU4A/ufewVmYA4NEvjy22QMS81aOD8wjVb8RUpGPaHbo4mgq8Y6Qmzt3+tYhX5eAvq8grEYvU7q1fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009649; c=relaxed/simple; bh=OTCJmDRdeQw+MVudaJiUkwSG/PvC7qpRtAicPLNJlfc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MF1MFzo2PuHAh/qqv3JUMiHHFZUahc7Uca5zQHr7oyMUB+FjE241SrhoLA2sRj/FRPYh30HEyEamOEtzd/5fKkKlVRhrwRLUzfNDo6el7XMBvSnY8of0MK/jL2t092HXlENHCi8DQScCWZw6QBNGok3GiPONQCXKQ7KYicbMaug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kbhN9N98; arc=none smtp.client-ip=74.125.231.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kbhN9N98" Received: by mail-oi2-f13.google.com with SMTP id 5614622812f47-4b5c61966d0so1960974b6e.3 for ; Mon, 21 Sep 2026 09:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790009646; x=1790614446; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YhWGvSN0/re+XL27oH8EyakYJ2QqZd3jNzma8F4tE+U=; b=kbhN9N9819PPv3PAbwGnvH/NUmlwFiE9f+zEEAmXgfu8JJ2O1g6Q52FE3ed5Z0lqow x/kOm1PQm2iojP9RkBG+adN8MGG6d4i/Gm52Stnq/KTgNlsnABR0fZQ1SP5UfNgAvqyZ yYKQ4j0KNQjKOWFQY9JE4PQeCABCLU9pLGGn6n4gRj5Io9ADjcexrK1RLzKioLeOgyw6 Sa+pQEGR8kSTIVkkzX4eibSZgWBdM22bd1eYwC6pb/377lOQIbWVzrFOkKTGfsVB2Egm u7R+41nhyyzQPrKXITDV6losM5JvY7J42hEGregq5VdNL6jYiwTVBqPvWXoUwpYkOto9 to/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790009646; x=1790614446; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=YhWGvSN0/re+XL27oH8EyakYJ2QqZd3jNzma8F4tE+U=; b=xtm2pH7Zbe08P3d2BU0uGdD0qoHHu+sNTUnpfmCoRPvXDuOONqgAEdG12tOur/yjVN 9Wz/KDMql/Sj7sJSLeDBzLoZpyF02xor0S4GhXJ0ivS4i2/n/ez4tMDz3xWbv+O+LBBa wfj4iVzFERJpvIiSKt4XwSOZFtpEifjkbMjy7f4f96UY854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Rk157nCy1hVYDp0f w3AkbesH00o7oiLuBKaKg2Q== X-Received: by 2002:a05:6820:61a:b0:6b7:8415:d785 with SMTP id 006d021491bc7-6ca9c9551efmr10448335eaf.48.1790009645716; Mon, 21 Sep 2026 09:54:05 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6d145bc40e6sm510481eaf.5.2026.09.21.09.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 09:54:05 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 10:54:02 -0600 Subject: [PATCH net 1/3] net: phylink: allow stopping a suspended instance Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-submit-stmmac-reset-fixes-v1-v1-1-87a4e431ee00@gmail.com> References: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> In-Reply-To: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> To: Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Joakim Zhang , "Russell King (Oracle)" , Maxime Chevallier , Andrew Lunn , Maxime Coquelin , Alexandre Torgue , Christian Marangi , Tiezhu Yang , Huacai Chen Cc: Richard Genoud , Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.15.2 A MAC which cannot restore its hardware after system sleep may need to close the network device instead of calling phylink_resume(). Without MAC Wake-on-LAN, phylink_suspend() has already stopped the PHY and PCS, so another phylink_stop() repeats their shutdown. With MAC Wake-on-LAN, the saved link-up state still needs a matching mac_link_down(), and leaving PHYLINK_DISABLE_MAC_WOL set prevents a subsequent start from resolving the link. Allow phylink_stop() to finish shutdown directly from either suspended state. Leave an already stopped instance alone. For MAC Wake-on-LAN, stop resolution, drain pending resolve work, complete the deferred link-down and clear the WoL disable bit while retaining the stopped bit. This does not restart the PHY, reconfigure the MAC or bring its link up. Fixes: f97493657c63 ("net: phylink: add suspend/resume support") Signed-off-by: James Hilliard --- drivers/net/phy/phylink.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index a1458da8111b..8f9278112623 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2495,11 +2495,17 @@ EXPORT_SYMBOL_GPL(phylink_start); * * This will synchronously bring down the link if the link is not already * down (in other words, it will trigger a mac_link_down() method call.) + * It may also be called after phylink_suspend() if the MAC cannot resume + * and the network device must be closed instead. */ void phylink_stop(struct phylink *pl) { ASSERT_RTNL(); =20 + /* phylink_suspend() already stops the link without MAC WoL. */ + if (test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) + return; + if (pl->sfp_bus) sfp_upstream_stop(pl->sfp_bus); if (pl->phydev) @@ -2512,6 +2518,16 @@ void phylink_stop(struct phylink *pl) =20 phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); =20 + if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) { + /* Finish the link-down deferred by MAC WoL, without restarting. */ + flush_work(&pl->resolve); + mutex_lock(&pl->state_mutex); + if (pl->suspend_link_up) + phylink_link_down(pl); + __clear_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state); + mutex_unlock(&pl->state_mutex); + } + pl->pcs_state =3D PCS_STATE_DOWN; =20 phylink_pcs_disable(pl->pcs); --=20 2.53.0 From nobody Thu Sep 24 19:23:13 2026 Received: from mail-oo2-f41.google.com (mail-oo2-f41.google.com [74.125.231.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 848F24E06EA for ; Mon, 21 Sep 2026 16:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009650; cv=none; b=L6PG0U2v1ANfvIUPDjH3gFY8SltGXhnEmU1owiomxVM1mlNfoaeepv2e3H+1lEYxeJiXe9W+8Ge+POUJM8EPsjIO7zTZy+COjfvxX7IyYntvyjFjivMAII4dBtP5wcdJ8ORxhxpephKmHYJf/ip3DBfxnYo10UYi1usLwZDOS9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009650; c=relaxed/simple; bh=bWQ6pPswaesSyX3jvthXifBbTMag2VXIen957tS7Bj0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tvippH13btuYZFuvjBjKIV6vlWZ2PpOrJ+rhl4PI/tP0FwUjAIzR1d7O6Y32mea8Y1NGvtZX78sfUROYdogvqSf3IA/wfFAn8J7QhrFJ/QCOJfaRDPhPG0Vje3PBzyJUGVLKT/dKBgu/pLPNKeiwePiQ1fqnqiWtku612v+q9bM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ed+q52Qg; arc=none smtp.client-ip=74.125.231.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ed+q52Qg" Received: by mail-oo2-f41.google.com with SMTP id 006d021491bc7-6b1ae6c9b72so441415eaf.0 for ; Mon, 21 Sep 2026 09:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790009647; x=1790614447; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=PWAktAj8+a2EZgQ4kCGxOWW2beeBTXDV3b5mgoUzlt8=; b=ed+q52Qg5ZZSD9rMqA4+YPcezmvS0tMS07Bc3SEZTzDBy/qaM4CX44YEd1W160k1vy XUnGYq9B8ImZUogFErIKBaFqv2SheMp8XS8rhRTeenCVtgppEdvQFvhtCY4Hyo2dHTNm 8yEtoXKwWk+5JhJCseLR5MJOG4yZw550Sep2FRsQtQsHsTxf7/IS1VZqUybxAFd2nj4i 6RwUBmxmz0QH0YMC2uPA6WPbubjrr4EUBZ+kU3/mJOKrzrUZ565y63IVLx+CTG40j7LY jKg1va7/LN9MwGkH2oSlXbtnrZzBOre02AP81GMDuyYpbghZ4tjxR8Cw6WK4xMGcE83A cI9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790009647; x=1790614447; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PWAktAj8+a2EZgQ4kCGxOWW2beeBTXDV3b5mgoUzlt8=; b=N+uqVAEzxIbPCLXDqgmleAV0ZS9Dr5gEtelp3eTQk0OEeJmtJ/P8Xl4YN8N5GMSU/w lPZbUdG3SswMJfWwBwkkSqBxynYNLz+qza9c4m66WjoVtNfPbU91e5aEUZPK24qqEpsg jvCKDSUcH+ym8b/KNRDuOuqRZvlqh8SVksaGqWZr2/Zy1lls4hHRienI3KTGZeVQq7nS EozHMiyGOiNdZMaVxY3mCjweKAz0mJk/OK74KhQv7ufADcTY/HSDDaaec8cYOhqsFkyw qes+uzNMdRqeIE+EJJIBJgiQ6M70U7G4iArINDiA/aZ3xkXs8vIsTxxWydcZjgE1d+P/ iT+Q== X-Forwarded-Encrypted: i=1; AKwUvByvBTzJVjOzZnEJVD2ww/quWR9aYj4t7BN+5uav5mEflIjwhd7sS5GPewEMGTCEeI68D07PPWRFfxszXag=@vger.kernel.org X-Gm-Message-State: AFuF++lPqpdIxKMqpuXwkajvtNRug7ipaLp4BpEwD1P0Y7kAD/mENR6z L+pAQKV2MbGRbYL5GrFVwoKEwtFZkXlZusSgSKgv7eH51TdJyLaZlfU2 X-Gm-Gg: AYBFou2g6UkbNjNbknMhrJJouvLzxgYlBpqYvjjlMmhjJ9FzEXUfEqh+3XAUqh9hTpn 2lD4r7PFbOojdds857vpcMp3QhO6NUGcCC39wYXXATNcu2FuF/Vb2xEOzPvs6GuytRVnpTdaGdb DDullfm+t3xLAiScTWWJMaWycBuyKDZ2QsV+lEoPTUwtpaGVx956cx8z1BM1M2tNhTl9dlPPjax ysQtUi8ibYktK5jsajUkAJTeEsLSt3iif+MhOZCw/gRXp8VQzqyls+JEcEX+KwFq3rkdOQeK4BT zlMdX0E/Xj2zK9kRjnc3t1NftMHUvb7YKGfX9RD5e1aNOdWPB8wuIgx9CkI4mMmsuGbdk0/JzRh D3Al9cj2HpFsqsdHmwcx2cs7lh0OevYN+hLcWfo7HZWTaXWQJ5ccMEIbc7dX1z236AN31ux/G+E VFSAslAQqtO1UGrcvHnXRMvFLGoyfUne3lCe80GjI4zdYoZX0pSlV+i1TfeBrqxOU82odsjMJ76 18UQNyp5k8W6s+PaM4mK8XmB/nnA/xcD+gazHeQuN2wqT5V2HkpA6iDJsi3nwGGtYs81T4XTSL1 7i8WQqqvLqQswYlzDTd0TznUNJlkF6kHl7NMXv6FciKBckqxG7ZtUYn9k5byWZZKULJay/IAm0j FdpRR2Jvk0VwCX0eXa1HonQ== X-Received: by 2002:a05:6820:812:b0:6b5:ec3f:497d with SMTP id 006d021491bc7-6d15a65b6c9mr206525eaf.24.1790009646999; Mon, 21 Sep 2026 09:54:06 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6d145bc40e6sm510481eaf.5.2026.09.21.09.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 09:54:06 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 10:54:03 -0600 Subject: [PATCH net 2/3] net: stmmac: close the interface after a failed MTU reopen Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-submit-stmmac-reset-fixes-v1-v1-2-87a4e431ee00@gmail.com> References: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> In-Reply-To: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> To: Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Joakim Zhang , "Russell King (Oracle)" , Maxime Chevallier , Andrew Lunn , Maxime Coquelin , Alexandre Torgue , Christian Marangi , Tiezhu Yang , Huacai Chen Cc: Richard Genoud , Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.15.2 An MTU change stops the data path and then reopens it using a newly allocated DMA configuration. If reopening fails, the new allocation is freed while the netdev remains up and priv->dma_conf retains copies of the freed pointers. A subsequent close repeats NAPI disable and IRQ and DMA-resource teardown. It can hang in napi_disable() or access resources which have already been freed. Track successful opens of the data path separately from the netdev's administrative state. Clear that state when releasing the data path and skip a second release after a failed reopen. Close the netdev through the network core on the MTU error path, so the PHY attachment and runtime-PM reference are released and the interface is marked down. A subsequent open can then allocate fresh resources and retry normally. Keep successful MTU changes on the existing path, retaining the PHY attachment and runtime-PM reference. Allocation failures before stopping the original data path still leave the running interface unchanged. Fixes: 3470079687448 ("net: ethernet: stmicro: stmmac: permit MTU change wi= th interface up") Signed-off-by: James Hilliard --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/eth= ernet/stmicro/stmmac/stmmac.h index 7582fca63741..873331dbaf77 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -281,6 +281,8 @@ struct stmmac_priv { struct mutex lock; =20 struct stmmac_dma_conf dma_conf; + /* Paired __stmmac_open()/__stmmac_release(), serialized by RTNL. */ + bool opened; =20 /* Generic channel for NAPI */ struct stmmac_channel channel[STMMAC_CH_MAX]; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 1fb5f804ea23..44b59d0f56b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4179,6 +4179,7 @@ static int __stmmac_open(struct net_device *dev, stmmac_enable_all_queues(priv); netif_tx_start_all_queues(priv->dev); stmmac_enable_all_dma_irq(priv); + priv->opened =3D true; =20 return 0; =20 @@ -4249,6 +4250,11 @@ static void __stmmac_release(struct net_device *dev) struct stmmac_priv *priv =3D netdev_priv(dev); u8 chan; =20 + /* A failed MTU reopen has already released the data path. */ + if (!priv->opened) + return; + priv->opened =3D false; + /* Stop and disconnect the PHY */ phylink_stop(priv->phylink); =20 @@ -6174,6 +6180,10 @@ static int stmmac_change_mtu(struct net_device *dev,= int new_mtu) if (ret) { free_dma_desc_resources(priv, dma_conf); kfree(dma_conf); + /* Finish closing the PHY and PM state, but do not repeat + * the data-path teardown after the failed reopen. + */ + netif_close(dev); netdev_err(priv->dev, "failed reopening the interface after MTU change\= n"); return ret; } --=20 2.53.0 From nobody Thu Sep 24 19:23:13 2026 Received: from mail-oi2-f13.google.com (mail-oi2-f13.google.com [74.125.231.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69B094E0B86 for ; Mon, 21 Sep 2026 16:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009652; cv=none; b=FNomdwY+mZAg7RjUQe7EeYmGlpawjuhYkJ+4XOkhEt36d3HxpNFMnXPt6AKwKsCRbLb4chG2HUmLTFQrMcDoOGiBmdpMhBIhohHBg810x7ZM16WJ5NSFF8PRszx0M2kfy61kQTUrT5gNLEeV8XgH37JPbgvShaYOhAnzD9jrRlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790009652; c=relaxed/simple; bh=1qgx7WO1ODz0uzZ0PV4p/UIMKqQiae0iH1KRXidMcvY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UwzYxkwT/XFPu3OqkR8S0VQyxL7W1BLmxLYu8WMND4QbdORftJKW5J+i8Bg+K021ambde8ID8oNnFtXkk9lXpC0oEAKPlh1iMlze/cw295BcNVXKgT+qnW0JKXkXY/A7wZKqr85VSf1UZDDHS5tTQLDfrKcKn/+G7o4bMIhAg2Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TzRYSL0o; arc=none smtp.client-ip=74.125.231.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TzRYSL0o" Received: by mail-oi2-f13.google.com with SMTP id 46e09a7af769-804f7045f3eso1183612a34.2 for ; Mon, 21 Sep 2026 09:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790009648; x=1790614448; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tvfdmXPJ30DEketzEq5aXVKBwOS7ewPYMj6rBpY0hhM=; b=TzRYSL0o+MpnwNBRJpqqA0Jzs+X+BizeBR8Xs4t/NZDUnnjVj/IPAgy+bMB0mEaBjJ fFL1VPPamn21NLHMGuA1qas1GqibT8ksabxhUoWfniQBvynsJces+DeL157WMjxwoYiF yuE2QKY8/gvogRsntZabuP0YSmBQ8mge4BkYHLnTOjxfHYNz6J4jimucok2MSt48tKyI etnqLkaLRsdwlGUT21xHuENi3hfcLDsMWVd2tWHYA2CyJrIrWgg8JvRg6QxMlEH6Z1p3 TsvShJsG2gze47Us3D2zh1vB53JodlwmulORilbuiZ7dfaHbWWife/0dvvVi0Tn/bmZB WasA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790009648; x=1790614448; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tvfdmXPJ30DEketzEq5aXVKBwOS7ewPYMj6rBpY0hhM=; b=wZKzeBiBZKXP9D4tNVLhnfcuXiC1L/GRkyUDcOn/eIxtK3gpKxszKzuu6sRSPy2eYQ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Fws3Hq8SF6J9ljvmTS0TgXZUPDhRpkfKDsW5yFMiAg zBLMyvhKkFqPs5W9R70fTvCbo/Om6y2UNf4utaQYwDzkjlsxSNzk7fpFTKWiCufZBqF6kh8RkbQ RvuTq0chLMHX8iHCEHFbGfw== X-Received: by 2002:a05:6820:f00b:b0:6bd:760a:a8ce with SMTP id 006d021491bc7-6ca9d451e13mr9761450eaf.62.1790009648212; Mon, 21 Sep 2026 09:54:08 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6d145bc40e6sm510481eaf.5.2026.09.21.09.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 09:54:07 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 10:54:04 -0600 Subject: [PATCH net 3/3] net: stmmac: close the interface after failed hardware resume Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-submit-stmmac-reset-fixes-v1-v1-3-87a4e431ee00@gmail.com> References: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> In-Reply-To: <20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com> To: Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Joakim Zhang , "Russell King (Oracle)" , Maxime Chevallier , Andrew Lunn , Maxime Coquelin , Alexandre Torgue , Christian Marangi , Tiezhu Yang , Huacai Chen Cc: Richard Genoud , Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.15.2 System suspend disables NAPI and suspends phylink but retains the IRQs and DMA resources. If hardware setup fails during resume, the interface remains administratively up with NAPI still disabled. Closing it later calls napi_disable() a second time and can hang indefinitely. On hardware-setup failure, stop DMA and disable the MAC, then release the suspended data path without repeating NAPI disable. Stop phylink directly from its suspended state rather than restarting the link on hardware which failed to resume. Drop the driver mutex before teardown, retaining RTNL across cleanup and network-core close. Close the netdev to detach the PHY, release its runtime-PM reference and clear its administrative state. Reattach the now-down netdev so a later open can allocate new resources and retry. Preserve the original resume error and leave successful resume unchanged. Fixes: 6896c2449a18 ("net: stmmac: Check stmmac_hw_setup() in stmmac_resume= ()") Signed-off-by: James Hilliard --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 29 ++++++++++++++++---= ---- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 44b59d0f56b5..87cb0978ed6a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4245,7 +4245,7 @@ static int stmmac_open(struct net_device *dev) return ret; } =20 -static void __stmmac_release(struct net_device *dev) +static void __stmmac_release(struct net_device *dev, bool napi_disabled) { struct stmmac_priv *priv =3D netdev_priv(dev); u8 chan; @@ -4258,7 +4258,9 @@ static void __stmmac_release(struct net_device *dev) /* Stop and disconnect the PHY */ phylink_stop(priv->phylink); =20 - stmmac_disable_all_queues(priv); + /* Suspend has already disabled NAPI when hardware resume fails. */ + if (!napi_disabled) + stmmac_disable_all_queues(priv); =20 for (chan =3D 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); @@ -4297,7 +4299,7 @@ static int stmmac_release(struct net_device *dev) if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); =20 - __stmmac_release(dev); + __stmmac_release(dev, false); =20 stmmac_legacy_serdes_power_down(priv); phylink_disconnect_phy(priv->phylink); @@ -6174,7 +6176,7 @@ static int stmmac_change_mtu(struct net_device *dev, = int new_mtu) return PTR_ERR(dma_conf); } =20 - __stmmac_release(dev); + __stmmac_release(dev, false); =20 ret =3D __stmmac_open(dev, dma_conf); if (ret) { @@ -8356,10 +8358,7 @@ int stmmac_resume(struct device *dev) ret =3D stmmac_hw_setup(ndev); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); - stmmac_legacy_serdes_power_down(priv); - mutex_unlock(&priv->lock); - rtnl_unlock(); - return ret; + goto error_stop_dma; } =20 stmmac_init_timestamping(priv); @@ -8386,6 +8385,20 @@ int stmmac_resume(struct device *dev) netif_device_attach(ndev); =20 return 0; + +error_stop_dma: + stmmac_stop_all_dma(priv); + stmmac_mac_set(priv, priv->ioaddr, false); + mutex_unlock(&priv->lock); + /* Release the suspended data path before ndo_stop(), which must not + * disable NAPI or free these resources a second time. + */ + __stmmac_release(ndev, true); + netif_close(ndev); + netif_device_attach(ndev); + rtnl_unlock(); + + return ret; } EXPORT_SYMBOL_GPL(stmmac_resume); =20 --=20 2.53.0