[PATCH 0/3] can: rockchip_canfd: fix TX stalls and echo skb races

Cunhao Lu 1579567540 at qq.com
Wed Jul 29 23:11:21 PDT 2026


While running CAN traffic on an RK3588 system, the driver repeatedly
reported an inconsistent TX echo state:

  rockchip_canfd fea60000.can can0: rkcanfd_tx_tail_is_eff:
  echo_skb[0]=NULL tx_head=0x00060f7d tx_tail=0x00060f7c

The Rockchip CAN-FD driver completes transmissions by matching
self-received frames with entries in the echo skb ring. The warning above
is emitted when the driver sees a pending transmission but finds no skb in
the corresponding echo slot.

The immediate cause is a race between the transmit and completion paths.
The completion path removes an echo skb before advancing tx_tail, while
the transmit path reads tx_head, tx_tail and that echo slot without common
synchronization. It can therefore observe a partially updated state,
report the warning and stop the TX queue without a later completion to
wake it.

While investigating the warning, two additional ways for the TX state to
become inconsistent were found. The transmit path submits a frame and
advances tx_head even if installing its echo skb fails. In addition, the
erratum 6 retry path selects tx_head, which denotes the next free buffer
with a two-entry FIFO, instead of retrying the outstanding buffer at
tx_tail.

This series makes echo skb setup failure abort the transmission, retries
the correct hardware buffer, and serializes the TX head, tail and echo
ring updates with a spinlock.

All three patches pass scripts/checkpatch.pl.

---
Cunhao Lu (3):
      can: rockchip_canfd: prevent TX stall on echo skb failure
      can: rockchip_canfd: retry the outstanding TX buffer
      can: rockchip_canfd: fix TX echo skb race

 drivers/net/can/rockchip/rockchip_canfd-core.c |  1 +
 drivers/net/can/rockchip/rockchip_canfd-rx.c   | 31 +++++++++++++-----
 drivers/net/can/rockchip/rockchip_canfd-tx.c   | 44 ++++++++++++++++++++++----
 drivers/net/can/rockchip/rockchip_canfd.h      |  4 ++-
 4 files changed, 64 insertions(+), 16 deletions(-)
---
base-commit: 11028ab62899e4191e074ee364c712b77823a9c4
change-id: 20260730-master-a1b54b3cf5a0

Best regards,
--  
Cunhao Lu <1579567540 at qq.com>




More information about the Linux-rockchip mailing list