[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5d24e045-8ede-4db1-8b0d-a6efd5037704@hartkopp.net>
Date: Wed, 14 Jan 2026 17:55:59 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: Rakuram Eswaran <rakuram.e96@...il.com>,
Marc Kleine-Budde <mkl@...gutronix.de>, Vincent Mailhol
<mailhol@...nel.org>, Jonathan Corbet <corbet@....net>
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH 2/2] docs: can: update SocketCAN documentation for CAN XL
Hello Rakuram,
On 13.01.26 17:14, Oliver Hartkopp wrote:
>> +For user space applications the following rules are important when
>> +handling CAN XL:
>> +
>> +- Use ``struct canxl_frame`` as basic data structure when CAN XL traffic
>> + is expected.
>> +- Set CANXL_XLF in ``canxl_frame.flags`` for all valid CAN XL frames.
>> +- Ensure that undefined bits in ``canxl_frame.flags`` are kept at zero.
>> +- Respect the configured device MTU; do not send frames larger than
>> + the MTU announced by the kernel.
>> +- For mixed-mode controllers, be prepared to handle Classical CAN,
>> + CAN FD and CAN XL frames on the same interface and choose the frame
>> + structure according to the socket/protocol semantics (e.g. dedicated
>> + CAN XL APIs when available).
>
> There's one big difference between CC/FD and XL frames when you read/
> write it to CAN_RAW sockets:
>
> For CAN CC and CAN FD you write struct can(fd)_frame's with CAN_MTU
> resp. CANFD_MTU lengths - no matter about the data length (cf->len).
>
> When you read/write CAN XL frames you are reading and writing the
> CANXL_HDR_SIZE + the length of the data.
>
> So only in the case of writing 2048 byte data, you write 2060 bytes.
>
> The minimum size for read/write is CANXL_HDR_SIZE + CANXL_MIN_DLEN == 13
>
Here is an example that I've been implemented recently that shows a good
example how to handle CC/FD/XL frames, when they are all enabled on the
CAN_RAW socket:
https://github.com/hartkopp/can-utils/commit/bf0cae218af9b1c1f5eabad7f3704b88ab642e00
Feel free to pick the code for some example.
But please do not reference the commit as it is in my private repo and
not yet integrated in the official can-utils repo.
Best regards,
Oliver
Powered by blists - more mailing lists