From: Loic Poulain <loic.poulain@linaro.org>
To: kuba@kernel.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, Loic Poulain <loic.poulain@linaro.org>
Subject: [PATCH] net: mhi: Fix unexpected queue wake
Date: Thu, 10 Dec 2020 12:25:07 +0100 [thread overview]
Message-ID: <1607599507-5879-1-git-send-email-loic.poulain@linaro.org> (raw)
This patch checks that MHI queue is not full before waking up the net
queue. This fix sporadic MHI queueing issues in xmit. Indeed xmit and
its symmetric complete callback (ul_callback) can run concurently, it
is then not safe to unconditionnaly waking the queue in the callback
without checking queue fullness.
Fixes: 3ffec6a14f24 ("net: Add mhi-net driver")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/net/mhi_net.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index 8e72d94..b7f7f2e 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -173,6 +173,7 @@ static void mhi_net_ul_callback(struct mhi_device *mhi_dev,
{
struct mhi_net_dev *mhi_netdev = dev_get_drvdata(&mhi_dev->dev);
struct net_device *ndev = mhi_netdev->ndev;
+ struct mhi_device *mdev = mhi_netdev->mdev;
struct sk_buff *skb = mhi_res->buf_addr;
/* Hardware has consumed the buffer, so free the skb (which is not
@@ -196,7 +197,7 @@ static void mhi_net_ul_callback(struct mhi_device *mhi_dev,
}
u64_stats_update_end(&mhi_netdev->stats.tx_syncp);
- if (netif_queue_stopped(ndev))
+ if (netif_queue_stopped(ndev) && !mhi_queue_is_full(mdev, DMA_TO_DEVICE))
netif_wake_queue(ndev);
}
--
2.7.4
next reply other threads:[~2020-12-10 11:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 11:25 Loic Poulain [this message]
2020-12-15 1:30 ` [PATCH] net: mhi: Fix unexpected queue wake patchwork-bot+netdevbpf
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=1607599507-5879-1-git-send-email-loic.poulain@linaro.org \
--to=loic.poulain@linaro.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).