From patchwork Thu Mar 24 14:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Escande X-Patchwork-Id: 1609070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=359cqctj; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=GWHMS8mi; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KPS8V5M98z9s1l for ; Fri, 25 Mar 2022 01:21:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ezmm3h+bD+8ZB03ryXzS/tIvrMeMpu++MbJhDg8vPKc=; b=359cqctjC0+QMd 8cVRY9x/QVtsFPZjS9TUt9F+hGyncxYyeDhB3P+v1ppprh296bFB1AlGIZd3mnl6O1JtYSl4sAr+k afNMwfuSZLBFCeCRQTf8dQHEqAxrZo06UBNOXDz3BYw949u9u+5RDuonsv/wNXg+f9wcSu8lqmZCL olg0MxpUlg0+mPBUiLtdGDLXQD8H212jXXcjS8aOLvF/7Fi0zk0ZXJDPwLQ0Q5OxmLBobxWPMSTM5 meyHeYzxrAXsGyj9lZE3Y2VJZRL89iFF1IdDrhqb3nMHW/5QWOaLJ6URBdxjlMkzOsqPKnEcYRkdY H/OIJCCdInAvBl4U7ybw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXOKO-00Gqa4-Ro; Thu, 24 Mar 2022 14:20:41 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXOJW-00Gq72-5b for hostap@lists.infradead.org; Thu, 24 Mar 2022 14:19:47 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 123-20020a1c1981000000b0038b3616a71aso2653461wmz.4 for ; Thu, 24 Mar 2022 07:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E7lKksvrkHyBrOAHrkgn9egXHKXBZ90pUmtIV0XbXZQ=; b=GWHMS8mics/ioZduwIg3QethWFjvA3mQrBVjfK0PAdFxRlF2SogxqR9xzDQR7OxagS 7qiUHtOz44vbi+Jf/zckiWi2thiZ/Luea7sXLlf8YXY3fUO8XGGQ3fm0C2eBdWvgrhVY z45cFmN9LVhTPURqzweSd8pJfxy+NK+IpRE9ok1gLIWbKMO9iZXKgpHLabkB5N7UeLKx mhtLZJ/1+EFL1AYHbFXDgDupi4h6nzNorzLKgzF6jlE0sioMALPswAeoto2pQ48W4wPx khAQKYbcvul58N6MPA0QzhYVh/Kp4pPLm16nnoxprPC+E/WJ/2db7167TneHAbJglQSx TLWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E7lKksvrkHyBrOAHrkgn9egXHKXBZ90pUmtIV0XbXZQ=; b=rgGWe7xdxLp9twuurLo4lCkZZmGFuhhniOTCAFwGah7e9ZkrQmq7sNCGz4X+vXQjiI MO4+bmESq6pu9mGde13k1a8+MlTzO1qg/O3SRDxLfWdGBgIodzM4N3pb/m5MLQVwRqDH qiQTDK14frpddgF80iwejQvPC68/7m9gpS5sV/9Vx6xp0xxyNxVuZTM0638ohz2qmI7W iGb4zYgdejmOTihAzonWkqwjN7JQyJkavRDxPW2QdoIhxXdcEBPMP1/O+LejpyC35/w6 SmTYq+gKFc+oUETusbHGlg3iKPBtbqT0OEE0OpUaBvLanHjfHGGU0hh7N2nkGmZGBjw1 G4+Q== X-Gm-Message-State: AOAM532DZmTozGH9qVcTtXGYm/Rktafo4t6VSVyauB7HEPvWMdv/Vgyz XR1W2hf9IyuJ9VRWa01l5chKhDl4dF4= X-Google-Smtp-Source: ABdhPJzPPLOPWrjC8/n5kCBGCstZ5YZ6B/EzfzUn12BEFlIgn8EbmIV8ELc5tyyVm2dI9sbVjapyCQ== X-Received: by 2002:a7b:c40f:0:b0:389:f3ad:5166 with SMTP id k15-20020a7bc40f000000b00389f3ad5166mr4920639wmi.63.1648131584265; Thu, 24 Mar 2022 07:19:44 -0700 (PDT) Received: from syracuse.iliad.local (freebox.vlq16.iliad.fr. [213.36.7.13]) by smtp.gmail.com with ESMTPSA id n65-20020a1c2744000000b003862bfb509bsm6776422wmn.46.2022.03.24.07.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 07:19:43 -0700 (PDT) From: Nicolas Escande To: hostap@lists.infradead.org Cc: Nicolas Escande Subject: [RFC PATCH 1/4] ACS: extract bw40/80/160 freqs out of acs_usable_bwXXX_chan Date: Thu, 24 Mar 2022 15:19:17 +0100 Message-Id: <20220324141920.317515-2-nico.escande@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220324141920.317515-1-nico.escande@gmail.com> References: <20220324141920.317515-1-nico.escande@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220324_071946_245695_57C6C447 X-CRM114-Status: GOOD ( 13.16 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This extracts the 3 lists of allowed channels for 40/80/160MHz bandwidth out of their respective functions. It also ads for each segment the frequency of the segment's last channel & the number of the [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [nico.escande[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This extracts the 3 lists of allowed channels for 40/80/160MHz bandwidth out of their respective functions. It also ads for each segment the frequency of the segment's last channel & the number of the segment's "center" channel. This is preparativie work to allow selecting a channel which is not the first of the segment for 40/80/160MHz Signed-off-by: Nicolas Escande --- src/ap/acs.c | 67 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index e2ac1d0d3..40df377f0 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -371,47 +371,80 @@ acs_survey_chan_interference_factor(struct hostapd_iface *iface, } +const struct { + int first; + int last; + int center_chan; +} bw40_seg[] = { { 5180, 5200, 38 }, { 5220, 5240, 46 }, { 5260, 5280, 54 }, + { 5300, 5320, 62 }, { 5500, 5520, 102 }, { 5540, 5560, 110 }, + { 5580, 5600, 110 }, { 5620, 5640, 126}, { 5660, 5680, 134 }, + { 5700, 5720, 142 }, { 5745, 5765, 151 }, { 5785, 5805, 159 }, + { 5825, 5845, 167 }, { 5865, 5885, 175 }, + { 5955, 5975, 3 }, { 5995, 6015, 11 }, { 6035, 6055, 19 }, + { 6075, 6095, 27 }, { 6115, 6135, 35 }, { 6155, 6175, 43 }, + { 6195, 6215, 51 }, { 6235, 6255, 59 }, { 6275, 6295, 67 }, + { 6315, 6335, 75 }, { 6355, 6375, 83 }, { 6395, 6415, 91 }, + { 6435, 6455, 99 }, { 6475, 6495, 107 }, { 6515, 6535, 115 }, + { 6555, 6575, 123 }, { 6595, 6615, 131 }, { 6635, 6655, 139 }, + { 6675, 6695, 147 }, { 6715, 6735, 155 }, { 6755, 6775, 163 }, + { 6795, 6815, 171 }, { 6835, 6855, 179 }, { 6875, 6895, 187 }, + { 6915, 6935, 195 }, { 6955, 6975, 203 }, { 6995, 7015, 211 }, + { 7035, 7055, 219 }, { 7075, 7115, 227} }; + static int acs_usable_bw40_chan(const struct hostapd_channel_data *chan) { - const int allowed[] = { 5180, 5220, 5260, 5300, 5500, 5540, 5580, 5620, - 5660, 5745, 5785, 4920, 4960, 5955, 5995, 6035, - 6075, 6115, 6155, 6195, 6235, 6275, 6315, 6355, - 6395, 6435, 6475, 6515, 6555, 6595, 6635, 6675, - 6715, 6755, 6795, 6835, 6875, 6915, 6955, 6995, - 7035, 7075 }; unsigned int i; - for (i = 0; i < ARRAY_SIZE(allowed); i++) - if (chan->freq == allowed[i]) + for (i = 0; i < ARRAY_SIZE(bw40_seg); i++) + if (chan->freq == bw40_seg[i].first) return 1; return 0; } +const struct { + int first; + int last; + int center_chan; +} bw80_seg[] = { { 5180, 5240, 42 }, { 5260, 5320, 58 }, { 5500, 5560, 106 }, + { 5580, 5640, 122 }, { 5660, 5720, 138 }, { 5745, 5805, 155 }, + { 5825, 5885, 171}, + { 5955, 6015, 7 }, { 6035, 6095, 23 }, { 6115, 6175, 39 }, + { 6195, 6255, 55 }, { 6275, 6335, 71 }, { 6355, 6415, 87 }, + { 6435, 6495, 103 }, { 6515, 6575, 119 }, { 6595, 6655, 135 }, + { 6675, 6735, 151 }, { 6755, 6815, 167 }, { 6835, 6895, 183 }, + { 6915, 6975, 199 }, { 6995, 7055, 215 } }; + + static int acs_usable_bw80_chan(const struct hostapd_channel_data *chan) { - const int allowed[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, 6035, - 6115, 6195, 6275, 6355, 6435, 6515, 6595, 6675, - 6755, 6835, 6915, 6995 }; unsigned int i; - for (i = 0; i < ARRAY_SIZE(allowed); i++) - if (chan->freq == allowed[i]) + for (i = 0; i < ARRAY_SIZE(bw80_seg); i++) + if (chan->freq == bw80_seg[i].first) return 1; return 0; } +const struct { + int first; + int last; + int center_chan; +} bw160_seg[] = { { 5180, 5320, 50 }, { 5500, 5640, 114 }, {5745, 5885, 163 }, + { 5955, 6095, 15 }, { 6115, 6255, 47 }, { 6275, 6415, 79 }, + { 6435, 6575, 111 }, { 6595, 6735, 143 }, + { 6755, 6895, 175 }, { 6915, 7055, 207 } }; + + static int acs_usable_bw160_chan(const struct hostapd_channel_data *chan) { - const int allowed[] = { 5180, 5500, 5955, 6115, 6275, 6435, 6595, 6755, - 6915 }; unsigned int i; - for (i = 0; i < ARRAY_SIZE(allowed); i++) - if (chan->freq == allowed[i]) + for (i = 0; i < ARRAY_SIZE(bw160_seg); i++) + if (chan->freq == bw160_seg[i].first) return 1; return 0;