Skip to content

Patch to use deeper MCP251x TX queue #7

@matt-foundry

Description

@matt-foundry

Hello @marckleinebudde, I have tried modifying the mcp251x.c driver (attached) to use 3 TX mailboxes rather than just 1 TX mailbox (as is currently supported). This has approximately doubled the rate at which I can transmit CAN messages, and has been working reliably on my Raspberry Pi for a couple of months now.

I wondered if you might be interested in this patch? Whether it is potentially suitable for incorporation into the mainline kernel repository?

It does not support aborting messages in favour of those with higher priority, so there is potentially an issue with priority inversion. However the mainline mcp251x.c driver has the same issue, just a shorter FIFO, so I suppose the problem is less severe. On the other hand, queuing messages in the MCP251x mailboxes means that when sending a stream of high priority messages, the bus is released less frequently between frames, which helps avoid that particular source of priority inversion.

The idea of using the mailbox order and priority bits was inspired by the the mcp2515a driver by @msperl, although I also notice at91_can.c does something similar. I am new to kernel development, so not really sure if what I have done is up to standard.

patch-mcp251x.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions