From patchwork Mon Nov 8 03:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 1552114 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=FNYbWSBm; 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 4Hnbbf3YQVz9sR4 for ; Mon, 8 Nov 2021 14:06:06 +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=zQnS3Zfye3rrdWsY67X+kqgEkt7sw7eyXA+j3iDImIs=; b=FNYbWSBmAKVGTL G/vix+Ug5vQJ1C4MkodN488cA5n54x7wwD6nEXcYUir7i/Jo9DDP7toOFkmNye+/fWwsF3mopTfmD mKcm57p5fg0Pl4v6C3K16WtgravMpwrr979HtbIHjMcaIX8UpdKF0atOg1CMcT3yfog+8MModkZyk Duas/c2biGmKCPws+APX6cMLI4F/c0f8eMrTGmzFXBMpyTitjmG+q6SMsjvsq+7lxZpos+XFTO1QX IVcBjVF+9tUuk3c0x8MA5r8kJfg0XhP/F7lufL8cWiwitTf1FRxLmblj6tp2PZH9aQpvxxTtzy3I+ GEBz8oRaZzYLQvevdyiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjuxf-00FLEj-VJ; Mon, 08 Nov 2021 03:04:44 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjuxb-00FLDo-7a for hostap@lists.infradead.org; Mon, 08 Nov 2021 03:04:41 +0000 X-UUID: d5fc02cf516e4810a7ad38409f469145-20211107 X-UUID: d5fc02cf516e4810a7ad38409f469145-20211107 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1005168563; Sun, 07 Nov 2021 20:04:34 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 7 Nov 2021 19:04:33 -0800 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Nov 2021 11:04:31 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs10n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 8 Nov 2021 11:04:31 +0800 From: Ryder Lee To: Jouni Malinen CC: Felix Fietkau , Lorenzo Bianconi , Shayne Chen , "Evelyn Tsai" , , John Crispin , Lorenzo Bianconi , Ryder Lee Subject: [PATCH v2 2/5] bss_coloring: add the code required to generate the CCA IE Date: Mon, 8 Nov 2021 11:04:23 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 In-Reply-To: <2d69afce2fd6f44ae08ac75d5715fa9e43fe2a77.1636093546.git.ryder.lee@mediatek.com> References: <2d69afce2fd6f44ae08ac75d5715fa9e43fe2a77.1636093546.git.ryder.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211107_190439_311523_23A01681 X-CRM114-Status: GOOD ( 13.18 ) X-Spam-Score: 0.0 (/) 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: From: John Crispin This IE is similar to the CSA one. It contains a counter and the target color. Once the counter expired, the change to the new color happens. Just note the current implementation is based on CCA counter attributes that only takes beacon and prob_resp into account, as for the assoc_resp frames will be added in the future patches. Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 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 From: John Crispin This IE is similar to the CSA one. It contains a counter and the target color. Once the counter expired, the change to the new color happens. Just note the current implementation is based on CCA counter attributes that only takes beacon and prob_resp into account, as for the assoc_resp frames will be added in the future patches. Tested-by: Peter Chiu Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Signed-off-by: John Crispin Signed-off-by: Ryder Lee --- changes since v2 - - fix the position of CCA IE. --- src/ap/beacon.c | 18 ++++++++++++++++++ src/ap/ieee802_11.h | 1 + src/ap/ieee802_11_he.c | 14 ++++++++++++++ src/common/ieee802_11_defs.h | 1 + 4 files changed, 34 insertions(+) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 15fc2b3db..794229527 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -578,8 +578,17 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { + u8 *cca_pos; + pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP); pos = hostapd_eid_he_operation(hapd, pos); + + /* CCA IE */ + cca_pos = hostapd_eid_cca(hapd, pos); + if (cca_pos != pos) + hapd->cca_c_off_proberesp = cca_pos - (u8 *) resp - 2; + pos = cca_pos; + pos = hostapd_eid_spatial_reuse(hapd, pos); pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); @@ -1567,9 +1576,18 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { + u8 *cca_pos; + tailpos = hostapd_eid_he_capab(hapd, tailpos, IEEE80211_MODE_AP); tailpos = hostapd_eid_he_operation(hapd, tailpos); + + /* CCA IE */ + cca_pos = hostapd_eid_cca(hapd, tailpos); + if (cca_pos != tailpos) + hapd->cca_c_off_beacon = cca_pos - tail - 2; + tailpos = cca_pos; + tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos); tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index ea8c60846..65308ff34 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -100,6 +100,7 @@ u16 copy_sta_he_6ghz_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *he_6ghz_capab); int hostapd_get_he_twt_responder(struct hostapd_data *hapd, enum ieee80211_op_mode mode); +u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid); void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr, const u8 *buf, size_t len, int ack); void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst, diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index 6cd6c90dc..a3203c993 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -520,3 +520,17 @@ int hostapd_get_he_twt_responder(struct hostapd_data *hapd, return !!(mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER) && hapd->iface->conf->he_op.he_twt_responder; } + +u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid) +{ + if (!hapd->cca_in_progress) + return eid; + + *eid++ = WLAN_EID_EXTENSION; + *eid++ = 3; + *eid++ = WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT; + *eid++ = hapd->cca_count; + *eid++ = hapd->cca_color; + + return eid; +} diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index adb89d111..a1112c99b 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -479,6 +479,7 @@ #define WLAN_EID_EXT_HE_OPERATION 36 #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38 #define WLAN_EID_EXT_SPATIAL_REUSE 39 +#define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42 #define WLAN_EID_EXT_OCV_OCI 54 #define WLAN_EID_EXT_SHORT_SSID_LIST 58 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59