[PATCH] can: bcm: Account cyclic transmissions only on success
From: raoxu
Date: Tue Nov 10 2026 - 00:26:14 EST
From: Xu Rao <raoxu@xxxxxxxxxxxxx>
The CAN broadcast manager advances the cyclic frame index and decrements
the initial-interval transmission count even when can_send() fails.
For example, taking the CAN interface down makes can_send() return
-ENETDOWN, but the timer still consumes the configured transmissions and
can report TX_EXPIRED without sending a frame.
Only update cyclic bookkeeping after can_send() succeeds. This matches
the existing successful-send accounting of frames_abs while preserving
the concurrent TX_RESET_MULTI_IDX check.
Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>
---
net/can/bcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 7bd2aa39777a..cd66b23bf95c 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -375,7 +375,7 @@ static void bcm_can_tx(struct bcm_op *op, struct canfd_frame *cf)
* we were sending - a concurrent TX_RESET_MULTI_IDX means this
* frame's bookkeeping belongs to a sequence that no longer exists
*/
- if (!cyclic || op->currframe == idx) {
+ if (!err && (!cyclic || op->currframe == idx)) {
op->currframe++;
/* reached last frame? */
--
2.50.1