[PATCH 17/18] MLD STA: Get MLO links channel width information for MLO_SIGNAL_POLL

Veerendranath Jakkam quic_vjakkam at quicinc.com
Thu Jul 28 06:45:46 PDT 2022


Add support to get all MLO links channel width information for
MLO_SIGNAL_POLL control interface command.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/drivers/driver_nl80211.c | 51 ++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d41c38869..0781553af 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8796,11 +8796,58 @@ static int nl80211_get_links_noise(struct wpa_driver_nl80211_data *drv,
 }
 
 
+static int get_links_channel_width(struct nl_msg *msg, void *arg)
+{
+	struct nlattr *tb[NL80211_ATTR_MAX + 1];
+	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+	struct wpa_mlo_signal_info *mlo_sig = arg;
+	struct nlattr *link;
+	int rem_links;
+
+	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+		  genlmsg_attrlen(gnlh, 0), NULL);
+
+	if (!tb[NL80211_ATTR_MLO_LINKS])
+		return NL_SKIP;
+
+	nla_for_each_nested(link, tb[NL80211_ATTR_MLO_LINKS], rem_links) {
+		struct nlattr *tb2[NL80211_ATTR_MAX + 1];
+		int link_id;
+
+		nla_parse(tb2, NL80211_ATTR_MAX, nla_data(link), nla_len(link),
+			  NULL);
+
+		if (!tb2[NL80211_ATTR_MLO_LINK_ID])
+			continue;
+
+		link_id = nla_get_u8(tb2[NL80211_ATTR_MLO_LINK_ID]);
+		if (link_id >= MAX_NUM_MLD_LINKS)
+			continue;
+
+		if (tb2[NL80211_ATTR_CHANNEL_WIDTH]) {
+			mlo_sig->links[link_id].chanwidth = convert2width(
+				nla_get_u32(tb2[NL80211_ATTR_CHANNEL_WIDTH]));
+			if (tb2[NL80211_ATTR_CENTER_FREQ1])
+				mlo_sig->links[link_id].center_frq1 =
+				nla_get_u32(tb2[NL80211_ATTR_CENTER_FREQ1]);
+			if (tb2[NL80211_ATTR_CENTER_FREQ2])
+				mlo_sig->links[link_id].center_frq2 =
+				nla_get_u32(tb2[NL80211_ATTR_CENTER_FREQ2]);
+		}
+	}
+
+	return NL_SKIP;
+}
+
+
 static int nl80211_get_links_channel_width(struct wpa_driver_nl80211_data *drv,
 					   struct wpa_mlo_signal_info *mlo_sig)
 {
-	//TODO: Kernel yet to support fetching link channel width information.
-	return 0;
+	struct nl_msg *msg;
+
+	msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE);
+	return send_and_recv_msgs(drv, msg, get_links_channel_width, mlo_sig,
+				  NULL, NULL);
 }
 
 
-- 
2.25.1




More information about the Hostap mailing list