Fixing following build issues seen when building with clang (AOSP14):
cansend.c:168:11: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (mtu >= CANXL_MIN_MTU) {
~~~ ^ ~~~~~~~~~~~~~
lib.c:525:14: error: comparison of integers of different signs: 'int'
and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (maxsize > size - 1) {
~~~~~~~ ^ ~~~~~~~~
cangen.c:777:29: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (canxl && (ifr.ifr_mtu < CANXL_MIN_MTU)) {
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
cangen.c:782:29: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (canfd && (ifr.ifr_mtu < CANFD_MTU)) {
~~~~~~~~~~~ ^ ~~~~~~~~~
cangen.c:796:19: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (ifr.ifr_mtu >= CANXL_MIN_MTU) {
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
cangen.c:1073:20: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (ifr.ifr_mtu >= CANXL_MIN_MTU)
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
candump.c:758:15: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (nbytes < CANXL_HDR_SIZE + CANXL_MIN_DLEN) {
~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Update includes to support CAN XL and latest CAN netlink features.
Upstream commits:
(1a3e3034c049) "can: canxl: introduce CAN XL data structure"
(061834624c87) "can: set CANFD_FDF flag in all CAN FD frame structures"
(94dfc73e7cf4) "treewide: uapi: Replace zero-length arrays with flexible-array members"
(383f0993fc77) "can: netlink: report the CAN controller mode supported flags"
(d99755f71a80) "can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC)"
(63dfe0709643) "can: bittiming: allow TDC{V,O} to be zero and add can_tdc_const::tdc{v,o,f}_min"
(626332696d75) "can: raw: add CAN XL support"
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
ISO 11898-1 Chapter 8.4.2.3 defines a 4 bit data length code (DLC) table which
maps the DLC to the payload length of the CAN frame in bytes:
DLC -> payload length
0 .. 8 -> 0 .. 8
9 .. 15 -> 8
Although the DLC values 8 .. 15 in Classical CAN always result in a payload
length of 8 bytes these DLC values are transparently transmitted on the CAN
bus. As the struct can_frame only provides a 'len' element (formerly 'can_dlc')
which contains the plain payload length ( 0 .. 8 ) of the CAN frame, the raw
DLC is not visible to the application programmer, e.g. for testing use-cases.
To access the raw DLC values 9 .. 15 the len8_dlc element is introduced, which
is only valid when the payload length 'len' is 8 and the DLC is greater than 8.
The len8_dlc element is filled by the CAN interface driver and used for CAN
frame creation by the CAN driver when the CAN_CTRLMODE_CC_LEN8_DLC flag is
supported by the driver and enabled via netlink configuration interface.
Reported-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This patch adds the typedef for __kernel_sa_family_t that was introduced in
Linux v3.1-rc2 (commit 6602a4b net: Make userland include of netlink.h more sane)
in <linux/socket.h>. It must be duplicated here to make the CAN headers
self-contained.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This patch remove the include of version.h, as it's not used and also not
present in the kernel headers.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This patch fixes paths mentioned in the files which are wrong now, due the move
of the files in the previous patch.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This makes it possible to import header from the kernel more easily, e.g.:
cd $path_to_linux_repo
make headers_install
rsync -a --exclude .\* usr/include/linux/can* $path_to_can_utils/include/linux
[mkl: also move isotp.h although Uwe skipped it as it is not
part of the upstream kernel; adapt commit log accordingly]
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>