All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: "Maximilian Güntner" <maximilian.guentner@gmail.com>
Cc: Mike Purvis <mpurvis@clearpathrobotics.com>,
	linux-can@vger.kernel.org, tom_usenet@optusnet.com.au
Subject: Re: Standard CAN over IP
Date: Mon, 23 Feb 2015 14:08:37 +0100	[thread overview]
Message-ID: <54EB2655.7060303@hartkopp.net> (raw)
In-Reply-To: <CAKSnaaezqAXG3mNRa8zq7r1bq_YbJMHbLb1odSkaYYYDsqLi+Q@mail.gmail.com>

On 23.02.2015 13:25, Maximilian Güntner wrote:

> 2015-02-20 12:43 GMT+01:00 Oliver Hartkopp <socketcan@hartkopp.net>:
>> I would suggest to implement CAN FD from the beginning.
>>
>> When creating the CAN RAW socket just try to switch it into CAN FD mode:
>>
> thank you for the input. CAN FD is now (1ef0769900b) supported :)

Great!

>
> Each instance determines whether it is possible to write CAN FD frames
> to the socket, a configuration is not necessary.
> In a setup where a host that uses CAN FD is connected to a host that
> uses traditional CAN, frames with a payload of under 9 Bytes can also be
> bridged using cannelloni - only frames that exceed 8 Bytes will be dropped.

Hm. This is not the correct distinction for CAN and CAN FD.

There can be CAN FD frames with <=8 bytes too.

You need to make sure that the difference between CAN FD with 8 bytes and 
CAN2.0 with 8 bytes does not get lost. So I would suggest to add an additional 
attribute to each transfered CAN frame which tells you:

- Is a CAN FD frame (or not)
- Has bitrate setting (CANFD_BRS) enabled (for CAN FD)
- Has error state (CANFD_ESI) enabled (for CAN FD)

My suggestion would be to add a single byte for each frame that contains 
CANFD_BRS and CANFD_ESI as-is and e.g. 0x80 when this is a CAN FD frame.

> Here is how a cannelloni frame looks like:
>
> [ VERSION | TYPE | SEQ_NO | COUNT | COUNT * [ CANID |
> LEN | LEN * DATA ] ]

You would have COUNT * [ CANID | FLAGS | LEN | LEN * DATA ] ]

then with a single FLAGS byte.

On the sender side 0x80 is OR'ed when the read frame length was CANFD_MTU.
And on the receiver a CAN or CAN FD frame is created based on 0x80 in FLAGS.

Regards,
Oliver


  reply	other threads:[~2015-02-23 13:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 20:27 Standard CAN over IP Mike Purvis
2015-02-04 20:44 ` Armin Burchardt
2015-02-04 21:38   ` Mike Purvis
2015-02-04 22:42     ` Gerhard Bertelsmann
2015-02-05  0:50     ` Tom Evans
2015-02-05 13:15       ` Mike Purvis
2015-02-06  8:33         ` Michal Sojka
2015-02-09 16:00           ` Mike Purvis
2015-02-09 18:32             ` Oliver Hartkopp
2015-02-04 23:43 ` Tom Evans
2015-02-18 17:57 ` Maximilian Güntner
     [not found]   ` <CACsJT9M4QbYkDvQkGfhFuwA6haNyV5zesUFtLzB5VEbxP=obBA@mail.gmail.com>
2015-02-19  3:21     ` Mike Purvis
2015-02-19 14:58     ` Maximilian Güntner
2015-02-20 11:43   ` Oliver Hartkopp
2015-02-23 12:25     ` Maximilian Güntner
2015-02-23 13:08       ` Oliver Hartkopp [this message]
2015-02-23 14:27         ` Maximilian Güntner
2015-02-23 16:22           ` Oliver Hartkopp
2015-03-20 16:54   ` Maximilian Güntner
2015-03-23 10:28     ` Pankajkumar Misra (RBEI/EEA2)
2015-03-23 13:15       ` Maximilian Güntner
2015-03-23 16:57         ` Pankajkumar Misra (RBEI/EEA2)
2015-03-23 13:23       ` GARNERO, PIERRE (P.)

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=54EB2655.7060303@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=maximilian.guentner@gmail.com \
    --cc=mpurvis@clearpathrobotics.com \
    --cc=tom_usenet@optusnet.com.au \
    /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.