Linux CAN drivers development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cunhao Lu" <1579567540@qq.com>
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	linux-can@vger.kernel.org,
	"Oliver Hartkopp" <socketcan@hartkopp.net>
Subject: Re: [PATCH v2 1/3] can: rockchip_canfd: prevent TX stall on echo skb failure
Date: Thu, 30 Jul 2026 10:26:56 +0000	[thread overview]
Message-ID: <20260730102656.B68F61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <tencent_5E44473FC626379A34998A84DF11E6000807@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The `rkcanfd_xmit_retry()` function retransmits the wrong hardware buffer due to using `tx_head` instead of `tx_tail`.
--

--- Patch [1]: [PATCH v2 1/3] can: rockchip_canfd: prevent TX stall on echo skb failure ---
commit f51df37d6dddee0c506b68b904fa428c63fce520
Author: Cunhao Lu <1579567540@qq.com>

can: rockchip_canfd: prevent TX stall on echo skb failure

This commit prevents a TX stall when can_put_echo_skb() fails by not
advancing tx_head or requesting transmission. It ensures the skb is
properly freed on -EINVAL and accounts the frame as dropped.

> diff --git a/drivers/net/can/rockchip/rockchip_canfd-tx.c b/drivers/net/can/rockchip/rockchip_canfd-tx.c
> index 12200dcfd3389..d2cbe25c46d6c 100644
> --- a/drivers/net/can/rockchip/rockchip_canfd-tx.c
> +++ b/drivers/net/can/rockchip/rockchip_canfd-tx.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file I
noticed a pre-existing issue in rkcanfd_xmit_retry().

When a hardware erratum occurs and rkcanfd_rxstx_filter() detects a
mangled self-received frame, it calls rkcanfd_xmit_retry() to retransmit
it. The failed frame is located at the software queue's tail. Does this
code request the correct buffer for retransmission?

drivers/net/can/rockchip/rockchip_canfd-tx.c:rkcanfd_xmit_retry() {
	...
	const unsigned int tx_head = rkcanfd_get_tx_head(priv);
	const u32 reg_cmd = RKCANFD_REG_CMD_TX_REQ(tx_head);

	rkcanfd_start_xmit_write_cmd(priv, reg_cmd);
	...
}

Because rkcanfd_start_xmit() already incremented tx_head, it points to the
next available, uninitialized slot. Will this instruct the hardware to
transmit an empty or uninitialized buffer onto the CAN bus instead of
recovering the valid frame at tx_tail?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-master-v2-0-572974052400@qq.com?part=1

  reply	other threads:[~2026-07-30 10:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260730-master-v2-0-572974052400@qq.com>
2026-07-30 10:11 ` [PATCH v2 1/3] can: rockchip_canfd: prevent TX stall on echo skb failure Cunhao Lu
2026-07-30 10:26   ` sashiko-bot [this message]
2026-07-30 11:38   ` Marc Kleine-Budde
2026-07-30 12:39     ` Cunhao Lu
2026-07-30 10:11 ` [PATCH v2 2/3] can: rockchip_canfd: retry the outstanding TX buffer Cunhao Lu
2026-07-30 10:34   ` sashiko-bot
2026-07-30 10:11 ` [PATCH v2 3/3] can: rockchip_canfd: serialize TX state and command writes Cunhao Lu
2026-07-30 10:50   ` sashiko-bot
2026-07-30 10:11 [PATCH v2 0/3] can: rockchip_canfd: fix TX stalls and races Cunhao Lu

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=20260730102656.B68F61F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=1579567540@qq.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=sashiko-reviews@lists.linux.dev \
    --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