net: phylink: provide mac_get_caps() method
Provide a new method, mac_get_caps() to get the MAC capabilities for the specified interface mode. This is for MACs which have special requirements, such as not supporting half-duplex in certain interface modes, and will replace the validate() method. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/E1qsPk5-009wiX-G5@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
73b24e7ce8
commit
b6f9774719
@@ -657,6 +657,7 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
|
||||
unsigned long *supported,
|
||||
struct phylink_link_state *state)
|
||||
{
|
||||
unsigned long capabilities;
|
||||
struct phylink_pcs *pcs;
|
||||
int ret;
|
||||
|
||||
@@ -696,10 +697,17 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
|
||||
}
|
||||
|
||||
/* Then validate the link parameters with the MAC */
|
||||
if (pl->mac_ops->validate)
|
||||
if (pl->mac_ops->validate) {
|
||||
pl->mac_ops->validate(pl->config, supported, state);
|
||||
else
|
||||
phylink_generic_validate(pl->config, supported, state);
|
||||
} else {
|
||||
if (pl->mac_ops->mac_get_caps)
|
||||
capabilities = pl->mac_ops->mac_get_caps(pl->config,
|
||||
state->interface);
|
||||
else
|
||||
capabilities = pl->config->mac_capabilities;
|
||||
|
||||
phylink_validate_mask_caps(supported, state, capabilities);
|
||||
}
|
||||
|
||||
return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user