-
Notifications
You must be signed in to change notification settings - Fork 8k
[Backport v3.0-branch] drivers: can: various RTR fixes #47958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dkalowsk
merged 4 commits into
zephyrproject-rtos:v3.0-branch
from
vestas-wind-systems:backport-47903-to-v3.0-branch
Jul 29, 2022
Merged
[Backport v3.0-branch] drivers: can: various RTR fixes #47958
dkalowsk
merged 4 commits into
zephyrproject-rtos:v3.0-branch
from
vestas-wind-systems:backport-47903-to-v3.0-branch
Jul 29, 2022
Conversation
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
The Bosch M_CAN IP does not support RX filtering of the RTR bit, so the driver handles this bit in software. If a recevied frame matches a filter with RTR enabled, the RTR bit of the frame must match that of the filter in order to be passed to the RX callback function. If the RTR bits do not match the frame must be dropped. Improve the readability of the the logic for determining if a frame should be dropped and add a missing FIFO acknowledge write for dropped frames. Fixes: zephyrproject-rtos#47204 Signed-off-by: Henrik Brix Andersen <[email protected]>
When installing a RX filter, the driver uses "filter->rtr & filter->rtr_mask" for setting the filter mask. It should just be using filter->rtr_mask, otherwise filters for non-RTR frames will match RTR frames as well. When transmitting a RTR frame, the hardware automatically switches the mailbox used for TX to RX in order to receive the reply. This, however, does not match the Zephyr CAN driver model, where mailboxes are dedicated to either RX or TX. Attempting to reuse the TX mailbox (which was automatically switched to an RX mailbox by the hardware) fails on the first call, after which the mailbox is reset and can be reused for TX. To overcome this, the driver must abort the RX mailbox operation when the hardware performs the TX to RX switch. Fixes: zephyrproject-rtos#47902 Signed-off-by: Henrik Brix Andersen <[email protected]>
Check the frame ID type and RTR bit when comparing loopback CAN frames against installed RX filters. Fixes: zephyrproject-rtos#47904 Signed-off-by: Henrik Brix Andersen <[email protected]>
Add test for CAN RX filtering of RTR frames. Signed-off-by: Henrik Brix Andersen <[email protected]>
1da2b7f
to
73cf370
Compare
martinjaeger
approved these changes
Jul 19, 2022
@alexanderwachter Could you please review this one (for the v3.0-branch) as well? |
alexanderwachter
approved these changes
Jul 19, 2022
str4t0m
approved these changes
Jul 19, 2022
dkalowsk
approved these changes
Jul 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Backport c17c7e4..097cb04 from #47903
Fixes: #47956, #47204, #47902, #47904