All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: peppe.cavallaro@st.com, alexandre.torgue@st.com,
	joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-imx@nxp.com
Subject: [PATCH 3/6] ethernet: stmmac: fix watchdog timeout during suspend/resume stress test
Date: Mon, 11 Jan 2021 19:35:35 +0800	[thread overview]
Message-ID: <20210111113538.12077-4-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20210111113538.12077-1-qiangqing.zhang@nxp.com>

stmmac_xmit() call stmmac_tx_timer_arm() at the end to modify tx timer to
do the transmission cleanup work. Imagine such a situation, stmmac enters
suspend immediately after tx timer modified, it's expire callback
stmmac_tx_clean() would not be invoked. This could affect BQL, since
netdev_tx_sent_queue() has been called, but netdev_tx_completed_queue()
have not been involved, as a result, dql_avail(&dev_queue->dql) finally always
return a negative value.

__dev_queue_xmit->__dev_xmit_skb->qdisc_run->__qdisc_run->qdisc_restart->dequeue_skb:
	if ((q->flags & TCQ_F_ONETXQUEUE) &&
		netif_xmit_frozen_or_stopped(txq)) // __QUEUE_STATE_STACK_XOFF is set

Net core will stop transmitting any more. Finillay, net watchdong would timeout.
To fix this issue, we should call netdev_tx_reset_queue() in stmmac_resume().

Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a0bd064a8421..41d9a5a3cc9a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5256,6 +5256,8 @@ static void stmmac_reset_queues_param(struct stmmac_priv *priv)
 		tx_q->cur_tx = 0;
 		tx_q->dirty_tx = 0;
 		tx_q->mss = 0;
+
+		netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue));
 	}
 }
 
-- 
2.17.1


  parent reply	other threads:[~2021-01-11 11:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 11:35 [PATCH 0/6] ethernet: fixes for stmmac driver Joakim Zhang
2021-01-11 11:35 ` [PATCH 1/6] ethernet: stmmac: remove redundant null check for ptp clock Joakim Zhang
2021-01-11 17:13   ` Andrew Lunn
2021-01-11 11:35 ` [PATCH 2/6] ethernet: stmmac: stop each tx channal independently Joakim Zhang
2021-01-11 17:28   ` Florian Fainelli
2021-01-11 11:35 ` Joakim Zhang [this message]
2021-01-11 11:35 ` [PATCH 4/6] ethernet: stmmac: fix dma physical address of descriptor when display ring Joakim Zhang
2021-01-11 17:30   ` Florian Fainelli
2021-01-12  1:41     ` Joakim Zhang
2021-01-11 11:35 ` [PATCH 5/6] ethernet: stmmac: fix wrongly set buffer2 valid when sph unsupport Joakim Zhang
2021-01-11 22:24   ` Jakub Kicinski
2021-01-11 11:35 ` [PATCH 6/6] ethernet: stmmac: re-init rx buffers when mac resume back Joakim Zhang

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=20210111113538.12077-4-qiangqing.zhang@nxp.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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.