From 20c82a2708974fdcbe014bf64d704fd170168d05 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 28 Nov 2023 00:33:58 +0530 Subject: [PATCH] Add an option to remove WMM-AC For a memory constrained system, it may be more important to reduce binary size than include support for these capabilities. By default this is enabled. Signed-off-by: Chaitanya Tata --- wpa_supplicant/Android.mk | 7 ++++++- wpa_supplicant/Makefile | 7 ++++++- wpa_supplicant/android.config | 3 +++ wpa_supplicant/ctrl_iface.c | 6 ++++++ wpa_supplicant/defconfig | 3 +++ wpa_supplicant/events.c | 4 ++++ wpa_supplicant/wpa_cli.c | 6 ++++++ wpa_supplicant/wpa_supplicant.c | 12 ++++++++++++ 8 files changed, 46 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index 8fccfe7cf..809973a21 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -100,7 +100,6 @@ OBJS += src/utils/wpabuf.c OBJS += src/utils/bitfield.c OBJS += src/utils/ip_addr.c OBJS += src/utils/crc32.c -OBJS += wmm_ac.c OBJS += twt.c OBJS_p = wpa_passphrase.c OBJS_p += src/utils/common.c @@ -430,6 +429,12 @@ endif OBJS += op_classes.c endif +ifdef CONFIG_NO_WMM_AC +L_CFLAGS += -DCONFIG_NO_WMM_AC +else +OBJS += wmm_ac.c +endif + ifdef CONFIG_NO_ROBUST_AV L_CFLAGS += -DCONFIG_NO_ROBUST_AV else diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 819a0dd88..d7d2cceba 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -120,7 +120,6 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o OBJS_c += ../src/utils/wpa_debug.o OBJS_c += ../src/utils/common.o OBJS_c += ../src/common/cli.o -OBJS += wmm_ac.o ifndef CONFIG_OS ifdef CONFIG_NATIVE_WINDOWS @@ -480,6 +479,12 @@ endif OBJS += op_classes.o endif +ifdef CONFIG_NO_WMM_AC +CFLAGS += -DCONFIG_NO_WMM_AC +else +OBJS += wmm_ac.o +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 55ddb2a6d..9aff882e2 100644 --- a/wpa_supplicant/android.config +++ b/wpa_supplicant/android.config @@ -551,4 +551,7 @@ CONFIG_WEP=y # applications; IEEE Std 802.11-2020, 4.3.24; SCS, MSCS, QoS Management #CONFIG_NO_ROBUST_AV=y +# Disable support for WMM admission control +#CONFIG_NO_WMM_AC=y + include $(wildcard $(LOCAL_PATH)/android_config_*.inc) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 1167dd48d..32f964f9c 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -1264,6 +1264,8 @@ static int wpa_supplicant_ctrl_iface_tdls_link_status( #endif /* CONFIG_TDLS */ +#ifndef CONFIG_NO_WMM_AC + static int wmm_ac_ctrl_addts(struct wpa_supplicant *wpa_s, char *cmd) { char *token, *context = NULL; @@ -1313,6 +1315,8 @@ static int wmm_ac_ctrl_delts(struct wpa_supplicant *wpa_s, char *cmd) return wpas_wmm_ac_delts(wpa_s, tsid); } +#endif /* CONFIG_NO_WMM_AC */ + #ifdef CONFIG_IEEE80211R static int wpa_supplicant_ctrl_iface_ft_ds( @@ -12746,6 +12750,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = wpa_supplicant_ctrl_iface_tdls_link_status( wpa_s, buf + 17, reply, reply_size); #endif /* CONFIG_TDLS */ +#ifndef CONFIG_NO_WMM_AC } else if (os_strcmp(buf, "WMM_AC_STATUS") == 0) { reply_len = wpas_wmm_ac_status(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "WMM_AC_ADDTS ", 13) == 0) { @@ -12754,6 +12759,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "WMM_AC_DELTS ", 13) == 0) { if (wmm_ac_ctrl_delts(wpa_s, buf + 13)) reply_len = -1; +#endif /* CONFIG_NO_WMM_AC */ } else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) { reply_len = wpa_supplicant_signal_poll(wpa_s, reply, reply_size); diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig index 4f9d9b6a8..60d1bfc57 100644 --- a/wpa_supplicant/defconfig +++ b/wpa_supplicant/defconfig @@ -680,3 +680,6 @@ CONFIG_DPP2=y # Disable support for Robust AV streaming for consumer and enterprise Wi-Fi # applications; IEEE Std 802.11-2020, 4.3.24; SCS, MSCS, QoS Management #CONFIG_NO_ROBUST_AV=y + +# Disable support for WMM admission control +#CONFIG_NO_WMM_AC=y diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 96e706e4a..4644f5488 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -4347,6 +4347,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, wpas_wps_notify_assoc(wpa_s, bssid); +#ifndef CONFIG_NO_WMM_AC if (data) { wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len, @@ -4355,6 +4356,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, if (wpa_s->reassoc_same_bss) wmm_ac_restore_tspecs(wpa_s); } +#endif /* CONFIG_NO_WMM_AC */ #if defined(CONFIG_FILS) || defined(CONFIG_MBO) bss = wpa_bss_get_bssid(wpa_s, bssid); @@ -5227,10 +5229,12 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, " Category=%u DataLen=%d freq=%d MHz", MAC2STR(mgmt->sa), category, (int) plen, freq); +#ifndef CONFIG_NO_WMM_AC if (category == WLAN_ACTION_WMM) { wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen); return; } +#endif /* CONFIG_NO_WMM_AC */ #ifdef CONFIG_IEEE80211R if (category == WLAN_ACTION_FT) { diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 65078edf1..b1334e2e6 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -2847,6 +2847,8 @@ static int wpa_cli_cmd_tdls_link_status(struct wpa_ctrl *ctrl, int argc, } +#ifndef CONFIG_NO_WMM_AC + static int wpa_cli_cmd_wmm_ac_addts(struct wpa_ctrl *ctrl, int argc, char *argv[]) { @@ -2867,6 +2869,8 @@ static int wpa_cli_cmd_wmm_ac_status(struct wpa_ctrl *ctrl, int argc, return wpa_ctrl_command(ctrl, "WMM_AC_STATUS"); } +#endif /* CONFIG_NO_WMM_AC */ + static int wpa_cli_cmd_tdls_chan_switch(struct wpa_ctrl *ctrl, int argc, char *argv[]) @@ -3889,6 +3893,7 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = { { "tdls_link_status", wpa_cli_cmd_tdls_link_status, NULL, cli_cmd_flag_none, " = TDLS link status with " }, +#ifndef CONFIG_NO_WMM_AC { "wmm_ac_addts", wpa_cli_cmd_wmm_ac_addts, NULL, cli_cmd_flag_none, " [nominal_msdu_size=#] " @@ -3900,6 +3905,7 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = { { "wmm_ac_status", wpa_cli_cmd_wmm_ac_status, NULL, cli_cmd_flag_none, "= show status for Wireless Multi-Media Admission-Control" }, +#endif /* CONFIG_NO_WMM_AC */ { "tdls_chan_switch", wpa_cli_cmd_tdls_chan_switch, NULL, cli_cmd_flag_none, " [sec_channel_offset=] [center_freq1=] " diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 24f3e0bc0..ade4d003a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -582,7 +582,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) wpa_tdls_deinit(wpa_s->wpa); #endif /* CONFIG_TDLS */ +#ifndef CONFIG_NO_WMM_AC wmm_ac_clear_saved_tspecs(wpa_s); +#endif /* CONFIG_NO_WMM_AC */ pmksa_candidate_free(wpa_s->wpa); ptksa_cache_deinit(wpa_s->ptksa); wpa_s->ptksa = NULL; @@ -699,7 +701,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) wpa_s->vendor_elem[i] = NULL; } +#ifndef CONFIG_NO_WMM_AC wmm_ac_notify_disassoc(wpa_s); +#endif /* CONFIG_NO_WMM_AC */ wpa_s->sched_scan_plans_num = 0; os_free(wpa_s->sched_scan_plans); @@ -1067,8 +1071,10 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, if (state == WPA_DISCONNECTED || state == WPA_INACTIVE) wpa_supplicant_start_autoscan(wpa_s); +#ifndef CONFIG_NO_WMM_AC if (old_state >= WPA_ASSOCIATED && wpa_s->wpa_state < WPA_ASSOCIATED) wmm_ac_notify_disassoc(wpa_s); +#endif /* CONFIG_NO_WMM_AC */ if (wpa_s->wpa_state != old_state) { wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state); @@ -2486,7 +2492,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, wpa_s->eapol_failed = 0; wpa_s->multi_ap_ie = 0; +#ifndef CONFIG_NO_WMM_AC wmm_ac_clear_saved_tspecs(wpa_s); +#endif /* CONFIG_NO_WMM_AC */ wpa_s->reassoc_same_bss = 0; wpa_s->reassoc_same_ess = 0; #ifdef CONFIG_TESTING_OPTIONS @@ -2497,7 +2505,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Re-association to the same ESS"); wpa_s->reassoc_same_ess = 1; if (wpa_s->current_bss && wpa_s->current_bss == bss) { +#ifndef CONFIG_NO_WMM_AC wmm_ac_save_tspecs(wpa_s); +#endif /* CONFIG_NO_WMM_AC */ wpa_s->reassoc_same_bss = 1; } else if (wpa_s->current_bss && wpa_s->current_bss != bss) { os_get_reltime(&wpa_s->roam_start); @@ -7217,7 +7227,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->extended_capa_len = capa.extended_capa_len; wpa_s->num_multichan_concurrent = capa.num_multichan_concurrent; +#ifndef CONFIG_NO_WMM_AC wpa_s->wmm_ac_supported = capa.wmm_ac_supported; +#endif /* CONFIG_NO_WMM_AC */ wpa_s->max_num_akms = capa.max_num_akms; if (capa.mac_addr_rand_scan_supported)