Skip to content

RDKBWIFI-482 wifi_em: add client disassoc stats event publishing - #1237

Open
santhoshg6 wants to merge 1 commit into
rdkcentral:developfrom
santhoshg6:RDKBWIFI-482
Open

santhoshg6 wants to merge 1 commit into
rdkcentral:developfrom
santhoshg6:RDKBWIFI-482

Conversation

@santhoshg6

Copy link
Copy Markdown
Contributor
  • Publish client disassociation stats over EM bus
  • Include traffic counters and reason code in JSON payload
  • Add basic MLO affiliated STA metrics support
  • Improve validation and error handling
  • Fix return codes and memory handling

@santhoshg6
santhoshg6 requested a review from a team as a code owner June 29, 2026 11:43
Copilot AI lite review requested due to automatic review settings June 29, 2026 11:43

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.

Pull request overview

This PR adds a new EasyMesh (EM) bus event to publish client disassociation statistics, including per-STA traffic counters, the disassociation reason code, and a basic placeholder for Wi-Fi 7 MLO “Affiliated STA Metrics”.

Changes:

  • Introduces a new EM bus event name (Device.WiFi.EM.ClientDisassocStats) and registers it in em_init().
  • Publishes a JSON payload on STA disassociation, using cached per-STA counters when available.
  • Adds initial (placeholder) MLO affiliated STA metrics emission and improves some validation/return codes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
source/apps/em/wifi_em.h Adds the bus event name constant for client disassociation stats.
source/apps/em/wifi_em.c Publishes the new disassociation stats event and registers it on the EM bus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c Outdated
@Nikita-Hakai Nikita-Hakai added the community contribution Contributions from community. label Jul 21, 2026
@Nikita-Hakai

Copy link
Copy Markdown
Contributor

Hi @santhoshg6 , could you address the comments.

@dkyncu

dkyncu commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Hi @santhoshg6, the unified-wifi-mesh side of this is up for review:
rdkcentral/unified-wifi-mesh#806. The agent subscribes to Device.WiFi.EM.ClientDisassocStats and sends the Client Disassociation Stats message from it, and the controller publishes DisassociationEvent.Disassociated!. We tested both changes together on a device.

#806 depends on this PR. Could you address the open review comments so it can move forward?

@Nikita-Hakai @mateuszCieslak-GL FYI.

Copilot AI review requested due to automatic review settings September 21, 2026 22:07

@github-actions github-actions Bot 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.

clang-format suggests the formatting changes below. Use Commit suggestion to apply them.

Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.h Outdated

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.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect MLO metrics, JSON truncation handling, and function declaration order.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

Comment thread source/apps/em/wifi_em.c Outdated

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.

Copilot review overview

🟡 Changes recommended

Moderate issues remain with compilation, unverified counters, and MLO metric data.

Review effort: Lite
Findings: 2 Medium severity

Open (2)

Comment thread source/apps/em/wifi_em.c Outdated

@github-actions github-actions Bot 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.

clang-format suggests the formatting changes below. Use Commit suggestion to apply them.

Copilot AI lite review requested due to automatic review settings October 6, 2026 05:50

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.

Copilot review overview

🔵 Needs a closer look

Moderate issues remain in MLO data propagation, address serialization, declaration order, and metric schema consistency.

Review effort: Lite
Findings: 2 Medium severity

Open (2)

Copilot AI lite review requested due to automatic review settings October 6, 2026 06:16

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.

Copilot review overview

🔵 Needs a closer look

Unresolved moderate issues affect compilation and correctness of MLO data and schema output.

Review effort: Lite
Findings: 2 Medium severity

Open (2)

Copilot AI lite review requested due to automatic review settings October 6, 2026 06:19

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.

Copilot review overview

🔵 Needs a closer look

Unresolved compilation, MLO serialization, schema, and error-propagation issues remain.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity MLO affiliated entries use duplicate MLD addresses

source/​apps/​em/​wifi_em.c:1827

Even when MLO metadata is available, this uses the MLD address for every valid link, producing duplicate STA identifiers. cli_LinkInfo[link_idx].cli_LinkAddress is the per-link address already populated/used by the monitor (source/stats/wifi_monitor.c:2166); serialize that address for each affiliated entry instead.

Copilot AI lite review requested due to automatic review settings October 6, 2026 06:26

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 reviewed implementation has build-breaking declaration issues and correctness problems in published traffic statistics and schema fields.

No open issues 🎉

Review effort: Lite

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

Unresolved compilation, concurrency, and error-propagation issues block approval.

1 open issue

Review effort: Lite

Comment thread source/apps/em/wifi_em.c
Copilot AI lite review requested due to automatic review settings October 22, 2026 04:45

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

Add a forward declaration or move the helper definition before its first use to resolve the compilation issue.

1 open issue

Review effort: Lite

Copilot AI lite review requested due to automatic review settings October 22, 2026 04: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.

🔵 Needs a closer look

Two moderate issues remain unresolved, including a potential compilation failure and inconsistent affiliated-STA metric field names.

No open issues 🎉

1 resolved since last review

Review effort: Lite

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

Add the missing helper declaration and preserve/report failed event publications instead of losing data and returning success.

No open issues 🎉

Review effort: Lite

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

Two critical correctness and memory-safety issues, plus a moderate counter-publication issue, remain unresolved.

2 open issues

Review effort: Lite

Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c

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

The unreachable MLO fallback can publish zeroed statistics because the cached entry is not removed correctly.

1 open issue
2 resolved since last review

Review effort: Lite

Comment thread source/apps/em/wifi_em.c

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 unresolved MLO cache lookup issue can cause disassociation events to publish incorrect zero counters and discard cached MLO metadata.

No open issues 🎉

1 resolved since last review

Review effort: Lite

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

Address the three moderate issues in wifi_em.c before approval.

2 open issues

Review effort: Lite

Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c

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

Unresolved memory-management and cache-consistency issues include a critical double-free risk.

2 open issues
2 resolved since last review

Review effort: Lite

Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c

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

It contains a compilation error plus unresolved cache ownership, timer teardown, and failure-path memory-safety issues.

3 open issues
1 resolved since last review

Review effort: Lite

Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated

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

Six unresolved moderate issues affect memory safety, cache consistency, error handling, and MLO statistics publication.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Stale reverse-index entries survive MLO link replacement

source/​apps/​em/​wifi_em.c:400

When the sampled MLO link changes, this removes only the mapping for the new link_key; older link keys for the same primary MLD remain in link_mac_map. After the primary stats entry is removed on one disassociation, a later event using one of those stale keys resolves to a deleted primary key and is published without cached counters. Remove or otherwise invalidate all reverse-index entries that point to the primary key when replacing/removing that client.

This issue also appears on line 1781 of the same file.

1 resolved since last review

Review effort: Lite

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

Unresolved moderate memory-safety, event-publication, cache-consistency, and teardown issues must be addressed before approval.

2 open issues
1 resolved since last review

Review effort: Lite

Comment thread source/apps/em/wifi_em.c Outdated

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

Unresolved teardown race, double-free risks, and stale or misleading disassociation statistics can affect correctness and stability.

No open issues 🎉

2 resolved since last review

Review effort: Lite

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

Unresolved critical shutdown deadlock and moderate cache ownership, cleanup, MLO indexing, and client-type consistency issues remain.

1 open issue

Review effort: Lite

Comment thread source/apps/em/wifi_em.c
- Publish client disassociation stats over EM bus
- Include traffic counters and reason code in JSON payload
- Add basic MLO affiliated STA metrics support
- Improve validation and error handling
- Fix return codes and memory handling

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

Three unresolved moderate correctness and memory-management issues block approval.

No open issues 🎉

1 resolved since last review

Review effort: Lite

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

Two unresolved moderate issues affect cache ownership and failure handling in the disassociation statistics implementation.

No open issues 🎉

Review effort: Lite

@santhoshg6

Copy link
Copy Markdown
Contributor Author

Hi @Nikita-Hakai

I have addressed all the review comments and updated the PR accordingly. Could you please review it and merge it if everything looks good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution Contributions from community. question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants