Re: [PATCH net v10 08/10] can: rockchip_canfd: retry the outstanding TX buffer

From: Cunhao Lu

Date: Sat Nov 21 2026 - 02:49:44 EST


Hi,

> [Severity: Low]
> Is there a limit on how many times this re-arms?
>
> rkcanfd_chip_start() enables RKCANFD_REG_MODE_AUTO_RETX_MODE. If the
> retried frame never gets an ACK (for example the bus is unplugged or the
> only other node goes silent), the controller keeps retransmitting and
> TX_REQ stays set.
>
> Under the ISO 11898-1 fault confinement exception, an error-passive
> transmitter that sees only ACK errors does not increase TEC. Bus-off is
> never reached, so rkcanfd_tx_disable()->rkcanfd_tx_retry_stop() never
> runs.
>
> Wouldn't this worker then take tx_lock and read RKCANFD_REG_CMD once per
> jiffy until the interface is closed or restarted? An un-ACKed frame also
> stalled TX before this patch, but the per-jiffy polling with no limit is
> new.
>
> In the spurious match case the stuck request is the untracked duplicate.
> The queue then stays stopped even though tx_pending is 0.

No. A missing ACK alone does not start the worker. The driver must first
issue a software retry for erratum 6. Either TX0_REQ or TX1_REQ must
then stay set, and the interface must remain up without the controller
going bus-off. Prolonged polling requires all of those conditions.

I tested this on RK3588. The first time the worker took the busy path,
TX0_REQ was still set, so it scheduled another poll. By the next poll,
both TX0_REQ and TX1_REQ were clear. I suspect the
prolonged polling you describe may never occur in practice, although
this test alone cannot establish that.

> [Severity: Medium]
>
> Is it safe to release the guard as soon as both TX_REQ bits read clear?
>
> rkcanfd_xmit_retry() starts a second hardware transmission of the frame at
> tx_tail, but it creates no echo_skb slot or pending count for it. Clear
> TX_REQ bits only mean the hardware finished sending. The RXSTX
> self-reception of the retried copy may still be in the RX FIFO.
>
> Take the ordering the commit message describes, where the original request
> has already completed when the matching standard frame is processed:
>
> 1. Standard frame S matches pending EFF frame B at tx_tail.
> rkcanfd_rxstx_filter() calls rkcanfd_xmit_retry(), and B is sent again.
>
> 2. B's original echo, still in the RX FIFO, matches echo_skb[tx_tail].
> tx_tail advances and tx_pending becomes 0.
>
> 3. The retry finishes. This worker sees TX_REQ clear,
> rkcanfd_get_effective_tx_free() returns 2, and the queue is woken.
>
> [...]
>
> Should the echo of the retry be accounted for? If not, could the commit
> message also mention the local phantom RX and the misattributed
> completion?

The driver already retries the frame without allocating a second echo
slot. Once the original echo has been consumed, the retry echo can be
delivered as ordinary RX or mistaken for the completion of an identical
successor. This predates the patch. The guard keeps new submissions from
overwriting the TX registers while the retry is active. It does not
identify the retry echo, and I do not currently plan to fix this issue
in this patch.

Best regards,
Cunhao Lu