All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation
@ 2021-04-20  9:36 Loic Poulain
  2021-04-21  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2021-04-20  9:36 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, Loic Poulain

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

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);
 
-- 
2.7.4


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

* Re: [PATCH net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation
  2021-04-20  9:36 [PATCH net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation Loic Poulain
@ 2021-04-21  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-21  0:20 UTC (permalink / raw)
  To: Loic Poulain; +Cc: kuba, davem, netdev

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



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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20  9:36 [PATCH net-next] net: wwan: mhi_wwan_ctrl: Fix RX buffer starvation Loic Poulain
2021-04-21  0:20 ` 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.