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

RDKBWIFI-482 wifi_em: add client disassoc stats event publishing#1237
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 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 on lines 1411 to 1412

static int em_handle_disassoc_device(wifi_app_t *app, void *arg)
Comment thread source/apps/em/wifi_em.c
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 thread source/apps/em/wifi_em.c
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants