RDKBWIFI-482 wifi_em: add client disassoc stats event publishing#1237
Open
santhoshg6 wants to merge 1 commit into
Open
RDKBWIFI-482 wifi_em: add client disassoc stats event publishing#1237santhoshg6 wants to merge 1 commit into
santhoshg6 wants to merge 1 commit into
Conversation
santhoshg6
commented
Jun 29, 2026
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
Contributor
There was a problem hiding this comment.
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 inem_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 on lines
1411
to
1412
|
|
||
| static int em_handle_disassoc_device(wifi_app_t *app, void *arg) |
Comment on lines
+1587
to
+1608
| snprintf(json_buf, DISASSOC_JSON_BUF_SZ, | ||
| "{\"Version\":\"1.0\",\"SubDocName\":\"ClientDisassocStats\"," | ||
| "\"BSSID\":\"%s\",\"STA MacAddress\":\"%s\",\"Reason Code\":%u," | ||
| "\"Traffic Stats\":{\"BytesSent\":%llu,\"BytesReceived\":%llu," | ||
| "\"PacketsSent\":%llu,\"PacketsReceived\":%llu,\"TxPacketsErrors\":%llu," | ||
| "\"RxPacketsErrors\":%llu,\"RetransmissionCount\":%llu}," | ||
| "\"Affiliated STA Metrics\":%s}", | ||
| bssid_str, | ||
| sta_str, | ||
| (unsigned int)assoc_data->reason, | ||
| (unsigned long long)assoc_data->dev_stats.cli_BytesSent, | ||
| (unsigned long long)assoc_data->dev_stats.cli_BytesReceived, | ||
| (unsigned long long)assoc_data->dev_stats.cli_PacketsSent, | ||
| (unsigned long long)assoc_data->dev_stats.cli_PacketsReceived, | ||
| (unsigned long long)assoc_data->dev_stats.cli_ErrorsSent, | ||
| (unsigned long long)assoc_data->dev_stats.cli_RxErrors, | ||
| (unsigned long long)assoc_data->dev_stats.cli_RetransCount, | ||
| affiliated_buf); | ||
|
|
||
| free(affiliated_buf); | ||
| affiliated_buf = NULL; | ||
|
|
Comment on lines
+1562
to
+1577
| int written = snprintf(affiliated_buf + aff_pos, DISASSOC_AFF_BUF_SZ - aff_pos, | ||
| "%s{\"STA MacAddress\":\"%s\"," | ||
| "\"BytesSent\":0,\"BytesReceived\":0," | ||
| "\"PacketsSent\":0,\"PacketsReceived\":0," | ||
| "\"PacketsSentErrors\":0}", | ||
| first_entry ? "" : ",", | ||
| mld_str); | ||
| if (written < 0 || (size_t)written >= (DISASSOC_AFF_BUF_SZ - aff_pos)) { | ||
| /* truncation or error - no room for more entries */ | ||
| wifi_util_error_print(WIFI_EM, "%s:%d : no room in affiliated_buf\n", __func__, __LINE__); | ||
| aff_pos = DISASSOC_AFF_BUF_SZ - 1; | ||
| break; | ||
| } | ||
| aff_pos += (size_t)written; | ||
| first_entry = 0; | ||
| } |
- 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
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.