Commit 94ce880ba756df6171da28538fe9e4f8f39c323d

Authored by Joakim Zhang
1 parent f54dc1486d

MLK-21424 can: flexcan: fix normal CAN can't receive remote frame after setting fd mode

The variable "is_canfd" will stay true after the following sequence:
root@imx8qxpmek:~# ip link set can0 type can bitrate 1000000 dbitrate 4000000 fd on
root@imx8qxpmek:~# ip link set can0 up
root@imx8qxpmek:~# ip link set can0 down
root@imx8qxpmek:~# ip link set can0 type can bitrate 1000000

It will use alloc_canfd_skb() to allocate skb for normal CAN when
"is_canfd" is true, which will affect the receive of remote frame.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/net/can/flexcan.c
... ... @@ -1322,6 +1322,8 @@
1322 1322 priv->mb_size = FLEXCAN_MB_FD_SIZE;
1323 1323 priv->mb_num = FLEXCAN_MB_FD_NUM;
1324 1324 } else {
  1325 + priv->offload.is_canfd = false;
  1326 +
1325 1327 priv->mb_size = FLEXCAN_MB_SIZE;
1326 1328 priv->mb_num = FLEXCAN_MB_NUM;
1327 1329 }