developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From 0946b9ece456bc11e4ef620063e7b0078d3d73aa Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Fri, 17 May 2024 17:21:06 +0800 |
| 4 | Subject: [PATCH 093/126] mtk: hostapd: get link channel information and |
| 5 | synchronize to AP |
| 6 | |
| 7 | 'wpa_s->valid_links' is used to determine the connection is MLO or not, |
| 8 | and different ways are used to retrieve operating channel information. |
| 9 | |
| 10 | Refactor center frequency calculation part in the function |
| 11 | uc_wpa_freq_info. |
| 12 | 1. It does not have to set seg0 for 2GHz. |
| 13 | 2. The original center frequency calculation is wrong for 2G. Also, center |
| 14 | frequency 1 of BW 20/40 MHz can be derived from control frequency & |
| 15 | secondary channel offset. |
| 16 | |
| 17 | Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 18 | --- |
| 19 | src/ap/ucode.c | 2 +- |
| 20 | src/utils/ucode.c | 8 +++++--- |
| 21 | wpa_supplicant/ucode.c | 14 ++++++++++---- |
| 22 | 3 files changed, 16 insertions(+), 8 deletions(-) |
| 23 | |
| 24 | diff --git a/src/ap/ucode.c b/src/ap/ucode.c |
| 25 | index a69caa6cf..8c05404f5 100644 |
| 26 | --- a/src/ap/ucode.c |
| 27 | +++ b/src/ap/ucode.c |
| 28 | @@ -657,7 +657,7 @@ out: |
| 29 | wpa_printf(MSG_INFO, " * seg0: %d\n", |
| 30 | hostapd_get_oper_centr_freq_seg0_idx(conf)); |
| 31 | wpa_printf(MSG_INFO, " * seg1: %d\n", |
| 32 | - hostapd_get_oper_centr_freq_seg0_idx(conf)); |
| 33 | + hostapd_get_oper_centr_freq_seg1_idx(conf)); |
| 34 | wpa_printf(MSG_INFO, " * oper_chwidth: %d\n", |
| 35 | hostapd_get_oper_chwidth(conf)); |
| 36 | |
| 37 | diff --git a/src/utils/ucode.c b/src/utils/ucode.c |
| 38 | index 81d472f6b..8bbbbbeff 100644 |
| 39 | --- a/src/utils/ucode.c |
| 40 | +++ b/src/utils/ucode.c |
| 41 | @@ -186,9 +186,11 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs) |
| 42 | ucv_object_add(ret, "oper_chwidth", ucv_int64_new(chanwidth)); |
| 43 | ucv_object_add(ret, "band_idx", ucv_int64_new(band_idx)); |
| 44 | |
| 45 | - if (chanwidth == CONF_OPER_CHWIDTH_USE_HT && !sec_channel) { |
| 46 | - ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(channel)); |
| 47 | - ucv_object_add(ret, "center_freq1", ucv_int64_new(freq_val)); |
| 48 | + if (chanwidth == CONF_OPER_CHWIDTH_USE_HT) { |
| 49 | + center_idx = freq_val < 3000 ? 0 : channel; |
| 50 | + ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(center_idx)); |
| 51 | + ucv_object_add(ret, "center_freq1", |
| 52 | + ucv_int64_new(freq_val + sec_channel * 10)); |
| 53 | return ret; |
| 54 | } |
| 55 | |
| 56 | diff --git a/wpa_supplicant/ucode.c b/wpa_supplicant/ucode.c |
| 57 | index d4b2160b6..450780737 100644 |
| 58 | --- a/wpa_supplicant/ucode.c |
| 59 | +++ b/wpa_supplicant/ucode.c |
| 60 | @@ -309,10 +309,16 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) |
| 61 | else if (is_6ghz_freq(bss->freq)) |
| 62 | band_idx = 2; |
| 63 | |
| 64 | - wpa_drv_channel_info(wpa_s, &ci); |
| 65 | - freq = ci.frequency; |
| 66 | - center_freq1 = ci.center_frq1; |
| 67 | - chwidth=ci.chanwidth; |
| 68 | + if (wpa_s->valid_links) { |
| 69 | + freq = wpa_s->links[link_id].freq; |
| 70 | + center_freq1 = wpa_s->links[link_id].center_freq1; |
| 71 | + chwidth = wpa_s->links[link_id].width; |
| 72 | + } else { |
| 73 | + wpa_drv_channel_info(wpa_s, &ci); |
| 74 | + freq = ci.frequency; |
| 75 | + center_freq1 = ci.center_frq1; |
| 76 | + chwidth=ci.chanwidth; |
| 77 | + } |
| 78 | |
| 79 | if (bss->freq != center_freq1) { |
| 80 | if (is_24ghz) |
| 81 | -- |
| 82 | 2.18.0 |
| 83 | |