Re: [RFC PATCH v2 5/8] net: pcs: add driver for MediaTek USXGMII PCS

From: Maxime Chevallier
Date: Wed Dec 06 2023 - 13:58:15 EST


On Wed, 6 Dec 2023 17:58:08 +0000
"Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx> wrote:

> On Wed, Dec 06, 2023 at 10:58:38AM +0100, Maxime Chevallier wrote:
> > On Wed, 6 Dec 2023 01:44:38 +0000
> > Daniel Golle <daniel@xxxxxxxxxxxxxx> wrote:
> > > + /* Read USXGMII link status */
> > > + state->link = FIELD_GET(RG_PCS_RX_LINK_STATUS,
> > > + mtk_r32(mpcs, RG_PCS_RX_STATUS0));
> > > +
> > > + /* Continuously repeat re-configuration sequence until link comes up */
> > > + if (!state->link) {
> > > + mtk_usxgmii_pcs_config(pcs, mpcs->neg_mode,
> > > + state->interface, NULL, false);
> > > + return;
> >
> > .pcs_get_state() isn't called only for link state polling,but also when querying
> > the link state from ethtool, from phylink_ethtool_ksettings_get().
> >
> > As mtk_usxgmii_pcs_config triggers a pcs reset and reconfiguration, won't this disrupt
> > the link ?
>
> Highly likely if there's a race, but note that mtk_usxgmii_pcs_config()
> only gets called if the link is *down*. I guess some IPs need a bit of
> kicking to work properly.
>
Ah right that's true, it should be OK then.

Thanks,

Maxime