[PATCH v2] hostapd: Add he_ldpc configuration

MeiChia Chiu MeiChia.Chiu at mediatek.com
Tue Jun 20 00:35:49 PDT 2023


From: MeiChia Chiu <meichia.chiu at mediatek.com>

Add configuration option 'he_ldpc' to enable or disable he ldpc support.

Signed-off-by: Money Wang <Money.Wang at mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu at mediatek.com>
---
v2: Add the hardware capabilities check
---
 hostapd/config_file.c        |  2 ++
 hostapd/hostapd.conf         |  5 +++++
 src/ap/ap_config.c           |  1 +
 src/ap/ap_config.h           |  1 +
 src/ap/hw_features.c         | 32 ++++++++++++++++++++++++++++++++
 src/ap/ieee802_11_he.c       |  7 +++++++
 src/common/ieee802_11_defs.h |  3 +++
 7 files changed, 51 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 412ca8a9f..db77dd6dc 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3491,6 +3491,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		conf->he_phy_capab.he_su_beamformee = atoi(pos);
 	} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
 		conf->he_phy_capab.he_mu_beamformer = atoi(pos);
+	} else if (os_strcmp(buf, "he_ldpc") == 0) {
+		conf->he_phy_capab.he_ldpc = atoi(pos);
 	} else if (os_strcmp(buf, "he_bss_color") == 0) {
 		conf->he_op.he_bss_color = atoi(pos) & 0x3f;
 		conf->he_op.he_bss_color_disabled = 0;
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 30fb06d1c..fd42c5038 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -833,6 +833,11 @@ wmm_ac_vo_acm=0
 # 1 = supported
 #he_mu_beamformer=1
 
+#he_ldpc: HE LDPC support
+# 0 = not supported
+# 1 = supported (default)
+#he_ldpc=1
+
 # he_bss_color: BSS color (1-63)
 #he_bss_color=1
 
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 298216a47..6face2ede 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -268,6 +268,7 @@ struct hostapd_config * hostapd_config_defaults(void)
 #endif /* CONFIG_ACS */
 
 #ifdef CONFIG_IEEE80211AX
+	conf->he_phy_capab.he_ldpc = 1;
 	conf->he_op.he_rts_threshold = HE_OPERATION_RTS_THRESHOLD_MASK >>
 		HE_OPERATION_RTS_THRESHOLD_OFFSET;
 	/* Set default basic MCS/NSS set to single stream MCS 0-7 */
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 777aa5af0..5408cf84e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -951,6 +951,7 @@ struct hostapd_bss_config {
  * struct he_phy_capabilities_info - HE PHY capabilities
  */
 struct he_phy_capabilities_info {
+	bool he_ldpc;
 	bool he_su_beamformer;
 	bool he_su_beamformee;
 	bool he_mu_beamformer;
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 26f8974ba..a0b204a7c 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -679,6 +679,38 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
 #ifdef CONFIG_IEEE80211AX
 static int ieee80211ax_supported_he_capab(struct hostapd_iface *iface)
 {
+	struct he_capabilities *he_cap;
+	struct hostapd_config *conf = iface->conf;
+
+#define HE_CAP_CHECK(hw_cap, field, phy_idx, cap_cfg)		\
+	do {							\
+		if (cfg_cap && !(hw_cap[phy_idx] & field)) {	\
+			wpa_printf(MSG_ERROR,			\
+				   "Driver does not support configured HE capability [%s]",\
+				   field);			\
+			return 0;				\
+		}						\
+	} while (0)						\
+
+	if (!iface->current_mode)
+		return 0;
+
+	he_cap = &iface->current_mode->he_capab[IEEE80211_MODE_AP];
+
+	HE_CAP_CHECK(he_cap->phy_cap, HE_PHYCAP_LDPC_CODING_IN_PAYLOAD,
+		     HE_PHYCAP_LDPC_CODING_IN_PAYLOAD_IDX,
+		     conf->he_phy_capab.he_ldpc);
+	HE_CAP_CHECK(he_cap->phy_cap, HE_PHYCAP_SU_BEAMFORMER_CAPAB,
+		     HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX,
+		     conf->he_phy_capab.he_su_beamformer);
+	HE_CAP_CHECK(he_cap->phy_cap, HE_PHYCAP_SU_BEAMFORMEE_CAPAB,
+		     HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX,
+		     conf->he_phy_capab.he_su_beamformee);
+	HE_CAP_CHECK(he_cap->phy_cap, HE_PHYCAP_MU_BEAMFORMER_CAPAB,
+		     HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX,
+		     conf->he_phy_capab.he_mu_beamformer);
+#undef HE_CAP_CHECK
+
 	return 1;
 }
 #endif /* CONFIG_IEEE80211AX */
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
index 548a44821..9407dd6e5 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -138,6 +138,13 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
 		os_memcpy(&cap->optional[mcs_nss_size],
 			  mode->he_capab[opmode].ppet,  ppet_size);
 
+	if (hapd->iface->conf->he_phy_capab.he_ldpc)
+		cap->he_phy_capab_info[HE_PHYCAP_LDPC_CODING_IN_PAYLOAD_IDX] |=
+			HE_PHYCAP_LDPC_CODING_IN_PAYLOAD;
+	else
+		cap->he_phy_capab_info[HE_PHYCAP_LDPC_CODING_IN_PAYLOAD_IDX] &=
+			~HE_PHYCAP_LDPC_CODING_IN_PAYLOAD;
+
 	if (hapd->iface->conf->he_phy_capab.he_su_beamformer)
 		cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |=
 			HE_PHYCAP_SU_BEAMFORMER_CAPAB;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 571ace2f5..74301178f 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2355,6 +2355,9 @@ struct ieee80211_spatial_reuse {
 #define HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G	((u8) BIT(3))
 #define HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G	((u8) BIT(4))
 
+#define HE_PHYCAP_LDPC_CODING_IN_PAYLOAD_IDX	1
+#define HE_PHYCAP_LDPC_CODING_IN_PAYLOAD	((u8) BIT(5))
+
 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX	3
 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB		((u8) BIT(7))
 #define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX	4
-- 
2.39.0




More information about the Hostap mailing list