From: Francois Romieu <romieu@fr.zoreil.com>
To: Zhang Changzhong <zhangchangzhong@huawei.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, mdf@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 3/3] net: nixge: fix tx queue handling
Date: Wed, 16 Nov 2022 11:27:58 +0100 [thread overview]
Message-ID: <Y3S7LpbVaTRdKmLl@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <c476086a-14ce-6e47-8183-def31d569ec6@huawei.com>
Zhang Changzhong <zhangchangzhong@huawei.com> :
> On 2022/11/16 7:04, Francois Romieu wrote:
> > Zhang Changzhong <zhangchangzhong@huawei.com> :
[...]
> >> diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
> >> index 91b7ebc..3776a03 100644
> >> --- a/drivers/net/ethernet/ni/nixge.c
> >> +++ b/drivers/net/ethernet/ni/nixge.c
> > [...]
> >> static netdev_tx_t nixge_start_xmit(struct sk_buff *skb,
> >> @@ -518,10 +523,15 @@ static netdev_tx_t nixge_start_xmit(struct sk_buff *skb,
> >> cur_p = &priv->tx_bd_v[priv->tx_bd_tail];
> >> tx_skb = &priv->tx_skb[priv->tx_bd_tail];
> >>
> >> - if (nixge_check_tx_bd_space(priv, num_frag + 1)) {
> >> - if (!netif_queue_stopped(ndev))
> >> - netif_stop_queue(ndev);
> >> - return NETDEV_TX_OK;
> >> + if (unlikely(nixge_check_tx_bd_space(priv, num_frag + 1))) {
> >> + /* Should not happen as last start_xmit call should have
> >> + * checked for sufficient space and queue should only be
> >> + * woken when sufficient space is available.
> >> + */
> >
> > Almost. IRQ triggering after nixge_start_xmit::netif_stop_queue and
> > before nixge_start_xmit::smp_mb may wrongly wake queue.
> >
>
> I don't know what you mean by "wronly wake queue". The queue is woken
> only when there is sufficient for next packet.
Between nixge_start_xmit::netif_stop_queue and nixge_start_xmit::smp_mb,
"next" packet is current packet in hard_start_xmit. However said current
packet may not be accounted for in the IRQ context transmit completion
handler.
[nixge_start_xmit]
++priv->tx_bd_tail;
priv->tx_bd_tail %= TX_BD_NUM;
/* Stop queue if next transmit may not have space */
if (nixge_check_tx_bd_space(priv, MAX_SKB_FRAGS + 1)) {
netif_stop_queue(ndev);
Which value does [nixge_start_xmit_done] read as priv->tx_bd_tail at
this point ? The value set a few lines above or some older value ?
/* Matches barrier in nixge_start_xmit_done */
smp_mb();
/* Space might have just been freed - check again */
if (!nixge_check_tx_bd_space(priv, MAX_SKB_FRAGS + 1))
netif_wake_queue(ndev);
}
--
Ueimor
next prev parent reply other threads:[~2022-11-16 10:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 15:10 [PATCH net v2 0/3] three fixes for nixge driver Zhang Changzhong
2022-11-15 15:10 ` [PATCH net v2 1/3] net: nixge: fix potential memory leak in nixge_start_xmit() Zhang Changzhong
2022-11-15 22:57 ` Francois Romieu
2022-11-15 15:10 ` [PATCH net v2 2/3] net: nixge: avoid overwriting buffer descriptor Zhang Changzhong
2022-11-15 23:03 ` Francois Romieu
2022-11-15 15:10 ` [PATCH net v2 3/3] net: nixge: fix tx queue handling Zhang Changzhong
2022-11-15 23:04 ` Francois Romieu
2022-11-16 8:55 ` Zhang Changzhong
2022-11-16 10:27 ` Francois Romieu [this message]
2022-11-16 11:52 ` Zhang Changzhong
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=Y3S7LpbVaTRdKmLl@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhangchangzhong@huawei.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.