hw/net/can/xlnx-versal-canfd: Simplify DLC conversions
authorDoug Brown <doug@schmorgal.com>
Fri, 13 Sep 2024 14:31:49 +0000 (15:31 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 13 Sep 2024 14:31:49 +0000 (15:31 +0100)
commit12d60ca09e5150b785d067566f49e330c68b2985
tree94a02eefa0cd0ff38e9084ccf6f3701dd18326a2
parentbe243e9ddb8f0ba149a1c51faee035c303be7eeb
hw/net/can/xlnx-versal-canfd: Simplify DLC conversions

Use QEMU's helper functions can_dlc2len() and can_len2dlc() for
translating between the raw DLC value and the SocketCAN length value.
This also has the side effect of correctly handling received CAN FD
frames with a DLC of 0-8, which was broken previously.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Reviewed-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Message-id: 20240827034927.66659-7-doug@schmorgal.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/net/can/xlnx-versal-canfd.c