[PATCH v2 1/3] can: rockchip_canfd: prevent TX stall on echo skb failure
Marc Kleine-Budde
mkl at pengutronix.de
Thu Jul 30 04:38:57 PDT 2026
On 30.07.2026 18:11:46, Cunhao Lu wrote:
> rkcanfd_start_xmit() advances tx_head and requests transmission even when
> can_put_echo_skb() fails. This creates a pending TX entry without the echo
> skb that the RXSTX completion path needs to match the self-received frame.
> The entry cannot be completed, and the netdev TX queue can remain stopped
> after the two-entry software FIFO fills.
>
> Do not advance tx_head or request transmission if the echo skb cannot be
> installed. Account the frame as dropped and report the error. The
> -ENOMEM and -EBUSY paths have already consumed the skb; explicitly free
> it on -EINVAL, where ownership remains with the caller.
Can you update can_put_echo_skb() to always free the skb in the error case?
> Fixes: b6661d73290c ("can: rockchip_canfd: add TX PATH")
> Cc: stable at vger.kernel.org
> Signed-off-by: Cunhao Lu <1579567540 at qq.com>
> ---
> drivers/net/can/rockchip/rockchip_canfd-tx.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/rockchip/rockchip_canfd-tx.c b/drivers/net/can/rockchip/rockchip_canfd-tx.c
> index 12200dcfd338..d2cbe25c46d6 100644
> --- a/drivers/net/can/rockchip/rockchip_canfd-tx.c
> +++ b/drivers/net/can/rockchip/rockchip_canfd-tx.c
> @@ -125,8 +125,18 @@ netdev_tx_t rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>
> frame_len = can_skb_get_frame_len(skb);
> err = can_put_echo_skb(skb, ndev, tx_head, frame_len);
> - if (!err)
> - netdev_sent_queue(priv->ndev, frame_len);
> + if (err) {
> + if (err == -EINVAL)
> + dev_kfree_skb_any(skb);
> +
> + ndev->stats.tx_dropped++;
> + if (net_ratelimit())
> + netdev_err(ndev, "%s: failed to put echo skb: %pe\n",
> + __func__, ERR_PTR(err));
Is this error message needed? In the -EINVAL case can_put_echo_skb()
already emits an error. If skb allocation I think in -ENOMEM case the
kernel already throws an error, right?
> +
> + return NETDEV_TX_OK;
> + }
> + netdev_sent_queue(priv->ndev, frame_len);
>
> WRITE_ONCE(priv->tx_head, priv->tx_head + 1);
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20260730/6ace2949/attachment.sig>
More information about the Linux-rockchip
mailing list