From patchwork Thu Oct 24 15:40:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 285951 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 6E1DE2C009F for ; Fri, 25 Oct 2013 02:41:10 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A1BEF9C16E; Thu, 24 Oct 2013 11:41:07 -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 O-456V9o-Ad9; Thu, 24 Oct 2013 11:41:07 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C38359C159; Thu, 24 Oct 2013 11:41:02 -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 04CD79C148 for ; Thu, 24 Oct 2013 11:41:01 -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 fXzEhXQUcBn5 for ; Thu, 24 Oct 2013 11:40:56 -0400 (EDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) (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 DC2F09C10C for ; Thu, 24 Oct 2013 11:40:55 -0400 (EDT) Received: by mail-wi0-f179.google.com with SMTP id hm4so2759869wib.6 for ; Thu, 24 Oct 2013 08:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=MPXpzJSQaRJDF+zII/M7G+kz1+7mS6oG5zbXrpypHBA=; b=V9pYM+hauc2cFySbgXGexhd/FzmhL5eopNA9+0SLg5jQF4nIw/ZFi27qcIIajrzigD ATrZMCMyi6KTzORVDfCSTZPwW43Z3ryr686fuXS/Jax4pb97H2XqL6VUQPCJbQAtItZW DLIpGMc2jnRISIyxTTU6E81t2l5JgG+91JsPw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MPXpzJSQaRJDF+zII/M7G+kz1+7mS6oG5zbXrpypHBA=; b=DU9HWPlP71kPIXAaiZkdKm65YTv0bBm+dIJdtmygx+eFDYVfiMi3vWbq/gjEdSTrKY 24imQ5ahj278cqi4PXGP2E3wa9Q4VXEeLIag3AAWBt0mYSeLjb/sKM+rqPij+qtrqZRW SwlemzLRZNmFKLFs1KRWt9QeL0Nt6toqfrEgxwuRDRcM/VIdEZGLS/pQoqS78TGlx7Dd dYld5MnsEgzwNgQbxG/qzN5UUES3FFK7xw/vMOnpdLA3U29IzkUdHwT7FJ32dK6/wYae z0cHVT5zik1UuWTppyIhzPJGp69vEb6feBTJLtKmrnaxxO4Vodvj54oE47BQvPNK3srJ A+tA== X-Gm-Message-State: ALoCoQn6tGjCcjXlqK+7B2KOF8gK63uLcMhLLLxdkwuP1Wf4vr6YsNZQPQHqWcj0oaavGhqyqUYgwHFpf66O68+xWTHfAXQ0F7DFViNl8RngbI8MF+NpLcE= X-Received: by 10.194.118.169 with SMTP id kn9mr2435608wjb.71.1382629254360; Thu, 24 Oct 2013 08:40:54 -0700 (PDT) Received: from dell.eicc.co.uk (ed03490-ge-0-0-0.mgdfwr.lumison.net. [212.20.242.100]) by mx.google.com with ESMTPSA id c10sm28194410wie.11.2013.10.24.08.40.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Oct 2013 08:40:53 -0700 (PDT) From: Janusz Dziedzic To: hostap@lists.shmoo.com Subject: [PATCH 1/4] hostapd: DFS VHT80 fix available channels list Date: Thu, 24 Oct 2013 17:40:25 +0200 Message-Id: <1382629228-8895-1-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.7.9.5 X-DomainID: tieto.com Cc: j@w1.fi 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 Add VHT80 available channels table. This table contains first available channel. We will choose also first channel as a control one. Signed-hostap: Janusz Dziedzic --- src/ap/dfs.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 37bbd20..70696cd 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -55,13 +55,33 @@ static int dfs_channel_available(struct hostapd_channel_data *chan) } -static int dfs_is_ht40_allowed(struct hostapd_channel_data *chan) +static int dfs_is_chan_allowed(struct hostapd_channel_data *chan, int n_chans) { - int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, - 184, 192 }; + /* Tables contains first valid channel number base on width. + * We will also choose this first channel as a control one. */ + int allowed_40[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, + 184, 192 }; + /* VHT80, valid channels base on central freq: 42, 58, 106, 122, 138, 155 */ + int allowed_80[] = { 36, 52, 100, 116, 132, 149 }; + int *allowed = allowed_40; + int allowed_no = 0; unsigned int i; - for (i = 0; i < sizeof(allowed) / sizeof(allowed[0]); i++) { + switch (n_chans) { + case 2: + allowed = allowed_40; + allowed_no = sizeof(allowed_40) / sizeof(allowed_40[0]); + break; + case 4: + allowed = allowed_80; + allowed_no = sizeof(allowed_80) / sizeof(allowed_80[0]); + break; + default: + wpa_printf(MSG_DEBUG, "Unknown width for %d channels", n_chans); + break; + } + + for (i = 0; i < allowed_no; i++) { if (chan->chan == allowed[i]) return 1; } @@ -92,7 +112,7 @@ static int dfs_find_channel(struct hostapd_data *hapd, /* Skip HT40/VHT uncompatible channels */ if (hapd->iconf->ieee80211n && hapd->iconf->secondary_channel) { - if (!dfs_is_ht40_allowed(chan)) + if (!dfs_is_chan_allowed(chan, n_chans)) continue; for (j = 1; j < n_chans; j++) {