From: Jarvis Jiang <jarvis.w.jiang@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, loic.poulain@linaro.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jarvis Jiang <jarvis.w.jiang@gmail.com>
Subject: [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly
Date: Tue, 20 Apr 2021 20:56:16 -0700 [thread overview]
Message-ID: <20210421035616.14540-1-jarvis.w.jiang@gmail.com> (raw)
mhi_wwan_rx_budget_dec() should check the value of mhiwwan->rx_budget
before the decrement, not the value after decrement.
When mhiwwan->rx_budget = 1, mhi_wwan_rx_budget_dec() will always return
false, which will cause the mhi_wwan_ctrl_refill_work() not to queue rx
buffers to transfer ring any more, and rx will be stuck.
This patch was tested with Ubuntu 20.04 X86_64 PC as host
Signed-off-by: Jarvis Jiang <jarvis.w.jiang@gmail.com>
---
drivers/net/wwan/mhi_wwan_ctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wwan/mhi_wwan_ctrl.c b/drivers/net/wwan/mhi_wwan_ctrl.c
index 11475ade4be5..721edf5a238f 100644
--- a/drivers/net/wwan/mhi_wwan_ctrl.c
+++ b/drivers/net/wwan/mhi_wwan_ctrl.c
@@ -56,12 +56,12 @@ static bool mhi_wwan_rx_budget_dec(struct mhi_wwan_dev *mhiwwan)
spin_lock(&mhiwwan->rx_lock);
- if (mhiwwan->rx_budget)
- mhiwwan->rx_budget--;
-
if (mhiwwan->rx_budget && test_bit(MHI_WWAN_RX_REFILL, &mhiwwan->flags))
ret = true;
+ if (mhiwwan->rx_budget)
+ mhiwwan->rx_budget--;
+
spin_unlock(&mhiwwan->rx_lock);
return ret;
--
2.25.1
next reply other threads:[~2021-04-21 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 3:56 Jarvis Jiang [this message]
2021-04-21 6:46 ` [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly Loic Poulain
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=20210421035616.14540-1-jarvis.w.jiang@gmail.com \
--to=jarvis.w.jiang@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.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 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.