From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Vincent Mailhol <vincent.mailhol@gmail.com>
Cc: linux-can@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] can: canxl: introduce CAN XL data structure
Date: Thu, 14 Jul 2022 12:10:30 +0200 [thread overview]
Message-ID: <f73cdc76-c422-572e-1ef7-89f34c06051f@hartkopp.net> (raw)
In-Reply-To: <CAMZ6RqLtUKja1dzvN9Wj8zRXigbeXW43jzpST-tZP9RmLHhVFg@mail.gmail.com>
On 14.07.22 11:12, Vincent Mailhol wrote:
> On Thu. 14 Jul. 2022 at 15:11, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
>> I would suggest the following:
>>
>> #define CANXL_XLF 0x80 /* mark CAN XL frame (must be set) */
>> #define CANXL_SEC 0x40 /* Simple Extended Content (security/segmentation) */
>
> OK. Having CANXL_SEC on the most significant bit (0x40) or instead of
> the least significant bit (0x01) works for me.
Hm. This is a really iterative process ;-)
Maybe
#define CANXL_XLF 0x80 /* mark CAN XL frame (must be set) */
#define CANXL_SEC 0x01 /* Simple Extended Content (security/segmentation) */
looks even more natural:
The MSB is set and the other bits start from LSB as usual.
>> And the rest of the bits are reserved (shall be set to zero).
>
> ACK.
>
>> This way the CAN_XLF value would make the former 'len' element 128 -
>> which is a proper distinction for CAN XL frames as such length value
>> surely bounces on CAN/CANFD frames.
>
> The purpose of the CAN_XLF is still unclear to me. In your initial
> patch, you wrote that CAN_XLF was to "mark CAN XL for dual use of
> struct canfd_frame". So are we really OK to specify that CAN_XLF is
> always set? How are we going to tag dual use?
I think the dual-use pattern does not make sense anymore as either the
flags element and the len element have been moved away from the struct
can[fd]_frame layout.
There is no layout match between CAN XL and CAN/CANFD anymore.
> But my main point was to always set 0x80 to differentiate between
> CAN(-FD) and CANXL, and we are aligned on this. :D
ACK.
IMO this 0x80 bit at this specific position is an excellent flag to
introduce CAN XL frames and to provide a proper break with CAN/CANFD
data structures.
> The last topic remaining is the data[] vs. data[CANXL_MAX_DLEN]. I
> thought about it but can not find any killer arguments for either
> solution.
> The biggest difference is that for data[] we can do sizeof(struct
> canxl_frame) to get the header file whereas for data[CANXL_MAX_DLEN],
> we need to introduce the CANXL_HEADER_SIZE macro.
> My preference still goes toward the data[] because I see flexible
> member arrays as being more idiomatic C. But it is more for personal
> taste than anything else…
I see it as a practical thing for programmers (also in userspace) to
allocate sizeof(struct canxl_frame) and do all the checks and operations
similar to struct can[fd]_frame (and the ISO CAN Spec).
It just makes it very clear what we are talking about.
The fact that we can reduce the content size whenever we transfer
content from/to kernel space or inside the kernel is just a nice
optimization IMO.
> Yours sincerely,
> Vincent Mailhol
Thanks for your feedback! I think I'll post an updated patch set later
today to continue the discussion on a new code basis.
Best regards,
Oliver
next prev parent reply other threads:[~2022-07-14 10:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 18:34 [RFC PATCH 0/5] can: support CAN XL Oliver Hartkopp
2022-07-11 18:34 ` [RFC PATCH 1/5] can: canxl: introduce CAN XL data structure Oliver Hartkopp
2022-07-12 0:36 ` Vincent Mailhol
2022-07-12 7:55 ` Oliver Hartkopp
2022-07-12 8:40 ` Vincent Mailhol
2022-07-12 9:31 ` Oliver Hartkopp
2022-07-12 10:19 ` Vincent Mailhol
2022-07-12 12:30 ` Oliver Hartkopp
2022-07-12 14:31 ` Vincent Mailhol
2022-07-12 19:24 ` Oliver Hartkopp
2022-07-13 1:07 ` Vincent Mailhol
2022-07-13 20:02 ` Oliver Hartkopp
2022-07-14 1:23 ` Vincent Mailhol
2022-07-14 6:11 ` Oliver Hartkopp
2022-07-14 9:12 ` Vincent Mailhol
2022-07-14 10:10 ` Oliver Hartkopp [this message]
2022-07-11 18:34 ` [RFC PATCH 2/5] can: canxl: introduce ETH_P_CANXL ethernet protocol handling Oliver Hartkopp
2022-07-11 19:34 ` Marc Kleine-Budde
2022-07-11 19:41 ` Marc Kleine-Budde
2022-07-12 7:12 ` Oliver Hartkopp
2022-07-12 7:17 ` Marc Kleine-Budde
2022-07-12 8:02 ` Oliver Hartkopp
2022-07-12 8:10 ` Marc Kleine-Budde
2022-07-12 1:23 ` Vincent Mailhol
2022-07-12 20:20 ` Oliver Hartkopp
2022-07-12 23:58 ` Vincent Mailhol
2022-07-13 7:02 ` Marc Kleine-Budde
2022-07-13 7:15 ` Vincent Mailhol
2022-07-13 20:27 ` Oliver Hartkopp
2022-07-14 1:32 ` Vincent Mailhol
2022-07-11 18:34 ` [RFC PATCH 3/5] can: dev: add CAN XL support Oliver Hartkopp
2022-07-11 19:46 ` Marc Kleine-Budde
2022-07-12 7:08 ` Oliver Hartkopp
2022-07-11 18:34 ` [RFC PATCH 4/5] can: vcan: " Oliver Hartkopp
2022-07-11 18:34 ` [RFC PATCH 5/5] can: raw: " Oliver Hartkopp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f73cdc76-c422-572e-1ef7-89f34c06051f@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=vincent.mailhol@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox