Re: [PATCH v3 2/3] can: m_can: Batch FIFO reads during CAN receive
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-08-19 11:45:09
Attachments
- signature.asc [application/pgp-signature] 488 bytes
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-08-19 11:45:09
On 16.08.2021 22:08:52, Matt Kline wrote:
On peripherals communicating over a relatively slow SPI line (e.g. tcan4x5x), individual transfers have high fixed costs. This causes the driver to spend most of its time waiting between transfers and severely limits throughput. Reduce these overheads by reading more than one word at a time. Writing could get a similar treatment in follow-on commits. Signed-off-by: Matt Kline <redacted> --- drivers/net/can/m_can/m_can.c | 51 +++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 23 deletions(-)diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 83eb5cd51de5..85d6cd03bff1 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c@@ -308,6 +308,15 @@ enum m_can_reg { #define TX_EVENT_MM_MASK GENMASK(31, 24) #define TX_EVENT_TXTS_MASK GENMASK(15, 0) +/* The ID and DLC registers are adjacent in M_CAN FIFO memory, + * and we can save a (potentially slow) bus round trip by combining + * reads and writes to them. + */ +struct __packed id_and_dlc { + u32 id; + u32 dlc; +};
No need for __packed, removed while applying. regards, 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 |