]> git.ipfire.org Git - thirdparty/openwrt.git/blob
5f66869ef374ccbc899c57b74c303d9ab5496f08
[thirdparty/openwrt.git] /
1 From c6fec66d3cd76d797f70b30f1511bed10ba45a96 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 24 Nov 2023 12:28:29 +0000
4 Subject: [PATCH 5/7] net: phylink: pass PHY into phylink_validate_mask()
5
6 Pass the phy (if any) into phylink_validate_mask() so that we can
7 validate each interface with its rate matching setting.
8
9 Tested-by: Luo Jie <quic_luoj@quicinc.com>
10 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Link: https://lore.kernel.org/r/E1r6VIL-00DDM3-HJ@rmk-PC.armlinux.org.uk
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 ---
15 drivers/net/phy/phylink.c | 11 +++++++----
16 1 file changed, 7 insertions(+), 4 deletions(-)
17
18 --- a/drivers/net/phy/phylink.c
19 +++ b/drivers/net/phy/phylink.c
20 @@ -734,7 +734,8 @@ static void phylink_validate_one(struct
21 }
22 }
23
24 -static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
25 +static int phylink_validate_mask(struct phylink *pl, struct phy_device *phy,
26 + unsigned long *supported,
27 struct phylink_link_state *state,
28 const unsigned long *interfaces)
29 {
30 @@ -743,7 +744,7 @@ static int phylink_validate_mask(struct
31 int interface;
32
33 for_each_set_bit(interface, interfaces, PHY_INTERFACE_MODE_MAX)
34 - phylink_validate_one(pl, NULL, supported, state, interface,
35 + phylink_validate_one(pl, phy, supported, state, interface,
36 all_s, all_adv);
37
38 linkmode_copy(supported, all_s);
39 @@ -758,7 +759,8 @@ static int phylink_validate(struct phyli
40 const unsigned long *interfaces = pl->config->supported_interfaces;
41
42 if (state->interface == PHY_INTERFACE_MODE_NA)
43 - return phylink_validate_mask(pl, supported, state, interfaces);
44 + return phylink_validate_mask(pl, NULL, supported, state,
45 + interfaces);
46
47 if (!test_bit(state->interface, interfaces))
48 return -EINVAL;
49 @@ -3194,7 +3196,8 @@ static int phylink_sfp_config_optical(st
50 /* For all the interfaces that are supported, reduce the sfp_support
51 * mask to only those link modes that can be supported.
52 */
53 - ret = phylink_validate_mask(pl, pl->sfp_support, &config, interfaces);
54 + ret = phylink_validate_mask(pl, NULL, pl->sfp_support, &config,
55 + interfaces);
56 if (ret) {
57 phylink_err(pl, "unsupported SFP module: validation with support %*pb failed\n",
58 __ETHTOOL_LINK_MODE_MASK_NBITS, support);