OceanfromXiaomi opened a new pull request, #17694: URL: https://github.com/apache/nuttx/pull/17694
add the logic about "cancel mechanism" of sending can/canfd message based priority list. ## Summary This PR is intended to resolve the CAN message priority inversion issue that can occur during CAN frame transmission. It fundamentally addresses the problem of CAN message priority inversion, thereby avoiding communication latency or errors caused by priority inversion. The solution manages CAN message transmission by introducing a **cancel mechanism** combined with a linked list, along with **predefined cancel conditions** (can_txneed_cancel), to control and reorder CAN frame transmission as needed. ## Impact If users want to use this scheme, they only need to enable CONFIG_CAN_TXCANCEL. This scheme does not affect the build process, security, or compatibility. A new dev_cancel interface is introduced, which is used to cancel the transmission of CAN messages that are already queued in the CAN driver’s hardware transmit buffer. ## Testing This scheme has been applied in an automotive basic-software project and has undergone long-term testing and validation; it does not break existing code. The scheme also ran stably on development boards based on the Cortex-M7 architecture. **Test procedure:** 1. Enable CONFIG_CAN_TXCANCEL. 2. Configure the CAN driver to use only one hardware transmit buffer. 3. Disconnect the CAN bus. 4. Using the cansend utility, first send a low-priority CAN message (ID 0x222). After confirming that this message has been placed into the hardware transmit buffer, send a high-priority CAN message (ID 0x111). 5. Reconnect the CAN bus. **Observed behavior:** the high-priority message (ID 0x111) appears on the bus first, followed by the low-priority message (ID 0x222). <img width="726" height="378" alt="github_PR_1" src="https://github.com/user-attachments/assets/4b9f91d3-1220-406c-b9ba-2294892be10d" /> <img width="1230" height="824" alt="github_PR_2" src="https://github.com/user-attachments/assets/f005e105-3b75-4a95-a7b8-8bd737f6792e" /> <img width="716" height="360" alt="github_PR_3" src="https://github.com/user-attachments/assets/081aef0c-b20e-4a99-9d82-327ad9c435c7" /> -- 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]
