From patchwork Tue Feb 27 20:40:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?0JTQvNC40YLRgNC40Lkg0JvQtdCx0LXQtNGM?= X-Patchwork-Id: 878830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uHU0qdYF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jUUC8AXn"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zrVwc50Dvz9s1d for ; Wed, 28 Feb 2018 07:41:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=W1SAh2njYRd/nrIAFHEsP/4HN/TNsywuPWrCFB7waUI=; b=uHU 0qdYFruGRkshBdk0TQFSpP/lnuY+S2mclx7eNSUOgTNi24AnIufFffkptvZCnAW9YdkE0Cwy57Mlf t0c4pA4iimtvLriwvocT8SYXE1/UayxxBYHkXNbeu1M8e0asToZPg92acJyN5dPl79yfSPYubDisO KlW3BFG1BlENRSBOZVH4K8F1a3RF9T+pUVaKoeGJfECHoqnarzMTJN5qXWXy5CSmui770Vwl0XEKT 1ormGVjuuEuEMwc2GvSj9tDMQb931qcyxBXASWXULi9sUFU4T/LciLzUzWx/cqSPicx4hnGJPhT44 dWVFFsaqwUAr95bNV+FASywcE619TYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqm3q-00067m-G6; Tue, 27 Feb 2018 20:41:18 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqm3m-0005wB-QY for hostap@lists.infradead.org; Tue, 27 Feb 2018 20:41:16 +0000 Received: by mail-lf0-x243.google.com with SMTP id 70so246094lfw.2 for ; Tue, 27 Feb 2018 12:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wO98PjRXT2SYdm2ilNoGhvOmLeTGMkprySArOBJaBGI=; b=jUUC8AXnAYNkHPSnBiPYZZQgLJTpsTquKrV2/2FmBsq0ivgQv1nKwcw05gUkAx2KOy V2nKqXER6uftR5uFZA6pZpQwodwo2o4xgRmWLuCmPjLHh6xk3ji6RhqqVPgLL3v2yAOG ykhWIuen66vObUzeLL8bygAthJNxlEibqYr84T8Uk+HszYIXIH0pH0meKZnBm1he3UTx IJ8Zrdh/VBLOXnuNKh2u0fVfQnAfErRCh75qvzyLuZnV/QH/iDPIIla9NrVpHAH7YGeC 9SBGdwfNO5A7i11dj9olnzjfowtivydYtW8l2mh9l9LjKmC9U5hH0Yqpv6WgjpRuNhTq LSOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wO98PjRXT2SYdm2ilNoGhvOmLeTGMkprySArOBJaBGI=; b=C608AIAezyzZr+CtCj6/OrFzkkg8WfxiUYc0j/KPBm5eD0WFaKTOVi2NuoKwZDyvjD Z7Vyd8ee+WO7CTxHUKikdRo9zaGPufxQ4Y+a3VuBQpAyMcE7oivXsV6URwmn9L6R4Ntq +bEl2sb2QBfGrm0gZ7/db6VweYEd94OsAHZSazJ0JsPUmon11+gyd2znSeI6FokajqLb 6/bkd8IFOJDzIlW2v5bwMQQtrKooOdy0zoBP4Aw5k5jZQ18DzJXtyuB9UnH6xsTpFL7w mCf646z8MeYzPHpHmgxrYLs6uqXJ3G3/G4C7/DxzcaT0TpJDUi9mgfXZmaWjA2KYO33S dC8A== X-Gm-Message-State: APf1xPA5cIRlcVt3DkEfB7RPVzSlGaD7VGlwUObuXm46zB5Jt4iM8KOR j7/lU8TN9B6xWxxODosw1A3ZCnR9 X-Google-Smtp-Source: AH8x226yPvjW2glJ3wZqJdLv+ik2C5XuIhim8lJGtbsUe9Ut507UFMh3RQRt9PGuZ3cu9Z2ROcnSXQ== X-Received: by 10.46.50.16 with SMTP id y16mr10798706ljy.53.1519764062830; Tue, 27 Feb 2018 12:41:02 -0800 (PST) Received: from localhost.localdomain ([5.101.39.44]) by smtp.gmail.com with ESMTPSA id s75sm2523lje.69.2018.02.27.12.41.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 12:41:02 -0800 (PST) From: Dmitry Lebed To: hostap@lists.infradead.org Subject: [PATCH] ACS: add support for 160MHz BW Date: Tue, 27 Feb 2018 23:40:52 +0300 Message-Id: <20180227204052.15219-1-lebed.dmitry@gmail.com> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_124114_866662_72606EDE X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4010:c07:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lebed.dmitry[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Lebed MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Added support for 160MHz BW channels to automatic channel selection algorithm. Only 36 and 100 channels are supported as 160MHz channels. Signed-off-by: Dmitry Lebed --- src/ap/acs.c | 62 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index aa5905894..264098b51 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -362,7 +362,7 @@ acs_survey_chan_interference_factor(struct hostapd_iface *iface, } -static int acs_usable_ht40_chan(struct hostapd_channel_data *chan) +static int acs_usable_ht40_chan(const struct hostapd_channel_data *chan) { const int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 184, 192 }; @@ -376,7 +376,7 @@ static int acs_usable_ht40_chan(struct hostapd_channel_data *chan) } -static int acs_usable_vht80_chan(struct hostapd_channel_data *chan) +static int acs_usable_vht80_chan(const struct hostapd_channel_data *chan) { const int allowed[] = { 36, 52, 100, 116, 132, 149 }; unsigned int i; @@ -388,6 +388,17 @@ static int acs_usable_vht80_chan(struct hostapd_channel_data *chan) return 0; } +static int acs_usable_vht160_chan(const struct hostapd_channel_data *chan) +{ + const int allowed[] = { 36, 100 }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(allowed); i++) + if (chan->chan == allowed[i]) + return 1; + + return 0; +} static int acs_survey_is_sufficient(struct freq_survey *survey) { @@ -579,16 +590,24 @@ acs_find_ideal_chan(struct hostapd_iface *iface) iface->conf->secondary_channel) n_chans = 2; - if (iface->conf->ieee80211ac && - iface->conf->vht_oper_chwidth == 1) - n_chans = 4; + if (iface->conf->ieee80211ac) { + switch (iface->conf->vht_oper_chwidth) { + case VHT_CHANWIDTH_80MHZ: + n_chans = 4; + break; + case VHT_CHANWIDTH_160MHZ: + n_chans = 8; + break; + default: + n_chans = 1; + break; + } + } - /* TODO: VHT80+80, VHT160. Update acs_adjust_vht_center_freq() too. */ + /* TODO: VHT80+80. Update acs_adjust_vht_center_freq() too. */ wpa_printf(MSG_DEBUG, "ACS: Survey analysis for selected bandwidth %d MHz", - n_chans == 1 ? 20 : - n_chans == 2 ? 40 : - 80); + n_chans * 20); for (i = 0; i < iface->current_mode->num_channels; i++) { double total_weight; @@ -614,12 +633,20 @@ acs_find_ideal_chan(struct hostapd_iface *iface) } if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && - iface->conf->ieee80211ac && - iface->conf->vht_oper_chwidth == 1 && - !acs_usable_vht80_chan(chan)) { - wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for VHT80", - chan->chan); - continue; + iface->conf->ieee80211ac) { + if (iface->conf->vht_oper_chwidth == VHT_CHANWIDTH_80MHZ && + !acs_usable_vht80_chan(chan)) { + wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for VHT80", + chan->chan); + continue; + } + + if (iface->conf->vht_oper_chwidth == VHT_CHANWIDTH_160MHZ && + !acs_usable_vht160_chan(chan)) { + wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for VHT160", + chan->chan); + continue; + } } factor = 0; @@ -744,10 +771,13 @@ static void acs_adjust_vht_center_freq(struct hostapd_iface *iface) case VHT_CHANWIDTH_80MHZ: offset = 6; break; + case VHT_CHANWIDTH_160MHZ: + offset = 14; + break; default: /* TODO: How can this be calculated? Adjust * acs_find_ideal_chan() */ - wpa_printf(MSG_INFO, "ACS: Only VHT20/40/80 is supported now"); + wpa_printf(MSG_INFO, "ACS: Only VHT20/40/80/160 is supported now"); return; }