Add set_slave_only method to PtpInstance#801
Merged
davidv1992 merged 1 commit intopendulum-project:mainfrom Mar 11, 2026
Merged
Add set_slave_only method to PtpInstance#801davidv1992 merged 1 commit intopendulum-project:mainfrom
set_slave_only method to PtpInstance#801davidv1992 merged 1 commit intopendulum-project:mainfrom
Conversation
This will prevent a port from becoming a master, or cause a port that is currently a master to be demoted during the next BMCA decision.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #801 +/- ##
==========================================
+ Coverage 63.64% 63.82% +0.18%
==========================================
Files 62 62
Lines 7950 8020 +70
==========================================
+ Hits 5060 5119 +59
- Misses 2890 2901 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
davidv1992
approved these changes
Mar 11, 2026
Member
|
Thank you for contributing this. This looks like a very good idea, and with how the codebase works this is the correct approach. |
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.
It can be useful to configure a port's
slave_onlyconfiguration on the fly. For example, a port might need to start out inslave_only = truewhile it waits for it's PHC clock to synchronize for hardware timestamping to be reliable. After health checks pass, it can setslave_only = falseand become a master if applicable.I made a small change to add a
set_slave_onlyfunction to the default dataset, but that wasn't quite enough since the code currently assumesslave_onlyis set during init and won't change. The largest change is inset_recommended_port_statewhich will no longer error out if a port is a master withslave_onlyset. Instead, it will be forced toPortState::Listeninglike other port states already are.I'll admit I don't have a wide enough knowledge of the codebase to know if this is all that is needed for this change to work. I added a few unit tests that seem to show it does, but my confidence level isn't super high still. I did test this practically on the bench and it appears to function as intended.
Resolves #799