Re: [PATCH net 1/1] net: stmmac: add fsleep() in HW Rx timestamp checking loop

Tan Tee Min
2022-04-14T07:31:52Z

On Wed, Apr 13, 2022 at 05:59:15AM -0700, Richard Cochran wrote:
> On Wed, Apr 13, 2022 at 12:01:15PM +0800, Tan Tee Min wrote:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> > index d3b4765c1a5b..289bf26a6105 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> > @@ -279,10 +279,11 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
> > /* Check if timestamp is OK from context descriptor */
> > do {
> > ret = dwmac4_rx_check_timestamp(next_desc);
> > - if (ret < 0)
> > + if (ret <= 0)
> > goto exit;
> > i++;
> >
> > + fsleep(1);
>
> This is nutty. Why isn't this code using proper deferral mechanisms
> like work or kthread?

Appreciate your comment.
The dwmac4_wrback_get_rx_timestamp_status() is called by stmmac_rx()
function which is scheduled by NAPI framework.
Do we still need to create deferred work inside NAPI work?
Would you mind to explain it more in detail?

>
> > } while ((ret == 1) && (i < 10));
> >
> > if (i == 10)
> > --
> > 2.25.1
> >
>
> Thanks,
> Richard

Thanks,
Tee Min