From patchwork Mon Aug 19 02:54:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-CY Lee X-Patchwork-Id: 1976140 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=4ZvxkIyk; 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=ozQeN4nf; 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 4Wr3R35zNPz1yNr for ; Sat, 24 Aug 2024 01:10:23 +1000 (AEST) 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: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:In-Reply-To:References: List-Owner; bh=BTLKDSqYA81nmeZZEVokat7QN1zID/jbmzj57kMkyBA=; b=4ZvxkIyk4xp3TI noDrdeh8GITt+9ZTzCqTtP+4KmG+d4zVPb9JpuAOkZcnv22rRIa7FdmByDv4wcyTxY4DdhscHxQvd iGFTETu/AI+fQMktlldujbia8gQGoTv5EfI+/J8GayiqTlKp7Iye6sAswkMKdmeZSSBlIDC1+wlRM fOu86wC8KuImne/t+YBkR1youhKAG2UVcFDqRCSVegrcoou553H/9V61xRLxIM++Cd27MlLbZWdBp k70+WnggoJErTuXcTeKeWUJKXPGI15H+SByOkXOHAvPNixaB/UGNEFPfZkP9EhpBZRF7mbJdtJkEH GLoGv9vk+v3nG9feruuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVvF-0000000HEg4-3foA; Fri, 23 Aug 2024 15:09:53 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfsXQ-00000000AOZ-2AS0 for hostap@lists.infradead.org; Mon, 19 Aug 2024 02:54:33 +0000 X-UUID: 57272dd45dd611efba0aef63c0775dbf-20240818 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=TmmSVDklY+8MyGYYYPP2iJJxGTiDFxERc4QeQ8m967k=; b=ozQeN4nfL5U/SMc3GaasjSYTgXKtTfmvKYdC3RnB3/Mu9briGv4+u7o6t4xdNAxD0PsxdGlmHR1k2sr6Q7GNtV3OEkPP1c7xYI+ilnh2S4ttg3KQ+KNeW1FCI8tZHdZxUrchN7rCyDiBwL//S2FupdpXQKcbLypy9JmOcQehk9A=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:0f238005-e389-4afe-8f80-ca47cd292d28,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:6dc6a47,CLOUDID:b99c8ebe-d7af-4351-93aa-42531abf0c7b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT: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,ARC: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: 57272dd45dd611efba0aef63c0775dbf-20240818 Received: from mtkmbs09n1.mediatek.inc [(172.21.101.35)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2043310059; Sun, 18 Aug 2024 19:54:23 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 19 Aug 2024 10:54:19 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 19 Aug 2024 10:54:19 +0800 From: Michael-CY Lee To: Jouni Malinen CC: Felix Fietkau , , Evelyn Tsai , Money Wang , "Michael-CY Lee" Subject: [PATCH] hostapd: do not indicate a punctured secondary channel in HT operation Date: Mon, 19 Aug 2024 10:54:10 +0800 Message-ID: <20240819025410.20885-1-michael-cy.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 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.694800-8.000000 X-TMASE-MatchedRID: Zok17GuDVgvBkUnwhyKixiU3k0n8S5Kp+Vb3woyMZbvfUZT83lbkEN6M yUV+2+DZk7kyF4Md6sx1fL79uO0JYuF/B1jEjV+6syw+ZJnFumQEa8g1x8eqFxL6MU7t349bn1J EEv0fxQ9X0o9vLjHnr3ATsg8MODVIHxPMjOKY7A8LbigRnpKlKTpcQTtiHDgWF2dz232NnaIzyY pdvk3hBs4niraP0zvmy5KWoMqpnR/3Zm7bG2BLIIeSML7xhE03v0ha6W0UGEG6kA+ly1ljsafE4 QY8i/zTwZBgUyJVEbl6Fw8/PpTMRaVvmiAyeA2kc5MSfkiJFI5QBJtcKcOYfpRMZUCEHkRt X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.694800-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: DE0F9D5F8D49422C01E778BF617F2439275E8058564F9F5510F0677FA09811C92000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240818_195432_588779_B04C9DFB X-CRM114-Status: GOOD ( 11.78 ) X-Spam-Score: -2.1 (--) 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: If the secondary channel is punctured, the HT operation in the beacon should not indicate a secondary channel offset. Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/ieee802_11_ht.c | 51 +++++++++++++++++++++++++++++++++++++----- 1 file chan [...] Content analysis details: (-2.1 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_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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [216.200.240.185 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [216.200.240.185 listed in sa-accredit.habeas.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [216.200.240.185 listed in bl.score.senderscore.com] X-Mailman-Approved-At: Fri, 23 Aug 2024 08:09:52 -0700 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 If the secondary channel is punctured, the HT operation in the beacon should not indicate a secondary channel offset. Co-developed-by: Money Wang Signed-off-by: Michael-CY Lee --- src/ap/ieee802_11_ht.c | 51 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c index f90f1254e..7508587f6 100644 --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c @@ -79,6 +79,50 @@ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid) } +static void set_ht_param(struct hostapd_data *hapd, + struct ieee80211_ht_operation *oper) +{ + int secondary_channel = hapd->iconf->secondary_channel; +#ifdef CONFIG_IEEE80211BE + enum oper_chan_width chwidth = hostapd_get_oper_chwidth(hapd->iconf); + u16 bw = 0, punct_bitmap = hostapd_get_punct_bitmap(hapd); + u8 offset, chan_bit_pos; + + switch (chwidth) { + case CONF_OPER_CHWIDTH_80MHZ: + bw = 80; + offset = 6; + break; + case CONF_OPER_CHWIDTH_160MHZ: + bw = 160; + offset = 14; + break; + case CONF_OPER_CHWIDTH_320MHZ: + bw = 320; + offset = 30; + break; + default: + break; + } + + chan_bit_pos = (hapd->iconf->channel - + hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf) + + offset) / 4; + /* check if secondary channel is punctured */ + if (bw >= 80 && punct_bitmap && secondary_channel && + (punct_bitmap & BIT(chan_bit_pos + secondary_channel))) + return; +#endif /* CONFIG_IEEE80211BE */ + + if (secondary_channel == 1) + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; + if (secondary_channel == -1) + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; +} + + u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_ht_operation *oper; @@ -96,12 +140,7 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) oper->primary_chan = hapd->iconf->channel; oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); - if (hapd->iconf->secondary_channel == 1) - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; - if (hapd->iconf->secondary_channel == -1) - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; + set_ht_param(hapd, oper); pos += sizeof(*oper);