Netdev List
 help / color / mirror / Atom feed
From: "François-Xavier Gsell" <fxgsell@gmail.com>
To: intel-wired-lan@lists.osuosl.org,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: netdev@vger.kernel.org, "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"François-Xavier Gsell" <fxgsell@gmail.com>
Subject: [PATCH iwl-net 2/2] igb: restore hw_addr on resume after a failed register read
Date: Sat,  5 Dec 2026 19:37:10 +0800	[thread overview]
Message-ID: <20261205113710.1833153-3-fxgsell@gmail.com> (raw)
In-Reply-To: <20261205113710.1833153-1-fxgsell@gmail.com>

igb_rd32() sets hw->hw_addr to NULL when a register read returns
all-ones, after which every register access is a no-op. __igb_resume()
restores PCI state and re-attaches the netdev but never restores
hw_addr, so an adapter that saw a single failed read stays unusable
across suspend/resume while appearing attached. Only
igb_io_slot_reset() restores it today.

Restore hw_addr once the device is known to be present, as
ixgbe_resume() does. igc has the same problem and gets the same fix.

A similar change was discussed for igb in 2016, when a register read
during suspend triggered the detach, and was not merged because that
read was the real bug. Here the failure happens while the device is
running and powered, so there is no stray access to fix; the device
needs a path back once it is reachable again.

Written with the help of an AI coding assistant (Claude Opus 5.5),
which drafted the patch and this message. Compile-tested only.

Fixes: 22a8b2915998 ("igb: add register rd/wr for surprise removal")
Signed-off-by: François-Xavier Gsell <fxgsell@gmail.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 131df3e09ba1..3667a86df248 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -9607,6 +9607,10 @@ static int __igb_resume(struct device *dev, bool rpm)
 
 	if (!pci_device_is_present(pdev))
 		return -ENODEV;
+
+	/* A failed register read may have cleared hw_addr. */
+	hw->hw_addr = adapter->io_addr;
+
 	err = pci_enable_device_mem(pdev);
 	if (err) {
 		dev_err(&pdev->dev,
-- 
2.56.1


      parent reply	other threads:[~2026-12-05 11:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 11:37 [PATCH iwl-net 0/2] igc/igb: recover register access on resume François-Xavier Gsell
2026-12-05 11:37 ` [PATCH iwl-net 1/2] igc: restore hw_addr on resume after a failed register read François-Xavier Gsell
2026-12-05 11:37 ` François-Xavier Gsell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205113710.1833153-3-fxgsell@gmail.com \
    --to=fxgsell@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox