This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 41cdd1bb15a891dbb24d3c055b66be68f50ebd32
Author: p-szafonimateusz <[email protected]>
AuthorDate: Wed Oct 28 15:11:28 2026 +0100

    drivers/can/kvaser_pci.c: Re-enable RX after dropping a frame.
    
    kvaser_sock_recv() returned NULL with the RX interrupt still masked
    when it dropped a frame: when no packet could be allocated, or for an
    extended frame without CONFIG_NET_CAN_EXTID.  The rest of the RX FIFO
    was then never received.  Release the frame and re-enable the RX
    interrupt on these paths too.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: p-szafonimateusz <[email protected]>
---
 drivers/can/kvaser_pci.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/can/kvaser_pci.c b/drivers/can/kvaser_pci.c
index e5177bfe2bc..d33a44b93d2 100644
--- a/drivers/can/kvaser_pci.c
+++ b/drivers/can/kvaser_pci.c
@@ -1238,6 +1238,13 @@ static FAR netpkt_t *kvaser_sock_recv(FAR struct 
netdev_lowerhalf_s *dev)
   if (!pkt)
     {
       canerr("alloc pkt_new failed\n");
+
+      /* Drop the frame and re-enable the RX interrupt, so that the next
+       * frame in the RX FIFO is received when a packet is available again.
+       */
+
+      kvaser_putreg_sja(priv, SJA1000_CMD_REG, SJA1000_RELEASE_BUF);
+      kvaser_rxint(priv, true);
       return NULL;
     }
 
@@ -1275,9 +1282,12 @@ static FAR netpkt_t *kvaser_sock_recv(FAR struct 
netdev_lowerhalf_s *dev)
       canerr("ERROR: Received message with extended"
              " identifier.  Dropped\n");
 
-      /* Release RX buffer */
+      /* Release RX buffer and re-enable the RX interrupt for the next
+       * frame in the RX FIFO
+       */
 
       kvaser_putreg_sja(priv, SJA1000_CMD_REG, SJA1000_RELEASE_BUF);
+      kvaser_rxint(priv, true);
 
       netpkt_free(dev, pkt, NETPKT_RX);
       return NULL;

Reply via email to