Skip to content

Commit

Permalink
net: dsa: support use of phylink_generic_validate()
Browse files Browse the repository at this point in the history
Support the use of phylink_generic_validate() when there is no
phylink_validate method given in the DSA switch operations and
mac_capabilities have been set in the phylink_config structure by the
DSA switch driver.

This gives DSA switch drivers the option to use this if they provide
the supported_interfaces and mac_capabilities, while still giving them
an option to override the default implementation if necessary.

Reviewed-by: Vladimir Oltean <[email protected]>
Signed-off-by: Russell King (Oracle) <[email protected]>
Reviewed-by: Marek Behún <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Russell King (Oracle) authored and kuba-moo committed Dec 2, 2021
1 parent 072eea6 commit 5938bce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,11 @@ static void dsa_port_phylink_validate(struct phylink_config *config,
struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
struct dsa_switch *ds = dp->ds;

if (!ds->ops->phylink_validate)
if (!ds->ops->phylink_validate) {
if (config->mac_capabilities)
phylink_generic_validate(config, supported, state);
return;
}

ds->ops->phylink_validate(ds, dp->index, supported, state);
}
Expand Down

0 comments on commit 5938bce

Please sign in to comment.