All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stéphane Grosjean" <stephane.grosjean@free.fr>
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Oliver Hartkopp" <socketcan@hartkopp.net>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	linux-can@vger.kernel.org
Subject: Re: [PATCH v3] can: peak_usb: Add PCAN-USB bus errors reporting
Date: Fri, 25 Sep 2026 13:29:16 +0000	[thread overview]
Message-ID: <20260925132917.3B3CF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925-peak_usb-v3-1-e7bfccacf795@peak-system.fr>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] can: missing CAN_ERR_CNT flag in bus error frame
--

commit d66a7ddeb9e61cb6f2f338731231a0a8c41a3d91
Author: Stéphane Grosjean <s.grosjean@peak-system.fr>

can: peak_usb: Add PCAN-USB bus errors reporting

This patch implements missing CAN bus error reporting for PCAN-USB devices.
It parses the hardware ECC, RX, and TX counters to construct standard CAN
error frames.

> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
> index 8fd058c328564..c59166a29648d 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
[ ... ]
> @@ -550,23 +560,94 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
[ ... ]
> +			/* allocate an skb to store the error frame */
> +			skb = alloc_can_err_skb(mc->netdev, &cf);
> +			if (!skb)
> +				return -ENOMEM;
> +
> +			cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
> +			cf->data[2] |= can_err_tx;
> +
> +			/* set error type according to 1st data byte (ECC) */
[ ... ]
> +			/* set error location */
> +			cf->data[3] = ecc & PCAN_SJA1000_ECC_SEG;
> +
> +			cf->data[6] = pdev->bec.txerr;
> +			cf->data[7] = pdev->bec.rxerr;

[Severity: Medium]
Is this missing the CAN_ERR_CNT flag in cf->can_id?

Userspace tools like candump rely on the CAN_ERR_CNT flag in the CAN ID to
know if data[6] and data[7] contain valid error counters. Because the flag
is not set here in pcan_usb_handle_bus_evt(), will these tools silently
ignore the newly provided TX and RX error counters?

> +
> +			if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {
> +				struct skb_shared_hwtstamps *hwts =
> +					skb_hwtstamps(skb);
> +
> +				peak_usb_get_ts_time(&mc->pdev->time_ref,
> +						     mc->ts16, &hwts->hwtstamp);
> +			}
> +
> +			netif_rx(skb);
> +		}
>  	}
>  
>  	return 0;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-peak_usb-v3-1-e7bfccacf795@peak-system.fr?part=1

      reply	other threads:[~2026-09-25 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 13:19 [PATCH v3] can: peak_usb: Add PCAN-USB bus errors reporting Stéphane Grosjean
2026-09-25 13:29 ` sashiko-bot [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=20260925132917.3B3CF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --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 \
    --cc=stephane.grosjean@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.