Subject: Re: [PATCH v3 net-next 3/5] net: ethernet: mtk_eth_soc: align reset procedure to vendor sdk

From: Jakub Kicinski <[email-masked]>
Date: Mon, 9 Jan 2023 16:28:00 -0800

On Sun, 8 Jan 2023 15:44:09 +0200 Leon Romanovsky wrote:
> On Sat, Jan 07, 2023 at 03:50:52PM +0100, Lorenzo Bianconi wrote:
> > Avoid to power-down the ethernet chip during hw reset and align reset
> > procedure to vendor sdk.
> > 
> > Tested-by: Daniel Golle <[email-masked]>
> > Co-developed-by: Sujuan Chen <[email-masked]>
> > Signed-off-by: Sujuan Chen <[email-masked]>
> > Signed-off-by: Lorenzo Bianconi <[email-masked]>
> > ---
> >  drivers/net/ethernet/mediatek/mtk_eth_soc.c  | 94 +++++++++++++++-----
> >  drivers/net/ethernet/mediatek/mtk_eth_soc.h  | 12 +++
> >  drivers/net/ethernet/mediatek/mtk_ppe.c      | 27 ++++++
> >  drivers/net/ethernet/mediatek/mtk_ppe.h      |  1 +
> >  drivers/net/ethernet/mediatek/mtk_ppe_regs.h |  6 ++
> >  5 files changed, 116 insertions(+), 24 deletions(-)  
> 
> mdelay is macro wrapper around udelay, to account for possible overflow when
> passing large arguments to udelay. In general, use of mdelay is discouraged
> and code should be refactored to allow for the use of msleep.
> 
> https://www.kernel.org/doc/html/latest/timers/timers-howto.html#delays-information-on-the-various-kern
> 
> It is not your case as you are passing small numbers and can use udelay instead.

Good point, there's one:

	mdelay(100)

in the series which is a lot of time to be spinning blocking a core :S

In this particular patch you basically:

	rtnl_lock();
	mdelay(10);
	..
	mdelay(15);

which seems odd. If you can take rtnl you can sleep, so perhaps this is
trying to be competence-compatible with the vendor driver unnecessarily?