All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mhi: Fix unexpected queue wake
@ 2020-12-10 11:25 Loic Poulain
  2020-12-15  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2020-12-10 11:25 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, Loic Poulain

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: mhi: Fix unexpected queue wake
  2020-12-10 11:25 [PATCH] net: mhi: Fix unexpected queue wake Loic Poulain
@ 2020-12-15  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-15  1:30 UTC (permalink / raw)
  To: Loic Poulain; +Cc: kuba, davem, netdev

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 10 Dec 2020 12:25:07 +0100 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - net: mhi: Fix unexpected queue wake
    https://git.kernel.org/netdev/net-next/c/efc36d3c344a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-15  1:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 11:25 [PATCH] net: mhi: Fix unexpected queue wake Loic Poulain
2020-12-15  1:30 ` patchwork-bot+netdevbpf

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.