linux/drivers/net/ethernet/intel
En-Wei Wu a78e04e023 igc: return early when failing to read EECD register
[ Upstream commit bd2776e39c ]

When booting with a dock connected, the igc driver may get stuck for ~40
seconds if PCIe link is lost during initialization.

This happens because the driver access device after EECD register reads
return all F's, indicating failed reads. Consequently, hw->hw_addr is set
to NULL, which impacts subsequent rd32() reads. This leads to the driver
hanging in igc_get_hw_semaphore_i225(), as the invalid hw->hw_addr
prevents retrieving the expected value.

To address this, a validation check and a corresponding return value
catch is added for the EECD register read result. If all F's are
returned, indicating PCIe link loss, the driver will return -ENXIO
immediately. This avoids the 40-second hang and significantly improves
boot time when using a dock with an igc NIC.

Log before the patch:
[    0.911913] igc 0000:70:00.0: enabling device (0000 -> 0002)
[    0.912386] igc 0000:70:00.0: PTM enabled, 4ns granularity
[    1.571098] igc 0000:70:00.0 (unnamed net_device) (uninitialized): PCIe link lost, device now detached
[   43.449095] igc_get_hw_semaphore_i225: igc 0000:70:00.0 (unnamed net_device) (uninitialized): Driver can't access device - SMBI bit is set.
[   43.449186] igc 0000:70:00.0: probe with driver igc failed with error -13
[   46.345701] igc 0000:70:00.0: enabling device (0000 -> 0002)
[   46.345777] igc 0000:70:00.0: PTM enabled, 4ns granularity

Log after the patch:
[    1.031000] igc 0000:70:00.0: enabling device (0000 -> 0002)
[    1.032097] igc 0000:70:00.0: PTM enabled, 4ns granularity
[    1.642291] igc 0000:70:00.0 (unnamed net_device) (uninitialized): PCIe link lost, device now detached
[    5.480490] igc 0000:70:00.0: enabling device (0000 -> 0002)
[    5.480516] igc 0000:70:00.0: PTM enabled, 4ns granularity

Fixes: ab40561268 ("igc: Add NVM support")
Cc: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Signed-off-by: En-Wei Wu <en-wei.wu@canonical.com>
Reviewed-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-01-17 13:36:13 +01:00
..
e1000 intel: legacy: field get conversion 2024-04-10 16:35:56 +02:00
e1000e e1000e: Remove Meteor Lake SMBUS workarounds 2024-11-14 13:19:31 +01:00
fm10k intel: legacy: field get conversion 2024-04-10 16:35:56 +02:00
i40e i40e: fix race condition by adding filter's intermediate sync state 2024-11-14 13:19:31 +01:00
iavf iavf: Fix TC config comparison with existing adapter TC config 2024-05-02 16:32:40 +02:00
ice ice: fix incorrect PHY settings for 100 GB/s 2025-01-17 13:36:13 +01:00
igb igb: Fix potential invalid memory access in igb_init_module() 2024-12-14 19:59:38 +01:00
igbvf intel: legacy: field get conversion 2024-04-10 16:35:56 +02:00
igc igc: return early when failing to read EECD register 2025-01-17 13:36:13 +01:00
ixgbe ixgbe: downgrade logging of unsupported VF API version to debug 2024-12-14 19:59:38 +01:00
ixgbevf ixgbevf: stop attempting IPSEC offload on Mailbox API 1.5 2024-12-14 19:59:38 +01:00
e100.c e100: Fix possible use after free in e100_xmit_prepare 2022-11-23 08:38:22 -08:00
Kconfig ixgb: Remove ixgb driver 2023-03-19 10:51:07 +00:00
Makefile ixgb: Remove ixgb driver 2023-03-19 10:51:07 +00:00