Re: [PATCH net-next v3 1/2] net: macb: Poll for link state changes when using the internal PCS.
Nathan Whitehorn <[email protected]>
| Newsgroups | org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 8/5/26 15:43, Théo Lebrun wrote: > 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]> Thanks, that's really good to know! I will look into it. For right now, though, if it is all right, I think I would prefer to keep this as-is and come back with a later patch that switches this to use the interrupt, just to get the base functionality into the tree. -Nathan > > Regards, > > -- > Théo Lebrun, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > -- Nathan Whitehorn (he/him) Associate Professor Department of Physics and Astronomy Michigan State University Biomedical and Physical Sciences 3225 East Lansing, MI 48824 (517) 884-5563