diff --git a/source/apps/whix/wifi_whix.c b/source/apps/whix/wifi_whix.c index 8c11e616b..02a2944cc 100644 --- a/source/apps/whix/wifi_whix.c +++ b/source/apps/whix/wifi_whix.c @@ -814,6 +814,78 @@ void print_sta_client_telemetry_data(unsigned int num_devs, int vap_index, sta_d #define CLIENT_TELEMETRY_PARAM_MAX_LEN 64 #define MAX_BUFF_SIZE BSS_MAX_NUM_STATIONS *CLIENT_TELEMETRY_PARAM_MAX_LEN +#ifdef CONFIG_IEEE80211BE +static void upload_mld_telemetry_data() { + wifi_mgr_t *mgr = get_wifimgr_obj(); + unsigned int mld_id, index; + rdk_wifi_vap_info_t *rdk_vap_info = NULL; + wifi_vap_info_t *vap_info = NULL; + char buff[MAX_BUFF_SIZE]; + char tmp[128]; + + for (mld_id = 0; mld_id < MLD_UNIT_COUNT; mld_id++) { + unsigned int mlo_clients_count = 0; + unsigned int l1 = 0, l2 = 0, l3 = 0; + bool vap_found = false; + for (index = 0; index < getTotalNumberVAPs(); index++) { + UINT vap_index = VAP_INDEX(mgr->hal_cap, index); + vap_info = getVapInfo(vap_index); + if(vap_info == NULL) + continue; + if (vap_info->vap_mode == wifi_vap_mode_sta || + !vap_info->u.bss_info.enabled || + !vap_info->u.bss_info.mld_info.common_info.mld_enable || + vap_info->u.bss_info.mld_info.common_info.mld_id != mld_id) + continue; + rdk_vap_info = get_wifidb_rdk_vap_info(vap_info->vap_index); + if (rdk_vap_info == NULL) + continue; + + vap_found = true; + + pthread_mutex_lock(rdk_vap_info->associated_devices_lock); + if (rdk_vap_info->associated_devices_map == NULL) { + pthread_mutex_unlock(rdk_vap_info->associated_devices_lock); + continue; + } + assoc_dev_data_t *sta = hash_map_get_first(rdk_vap_info->associated_devices_map); + while (sta) { + if (sta->association_link) { + mlo_clients_count++; + unsigned int nb_links = 0; + for (int i = 0; i < MAX_NUM_RADIOS; i++) { + if (sta->mld_info.cli_LinkInfo[i].cli_Valid) + nb_links++; + } + switch (nb_links) { + case 1: l1++; break; + case 2: l2++; break; + case 3: l3++; break; + default: break; + } + } + sta = hash_map_get_next(rdk_vap_info->associated_devices_map, sta); + } + pthread_mutex_unlock(rdk_vap_info->associated_devices_lock); + } + if (!vap_found) + continue; + + get_formatted_time(tmp); + memset(buff, 0, MAX_BUFF_SIZE); + snprintf(buff, MAX_BUFF_SIZE - 1, "%s WIFI_MLO_%u_CLIENT_COUNT:%u\n", tmp, mld_id, mlo_clients_count); + write_to_file(wifi_health_log, buff); + memset(buff, 0, MAX_BUFF_SIZE); + snprintf(buff, MAX_BUFF_SIZE - 1, "%s WIFI_MLO_%u_1LINK_CLIENT_COUNT:%u\n", tmp, mld_id, l1); + write_to_file(wifi_health_log, buff); + snprintf(buff, MAX_BUFF_SIZE - 1, "%s WIFI_MLO_%u_2LINK_CLIENT_COUNT:%u\n", tmp, mld_id, l2); + write_to_file(wifi_health_log, buff); + snprintf(buff, MAX_BUFF_SIZE - 1, "%s WIFI_MLO_%u_3LINK_CLIENT_COUNT:%u\n", tmp, mld_id, l3); + write_to_file(wifi_health_log, buff); + } +} +#endif + int upload_client_telemetry_data(wifi_app_t *app, unsigned int num_devs, unsigned int vap_index, sta_data_t *sta) { @@ -1549,6 +1621,12 @@ void update_clientdiagdata(wifi_app_t *app, unsigned int num_devs, int vap_idx, if (isVapHotspotSecure(vap_idx)) { upload_ap_telemetry_anqp_whix(vap_idx); } +#ifdef CONFIG_IEEE80211BE + if (vap_idx == 0) { + //update once per cycle + upload_mld_telemetry_data(); + } +#endif upload_client_telemetry_data(app, num_devs, vap_idx, assoc_stats); if (vap_idx == 0) { logVAPUpStatus();