From patchwork Mon May 22 19:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1784637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=ZNMd4Oqk; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=MctlYuvn; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QQ7320kDZz20fC for ; Tue, 23 May 2023 05:35:40 +1000 (AEST) 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=efP7rFWrIygogd3kK4d34czwcusqmi5ycPnR17ao0Ag=; b=ZNMd4OqkLOOJE6 mP+4Q8PsXIg6ozcvRo2Ol2f0BXTsiUagnnnoW8wPggPCNCDBuhx/enBuXvD8Y/5nexmNi4vWNG/77 9NtJwHoo7WxdMARme7Py+X/wc47DJeWnAQWY9mGUo8AS20azbRmSN/HD0NBWvy1wD2Gm3p1+aolhc Hn5A/gpRp/RBudV3/UtsammbfCzdOen+dxVnSmv0HHnwaYSBANJBRtyxUMaPFUKHHDBca3YJv6NCM WZBIsAZNP91GwUoNYo8kUPlkrxXUTb3gLlKRMJbVKUoCPI/4WtOmT7Aku9t78UDJGOoC2ul8K+CEx r7MTRcn7GBri7PiGUW4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1BIz-007hYq-2e; Mon, 22 May 2023 19:34:53 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1BIv-007hVw-0T for hostap@lists.infradead.org; Mon, 22 May 2023 19:34:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684784089; x=1716320089; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmrVn0taDVXw2fv7/Y+piVyKqjJIpsRZsSr/kljdITs=; b=MctlYuvn+Cou67hVHksgsiMl5r7u0vjnJcHHkHJMx5nOu146rV+4QRV0 LhUgSMNRK5qHbwHeN+E0p66SW/gAHwnAQiG0sDCvJMBBKBGd3afICTpoT opViswCykZLtxZFc3LJSmWvk200iwW0xgb/Vwo7ceRlnPJsyaia38hbDy Cb3CvYIITXpoRPsoMv4+RmrS4Q6ZtdIV6isrd7jCzndO2DYnVt2kgUMDk 9l5yezORE4kDAAkdYfEAK+KHODwqQaPvCTdB6R60nHdfCWL0TsPscuDwe yAYITvJpX7Es8Opazdn/z092sLh50GdFzhHLZus9tGuzQdbK3bK+4FbrV Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="351869092" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="351869092" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 12:34:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10718"; a="827809091" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="827809091" Received: from ghorst-mobl3.ger.corp.intel.com (HELO aotchere-desk.intel.com) ([10.254.149.56]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 12:34:47 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer , Andrei Otcheretianski Subject: [PATCH v2 06/44] driver: Allow to provide a link ID when setting a channel Date: Mon, 22 May 2023 22:33:34 +0300 Message-Id: <20230522193412.658666-7-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230522193412.658666-1-andrei.otcheretianski@intel.com> References: <20230522193412.658666-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_123449_214422_FED7ECAB X-CRM114-Status: GOOD ( 19.13 ) X-Spam-Score: -2.7 (--) 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: Ilan Peer This includes: - Modifications of the driver API, to include the link ID as part of 'struct hostapd_freq_params'. - Modifications to nl80211 driver. - Modifications for the driver wrappers. Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.120 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer This includes: - Modifications of the driver API, to include the link ID as part of 'struct hostapd_freq_params'. - Modifications to nl80211 driver. - Modifications for the driver wrappers. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- src/ap/ap_drv_ops.c | 9 ++++++ src/drivers/driver.h | 5 ++++ src/drivers/driver_nl80211.c | 56 +++++++++++++++++++++++++++++++++++- wpa_supplicant/driver_i.h | 7 +++++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index c8e8bd6693..3167bca786 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -584,6 +584,15 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, return 0; if (hapd->driver->set_freq == NULL) return 0; + + data.link_id = -1; + +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) + data.link_id = hapd->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + + wpa_printf(MSG_DEBUG, "hostapd_set_freq: link_id=%d", data.link_id); return hapd->driver->set_freq(hapd->drv_priv, &data); } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 2831955e81..42edd6b8dd 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -829,6 +829,11 @@ struct hostapd_freq_params { * eht_enabled - Whether EHT is enabled */ bool eht_enabled; + + /** + * if >=0 indicates the link of the MLD AP to configure. + */ + int link_id; }; /** diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index e388a0f518..bc267014a1 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4116,6 +4116,29 @@ int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv) } +static struct i802_link *nl80211_get_link(struct i802_bss *bss, s8 link_id) +{ + unsigned int i; + + for (i = 0; i < bss->n_links; i++) { + if (bss->links[i].link_id != link_id) + continue; + + return &bss->links[i]; + } + + return bss->flink; +} + + +static void nl80211_link_set_freq(struct i802_bss *bss, s8 link_id, int freq) +{ + struct i802_link *link = nl80211_get_link(bss, link_id); + + link->freq = freq; +} + + static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data, size_t data_len, int noack, unsigned int freq, int no_cck, @@ -5287,6 +5310,26 @@ static int nl80211_put_freq_params(struct nl_msg *msg, return 0; } +static bool nl80211_link_valid(struct i802_bss *bss, s8 link_id) +{ + u32 i; + + if (link_id < 0) + return false; + + for (i = 0; i < bss->n_links; i++) { + wpa_printf(MSG_DEBUG, "nl80211: i=%u, link_Id=%u", + i, bss->links[i].link_id); + if (bss->links[i].link_id == NL80211_DRV_LINK_ID_NA) + continue; + + if (bss->links[i].link_id == link_id) + return true; + } + + return false; +} + static int nl80211_set_channel(struct i802_bss *bss, struct hostapd_freq_params *freq, int set_chan) @@ -5308,9 +5351,20 @@ static int nl80211_set_channel(struct i802_bss *bss, return -1; } + if (nl80211_link_valid(bss, freq->link_id)) { + wpa_printf(MSG_DEBUG, "nl80211: Set link_id=%u for freq", + freq->link_id); + + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + freq->link_id)) { + nlmsg_free(msg); + return -ENOBUFS; + } + } + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); if (ret == 0) { - bss->flink->freq = freq->freq; + nl80211_link_set_freq(bss, freq->link_id, freq->freq); return 0; } wpa_printf(MSG_DEBUG, "nl80211: Failed to set channel (freq=%d): " diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index d707cf556d..d5ec22cee1 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -60,6 +60,9 @@ static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s, struct wpa_driver_associate_params *params) { if (wpa_s->driver->associate) { + if (params) + params->freq.link_id = -1; + return wpa_s->driver->associate(wpa_s->drv_priv, params); } return -1; @@ -1098,6 +1101,10 @@ static inline int wpa_drv_update_connect_params( { if (!wpa_s->driver->update_connect_params) return -1; + + if (params) + params->freq.link_id = -1; + return wpa_s->driver->update_connect_params(wpa_s->drv_priv, params, mask); }