developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 1 | From 25b1c0f5e4f674ea2b72949bce83c05204d19653 Mon Sep 17 00:00:00 2001 |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 3 | Date: Thu, 24 Aug 2023 16:44:30 +0800 |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 4 | Subject: [PATCH] hostapd: mtk: synchronize bandwidth in AP/STA support |
| 5 | |
| 6 | Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com> |
| 7 | --- |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 8 | src/utils/ucode.c | 1 + |
| 9 | wpa_supplicant/ucode.c | 10 ++++++++++ |
| 10 | 2 files changed, 11 insertions(+) |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 11 | |
| 12 | diff --git a/src/utils/ucode.c b/src/utils/ucode.c |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 13 | index 44169f0..41c19fb 100644 |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 14 | --- a/src/utils/ucode.c |
| 15 | +++ b/src/utils/ucode.c |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 16 | @@ -115,6 +115,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs) |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 17 | ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr))); |
| 18 | ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel)); |
| 19 | ucv_object_add(ret, "frequency", ucv_int64_new(freq_val)); |
| 20 | + ucv_object_add(ret, "oper_chwidth", ucv_int64_new(chanwidth)); |
| 21 | |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 22 | if (!sec_channel) |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 23 | return ret; |
| 24 | diff --git a/wpa_supplicant/ucode.c b/wpa_supplicant/ucode.c |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 25 | index d0a78d1..dbf57fa 100644 |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 26 | --- a/wpa_supplicant/ucode.c |
| 27 | +++ b/wpa_supplicant/ucode.c |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 28 | @@ -6,6 +6,7 @@ |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 29 | #include "wps_supplicant.h" |
| 30 | #include "bss.h" |
| 31 | #include "ucode.h" |
| 32 | +#include "driver_i.h" |
| 33 | |
| 34 | static struct wpa_global *wpa_global; |
| 35 | static uc_resource_type_t *global_type, *iface_type; |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 36 | @@ -194,6 +195,9 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 37 | struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface"); |
| 38 | struct wpa_bss *bss; |
| 39 | uc_value_t *ret, *val; |
| 40 | + struct wpa_channel_info ci; |
| 41 | + u8 op_class, channel; |
| 42 | + enum oper_chan_width ch_width; |
| 43 | |
| 44 | if (!wpa_s) |
| 45 | return NULL; |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 46 | @@ -222,6 +226,12 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) |
developer | b85e875 | 2023-09-25 14:16:05 +0800 | [diff] [blame] | 47 | |
| 48 | ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan)); |
| 49 | ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq)); |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 50 | + |
| 51 | + wpa_drv_channel_info(wpa_s, &ci); |
| 52 | + ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth, |
| 53 | + sec_chan, &op_class, &channel); |
| 54 | + ch_width = op_class_to_ch_width(op_class); |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 55 | + ucv_object_add(ret, "ch_width", ucv_int64_new(ch_width)); |
| 56 | } |
| 57 | |
developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 58 | return ret; |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 59 | -- |
| 60 | 2.25.1 |
| 61 | |