From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 BD94E4A8A13 for ; Thu, 24 Sep 2026 17:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790271879; cv=none; b=sSFrwm9LrBkEl7iki2ZVPfbTCQN31XRTuGO1KddH2jrA7pAfSYtjamiyMlM8LngfC4+N63vyFIH9NumulizFjB5x+6d8MN+GwZipZIAmDESmvUQ59xLkUa4dag3Ntop0gDViRS33MP4KYzayL63VMP8pKwPVuyZnbxPE1pCpFBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790271879; c=relaxed/simple; bh=7XmKKcJx3+9gJOrs3+82dw4o/KYQ1Xfg/FTkZC0fgig=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=hUr2YZlpgvrjomBUmaHdbVxerXr00IEOoCjojU5e5Hu9gZ6c5YfnaGyvGyz/u2G95gZ6dN3UXt3xTGAR4jZge9ktuBDysw0BluwhoQI+E/LFccDOwDdGJw9p13Mu01Q5Nd5jOxr1tEh0YVxx1KRYNf9qVaH6dccpf9nh3OIM6bI= 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=azfct/tU; arc=none smtp.client-ip=209.85.161.48 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="azfct/tU" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-6c8f6a53fabso1008740eaf.1 for ; Thu, 24 Sep 2026 10:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790271875; x=1790876675; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=m/yuadhswZztFZIXp8O1C3rG4scLLGx4YqdmEAm1GxE=; b=azfct/tUP8UKAlCNTtkHerRTzmzo5baoL+tG/sYCUY6g3BgLF3Clq1k8S/J0OnM79i iA5zlArFpHfJg2fZBM6kbhKV1g4MEMrcg9Ci2Ku9tjwM7KsB07t26p1kFvjOYe39kFrZ 2N+TA8azK463/mWRZoIaYT6VRshc6PdvN2FfY4JbEPNNOBcQa6Bli+k4SktM3VQVCzSH SFnjfYDgqFsfg2MEqcu6VbHxkl2vSNM5fmy8XTTdHjx/4XGX0KIY1jMuS7Ys+XP6yjzi F7c3iy5cdNkDWiQFQyUHKJGhMkt9+hnuY9m2wzrZPVawc0X35wGRya8y0mLRJSXYW2qG czwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790271875; x=1790876675; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=m/yuadhswZztFZIXp8O1C3rG4scLLGx4YqdmEAm1GxE=; b=0WnhcWx0fNlCs7VPWvmheRTzBeytX7mRUVE7z10AARFfGZy0v+LHmYIqDUhvLflpbO u2MYoQmxtuPqVsXVEQ+zDjdAnYg6PspFMaMvsddRT7LzWK6MEcjE8xrX1kQQ2te1zulF yljw+hvCYnyAg48lbr/QrQUuClICCfpXj+Nho4hmex58EJBO3bq8yHDPa3NfkXcwDlxf jtmDS1ST3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received: by 2002:a05:6820:162a:b0:6b1:9b72:213c with SMTP id 006d021491bc7-6d43eedd850mr2506187eaf.3.1790271875445; Thu, 24 Sep 2026 10:44:35 -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 586e51a60fabf-491e8f8d14asm3027802fac.0.2026.09.24.10.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 10:44:34 -0700 (PDT) From: James Hilliard Subject: [PATCH net v3 00/10] net: stmmac: preserve datapath state across MTU and resume failures Date: Thu, 24 Sep 2026 11:44:30 -0600 Message-Id: <20260924-submit-stmmac-reset-fixes-v1-v3-0-c031e3f3a282@gmail.com> 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: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/43OwQ6CMAwG4FchPTuzFQLMk+9hPIxRZcaB2eaiI by7Y164adJL2z9fO4MnZ8jDoZjBUTTeTGNqyl0BelDjlZjpUw/IseYSBfPPzprAfLBWaebIU2A X8yLPomCNlm0nsUepJCTi4SjvknCCkQKcv8OE3EiHFV5jg/Fhcu/8RBQ5/N+9VJy1jaqoKgUR5 8erVea+15PNpyJuMfyBYcJ6iZSyHUlZb7FlWT6VZXt+LAEAAA== X-Change-ID: 20260921-submit-stmmac-reset-fixes-v1-7c98b92d29a9 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 , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Serge Semin , Suraj Jaiswal , Richard Cochran , Joao Pinto , Vladimir Oltean , Ong Boon Leong , Voon Weifeng , "Song, Yoong Siang" Cc: Richard Genoud , Alastair D'Silva , Maxime Ripard , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, ZhaoJinming , Lorenzo Bianconi , Ding Hui , James Hilliard X-Mailer: b4 0.15.2 Keep the stmmac datapath coherent after failed MTU changes or hardware resume without changing the interface's administrative state. Retain the working MTU configuration for rollback, and allow ordinary down/up recovery when hardware cannot be restored. The ten patches separate ownership and recovery fixes from the MTU transaction: 1. Correct the WoL/safety IRQ unwind order after failed IRQ registration. 2. Allow phylink_stop() to finish a suspended instance, restoring PHY advertisement reduced by suspend without restarting the failed MAC. 3. Track datapath ownership separately from administrative and hardware sleep state. Close and PM perform only the work still outstanding. 4. Leave normal-size MTU changes running, including supported AF_XDP MTUs. 5. Make partial DMA allocation unwind complete and leave freed queues empty. 6. Keep DMA configurations at stable addresses, use persistent IRQ contexts, and drain timer producers before the final cancellation. 7. Track live XDP release/reopen and propagate program-attach failures. 8. Use that tracked restart for AF_XDP pool changes, handling failures without leaving NAPI active over missing buffers or unmapping live pools. 9. Retain PHY and runtime-PM ownership during ethtool ring/channel reopening. 10. Retain rings and IRQ registrations across jumbo MTU replacement, restoring the old MTU and rings if hardware setup fails. The ownership states remain distinct: DOWN has no datapath allocations; RUNNING has active queues; SUSPENDED retains rings and IRQs; HALTED retains rings but has released IRQs after failed MTU rollback. Collapsing the last two states would make close free IRQs which it no longer owns. Jumbo rollback allocates no new buffers or IRQ registrations. RX holes are filled before reset without changing the old descriptors; descriptors are rebuilt or retired only after reset succeeds. If rollback also fails, the interface remains detached until down/up recovery. This cannot guarantee recovery from indefinitely failing hardware. Failed interfaces still receive hardware/PHY sleep handling. A failed datapath with MAC WoL configured rejects suspend with -EBUSY because its wake path is unusable; PHY-only WoL is not rejected. Timestamp filters and PHC registration survive an MTU change, but continuous PHC time across the hardware reset is not preserved. Live XDP and ethtool failures leave the administratively-up interface detached for ordinary down/up recovery. Program attachment failures return an error without consuming the proposed program. BPF-link and XSK-pool removal still complete if their datapath restart fails, so teardown can release the program or pool safely. AF_XDP pool reconfiguration now pauses all queues and link resolution while rebuilding the rings; this trades reconfiguration latency for one consistent ownership and failure path. Signed-off-by: James Hilliard --- Changes in v3: - Snapshot debugfs queue counts under RTNL with the descriptor ownership check, so a reader blocked behind channel shrink uses the new topology. - Complete pending core sleep state during close and retry restoration on open after runtime-PM acquisition. Use the installed wake state rather than mutable WoL settings, and retain the pending marker if restoration fails. - Put the independent IRQ unwind fix first, ahead of the ownership changes. - Correct the WoL/safety IRQ unwind order, fixing a repeated safety IRQ free and a leaked WoL handler. - Account for live XDP release/reopen in datapath ownership. Stop DMA on late IRQ failure, propagate program-attach errors without losing program references, and allow BPF-link removal to complete after restart failure. - Replace the void AF_XDP queue-enable helpers with the tracked XDP restart. Unmap a removed pool only after freeing its rings, undo failed pool attachment, and preserve TBS configuration while rebuilding the channels. - Keep PHY/PM ownership across ethtool ring/channel changes, restoring the old configuration after failed reopening and leaving the interface detached for down/up recovery without a second runtime-PM put. Explicitly disable the MAC during release even when link resolution has not reached mac_link_up(). - Split the MTU work into normal-size MTU handling, allocation unwind, stable DMA/IRQ ownership (including timer lifetime), and the retained-ring transaction. Keep the ownership change and its open/error-path adaptations in the same patch. - Restore the PHY advertisement reduced by phylink_suspend() when stopping a suspended instance, without restarting or reconfiguring the MAC, in response to Andrew Lunn. - Keep suspend-owned PHY speed control separate from explicit driver speed-down requests, so close-time power saving does not overwrite the original advertisement and remains effective until the matching speed-up. - Suspend a stopped PHY powered back up by phylink_prepare_resume() when stopping after a failed MAC resume, without repeating phy_stop(). - Add a separate MTU transaction patch retaining old DMA resources and IRQ registrations until replacement succeeds, following Andrew Lunn's request to keep the old setup for failure recovery. - Keep DMA configuration objects at stable addresses and use persistent channel objects for per-queue interrupt contexts. - Drain transmitters and post-completion NAPI poll tails before cancelling TX timers. - Avoid resetting normal-size MTU changes, including all supported AF_XDP MTUs, and stop rebinding live pools through temporary RXQ objects. - Program the new MAC receive limit before activation and restore the old MTU on failure; refill old RX buffer holes before reset so rollback does not require allocation. - Preserve coalescing, TBS state, PHC registration and timestamp filters; leave a failed rollback detached with old rings retained for close. - Harden partial-allocation unwind. - Separate core sleep completion from datapath ownership so failed MTU and resume paths still receive hardware PM handling, without disabling NAPI twice or restarting released queues. Address the skipped-suspend issue reported by Sashiko; reject an unusable MAC WoL path with -EBUSY. - Balance platform noirq PTP clock handling against resources still owned after detached XDP cleanup. - Link to v2: https://patch.msgid.link/20260922-submit-stmmac-reset-fixes-v1-v2-0-d92e609be996@gmail.com Changes in v2: - Drop forced netif_close() and retain the interface's administrative state, as requested by Maxime Chevallier. - Separate queue quiescence from resource release and use explicit datapath state instead of a napi_disabled argument to the release helper. - Handle repeated suspend/resume after failure, preserve PHY/PM ownership until ordinary close, and allow a fresh down/up recovery. - Check XDP/AF_XDP cleanup, descriptor readback and asynchronous reset work while the netdev is administratively up but unavailable. - Explain the generic phylink suspend-to-stop transition and why restarting phylink after a failed MAC resume is not a valid substitute, in response to Andrew Lunn. - Combine the two stmmac error-path fixes so every user of the new state has consistent resource and NAPI lifetime handling in one patch. - Link to v1: https://patch.msgid.link/20260921-submit-stmmac-reset-fixes-v1-v1-0-87a4e431ee00@gmail.com To: Maxime Chevallier To: Andrew Lunn To: "David S. Miller" To: Eric Dumazet To: Jakub Kicinski To: Paolo Abeni To: Maxime Coquelin To: Alexandre Torgue To: Serge Semin To: Suraj Jaiswal To: Russell King To: Andrew Lunn To: Heiner Kallweit To: Joakim Zhang To: "Russell King (Oracle)" To: Alexei Starovoitov To: Daniel Borkmann To: Jesper Dangaard Brouer To: John Fastabend To: Stanislav Fomichev To: Richard Cochran To: Christian Marangi To: Tiezhu Yang To: Huacai Chen To: Joao Pinto To: Vladimir Oltean To: Ong Boon Leong To: Voon Weifeng To: "Song, Yoong Siang" Cc: netdev@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: bpf@vger.kernel.org --- James Hilliard (10): net: stmmac: unwind the WoL IRQ after a safety IRQ request failure net: phylink: allow stopping a suspended instance net: stmmac: keep datapath state coherent after reinitialization failure net: stmmac: leave the datapath running for normal-size MTU changes net: stmmac: unwind partially allocated DMA configurations net: stmmac: keep DMA configurations at stable addresses net: stmmac: account for failed live XDP reopening net: stmmac: use the tracked datapath restart for XSK pool changes net: stmmac: retain PHY and PM ownership during ethtool reopening net: stmmac: retain DMA resources across MTU changes drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 6 +- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 21 +- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1036 +++++++++++++------- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 19 +- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 8 +- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c | 83 +- drivers/net/phy/phylink.c | 51 +- 10 files changed, 815 insertions(+), 423 deletions(-) --- base-commit: 8e1937fed6738460554ec123c64839e2445e7d53 change-id: 20260921-submit-stmmac-reset-fixes-v1-7c98b92d29a9 Best regards, -- James Hilliard