Skip to content

Commit b7014f9

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: pass PHY into phylink_validate_mask()
Pass the phy (if any) into phylink_validate_mask() 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/E1r6VIL-00DDM3-HJ@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 385e72b commit b7014f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/phy/phylink.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ static void phylink_validate_one(struct phylink *pl, struct phy_device *phy,
719719
}
720720
}
721721

722-
static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
722+
static int phylink_validate_mask(struct phylink *pl, struct phy_device *phy,
723+
unsigned long *supported,
723724
struct phylink_link_state *state,
724725
const unsigned long *interfaces)
725726
{
@@ -728,7 +729,7 @@ static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
728729
int interface;
729730

730731
for_each_set_bit(interface, interfaces, PHY_INTERFACE_MODE_MAX)
731-
phylink_validate_one(pl, NULL, supported, state, interface,
732+
phylink_validate_one(pl, phy, supported, state, interface,
732733
all_s, all_adv);
733734

734735
linkmode_copy(supported, all_s);
@@ -743,7 +744,8 @@ static int phylink_validate(struct phylink *pl, unsigned long *supported,
743744
const unsigned long *interfaces = pl->config->supported_interfaces;
744745

745746
if (state->interface == PHY_INTERFACE_MODE_NA)
746-
return phylink_validate_mask(pl, supported, state, interfaces);
747+
return phylink_validate_mask(pl, NULL, supported, state,
748+
interfaces);
747749

748750
if (!test_bit(state->interface, interfaces))
749751
return -EINVAL;
@@ -3179,7 +3181,8 @@ static int phylink_sfp_config_optical(struct phylink *pl)
31793181
/* For all the interfaces that are supported, reduce the sfp_support
31803182
* mask to only those link modes that can be supported.
31813183
*/
3182-
ret = phylink_validate_mask(pl, pl->sfp_support, &config, interfaces);
3184+
ret = phylink_validate_mask(pl, NULL, pl->sfp_support, &config,
3185+
interfaces);
31833186
if (ret) {
31843187
phylink_err(pl, "unsupported SFP module: validation with support %*pb failed\n",
31853188
__ETHTOOL_LINK_MODE_MASK_NBITS, support);

0 commit comments

Comments
 (0)