BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-sunxi@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [PATCH net-next v5 15/19] net: stmmac: restore TC offloads before restarting DMA
Date: Mon, 28 Sep 2026 22:00:27 +0000	[thread overview]
Message-ID: <20260928220028.1D2851F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-submit-stmmac-reset-fixes-v1-v5-15-feec6c14dd06@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: stmmac: restoring failed TAPRIO schedule uses stale base time
--

commit 8c820a1d24ead26f459c2d60dccc5c98e5feaf2f
Author: James Hilliard <james.hilliard1@gmail.com>

net: stmmac: restore TC offloads before restarting DMA

This commit adjusts the restoration of TC offloads in stmmac to occur
before restarting DMA during hardware setup or resume. It also modifies
TAPRIO configuration to validate replacements separately, only publishing
the new schedule upon success and falling back to the old schedule if
programming fails.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
[ ... ]
> @@ -1032,48 +1091,43 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
[ ... ]
> -	ret = __stmmac_setup_est(priv);
> +	mutex_lock(&priv->est_lock);
> +	ret = __stmmac_setup_est(priv, est);
>  	if (ret)
> -		goto disable;
> +		goto restore;
>  
>  	ret = tc_config_preemption(priv, extack, qopt->mqprio.preemptible_tcs);
>  	if (ret)
> -		goto disable;
> -
> -	priv->est.enable = true;
> -	kfree(gcl);
> +		goto restore;
>  
> +	priv->est = *est;
>  	mutex_unlock(&priv->est_lock);
> +free_est:
> +	kfree(est);
> +	return ret;
>  
> -	return 0;
> +restore:
> +	/* A failed hardware update must not publish the rejected schedule. */
> +	if (stmmac_est_configure(priv, priv, &priv->est,
> +				 priv->plat->clk_ptp_rate, priv->est.enable))

[Severity: Medium]
Will this restore operation use a stale base time that is in the past?

If __stmmac_setup_est() succeeds with the new schedule but the subsequent
tc_config_preemption() fails, the code jumps to the restore label.

This restore path calls stmmac_est_configure() directly on the old
priv->est. Because it bypasses __stmmac_setup_est() for the restoration,
it skips calculating a valid future base time via stmmac_calc_tas_basetime()
and appears to write the old base time register values back to the hardware.

Could this lead to hardware schedule malfunctions, such as loop errors
or a failure to start, since the old base time lies in the past?

> +		netdev_err(priv->dev, "failed to restore EST\n");
> +	mutex_unlock(&priv->est_lock);
> +	goto free_est;
>  
>  disable:
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-submit-stmmac-reset-fixes-v1-v5-0-feec6c14dd06@gmail.com?part=15

  reply	other threads:[~2026-09-28 22:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 21:59 [PATCH net-next v5 00/19] net: stmmac: preserve datapath state across MTU and resume failures James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 01/19] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 02/19] net: stmmac: request the MDIO reset GPIO only once James Hilliard
2026-09-27 23:35   ` Linus Walleij
2026-09-27 23:49     ` James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 03/19] net: phylink: allow stopping a suspended instance James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 04/19] xsk: freeze deferred pool teardown during system sleep James Hilliard
2026-09-28 12:16   ` Björn Töpel
2026-09-27 21:59 ` [PATCH net-next v5 05/19] net: stmmac: embed struct stmmac_est in stmmac_priv struct James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 06/19] net: stmmac: pass the desired EST enable state to est_configure() James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 07/19] net: stmmac: re-apply taprio offload in __stmmac_open() and stmmac_resume() James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 08/19] net: stmmac: serialize and retain PHC configuration across reset James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 09/19] net: stmmac: leave the datapath running for normal-size MTU changes James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 10/19] net: stmmac: fix error path cleanup in DMA descriptor ring allocation James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 11/19] net: stmmac: complete DMA configuration allocation unwind James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 12/19] net: stmmac: keep DMA configurations at stable addresses James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 13/19] net: stmmac: track datapath and power ownership across failed reopening James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 14/19] net: stmmac: use the tracked datapath restart for XSK pool changes James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 15/19] net: stmmac: restore TC offloads before restarting DMA James Hilliard
2026-09-28 22:00   ` sashiko-bot [this message]
2026-09-27 21:59 ` [PATCH net-next v5 16/19] xsk: allow drivers to retain DMA mappings independently of pools James Hilliard
2026-09-28 12:22   ` Björn Töpel
2026-09-27 21:59 ` [PATCH net-next v5 17/19] net: stmmac: retain DMA memory until hardware shutdown completes James Hilliard
2026-09-28 22:00   ` sashiko-bot
2026-09-27 21:59 ` [PATCH net-next v5 18/19] net: stmmac: prepare device-local DMA interrupt quiescence James Hilliard
2026-09-27 21:59 ` [PATCH net-next v5 19/19] net: stmmac: retain DMA resources across MTU changes James Hilliard
2026-09-27 22:10 ` [PATCH net-next v5 00/19] net: stmmac: preserve datapath state across MTU and resume failures Jakub Kicinski
2026-09-27 23:15   ` James Hilliard
2026-09-28  6:50 ` Maxime Chevallier

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=20260928220028.1D2851F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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