blob: e48042839ceedba1f6bc9238900e5315802b3204 [file] [log] [blame]
From f046d62580187077b4d75c3e5f183a8ad8ad9079 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 6 Aug 2024 10:11:22 +0800
Subject: [PATCH 123/126] mtk: hostapd: add puncture bitmap to ucode
Add puncture bitmap to ucode since fw might trigger channel switch due
to pp bitmap change.
Therefore, the changed pp bitmap should be synchronized to extender's AP
when root AP changes its pp bitmap.
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
src/ap/ucode.c | 4 ++++
src/utils/ucode.c | 2 ++
wpa_supplicant/ucode.c | 1 +
3 files changed, 7 insertions(+)
diff --git a/src/ap/ucode.c b/src/ap/ucode.c
index 8c05404f5..0c6f4043c 100644
--- a/src/ap/ucode.c
+++ b/src/ap/ucode.c
@@ -726,6 +726,8 @@ uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
csa.freq_params.center_freq1 = intval;
if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno)
csa.freq_params.center_freq2 = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "punct_bitmap", NULL))) && !errno)
+ csa.freq_params.punct_bitmap = intval;
intval = ucv_int64_get(ucv_object_get(info, "band_idx", NULL));
band_idx = errno ? iface->conf->band_idx : intval;
@@ -740,6 +742,8 @@ uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
csa.freq_params.center_freq1);
wpa_printf(MSG_INFO, " * center_freq2 is %d\n",
csa.freq_params.center_freq2);
+ wpa_printf(MSG_INFO, " * punct_bitmap is %d\n",
+ csa.freq_params.punct_bitmap);
wpa_printf(MSG_INFO, " * band_idx is %d\n",
band_idx);
diff --git a/src/utils/ucode.c b/src/utils/ucode.c
index 8bbbbbeff..c688d9bee 100644
--- a/src/utils/ucode.c
+++ b/src/utils/ucode.c
@@ -110,6 +110,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
uc_value_t *freq = uc_fn_arg(0);
uc_value_t *sec = uc_fn_arg(1);
int width = ucv_uint64_get(uc_fn_arg(2));
+ int punct_bitmap = ucv_uint64_get(uc_fn_arg(5));
int bw320_offset = 1, band_idx;
int freq_val, center_idx, center_ofs;
enum oper_chan_width chanwidth;
@@ -185,6 +186,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
ucv_object_add(ret, "oper_chwidth", ucv_int64_new(chanwidth));
ucv_object_add(ret, "band_idx", ucv_int64_new(band_idx));
+ ucv_object_add(ret, "punct_bitmap", ucv_int64_new(punct_bitmap));
if (chanwidth == CONF_OPER_CHWIDTH_USE_HT) {
center_idx = freq_val < 3000 ? 0 : channel;
diff --git a/wpa_supplicant/ucode.c b/wpa_supplicant/ucode.c
index 450780737..124038def 100644
--- a/wpa_supplicant/ucode.c
+++ b/wpa_supplicant/ucode.c
@@ -178,6 +178,7 @@ void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_d
ucv_object_add(val, "center_freq2", ucv_int64_new(data->ch_switch.cf2));
ucv_object_add(val, "ch_width", ucv_int64_new(oper_chwidth));
ucv_object_add(val, "bw320_offset", ucv_int64_new(bw320_offset));
+ ucv_object_add(val, "punct_bitmap", ucv_int64_new(data->ch_switch.punct_bitmap));
ucv_object_add(val, "band_idx", ucv_int64_new(band_idx));
}
--
2.18.0