All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.6-rc1] canfd: remove redundant CAN FD flag
@ 2012-08-06 16:02 Oliver Hartkopp
  2012-08-07  8:16 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2012-08-06 16:02 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

The first idea of the CAN FD implementation started with a new struct
canfd_frame to be used for both CAN FD frames and legacy CAN frames.
The now mainlined implementation supports both CAN frame types simultaneously
and distinguishes them only by their required sizes: CAN_MTU and CANFD_MTU.

Only the struct canfd_frame contains a flags element which is needed for the
additional CAN FD information. As CAN FD implicitly means that the 'Extened
Data Length' mode is enabled the formerly defined CANFD_EDL bit became
redundant and also confusing as an unset bit would be an error and would
always need to be tested.

This patch removes the obsolete CANFD_EDL bit and clarifies the documentation
for the use of struct canfd_frame and the CAN FD relevant flags.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

Hello Marc,

when thinking about the extension of the can-utils to support the handling of
CAN FD specific flags in logfiles and console output i stumbled upon an
implementation artifact i would like to fix before 3.6 is released.

The former flags definition turned out to be hard to use and is redundant in
the case of the CANFD_EDL flag.

Do you want to take that patch in your linux-can tree to be pulled for 3.6-rc2
or should i send it to Dave/netdev-ML directly?
The patch is based on Linus' 3.6-rc1 tree.

Thanks,
Oliver

diff --git a/include/linux/can.h b/include/linux/can.h
index 018055e..de49bd3 100644
--- a/include/linux/can.h
+++ b/include/linux/can.h
@@ -74,20 +74,21 @@ struct can_frame {
 /*
  * defined bits for canfd_frame.flags
  *
- * As the default for CAN FD should be to support the high data rate in the
- * payload section of the frame (HDR) and to support up to 64 byte in the
- * data section (EDL) the bits are only set in the non-default case.
- * Btw. as long as there's no real implementation for CAN FD network driver
- * these bits are only preliminary.
+ * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to
+ * be set in the CAN frame bitstream on the wire. The EDL bit switch turns
+ * the CAN controllers bitstream processor into the CAN FD mode which creates
+ * two new options within the CAN FD frame specification:
  *
- * RX: NOHDR/NOEDL - info about received CAN FD frame
- *     ESI         - bit from originating CAN controller
- * TX: NOHDR/NOEDL - control per-frame settings if supported by CAN controller
- *     ESI         - bit is set by local CAN controller
+ * Bit Rate Switch - to indicate a second bitrate is/was used for the payload
+ * Error State Indicator - represents the error state of the transmitting node 
+ *
+ * As the CANFD_ESI bit is internally generated by the transmitting CAN
+ * controller only the CANFD_BRS bit is relevant for real CAN controllers when
+ * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make
+ * sense for virtual CAN interfaces to test applications with echoed frames.
  */
-#define CANFD_NOHDR 0x01 /* frame without high data rate */
-#define CANFD_NOEDL 0x02 /* frame without extended data length */
-#define CANFD_ESI   0x04 /* error state indicator */
+#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
+#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
 
 /**
  * struct canfd_frame - CAN flexible data rate frame structure



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.6-rc1] canfd: remove redundant CAN FD flag
  2012-08-06 16:02 [PATCH 3.6-rc1] canfd: remove redundant CAN FD flag Oliver Hartkopp
@ 2012-08-07  8:16 ` Marc Kleine-Budde
  2012-08-07  8:33   ` Oliver Hartkopp
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2012-08-07  8:16 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]

On 08/06/2012 06:02 PM, Oliver Hartkopp wrote:
> The first idea of the CAN FD implementation started with a new struct
> canfd_frame to be used for both CAN FD frames and legacy CAN frames.
> The now mainlined implementation supports both CAN frame types simultaneously
> and distinguishes them only by their required sizes: CAN_MTU and CANFD_MTU.
> 
> Only the struct canfd_frame contains a flags element which is needed for the
> additional CAN FD information. As CAN FD implicitly means that the 'Extened
> Data Length' mode is enabled the formerly defined CANFD_EDL bit became
> redundant and also confusing as an unset bit would be an error and would
> always need to be tested.
> 
> This patch removes the obsolete CANFD_EDL bit and clarifies the documentation
> for the use of struct canfd_frame and the CAN FD relevant flags.
> 
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> ---
> 
> Hello Marc,
> 
> when thinking about the extension of the can-utils to support the handling of
> CAN FD specific flags in logfiles and console output i stumbled upon an
> implementation artifact i would like to fix before 3.6 is released.
> 
> The former flags definition turned out to be hard to use and is redundant in
> the case of the CANFD_EDL flag.
> 
> Do you want to take that patch in your linux-can tree to be pulled for 3.6-rc2
> or should i send it to Dave/netdev-ML directly?
> The patch is based on Linus' 3.6-rc1 tree.

I'll take the patch. As I'm the single point of contact, David will
probably refuse to take it directly from you. I hope no one will blame
us hard for modifying the ABI of the kernel for canfd frames. However I
think it's okay as there are probably no users of the canfd frame out there.

BTW: warning: 1 line adds whitespace errors.
I've fixed this.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.6-rc1] canfd: remove redundant CAN FD flag
  2012-08-07  8:16 ` Marc Kleine-Budde
@ 2012-08-07  8:33   ` Oliver Hartkopp
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Hartkopp @ 2012-08-07  8:33 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

On 07.08.2012 10:16, Marc Kleine-Budde wrote:

> On 08/06/2012 06:02 PM, Oliver Hartkopp wrote:

>> The former flags definition turned out to be hard to use and is redundant in
>> the case of the CANFD_EDL flag.
>>
>> Do you want to take that patch in your linux-can tree to be pulled for 3.6-rc2
>> or should i send it to Dave/netdev-ML directly?
>> The patch is based on Linus' 3.6-rc1 tree.
> 
> I'll take the patch. As I'm the single point of contact, David will
> probably refuse to take it directly from you. I hope no one will blame
> us hard for modifying the ABI of the kernel for canfd frames. However I
> think it's okay as there are probably no users of the canfd frame out there.


Yes. We are the only users now and if you look at the patch in detail, i
removed these lines:

- * Btw. as long as there's no real implementation for CAN FD network driver
- * these bits are only preliminary.

Just if there's a discussion coming up.

From reading the CAN FD specs and the first controller register layout of the
M_CAN IP core the picture just settles :-)

> BTW: warning: 1 line adds whitespace errors.
> I've fixed this.


Many thanks!

Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-07  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 16:02 [PATCH 3.6-rc1] canfd: remove redundant CAN FD flag Oliver Hartkopp
2012-08-07  8:16 ` Marc Kleine-Budde
2012-08-07  8:33   ` Oliver Hartkopp

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.