RE: [EXTERNAL] Re: [PATCH net-next] net: mana: Support HW link state events

From: Haiyang Zhang

Date: Tue Oct 14 2025 - 10:11:27 EST




> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Monday, October 13, 2025 7:22 PM
> To: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxxxxxxxx>; linux-
> hyperv@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; Paul Rosswurm
> <paulros@xxxxxxxxxxxxx>; Dexuan Cui <decui@xxxxxxxxxxxxx>; KY Srinivasan
> <kys@xxxxxxxxxxxxx>; wei.liu@xxxxxxxxxx; edumazet@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; Long Li
> <longli@xxxxxxxxxxxxx>; ssengar@xxxxxxxxxxxxxxxxxxx;
> ernis@xxxxxxxxxxxxxxxxxxx; dipayanroy@xxxxxxxxxxxxxxxxxxx; Konstantin
> Taranov <kotaranov@xxxxxxxxxxxxx>; horms@xxxxxxxxxx;
> shradhagupta@xxxxxxxxxxxxxxxxxxx; leon@xxxxxxxxxx; mlevitsk@xxxxxxxxxx;
> yury.norov@xxxxxxxxx; Shiraz Saleem <shirazsaleem@xxxxxxxxxxxxx>;
> andrew+netdev@xxxxxxx; linux-rdma@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [EXTERNAL] Re: [PATCH net-next] net: mana: Support HW link
> state events
>
> > > > + 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