[PATCH] Add an option to remove 6 GHz band support
Jordan Yates
jordan.yates.au at gmail.com
Sat Oct 31 18:35:46 PDT 2026
Devices whose radio does not support the 6 GHz band still build in the
6 GHz specific scan, channel and BSS selection logic since it is only
gated at runtime by is_6ghz_freq() and related helpers. Add
CONFIG_NO_6GHZ to replace these helpers with constant stubs so that the
compiler can remove the 6 GHz specific paths. This saves about 4 kB of
flash on a Cortex-M33 build with the nRF7002.
By default 6GHz support remains enabled.
Signed-off-by: Jordan Yates <jordan.yates.au at gmail.com>
---
src/common/ieee802_11_common.c | 2 ++
src/common/ieee802_11_common.h | 17 +++++++++++++++++
wpa_supplicant/Android.mk | 4 ++++
wpa_supplicant/Makefile | 4 ++++
wpa_supplicant/android.config | 3 +++
wpa_supplicant/defconfig | 3 +++
wpa_supplicant/events.c | 4 ++++
wpa_supplicant/wpa_supplicant.c | 2 ++
wpa_supplicant/wpa_supplicant_i.h | 8 ++++++++
9 files changed, 47 insertions(+)
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 0a1e9a67b..29e62d056 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -3128,6 +3128,7 @@ int center_idx_to_bw_6ghz(u8 idx)
}
+#ifndef CONFIG_NO_6GHZ
bool is_6ghz_freq(int freq)
{
if (freq < 5935 || freq > 7115)
@@ -3167,6 +3168,7 @@ bool is_6ghz_psc_frequency(int freq)
return false;
}
+#endif /* CONFIG_NO_6GHZ */
/**
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 8dc38e215..2f4b7f7b4 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -365,9 +365,26 @@ int oper_class_bw_to_int(const struct oper_class_map *map);
bool is_24ghz_freq(int freq);
bool is_5ghz_freq(int freq);
int center_idx_to_bw_6ghz(u8 idx);
+#ifdef CONFIG_NO_6GHZ
+static inline bool is_6ghz_freq(int freq)
+{
+ return false;
+}
+
+static inline bool is_6ghz_op_class(u8 op_class)
+{
+ return false;
+}
+
+static inline bool is_6ghz_psc_frequency(int freq)
+{
+ return false;
+}
+#else /* CONFIG_NO_6GHZ */
bool is_6ghz_freq(int freq);
bool is_6ghz_op_class(u8 op_class);
bool is_6ghz_psc_frequency(int freq);
+#endif /* CONFIG_NO_6GHZ */
int get_6ghz_sec_channel(int channel);
bool is_same_band(int freq1, int freq2);
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 8efd0c979..523688059 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -499,6 +499,10 @@ else
OBJS += wmm_ac.c
endif
+ifdef CONFIG_NO_6GHZ
+L_CFLAGS += -DCONFIG_NO_6GHZ
+endif
+
ifdef CONFIG_NO_ROBUST_AV
L_CFLAGS += -DCONFIG_NO_ROBUST_AV
else
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index a2c689295..bad615e3a 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -561,6 +561,10 @@ else
OBJS += wmm_ac.o
endif
+ifdef CONFIG_NO_6GHZ
+CFLAGS += -DCONFIG_NO_6GHZ
+endif
+
ifdef CONFIG_NO_ROBUST_AV
CFLAGS += -DCONFIG_NO_ROBUST_AV
else
diff --git a/wpa_supplicant/android.config b/wpa_supplicant/android.config
index 5ae3808fb..00376e238 100644
--- a/wpa_supplicant/android.config
+++ b/wpa_supplicant/android.config
@@ -554,6 +554,9 @@ CONFIG_WEP=y
# Disable support for WMM admission control
#CONFIG_NO_WMM_AC=y
+# Disable support for the 6 GHz band
+#CONFIG_NO_6GHZ=y
+
# Wi-Fi Aware unsynchronized service discovery (NAN USD)
#CONFIG_NAN_USD=y
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 3ecd1e5f7..2b1fcb952 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -675,6 +675,9 @@ CONFIG_DPP2=y
# Disable support for WMM admission control
#CONFIG_NO_WMM_AC=y
+# Disable support for the 6 GHz band
+#CONFIG_NO_6GHZ=y
+
# Wi-Fi Aware unsynchronized service discovery (NAN USD)
#CONFIG_NAN_USD=y
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 7083d811e..f9940082a 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2710,8 +2710,12 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
ap = 1;
#endif /* CONFIG_AP */
+#ifdef CONFIG_NO_6GHZ
+ trigger_6ghz_scan = false;
+#else /* CONFIG_NO_6GHZ */
trigger_6ghz_scan = wpa_s->crossed_6ghz_dom &&
wpa_s->last_scan_all_chan;
+#endif /* CONFIG_NO_6GHZ */
wpa_s->crossed_6ghz_dom = false;
wpa_s->last_scan_all_chan = false;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e167cf9dd..0bf7889b8 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -11267,6 +11267,7 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
}
+#ifndef CONFIG_NO_6GHZ
bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled)
{
struct hostapd_channel_data *chnl;
@@ -11287,6 +11288,7 @@ bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled)
return false;
}
+#endif /* CONFIG_NO_6GHZ */
bool wpas_ap_supports_rsn_overriding(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 7b7b79d59..d7f740116 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -2259,7 +2259,15 @@ void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s,
void wpas_pasn_auth_work_done(struct wpa_supplicant *wpa_s, int status);
struct sae_pt * wpas_pasn_sae_derive_pt_for_eppke(struct wpa_ssid *ssid,
int group);
+#ifdef CONFIG_NO_6GHZ
+static inline bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s,
+ bool only_enabled)
+{
+ return false;
+}
+#else /* CONFIG_NO_6GHZ */
bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled);
+#endif /* CONFIG_NO_6GHZ */
bool wpa_is_non_eht_scs_traffic_desc_supported(struct wpa_bss *bss);
bool wpas_ap_link_address(struct wpa_supplicant *wpa_s, const u8 *addr);
--
2.53.0
More information about the Hostap
mailing list