Re: [PATCH RFC] can: c_can: wake TX queue after kicking TX of cached CAN frames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marc,

On 9/23/22 13:38, Marc Kleine-Budde wrote:
Link: https://lore.kernel.org/all/15a8084b-9617-2da1-6704-d7e39d60643b@xxxxxxxxx
Reported-by: Jacob Kroon <jacob.kroon@xxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
  drivers/net/can/c_can/c_can_main.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/can/c_can/c_can_main.c b/drivers/net/can/c_can/c_can_main.c
index dc8132862f33..fcf71c1f3b72 100644
--- a/drivers/net/can/c_can/c_can_main.c
+++ b/drivers/net/can/c_can/c_can_main.c
@@ -748,19 +748,8 @@ static void c_can_do_tx(struct net_device *dev)
  		return;
tx_ring->tail += pkts;
-	if (c_can_get_tx_free(tx_ring)) {
-		/* Make sure that anybody stopping the queue after
-		 * this sees the new tx_ring->tail.
-		 */
-		smp_mb();
-		netif_wake_queue(priv->dev);
-	}
-
-	stats->tx_bytes += bytes;
-	stats->tx_packets += pkts;
tail = c_can_get_tx_tail(tx_ring);
-
  	if (tail == 0) {
  		u8 head = c_can_get_tx_head(tx_ring);
@@ -770,6 +759,17 @@ static void c_can_do_tx(struct net_device *dev)
  			c_can_object_put(dev, IF_NAPI, obj, IF_COMM_TXRQST);
  		}
  	}
+
+	if (c_can_get_tx_free(tx_ring)) {
+		/* Make sure that anybody stopping the queue after
+		 * this sees the new tx_ring->tail.
+		 */
+		smp_mb();
+		netif_wake_queue(priv->dev);
+	}
+
+	stats->tx_bytes += bytes;
+	stats->tx_packets += pkts;
  }
/* If we have a gap in the pending bits, that means we either

I tested this patch but unfortunately I got the network lockup after a couple of minutes.

Jacob



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux