[net-next,v4,01/11] net: phylink: publish ethtool link modes that supported and advertised
Commit Message
Adding the allow_switch_interface flag to publish all the ethtool
link modes that can be supported and advertised.
This will allow the interface switching based on different ethtool
link modes.
Signed-off-by: Choong Yong Liang <yong.liang.choong@linux.intel.com>
---
drivers/net/phy/phylink.c | 9 +++++----
include/linux/phylink.h | 1 +
2 files changed, 6 insertions(+), 4 deletions(-)
@@ -1839,10 +1839,11 @@ static int phylink_validate_phy(struct phylink *pl, struct phy_device *phy,
* against all interface modes, which may lead to more ethtool link
* modes being advertised than are actually supported.
*/
- if (phy->is_c45 && state->rate_matching == RATE_MATCH_NONE &&
- state->interface != PHY_INTERFACE_MODE_RXAUI &&
- state->interface != PHY_INTERFACE_MODE_XAUI &&
- state->interface != PHY_INTERFACE_MODE_USXGMII)
+ if ((phy->is_c45 && state->rate_matching == RATE_MATCH_NONE &&
+ state->interface != PHY_INTERFACE_MODE_RXAUI &&
+ state->interface != PHY_INTERFACE_MODE_XAUI &&
+ state->interface != PHY_INTERFACE_MODE_USXGMII) ||
+ pl->config->allow_switch_interface)
state->interface = PHY_INTERFACE_MODE_NA;
return phylink_validate(pl, supported, state);
@@ -151,6 +151,7 @@ struct phylink_config {
bool poll_fixed_state;
bool mac_managed_pm;
bool ovr_an_inband;
+ bool allow_switch_interface;
void (*get_fixed_state)(struct phylink_config *config,
struct phylink_link_state *state);
DECLARE_PHY_INTERFACE_MASK(supported_interfaces);