All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: 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 15:13:54 +0200	[thread overview]
Message-ID: <4FA28492.7010704@hartkopp.net> (raw)
In-Reply-To: <20120503130041.GA2846@vandijck-laurijssen.be>

On 03.05.2012 15:00, Kurt Van Dijck wrote:

>>
>> Furthermore, the user should be allowed to specify *any* lenght below
>> max, als 57 bytes. It's than up to the driver to do the necessary padding.
> I think Oliver solved this (on af_can level?) with a table len2dlc (static in the header?)


Yes - it was the only way not to make it clash when linking proc.o and
af_can.o together.

Btw. if we move this functionality to the driver, i would like to move it from
can.h into dev.c :-)

> 
>>
>>>
>>> What about this binary compatible introduction of cf->len ...
>>
>> Looks good.
> Yep, given 2 structs, this illustrates the contents very well!


Fine.

One question:

What about omitting the union in struct can_frame modification and leave it as
it is since the first days of SocketCAN?

We can still check these offsets

 	BUILD_BUG_ON(offsetof(struct can_frame, can_dlc) !=
-		     offsetof(struct canfd_frame, can_dlc));
+		     offsetof(struct canfd_frame, len));


and can (kernel) internally use struct canfd_frame as reference:

	struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
	struct net_device_stats *stats = &dev->stats;

	stats->rx_packets++;
	stats->rx_bytes += cfd->len;

which would cover cf->can_dlc in the same way.

I wonder, if people would start to use can_frame.len once it is defined as
this would not be backward compatible code (but binary compatible).

Regards,
Oliver

  reply	other threads:[~2012-05-03 13:13 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 [this message]
2012-05-03 13:44           ` Marc Kleine-Budde
2012-05-03 14:41             ` 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=4FA28492.7010704@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --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.