This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 2c358c971c6 drivers/can/kvaser_pci.c: Stop the socket ISR when nothing
is pending.
2c358c971c6 is described below
commit 2c358c971c65a7a9c0fe76b97d0574a6f28a9616
Author: raiden00pl <[email protected]>
AuthorDate: Thu Nov 26 17:13:22 2026 +0100
drivers/can/kvaser_pci.c: Stop the socket ISR when nothing is pending.
kvaser_sock_interrupt() always ran CONFIG_CAN_KVASER_IRQ_PASSES passes and
handled the interrupt register bits of disabled sources, so with the RX
interrupt masked every TX interrupt re-masked RX and read the registers
16 times. Handle only the enabled sources and leave the loop at the
first pass that finds none, so the deferred RX poll drains the RX FIFO
before it overruns.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <[email protected]>
---
drivers/can/kvaser_pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/can/kvaser_pci.c b/drivers/can/kvaser_pci.c
index 324c26d5b37..a2978597b07 100644
--- a/drivers/can/kvaser_pci.c
+++ b/drivers/can/kvaser_pci.c
@@ -1428,14 +1428,19 @@ static void kvaser_sock_interrupt(FAR struct
kvaser_driver_s *priv)
for (passes = 0; passes < CONFIG_CAN_KVASER_IRQ_PASSES; passes++)
{
+ bool pending = false;
+
for (i = 0; i < priv->count; i++)
{
st = kvaser_getreg_sja(&priv->sja[i], SJA1000_INT_RAW_REG);
+ st &= kvaser_getreg_sja(&priv->sja[i], SJA1000_INT_ENA_REG);
if (st == 0)
{
continue;
}
+ pending = true;
+
/* RX ready. The SJA1000 RX interrupt is level triggered (it stays
* asserted while the RX FIFO is non-empty), and we process RX in a
* deferred poll, so leaving it enabled here makes the ISR re-fire
@@ -1456,6 +1461,11 @@ static void kvaser_sock_interrupt(FAR struct
kvaser_driver_s *priv)
netdev_lower_txdone(&priv->sja[i].dev);
}
}
+
+ if (!pending)
+ {
+ break;
+ }
}
}
#endif /* CONFIG_CAN_KVASER_SOCKET */