Skip to contentSkip to conversation

Patch "can: gs_usb: fix busy loop if no more TX context is available" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 23, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

can: gs_usb: fix busy loop if no more TX context is available

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
can-gs_usb-fix-busy-loop-if-no-more-tx-context-is-available.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 97819f943063b622eca44d3644067c190dc75039 Mon Sep 17 00:00:00 2001

From: Wolfgang Grandegger <[email protected]>
Date: Thu, 14 Sep 2017 18:37:14 +0200
Subject: can: gs_usb: fix busy loop if no more TX context is available

From: Wolfgang Grandegger <[email protected]>

commit 97819f943063b622eca44d3644067c190dc75039 upstream.

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.

---
 drivers/net/can/usb/gs_usb.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/can/usb/gs_usb.c +2 -8
@@ -375,6 +375,8 @@ static void gs_usb_receive_bulk_callback
 
 		gs_free_tx_context(txc);
 
+		atomic_dec(&dev->active_tx_urbs);
+
 		netif_wake_queue(netdev);
 	}
 
@@ -463,14 +465,6 @@ static void gs_usb_xmit_callback(struct
 			  urb->transfer_buffer_length,
 			  urb->transfer_buffer,
 			  urb->transfer_dma);
-
-	atomic_dec(&dev->active_tx_urbs);
-
-	if (!netif_device_present(netdev))
-		return;
-
-	if (netif_queue_stopped(netdev))
-		netif_wake_queue(netdev);
 }
 
 static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/can-gs_usb-fix-busy-loop-if-no-more-tx-context-is-available.patch