From: netdev-bot+sashiko@kernel.org
To: raoxu@uniontech.com
Cc: socketcan@hartkopp.net, mkl@pengutronix.de,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org
Subject: Re: [PATCH] can: bcm: Account cyclic transmissions only on success
Date: Wed, 11 Nov 2026 21:54:40 +0000 [thread overview]
Message-ID: <179443408049.488853.9633574112206236032@kernel.org> (raw)
In-Reply-To: <45A9B6D8611C63C9+20261110052315.253367-1-raoxu@uniontech.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In bcm_can_tx() (net/can/bcm.c:378), the patch changes the
condition to `if (!err && (!cyclic || op->currframe == idx))`.
- [Low] The commit fixes a user-visible BCM bug: cyclic transmissions and
the ival1 count are used up, and TX_EXPIRED can be reported, without…
--
can: bcm: Account cyclic transmissions only on success
This patch changes bcm_can_tx() so that op->currframe and op->count only
move forward when can_send() returns success. The goal is to stop the BCM
timer from using up the configured ival1 transmissions, and reporting
TX_EXPIRED, when no frame was sent, for example while the interface is down.
> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index 7bd2aa39777af..cd66b23bf95c2 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)) {
[Severity: Medium]
What happens here when can_send() keeps failing with a persistent error?
With the new !err gate, op->count is never decremented. The timer logic
depends on op->count reaching zero:
net/can/bcm.c:bcm_tx_timeout_handler() {
...
tx_ival1 = op->kt_ival1 && (op->count > 0);
...
if (!count && (flags & TX_COUNTEVT)) {
/* create notification to user */
...
}
net/can/bcm.c:bcm_tx_set_expiry() {
...
if (op->kt_ival1 && op->count)
ival = op->kt_ival1;
else if (op->kt_ival2) {
ival = op->kt_ival2;
} else {
spin_unlock_bh(&op->bcm_tx_lock);
return false;
}
...
}
While the error lasts, the op stays in the ival1 phase with no limit. It
never switches to ival2 and never sends TX_EXPIRED.
An op with ival2 == 0 used to stop on its own after count attempts. It now
keeps re-arming at ival1 until the error clears or userspace sends
TX_DELETE.
Several can_send() failures on this path look persistent:
- -ENETDOWN while the interface is administratively down. The NETDEV_DOWN
handling in bcm_notifier() only sets sk->sk_err. Only NETDEV_UNREGISTER
cancels the tx_op timers.
- -EMSGSIZE when a CAN_FD_FRAME op targets a device with CAN_MTU, or after
the MTU is lowered. bcm_tx_setup() only checks cf->len.
- -EPERM and -EINVAL.
- -ENOBUFS once the qdisc fills on a stopped or bus-off controller.
This also changes what count means in the UAPI. It used to count ival1
transmission attempts. It now counts frames that can_send() accepted. The
value reported through TX_READ and TX_STATUS changes to match.
Documentation/networking/can.rst describes count as a timer schedule:
"run 'count' times with ival1". It describes TX_EXPIRED as "Notification
when counter finishes sending at initial interval". It does not say that
failed sends are retried at ival1 with no limit.
The commit message only covers the opposite symptom, TX_EXPIRED being
reported too early.
Was this change in meaning intended? If so, could the commit message and
the documentation describe it? Should there be a limit when the error is
permanent, such as -ENETDOWN or -EMSGSIZE?
[Severity: Low]
Should this commit have a Fixes: tag?
The behaviour being changed goes back to the original BCM code. git blame
points at ffd980f976e7 ("[CAN]: Add broadcast manager (bcm) protocol").
The count decrement was later moved into bcm_can_tx() by c2aba69d0c36a4.
The TX_RESET_MULTI_IDX guard was added by 749179c2e25b95.
Could the commit name one of these in a Fixes: tag? If it is not meant for
stable, could it say that this is a behaviour change instead?
> op->currframe++;
>
> /* reached last frame? */
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/45A9B6D8611C63C9%2B20261110052315.253367-1-raoxu%40uniontech.com
prev parent reply other threads:[~2026-11-11 21:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 5:23 raoxu
2026-11-10 8:38 ` Oliver Hartkopp
2026-11-11 21:54 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179443408049.488853.9633574112206236032@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=raoxu@uniontech.com \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®