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 -- 2.35.1