developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From e3acb288c0e30eef9b734b62045f505c1392aab3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Fri, 17 May 2024 16:36:19 +0800 |
| 4 | Subject: [PATCH 090/126] mtk: hostapd: extend MLO information getting |
| 5 | |
| 6 | Extend MLO information getting, including center frequency & bandwidth, |
| 7 | from the driver. These informations are helpful for Extender STA to |
| 8 | synchronize channel informations to Extender AP. |
| 9 | |
| 10 | Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 11 | --- |
| 12 | src/drivers/driver.h | 3 ++- |
| 13 | src/drivers/driver_nl80211.c | 24 ++++++++++++++++++++++-- |
| 14 | wpa_supplicant/events.c | 3 +++ |
| 15 | wpa_supplicant/wpa_supplicant_i.h | 3 ++- |
| 16 | 4 files changed, 29 insertions(+), 4 deletions(-) |
| 17 | |
| 18 | diff --git a/src/drivers/driver.h b/src/drivers/driver.h |
| 19 | index e7e62c5ad..eed99dac8 100644 |
| 20 | --- a/src/drivers/driver.h |
| 21 | +++ b/src/drivers/driver.h |
| 22 | @@ -3058,8 +3058,9 @@ struct driver_sta_mlo_info { |
| 23 | struct { |
| 24 | u8 addr[ETH_ALEN]; |
| 25 | u8 bssid[ETH_ALEN]; |
| 26 | - unsigned int freq; |
| 27 | + unsigned int freq, center_freq1, center_freq2; |
| 28 | struct t2lm_mapping t2lmap; |
| 29 | + enum chan_width width; |
| 30 | } links[MAX_NUM_MLD_LINKS]; |
| 31 | }; |
| 32 | |
| 33 | diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c |
| 34 | index 9451714a7..b3ae50d15 100644 |
| 35 | --- a/src/drivers/driver_nl80211.c |
| 36 | +++ b/src/drivers/driver_nl80211.c |
| 37 | @@ -1171,6 +1171,27 @@ static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid) |
| 38 | } |
| 39 | |
| 40 | |
| 41 | +static void get_link_channel_info(struct nlattr **link_data, u8 link_id, |
| 42 | + struct driver_sta_mlo_info *info) |
| 43 | +{ |
| 44 | + info->links[link_id].freq = |
| 45 | + nla_get_u32(link_data[NL80211_ATTR_WIPHY_FREQ]); |
| 46 | + |
| 47 | + if (link_data[NL80211_ATTR_CHANNEL_WIDTH]) { |
| 48 | + info->links[link_id].width = |
| 49 | + convert2width(nla_get_u32(link_data[NL80211_ATTR_CHANNEL_WIDTH])); |
| 50 | + |
| 51 | + if (link_data[NL80211_ATTR_CENTER_FREQ1]) |
| 52 | + info->links[link_id].center_freq1 = |
| 53 | + nla_get_u32(link_data[NL80211_ATTR_CENTER_FREQ1]); |
| 54 | + |
| 55 | + if (link_data[NL80211_ATTR_CENTER_FREQ2]) |
| 56 | + info->links[link_id].center_freq2 = |
| 57 | + nla_get_u32(link_data[NL80211_ATTR_CENTER_FREQ2]); |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | + |
| 62 | static int get_mlo_info(struct nl_msg *msg, void *arg) |
| 63 | { |
| 64 | struct nlattr *tb[NL80211_ATTR_MAX + 1]; |
| 65 | @@ -1208,8 +1229,7 @@ static int get_mlo_info(struct nl_msg *msg, void *arg) |
| 66 | os_memcpy(info->links[link_id].addr, |
| 67 | nla_data(link_data[NL80211_ATTR_MAC]), ETH_ALEN); |
| 68 | if (link_data[NL80211_ATTR_WIPHY_FREQ]) |
| 69 | - info->links[link_id].freq = |
| 70 | - nla_get_u32(link_data[NL80211_ATTR_WIPHY_FREQ]); |
| 71 | + get_link_channel_info(link_data, link_id, info); |
| 72 | } |
| 73 | |
| 74 | return NL_SKIP; |
| 75 | diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c |
| 76 | index 7b91ce988..cd838c6cf 100644 |
| 77 | --- a/wpa_supplicant/events.c |
| 78 | +++ b/wpa_supplicant/events.c |
| 79 | @@ -4122,6 +4122,9 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s) |
| 80 | os_memcpy(wpa_s->links[i].addr, mlo.links[i].addr, ETH_ALEN); |
| 81 | os_memcpy(wpa_s->links[i].bssid, mlo.links[i].bssid, ETH_ALEN); |
| 82 | wpa_s->links[i].freq = mlo.links[i].freq; |
| 83 | + wpa_s->links[i].center_freq1 = mlo.links[i].center_freq1; |
| 84 | + wpa_s->links[i].center_freq2 = mlo.links[i].center_freq2; |
| 85 | + wpa_s->links[i].width = mlo.links[i].width; |
| 86 | wpa_supplicant_update_link_bss(wpa_s, i, mlo.links[i].bssid); |
| 87 | } |
| 88 | |
| 89 | diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h |
| 90 | index 952a3bd5a..d2835cc68 100644 |
| 91 | --- a/wpa_supplicant/wpa_supplicant_i.h |
| 92 | +++ b/wpa_supplicant/wpa_supplicant_i.h |
| 93 | @@ -740,7 +740,8 @@ struct wpa_supplicant { |
| 94 | struct { |
| 95 | u8 addr[ETH_ALEN]; |
| 96 | u8 bssid[ETH_ALEN]; |
| 97 | - unsigned int freq; |
| 98 | + unsigned int freq, center_freq1, center_freq2; |
| 99 | + enum chan_width width; |
| 100 | struct wpa_bss *bss; |
| 101 | bool disabled; |
| 102 | } links[MAX_NUM_MLD_LINKS]; |
| 103 | -- |
| 104 | 2.18.0 |
| 105 | |