on 2023/7/31 17:10, Jijie Shao wrote:
What PHY driver is this?
It is not so clear what should actually happen with auto-neg turned off. With it on, and the link going down, the PHY should react after about 1 second. It is not supposed to react faster than that, although some PHYs allow fast link down notification to be configured.
Have you checked 802.3 to see what it says about auto-neg off and link down detection?
I personally would not suppress this behaviour in the MAC driver. Otherwise you are going to have funny combinations of special cases of a feature which very few people actually use, making your maintenance costs higher.
Andrew
Hi Andrew, We trace how the PHY state machine changed and show as followed:
[ 1974.220847][ T362] hns3 0000:35:00.0 eth1: set link(phy): autoneg=0, speed=100, duplex=1 [ 1974.233694][ T362] hns3 0000:35:00.0 eth1: link down [ 1974.267444][ T32] RTL8211F Gigabit Ethernet mii-0000:35:00.0:02: PHY state change UP -> RUNNING [ 1974.892830][ T7] hns3 0000:35:00.0 eth1: link up [ 2004.277425][ T32] RTL8211F Gigabit Ethernet mii-0000:35:00.0:02: PHY state change RUNNING -> NOLINK [ 2004.797731][ T7] hns3 0000:35:00.0 eth1: link down
Meanwhile, we also open tracing event about mdio and here are some useful logs:
kworker/1:0-19 [001] .... 1973.329775: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x00 val:0x1040 kworker/1:0-19 [001] .... 1973.331964: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x01 val:0x79ad kworker/2:1-32 [002] .... 1974.247627: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x00 val:0x1040 kworker/2:1-32 [002] .... 1974.249870: mdio_access: mii-0000:35:00.0 write phy:0x02 reg:0x00 val:0x2100 kworker/2:1-32 [002] .... 1974.252069: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x00 val:0x2100 kworker/2:1-32 [002] .... 1974.254143: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x01 val:0x798d .... kworker/2:1-32 [002] .... 2003.240015: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x01 val:0x798d .... kworker/2:1-32 [002] .... 2004.269525: mdio_access: mii-0000:35:00.0 read phy:0x02 reg:0x01 val:0x7989
As you can see, the link state changed after 30 seconds when only setting autoneg off. When the BMSR changed, the PHY driver change state immediately. This patch wants to fixed the first link down up showed on logs cause the link do not changed.
Regards Jijie Shao