[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210806075220.2psgtigcy3quyzrw@pengutronix.de>
Date: Fri, 6 Aug 2021 09:52:20 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Dario Binacchi <dariobin@...ero.it>
Cc: linux-kernel@...r.kernel.org,
Gianluca Falavigna <gianluca.falavigna@...ind.it>,
Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Wolfgang Grandegger <wg@...ndegger.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [RESEND PATCH 4/4] can: c_can: cache frames to operate as a true
FIFO
On 05.08.2021 22:12:18, Dario Binacchi wrote:
> > > diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
> > > index 8fe7e2138620..fc499a70b797 100644
> > > --- a/drivers/net/can/c_can/c_can.h
> > > +++ b/drivers/net/can/c_can/c_can.h
> > > +static inline u8 c_can_get_tx_free(const struct c_can_tx_ring *ring)
> > > +{
> > > + return ring->obj_num - (ring->head - ring->tail);
> > > +}
> > > +
> > > #endif /* C_CAN_H */
> > > diff --git a/drivers/net/can/c_can/c_can_main.c b/drivers/net/can/c_can/c_can_main.c
> > > index 451ac9a9586a..4c061fef002c 100644
> > > --- a/drivers/net/can/c_can/c_can_main.c
> > > +++ b/drivers/net/can/c_can/c_can_main.c
> > > @@ -427,20 +427,6 @@ static void c_can_setup_receive_object(struct net_device *dev, int iface,
> > > c_can_object_put(dev, iface, obj, IF_COMM_RCV_SETUP);
> > > }
> > >
> > > -static u8 c_can_get_tx_free(const struct c_can_tx_ring *ring)
> > > -{
> > > - u8 head = c_can_get_tx_head(ring);
> > > - u8 tail = c_can_get_tx_tail(ring);
> > > -
> > > - /* This is not a FIFO. C/D_CAN sends out the buffers
> > > - * prioritized. The lowest buffer number wins.
> > > - */
> > > - if (head < tail)
> > > - return 0;
> > > -
> > > - return ring->obj_num - head;
> > > -}
> > > -
> >
> > Can you move that change into patch 3?
>
> Patch 3 adds the ring transmission algorithm without compromising the
> message transmission order. This is not a FIFO.
Right, thanks!
> C/D_CAN controller sends out the buffers prioritized. The lowest
> buffer number wins, so moving the change into patch 3 may not
> guarantee the transmission order. In patch 3, however, I will move
> c_can_get_tx_free() from c_can_main.c to c_can.h, so that in patch 4
> it will be clearer how the routine has changed.
The updated patch looks much nicer now, thanks!
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists