> -----Original Message-----
> From: Jakub Kicinski <[email protected]>
> Sent: Tuesday, October 28, 2025 6:02 PM
> To: Haiyang Zhang <[email protected]>
> Cc: Paolo Abeni <[email protected]>; Haiyang Zhang
> <[email protected]>; [email protected];
> [email protected]; Paul Rosswurm <[email protected]>; Dexuan Cui
> <[email protected]>; KY Srinivasan <[email protected]>;
> [email protected]; [email protected]; [email protected]; Long Li
> <[email protected]>; [email protected];
> [email protected]; [email protected]; Konstantin
> Taranov <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Shiraz Saleem <[email protected]>;
> [email protected]; [email protected]; linux-
> [email protected]
> Subject: Re: [EXTERNAL] Re: [net-next, v3] net: mana: Support HW link
> state events
>
> On Tue, 28 Oct 2025 19:36:02 +0000 Haiyang Zhang wrote:
> > > Why is the above needed? I thought mana_link_state_handle() should
> kick
> > > and set the carrier on as needed???
> >
> > Thanks for the question -- our MANA NIC only sends out the link state
> down/up
> > messages when need to let the VM rerun DHCP client and change IP
> address...
> >
> > So, I need to add netif_carrier_on(ndev) in the probe(), otherwise the
> > /sys/class/net/ethX/operstate will remain "unknown" until it receives
> the
> > Link down/up messages which do NOT always happen.
>
> Oh that makes the code make much more sense.
> Please add this and more detail into the commit message.
Will do.
>
> > + if (!netif_carrier_ok(ndev))
> > + netif_carrier_on(ndev);
>
> Testing carrier_ok() before calling carrier_on/off is entirely
> pointless, please see the relevant implementations.
>
> BTW I think the ac->link_event accesses are technically racy,
> wrap them in READ_ONCE() / WRITE_ONCE() while you respin.
> (Unless mana_hwc_init_event_handler() is somehow under rtnl_lock)
I will remove the netif_carrier_ok(), and add READ/WRITE_ONCE.
Thanks,
- Haiyang