From: Thomas BOURGOIN <thomas.bourgoin@foss.st.com>
To: Ding Hui <dinghui1111@163.com>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
"open list:STMMAC ETHERNET DRIVER" <netdev@vger.kernel.org>,
"moderated list:ARM/STM32 ARCHITECTURE"
<linux-stm32@st-md-mailman.stormreply.com>,
"moderated list:ARM/STM32 ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Cc: <dinghui@lixiang.com>, <xiasanbo@lixiang.com>,
<yangchen11@lixiang.com>, <liuxuanjun@lixiang.com>,
<zhoujing3@lixiang.com>, <fujiahui@lixiang.com>
Subject: Re: [PATCH net v5 2/2] net: stmmac: restore RX descriptor buffer addresses on resume
Date: Mon, 2 Nov 2026 09:14:21 +0100 [thread overview]
Message-ID: <872a93b8-4bd9-4718-89e2-019fd3c5b8ac@foss.st.com> (raw)
In-Reply-To: <20261025100636.613670-3-dinghui1111@163.com>
Hello,
I reproduced this issue on the STM32MP215-DK. I’m using kernel v6.18.
I fixed it similarly to your v5 patch set (cf.
https://lore.kernel.org/all/20261027150556.51209-2-thomas.bourgoin@foss.st.com/).
I am limited to testing the low-power sequence on the STM32MP215-DK
because we are currently upstreaming.
I backported your series to the STM32 fork based on v6.18, but I had to
modify it because of some compilation issues, so I cannot say I tested
your series as-is.
Overall, I’m okay with your patch, I have a few suggestions:
> + stmmac_legacy_serdes_power_down(priv);
> + mutex_unlock(&priv->lock);
> + rtnl_unlock();
> + return ret;
replace these 4 lines with: `goto error_unlock;`
> @@ -8503,6 +8577,18 @@ int stmmac_resume(struct device *dev)
> stmmac_free_tx_skbufs(priv);
> stmmac_clear_descriptors(priv, &priv->dma_conf);
>
> + for (queue = 0; queue < priv->plat->rx_queues_to_use; queue++) {
> + ret = stmmac_reinit_rx_descriptors(priv, &priv->dma_conf, queue);
> + if (ret) {
> + netdev_err(ndev, "Failed to restore RX queue %u: %d\n",
> + queue, ret);
> + stmmac_legacy_serdes_power_down(priv);
> + mutex_unlock(&priv->lock);
> + rtnl_unlock();
> + return ret;
> + }
> + }
> +
> ret = stmmac_hw_setup(ndev);
> if (ret < 0) {
> netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
You could move the calls to `stmmac_free_tx_skbufs()`,
`stmmac_clear_descriptors()`, and your loop into a dedicated function,
perhaps something like `stmmac_resume_descriptors()`.
In my PR, I also factorized the loops so there is one for TX and one for
RX, instead of one loop for TX and RX in `stmmac_clear_descriptors()`,
one loop for TX in `stmmac_free_tx_skbufs()`, and one loop for RX to
rebuild them.
By doing this, I managed to remove the `stmmac_free_tx_skbufs()`
function. It changes the PM sequence a bit, but I think it is okay. I’ll
let you decide whether you want to do it or not.
> + /* GMAC4/XGMAC secondary address writes overwrite the OWN bit. */
> + dma_wmb();
> + for (i = 0; i < dma_conf->dma_rx_size; i++) {
> + buf = &rx_q->buf_pool[i];
> + if (rx_q->xsk_pool && !buf->xdp)
> + continue;
> +
> + p = stmmac_get_rx_desc(priv, rx_q, i);
> + stmmac_set_rx_owner(priv, p, false);
> + }
Since on GMAC4/XGMAC we need to set the owner bit after writing the
secondary address, why do we need to call `stmmac_clear_descriptors()`
before reinitializing the RX descriptors?
Since `stmmac_clear_descriptors()` is a loop that calls
`stmmac_init_rx_desc()`, and I verified that all `.init_rx_desc` ops set
the OWN bit to 1, could we call `stmmac_clear_descriptors()` after
rebuilding the RX descriptors instead and remove this loop ?
Best regards,
Thomas
next prev parent reply other threads:[~2026-11-02 8:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 10:06 [PATCH net v5 0/2] net: stmmac: restore RX descriptors " Ding Hui
2026-10-25 10:06 ` [PATCH net v5 1/2] net: stmmac: honor allocation flags when initializing RX buffers Ding Hui
2026-10-25 10:06 ` [PATCH net v5 2/2] net: stmmac: restore RX descriptor buffer addresses on resume Ding Hui
2026-10-26 11:10 ` netdev-bot+sashiko
2026-11-02 8:14 ` Thomas BOURGOIN [this message]
2026-11-03 6:00 ` Ding Hui
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=872a93b8-4bd9-4718-89e2-019fd3c5b8ac@foss.st.com \
--to=thomas.bourgoin@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dinghui1111@163.com \
--cc=dinghui@lixiang.com \
--cc=edumazet@kernel.org \
--cc=fujiahui@lixiang.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=liuxuanjun@lixiang.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiasanbo@lixiang.com \
--cc=yangchen11@lixiang.com \
--cc=zhoujing3@lixiang.com \
/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
all inboxes | Powered by JetHome®