openwrt/target/linux/generic/backport-6.6/895-04-v6.8-net-phylink-pass-PHY-into-phylink_validate_one.patch

48 lines
1.8 KiB
Diff
Raw Normal View History

From ce7273c31fadb3143fc80c96a72a42adc19c2757 Mon Sep 17 00:00:00 2001
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Date: Fri, 24 Nov 2023 12:28:24 +0000
Subject: [PATCH 4/7] net: phylink: pass PHY into phylink_validate_one()
Pass the phy (if any) into phylink_validate_one() so that we can
validate each interface with its rate matching setting.
Tested-by: Luo Jie <quic_luoj@quicinc.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/E1r6VIG-00DDLx-Cb@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/phy/phylink.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -704,7 +704,7 @@ static int phylink_validate_mac_and_pcs(
return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
}
-static void phylink_validate_one(struct phylink *pl,
+static void phylink_validate_one(struct phylink *pl, struct phy_device *phy,
const unsigned long *supported,
const struct phylink_link_state *state,
phy_interface_t interface,
@@ -719,6 +719,9 @@ static void phylink_validate_one(struct
tmp_state = *state;
tmp_state.interface = interface;
+ if (phy)
+ tmp_state.rate_matching = phy_get_rate_matching(phy, interface);
+
if (!phylink_validate_mac_and_pcs(pl, tmp_supported, &tmp_state)) {
phylink_dbg(pl, " interface %u (%s) rate match %s supports %*pbl\n",
interface, phy_modes(interface),
@@ -740,7 +743,7 @@ static int phylink_validate_mask(struct
int interface;
for_each_set_bit(interface, interfaces, PHY_INTERFACE_MODE_MAX)
- phylink_validate_one(pl, supported, state, interface,
+ phylink_validate_one(pl, NULL, supported, state, interface,
all_s, all_adv);
linkmode_copy(supported, all_s);