Re: [PATCH v3 11/16] can: m_can: Cache tx putidx

From: Simon Horman
Date: Thu Mar 16 2023 - 06:09:11 EST


On Thu, Mar 16, 2023 at 10:55:00AM +0100, Simon Horman wrote:
> On Wed, Mar 15, 2023 at 12:05:41PM +0100, Markus Schneider-Pargmann wrote:
> > m_can_tx_handler is the only place where data is written to the tx fifo.
> > We can calculate the putidx in the driver code here to avoid the
> > dependency on the txfqs register.
> >
> > Signed-off-by: Markus Schneider-Pargmann <msp@xxxxxxxxxxxx>

Nit in my previous email (which I hit send on a little too soon)
not withstanding,

Signed-off-by: Simon Horman <simon.horman@xxxxxxxxxxxx>

FWIIW, I am taking a pause in my review now.

...

> > diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h
> > index d0c21eddb6ec..548ae908ac4e 100644
> > --- a/drivers/net/can/m_can/m_can.h
> > +++ b/drivers/net/can/m_can/m_can.h
> > @@ -102,6 +102,9 @@ struct m_can_classdev {
> > u32 tx_max_coalesced_frames_irq;
> > u32 tx_coalesce_usecs_irq;
> >
> > + // Store this internally to avoid fetch delays on peripheral chips
> > + int tx_fifo_putidx;
>
> nit: it might be slightly nicer to do a pass over the code
> and make putidx unsigned - assuming it is an unsigned value.
>
> > +
> > struct mram_cfg mcfg[MRAM_CFG_NUM];
> > };
> >
> > --
> > 2.39.2
> >