can: c_can: exit c_can_do_tx() early if no frames have been sent
The c_can_poll() handles RX/TX events unconditionally. It may therefore happen that c_can_do_tx() is called unnecessarily because the interrupt was triggered by the reception of a frame. In these cases, we avoid to execute unnecessary statements and exit immediately. Link: https://lore.kernel.org/r/20210807130800.5246-3-dariobin@libero.it Signed-off-by: Dario Binacchi <dariobin@libero.it> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
5064e40596
commit
a54cdbba9d
|
@ -720,18 +720,19 @@ static void c_can_do_tx(struct net_device *dev)
|
||||||
pkts++;
|
pkts++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pkts)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Clear the bits in the tx_active mask */
|
/* Clear the bits in the tx_active mask */
|
||||||
atomic_sub(clr, &priv->tx_active);
|
atomic_sub(clr, &priv->tx_active);
|
||||||
|
|
||||||
if (clr & BIT(priv->msg_obj_tx_num - 1))
|
if (clr & BIT(priv->msg_obj_tx_num - 1))
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
|
|
||||||
if (pkts) {
|
|
||||||
stats->tx_bytes += bytes;
|
stats->tx_bytes += bytes;
|
||||||
stats->tx_packets += pkts;
|
stats->tx_packets += pkts;
|
||||||
can_led_event(dev, CAN_LED_EVENT_TX);
|
can_led_event(dev, CAN_LED_EVENT_TX);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have a gap in the pending bits, that means we either
|
/* If we have a gap in the pending bits, that means we either
|
||||||
* raced with the hardware or failed to readout all upper
|
* raced with the hardware or failed to readout all upper
|
||||||
|
|
Loading…
Reference in New Issue