From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [RFC] CAN FD support
Date: Thu, 03 May 2012 16:41:49 +0200 [thread overview]
Message-ID: <4FA2992D.6000807@hartkopp.net> (raw)
In-Reply-To: <4FA28BAA.3000109@pengutronix.de>
On 03.05.2012 15:44, Marc Kleine-Budde wrote:
> On 05/03/2012 02:38 PM, Oliver Hartkopp wrote:
> [...]
>
>>> I share this.
>>> I'd even prefer u16 over u8 even.
>>> No legacy issues exist when changing the meaning of can_dlc, since current
>>> CAN frames have equal values for DLC & length!
>>>
>>>> the struct is also used by the app.
>>
>>
>> Yes - that's the main problem IMO.
>>
>> What about this binary compatible introduction of cf->len ...
>
> ...but it's not 100% source compatible, due to a compiler bug in gcc.
> You cannot use C99 initializers on anonymous unions in certain gcc versions.
ugh!
>
> [..]
>
>> --- a/include/linux/can.h
>> +++ b/include/linux/can.h
>> @@ -57,7 +57,10 @@ typedef __u32 can_err_mask_t;
>> */
>> struct can_frame {
>> canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
>> - __u8 can_dlc; /* data length code: 0 .. 8 */
>> + union {
>> + __u8 can_dlc; /* data length code: 0 .. 8 */
>> + __u8 len; /* data length: 0 .. 8 */
>> + };
>> __u8 data[8] __attribute__((aligned(8)));
>> };
>
Thanks for the hint.
Indeed i left the struct can_frame as is now!
There's now can_frame.can_dlc and canfd_frame.len which both contains the real
length - even if can_frame.can_dlc is literally a data length *code* .
Btw. by having canfd_frame.len we indicate for CAN FD that we have a real
length here.
Regards,
Oliver
prev parent reply other threads:[~2012-05-03 14:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 11:14 [RFC] CAN FD support part 1 - uncommented source Oliver Hartkopp
2012-05-03 11:34 ` Wolfgang Grandegger
2012-05-03 11:43 ` Oliver Hartkopp
2012-05-03 12:10 ` Wolfgang Grandegger
2012-05-03 12:18 ` [RFC] CAN FD support Kurt Van Dijck
2012-05-03 12:38 ` Oliver Hartkopp
2012-05-03 12:43 ` Wolfgang Grandegger
2012-05-03 13:00 ` Kurt Van Dijck
2012-05-03 13:13 ` Oliver Hartkopp
2012-05-03 13:44 ` Marc Kleine-Budde
2012-05-03 14:41 ` Oliver Hartkopp [this message]
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=4FA2992D.6000807@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=wg@grandegger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.