[][MAC80211][hostapd][Add HE capabilities check]

[Description]
Add HE capabilities check.
Since "HE capabilities" check has been removed by driver,
add the support for "HE capabilities" check in hostapd.

[Release-log]
N/A

Change-Id: Ie8eb69e206918d63af77ea8aa16893fdfd9ccdbd
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7605877
diff --git a/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
new file mode 100644
index 0000000..1c5cacc
--- /dev/null
+++ b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
@@ -0,0 +1,53 @@
+From 43c8934074a4f6fd1e98143b3bd011e71fe69fdb Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Fri Jun 9 09:03:05 2023 +0800
+Subject: hostapd: mtk: Add HE capabilities check
+
+Add HE capabilities check.
+Since "HE capabilities" check has been removed by driver,
+add the support for "HE capabilities" check in hostapd.
+
+---
+ src/ap/hw_features.c         | 26 ++++++++++++++++++++++++++
+ 1 files changed, 26 insertions(+)
+
+diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
+index 9967494..309f2d5 100644
+--- a/src/ap/hw_features.c
++++ b/src/ap/hw_features.c
+@@ -680,6 +680,32 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
+ #ifdef CONFIG_IEEE80211AX
+ static int ieee80211ax_supported_he_capab(struct hostapd_iface *iface)
+ {
++	struct hostapd_hw_modes *mode = iface->current_mode;
++	struct he_capabilities *he_cap = &mode->he_capab[IEEE80211_MODE_AP];
++	struct hostapd_config *conf = iface->conf;
++
++#define HE_CAP_CHECK(hw_cap, field, phy_idx, cfg_cap)					\
++	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)
++
++	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);
++
+ 	return 1;
+ }
+ #endif /* CONFIG_IEEE80211AX */
+-- 
+2.39.0
+