Skip to content

Conversation

haitomatic
Copy link
Contributor

Summary

Add simple single ID mask filter. Only pkts with set CAN ID are accepted. This works for both STD and EXT CAN ID.
Note that Range Filter is not yet supported.

Impact

ARM64 IMX9 flexcan driver

Testing

Build Host: Ubuntu 22.04
Target: NXP IMX93 custom target

@github-actions github-actions bot added Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: M The size of the change in this PR is medium labels Oct 8, 2025
jerpelea
jerpelea previously approved these changes Oct 8, 2025
@haitomatic haitomatic requested a review from jerpelea October 8, 2025 07:52
@haitomatic
Copy link
Contributor Author

haitomatic commented Oct 8, 2025

For some reasons I cant request another reviewer and this blocks the merge since at least 2 reviews needed 🤔
image

@linguini1
Copy link
Contributor

Can you please add more testing information about what test cases you tried, and some logs?

struct imx9_driver_s *priv = (struct imx9_driver_s *)dev;
struct can_ioctl_filter_s *req =
(struct can_ioctl_filter_s *)((uintptr_t)arg);
ret = imx9_add_filter(priv, req->ftype, 0, req->fid1, req->fid2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you should add a DEBUGASSERT() before using req, to guarantee it is not NULL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. i added the check instead

struct imx9_driver_s *priv = (struct imx9_driver_s *)dev;
struct can_ioctl_filter_s *req =
(struct can_ioctl_filter_s *)((uintptr_t)arg);
ret = imx9_add_filter(priv, req->ftype, 1, req->fid1, req->fid2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. i added the check instead

return ERROR;
}

if (filter_type == CAN_FILTER_MASK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using a switch case instead of if else here.
Arguably easier to read, but the main argument is that it translate to faster assembly construct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. i converted to switch case

if (!imx9_setfreeze(priv->base, false))
{
canerr("FLEXCAN: unfreeze fail\n");
return ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change ALL ERROR to reasonable error code

Copy link
Contributor Author

@haitomatic haitomatic Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. I removed all the ERROR returns and use the correct ERR code instead

Add simple single ID mask filter. Only pkts with set CAN ID are accepted. This works for both STD and EXT CAN ID.

Signed-off-by: haitomatic <[email protected]>
@haitomatic haitomatic force-pushed the upstream-flexcan-driver-changes branch from 7be2ae4 to 283ba48 Compare October 13, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants