diff mbox series

[4/6] hostapd: MLO: send link id during color change

Message ID 20240422124005.3075001-5-quic_adisi@quicinc.com
State Accepted
Headers show
Series Add HE BSS color change support via cli | expand

Commit Message

Aditya Kumar Singh April 22, 2024, 12:40 p.m. UTC
Add changes to send link id in the NL command if operating in MLO during
color change.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 src/ap/hostapd.c             |  6 ++++++
 src/drivers/driver.h         |  5 +++++
 src/drivers/driver_nl80211.c | 14 ++++++++++++++
 3 files changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index fc965cc14d7f..c211f64e6c27 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -4545,6 +4545,12 @@  int hostapd_fill_cca_settings(struct hostapd_data *hapd,
 	if (!iface || iface->conf->he_op.he_bss_color_disabled)
 		return -1;
 
+#ifdef CONFIG_IEEE80211BE
+	settings->link_id = -1;
+	if (hapd->conf->mld_ap)
+		settings->link_id = hapd->mld_link_id;
+#endif /* CONFIG_IEEE80211BE */
+
 	old_color = iface->conf->he_op.he_bss_color;
 	iface->conf->he_op.he_bss_color = hapd->cca_color;
 	ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 52632154ee4b..4cf4eeee2975 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2752,6 +2752,7 @@  struct csa_settings {
  * @beacon_after: Next Beacon/Probe Response/(Re)Association Response frame info
  * @counter_offset_beacon: Offset to the count field in Beacon frame tail
  * @counter_offset_presp: Offset to the count field in Probe Response frame
+ * @link_id: If >=0 indicates the link of the MLD to configure
  */
 struct cca_settings {
 	u8 cca_count;
@@ -2762,6 +2763,10 @@  struct cca_settings {
 
 	u16 counter_offset_beacon;
 	u16 counter_offset_presp;
+
+#ifdef CONFIG_IEEE80211BE
+	int link_id;
+#endif /* CONFIG_IEEE80211BE */
 };
 
 /* TDLS peer capabilities for send_tdls_mgmt() */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index c6af0f02f619..255becc1e73e 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11389,6 +11389,20 @@  static int nl80211_switch_color(void *priv, struct cca_settings *settings)
 	}
 
 	nla_nest_end(msg, beacon_cca);
+
+#ifdef CONFIG_IEEE80211BE
+	if (nl80211_link_valid(bss->valid_links, settings->link_id)) {
+		wpa_printf(MSG_DEBUG, "nl80211: Color change request on link_id=%d",
+			   settings->link_id);
+
+		if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
+			       settings->link_id)) {
+			nlmsg_free(msg);
+			return -1;
+		}
+	}
+#endif /* CONFIG_IEEE80211BE */
+
 	ret = send_and_recv_cmd(drv, msg);
 	if (ret) {
 		wpa_printf(MSG_DEBUG,