From: "Thomas Wagner" <thomas@the-wagner.de>
To: "'Marc Kleine-Budde'" <mkl@pengutronix.de>
Cc: <linux-can@vger.kernel.org>
Subject: RE: Write canfd_frame to can interface
Date: Thu, 29 Jul 2021 14:02:34 +0200 [thread overview]
Message-ID: <00a601d78471$9e6f3ca0$db4db5e0$@the-wagner.de> (raw)
In-Reply-To: <20210729105539.ppi7rm6uglwbpyov@pengutronix.de>
Hello Marc,
On 2021-07-29 12:55, Marc Kleine-Budde wrote:
> On 29.07.2021 12:03:56, thomas@the-wagner.de wrote:
>> Shouldn't the error only be returned if the
>> canfd_frame I pass has more than 8 bytes when the interface is not in
>> FD-mode?
>
> A CAN-2.0 frame with 8 bytes is something different than a CAN-FD frame
> with 8 bytes. The kernel uses the length of the frame to decide if it is
> a CAN-2.0 or CAN-FD frame. If your CAN controller has switched CAN-FD
> off, it cannot send CAN-FD frames, thus you get an error.
>
> Does that make sense?
Sure!
I see how a CAN-2.0 frame with 8 bytes differs from a CAN-FD frame with
8-bytes, but when I receive into a canfd_frame I can't differentiate like that
anymore. In userspace an 8B CAN-2.0 frame and an 8B CAN-FD frame look just
the same, no matter the interface running with FD on or off.
... which is wrong as I just noticed. Paying attention to the actual bytes read
by the socket I can see the 16 vs. 72B that make up a can_frame vs. a
canfd_frame respectively. Even when always writing into a canfd_frame.
The same differentiation I must make when sending...
Thanks for the quick reply!
Best regards
Thomas Wagner
next prev parent reply other threads:[~2021-07-29 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 10:03 Write canfd_frame to can interface thomas
2021-07-29 10:55 ` Marc Kleine-Budde
2021-07-29 12:02 ` Thomas Wagner [this message]
2021-07-29 12:14 ` Marc Kleine-Budde
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='00a601d78471$9e6f3ca0$db4db5e0$@the-wagner.de' \
--to=thomas@the-wagner.de \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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).