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 */