Linux CAN drivers development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: socketcan@hartkopp.net
Cc: linux-can@vger.kernel.org, mkl@pengutronix.de, kuba@kernel.org
Subject: Re: [PATCH can-next v5 08/24] can: isotp: add N_As timeout monitoring for SF/FF/CF
Date: Sat, 05 Dec 2026 01:27:20 +0000	[thread overview]
Message-ID: <179643404050.3142.8094561093795801558@kernel.org> (raw)
In-Reply-To: <20261203-getsockopt-memcg-isotp-v5-8-bbe89b3d3b71@hartkopp.net>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit fixes a reported protocol timing defect but has no
  Fixes: tag and no Cc: stable or explicit no-backport statement.
- [Low] The commit message only says ECOMM 'may be reported earlier'
  because the echo timeout drops from 2 s to 1 s.
- [Low] Several comments in net/can/isotp.c still describe the old
  behaviour after this patch made the local echo and so->echotimer…

--

can: isotp: add N_As timeout monitoring for SF/FF/CF

This commit uses the local echo to supervise the transmission of all SF,
FF and CF frames with the ISO 15765-2 N_As timeout of 1 s. The FC timeout
(N_Bs) now starts only after the FF transmission is confirmed, either by
its local echo or by an early FC. ISOTP_FC_TIMEOUT and ISOTP_ECHO_TIMEOUT
are replaced by a single ISOTP_TIMEOUT of 1 s.

Closes: https://lore.kernel.org/linux-can/eb5e9618-3dbf-42cb-a635-752ff9fbcb99@hartkopp.net/

> The FF with flow control was not supervised at all and the FC timeout
> was started with the transmission request of the FF, so that a delayed
> transmission of the FF shortened the time for the FC of the receiver.

[ ... ]

> Reported-by: Wentian Ye <yewentian395@gmail.com>
> Closes: https://lore.kernel.org/linux-can/eb5e9618-3dbf-42cb-a635-752ff9fbcb99@hartkopp.net/

[Severity: Low]
The commit message describes a reported defect, but the patch has no
Fixes: tag. It also has no Cc: stable and no note saying it should not be
backported. Should one of these be added?

In the baseline isotp_sendmsg(), the FC timer armed at FF request time
comes from:

    hrtimer_sec = ISOTP_FC_TIMEOUT;   (866337865f37)
    tx_hrt = &so->txtimer;            (cf070fe33bfb)

The surrounding send logic goes back to e057dd3fc20f ("can: add ISO
15765-2:2016 transport protocol").

Other patches in this series either carry Fixes:/Cc: stable (for example
"can: isotp: do not send FC.OVFLW in listen mode") or explain why they
don't (for example "can: isotp: check the minimum FF_DL"). This patch also
changes user-visible timing, since the SF/CF echo timeout drops from 2 s
to 1 s.

The follow-up "can: isotp: add N_Ar timeout monitoring for FC" does not
add a Fixes: tag for this either.

> diff --git a/net/can/isotp.c b/net/can/isotp.c
> index 2ef4cbc9962ea..368e50bd82fd7 100644
> --- a/net/can/isotp.c
> +++ b/net/can/isotp.c

[ ... ]

> @@ -1007,9 +1015,16 @@ static void isotp_rcv_echo(struct sk_buff *skb, void *data)
>  	/* cancel local echo timeout */
>  	hrtimer_cancel(&so->echotimer);
>  
> -	/* local echo skb with consecutive frame has been consumed */
> +	/* local echo skb has been consumed */
>  	WRITE_ONCE(so->cfecho, 0);
>  
> +	/* the FF has been sent => start the FC timeout (N_Bs) */
> +	if (READ_ONCE(so->tx.state) == ISOTP_WAIT_FIRST_FC) {
> +		hrtimer_start(&so->txtimer, ktime_set(ISOTP_TIMEOUT, 0),
> +			      HRTIMER_MODE_REL_SOFT);
> +		goto out_unlock;
> +	}
> +

[Severity: Low]
The commit message says:

    As the transmission is now supervised with the N_As timeout of 1 s
    instead of the former local echo timeout of 2 s, the ECOMM error may be
    reported earlier.

For a standard FF (ISOTP_WAIT_FIRST_FC), isn't the ECOMM for a missing FC
now reported later rather than earlier?

Before this patch, isotp_sendmsg() armed so->txtimer for ISOTP_FC_TIMEOUT
(1 s) at the FF send request. With a silent peer, ECOMM came about 1 s
after write().

Now isotp_sendmsg() arms so->echotimer for 1 s. Only when the FF echo
arrives does isotp_rcv_echo() arm so->txtimer for another 1 s. So the time
to ECOMM is the FF echo latency plus 1 s, which can reach about 2 s under
bus load.

This matches ISO 15765-2, but CAN_ISOTP_WAIT_TX_DONE users and
applications watching SO_ERROR will see the difference.

Could the commit message mention this case too? The follow-up "can:
isotp: add N_Ar timeout monitoring for FC" does describe the matching RX
side change ("a delayed transmission of the FC may lead to a later
ETIMEDOUT error").

[ ... ]

> @@ -1308,12 +1321,8 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
>  			/* standard flow control check */
>  			new_state = ISOTP_WAIT_FIRST_FC;
>  
> -			/* start timeout for FC */
> -			hrtimer_sec = ISOTP_FC_TIMEOUT;
> -			tx_hrt = &so->txtimer;
> -
> -			/* no CF echo tag for isotp_rcv_echo() (FF-mode) */
> -			WRITE_ONCE(so->cfecho, 0);
> +			/* set FF echo tag to start the FC timeout (FF-mode) */
> +			WRITE_ONCE(so->cfecho, csx->can_skb_uid);
>  		}
>  	}

[Severity: Low]
This isn't a bug, but so->cfecho and so->echotimer now also cover the SF
and FF, and a few comments in net/can/isotp.c weren't updated.

struct isotp_sock still says:

    u32 cfecho; /* consecutive frame echo tag */

The comment above isotp_echo_timer_handler() still says:

    /* so->echotimer: fires when a sent CF/SF's local echo does not arrive */

However, isotp_sendmsg() now arms this timer for the standard FF too, and
isotp_rcv_fc() cancels it in ISOTP_WAIT_FIRST_FC.

The invariant comments in isotp_send_cframe() and isotp_sendmsg() are:

    /* zero'ed by init/isotp_rcv_echo(); reached lock-free via
    /* cfecho should have been zero'ed by init / former isotp_rcv_echo() */

Neither mentions that isotp_rcv_fc() now also clears cfecho:

    if (READ_ONCE(so->tx.state) == ISOTP_WAIT_FIRST_FC) {
            hrtimer_cancel(&so->echotimer);
            WRITE_ONCE(so->cfecho, 0);
    }

These comments are still unchanged at the end of the series ("can:
isotp: introduce CAN_ISOTP_MIN_TX_DL").

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-getsockopt-memcg-isotp-v5-0-bbe89b3d3b71%40hartkopp.net

  parent reply	other threads:[~2026-12-05  1:27 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:55 [PATCH can-next v5 00/24] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 01/24] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 02/24] can: isotp: read socket options under conf_lock in isotp_getsockopt() Oliver Hartkopp
2026-12-03 12:22   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 03/24] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-12-03 12:41   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 04/24] can: isotp: do not send FC.OVFLW in listen mode Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 05/24] can: isotp: check the CAN_ISOTP_OPTS values before applying them Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 06/24] can: isotp: add the frame transmission time to the CF broadcast gap Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 07/24] can: isotp: limit the frame transmission time to the N_As/N_Ar timeout Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 08/24] can: isotp: add N_As timeout monitoring for SF/FF/CF Oliver Hartkopp
2026-12-03 14:11   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko [this message]
2026-12-03 11:55 ` [PATCH can-next v5 09/24] can: isotp: add N_Ar timeout monitoring for FC Oliver Hartkopp
2026-12-03 14:30   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 10/24] can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS Oliver Hartkopp
2026-12-03 14:50   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 11/24] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 12/24] can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 13/24] can: isotp: drop frames without N_PCI Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 14/24] can: isotp: drop FF frames with invalid length extension Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 15/24] can: isotp: check the minimum FF_DL Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 16/24] can: isotp: check the data length of the last CF Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 17/24] can: isotp: drop inline keyword, let the compiler decide Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 18/24] can: isotp: rename rx_lock as it has become state machine lock Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 19/24] can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 20/24] can: isotp: rename variable for the required content length Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 21/24] can: isotp: rename checkpad functions returning bool values Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 22/24] can: isotp: change return type of functions to void Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 23/24] can: isotp: rename pointer in isotp_rcv() prototype Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 24/24] can: isotp: introduce CAN_ISOTP_MIN_TX_DL Oliver Hartkopp

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=179643404050.3142.8094561093795801558@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --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