[PATCH 08/16] hostapd: MLO: remove redundant put_freq call in set_ap

Aditya Kumar Singh quic_adisi at quicinc.com
Wed Mar 6 09:39:39 PST 2024


Currently wpa_driver_nl80211_set_ap() calls nl80211_put_freq_params() two
times if AP is a MLD AP. It calls one while putting MLO link ID and other
in the normal flow if frequency info is present. Calling two times is not
required.

Hence, add code changes to call it via the normal flow only and if the AP
is MLD AP, add MLO link ID as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi at quicinc.com>
---
 src/drivers/driver_nl80211.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index dc19ef1158b3..856c004b27c2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5099,20 +5099,6 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 	    nla_put(msg, NL80211_ATTR_SSID, params->ssid_len, params->ssid))
 		goto fail;
 
-	if (params->mld_ap) {
-		wpa_printf(MSG_DEBUG, "nl80211: link_id=%u",
-			   params->mld_link_id);
-
-		if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
-			       params->mld_link_id) ||
-		    (params->freq &&
-		     nl80211_put_freq_params(msg, params->freq) < 0))
-			goto fail;
-
-		nl80211_link_set_freq(bss, params->mld_link_id,
-				      params->freq->freq);
-	}
-
 	if (params->proberesp && params->proberesp_len) {
 		wpa_hexdump(MSG_DEBUG, "nl80211: proberesp (offload)",
 			    params->proberesp, params->proberesp_len);
@@ -5355,6 +5341,19 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 	if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0)
 		goto fail;
 
+	if (params->mld_ap) {
+		wpa_printf(MSG_DEBUG, "nl80211: link_id=%u",
+			   params->mld_link_id);
+
+		if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
+			       params->mld_link_id))
+			goto fail;
+
+		if (params->freq)
+			nl80211_link_set_freq(bss, params->mld_link_id,
+					      params->freq->freq);
+	}
+
 	if (params->freq && params->freq->he_enabled &&
 	    nl80211_attr_supported(drv, NL80211_ATTR_HE_BSS_COLOR)) {
 		struct nlattr *bss_color;
-- 
2.25.1




More information about the Hostap mailing list