From 73ff81f12583aff87c20984d2e8291198132a172 Mon Sep 17 00:00:00 2001 From: "Russell King (Oracle)" Date: Sat, 27 Nov 2021 12:12:49 +0000 Subject: net: phylink: allow PCS to override MAC validation Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 3 +++ include/linux/phylink.h | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a4305a07285..bdadeafc6477 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -473,6 +473,9 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl, */ linkmode_and(state->advertising, state->advertising, supported); + + if (ret == PCS_VALIDATE_RATEADAPT) + return 0; } } diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 9d4a57529d9d..10c0d4728391 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -21,6 +21,11 @@ enum { MLO_AN_FIXED, /* Fixed-link mode */ MLO_AN_INBAND, /* In-band protocol */ + /* pcs_validate() return values */ + PCS_VALIDATE_FAIL = -EINVAL, /* Failed */ + PCS_VALIDATE_PASS = 0, /* Passed */ + PCS_VALIDATE_RATEADAPT = 1, /* Passed with rate adaption at PCS */ + MAC_SYM_PAUSE = BIT(0), MAC_ASYM_PAUSE = BIT(1), MAC_10HD = BIT(2), @@ -460,7 +465,9 @@ struct phylink_pcs_ops { * &struct phylink_mac_ops validate() method. * * Returns -EINVAL if the interface mode/autoneg mode is not supported. - * Returns non-zero positive if the link state can be supported. + * Returns non-zero positive if the link state can be supported and does + * not depend on the MAC. + * Returns 0 if the link state can be supported but does depend on the MAC. */ int pcs_validate(struct phylink_pcs *pcs, unsigned long *supported, const struct phylink_link_state *state); -- cgit