RE: [EXTERNAL] Re: [PATCH net-next] net: mana: Support HW link state events
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2025-10-14 14:11:27
Also in:
linux-hyperv, linux-rdma, lkml
-----Original Message----- From: Andrew Lunn <andrew@lunn.ch> Sent: Monday, October 13, 2025 7:22 PM To: Haiyang Zhang <haiyangz@microsoft.com> Cc: Haiyang Zhang <redacted>; 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; kuba@kernel.org; pabeni@redhat.com; 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: [PATCH net-next] net: mana: Support HW link state eventsquoted
quoted
quoted
+ if (link_up) { + netif_carrier_on(ndev); + + if (apc->port_is_up) + netif_tx_wake_all_queues(ndev); + + __netdev_notify_peers(ndev); + } else { + if (netif_carrier_ok(ndev)) { + netif_tx_disable(ndev); + netif_carrier_off(ndev); + } + }It is odd this is asymmetric. Up and down should really be opposites.For the up event, we need to delay the wake up queues if the mana_close() is called, or mana_open() isn't called yet. Also, we notify peers only when link up.But why is this not symmetric? On down, if port_is_up is not true, there is no need to disable tx and set the carrier off. There are also counters associated with netif_carrier_off() and netif_carrier_on(), and if you don't call them in symmetric pairs, the counters are going to look odd.
I see. Will update the patch. Thanks, - Haiyang