From patchwork Fri Dec 22 04:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-CY Lee X-Patchwork-Id: 1879553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=l+9Gw9Yk; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=X/M6+pTI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SxKXp0cdmz1ypX for ; Fri, 22 Dec 2023 19:02:50 +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=Pf8cCBk2z4eU2jpEVX4bTdm5/0dv7KDQfspCJDQw+aY=; b=l+9Gw9YkKIn3V2 AnBaKnfa5l6dPsTO5hErV330tRzkXTJgx2j2632blba/e4e+nCDVltA9XMsF0RM4B3BTSgNXurQkX hRhkAvQ11133p2ncSEkKwKXOVdz7/Gd4OhbjR8WvI99OT8e+sNEu9MhqK4QrrRw3BvPM0XA4H7ggq z9BesW9FHWYjRAzg4irxI4ZM03qPoEMEbHPA1x06VlTDMA8PyCfc6FF096s5lld5pQI+erfuwNsyj 72untbSuVHNBaF4FF4FASiftTcdZvbfBIqVpZVR3kE9B0gZ31JwkWBNOlpDus9hYfHB5kUqif/P7z pt9Zs+6jDjt5aM6hKDnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGaU6-005FHi-0G; Fri, 22 Dec 2023 08:02:18 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGXd5-004v9F-1D for hostap@lists.infradead.org; Fri, 22 Dec 2023 04:59:24 +0000 X-UUID: dde9e522a08611ee9b09ad09c76753c8-20231221 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Eye7a0CzHFijQEYt2Et2iwgEw1+HOcMHwJg5kUc4xQk=; b=X/M6+pTISRsINXFNvjuViiMkbdkTMZW84VOsMzshzLt27yLm8MdqdsdFD22yy4qBzklwJsZZtNZZQyQ+SdaOQ6dA1GBX1OdTBVLBOogyHJNGnTnA+4/6wmwWk9xWi67THeDNK6v+I/zS65hZUMfvaFh6hWU8iUPxkhGN3zFULj8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:5f08465a-ba36-4beb-94a4-793f8a1b9ba2,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:29275e2e-1ab8-4133-9780-81938111c800,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: dde9e522a08611ee9b09ad09c76753c8-20231221 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1410428457; Thu, 21 Dec 2023 21:59:20 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 12:59:17 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Dec 2023 12:59:17 +0800 From: Michael-CY Lee To: Jouni Malinen CC: Felix Fietkau , , Evelyn Tsai , Money Wang , "Michael-CY Lee" Subject: [PATCH 1/4] ACS: Add 40- MHz support in 2GHz band. Date: Fri, 22 Dec 2023 12:59:08 +0800 Message-ID: <20231222045911.27999-2-michael-cy.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222045911.27999-1-michael-cy.lee@mediatek.com> References: <20231222045911.27999-1-michael-cy.lee@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--4.255200-8.000000 X-TMASE-MatchedRID: WeEc/VfbZdBkJB0BBwKFmQPZZctd3P4BWjWsWQUWzVo6T6DETDu0shWM l8ih/tVGehXd+MERQc1dPcv79cgNcSqDVw6LinnHAoNa2r+Edw13zasRoUmRGvvHmhh5NK3qEWX AmFVxJU5yylwV7Bc73YAy6p60ZV62fJ5/bZ6npdjKayT/BQTiGhF0z2eYTGiTqDslhSSa+PnbbI UXIs8va4zfzwhsPc3TiABrcLTmFYeRKT12/2oS3YChBJx+Rc/wyHyawlv5YT/sIAAoP/QFVUEsB v8VOmZSdATQdtPksR+3/JiWOe6GXXSWgQ2GpXdZbxffl9hhCBw= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.255200-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: D05D5D6F86E1DE5274A3A0DA96A5B8DA56B72EAF22C0001FD62E090646F317D12000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_205923_422937_8EF17C22 X-CRM114-Status: GOOD ( 12.04 ) 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 patch adds the support for 40- MHz in 2GHz band. Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/acs.c | 26 ++++++++++++ 1 file changed, 12 insertions(+), 14 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Mailman-Approved-At: Fri, 22 Dec 2023 00:02:16 -0800 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 patch adds the support for 40- MHz in 2GHz band. Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/acs.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index 7ab310f75..f04c8a8d8 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -787,6 +787,10 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, long double factor; int i, j; unsigned int k; + int secondary_channel = 1, freq_offset; + + if (is_24ghz_mode(mode->mode)) + secondary_channel = iface->conf->secondary_channel; for (i = 0; i < mode->num_channels; i++) { double total_weight; @@ -825,7 +829,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, iface->conf->country[2] == 0x4f) continue; - if (!chan_bw_allowed(chan, bw, 1, 1)) { + if (!chan_bw_allowed(chan, bw, secondary_channel != -1, 1)) { wpa_printf(MSG_DEBUG, "ACS: Channel %d: BW %u is not supported", chan->chan, bw); @@ -884,7 +888,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, total_weight = 1; for (j = 1; j < n_chans; j++) { - adj_chan = acs_find_chan(iface, chan->freq + (j * 20)); + adj_chan = acs_find_chan(iface, chan->freq + + (j * secondary_channel * 20)); if (!adj_chan) break; @@ -932,8 +937,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, * channel interference factor. */ if (is_24ghz_mode(mode->mode)) { for (j = 0; j < n_chans; j++) { + freq_offset = j * 20 * secondary_channel; adj_chan = acs_find_chan(iface, chan->freq + - (j * 20) - 5); + freq_offset - 5); if (adj_chan && acs_usable_chan(adj_chan)) { factor += ACS_ADJ_WEIGHT * adj_chan->interference_factor; @@ -941,7 +947,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } adj_chan = acs_find_chan(iface, chan->freq + - (j * 20) - 10); + freq_offset - 10); if (adj_chan && acs_usable_chan(adj_chan)) { factor += ACS_NEXT_ADJ_WEIGHT * adj_chan->interference_factor; @@ -949,7 +955,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } adj_chan = acs_find_chan(iface, chan->freq + - (j * 20) + 5); + freq_offset + 5); if (adj_chan && acs_usable_chan(adj_chan)) { factor += ACS_ADJ_WEIGHT * adj_chan->interference_factor; @@ -957,7 +963,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } adj_chan = acs_find_chan(iface, chan->freq + - (j * 20) + 10); + freq_offset + 10); if (adj_chan && acs_usable_chan(adj_chan)) { factor += ACS_NEXT_ADJ_WEIGHT * adj_chan->interference_factor; @@ -1042,14 +1048,6 @@ acs_find_ideal_chan(struct hostapd_iface *iface) goto bw_selected; } - /* TODO: HT40- support */ - - if (iface->conf->ieee80211n && - iface->conf->secondary_channel == -1) { - wpa_printf(MSG_ERROR, "ACS: HT40- is not supported yet. Please try HT40+"); - return NULL; - } - if (iface->conf->ieee80211n && iface->conf->secondary_channel) n_chans = 2; From patchwork Fri Dec 22 04:59:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-CY Lee X-Patchwork-Id: 1879554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=wwzTQbl3; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=f16HbZO0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SxKZ26sP0z1ypX for ; Fri, 22 Dec 2023 19:03:54 +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=tq6Xxlz7807X1L995W03evmb5LQp/QQwv5FEzz2tZ9A=; b=wwzTQbl336adom OKkdeMi07nd2DprBuH9ze23aZwqVYAbF+RRTqk+lNG5Op57WqEK6pvy5wcPLVb48Fx1ySr8V8Ltz6 M5XiSysTDc3rEgHCjutmNmpxPE8F1CJ+mgi2lJxEI3EY7ZqD4craIF/RAgDvoapEuR4Kv8zpaQTJ1 fWKQMoHweh3aDG+SWjLBhD05HlU4z2k2ophos+lwYAjxSDcxSNvJSJfmJ/avQxiDr5A3N7CGEpsIG uuIQrq9nEM/i/gFETB+Ft3s9DgGywkK5rd1WXrJowSVBkq/4SmgFfJTwF/mPaZvWoSbwD5DXN38v7 H6BAyI/yRjrTrRI5pV0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGaV3-005FVo-1q; Fri, 22 Dec 2023 08:03:17 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGXdd-004vEy-2S for hostap@lists.infradead.org; Fri, 22 Dec 2023 04:59:59 +0000 X-UUID: f206e6fea08611ee958cff29c719f35b-20231221 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=q4HOO8f27Pzet1S1E2/l1NVedVwheA0XjQNb4hWmCLo=; b=f16HbZO0836XkcOZg3JnNp9/tj5wEL1ApQWVqYD83ql2YoOsILSOhO1qUVQvSR/hwOuGVj4Qf1s/Yd8kCv2/yS/w3IgeIrsKHKWQnFitvwSQSrDJAoAzHDH8hmxGPfvMvZOY0igSzahHBBdeuNOfTFK3mROfYnQtHq1Fysj7O3E=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:fc79afe3-536b-4f1a-ba90-539cba7a2692,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:00bb8c7e-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_ULN,TF_CID_SPAM_SNR X-UUID: f206e6fea08611ee958cff29c719f35b-20231221 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 509297684; Thu, 21 Dec 2023 21:59:54 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 12:59:19 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Dec 2023 12:59:19 +0800 From: Michael-CY Lee To: Jouni Malinen CC: Felix Fietkau , , Evelyn Tsai , Money Wang , Michael-CY Lee Subject: [PATCH 2/4] ACS: Fix ACS not selecting the best channel in the segment Date: Fri, 22 Dec 2023 12:59:09 +0800 Message-ID: <20231222045911.27999-3-michael-cy.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222045911.27999-1-michael-cy.lee@mediatek.com> References: <20231222045911.27999-1-michael-cy.lee@mediatek.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_205957_798644_B274A8EB X-CRM114-Status: GOOD ( 16.91 ) 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 patch fixes the following bugs about selecting the best channels in the segment: 1. The 'update_best' once became false, it never becomes true again. In other word, if one of the channel in the s [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Mailman-Approved-At: Fri, 22 Dec 2023 00:03:16 -0800 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 patch fixes the following bugs about selecting the best channels in the segment: 1. The 'update_best' once became false, it never becomes true again. In other word, if one of the channel in the segment is not usable, the remaining channels in the segment were never able to be the best channel. 2. The primary channel in the segment might be not usable due to the insufficient survey data. Therefore, it cannot be the best channel and we cannot take its factor/weight into account. Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/acs.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index f04c8a8d8..b571459af 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -793,11 +793,10 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, secondary_channel = iface->conf->secondary_channel; for (i = 0; i < mode->num_channels; i++) { - double total_weight; + double total_weight = 0; struct acs_bias *bias, tmp_bias; - bool update_best = true; - best = chan = &mode->channels[i]; + chan = &mode->channels[i]; /* Since in the current ACS implementation the first channel is * always a primary channel, skip channels not available as @@ -883,9 +882,12 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } factor = 0; - if (acs_usable_chan(chan)) + best = NULL; + if (acs_usable_chan(chan)) { factor = chan->interference_factor; - total_weight = 1; + total_weight = 1; + best = chan; + } for (j = 1; j < n_chans; j++) { adj_chan = acs_find_chan(iface, chan->freq + @@ -903,15 +905,12 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, if (acs_usable_chan(adj_chan)) { factor += adj_chan->interference_factor; total_weight += 1; - } else { - update_best = false; - } - /* find the best channel in this segment */ - if (update_best && - adj_chan->interference_factor < - best->interference_factor) - best = adj_chan; + /* find the best channel in this segment */ + if (!best || adj_chan->interference_factor < + best->interference_factor) + best = adj_chan; + } } if (j != n_chans) { @@ -972,6 +971,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } } + if (total_weight == 0) + continue; + factor /= total_weight; bias = NULL; From patchwork Fri Dec 22 04:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-CY Lee X-Patchwork-Id: 1879556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=j1aD0dGn; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=YkI3/Zmr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SxKky5VKcz1ySd for ; Fri, 22 Dec 2023 19:11:38 +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=7GnoCORHH8klVUHFg/Xhka+F4RtdO8T1lCQSz+U+HGk=; b=j1aD0dGnshLQYi ELSTiQShJZhI07NSUEgXBPGtcv2BfZ+CyMZCPcDOH7wmDcg4GoUMOXudDmPgayUcCFMEdMTX0v6tN +Dct+5hG94uuASar8AaVq1bxV8CIc+duFB3DXnBp3+nwCn/C4v5H7I7UhJcILA9FCyCExkzD1CAdp mH0i7Szmy+qvbEfrn6xB1J89pIHzEnd+w9dTmfrYWD1qxUlGsOlIaeJRt5C4s/MsLqvLjt4DUPm37 AWC5SubvMRHXu9AuWYseYzMDPle5VPbCakLee1V4jRmy6SwPTWtgcZfUkGq+IKchCVcx6dCyv0zK3 qk0dOMnRR1lbiJJQ1W+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGacR-005GpK-0D; Fri, 22 Dec 2023 08:10:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGXdf-004vEy-0F for hostap@lists.infradead.org; Fri, 22 Dec 2023 05:00:00 +0000 X-UUID: f24ddb22a08611ee958cff29c719f35b-20231221 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=xLmv4JYPGsrNta7jLDEKOT3iT9NVYYuSBn1fdcSCAWg=; b=YkI3/ZmrY8htE9BbHquSigd2IxLTZpvigGGSaJaAn35YS8HM69b19KGOT57y1hUJ3VTRG3N62Kcc2Kaw+EddIIHUJrIKQng+HB7gf1jJCrn+drSX5rZn3/610KbIgiRelp+xI6bUc9Vxqr4crxjeUnJbB/pBfhwCilV0AP62mL0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:0763593e-ca7b-448c-a1f7-068cfafbbe1e,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:5d391d7,CLOUDID:dec6738d-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: f24ddb22a08611ee958cff29c719f35b-20231221 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2139971806; Thu, 21 Dec 2023 21:59:54 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 12:59:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Dec 2023 12:59:20 +0800 From: Michael-CY Lee To: Jouni Malinen CC: Felix Fietkau , , Evelyn Tsai , Money Wang , Michael-CY Lee Subject: [PATCH 3/4] hostapd: add eht_bw320_offset configuration option Date: Fri, 22 Dec 2023 12:59:10 +0800 Message-ID: <20231222045911.27999-4-michael-cy.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222045911.27999-1-michael-cy.lee@mediatek.com> References: <20231222045911.27999-1-michael-cy.lee@mediatek.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_205959_124838_3C38E753 X-CRM114-Status: GOOD ( 20.00 ) 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 patch introduces a new configuration option, "eht_bw320_offset", which enables devices to specify a preferred channelization for 320 MHz BSSs when using automatic channel selection (ACS). This op [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Mailman-Approved-At: Fri, 22 Dec 2023 00:10:54 -0800 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 patch introduces a new configuration option, "eht_bw320_offset", which enables devices to specify a preferred channelization for 320 MHz BSSs when using automatic channel selection (ACS). This option is applicable only when the channel is not already decided and the bandwidth is set to 320 MHz. The value and meaning of the option: 0: auto-detected by ACS 1: 320 MHz-1 2: 320 MHz-2 Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- hostapd/config_file.c | 2 ++ hostapd/hostapd.conf | 8 ++++++++ src/ap/ap_config.c | 6 ++++++ src/ap/ap_config.h | 38 ++++++++++++++++++++++++++++++++++++++ src/ap/ctrl_iface_ap.c | 11 +++++++++++ src/ap/drv_callbacks.c | 2 ++ 6 files changed, 67 insertions(+) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 1127d74f0..6d9b556fb 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -4830,6 +4830,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, line); return 1; } + } else if (os_strcmp(buf, "eht_bw320_offset") == 0) { + conf->eht_bw320_offset = atoi(pos); #endif /* CONFIG_IEEE80211BE */ } else { wpa_printf(MSG_ERROR, diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 8f6165a0b..9f3299c0c 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -1032,6 +1032,14 @@ wmm_ac_vo_acm=0 # 1 = PE field duration is 20 us #eht_default_pe_duration=0 +#eht_bw320_offset: For automatic channel selection (ACS) to indicate a preferred +# 320 MHz channelization in EHT mode. +# If the channel is decided or the bandwidth is not 320 MHz, this option is meaningless. +# 0 = auto-detect by hostapd +# 1 = 320 MHz-1 +# 2 = 320 MHz-2 +#eht_bw320_offset=0 + # Disabled subchannel bitmap (16 bits) as per IEEE P802.11be/3.0, # Figure 9-1002c (EHT Operation Information field format). Each bit corresponds # to a 20 MHz channel, the lowest bit corresponds to the lowest frequency. A diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 2c66217e8..05303e791 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -295,6 +295,7 @@ struct hostapd_config * hostapd_config_defaults(void) conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL; #endif /* CONFIG_AIRTIME_POLICY */ + hostapd_set_and_check_bw320_offset(conf, 0); return conf; } @@ -1505,6 +1506,7 @@ static int hostapd_config_check_cw(struct hostapd_config *conf, int queue) int hostapd_config_check(struct hostapd_config *conf, int full_config) { size_t i; + u8 bw320_offset = 0; if (full_config && is_6ghz_op_class(conf->op_class) && !conf->hw_mode_set) { @@ -1556,6 +1558,8 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config) "Cannot set ieee80211be without ieee80211ax"); return -1; } + + bw320_offset = conf->eht_bw320_offset; #endif /* CONFIG_IEEE80211BE */ if (full_config && conf->mbssid && !conf->ieee80211ax) { @@ -1564,6 +1568,8 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config) return -1; } + hostapd_set_and_check_bw320_offset(conf, bw320_offset); + for (i = 0; i < conf->num_bss; i++) { if (hostapd_config_check_bss(conf->bss[i], conf, full_config)) return -1; diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 0bc799d3e..69e42037a 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1174,6 +1174,7 @@ struct hostapd_config { u16 punct_bitmap; /* a bitmap of disabled 20 MHz channels */ u8 punct_acs_threshold; u8 eht_default_pe_duration; + u8 eht_bw320_offset; #endif /* CONFIG_IEEE80211BE */ /* EHT enable/disable config from CHAN_SWITCH */ @@ -1274,6 +1275,43 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf, conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx; } +static inline u8 +hostapd_get_bw320_offset(struct hostapd_config *conf) +{ +#ifdef CONFIG_IEEE80211BE + if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) && + hostapd_get_oper_chwidth(conf) == CONF_OPER_CHWIDTH_320MHZ) + return conf->eht_bw320_offset; +#endif /* CONFIG_IEEE80211BE */ + return 0; +} + +static inline void +hostapd_set_and_check_bw320_offset(struct hostapd_config *conf, + u8 bw320_offset) +{ +#ifdef CONFIG_IEEE80211BE + if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) && + hostapd_get_oper_chwidth(conf) == CONF_OPER_CHWIDTH_320MHZ) { + if (conf->channel) { + /* If the channel is set, then calculate bw320_offset + * by center frequency segment 0. + */ + u8 seg0 = hostapd_get_oper_centr_freq_seg0_idx(conf); + conf->eht_bw320_offset = (seg0 - 31) % 64 ? 2 : 1; + } else { + /* If the channel is not set, bw320_offset indicates + * preferred offset of 320 MHz. + */ + conf->eht_bw320_offset = bw320_offset; + } + } else { + conf->eht_bw320_offset = 0; + } +#endif /* CONFIG_IEEE80211BE */ +} + +#define IBF_DEFAULT_ENABLE 0 int hostapd_mac_comp(const void *a, const void *b); struct hostapd_config * hostapd_config_defaults(void); diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 32a5b8ecd..537867180 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -830,6 +830,17 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, if (os_snprintf_error(buflen - len, ret)) return len; len += ret; + + if (is_6ghz_op_class(iface->conf->op_class) && + hostapd_get_oper_chwidth(iface->conf) == + CONF_OPER_CHWIDTH_320MHZ) { + ret = os_snprintf(buf + len, buflen - len, + "eht_bw320_offset=%d\n", + iface->conf->eht_bw320_offset); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + } } #endif /* CONFIG_IEEE80211BE */ diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index ace0ce3d7..210068a94 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1170,6 +1170,8 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, hostapd_set_oper_chwidth(hapd->iconf, chwidth); hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx); hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx); + /* Auto-detect new bw320_offset */ + hostapd_set_and_check_bw320_offset(hapd->iconf, 0); #ifdef CONFIG_IEEE80211BE hapd->iconf->punct_bitmap = punct_bitmap; #endif /* CONFIG_IEEE80211BE */ From patchwork Fri Dec 22 04:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-CY Lee X-Patchwork-Id: 1879573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=x4CXgsb0; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=N5bwPUQv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SxLtl1ssLz1ypX for ; Fri, 22 Dec 2023 20:03:27 +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=kledPXov6EkaCKXx2zsARzyaK829guLZNWVT/exVq+Y=; b=x4CXgsb0nCmMqN tEPo02s4hFKQU0GyDaM3icJPKrefTJWi8Cizs4/oEzT9owTu6NBw0Ru1opSSA03a0O3kOZh8YB2xq tGn7oPjMPRklyFTNDlI4KMaQXvlrrc90IOJ7xRCeYCxVUPTrcYuhxoUfG8UutkR+so0fkVyIoEmdn OOPvwaPJGIpCPkD68O1H2Hq0aa2p/bb2sAeFo0PuDL4ZMsuccgMwWHiRchCiYZ+jisckIZDcDkUhy F3bdCY/ar+IxJR13l8V+xThJ9hCcYSIAA6ZzCGgbg6ehfJF//9eRQw60OPecDp0KlxMDIG+kiTm5d 8l5geQBUA2/iIhyVE9vA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGbQX-005Ntb-1R; Fri, 22 Dec 2023 09:02:41 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGXde-004vEi-1r for hostap@lists.infradead.org; Fri, 22 Dec 2023 05:00:00 +0000 X-UUID: f0fe3d70a08611ee958cff29c719f35b-20231221 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=lbjRzsNVsSAaD05AwokpWQ455iO/IMceXIigu1hqIF8=; b=N5bwPUQv8giSJUs/j5QSR5TpwFhxxZAOukvUq7jQTYaRPYaabmKC1ax9/BVg0U8xIo0/6HfGYukC2Sn+0m32HzeNTciN1b7uJgBnh1ndlLoQ84Jle/wiJ5r94RBnIUvM5LYn8ihFxKzHBdcmopp73JGVjsl9pDBlmHzSFpmhW04=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:a65ed0c5-770b-4cdb-be16-7780b6e17794,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:01bb8c7e-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: f0fe3d70a08611ee958cff29c719f35b-20231221 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 9966713; Thu, 21 Dec 2023 21:59:52 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 12:59:21 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Dec 2023 12:59:21 +0800 From: Michael-CY Lee To: Jouni Malinen CC: Felix Fietkau , , Evelyn Tsai , Money Wang , "Michael-CY Lee" Subject: [PATCH 4/4] ACS: Extend the 320 MHz support Date: Fri, 22 Dec 2023 12:59:11 +0800 Message-ID: <20231222045911.27999-5-michael-cy.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222045911.27999-1-michael-cy.lee@mediatek.com> References: <20231222045911.27999-1-michael-cy.lee@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--3.408000-8.000000 X-TMASE-MatchedRID: 173cC0PKvpvaVScbiljcbEKcYi5Qw/RVkKAa/khZ3iTqHdd93lVj+Gin UzJTXLm8DpeE76EMrX///ziG92/ObkKyAETKSsGBo4Ef+Wmk9x1XLUapz6y7gaaDeNpTFrdevHV UwD7DZC5OFu8ssjxG8xpMhWxtLWkb4X8HWMSNX7qzLD5kmcW6ZMCY5/Mqi1OiqanaW7tMOzq1QY NwWHqTDKJmEheuUjBwgZ89vC7wgWumWOD8X0TFhKTfLKfi4+0tfrTt+hmA5bL4JyR+b5tvoDtBj s7aUEmEV5m1h0apwwS57A7msEd0fh8TzIzimOwPC24oEZ6SpSk6XEE7Yhw4Fi9NDjx7wCwP2s5J jU7+/VHaox/okXATs+SP4BeoYuh3Gv9c/JGrqaoGUlPBTf4Nji627YrAFrlNns1ZAWkf/yHgYTj PGTEXG8GQYFMiVRG5ehcPPz6UzEWlb5ogMngNpHOTEn5IiRSOady5RJQR05c= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.408000-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: FE41C8E0368839106C29546E53DB17E6979AF9E3B085081A38D26A35635451122000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_205958_617342_0EB7032E X-CRM114-Status: GOOD ( 21.44 ) 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: There are bandwidth 320 MHz-1 and 320 MHz-2 channelization in EHT mode. When using ACS, user might prefer one of the channelization or both, but original ACS was unable to take such perference. Another problem is that the original ACS returns only the ideal channel but no 320 MHz channelization. The function acs_get_bw_center_chan() also could not correctly returns the center frequency of ba [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Mailman-Approved-At: Fri, 22 Dec 2023 01:02:40 -0800 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 There are bandwidth 320 MHz-1 and 320 MHz-2 channelization in EHT mode. When using ACS, user might prefer one of the channelization or both, but original ACS was unable to take such perference. Another problem is that the original ACS returns only the ideal channel but no 320 MHz channelization. The function acs_get_bw_center_chan() also could not correctly returns the center frequency of bandwidth 320 MHz that is decided by ACS. For example, if ACS decide the ideal channel is channel 37 with channelization 320 MHz-2 (center frequency 6265 MHz), acs_get_bw_center_chan() returns 6105 MHz, which is 320 MHz-1. This patch extends the support for 320 MHz so that ACS can choose the best channel according to the user's preference. Also, after calling acs_find_ideal_chan_mode(), the best channel and bandwidth can be derived. The changes of this patch are: - bw_type ACS_BW320 is divided into ACS_BW320_1 and ACS_BW320_2 - in bandwidth 320 MHz, find the best channel and bandwidth according to user's perference (320 MHz-1, 320 Mhz-2 or both are OK) - before acs_find_ideal_chan_mode() returns, update bw320_offset in iface->conf so that the best channel's channelization is recorded. - get the best center frequency from bw320_offset Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/acs.c | 90 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 17 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index b571459af..a5a870c1b 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -245,7 +245,8 @@ enum bw_type { ACS_BW40, ACS_BW80, ACS_BW160, - ACS_BW320, + ACS_BW320_1, + ACS_BW320_2 }; struct bw_item { @@ -287,16 +288,20 @@ static const struct bw_item bw_160[] = { { 6435, 6575, 111 }, { 6595, 6735, 143 }, { 6755, 6895, 175 }, { 6915, 7055, 207 }, { -1, -1, -1 } }; -static const struct bw_item bw_320[] = { - { 5955, 6255, 31 }, { 6115, 6415, 63 }, { 6275, 6575, 95 }, - { 6435, 6735, 127 }, { 6595, 6895, 159}, { 6755, 7055, 191 }, +static const struct bw_item bw_320_1[] = { + { 5955, 6255, 31 }, { 6275, 6575, 95 }, { 6595, 6895, 159 }, + { -1, -1, -1 } +}; +static const struct bw_item bw_320_2[] = { + { 6115, 6415, 63 }, { 6435, 6735, 127 }, { 6755, 7055, 191 }, { -1, -1, -1 } }; static const struct bw_item *bw_desc[] = { [ACS_BW40] = bw_40, [ACS_BW80] = bw_80, [ACS_BW160] = bw_160, - [ACS_BW320] = bw_320, + [ACS_BW320_1] = bw_320_1, + [ACS_BW320_2] = bw_320_2, }; @@ -775,6 +780,42 @@ static void acs_update_puncturing_bitmap(struct hostapd_iface *iface, #endif /* CONFIG_IEEE80211BE */ +static bool +acs_usable_bw320_chan(struct hostapd_iface *iface, + struct hostapd_channel_data *chan, int *bw320_offset) +{ + char *bw320_str[] = { "320 MHz", "320 MHz-1", "320 MHz-2" }; + int conf_bw320_offset = hostapd_get_bw320_offset(iface->conf); + + *bw320_offset = 0; + switch (conf_bw320_offset) { + case 2: + if (acs_usable_bw_chan(chan, ACS_BW320_2)) + *bw320_offset = 2; + break; + case 1: + if (acs_usable_bw_chan(chan, ACS_BW320_1)) + *bw320_offset = 1; + break; + case 0: + default: + conf_bw320_offset = 0; + if (acs_usable_bw_chan(chan, ACS_BW320_1)) + *bw320_offset = 1; + else if (acs_usable_bw_chan(chan, ACS_BW320_2)) + *bw320_offset = 2; + break; + } + + if (!*bw320_offset) + wpa_printf(MSG_DEBUG, + "ACS: Channel %d: not allowed as primary channel for %s bandwidth", + chan->chan, bw320_str[conf_bw320_offset]); + + return *bw320_offset != 0; +} + + static void acs_find_ideal_chan_mode(struct hostapd_iface *iface, struct hostapd_hw_modes *mode, @@ -785,9 +826,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, { struct hostapd_channel_data *chan, *adj_chan = NULL, *best; long double factor; - int i, j; + int i, j, secondary_channel = 1; + int freq_offset, bw320_offset = 0, ideal_bw320_offset = 0; unsigned int k; - int secondary_channel = 1, freq_offset; if (is_24ghz_mode(mode->mode)) secondary_channel = iface->conf->secondary_channel; @@ -849,7 +890,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } if (mode->mode == HOSTAPD_MODE_IEEE80211A && - (iface->conf->ieee80211ac || iface->conf->ieee80211ax)) { + (iface->conf->ieee80211ac || iface->conf->ieee80211ax || + iface->conf->ieee80211be)) { if (hostapd_get_oper_chwidth(iface->conf) == CONF_OPER_CHWIDTH_80MHZ && !acs_usable_bw_chan(chan, ACS_BW80)) { @@ -873,12 +915,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, iface->conf->ieee80211be) { if (hostapd_get_oper_chwidth(iface->conf) == CONF_OPER_CHWIDTH_320MHZ && - !acs_usable_bw_chan(chan, ACS_BW320)) { - wpa_printf(MSG_DEBUG, - "ACS: Channel %d: not allowed as primary channel for 320 MHz bandwidth", - chan->chan); + !acs_usable_bw320_chan(iface, chan, &bw320_offset)) continue; - } } factor = 0; @@ -1011,6 +1049,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, *ideal_factor = factor; *ideal_chan = chan; + ideal_bw320_offset = bw320_offset; #ifdef CONFIG_IEEE80211BE if (iface->conf->ieee80211be) @@ -1021,9 +1060,13 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, } /* This channel would at least be usable */ - if (!(*rand_chan)) + if (!(*rand_chan)) { *rand_chan = chan; + ideal_bw320_offset = bw320_offset; + } } + + hostapd_set_and_check_bw320_offset(iface->conf, ideal_bw320_offset); } @@ -1115,7 +1158,7 @@ static void acs_adjust_secondary(struct hostapd_iface *iface) acs_find_mode(iface, iface->freq) != HOSTAPD_MODE_IEEE80211A) return; - wpa_printf(MSG_DEBUG, "ACS: Adjusting HT/VHT/HE secondary frequency"); + wpa_printf(MSG_DEBUG, "ACS: Adjusting HT/VHT/HE/EHT secondary frequency"); for (i = 0; bw_desc[ACS_BW40][i].first != -1; i++) { if (iface->freq == bw_desc[ACS_BW40][i].first) @@ -1130,7 +1173,7 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface) { int center; - wpa_printf(MSG_DEBUG, "ACS: Adjusting VHT center frequency"); + wpa_printf(MSG_DEBUG, "ACS: Adjusting center frequency"); switch (hostapd_get_oper_chwidth(iface->conf)) { case CONF_OPER_CHWIDTH_USE_HT: @@ -1150,7 +1193,20 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface) center = acs_get_bw_center_chan(iface->freq, ACS_BW160); break; case CONF_OPER_CHWIDTH_320MHZ: - center = acs_get_bw_center_chan(iface->freq, ACS_BW320); + switch (hostapd_get_bw320_offset(iface->conf)) { + case 2: + center = acs_get_bw_center_chan(iface->freq, + ACS_BW320_2); + break; + case 1: + center = acs_get_bw_center_chan(iface->freq, + ACS_BW320_1); + break; + default: + wpa_printf(MSG_INFO, "ACS: BW320 offset is not selected"); + break; + } + break; default: /* TODO: How can this be calculated? Adjust