Skip to contentSkip to conversation

can: introduce CANFD_USE flag for mixed content in struct canfd_frame

PATCH New Oliver Hartkopp 1 participant 1 message Aug 12, 2016

Subsystems (2)
lore
Share & tools
lore

Oliver Hartkopp

author maintainer
#0 lore raw

PATCH 1/1 can: introduce CANFD_USE flag for mixed content in struct canfd_frame

The struct can_frame and struct canfd_frame intentionaly share the same layout to be able to write CAN frame content into a CAN FD frame structure. When this is done the former differentiation via CAN_MTU / CANFD_MTU gets lost. CANFD_USE allows programmers to mark CAN FD frames in the case of using struct canfd_frame for mixed CAN / CAN FD content (dual use). N.B. the Kernel APIs do NOT provide mixed CAN / CAN FD content inside of struct canfd_frame therefore the CANFD_USE flag is disregarded by Linux.

---
 include/uapi/linux/can.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/uapi/linux/can.h +9 -0
index 9692cda..698ffc5 100644
@@ -124,9 +124,18 @@ struct can_frame {
  * 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.
+ *
+ * The struct can_frame and struct canfd_frame intentionaly share the same
+ * layout to be able to write CAN frame content into a CAN FD frame structure.
+ * When this is done the former differentiation via CAN_MTU / CANFD_MTU gets
+ * lost. CANFD_USE allows programmers to mark CAN FD frames in the case of
+ * using struct canfd_frame for mixed CAN / CAN FD content (dual use).
+ * N.B. the Kernel APIs do NOT provide mixed CAN / CAN FD content inside of
+ * struct canfd_frame therefore the CANFD_USE flag is disregarded by Linux.
  */
 #define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
 #define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
+#define CANFD_USE 0x04 /* mark CAN FD for dual use of struct canfd_frame */
 
 /**
  * struct canfd_frame - CAN flexible data rate frame structure
Signature · 1 line
2.8.1