summaryrefslogtreecommitdiffstats
path: root/drivers/net/mhi_net.c
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2020-12-10 12:25:07 +0100
committerJakub Kicinski <kuba@kernel.org>2020-12-15 02:25:56 +0100
commitefc36d3c344a36fe73cda93c55763058629e0f2c (patch)
treedb1a92d6bec64bd45a6e17c843b6ae9e1303dfd7 /drivers/net/mhi_net.c
parentnet: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250 (diff)
downloadlinux-efc36d3c344a36fe73cda93c55763058629e0f2c.tar.xz
linux-efc36d3c344a36fe73cda93c55763058629e0f2c.zip
net: mhi: Fix unexpected queue wake
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> Link: https://lore.kernel.org/r/1607599507-5879-1-git-send-email-loic.poulain@linaro.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/mhi_net.c')
-rw-r--r--drivers/net/mhi_net.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index d3f92781314e..fa41d8c42f05 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);
}