From: Jakub Kicinski <kuba@kernel.org>
To: 2694439648@qq.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, 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
Subject: Re: [PATCH v2] net: stmmac: Modify the judgment condition of "tx_avail" from 1 to 2
Date: Tue, 2 Dec 2025 10:34:52 -0800 [thread overview]
Message-ID: <20251202103452.0d2df13d@kernel.org> (raw)
In-Reply-To: <tencent_4A0CBC92B9B22C699AC2890E139565FCB306@qq.com>
On Tue, 2 Dec 2025 15:43:59 +0800 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.
>
> ---
> V0-V1:
> 1. Stop their queues earlier
> V2-V1:
> 1. add fixes tag
> 2. Add stmmac_extra_space to count the additional required space
Why is the commit message indented ? Please looks around the mailing
list and try to follow the format others are using. Or read the
documentation. Either of the two will do.
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#changes-requested
> Fixes: 30d932279dc2 ("net: stmmac: Add support for VLAN Insertion Offload")
> Signed-off-by: hailong.fan <hailong.fan@siengine.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 7b90ecd3a..9a665a3b2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4476,6 +4476,15 @@ static bool stmmac_has_ip_ethertype(struct sk_buff *skb)
> (proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6));
> }
>
> +static inline int stmmac_extra_space(struct stmmac_priv *priv,
> + struct sk_buff *skb)
> +{
> + if (!priv->dma_cap.vlins || !skb_vlan_tag_present(skb))
> + return 0;
> +
> + return 1;
> +}
> +
> /**
> * stmmac_xmit - Tx entry point of the driver
> * @skb : the socket buffer
> @@ -4529,7 +4538,8 @@ 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 + 1 + stmmac_extra_space(priv, skb))) {
extra logic is likely not worth the single descriptor saving, can you
use the same + 2 as in the condition for stopping the queue, please?
> if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, queue))) {
> netif_tx_stop_queue(netdev_get_tx_queue(priv->dev,
> queue));
> @@ -4675,7 +4685,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))) {
next prev parent reply other threads:[~2025-12-02 18:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 7:43 [PATCH v2] net: stmmac: Modify the judgment condition of "tx_avail" from 1 to 2 2694439648
2025-12-02 18:34 ` Jakub Kicinski [this message]
2025-12-02 18:36 ` Jakub Kicinski
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=20251202103452.0d2df13d@kernel.org \
--to=kuba@kernel.org \
--cc=2694439648@qq.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hailong.fan@siengine.com \
--cc=inux-kernel@vger.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.