-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Update example network-manager-app and integrate it with ubus #33968
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
base: master
Are you sure you want to change the base?
Conversation
ksperling-apple
commented
Jun 18, 2024
- Add the ability for EventLoopHandlers to participate in the event loop
- Update network-manager-app with correct device type and integrate ubus
PR #33968: Size comparison from 8ba371a to 4f5e46f Full report (52 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, stm32, tizen)
|
72ed829
to
c6f4692
Compare
PR #33968: Size comparison from 4cdce52 to c6f4692 Full report (46 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, linux, mbed, nxp, psoc6, qpg, stm32, tizen)
|
Add ubus integration Fix device type id Prefix binary name with "matter-"
c6f4692
to
92ee347
Compare
PR #33968: Size comparison from 4cdce52 to 92ee347 Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Could we split this into separate PRs? Support for event loop handlers seem reasonably independent from the network manager changes. Can we add some unit tests that validates that EventLoopHandlers work as expected? |
@@ -685,16 +695,21 @@ void LayerImplSelect::HandleEvents() | |||
|
|||
for (auto & w : mSocketWatchPool) | |||
{ | |||
if (w.mFD != kInvalidFd) | |||
if (w.mFD != kInvalidFd && w.mCallback != nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Wouldn't we want to drain the events even if there is no callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SocketEventsFromFDs
doesn't drain anything, it just sets a bit mask based on which of the socket sets the given FD appears in. So this just avoids a bit of unnecessary work.
@@ -15,7 +15,11 @@ | |||
import("//build_overrides/build.gni") | |||
import("//build_overrides/chip.gni") | |||
|
|||
executable("network-manager-app") { | |||
declare_args() { | |||
matter_enable_ubus = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document what this arg means.
UloopHandler::Register(); | ||
|
||
int status; | ||
if ((status = ubus_connect_ctx(&mContext, nullptr))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My knowledge of ubus is nonexistent, so I am just rubber-stamping the ubus bits. If you need me to actually go read up on these APIs and do a proper review, please let me know.
PR #33968: Size comparison from a39c62e to d751d2c Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
I will split it out into a separate PR |
@ksperling-apple this is quite an old PR and has approvals, but also merge conflicts. Could you review if it is appropriate to update or if it should be closed if not applicable anymore? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the network-manager-app example to integrate ubus support and enhances the SystemLayer event loop by allowing EventLoopHandlers to participate. Key changes include:
- Adding Add/RemoveLoopHandler methods and integrating loop handler callbacks in SystemLayerImplSelect.
- Updating the network-manager-app to correctly define the device type and integrate ubus functionality via UbusManager and UloopHandler.
- Adjusting utility headers (e.g., IntrusiveList.h) and configuration settings to support the ubus integration.
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/system/SystemLayerImplSelect.h and .cpp | Integrated new loop handler methods and updated event handling. |
src/system/SystemLayer.h | Added interface definitions for loop handler registration. |
src/lib/support/IntrusiveList.h | Updated constructors to use constexpr for improved compile-time checks. |
examples/network-manager-app/linux/main.cpp | Revised app initialization to integrate ubus via a custom main loop. |
examples/network-manager-app/linux/include/CHIPProjectAppConfig.h | Updated device type and added MATTER_ENABLE_UBUS flag. |
examples/network-manager-app/linux/UloopHandler* | Added uloop integration support with corresponding registration API. |
examples/network-manager-app/linux/UbusSchema* & UbusManager* | Introduced ubus schema and management classes for integration. |
Files not reviewed (2)
- examples/network-manager-app/linux/BUILD.gn: Language not supported
- examples/network-manager-app/linux/args.gni: Language not supported
Comments suppressed due to low confidence (3)
examples/network-manager-app/linux/include/CHIPProjectAppConfig.h:21
- [nitpick] Consider using a hexadecimal literal (e.g., 0x90) for CHIP_DEVICE_CONFIG_DEVICE_TYPE to maintain consistency with typical device type representations and the inline comment.
#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 144 // 0x0090 Network Infrastructure Manager
src/system/SystemLayerImplSelect.cpp:698
- Confirm that filtering out socket watch entries with a null callback at this stage is intentional, as it changes the decision logic compared to checking for a non-null callback only after event detection.
if (w.mFD != kInvalidFd && w.mCallback != nullptr)
examples/network-manager-app/linux/UloopHandler.cpp:120
- Ensure that the StopWatchingSocket API correctly removes socket watch entries and that its error handling aligns with the intended behavior of the event loop management.
SuccessOrExit(err = system.StopWatchingSocket(&watch));