Re: Improving TX for m_can peripherals

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

 



On Wed, May 05, 2021 at 01:56:24PM +0200, Marc Kleine-Budde wrote:
> For easier queuing, get rid of the worker. Directly send the can_frame
> from the xmit handler. The problem is, you cannot sleep inside it. This
> means, you cannot use regmap(), the only thing that works is
> spi_async(). And as it's async, you can only write data via SPI, reading
> doesn't make sense.

Yeah, this makes things pretty tough, given that we currently have to
read the next available TX buffer index before doing the writes!

> Have a look at the mcp251xfd_start_xmit() function. All data structures
> for the SPI messages are prepared in beforehand in
> mcp251xfd_tx_ring_init_tx_obj(). The xmit function looks up the correct
> data structure, converts the skb to the chip's format
> mcp251xfd_tx_obj_from_skb() and then sends the data over spi. Special
> care is taken of the handling of the head and tail pointers and the
> stopping of the queue to avoid race conditions - see
> mcp251xfd_get_tx_free(), mcp251xfd_tx_busy(), netif_stop_queue(),
> netif_wake_queue().
> 
> Hope that helps,
> Marc

I'll be sure to look into it in more detail, thanks. In the meantime,
your patch is working very well to mostly solve this issue :)

--
Regards,

Torin Cooper-Bennun
Software Engineer | maxiluxsystems.com




[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