aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle)2021-11-30 13:10:06 +0000
committerJakub Kicinski2021-12-01 18:58:00 -0800
commit5938bce4b6e2146d5194badd7ecf0acc6bf877fc (patch)
treeae3067e3ce2bf96bcb126230336d01dfe506dbe0
parent072eea6c22b2af680c3949e64f9adde278c71e68 (diff)
net: dsa: support use of phylink_generic_validate()
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 <vladimir.oltean@nxp.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Marek BehĂșn <kabel@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/dsa/port.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c
index ef0acf005f8f..6d5ebe61280b 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -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);
}