netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly
@ 2021-04-21  3:56 Jarvis Jiang
  2021-04-21  6:46 ` Loic Poulain
  0 siblings, 1 reply; 2+ messages in thread
From: Jarvis Jiang @ 2021-04-21  3:56 UTC (permalink / raw)
  To: davem, kuba, loic.poulain; +Cc: netdev, linux-kernel, Jarvis Jiang

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


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

* Re: [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly
  2021-04-21  3:56 [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly Jarvis Jiang
@ 2021-04-21  6:46 ` Loic Poulain
  0 siblings, 0 replies; 2+ messages in thread
From: Loic Poulain @ 2021-04-21  6:46 UTC (permalink / raw)
  To: Jarvis Jiang; +Cc: David Miller, Jakub Kicinski, Network Development, open list

Hi Jarvis,

On Wed, 21 Apr 2021 at 05:57, Jarvis Jiang <jarvis.w.jiang@gmail.com> wrote:
>
> 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>

Thanks for the patch, but a similar change for this issue has just
been merged in net-next (a926c025d56b net: wwan: mhi_wwan_ctrl: Fix RX
buffer starvation).

Regards,
Loic

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

end of thread, other threads:[~2021-04-21  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-21  3:56 [PATCH v1] net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly Jarvis Jiang
2021-04-21  6:46 ` Loic Poulain

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).