Skip to content

Commit 165ae7a

Browse files
khfengJeff Kirsher
authored and
Jeff Kirsher
committed
igb: Report speed and duplex as unknown when device is runtime suspended
igb device gets runtime suspended when there's no link partner. We can't get correct speed under that state: $ cat /sys/class/net/enp3s0/speed 1000 In addition to that, an error can also be spotted in dmesg: [ 385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost Since device can only be runtime suspended when there's no link partner, we can skip reading register and let the following logic set speed and duplex with correct status. The more generic approach will be wrap get_link_ksettings() with begin() and complete() callbacks. However, for this particular issue, begin() calls igb_runtime_resume() , which tries to rtnl_lock() while the lock is already hold by upper ethtool layer. So let's take this approach until the igb_runtime_resume() no longer needs to hold rtnl_lock. CC: stable <[email protected]> Suggested-by: Alexander Duyck <[email protected]> Signed-off-by: Kai-Heng Feng <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 14ec06b commit 165ae7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/intel/igb/igb_ethtool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ static int igb_get_link_ksettings(struct net_device *netdev,
143143
u32 speed;
144144
u32 supported, advertising;
145145

146-
status = rd32(E1000_STATUS);
146+
status = pm_runtime_suspended(&adapter->pdev->dev) ?
147+
0 : rd32(E1000_STATUS);
147148
if (hw->phy.media_type == e1000_media_type_copper) {
148149

149150
supported = (SUPPORTED_10baseT_Half |

0 commit comments

Comments
 (0)