[RFC v8 net-next 15/16] net: dsa: felix: add phylink_get_caps capability
Vladimir Oltean
vladimir.oltean at nxp.com
Sat Sep 10 17:44:36 PDT 2022
On Fri, Sep 09, 2022 at 11:33:59AM -0700, Colin Foster wrote:
> Regarding felix_phylink_get_caps() - does it make sense that
> mac_capabilities would be the same for all ports? This is where I've
> currently landed, and I want to make sure it doesn't have adverse
> effects on vsc9959 or seville:
>
> static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
> struct phylink_config *config)
> {
> struct ocelot *ocelot = ds->priv;
> struct felix *felix;
> u32 modes;
> int i;
>
> felix = ocelot_to_felix(ocelot);
> modes = felix->info->port_modes[port];
>
> /* This driver does not make use of the speed, duplex, pause or
> * the advertisement in its mac_config, so it is safe to mark
> * this driver as non-legacy.
> */
> config->legacy_pre_march2020 = false;
>
> for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++)
> if (modes & felix_phy_match_table[i])
> __set_bit(i, config->supported_interfaces);
The current shape of the SERDES driver used with VSC9959 and VSC9953 is
such that dynamic changes to the SERDES protocol are not supported. So
at least for these 2 switches, please keep setting just the current
ocelot->ports[port]->phy_mode (i.e. what was set in the device tree).
>
> config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10 |
> MAC_100 | MAC_1000FD;
> }
>
> (this might be two patches - one for the match table and one for the
> mac_capabilities)
>
> Seemingly because net/dsa/port.c checks for phylink_validate before it
> checks for mac_capabilties, it won't make a difference there, but this
> seems ... wrong? Or maybe it isn't wrong until I implement the QSGMII
> port that supports 2500FD (as in drivers/net/ethernet/mscc/ocelot_net.c
> ocelot_port_phylink_create())
I don't think there is any QSGMII port that supports 2500FD in VSC7514.
In general, the frequency at which QSGMII operates would not be able to
support that data rate.
That must be an artefact of me copying and pasting code from Felix to
Ocelot in commit e6e12df625f2 ("net: mscc: ocelot: convert to phylink"),
later transformed by Russell in commit 7258aa5094db ("net: ocelot_net:
use phylink_generic_validate()").
How about you do the other way around: populate config->mac_capabilities
such that it unconditionally also includes MAC_2500FD. You may have
noticed that phylink_generic_validate() calls phylink_get_linkmodes(),
which contains a logical AND between the capabilities reported by the
MAC, and the plausible capabilities given by state->interface. So it
would be quite within the expectations of this API for phylink to
exclude MAC_2500FD from mac_capabilities if PHY_INTERFACE_MODE_QSGMII is
used.
On the other hand, VSC9959 and VSC9953 do support actual 2.5G on
internal interfaces (and on USXGMII, in the case of VSC9959). They don't
use the generic phylink validation method right now, but it would be
good, in case they get mechanically converted or something, to keep
reporting MAC_2500FD whatever code you add right now.
More information about the linux-arm-kernel
mailing list