OceanfromXiaomi commented on code in PR #17694:
URL: https://github.com/apache/nuttx/pull/17694#discussion_r2659464150


##########
drivers/can/can.c:
##########
@@ -595,6 +595,25 @@ static int can_xmit(FAR struct can_dev_s *dev)
         }
     }
 
+#ifdef CONFIG_CAN_TXCANCEL
+  if (TX_PENDING(&dev->cd_sender) && can_txneed_cancel(&dev->cd_sender))
+    {
+      if (can_cancel_mbmsg(dev))

Review Comment:
   We just cancel the msg with the max id in sending list.
   In the current design, when the hardware transmit buffer is full and there 
are frames in the pending list, the can_txneed_cancel function checks whether 
the ID of the first frame in the pending list is smaller than the minimum ID in 
the sending list. If this condition is met, the can_cancel_mbmsg function is 
invoked to attempt to cancel the transmission of the frame with the largest ID 
in the sending list, and this frame is then reinserted into the pending list at 
a specified position.
   
   Afterwards, dev_send is called to load the first frame from the pending list 
into the hardware transmit buffer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to