Repository navigation
Conversation
Add helpers for sending and receiving host frames on the bulk endpoints, and let the fake CAN controllers complete the frames sent to them, so that host frame handling can be tested. Sending a frame with CAN ID 0x7ff makes a fake CAN controller go bus-off: that frame fails in the TX callback, and further frames fail in can_send() until the channel is started again. Assisted-by: Amp:claude-opus-5.5 Signed-off-by: Eric Bradley <eric@basepowercompany.com>
…N TX Complete host frames rejected by can_send(), e.g. with -ENETUNREACH while bus-off, through the TX callback, so that they are echoed like frames that fail in the TX callback. Otherwise, each of them leaks a TX context in the host driver, and host TX stops at the first bus-off. Do not echo frames aborted by a channel reset. The host releases all TX contexts when it resets the channel, and may already have reused their echo IDs. Assisted-by: Amp:claude-opus-5.5 Signed-off-by: Eric Bradley <eric@basepowercompany.com>
Test that host frames are echoed when they fail in the TX callback or in can_send(), here because the CAN controller goes bus-off, and that frames aborted by a channel reset are not echoed. A frame sent with CAN ID 0x7fe now stays pending on a fake CAN controller until the controller is stopped. Assisted-by: Amp:claude-opus-5.5 Signed-off-by: Eric Bradley <eric@basepowercompany.com>
henrikbrixandersen
self-requested a review
November 21, 2026 11:00
|
Hi @eribradl, If I understand your point correctly, the patch attached here might be relevant: it makes it possible to enable the echo for frames that could not be sent ( It also addresses a different case from the bus-off one: a channel stuck in error-passive (no ACK on the bus), where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This completes #268, which echoes host frames that fail in the CAN TX callback. Two cases were left open:
can_send(), e.g. with-ENETUNREACHwhile bus-off, are still freed without an echo. Each one leaks a TX context in the Linux gs_usb driver, so with traffic queued, host TX stops at the first bus-off and stays stopped. These frames are now completed throughgs_usb_can_tx_callback().can_stop()on a channel reset are now echoed, although the host has already released their echo IDs and may have reused them. The TX callback now drops these frames once the channel is stopped.The host tests gain support for host frames, plus two tests. In one, the fake CAN controller goes bus-off with frames queued. In the other, a frame stays pending until the channel is reset. Both tests fail on main.
Testing: