-
Notifications
You must be signed in to change notification settings - Fork 1.5k
net/netdev: Change SIOCSCANBITRATE to require interface down. #16199
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
net/netdev: Change SIOCSCANBITRATE to require interface down. #16199
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
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
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>
This problem was introduced in apache#16199 Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
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>
This problem was introduced in #16199 Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
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>
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>
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
…d ifup due to Nuttx change apache/nuttx#16199 - Nuttx: update flexcan driver to sync up with upstream contribution
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.