Commit 51705244 authored by Felipe Balbi's avatar Felipe Balbi Committed by Sasha Levin

usb: gadget: function: u_ether: don't starve tx request queue

[ Upstream commit 6c83f772 ]

If we don't guarantee that we will always get an
interrupt at least when we're queueing our very last
request, we could fall into situation where we queue
every request with 'no_interrupt' set. This will
cause the link to get stuck.

The behavior above has been triggered with g_ether
and dwc3.

Cc: <stable@vger.kernel.org>
Reported-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 66f38bf9
...@@ -591,8 +591,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, ...@@ -591,8 +591,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
/* throttle high/super speed IRQ rate back slightly */ /* throttle high/super speed IRQ rate back slightly */
if (gadget_is_dualspeed(dev->gadget)) if (gadget_is_dualspeed(dev->gadget))
req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH || req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH ||
dev->gadget->speed == USB_SPEED_SUPER) dev->gadget->speed == USB_SPEED_SUPER)) &&
!list_empty(&dev->tx_reqs))
? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0) ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0)
: 0; : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment