RE: [EXTERNAL] Re: [net-next, v3] net: mana: Support HW link state events
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2025-10-29 13:20:51
Also in:
linux-hyperv, linux-rdma, lkml
-----Original Message----- From: Jakub Kicinski <kuba@kernel.org> Sent: Tuesday, October 28, 2025 6:02 PM To: Haiyang Zhang <haiyangz@microsoft.com> Cc: Paolo Abeni <pabeni@redhat.com>; Haiyang Zhang [off-list ref]; linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; Paul Rosswurm [off-list ref]; Dexuan Cui [off-list ref]; KY Srinivasan [off-list ref]; wei.liu@kernel.org; edumazet@google.com; davem@davemloft.net; Long Li [off-list ref]; ssengar@linux.microsoft.com; ernis@linux.microsoft.com; dipayanroy@linux.microsoft.com; Konstantin Taranov [off-list ref]; horms@kernel.org; shradhagupta@linux.microsoft.com; leon@kernel.org; mlevitsk@redhat.com; yury.norov@gmail.com; Shiraz Saleem [off-list ref]; andrew+netdev@lunn.ch; linux-rdma@vger.kernel.org; linux- kernel@vger.kernel.org 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:quoted
quoted
Why is the above needed? I thought mana_link_state_handle() shouldkickquoted
quoted
and set the carrier on as needed???Thanks for the question -- our MANA NIC only sends out the link statedown/upquoted
messages when need to let the VM rerun DHCP client and change IPaddress...quoted
So, I need to add netif_carrier_on(ndev) in the probe(), otherwise the /sys/class/net/ethX/operstate will remain "unknown" until it receivesthequoted
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.
quoted
+ 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