can: gs_usb: fix busy loop if no more TX context is available
authorWolfgang Grandegger <wg@grandegger.com>
Thu, 14 Sep 2017 16:37:14 +0000 (18:37 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 19 Oct 2017 11:05:54 +0000 (13:05 +0200)
commit97819f943063b622eca44d3644067c190dc75039
treeb6da0141e32b12829a7c23601835853bd043fccf
parent72d92e865d1560723e1957ee3f393688c49ca5bf
can: gs_usb: fix busy loop if no more TX context is available

If sending messages with no cable connected, it quickly happens that
there is no more TX context available. Then "gs_can_start_xmit()"
returns with "NETDEV_TX_BUSY" and the upper layer does retry
immediately keeping the CPU busy. To fix that issue, I moved
"atomic_dec(&dev->active_tx_urbs)" from "gs_usb_xmit_callback()" to
the TX done handling in "gs_usb_receive_bulk_callback()". Renaming
"active_tx_urbs" to "active_tx_contexts" and moving it into
"gs_[alloc|free]_tx_context()" would also make sense.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c