net/netdev: Change SIOCSCANBITRATE to require interface down.#16199
Merged
xiaoxiang781216 merged 1 commit intoApr 14, 2025
Conversation
|
[Experimental Bot, please feedback here] Yes, this PR appears to meet the NuttX requirements, although some sections could be expanded for better clarity. Strengths:
Areas for improvement:
Recommendation: While the PR seems generally well-formed, adding the missing details in the Impact and Testing sections will significantly strengthen it and make the review process smoother. Provide concrete examples of commands used for testing and the expected outcomes, showcasing how the change functions and demonstrating its effectiveness. |
8904073 to
cd977bb
Compare
raiden00pl
reviewed
Apr 14, 2025
raiden00pl
approved these changes
Apr 14, 2025
Previously, SIOCSCANBITRATE brought the iterface up to ensure changes where immediately applied. This was confusing, see https://lists.apache.org/thread/g8d0m6yp7noywhroby5br4hxt3r4og2c Now SIOCSCANBITRATE fails is interface is up. All existing SocketCAN drivers updated. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
cd977bb to
eaaea7f
Compare
lupyuen
approved these changes
Apr 14, 2025
acassis
approved these changes
Apr 14, 2025
xiaoxiang781216
approved these changes
Apr 14, 2025
jerpelea
approved these changes
Apr 14, 2025
csanchezdll
added a commit
to csanchezdll/nuttx-apps
that referenced
this pull request
Apr 15, 2025
A recent change (apache/nuttx#16199) has made the bitrate setting no longer bring the interface up. Moreover, it is now no longer possible to change bitrate of a CAN interface if it is up. Therefore, slcan needs to bring the interface down to change it. Fortunately, it already had commands to open and close the interface which map nicely to this. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
csanchezdll
added a commit
to csanchezdll/incubator-nuttx
that referenced
this pull request
Apr 16, 2025
This problem was introduced in apache#16199 Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
csanchezdll
added a commit
to csanchezdll/nuttx-apps
that referenced
this pull request
Apr 16, 2025
A recent change (apache/nuttx#16199) has made the bitrate setting no longer bring the interface up. Moreover, it is now no longer possible to change bitrate of a CAN interface if it is up. Therefore, slcan needs to bring the interface down to change it. Fortunately, it already had commands to open and close the interface which map nicely to this. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
xiaoxiang781216
pushed a commit
that referenced
this pull request
Apr 16, 2025
This problem was introduced in #16199 Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
csanchezdll
added a commit
to csanchezdll/nuttx-apps
that referenced
this pull request
Apr 23, 2025
A recent change (apache/nuttx#16199) has made the bitrate setting no longer bring the interface up. Moreover, it is now no longer possible to change bitrate of a CAN interface if it is up. Therefore, slcan needs to bring the interface down to change it. Fortunately, it already had commands to open and close the interface which map nicely to this. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
xiaoxiang781216
pushed a commit
to apache/nuttx-apps
that referenced
this pull request
Apr 23, 2025
A recent change (apache/nuttx#16199) has made the bitrate setting no longer bring the interface up. Moreover, it is now no longer possible to change bitrate of a CAN interface if it is up. Therefore, slcan needs to bring the interface down to change it. Fortunately, it already had commands to open and close the interface which map nicely to this. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
haitomatic
added a commit
to tiiuae/px4-firmware
that referenced
this pull request
Oct 17, 2025
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
haitomatic
added a commit
to tiiuae/px4-firmware
that referenced
this pull request
Oct 17, 2025
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
haitomatic
added a commit
to tiiuae/px4-firmware
that referenced
this pull request
Oct 17, 2025
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
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.
Summary
In Linux, CAN bitrate is set with netlink, not ioctl, and you need to
set a bitrate before bringing the interface up (make sense). In Nuttx,
you can begin the interface up (it uses a default bitrate) and then
you can change it. My guess is calling ifup at the end is precisely to
avoid requiring another ifdown/ifup cycle from app code.
SocketCAN is a Linux thing, so we should try to mimic the behaviour.
Implementing netlink would be overkill (and moreover, it is common in
Linux to use libsocketcan to abstract the netlink internals anyways)
but at least we should have similar semantics
Impact
The change makes changing bitrate on an up interface fails. This is done on the portable, architecture-independent section of ioctl handling, so it affects all the drivers and makes the semantics clear.
Al existing SocketCAN drivers have also been updated.
Now the process for setting bitrate on an open interface is:
This requires an update in apps/canutils/slcan. PR following.
Testing
The change was tested on a custom platform using s32k148 uC, confirming changing the bitrate no longer brings the interface up.