]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
usb: gadget: function: u_ether: don't starve tx request queue
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 4 Oct 2016 12:14:43 +0000 (15:14 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 6 Dec 2016 16:51:39 +0000 (16:51 +0000)
BugLink: http://bugs.launchpad.net/bugs/1642572
commit 6c83f77278f17a7679001027e9231291c20f0d8a upstream.

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.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/gadget/function/u_ether.c

index 6554322af2c16a076385ba021b8ee15c8483bdc1..b644248f4b8e31532e73b93bce50e7d14af01b58 100644 (file)
@@ -596,8 +596,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
 
        /* throttle high/super speed IRQ rate back slightly */
        if (gadget_is_dualspeed(dev->gadget))
-               req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH ||
-                                    dev->gadget->speed == USB_SPEED_SUPER)
+               req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH ||
+                                      dev->gadget->speed == USB_SPEED_SUPER)) &&
+                                       !list_empty(&dev->tx_reqs))
                        ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0)
                        : 0;