]> git.ipfire.org Git - thirdparty/linux.git/commit
net: phy: phy_caps: Don't skip better duplex macth on non-exact match
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Fri, 6 Jun 2025 09:43:20 +0000 (11:43 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Jun 2025 15:00:53 +0000 (08:00 -0700)
commitd4e6cb324dcc952618fec6b25aa3fc7bfc2750b4
tree5c8934d36976db891d242bd83cf7f6cf4b407af0
parent27cea0e419d2f9dc6f51bbce5a44c70bc3774b9a
net: phy: phy_caps: Don't skip better duplex macth on non-exact match

When performing a non-exact phy_caps lookup, we are looking for a
supported mode that matches as closely as possible the passed speed/duplex.

Blamed patch broke that logic by returning a match too early in case
the caller asks for half-duplex, as a full-duplex linkmode may match
first, and returned as a non-exact match without even trying to mach on
half-duplex modes.

Reported-by: Jijie Shao <shaojijie@huawei.com>
Closes: https://lore.kernel.org/netdev/20250603102500.4ec743cf@fedora/T/#m22ed60ca635c67dc7d9cbb47e8995b2beb5c1576
Tested-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Fixes: fc81e257d19f ("net: phy: phy_caps: Allow looking-up link caps based on speed and duplex")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20250606094321.483602-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_caps.c