All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [RFC] CAN FD support part 2 - ideas and commented source
Date: Thu, 03 May 2012 14:50:32 +0200	[thread overview]
Message-ID: <4FA27F18.9080106@hartkopp.net> (raw)
In-Reply-To: <20120503123755.GD416@vandijck-laurijssen.be>

On 03.05.2012 14:37, Kurt Van Dijck wrote:

> Oliver,
> 
> Your proposal looks more elaborate than my first one :-)
> 
> In this email, I'll restrict myself to discussing ETH_P_CANFD.
> 
> On Thu, May 03, 2012 at 01:14:58PM +0200, Oliver Hartkopp wrote:
>> Hi all,
>>
>> in this mail i would like to document the ideas for CAN FD support pointing
>> directly to the changes inside the source.
>>
> 
> [........]
>>
>> That's it.
> 
> using dev's MTU is a very good idea!


Tnx!

> 
> Restricting the API to use one of 2 MTU's makes life easier.
> 
>>
>> Any objections / better ideas?
> I don't see benefit in introducing ETH_P_CANFD.
> Using the skb's payload length differentiates enough between CAN_MTU & CANFD_MTU.
> Why not using that info. IMHO, ETH_P_CANFD duplicates the info.


This has a big advantage when thinking about wireshark & friends.

You can look into the eth protocol and know the skb data layout.
The length information is some kind of implicit knowledge.

> 
> This part proves my point:
> @@ -69,13 +73,23 @@ static inline int can_dropped_invalid_skb(struct net_device *dev,
>  {
>  	const struct can_frame *cf = (struct can_frame *)skb->data;
>  
> -	if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
> This check should have become:
> +	if (unlikely(skb->len != dev->mut) || (cf->can_dlc > mtu_to_max_can_dlc(dev->mtu))
> 
> Instead of all the if then else flows here.
> A lookup table to use by mtu_to_max_can_dlc is quite straight-forward:
> static const int mtu_to_max_can_dlc_table[] = {
> 	[sizeof(struct can_frame) = CAN_MAX_DLC,
> 	[sizeof(struct canfd_frame) = CANFD_MAX_DLC,
> };


Nice idea.

How big is mtu_to_max_can_dlc_table ??
sizeof(struct canfd_frame) * sizeof(int)

Regards,
Oliver

  reply	other threads:[~2012-05-03 12:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4FA242D0.2070604@hartkopp.net>
2012-05-03 11:14 ` [RFC] CAN FD support part 2 - ideas and commented source Oliver Hartkopp
2012-05-03 12:37   ` Kurt Van Dijck
2012-05-03 12:50     ` Oliver Hartkopp [this message]
2012-05-03 13:22       ` Kurt Van Dijck
2012-05-07 11:51         ` Felix Obenhuber
2012-05-07 18:03           ` Oliver Hartkopp
2012-05-03 18:01       ` Wireshark / libpcap - was " Oliver Hartkopp
2012-05-04  9:29         ` Kurt Van Dijck
2012-05-04  9:59           ` Oliver Hartkopp
2012-05-07 12:19             ` Felix Obenhuber

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=4FA27F18.9080106@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    /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.