switch: makes driver architecture compliant#282
Merged
Conversation
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.
What type of PR is this? (check all applicable)
Description
Fixes HAL wired manager startup and RTL8380M switch observation when the external switch is slow, temporarily unavailable or expensive to poll.
The wired manager previously let switch reads affect configuration admission. In practice, a slow RTL8380M command such as
sys_cpumemcould cause HAL manager apply to fail even though the wired provider configuration was valid. The manager could also emit provider state before HAL had processed capability registration, creating ordering and backpressure problems during startup.This PR separates configuration admission, capability registration and switch observation.
Changes include:
HAL wired manager now validates config, constructs backend objects, constructs provider runners, registers wired-provider capabilities, and starts runners.
The manager no longer calls RTL8380M backend methods directly after construction.
Each provider has one owned runner with a mailbox.
The runner owns backend access, request serialisation, poll scheduling, observation cache and changed-retained raw publication.
Runner emission waits for HAL capability registration before publishing raw provider facts.
External switch failures are published as raw provider status facts instead of failing manager apply.
Internal admission failures, such as invalid config, backend construction failure or runner start failure, still fail manager apply.
RTL8380M grouped observation now uses
observe_groups_op.Switch polling coalesces due groups and de-duplicates shared CGI commands such as
home_main.Saturated polling does not catch up in a tight loop; the next attempt is scheduled from completion time.
Backend naming is now explicit:
backend: callable backend objectprovider_name: configured backend kind, for examplertl8380m_httpprovider_id: instance id, for exampleswitch-mainRaw retained topics remain under
raw/host/wired/provider/<id>/....Device/Wired boundaries remain unchanged: Device owns physical assembly, and Wired owns semantic
state/wired/...projection.The measured switch timings and grouped observation design are documented in
docs/switch.md.Manual test
Manual test description
Started Devicecode with switch credentials set and confirmed HAL wired manager no longer fails configuration admission on switch observation timeout.
Validated that:
Representative checks:
cd tests SWITCH_TEST_BASE_URL=http://192.168.1.1/ \ SWITCH_TEST_USERNAME=admin \ SWITCH_TEST_PASSWORD=admin \ TEST_FILTER=rtl8380m_real_switch \ lua run.luaAdded tests?
Added or updated tests cover:
state/wiredobserve_groups_opbackend contractAdded to documentation?