net: dsa: allow DSA switch drivers to provide their own phylink mac ops

Rather than having a shim for each and every phylink MAC operation,
allow DSA switch drivers to provide their own ops structure. When a
DSA driver provides the phylink MAC operations, the shimmed ops must
not be provided, so fail an attempt to register a switch with both
the phylink_mac_ops in struct dsa_switch and the phylink_mac_*
operations populated in dsa_switch_ops populated.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/E1rudqF-006K9H-Cc@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Russell King (Oracle)
2024-04-10 20:42:43 +01:00
committed by Jakub Kicinski
parent dd0c9855b4
commit cae425cb43
3 changed files with 36 additions and 6 deletions

View File

@@ -457,6 +457,11 @@ struct dsa_switch {
*/
const struct dsa_switch_ops *ops;
/*
* Allow a DSA switch driver to override the phylink MAC ops
*/
const struct phylink_mac_ops *phylink_mac_ops;
/*
* User mii_bus and devices for the individual ports.
*/