static void hostapd_event_get_survey(struct hostapd_data *hapd, struct survey_results *survey_results) { struct hostapd_iface *iface = hapd->iface; struct freq_survey *survey, *tmp; struct hostapd_channel_data *chan; if (dl_list_empty(&survey_results->survey_list)) { wpa_printf(MSG_DEBUG, "No survey data received"); return; } dl_list_for_each_safe(survey, tmp, &survey_results->survey_list, struct freq_survey, list) { chan = hostapd_get_mode_channel(iface, survey->freq); if (!chan) continue; if (chan->flag & HOSTAPD_CHAN_DISABLED) continue; dl_list_del(&survey->list); dl_list_add_tail(&chan->survey_list, &survey->list); hostapd_update_nf(iface, chan, survey); iface->chans_surveyed++; } }
static void hostapd_single_channel_get_survey(struct hostapd_iface *iface, struct survey_results *survey_res) { struct hostapd_channel_data *chan; struct freq_survey *survey; u64 divisor, dividend; survey = dl_list_first(&survey_res->survey_list, struct freq_survey, list); if (!survey || !survey->freq) return; chan = hostapd_get_mode_channel(iface, survey->freq); if (!chan || chan->flag & HOSTAPD_CHAN_DISABLED) return; wpa_printf(MSG_DEBUG, "Single Channel Survey: (freq=%d channel_time=%ld channel_time_busy=%ld)", survey->freq, (unsigned long int) survey->channel_time, (unsigned long int) survey->channel_time_busy); if (survey->channel_time > iface->last_channel_time && survey->channel_time > survey->channel_time_busy) { dividend = survey->channel_time_busy - iface->last_channel_time_busy; divisor = survey->channel_time - iface->last_channel_time; iface->channel_utilization = dividend * 255 / divisor; wpa_printf(MSG_DEBUG, "Channel Utilization: %d", iface->channel_utilization); } iface->last_channel_time = survey->channel_time; iface->last_channel_time_busy = survey->channel_time_busy; }