blob: a73671fe21792f5ff9edecd1d1f083eecae7f1c6 [file] [log] [blame]
From e3acb288c0e30eef9b734b62045f505c1392aab3 Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Fri, 17 May 2024 16:36:19 +0800
Subject: [PATCH 090/126] mtk: hostapd: extend MLO information getting
Extend MLO information getting, including center frequency & bandwidth,
from the driver. These informations are helpful for Extender STA to
synchronize channel informations to Extender AP.
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
src/drivers/driver.h | 3 ++-
src/drivers/driver_nl80211.c | 24 ++++++++++++++++++++++--
wpa_supplicant/events.c | 3 +++
wpa_supplicant/wpa_supplicant_i.h | 3 ++-
4 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index e7e62c5ad..eed99dac8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3058,8 +3058,9 @@ struct driver_sta_mlo_info {
struct {
u8 addr[ETH_ALEN];
u8 bssid[ETH_ALEN];
- unsigned int freq;
+ unsigned int freq, center_freq1, center_freq2;
struct t2lm_mapping t2lmap;
+ enum chan_width width;
} links[MAX_NUM_MLD_LINKS];
};
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9451714a7..b3ae50d15 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1171,6 +1171,27 @@ static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
}
+static void get_link_channel_info(struct nlattr **link_data, u8 link_id,
+ struct driver_sta_mlo_info *info)
+{
+ info->links[link_id].freq =
+ nla_get_u32(link_data[NL80211_ATTR_WIPHY_FREQ]);
+
+ if (link_data[NL80211_ATTR_CHANNEL_WIDTH]) {
+ info->links[link_id].width =
+ convert2width(nla_get_u32(link_data[NL80211_ATTR_CHANNEL_WIDTH]));
+
+ if (link_data[NL80211_ATTR_CENTER_FREQ1])
+ info->links[link_id].center_freq1 =
+ nla_get_u32(link_data[NL80211_ATTR_CENTER_FREQ1]);
+
+ if (link_data[NL80211_ATTR_CENTER_FREQ2])
+ info->links[link_id].center_freq2 =
+ nla_get_u32(link_data[NL80211_ATTR_CENTER_FREQ2]);
+ }
+}
+
+
static int get_mlo_info(struct nl_msg *msg, void *arg)
{
struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -1208,8 +1229,7 @@ static int get_mlo_info(struct nl_msg *msg, void *arg)
os_memcpy(info->links[link_id].addr,
nla_data(link_data[NL80211_ATTR_MAC]), ETH_ALEN);
if (link_data[NL80211_ATTR_WIPHY_FREQ])
- info->links[link_id].freq =
- nla_get_u32(link_data[NL80211_ATTR_WIPHY_FREQ]);
+ get_link_channel_info(link_data, link_id, info);
}
return NL_SKIP;
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 7b91ce988..cd838c6cf 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -4122,6 +4122,9 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s)
os_memcpy(wpa_s->links[i].addr, mlo.links[i].addr, ETH_ALEN);
os_memcpy(wpa_s->links[i].bssid, mlo.links[i].bssid, ETH_ALEN);
wpa_s->links[i].freq = mlo.links[i].freq;
+ wpa_s->links[i].center_freq1 = mlo.links[i].center_freq1;
+ wpa_s->links[i].center_freq2 = mlo.links[i].center_freq2;
+ wpa_s->links[i].width = mlo.links[i].width;
wpa_supplicant_update_link_bss(wpa_s, i, mlo.links[i].bssid);
}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 952a3bd5a..d2835cc68 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -740,7 +740,8 @@ struct wpa_supplicant {
struct {
u8 addr[ETH_ALEN];
u8 bssid[ETH_ALEN];
- unsigned int freq;
+ unsigned int freq, center_freq1, center_freq2;
+ enum chan_width width;
struct wpa_bss *bss;
bool disabled;
} links[MAX_NUM_MLD_LINKS];
--
2.18.0