Re: [PATCH net-next v3 1/2] net: macb: Poll for link state changes when using the internal PCS.

Théo Lebrun <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <[email protected]>
Hello Nathan,

On Wed Jul 29, 2026 at 9:21 PM CEST, Nathan Whitehorn wrote:
> When used with an offboard transceiver (e.g. an SFP), link state needs
> to be measured at the PCS rather than an onboard PHY. Poll the link
> state when the PCS is active to allow the kernel to detect link state
> changes in this case.
>
> Signed-off-by: Nathan Whitehorn <[email protected]>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index d394f1f43b68..c15a9c7e69d3 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1025,6 +1025,7 @@ static int macb_mii_probe(struct net_device *dev)
>  	struct macb *bp = netdev_priv(dev);
>  
>  	bp->phylink_sgmii_pcs.ops = &macb_phylink_pcs_ops;
> +	bp->phylink_sgmii_pcs.poll = true;
>  	bp->phylink_usx_pcs.ops = &macb_phylink_usx_pcs_ops;
>  
>  	bp->phylink_config.dev = &dev->dev;

Hardware has an IRQ for that, would you want to use it instead of
polling? The user guide contains more info.

   /* Bitfields in ISR/IER/IDR/IMR */
   ...
   #define MACB_ISR_LINK_OFFSET  9 /* Enable link change interrupt */
   #define MACB_ISR_LINK_SIZE 1
   ...

I've checked with an on-board SGMII PHY and I get an IRQ once unmasked.

If you don't care, then:

Reviewed-by: Théo Lebrun <[email protected]>

Regards,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.