All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fan Hailong/范海龙" <hailong.fan@siengine.com>
To: Eric Dumazet <edumazet@google.com>,
	"2694439648@qq.com" <2694439648@qq.com>
Cc: "andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"alexandre.torgue@foss.st.com" <alexandre.torgue@foss.st.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"inux-kernel@vger.kernel.org" <inux-kernel@vger.kernel.org>
Subject: 回复: [PATCH] net: stmmac: Modify the judgment condition of "tx_avail" from 1 to 2
Date: Tue, 2 Dec 2025 01:24:35 +0000	[thread overview]
Message-ID: <addd14c84f164e4e90e35e8dc4121dd4@siengine.com> (raw)
In-Reply-To: <CANn89iLW+68YE9s9dChEcQYbmwXSBzWRPzFH50+--Kw3XNZXEQ@mail.gmail.com>

Hi Eric

You are right, I will follow your advice to modify the relevant code.

Regards
Hailong


-----邮件原件-----
发件人: Eric Dumazet <edumazet@google.com> 
发送时间: 2025年12月1日 20:21
收件人: 2694439648@qq.com
抄送: andrew+netdev@lunn.ch; davem@davemloft.net; kuba@kernel.org; pabeni@redhat.com; mcoquelin.stm32@gmail.com; alexandre.torgue@foss.st.com; Fan Hailong/范海龙 <hailong.fan@siengine.com>; netdev@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-arm-kernel@lists.infradead.org; inux-kernel@vger.kernel.org
主题: Re: [PATCH] net: stmmac: Modify the judgment condition of "tx_avail" from 1 to 2

On Sun, Nov 30, 2025 at 6:57 PM <2694439648@qq.com> wrote:
>
> From: "hailong.fan" <hailong.fan@siengine.com>
>
>     Under certain conditions, a WARN_ON will be triggered
>     if avail equals 1.
>
>     For example, when a VLAN packet is to send,
>     stmmac_vlan_insert consumes one unit of space,
>     and the data itself consumes another.
>     actually requiring 2 units of space in total.
>
> Signed-off-by: hailong.fan <hailong.fan@siengine.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 7b90ecd3a..b575384cd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4529,7 +4529,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>                 }
>         }
>
> -       if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
> +       if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 2)) {
>                 if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, queue))) {
>                         netif_tx_stop_queue(netdev_get_tx_queue(priv->dev,
>                                                                 
> queue));

Drivers should stop their queues earlier.

NETDEV_TX_BUSY is almost always wrong.

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7b90ecd3a55e600458b0c87d6125831626f4683d..6dcc7b84a8759763b6471a48a6c80b1f17cd937c
100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4675,7 +4675,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
                print_pkt(skb->data, skb->len);
        }

-       if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) {
+       if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 
+ 2))) {
                netif_dbg(priv, hw, priv->dev, "%s: stop transmitted packets\n",
                          __func__);
                netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue));

      reply	other threads:[~2025-12-02  1:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01  2:57 [PATCH] net: stmmac: Modify the judgment condition of "tx_avail" from 1 to 2 2694439648
2025-12-01 11:13 ` Simon Horman
2025-12-01 12:21 ` Eric Dumazet
2025-12-02  1:24   ` Fan Hailong/范海龙 [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=addd14c84f164e4e90e35e8dc4121dd4@siengine.com \
    --to=hailong.fan@siengine.com \
    --cc=2694439648@qq.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=inux-kernel@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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.