Skip to content

RDKB-67292 : LmLite Changes for Eco Mode - #114

Merged
snayak002c merged 19 commits into
developfrom
feature/wifi_lpm_rbus_pub
Oct 30, 2026
Merged

snayak002c merged 19 commits into
developfrom
feature/wifi_lpm_rbus_pub

Conversation

@JYMatanki

@JYMatanki JYMatanki commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Reason for change: Add RBUS event publishing for active Wi-Fi / POD client presence. Guard low-power functionality with LPM_MANAGER_SUPPORT.

Test Procedure: Validate by no clients connected, atleast one WiFi client, atleast one POD client and confirm the LPM state changes as expected
Risks: Medium
Priority: P1

JYMatanki and others added 7 commits October 9, 2026 12:56
Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Query OneWifi for associated devices on the mesh backhaul access points when no active WiFi clients are known to LM Lite. This prevents low-power idle behavior while mesh pods are connected.
Delete the unused LM_LOW_POWER_IDLE_SECS definition and its stale explanatory comment.
Wrap ActiveWiFiClientsPresent state tracking, RBUS handlers, event registration, and related declarations with LPM_MANAGER_SUPPORT to prevent low-power manager code from being built when the feature is disabled.
@JYMatanki
JYMatanki requested review from a team as code owners October 21, 2026 20:01
Copilot AI balanced review requested due to automatic review settings October 21, 2026 20:01
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ snayak002c
❌ JYMatanki
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Presence reporting can incorrectly indicate no clients, and reconnecting subscribers can miss their initial state.

3 open issues
What changed in this PR

Adds Wi-Fi client presence reporting to LM Lite for Eco Mode under LPM_MANAGER_SUPPORT.

Changes:

  • Registers an RBUS presence event with GET and subscription handlers.
  • Detects active Wi-Fi/MLO clients and queries mesh backhaul counts.
  • Publishes initial presence and subsequent changes when low-power support is enabled.
File Description
source/​lm/​lm_rbus_api.h Declares presence event APIs.
source/​lm/​lm_rbus_api.c Implements event registration, handlers, and publication.
source/​lm/​lm_main.h Declares the presence getter and includes Boolean support.
source/​lm/​lm_main.c Adds presence detection and periodic publication.

Review effort: Balanced

Comment thread source/lm/lm_main.c Resolved
Comment thread source/lm/lm_main.c Resolved
Comment thread source/lm/lm_main.c Resolved
Check the XHS host table for active Wi-Fi and MLD clients when resource optimization is disabled, ensuring low-power client detection includes SSID 3/4 devices.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Presence reporting can miss XHS clients in resource-optimized builds and leave subscribers with stale state after entering bridge mode.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Optimized builds miss XHS-only Wi-Fi clients

source/​lm/​lm_main.c:2916

With both LPM_MANAGER_SUPPORT and RESOURCE_OPTIMIZATION enabled, an XHS-only connection is reported as no active Wi-Fi clients. Wifi_ServerSyncHost() routes SSID 3/4 updates into a branch compiled out in optimized builds (lines 3950–4087), so these clients are absent from lmHosts as well as XlmHosts. The remaining fallback checks only backhaul APs 13/14. Both GET and published events can therefore report false while an XHS client is connected. Query the XHS association counts directly in optimized builds, or retain minimal XHS association tracking, before reporting absence.

Medium severity Bridge mode skips publication after host removal

source/​lm/​lm_main.c:3150

The publisher runs only in the non-bridge branch. If true was published before entering bridge mode, the bridge branch clears lmHosts with Hosts_RmHosts() but never calls the publisher while bridge mode remains active. With no XHS clients or pods, GET then returns false while an existing subscriber receives no update and can retain true indefinitely. The consumer's initial GET after subscribing does not cover this later transition. Move the low-power publication check outside the bridge/non-bridge conditional so it also observes host removal.

3 resolved since last review

Review effort: Balanced

Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Copilot AI balanced review requested due to automatic review settings October 25, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

POD-only transitions lack notification triggers, and concurrent host updates can publish stale absence states.

2 open issues

Review effort: Balanced

Comment thread source/lm/lm_main.c Resolved
Comment thread source/lm/lm_main.c Resolved
Reason for change:Rbus publish for active wifi clients
Test Procedure: Rbus publish when clients connect or disconnect
Risks: High
Priority: P1
Priority: P1
Copilot AI balanced review requested due to automatic review settings October 27, 2026 04:06
Copilot AI balanced review requested due to automatic review settings October 27, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Host-table teardown leaves stale client counts, causing incorrect presence reporting after bridge-mode transitions.

3 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Reconcile active-client count during host-table teardown

source/​lm/​lm_main.c:3185

[P2] The new counter is never reconciled when the bridge-mode path calls Hosts_RmHosts(), which deletes the main host table without running active-state transitions. If Wi-Fi clients were active before that cleanup, returning to router mode leaves a positive count even with no clients or pods; subsequent connects/disconnects retain the stale offset. Reconcile the counter during host-table teardown/rebuild while preserving any XHS contribution, or derive presence from the current host tables instead.

1 resolved since last review

Review effort: Balanced

Updated the publish call for XHS client
Copilot AI balanced review requested due to automatic review settings October 27, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Incorrect XHS reporting, stale client counts, and publication races can provide unreliable presence information to the low-power manager.

4 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Reconcile active-client count when clearing hosts

source/​lm/​lm_main.c:232

Hosts_RmHosts() clears the host table during bridge mode without decrementing or resetting this counter. After router mode resumes, rebuilding the table can count clients again, leaving a positive total even after every client disconnects and indefinitely reporting presence. Reconcile the counter when hosts are removed, under the appropriate locks, while preserving any separately tracked XHS clients.

Medium severity Prevent stale polling results from overwriting newer publications

source/​lm/​lm_main.c:3193

After polling reads zero clients and releases the count mutex, a Wi-Fi connection can publish true while the pod query runs; the poll can then overwrite it with its stale false result. LpmPublishMutex serializes publications but not their snapshots, so consumers can see false absence until the next poll. Coordinate sampling with publication, or use a state generation to discard outdated observations before publishing.

Review effort: Balanced

Comment thread source/lm/lm_main.c Resolved
Removed Duplicate check and moved publish call .
Copilot AI balanced review requested due to automatic review settings October 27, 2026 21:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread source/lm/lm_main.c Resolved
Comment thread source/lm/lm_main.c Resolved
Comment thread source/lm/lm_main.c Resolved
Copilot AI balanced review requested due to automatic review settings October 27, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The supplied review evidence identifies unresolved presence-tracking and notification errors that can leave the low-power manager out of sync with actual connectivity.

6 open issues
1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 01:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Presence reporting can remain incorrect because last-POD disconnects are not published, bridge-mode host removal leaves stale counts, and concurrent updates can publish outdated state.

1 open issue
2 resolved since last review

Review effort: Balanced

Bridge mode Wifi client count reset
Copilot AI balanced review requested due to automatic review settings October 30, 2026 01:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

With RESOURCE_OPTIMIZATION disabled, resetting the combined Wi-Fi/XHS counter while XHS entries remain active can cause later Wi-Fi events to falsely report that no clients are active.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread source/lm/lm_main.c Resolved
@snayak002c
snayak002c enabled auto-merge (squash) October 30, 2026 18:57
@snayak002c
snayak002c disabled auto-merge October 30, 2026 19:50
@snayak002c
snayak002c merged commit 433e6c1 into develop Oct 30, 2026
11 of 12 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants