From patchwork Tue Oct 15 12:10:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 283617 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D02902C00AC for ; Tue, 15 Oct 2013 23:11:34 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 64CAB9C11E; Tue, 15 Oct 2013 08:11:30 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N6ys2dp06MhF; Tue, 15 Oct 2013 08:11:30 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BABD29C12E; Tue, 15 Oct 2013 08:10:39 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2D53A9C106 for ; Tue, 15 Oct 2013 08:10:39 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KaaUHYXQW19M for ; Tue, 15 Oct 2013 08:10:34 -0400 (EDT) Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id E50D19C108 for ; Tue, 15 Oct 2013 08:10:22 -0400 (EDT) Received: by mail-ee0-f45.google.com with SMTP id c50so3970072eek.18 for ; Tue, 15 Oct 2013 05:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FAkEFWtL6DkrIC2DrZDv2WmBTdbusns1L7j8itS4MOw=; b=NY0ILHNr1w5JuAmcouIftwvmBDR6AHmSi3UFV30cjCl7tA+alYNGe7a3OG80k3AfHQ f5MIEBWlf/BBctGqMDjZDhAhE060ZLfN/syIJS3PijUgYTaoHfxn0EyO7V9lEDrrVQzn sd81iQkUS60GKLX3kCdNtMpc0vPnbsqxhQmqC3w5W7uiMmxaXt+1diBNvF86c47LQenQ XP8neoR5HyO6tXeiS9goT4zBW6FuvLdZUuyTwRSHAc50wPMkYRdeVFlLxZQNlKhYwNvS myw4yRgJVGuDf5EPZZgd0OkWIj22hypOZ0W3iaKH4HAa9ZIUld+ly0cxloB/h1jwa7Kh nCaA== X-Received: by 10.14.94.195 with SMTP id n43mr47650eef.93.1381839021995; Tue, 15 Oct 2013 05:10:21 -0700 (PDT) Received: from hschaa-desktop.site ([217.8.58.223]) by mx.google.com with ESMTPSA id bn13sm165888530eeb.11.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Oct 2013 05:10:21 -0700 (PDT) From: Helmut Schaa To: hostap@lists.shmoo.com Subject: [PATCH 3/4] hostapd: Allow ACS to deal with partial survey data Date: Tue, 15 Oct 2013 14:10:09 +0200 Message-Id: <1381839010-30681-3-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1381839010-30681-2-git-send-email-helmut.schaa@googlemail.com> References: <1381839010-30681-1-git-send-email-helmut.schaa@googlemail.com> <1381839010-30681-2-git-send-email-helmut.schaa@googlemail.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Previously ACS required valid survey data on all available channels. This can however not be guaranteed. Instead of just failing fall back to the subset of channels that have valid ACS data. Signed-off-by: Helmut Schaa --- src/ap/acs.c | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index 82f5dbf..e18c3d7 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -352,16 +352,6 @@ acs_survey_chan_interference_factor(struct hostapd_iface *iface, } -static int acs_usable_chan(struct hostapd_channel_data *chan) -{ - if (dl_list_empty(&chan->survey_list)) - return 0; - if (chan->flag & HOSTAPD_CHAN_DISABLED) - return 0; - return 1; -} - - static int acs_usable_ht40_chan(struct hostapd_channel_data *chan) { const int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, @@ -397,29 +387,53 @@ static int acs_survey_is_sufficient(struct freq_survey *survey) return 1; } +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; + +} static int acs_surveys_are_sufficient(struct hostapd_iface *iface) { int i; struct hostapd_channel_data *chan; - struct freq_survey *survey; + int valid = 0; for (i = 0; i < iface->current_mode->num_channels; i++) { chan = &iface->current_mode->channels[i]; if (chan->flag & HOSTAPD_CHAN_DISABLED) continue; - 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; - } - } + if (!acs_survey_list_is_sufficient(chan)) + continue; + + valid++; } + /* We need at least survey data for one channel */ + return !!valid; +} + + +static int acs_usable_chan(struct hostapd_channel_data *chan) +{ + if (dl_list_empty(&chan->survey_list)) + return 0; + if (chan->flag & HOSTAPD_CHAN_DISABLED) + return 0; + if (!acs_survey_list_is_sufficient(chan)) + return 0; return 1; }