Re: [RESEND PATCH 4/4] can: c_can: cache frames to operate as a true FIFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux