Exemplo n.º 1
0
static int acs_survey_list_is_sufficient(struct hostapd_channel_data *chan)
{
	struct freq_survey *survey;
	int ret = -1;

	dl_list_for_each(survey, &chan->survey_list, struct freq_survey, list)
	{
		if (acs_survey_is_sufficient(survey)) {
			ret = 1;
			break;
		}
		ret = 0;
	}

	if (ret == -1)
		ret = 1; /* no survey list entries */

	if (!ret) {
		wpa_printf(MSG_INFO,
			   "ACS: Channel %d has insufficient survey data",
			   chan->chan);
	}

	return ret;
}
Exemplo n.º 2
0
static int acs_survey_list_is_sufficient(struct hostapd_channel_data *chan)
{
	struct freq_survey *survey;

	dl_list_for_each(survey, &chan->survey_list, struct freq_survey, list)
	{
		if (!acs_survey_is_sufficient(survey)) {
			wpa_printf(MSG_ERROR, "ACS: Channel %d has insufficient survey data",
				   chan->chan);
			return 0;
		}
	}

	return 1;

}
Exemplo n.º 3
0
static void
acs_survey_chan_interference_factor(struct hostapd_iface *iface,
				    struct hostapd_channel_data *chan)
{
	struct freq_survey *survey;
	unsigned int i = 0;
	long double int_factor = 0;
	unsigned count = 0;

	if (dl_list_empty(&chan->survey_list))
		return;

	if (chan->flag & HOSTAPD_CHAN_DISABLED)
		return;

	chan->interference_factor = 0;

	dl_list_for_each(survey, &chan->survey_list, struct freq_survey, list)
	{
		i++;

		if (!acs_survey_is_sufficient(survey)) {
			wpa_printf(MSG_DEBUG, "ACS: %d: insufficient data", i);
			continue;
		}

		count++;
		int_factor = acs_survey_interference_factor(survey,
							    iface->lowest_nf);
		chan->interference_factor += int_factor;
		wpa_printf(MSG_DEBUG, "ACS: %d: min_nf=%d interference_factor=%Lg nf=%d time=%lu busy=%lu rx=%lu",
			   i, chan->min_nf, int_factor,
			   survey->nf, (unsigned long) survey->channel_time,
			   (unsigned long) survey->channel_time_busy,
			   (unsigned long) survey->channel_time_rx);
	}

	if (!count)
		return;
	chan->interference_factor /= count;
}