Skip to content

Conversation

henrikbrixandersen
Copy link
Member

@henrikbrixandersen henrikbrixandersen commented Jul 18, 2022

Backport c17c7e4..097cb04 from #47903

Fixes: #47956, #47204, #47902, #47904

@henrikbrixandersen henrikbrixandersen self-assigned this Jul 18, 2022
@github-actions github-actions bot added area: Tests Issues related to a particular existing or missing test platform: NXP NXP labels Jul 18, 2022
@henrikbrixandersen henrikbrixandersen linked an issue Jul 18, 2022 that may be closed by this pull request
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]>
@henrikbrixandersen henrikbrixandersen force-pushed the backport-47903-to-v3.0-branch branch from 1da2b7f to 73cf370 Compare July 18, 2022 20:28
@henrikbrixandersen henrikbrixandersen marked this pull request as ready for review July 18, 2022 20:42
@henrikbrixandersen
Copy link
Member Author

@alexanderwachter Could you please review this one (for the v3.0-branch) as well?

@dkalowsk dkalowsk merged commit 7e3d6fa into zephyrproject-rtos:v3.0-branch Jul 29, 2022
@henrikbrixandersen henrikbrixandersen deleted the backport-47903-to-v3.0-branch branch August 2, 2022 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CAN area: Tests Issues related to a particular existing or missing test platform: NXP NXP
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[backport v3.0-branch] backport of #47903 failed
5 participants