Skip to content

Conversation

@torlye
Copy link

@torlye torlye commented Feb 23, 2025

This fixes an issue I reproduced with my TRENDnet TEG-10GECTX v2.0R and the driver from branch release/linux-6.7.y-1 running on Linux 6.8.

This card has Device ID 4027, Subsystem Device ID 3015.

With my card; the for loop in bdx_mdio_scan_phy_id completes on the very first iteration, which means the resulting value of i is 0, which is then assigned to priv->phy_mdio_port.

When the port is set to 0, the if condition !priv->phy_mdio_port is true in bdx_phy_init, which results in an immediate return and failed detection of the PHY.

If I understand correctly, there may be up to 32 MDIO ports, but these are represented as values 0 to 31 in phy_mdio_port. Thus 0 is a valid port and should not result in a failure.

I changed the if condition in question to use the return value of bdx_mdio_scan_phy_id instead. This value is 0 when the for loop has completed 32 iterations without finding a PHY.

I also found that the call to priv->phy_ops.mdio_reset on line 463 was hard-coded to use a port number of 1 rather than the detected port number stored in phy_mdio_port. Adjusted the same.

The driver initialization completes successfully with these changes in my own testing.

Copy link

@kalvdans kalvdans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me! (I have no merge rights)

@DatPat
Copy link

DatPat commented Feb 23, 2025

I discovered this issue a while ago and did the very same thing. This definitely fixed the driver on my card.

@NF117
Copy link

NF117 commented Aug 1, 2025

I tested the pull request with my network adapter. It fix the problem. Please merge to master
@torlye thank you very much for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants