From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Stephane Grosjean <s.grosjean@peak-system.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH RFC] can fd: Add separate bittiming infrastructure
Date: Sat, 18 Jan 2014 18:34:32 +0100 [thread overview]
Message-ID: <52DABB28.4070608@hartkopp.net> (raw)
In-Reply-To: <52D8DF40.7050405@peak-system.com>
Hi Stephane,
On 17.01.2014 08:44, Stephane Grosjean wrote:
>> +#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
>
> - What is exactly the goal of this new CAN_CTRLMODE_FD please? Did you define
> it to allow user to enable the CANFD function into the hardware, for example?
> If yes, isn't it redundant with setting the MTU to 72 bytes?
>
> - Moreover, how a CANFD -able driver has to handle a CANFD frame read from the
> CANFD controller, when its network device MTU *ISNOT* == 72 ??? Should it
> discard the CANFD frame?
The stuff in linux/net/can/ takes care that only applications that know (and
enable) CAN FD get CAN frames with a length > 8 byte.
E.g. today a CAN FD frame with only 8 bytes (aka CANFD8) can be passed to
applications that are not CAN FD capable. In this case the size (MTU)
is reduced from CANFD_MTU to CAN_MTU, see:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net/can/raw.c?id=e2d265d3b587f5f6f8febc0222aace93302ff0be
and
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/net/can/raw.c#n753
This leads IMO to two questions:
1. Is it a good idea to provide CANFD8 frames to legacy applications?
2. If yes, should the CAN FD controller driver be able to make legacy frames
CANDF8 frames to support the higher data bitrate for legacy applications?
Maybe even the first question has to be denied (and the adaption in can/raw.c
should be removed then) ?!?
My idea behind CAN_CTRLMODE_FD is to enable/disable the CAN FD mode in the
CAN FD capable controller chip.
Depending on this CAN_CTRLMODE_FD the CAN FD functionality is enabled when
this feature is supported(!) by the driver, see priv->ctrlmode_supported:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/net/can/dev.c#n669
Depending on CAN_CTRLMODE_FD the MTU is then set to CAN_MTU or CANFD_MTU
(note that the interface has to be 'down' when configuring this feature -
that's just the same as with configuring the bitrate).
When CAN_CTRLMODE_FD was set but the second bitrate was *not* set before the
interface is requested to be set to 'up' this leads to the same error as if
the (single and only) bitrate is missing today.
I hope this would be a reasonable solution and I was able to describe it well.
Comming back to question 2 from above, we would then need an additional
controlmode:
#define CAN_CTRLMODE_TX_FD8 0x40 /* send legacy CAN frames in FD mode */
But I'm not really sure if these two 'compatibility' tweaks for legacy
applications to use CAN FD8 is a wanted/needed feature.
Any thoughts?
>
>> /*
>> * CAN device statistics
>> @@ -122,6 +123,9 @@ enum {
>> IFLA_CAN_RESTART_MS,
>> IFLA_CAN_RESTART,
>> IFLA_CAN_BERR_COUNTER,
>> + IFLA_CAN_DATA_BITTIMING,
>> + IFLA_CAN_DATA_BITTIMING_CONST,
>> + IFLA_CAN_DATA_CLOCK,
>> __IFLA_CAN_MAX
>> };
>
> - by defining another clock for the data bitrate, do you suppose that some
> hardwares could use different clocks for both arbitration and data bitrates?
Yes. But this is probably not necessary. I just looked into the M_CAN
specification. They have *one* CAN clock and two different baud rate
prescalers. So I would tend to remove IFLA_CAN_DATA_CLOCK in the next RFC
until a real requirement emerges from some real hardware.
Best regards,
Oliver
next prev parent reply other threads:[~2014-01-18 17:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 17:54 [PATCH RFC] can fd: Add separate bittiming infrastructure Oliver Hartkopp
2014-01-16 16:30 ` Marc Kleine-Budde
2014-01-17 7:44 ` Stephane Grosjean
2014-01-18 17:34 ` Oliver Hartkopp [this message]
2014-01-21 8:42 ` Stephane Grosjean
2014-01-21 9:56 ` Oliver Hartkopp
2014-01-21 10:22 ` [RFC] can fd: backward compatibility for CANFD8 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=52DABB28.4070608@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=s.grosjean@peak-system.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;
as well as URLs for NNTP newsgroup(s).