Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3415913rdb; Sun, 10 Dec 2023 05:06:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkoq6APnIgv1hoUGwYC7X313BxkcFuCX0zIkNONNrKyvtztzuVR9xch9b8oymZYyUX+Pte X-Received: by 2002:ac2:5b4f:0:b0:50b:fa9b:1649 with SMTP id i15-20020ac25b4f000000b0050bfa9b1649mr1445282lfp.73.1702213592667; Sun, 10 Dec 2023 05:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702213592; cv=none; d=google.com; s=arc-20160816; b=Rhmow8AWruU5WL57R6J6qqXYyN3Sb+BruHVPlT5szouvH4/90/or2PnDFNugF99n8p bcLtdqdqTe4urxJNWfj85WIIJynvIvf33HSIRRaYacQNZ+vQTsl/EyGl0fYNWSu8qcrf 0QJQ6NGsmPFm75KkwJsWuYC/Eb5jtlHmnvvWgRrZOXPlamCQEFeRb+/Rh/+Wy6uyItcy DbW/TRPPD1p2uJOLENhuc0fxQPAsVzSc5iHoGlK7V+xBw/Nj5ukvL0qDE87lBhyTT/b4 1u45O5IdsEiswbWBHyFeE/RR9c5W/fgUTQmyOGQhrANG3Zwf3cBDaQ0wbXOn4bdPvExu i6Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=dDRO1bvcpMCN0/q7Sogav3k9gcTMT+Ui8UkIhyeIcwI=; fh=YrAuaossMrVPiL8QCJPQEDvC/PQo4rrLqZt++logQ2o=; b=i2HTM91qqlCM5G9AfecS8X/I3k1RfIwn7jbkYwZXdwjQHAwxvWodH1MgUGNhcd0EA9 JTDpCwe9qOYKRk349o+ZENn965ZNj8/g9xXrgsEQ1gk2S5baJRc7Ko05cxOnJABGiGv1 9HDuVLJK7mx77Q5552S7XDFYcyqKimBAIlDJ+d5tj+3No8Jtj0fHDrFib2kaBlj+8Yg3 N64DMCNj3WAFI6gBhw9OwV/KUewFJgGjnVRs30+R8hgGd5Cgedn0x9JGOyk+YtBOmZLS 4/3H63WrdTMlo7JnUEk/kHyvDa/nbobxASZ0OAqfZ/qbdBUm02ws/TBWQkNnno4w4t+C 1e4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=VOqTn3Uj; spf=pass (google.com: domain of linux-wireless+bounces-604-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-604-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v26-20020a50a45a000000b0054ce7d5f3bbsi2778489edb.139.2023.12.10.05.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 05:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-604-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=VOqTn3Uj; spf=pass (google.com: domain of linux-wireless+bounces-604-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-604-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6A4821F20FBF for ; Sun, 10 Dec 2023 13:06:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F666C2C4; Sun, 10 Dec 2023 13:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VOqTn3Uj" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3022FE for ; Sun, 10 Dec 2023 05:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702213582; x=1733749582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cDB5PBzkwSn+zNT3BaZSKz2FXK4C/J3v/HhgzEGrcO4=; b=VOqTn3UjX7Jh4YsU7CGOwUsC9JsYjdFkaKU69TAnWdfJBFFRp2qQgxEd B+1GwrMHxUxk6wGt7OG2NiUtoMTCfJ89oEpdUp/iXeVvhntKaRpNHNM1A 7Rs6St2TqFphRB7V07NoAJF9MWznmxudORp6kf6jS5wFb/ljMerfen9I1 qM4nkTr8FXounAK5y/OEnx40vLBDc9cr1QFd8TXEBHL53XR5+hXS23uVe sDhW27OqrHQYTav/N10/mODNxvt0ASTMVk7L4GQxI/XvIoynqqbB+vQV3 b42Lxz8TOc6vVGXqxaPmphWKAZrcB+410bUA8sCOKUsBYZ6PtqVd+ki8M g==; X-IronPort-AV: E=McAfee;i="6600,9927,10919"; a="480746087" X-IronPort-AV: E=Sophos;i="6.04,265,1695711600"; d="scan'208";a="480746087" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2023 05:06:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10919"; a="748926270" X-IronPort-AV: E=Sophos;i="6.04,265,1695711600"; d="scan'208";a="748926270" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2023 05:06:20 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg , Berg@web.codeaurora.org, Johannes Subject: [PATCH 09/14] wifi: cfg80211: generate an ML element for per-STA profiles Date: Mon, 11 Dec 2023 09:05:27 +0200 Message-Id: <20231211085121.abde63d9cc6d.I3d346be0f84f51dccf4f4f92a3e997e6102b9456@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231211070532.2458539-1-miriam.rachel.korenblit@intel.com> References: <20231211070532.2458539-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit From: Benjamin Berg The specification says that this information should not be explicitly included in the per-STA profile. However, we need this information readily available in the BSS for userspace and also internally when associating. As such, append the appropriate element before adding/updating the BSS. Signed-off-by: Benjamin Berg Reviewed-by: Berg, Johannes Signed-off-by: Miri Korenblit --- net/wireless/scan.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 2f8c9b6f7ebc..3e3ba0ddb83e 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -2621,6 +2621,7 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy, const struct element *elem; struct cfg80211_mle *mle; u16 control; + u8 ml_common_len; u8 *new_ie; struct cfg80211_bss *bss; int mld_id; @@ -2651,6 +2652,8 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy, !(control & IEEE80211_MLC_BASIC_PRES_MLD_CAPA_OP)) return; + ml_common_len = ml_elem->variable[0]; + /* length + MLD MAC address + link ID info + BSS Params Change Count */ pos = ml_elem->variable + 1 + 6 + 1 + 1; @@ -2767,6 +2770,34 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy, if (!data.ielen) continue; + /* The generated elements do not contain: + * - Basic ML element + * - A TBTT entry in the RNR for the transmitting AP + * + * This information is needed both internally and in userspace + * as such, we should append it here. + */ + if (data.ielen + 3 + sizeof(*ml_elem) + ml_common_len > + IEEE80211_MAX_DATA_LEN) + continue; + + /* Copy the Basic Multi-Link element including the common + * information, and then fix up the link ID. + * Note that the ML element length has been verified and we + * also checked that it contains the link ID. + */ + new_ie[data.ielen++] = WLAN_EID_EXTENSION; + new_ie[data.ielen++] = 1 + sizeof(*ml_elem) + ml_common_len; + new_ie[data.ielen++] = WLAN_EID_EXT_EHT_MULTI_LINK; + memcpy(new_ie + data.ielen, ml_elem, + sizeof(*ml_elem) + ml_common_len); + + new_ie[data.ielen + sizeof(*ml_elem) + 1 + ETH_ALEN] = link_id; + + data.ielen += sizeof(*ml_elem) + ml_common_len; + + /* TODO: Add an RNR containing only the reporting AP */ + bss = cfg80211_inform_single_bss_data(wiphy, &data, gfp); if (!bss) break; -- 2.34.1