From patchwork Thu Mar 28 18:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 1917535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=J6eHfbew; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=itOE3MkA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V5Bbr4sFgz1yYR for ; Fri, 29 Mar 2024 05:18:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LSc6GO896mNBMKJKnvyfqiwzELgKY0y8hv1q2bFu9kc=; b=J6eHfbew2M/dKI m5qaguDNfT7IJ0g/LUaPiSvt4d1R9lYVR2G9BcftDV98aT+3INZM78zEfObmjO4FmlJTq4WNDURIk fkgPVzBDJtCnyFJd0JSqk9zMKInQrRDcCmevHFdiAIFyXWnXtXnTYhVtz27nWARLDqitcMrSjgrLc 6bP06upMyyXcGRSvN09WuHaQNRVe8sMrOZ3SpEWlZpNHGicKmOllm44llrcqGvj0YZqDssBCYUqWN LBZFYeQdqP08sPyPESTrGHOJnEoFM5qLgxv43f7Yi3WjNlZgWHTJciE1TucgCFY1MdlFTYPVx6ASm MDbLVyy3v5yc/ceR/iLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpuJm-0000000F74b-2AEt; Thu, 28 Mar 2024 18:17:38 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpuJf-0000000F70F-2s4V for hostap@lists.infradead.org; Thu, 28 Mar 2024 18:17:33 +0000 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42SIAURA020373 for ; Thu, 28 Mar 2024 18:17:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=gE8oo/fd7I3AWkpVcVoI5dX9J1gEL4Rm3YJUiqJwHkA=; b=it OE3MkAPX4i4V+53AlhM/eHkwYDsVAfYob2cc5iYy1o7K6G7lonjlbirz/NHcxikJ 7lF+AeupgxhsgdYK7C5+HYhSt8+vWpz3DcZnwB9Ax1xEdDnuR9mTIAsR0Moitxi/ QBuxpsMkDGPzz2nmDw9bdNznU2pxBWmWSqWZchQVYepnhJfZyBmOLnLBF7Fl6Et3 GF041oyo0igOY9CJynq1mYvKdCMOAEefHK5U332OKB8gMt9AaMPyxUrmLaMSgJm/ kLrUqKSAXI3ByoArMZzLZJF6vezujabOfuXdJC1zpmaXVE4YeaYRaJTOkzkVB/B1 1XC+rrRgBVvrAlHxyUrQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x4u20mbyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2024 18:17:30 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42SIHTqp013768 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2024 18:17:29 GMT Received: from hu-adisi-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 28 Mar 2024 11:17:28 -0700 From: Aditya Kumar Singh To: CC: Sriram R , Aditya Kumar Singh Subject: [PATCH 07/22] hostapd: MLO: add support for cohosted ML BSS Date: Thu, 28 Mar 2024 23:46:37 +0530 Message-ID: <20240328181652.2956122-8-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328181652.2956122-1-quic_adisi@quicinc.com> References: <20240328181652.2956122-1-quic_adisi@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: efXmFk9e-P5aPgcfTVSjNBDWSpCEoRDo X-Proofpoint-GUID: efXmFk9e-P5aPgcfTVSjNBDWSpCEoRDo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_17,2024-03-28_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403280128 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_111731_988317_400B5BFE X-CRM114-Status: GOOD ( 20.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Sriram R Currently MLO is being supported with an assumption of only single BSS per link in the hostapd conf file. This needs to be extended when cohosted ML BSS exist in the same config file. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Sriram R Currently MLO is being supported with an assumption of only single BSS per link in the hostapd conf file. This needs to be extended when cohosted ML BSS exist in the same config file. Extend the support for cohosted BSSes. This is required for MBSSID MLO support as well. Signed-off-by: Sriram R Signed-off-by: Aditya Kumar Singh --- hostapd/main.c | 38 +++++++------------------- src/ap/hostapd.c | 70 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 73 insertions(+), 35 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index a43d3a5be1d5..524a102742b7 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -158,6 +158,9 @@ static int hostapd_driver_init(struct hostapd_iface *iface) struct hostapd_bss_config *conf = hapd->conf; u8 *b = conf->bssid; struct wpa_driver_capa capa; +#ifdef CONFIG_IEEE80211BE + struct hostapd_data *h_hapd = NULL; +#endif /* CONFIG_IEEE80211BE */ if (hapd->driver == NULL || hapd->driver->hapd_init == NULL) { wpa_printf(MSG_ERROR, "No hostapd driver wrapper available"); @@ -165,35 +168,10 @@ static int hostapd_driver_init(struct hostapd_iface *iface) } #ifdef CONFIG_IEEE80211BE - for (i = 0; conf->mld_ap && i < iface->interfaces->count; i++) { - struct hostapd_iface *h = iface->interfaces->iface[i]; - struct hostapd_data *h_hapd = h->bss[0]; - struct hostapd_bss_config *hconf = h_hapd->conf; - - if (h == iface) { - wpa_printf(MSG_DEBUG, "MLD: Skip own interface"); - continue; - } - - if (!hconf->mld_ap) { - wpa_printf(MSG_DEBUG, - "MLD: Skip non-MLD"); - continue; - } - - if (!hostapd_is_ml_partner(hapd, h_hapd)) { - wpa_printf(MSG_DEBUG, - "MLD: Skip non matching MLD vif name"); - continue; - } - - wpa_printf(MSG_DEBUG, "MLD: Found matching MLD interface"); - if (!h_hapd->drv_priv) { - wpa_printf(MSG_DEBUG, - "MLD: Matching MLD BSS not initialized yet"); - continue; - } + if (conf->mld_ap) + h_hapd = hostapd_mld_get_first_bss(hapd); + if (h_hapd) { hapd->drv_priv = h_hapd->drv_priv; hapd->interface_added = h_hapd->interface_added; @@ -214,6 +192,8 @@ static int hostapd_driver_init(struct hostapd_iface *iface) } hostapd_mld_add_link(hapd); + wpa_printf(MSG_DEBUG, "Setup of non first link (%d) BSS of MLD %s", + hapd->mld_link_id, hapd->conf->iface); goto setup_mld; } @@ -298,6 +278,8 @@ static int hostapd_driver_init(struct hostapd_iface *iface) os_memcpy(hapd->own_addr, b, ETH_ALEN); hostapd_mld_add_link(hapd); + wpa_printf(MSG_DEBUG, "Setup of first link (%d) BSS of MLD %s", + hapd->mld_link_id, hapd->conf->iface); } setup_mld: diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index f8cb6432d007..ff1d8f9d08e7 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1333,6 +1333,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first, char force_ifname[IFNAMSIZ]; u8 if_addr[ETH_ALEN]; int flush_old_stations = 1; +#ifdef CONFIG_IEEE80211BE + struct hostapd_data *h_hapd = NULL; +#endif /* CONFIG_IEEE80211BE */ if (!hostapd_mld_is_first_bss(hapd)) wpa_printf(MSG_DEBUG, @@ -1379,6 +1382,21 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first, } while (mac_in_conf(hapd->iconf, hapd->own_addr)); } +#ifdef CONFIG_IEEE80211BE + if (conf->mld_ap) { + h_hapd = hostapd_mld_get_first_bss(hapd); + + if (h_hapd) { + hapd->drv_priv = h_hapd->drv_priv; + hapd->interface_added = h_hapd->interface_added; + hostapd_mld_add_link(hapd); + wpa_printf(MSG_DEBUG, "Setup of non first link (%d) BSS of MLD %s", + hapd->mld_link_id, hapd->conf->iface); + goto setup_mld; + } + } +#endif /* CONFIG_IEEE80211BE */ + hapd->interface_added = 1; if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, conf->iface, addr, hapd, @@ -1393,8 +1411,33 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first, if (!addr) os_memcpy(hapd->own_addr, if_addr, ETH_ALEN); + +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) { + wpa_printf(MSG_DEBUG, "Setup of first link (%d) BSS of MLD %s", + hapd->mld_link_id, hapd->conf->iface); + os_memcpy(hapd->mld->mld_addr, hapd->own_addr, ETH_ALEN); + hostapd_mld_add_link(hapd); + } } +setup_mld: + + if (hapd->conf->mld_ap && !first) { + wpa_printf(MSG_DEBUG, + "MLD: Set link_id=%u, mld_addr=" MACSTR + ", own_addr=" MACSTR, + hapd->mld_link_id, MAC2STR(hapd->mld->mld_addr), + MAC2STR(hapd->own_addr)); + + if (hostapd_drv_link_add(hapd, hapd->mld_link_id, + hapd->own_addr)) + return -1; + } +#else + } +#endif /* CONFIG_IEEE80211BE */ + if (conf->wmm_enabled < 0) conf->wmm_enabled = hapd->iconf->ieee80211n | hapd->iconf->ieee80211ax; @@ -4679,17 +4722,30 @@ void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx) struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd, u8 link_id) { - unsigned int i; + struct hostapd_iface *iface; + struct hostapd_data *bss; + struct hostapd_bss_config *conf; + unsigned int i, j; for (i = 0; i < hapd->iface->interfaces->count; i++) { - struct hostapd_iface *h = hapd->iface->interfaces->iface[i]; - struct hostapd_data *h_hapd = h->bss[0]; - - if (!hostapd_is_ml_partner(hapd, h_hapd)) + iface = hapd->iface->interfaces->iface[i]; + if (!iface) continue; - if (h_hapd->mld_link_id == link_id) - return h_hapd; + for (j = 0; j < iface->num_bss; j++) { + bss = iface->bss[j]; + conf = bss->conf; + + if (!conf->mld_ap || + !hostapd_is_ml_partner(hapd, bss)) + continue; + + if (!bss->drv_priv) + continue; + + if (bss->mld_link_id == link_id) + return bss; + } } return NULL;