Skip to content

Commit affdc1b

Browse files
committed
can: uapi: update can.h to latest upstream version
This update includes: commit f5076c6ba02e ("can: uapi: can.h: mark union inside struct can_frame packed") commit 7e97d274db92 ("can: uapi: update CAN-FD frame description") commit 025468842212 ("can: uapi: introduce CANFD_FDF flag for mixed content in struct canfd_frame") Signed-off-by: Oliver Hartkopp <[email protected]>
1 parent a70801f commit affdc1b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

include/linux/can.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct can_frame {
113113
*/
114114
__u8 len;
115115
__u8 can_dlc; /* deprecated */
116-
};
116+
} __attribute__((packed)); /* disable padding added in some ABIs */
117117
__u8 __pad; /* padding */
118118
__u8 __res0; /* reserved / padding */
119119
__u8 len8_dlc; /* optional DLC for 8 byte payload length (9 .. 15) */
@@ -123,8 +123,8 @@ struct can_frame {
123123
/*
124124
* defined bits for canfd_frame.flags
125125
*
126-
* The use of struct canfd_frame implies the Extended Data Length (EDL) bit to
127-
* be set in the CAN frame bitstream on the wire. The EDL bit switch turns
126+
* The use of struct canfd_frame implies the FD Frame (FDF) bit to
127+
* be set in the CAN frame bitstream on the wire. The FDF bit switch turns
128128
* the CAN controllers bitstream processor into the CAN FD mode which creates
129129
* two new options within the CAN FD frame specification:
130130
*
@@ -135,9 +135,18 @@ struct can_frame {
135135
* controller only the CANFD_BRS bit is relevant for real CAN controllers when
136136
* building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make
137137
* sense for virtual CAN interfaces to test applications with echoed frames.
138+
*
139+
* The struct can_frame and struct canfd_frame intentionally share the same
140+
* layout to be able to write CAN frame content into a CAN FD frame structure.
141+
* When this is done the former differentiation via CAN_MTU / CANFD_MTU gets
142+
* lost. CANFD_FDF allows programmers to mark CAN FD frames in the case of
143+
* using struct canfd_frame for mixed CAN / CAN FD content (dual use).
144+
* N.B. the Kernel APIs do NOT provide mixed CAN / CAN FD content inside of
145+
* struct canfd_frame therefore the CANFD_FDF flag is disregarded by Linux.
138146
*/
139147
#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
140148
#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
149+
#define CANFD_FDF 0x04 /* mark CAN FD for dual use of struct canfd_frame */
141150

142151
/**
143152
* struct canfd_frame - CAN flexible data rate frame structure

0 commit comments

Comments
 (0)