diff mbox series

[net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation

Message ID 1618911382-14256-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series [net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation | expand

Commit Message

Loic Poulain April 20, 2021, 9:36 a.m. UTC
The mhi_wwan_rx_budget_dec function is supposed to return true if
RX buffer budget has been successfully decremented, allowing to queue
a new RX buffer for transfer. However the current implementation is
broken when RX budget is '1', in which case budget is decremented but
false is returned, preventing to requeue one buffer, and leading to
RX buffer starvation.

Fixes: fa588eba632d ("net: Add Qcom WWAN control driver")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

---
 drivers/net/wwan/mhi_wwan_ctrl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4

Comments

patchwork-bot+netdevbpf@kernel.org April 21, 2021, 12:20 a.m. UTC | #1
Hello:

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

On Tue, 20 Apr 2021 11:36:22 +0200 you wrote:
> The mhi_wwan_rx_budget_dec function is supposed to return true if

> RX buffer budget has been successfully decremented, allowing to queue

> a new RX buffer for transfer. However the current implementation is

> broken when RX budget is '1', in which case budget is decremented but

> false is returned, preventing to requeue one buffer, and leading to

> RX buffer starvation.

> 

> [...]


Here is the summary with links:
  - [net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation
    https://git.kernel.org/netdev/net-next/c/a926c025d56b

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

Patch

diff --git a/drivers/net/wwan/mhi_wwan_ctrl.c b/drivers/net/wwan/mhi_wwan_ctrl.c
index 11475ad..1fc2376 100644
--- a/drivers/net/wwan/mhi_wwan_ctrl.c
+++ b/drivers/net/wwan/mhi_wwan_ctrl.c
@@ -56,11 +56,11 @@  static bool mhi_wwan_rx_budget_dec(struct mhi_wwan_dev *mhiwwan)
 
 	spin_lock(&mhiwwan->rx_lock);
 
-	if (mhiwwan->rx_budget)
+	if (mhiwwan->rx_budget) {
 		mhiwwan->rx_budget--;
-
-	if (mhiwwan->rx_budget && test_bit(MHI_WWAN_RX_REFILL, &mhiwwan->flags))
-		ret = true;
+		if (test_bit(MHI_WWAN_RX_REFILL, &mhiwwan->flags))
+			ret = true;
+	}
 
 	spin_unlock(&mhiwwan->rx_lock);