public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: <muhammad.nazim.amirul.nazle.asmade@altera.com>,
	<netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<ast@kernel.org>, <daniel@iogearbox.net>, <hawk@kernel.org>,
	<john.fastabend@gmail.com>, <sdf@fomichev.me>,
	<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] net: stmmac: Disable queues before tx_disable
Date: Wed, 4 Feb 2026 14:50:18 -0800	[thread overview]
Message-ID: <46190ba0-9cb3-4488-abdb-977fd8fda381@intel.com> (raw)
In-Reply-To: <20260204021558.24592-1-muhammad.nazim.amirul.nazle.asmade@altera.com>



On 2/3/2026 6:15 PM, muhammad.nazim.amirul.nazle.asmade@altera.com wrote:
> From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
> 
> Disable all queues and disconnect before tx_disable in stmmac_xdp_release
> to prevent a corner case where packet may be still queued at the same time
> tx_disable is called resulting in kernel panic if some packet still has to
> be processed.
> 

It is helpful to include a (trimmed) copy of the panic if you have one.

> Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

This is a net fix which should have the net tag in the subject and a 
Fixes commit. If it is a regression you should tag as the commit which 
introduced it. Otherwise, indicate the first commit which added 
stmmac_xdp_release().

I saw that there is also __sttmac_release which calls 
stmmac_disable_all_queues() first before calling netif_tx_disable(), so 
this aligns the XDP case with the non-XDP case, so this seems like the 
right approach.

The stmmac_disable_all_queue essentially just calls napi_disable on all 
of the appropriate queues. The netif_tx_disable() calls 
netif_tx_stop_queue() on each queue....


I don't actually know the proper sequencing here. I see several other 
drivers seem to have their napi_disable happening after the call to 
netif_tx_disable. It seems to me like the existing code should be safe, 
at least based on many other driver examples.

I think we need to see the supposed panic to understand the problem and 
whether this fix is correct.

> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index da206b24aaed..7f5a6f30c231 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -6967,15 +6967,15 @@ void stmmac_xdp_release(struct net_device *dev)
>   	struct stmmac_priv *priv = netdev_priv(dev);
>   	u32 chan;
>   
> -	/* Ensure tx function is not running */
> -	netif_tx_disable(dev);
> -
>   	/* Disable NAPI process */
>   	stmmac_disable_all_queues(priv);
>   
>   	for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
>   		hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
>   

The only other action here is to cancel some tx_queue hrtimer? Could 
this have an impact?

> +	/* Ensure tx function is not running */
> +	netif_tx_disable(dev);
> +
>   	/* Free the IRQ lines */
>   	stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);
>   


      reply	other threads:[~2026-02-04 22:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04  2:15 [PATCH v1] net: stmmac: Disable queues before tx_disable muhammad.nazim.amirul.nazle.asmade
2026-02-04 22:50 ` Jacob Keller [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=46190ba0-9cb3-4488-abdb-977fd8fda381@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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