net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly
Subsystems (3)
PATCH 1/1 net: Qcom WWAN control driver: fix the rx_budget was eaten incorrectly
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
--- drivers/net/wwan/mhi_wwan_ctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wwan/mhi_wwan_ctrl.c +3 -3
@@ -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;
Signature · 1 line
2.25.1
Hi Jarvis,
Quoted 11 lines · Jarvis Jiang
mhi_wwan_rx_budget_dec()should check the value ofmhiwwan->rx_budgetbefore the decrement, not the value after decrement.When
mhiwwan->rx_budget= 1,mhi_wwan_rx_budget_dec()will always return false, which will cause themhi_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_64PC as hostSigned-off-by Jarvis Jiang <[email protected]>
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