]> git.baikalelectronics.ru Git - kernel.git/commit
can: raw: fix CAN FD frame transmissions over CAN XL devices
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 31 Jan 2023 10:56:13 +0000 (11:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:10 +0000 (11:28 +0100)
commit431252b5b03bffaa5fb99e2c9fc65b1e9f235f21
tree251fb284c797c52254937e035a58d775114082cf
parentbcb6c53749f20a6d9a2ba8dcebd93e44f6ee3d45
can: raw: fix CAN FD frame transmissions over CAN XL devices

[ Upstream commit a8b424ad1eba818ad49cb418d0f8ed2a140602c5 ]

A CAN XL device is always capable to process CAN FD frames. The former
check when sending CAN FD frames relied on the existence of a CAN FD
device and did not check for a CAN XL device that would be correct
too.

With this patch the CAN FD feature is enabled automatically when CAN
XL is switched on - and CAN FD cannot be switch off while CAN XL is
enabled.

This precondition also leads to a clean up and reduction of checks in
the hot path in raw_rcv() and raw_sendmsg(). Some conditions are
reordered to handle simple checks first.

changes since v1: https://lore.kernel.org/all/20230131091012.50553-1-socketcan@hartkopp.net
- fixed typo: devive -> device
changes since v2: https://lore.kernel.org/all/20230131091824.51026-1-socketcan@hartkopp.net/
- reorder checks in if statements to handle simple checks first

Fixes: 2ea1b123bcdd ("can: raw: add CAN XL support")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230131105613.55228-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/can/raw.c