diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-11-27 12:12:49 +0000 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-06-21 10:57:43 +0100 |
commit | 73ff81f12583aff87c20984d2e8291198132a172 (patch) | |
tree | 18a3c31cfc47dab17b249f81738254e869a1897c | |
parent | 4b36015671ffabc3a8ff61c4f45e41f456707be1 (diff) |
net: phylink: allow PCS to override MAC validation
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/net/phy/phylink.c | 3 | ||||
-rw-r--r-- | include/linux/phylink.h | 9 |
2 files changed, 11 insertions, 1 deletions
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); |