diff mbox series

[05/16] hostapd: MLO: assign link ID during BSS creation

Message ID 20240306173947.2611965-6-quic_adisi@quicinc.com
State Accepted
Headers show
Series hostapd: scale up MLO flows | expand

Commit Message

Aditya Kumar Singh March 6, 2024, 5:39 p.m. UTC
Currently, link ID is assigned when BSS is going to set up either
via driver init. Later if interface is disabled and enabled again,
it will again call setup BSS which will give a new link ID to it.
However, Link ID should be same for a BSS affliated to a MLD until
the lifetime of the BSS.

Hence, add change to assign the link ID during BSS creation itself.
And it will remain until BSS entry is completely freed. Hence, link
ID will not change as part of disable/enable.

Also, since link ID would be decided now, it will help in creating
link level control sockets in a subsequent patch.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 hostapd/main.c   |  2 --
 src/ap/hostapd.c | 10 +++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hostapd/main.c b/hostapd/main.c
index 6df7868c778b..97e9704c7046 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -211,7 +211,6 @@  static int hostapd_driver_init(struct hostapd_iface *iface)
 			os_memcpy(hapd->own_addr, b, ETH_ALEN);
 		}
 
-		hapd->mld_link_id = hapd->mld->next_link_id++;
 		hostapd_mld_add_link(hapd);
 
 		goto setup_mld;
@@ -296,7 +295,6 @@  static int hostapd_driver_init(struct hostapd_iface *iface)
 		else
 			os_memcpy(hapd->own_addr, b, ETH_ALEN);
 
-		hapd->mld_link_id = hapd->mld->next_link_id++;
 		hostapd_mld_add_link(hapd);
 	}
 
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 13b2873c6cbf..38c4e253047d 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -73,7 +73,6 @@  static void hostapd_switch_color_timeout_handler(void *eloop_data,
 						 void *user_ctx);
 #endif /* CONFIG_IEEE80211AX */
 
-
 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
 			       int (*cb)(struct hostapd_iface *iface,
 					 void *ctx), void *ctx)
@@ -2914,6 +2913,13 @@  struct hostapd_iface * hostapd_alloc_iface(void)
 }
 
 #ifdef CONFIG_IEEE80211BE
+static void hostapd_bss_alloc_link_id(struct hostapd_data *hapd)
+{
+	hapd->mld_link_id = hapd->mld->next_link_id++;
+	wpa_printf(MSG_DEBUG, "MLD: %s: Link ID %d assigned.",
+		   hapd->mld->name, hapd->mld_link_id);
+}
+
 static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
 					 struct hapd_interfaces *interfaces)
 {
@@ -2937,6 +2943,7 @@  static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
 			continue;
 
 		hapd->mld = mld;
+		hostapd_bss_alloc_link_id(hapd);
 		break;
 	}
 
@@ -2956,6 +2963,7 @@  static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
 	wpa_printf(MSG_DEBUG, "MLD %s created", mld->name);
 
 	hapd->mld = mld;
+	hostapd_bss_alloc_link_id(hapd);
 
 	all_mld = os_realloc_array(interfaces->mld, interfaces->mld_count + 1,
 				   sizeof(struct hostapd_mld *));