mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] can: bcm: Account cyclic transmissions only on success
@ 2026-11-10  5:23 raoxu
  2026-11-10  8:38 ` Oliver Hartkopp
  2026-11-11 21:54 ` netdev-bot+sashiko
  0 siblings, 2 replies; 3+ messages in thread
From: raoxu @ 2026-11-10  5:23 UTC (permalink / raw)
  To: socketcan; +Cc: mkl, linux-can, linux-kernel, raoxu

From: Xu Rao <raoxu@uniontech.com>

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@uniontech.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-11 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  5:23 [PATCH] can: bcm: Account cyclic transmissions only on success raoxu
2026-11-10  8:38 ` Oliver Hartkopp
2026-11-11 21:54 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®