From patchwork Wed Jun 5 10:57:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 802629 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D7AB191492 for ; Wed, 5 Jun 2024 10:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585053; cv=none; b=JKZPHWKRko8HK6riSfmFsuWos1OeSBGs8nv9NjIdDx5qHA/rnUsFTxr5q9WuQz9prNqMbJxKkcPA4Bh0/mVGvlm2XUwyv9Z3H5nCYe2jDbKmhMZISNROxA0vndDdfJp81XXr1liDSlZxQHrNBkCdZTK9epwdyW7nvacOfHOdGbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585053; c=relaxed/simple; bh=bYuH1jGmMmrHWesZoIQzrkle/R8C/oqzDdcCiH00NGg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d3jh0X4g1B1WgGqnXK5aRAoe9823MRZSzxQxRjZpMScnuZILmjR93BaXtK9N4mVw4OtISzaIf0KcanpyuPFiMQ6jiL52EVtVg+2IfvO6aI4udFq/i2I8S7vrneXjClxqsMyZ+x7g2m0GFHyoQGDJp8J9U8JXLSYNq1I+jNAhqiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DQS2n/NX; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DQS2n/NX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585052; x=1749121052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bYuH1jGmMmrHWesZoIQzrkle/R8C/oqzDdcCiH00NGg=; b=DQS2n/NXRoCGvEx22pV5KV5HiTc4/gNKKufNA36M2HPwEXUpG5f6p2ro tGrYhNlyHO0WTQD/VzyAV/U+nlVGsnZ57VvNw/8LDxJTpYK9R4qgSKBW5 tXJZ6x2WwViCm0DDaVIphh57UpZFZNxBdhMsg4bcT6X4S20Pg/JxrrDG3 uE8QGLyqdBVqt4Waaw76/o67ymBPyucU0NLbI3HBpcn+BIaw7aBy/G+Eb GYm2f9aUT1zKosFGykB3GljYicdCQAHIK+tP1BNWrq4anhcqj/U1fAS1h 51WG0ryWbr1bhfQ8FjxUwPMWXJmLe+YC+/qQVyO8f3ZcwqSFcWsOJjUV4 g==; X-CSE-ConnectionGUID: K99ALj9bT9KuKrMPLaQJqg== X-CSE-MsgGUID: aAarZUnwSJKnC+SFcJ5TAA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919945" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919945" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:31 -0700 X-CSE-ConnectionGUID: wo0rJoeCR6ayeEJVb7Ahuw== X-CSE-MsgGUID: 5OnDzSwASnOf67N3BFtrEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563003" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:30 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Avraham Stern Subject: [PATCH 1/7] wifi: nl80211: remove the FTMs per burst limit for NDP ranging Date: Wed, 5 Jun 2024 13:57:16 +0300 Message-Id: <20240605135233.916e228537d9.I5fe4c1cefa1c1328726e7615dd5a0d861c694381@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Avraham Stern In NDP ranging, the number of NDP exchanges is not negotiated and thus is not limited by the protocol. Remove the limit on FTMs per burst for trigger based and non trigger based ranging. Signed-off-by: Avraham Stern Signed-off-by: Miri Korenblit --- net/wireless/nl80211.c | 3 +-- net/wireless/pmsr.c | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8ff5f79d446a..296acd2a2a1b 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -315,8 +315,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { [NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD] = { .type = NLA_U16 }, [NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION] = NLA_POLICY_MAX(NLA_U8, 15), - [NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST] = - NLA_POLICY_MAX(NLA_U8, 31), + [NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST] = { .type = NLA_U8 }, [NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES] = { .type = NLA_U8 }, [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI] = { .type = NLA_FLAG }, [NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC] = { .type = NLA_FLAG }, diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index e106dcea3977..4af6bd354ad1 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright (C) 2018 - 2021, 2023 Intel Corporation + * Copyright (C) 2018 - 2021, 2023 - 2024 Intel Corporation */ #include #include "core.h" @@ -148,6 +148,14 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, return -EINVAL; } + if (out->ftm.ftms_per_burst > 31 && !out->ftm.non_trigger_based && + !out->ftm.trigger_based) { + NL_SET_ERR_MSG_ATTR(info->extack, + tb[NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST], + "FTM: FTMs per burst must be set lower than 31"); + return -ERANGE; + } + if ((out->ftm.trigger_based || out->ftm.non_trigger_based) && out->ftm.preamble != NL80211_PREAMBLE_HE) { NL_SET_ERR_MSG_ATTR(info->extack, From patchwork Wed Jun 5 10:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 801955 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 508A21922E7 for ; Wed, 5 Jun 2024 10:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585053; cv=none; b=YN76Sn21eSiySiQ4VzN5AQYghAxkE2cfptbu80Ie/XAgjFgyyNJF8gHDTbx9CCo6yXVTiv5PdsgJzM0TvIaaSrwhT5mktzTaK/Kfp/mOqUw0n9FE4hIYxmp3rn2iE2VCBibya2WUNU5C5OPeTwkylWEhMfYoSo77LASNxe+Ujfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585053; c=relaxed/simple; bh=M3V1oqxS8zGU08v2P5RfRjI5YeDSjxbHxSD1guEftgE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lVogMJvZ+kwtxHkvzfGlgnxj9q4Pp4aDMjS76ay6rVfbI02loDEpCTh83UMVKPNGe0+1g5mRu4iCdHfJ0BTLA8/TaInxNtP4cstnV59Nti3DTZI74OqqUD7M4swPGPu80mPH+PBxac9csaiXDrr7kIZLXdY6JUnP2v/wr1weV/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mfDLyj3r; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mfDLyj3r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585052; x=1749121052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M3V1oqxS8zGU08v2P5RfRjI5YeDSjxbHxSD1guEftgE=; b=mfDLyj3rutr3zvBWWqRK0rl/HN25qLIo2u18knkN2s6GHjag2V39D9eV iPwR9d9c9asM3bH/PpCxWZZy0ZJP3IRhTLEBAnnxYxot8Ffph8/r6X7Du r2TBfMbEMhn9i3KALCAw2yXZwZpLIN9YSnFyuj7h+mvbO3Cc+9PPpb3+m ZMVanrWLZGi9+Rpid6DGwVCrndfyiQX89gnHPiiX/lxgv9eFRm1JOEzp6 zrCbdxOg1H36T3ikuG7X8bsH/GrvTiOWsxvW/X4dUQHd6GXN5Gm7vWuRd AJlhfIaXj6SmfSWwHIiP+ISdoPv/vPcPKcJf8Zvsy7fg88/kWbEMoo9Ez w==; X-CSE-ConnectionGUID: VddI3NY2RweeOxefEH+LCA== X-CSE-MsgGUID: bNyx3S3cSgKSut/LUzRcQw== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919947" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919947" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:32 -0700 X-CSE-ConnectionGUID: V37hiR9hQjahsul19JUr7g== X-CSE-MsgGUID: ZuHmYsK7SPOMDaXkxMk1rA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563007" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:31 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Avraham Stern Subject: [PATCH 2/7] wifi: mac80211_hwsim: add 320 MHz to hwsim channel widths Date: Wed, 5 Jun 2024 13:57:17 +0300 Message-Id: <20240605135233.a766c1465566.Ib859c7233511b61b8a34022cfceeb4971c739d80@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Avraham Stern Setting a channel with 320 MHz channel width over hwsim results in an array-index-out-of-bounds error. Fix it by adding 320 MHz to hwsim supported channel widths. Signed-off-by: Avraham Stern Signed-off-by: Miri Korenblit --- drivers/net/wireless/virtual/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index b5afaec61827..d0dac0db979e 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -2361,6 +2361,7 @@ static const char * const hwsim_chanwidths[] = { [NL80211_CHAN_WIDTH_4] = "4MHz", [NL80211_CHAN_WIDTH_8] = "8MHz", [NL80211_CHAN_WIDTH_16] = "16MHz", + [NL80211_CHAN_WIDTH_320] = "eht320", }; static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) From patchwork Wed Jun 5 10:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 802628 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD80B1922F2 for ; Wed, 5 Jun 2024 10:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585055; cv=none; b=hjJJbnF6o0UI4xeLhC09jAVZAoOOxONkcIEl4w/y+y1jPICg5YqlR9A5B8nOrAVOkd+Gg9sVjqug62AZnrQnPYkwv0SA5UzTHpNGUy7FF39nRBg8gnikBNR9/8lV+YRRHynKf+wB2DXc9xmx5Xj8ncXFrMICZ1XNVWEOMYlzGQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585055; c=relaxed/simple; bh=CaEISvJyN/0psLQBRsjv7+sN8zXe3+9OTQJNa0AMTFc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AAAS+1w3PYQHyW0u/uV2FgvbZamWgWQDjCb3UOQY3MR5bs6X1m6IRXL8GruJBsVi8Tu+rdwurJ2x7Lkl906/VXoSYzci/vTf7z+uWwIhyAVfXYbulsTPqRptXI9xi+qB76GZRhJyTb/51AMSGxb78uoSrD99dllvZ7N38A9uFkE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GdVkxeOt; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GdVkxeOt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585054; x=1749121054; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CaEISvJyN/0psLQBRsjv7+sN8zXe3+9OTQJNa0AMTFc=; b=GdVkxeOtbSwy7P5iymdYoawHRU+dfOiXRb/aqGkz6dZScJKPSW/PmWEl /ZpYZQNKST+6FD7TTsaWnqH3obGzuojVGLoNevZTVoo30ZSl7LibrvRL5 Jt3ur/lEJ65gfaLX2uuD9XT9Tyjb0zdhirzqbD+usogkU47VQEHGHmD+L 13Mid1m7r/j5W+hbx9PKBY+KAPp5TeQKMqbwDrIwDlmJfSGSzhD0bRLwr n6MhC5JD3FmxmywPCPANbQwG10uQHUdYJRphAD8ojqedCH3fY0/p27u2x DKNkVjG8p9SysocynmxoKeceGIdo0NA+UQYj5FFBsxRzhJ5/ISzzzPSx+ g==; X-CSE-ConnectionGUID: 99jTNo3rTgyFyC20WbvGHQ== X-CSE-MsgGUID: WJDLElhRQ4yHtMj87Cv1rA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919951" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919951" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:34 -0700 X-CSE-ConnectionGUID: ZdsyfBOvRlGRQhv/S5S8/g== X-CSE-MsgGUID: 73koYEMnTZiUXFDCKSF41Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563012" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:33 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 3/7] wifi: mac80211: fix erroneous errors for STA changes Date: Wed, 5 Jun 2024 13:57:18 +0300 Message-Id: <20240605135233.48e2b8af07e3.Ib9793c383fcba118c05100e024f4a11a1c3d0e85@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Johannes Berg When e.g. wpa_supplicant sets only the MLD "sta" authorized state, the code actually applies that change, but then returns an error to userspace anyway because there were no changes to the link station, and no link ID was given. However, it's not incorrect to not have a link ID when wanting to change only the MLD peer ("sta") state, so the code shouldn't require it. To fix this, separate the "new_link" argument out into a new three-state enum, because if modify is called on a link STA only, it should return an error if no link is given or if it doesn't exist. For modify on the MLD "sta", not having a link ID is OK, but if there is one it should be validated. This seems to not have mattered much as wpa_supplicant just prints a message and continues, and the authorized state was already set before this error return. However, in the later code powersave recalculation etc. will be skipped, so that it may result in never allowing powersave on MLO connections. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- net/mac80211/cfg.c | 55 ++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 62119e957cd8..54b03a86f71e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1814,8 +1814,15 @@ static void sta_apply_mesh_params(struct ieee80211_local *local, #endif } +enum sta_link_apply_mode { + STA_LINK_MODE_NEW, + STA_LINK_MODE_STA_MODIFY, + STA_LINK_MODE_LINK_MODIFY, +}; + static int sta_link_apply_parameters(struct ieee80211_local *local, - struct sta_info *sta, bool new_link, + struct sta_info *sta, + enum sta_link_apply_mode mode, struct link_station_parameters *params) { int ret = 0; @@ -1827,18 +1834,29 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, struct link_sta_info *link_sta = rcu_dereference_protected(sta->link[link_id], lockdep_is_held(&local->hw.wiphy->mtx)); - - /* - * If there are no changes, then accept a link that exist, - * unless it's a new link. - */ - if (params->link_id >= 0 && !new_link && - !params->link_mac && !params->txpwr_set && - !params->supported_rates_len && - !params->ht_capa && !params->vht_capa && - !params->he_capa && !params->eht_capa && - !params->opmode_notif_used) - return 0; + bool changes = params->link_mac || + params->txpwr_set || + params->supported_rates_len || + params->ht_capa || + params->vht_capa || + params->he_capa || + params->eht_capa || + params->opmode_notif_used; + + switch (mode) { + case STA_LINK_MODE_NEW: + if (!params->link_mac) + return -EINVAL; + break; + case STA_LINK_MODE_LINK_MODIFY: + break; + case STA_LINK_MODE_STA_MODIFY: + if (params->link_id >= 0) + break; + if (!changes) + return 0; + break; + } if (!link || !link_sta) return -EINVAL; @@ -1848,15 +1866,13 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, return -EINVAL; if (params->link_mac) { - if (new_link) { + if (mode == STA_LINK_MODE_NEW) { memcpy(link_sta->addr, params->link_mac, ETH_ALEN); memcpy(link_sta->pub->addr, params->link_mac, ETH_ALEN); } else if (!ether_addr_equal(link_sta->addr, params->link_mac)) { return -EINVAL; } - } else if (new_link) { - return -EINVAL; } if (params->txpwr_set) { @@ -2028,7 +2044,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, if (params->listen_interval >= 0) sta->listen_interval = params->listen_interval; - ret = sta_link_apply_parameters(local, sta, false, + ret = sta_link_apply_parameters(local, sta, STA_LINK_MODE_STA_MODIFY, ¶ms->link_sta_params); if (ret) return ret; @@ -5004,7 +5020,7 @@ ieee80211_add_link_station(struct wiphy *wiphy, struct net_device *dev, if (ret) return ret; - ret = sta_link_apply_parameters(local, sta, true, params); + ret = sta_link_apply_parameters(local, sta, STA_LINK_MODE_NEW, params); if (ret) { ieee80211_sta_free_link(sta, params->link_id); return ret; @@ -5031,7 +5047,8 @@ ieee80211_mod_link_station(struct wiphy *wiphy, struct net_device *dev, if (!(sta->sta.valid_links & BIT(params->link_id))) return -EINVAL; - return sta_link_apply_parameters(local, sta, false, params); + return sta_link_apply_parameters(local, sta, STA_LINK_MODE_LINK_MODIFY, + params); } static int From patchwork Wed Jun 5 10:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 801954 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 056F71922E7 for ; Wed, 5 Jun 2024 10:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585056; cv=none; b=BFoM7uj9uwP8DNKhhuAsgShaqjGFT+TNVLMcTj3zaxt4bVC8VftwXl7NCLzyAlxcnfi9hil93SXGMFXTq0ozQFX5XSG0iWqXtWFVakvi37ZqxLEhMmdFmmMVsvic2Zuqh6T727G+Zl8QQNxDr5WIC53X/UzAHIU/PhvW93ksY2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585056; c=relaxed/simple; bh=KM/m/ZCX4S9OiNRm4UNazr5uMdahk3wtZUHrJlE7pBk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SOUtWM5BQX8LB4BDBKpDnHhiPEnH4zS7ityXkrOCOaC0D4I31xzKrWFziioKCZU1HRky4urJkJc40uGQ//Y9covsm5saedlhpOJ2mEvc/ruywXa6JJFhiAYU9HEsoZE3SULGcibh1AXIMbVD5g+4U1bDJXH8gc4LhuweQZf+LTI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BEHiHXdo; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BEHiHXdo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585055; x=1749121055; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KM/m/ZCX4S9OiNRm4UNazr5uMdahk3wtZUHrJlE7pBk=; b=BEHiHXdocePOUdwRLONmB3D9N5mWJ2rUOtB9OykRBRUHn2NJakK67WuA 3S5oX0LIQwhnbVeU1fggRXFvfNypynEOTV1fQtzMRR243hw9rcyQtDEmx EQBb7sihji1oFnGb03d5l5oOR/9AY2xFwt7bKAxrsP55dDUnPCsjZFXrd xLsxjCZNTUVArc2k5Yc0WiO0Ehs3XmCgIkrBLMdmOE9N9Jufkka9laVJv CHFSo4opC9Gu0U8CzH3iomW8ss+cVTDp7meNQpErkQjKdZutcj7VttGIn vLagdqF36uOK9T7oyX5QUr0AcOCbcb4LG7SR3uzvf5nE2WqxFFqhXtB29 A==; X-CSE-ConnectionGUID: +kUdUa8EQZ+NQmKZ+CXRww== X-CSE-MsgGUID: vL1/98PXSd+lAQj3V6eRkg== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919955" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919955" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:35 -0700 X-CSE-ConnectionGUID: Wtw81o55R0Sz2wJYvlbErg== X-CSE-MsgGUID: 6chxHtBPTr2c4cXvVnPEmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563016" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:34 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 4/7] wifi: mac80211: clean up 'ret' in sta_link_apply_parameters() Date: Wed, 5 Jun 2024 13:57:19 +0300 Message-Id: <20240605135233.eb7a24632d98.I72d7fe1da89d4b89bcfd0f5fb9057e3e69355cfe@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Johannes Berg There's no need to have the always-zero ret variable in the function scope, move it into the inner scope only. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- net/mac80211/cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 54b03a86f71e..890590146fa4 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1825,7 +1825,6 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, enum sta_link_apply_mode mode, struct link_station_parameters *params) { - int ret = 0; struct ieee80211_supported_band *sband; struct ieee80211_sub_if_data *sdata = sta->sdata; u32 link_id = params->link_id < 0 ? 0 : params->link_id; @@ -1876,6 +1875,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, } if (params->txpwr_set) { + int ret; + link_sta->pub->txpwr.type = params->txpwr.type; if (params->txpwr.type == NL80211_TX_POWER_LIMITED) link_sta->pub->txpwr.power = params->txpwr.power; @@ -1928,7 +1929,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, ieee80211_sta_init_nss(link_sta); - return ret; + return 0; } static int sta_apply_parameters(struct ieee80211_local *local, From patchwork Wed Jun 5 10:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 802627 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BB571922F2 for ; Wed, 5 Jun 2024 10:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585058; cv=none; b=sQoZZ2oHnA6yuwselzWbGlTY2bXnfUW/93Di2IIvaX+zNBKnuzJb/7FBDUdo9cwFowPxoO2ZKhEwio8zNjaGx87OWdNGrY2NvnaOFt8fPU/5rmNSvBSe8IGtXNXEPBD5hulvnFx8B19C0B+NuwVa2YMvpNl+38cCQszIkMyHN9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585058; c=relaxed/simple; bh=zCzf87zuYlcS7QlJEs8hi1Y+ECX1zAwGj/MwI5/13tI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lw+5QF7DPlAzzPY759Z0MRN3Vp7G+Hzxkhce19ovULYwWe4Uo8K0CYsNuF6mzkjkMiDw1USfthOZXBnUpmHvP2lLangChR4ovbB03Ketmp9txJ0nuxE2JAPi+ZiblY483zNUdTRIGtE8BZoV4P4c6Sj95cONBpxUkeKCqa4Cu2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=he50FG6L; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="he50FG6L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585057; x=1749121057; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zCzf87zuYlcS7QlJEs8hi1Y+ECX1zAwGj/MwI5/13tI=; b=he50FG6LtSKdR8MM5G95gwgBLaqf6wlK3LbT+AQRSZnnlRK0677YGQHW uOK5MMz3ea4E87zT2asoMHJgjvpogZ4HRbmPmnnJCwqppcX92ITVxIwkF NY+bIMiSw3s/YzBMs1gc0gXFJS1++a6SytaQsCWDQPI91qIE4skUKWiPF 2Pbo/zaMaSlBAZtSh9TDdOKfuDTrt6//BNdtk1AFIQYDH0PQYJcADIpEm o13af5P2Z3LN0/zY4RISUtxvWH2jPOmHCkmQJaPToXFIFjHnaY5iXaOd+ Kxwfd+YpVY7/G14gdCefHvt0+vuIAbEzoqJPCTbP3CRBg9dC+RVK1yHCZ A==; X-CSE-ConnectionGUID: eHFTrUQJSUqx0AnIcNxPkg== X-CSE-MsgGUID: B7+fX14XRneqalxu+COOqA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919957" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919957" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:36 -0700 X-CSE-ConnectionGUID: SA0MtzqVSVuQGYZlFKt6mw== X-CSE-MsgGUID: FsjUWCDaQKqnP/hnUBpgMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563019" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:35 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Johannes Berg Subject: [PATCH 5/7] wifi: cfg80211: honor WIPHY_FLAG_SPLIT_SCAN_6GHZ in cfg80211_conn_scan Date: Wed, 5 Jun 2024 13:57:20 +0300 Message-Id: <20240605135233.33f03661476a.I7b5be20a55aafe012cd9ddb3b4ba2d46b256ace4@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Emmanuel Grumbach If a user uses iw to connect to a network and we don't have any information about the existing networks, cfg80211 will trigger a scan internally even if the user didn't ask for a scan. This scan is implemented by cfg80211_conn_scan(). This function called rdev_scan() directly without honoring the WIPHY_FLAG_SPLIT_SCAN_6GHZ flag. Use cfg80211_scan instead, this will split the scan if the low level driver asked to. Signed-off-by: Emmanuel Grumbach Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit --- net/wireless/sme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index a8ad55f11133..e419aa8c4a5a 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -5,7 +5,7 @@ * (for nl80211's connect() and wext) * * Copyright 2009 Johannes Berg - * Copyright (C) 2009, 2020, 2022-2023 Intel Corporation. All rights reserved. + * Copyright (C) 2009, 2020, 2022-2024 Intel Corporation. All rights reserved. * Copyright 2017 Intel Deutschland GmbH */ @@ -130,7 +130,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) rdev->scan_req = request; - err = rdev_scan(rdev, request); + err = cfg80211_scan(rdev); if (!err) { wdev->conn->state = CFG80211_CONN_SCANNING; nl80211_send_scan_start(rdev, wdev); From patchwork Wed Jun 5 10:57:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 801953 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E05ED192B87 for ; Wed, 5 Jun 2024 10:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585060; cv=none; b=qe9e0MZgmUsmNm8JrAoS6y+qSM2T9350jLU+mY2EWuAFQm+E/bKkmFMd1gdLcGRq33bibjp8uDMKMUM1wIW3ob1/Dy5VMyxbXff1bczjJmgL3eIOqfsOrRJ/EIBsAySDdI973KJVwEO8NC/JKMuo9QfTftSu+Q6RAY/7lqBwgpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585060; c=relaxed/simple; bh=SG3OxS/Jrm/vVcMinMy8x6zbXkjvoVXYuZCmHIT82YU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OopfarPp/jCL5sJNakzJ7mfKjbceJCSWrItewyQtM4xrk4q3gdSSmptj0S6cziAeHe1gJc4T1Cs/zfgzsVL9W6qaJeTvJ4laPNxgc4whHs/zcW9slb1sDjZftyjgapUccA0PskPy9+gRP1OCBBaGOL1Im3aSq1oaivJVEK0nwus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XyiQcBQd; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XyiQcBQd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585059; x=1749121059; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SG3OxS/Jrm/vVcMinMy8x6zbXkjvoVXYuZCmHIT82YU=; b=XyiQcBQd4JHkxiipU6+NBKRkiF0nb+AlwGHMWJE8QLe5+PbuZmSTHfv1 FEUuRmpasWfAiG4gLMnoX2dx0Mj9MF/9twCTvCg/0e4HQRGiwSbSnsJgO GXTHhT5PmLK+Bc5WuS/hOYQYLOamSNZtkL8cZwFNeOpHiFEJkb4nWqwv5 69Mc//k9LVFPWy3Q9S3wQZwj0ulFt7mMppoTF7IhUQM649NwAZXLPrJFC YVMW/29vZ7skNVt1mKhJx/8A/vGvTVMbxUjtgINDCrbdl7BGkta86YJ7W /N8qqIY7Jz6poPWEfvlX4SjlHNlomQQC3FkriytjF4sKo1vG30Je59Bsw g==; X-CSE-ConnectionGUID: E7q2/1faR3erxCIah7Wrfw== X-CSE-MsgGUID: DKDvEmUBTGiztLJ3WEXUyw== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919960" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919960" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:38 -0700 X-CSE-ConnectionGUID: k5HetlpzRRi/l8I0YsemWA== X-CSE-MsgGUID: 8avh59+XRVK7Eb4KBV9uBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563024" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:37 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Johannes Berg , iil_jenkins iil_jenkins Subject: [PATCH 6/7] wifi: cfg80211: Add support for interface usage notification Date: Wed, 5 Jun 2024 13:57:21 +0300 Message-Id: <20240605135233.23d15e758640.I7a62740a6868416acaed01e41157b3c0a7a41b4d@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Ilan Peer In some cases, when an interface is added by user space, user space might not know yet what is the intended type of the interface, e.g., before a P2P Group Ownership Negotiation (GON) an interface is added but only at the end of the GON flow the final interface type is determined. This doesn't allow the kernel drivers to prepare for the actual interface type, e.g., make resources available for the interface type etc. Generally, adding an interface doesn't necessarily imply that it will actually be used soon, and as described the interface might not be used with the type it's added as. This new API allows user space to indicate that it does indeed intend to use the interface soon, along with the types (of which the interface must be one) that may be selected for that usage. This will allow the underlying driver to adjust resources accordingly. Signed-off-by: Ilan Peer Reviewed-by: Johannes Berg Tested-by: iil_jenkins iil_jenkins --- include/net/cfg80211.h | 12 ++++++++++++ include/uapi/linux/nl80211.h | 16 ++++++++++++++++ net/wireless/nl80211.c | 36 ++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 13 +++++++++++++ net/wireless/trace.h | 18 ++++++++++++++++++ 5 files changed, 95 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5da9bb0ac6a4..f2defbfd758e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4176,6 +4176,15 @@ struct mgmt_frame_regs { u32 global_mcast_stypes, interface_mcast_stypes; }; +/** + * struct cfg80211_iface_usage - Notify about intended interface usage + * + * @types_mask: mask of interface types that are going to be used. + */ +struct cfg80211_iface_usage { + u32 types_mask; +}; + /** * struct cfg80211_ops - backend description for wireless configuration * @@ -4577,6 +4586,7 @@ struct mgmt_frame_regs { * * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. * @set_ttlm: set the TID to link mapping. + * @iface_usage: notify about intended usage of added interfaces. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); @@ -4938,6 +4948,8 @@ struct cfg80211_ops { struct cfg80211_set_hw_timestamp *hwts); int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ttlm_params *params); + void (*iface_usage)(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_iface_usage *usage); }; /* diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f917bc6c9b6f..92dbbb0589f0 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1329,6 +1329,15 @@ * %NL80211_ATTR_MLO_TTLM_ULINK attributes are used to specify the * TID to Link mapping for downlink/uplink traffic. * + * @NL80211_CMD_IFACE_USAGE_NOTIF: Notify kernel about the expected interface + * usage. Allows user space to indicate to the kernel that it intends to + * use the interface soon and what is the expected usage of the interface + * so resources could be prepared etc. This is useful in case an added + * interface is not going to be used immediately but soon, and its type + * might change. The %NL80211_ATTR_IFACE_USAGE_IFTYPES attribute is used to + * provide the mask of intended interface types (the current type must be + * included in the mask). + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ @@ -1586,6 +1595,8 @@ enum nl80211_commands { NL80211_CMD_SET_TID_TO_LINK_MAPPING, + NL80211_CMD_IFACE_USAGE_NOTIF, + /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ @@ -2856,6 +2867,9 @@ enum nl80211_commands { * %NL80211_CMD_ASSOCIATE indicating the SPP A-MSDUs * are used on this connection * + * @NL80211_ATTR_IFACE_USAGE_IFTYPES: a bitmask of interface types that might be + * used with the interface. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3401,6 +3415,8 @@ enum nl80211_attrs { NL80211_ATTR_ASSOC_SPP_AMSDU, + NL80211_ATTR_IFACE_USAGE_IFTYPES, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 296acd2a2a1b..04110b74547d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -825,6 +825,11 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLO_TTLM_DLINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_ASSOC_SPP_AMSDU] = { .type = NLA_FLAG }, + + /* Set the limits to not allow NL80211_IFTYPE_UNSPECIFIED */ + [NL80211_ATTR_IFACE_USAGE_IFTYPES] = + NLA_POLICY_RANGE(NLA_U32, BIT(NL80211_IFTYPE_UNSPECIFIED + 1), + BIT(NUM_NL80211_IFTYPES) - 2), }; /* policy for the key attributes */ @@ -16319,6 +16324,31 @@ nl80211_set_ttlm(struct sk_buff *skb, struct genl_info *info) return rdev_set_ttlm(rdev, dev, ¶ms); } +static int +nl80211_iface_usage(struct sk_buff *skb, struct genl_info *info) +{ + struct cfg80211_iface_usage iface_usage = {}; + struct cfg80211_registered_device *rdev = info->user_ptr[0]; + struct net_device *dev = info->user_ptr[1]; + struct wireless_dev *wdev = dev->ieee80211_ptr; + + /* once the interface is up and running its type can no longer change */ + if (wdev_running(wdev)) + return -EINVAL; + + if (!info->attrs[NL80211_ATTR_IFACE_USAGE_IFTYPES]) + return -EINVAL; + + iface_usage.types_mask = + nla_get_u32(info->attrs[NL80211_ATTR_IFACE_USAGE_IFTYPES]); + + if (!(BIT(wdev->iftype) & iface_usage.types_mask)) + return -EINVAL; + + rdev_iface_usage(rdev, dev, &iface_usage); + return 0; +} + #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 @@ -17511,6 +17541,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { .flags = GENL_UNS_ADMIN_PERM, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), }, + { + .cmd = NL80211_CMD_IFACE_USAGE_NOTIF, + .doit = nl80211_iface_usage, + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV), + }, }; static struct genl_family nl80211_fam __ro_after_init = { diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 43897a5269b6..0a13212d9c8d 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -1542,4 +1542,17 @@ rdev_set_ttlm(struct cfg80211_registered_device *rdev, return ret; } + +static inline void +rdev_iface_usage(struct cfg80211_registered_device *rdev, + struct net_device *dev, + struct cfg80211_iface_usage *iface_usage) +{ + struct wiphy *wiphy = &rdev->wiphy; + + trace_rdev_iface_usage(wiphy, dev, iface_usage); + if (rdev->ops->iface_usage) + rdev->ops->iface_usage(wiphy, dev, iface_usage); + trace_rdev_return_void(wiphy); +} #endif /* __CFG80211_RDEV_OPS */ diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 14cfa0aba93a..2f5df52918cf 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -3032,6 +3032,24 @@ TRACE_EVENT(rdev_set_ttlm, WIPHY_PR_ARG, NETDEV_PR_ARG) ); +TRACE_EVENT(rdev_iface_usage, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct cfg80211_iface_usage *iface_usage), + TP_ARGS(wiphy, netdev, iface_usage), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY + __field(u32, types_mask) + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + __entry->types_mask = iface_usage->types_mask; + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", types_mask=0x%x", + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->types_mask) +); + /************************************************************* * cfg80211 exported functions traces * *************************************************************/ From patchwork Wed Jun 5 10:57:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 802626 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3786F1922F2 for ; Wed, 5 Jun 2024 10:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585061; cv=none; b=SToeXT0FTtJydSBcs9HWNMVJgeAsY8rnyDZgvBbhd04UEXMGkO8FhigrIIvF1aZ4DLwCZ8Xn7FVbRce3L/B59iNK9PJxYxbCy7hlx6u59jWt1mz2JjZWSJFdaA+V4RdZZzeJlZg0fEFZQRld1F09M8hhADTEtMSf5+R+cI+kz+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717585061; c=relaxed/simple; bh=rCpk1LBT6PF7wSafOMG3Md14Uqhe/SYjj01iVYfA0iY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UHM8cyGHqE5a4fq56mVNEIAok6YirgX3+F9TpNKuK0DjHSuuEl0IIyZPcKk87hNstP3vlpFC/STSGX3O8X8CqxctS9C7RSuE67doba++bBfoZN27SVLDyxPInPhmMxS6qhAU1SwUj6Joek9/6zn8FJG41yU4qNt+NE2CeGSwByQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=m6pC4gWG; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="m6pC4gWG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717585060; x=1749121060; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rCpk1LBT6PF7wSafOMG3Md14Uqhe/SYjj01iVYfA0iY=; b=m6pC4gWG7M9k/rAS3myX1lpfoKDxiaZGoGKM8TFVHN1mdvDkpplTHB1H mhqp2rmJjPIJ7sL4TUBeXiD4T+gw8DQ3lA8tN4RDlV9uMdG/USaPSdGWV 4SX1ra9f3Gh1Ob7MmKStaE6ubTSUGN+K78scfc5x68MpAB8WionIrgQ0Q x5ysEGjwC+A+JJf0Tv6Fd4VwseQD821H2KdME2hCKN88c1wqFywY15ZGN PVHjvcPm7PQp8/xIBdfZtvbcuikb7yjz8fnMx5CkZX0dKCfZ73ixv/trS iRSezvq8fhFLjatyWML9en4GWQpBd/s3pWEnFrKcPOvJ3GxxlHQjb1uA+ Q==; X-CSE-ConnectionGUID: k7j64ZbsTIehTdMMH0rQBQ== X-CSE-MsgGUID: UnS1UbgWRleSAvw0kbkOgA== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="11919962" X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="11919962" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:40 -0700 X-CSE-ConnectionGUID: LD5iPWggTgez6fRxMg61Dw== X-CSE-MsgGUID: MxssnEzWSCusyvm5S/BEOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,216,1712646000"; d="scan'208";a="37563027" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2024 03:57:39 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer Subject: [PATCH 7/7] wifi: mac80211: Add support for interface usage notification Date: Wed, 5 Jun 2024 13:57:22 +0300 Message-Id: <20240605135233.4d602acf0e65.I01fecab3b41961038f37ca6e0e3039c5fe9bb6bf@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605105722.2034610-1-miriam.rachel.korenblit@intel.com> References: <20240605105722.2034610-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 From: Ilan Peer When user space indicates the intended usage of a network interface, propagate the information to the driver. Signed-off-by: Ilan Peer Signed-off-by: Miri Korenblit --- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 12 ++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/trace.h | 23 +++++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index ecfa65ade226..047dce69e79b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4438,6 +4438,7 @@ struct ieee80211_prep_tx_info { * if the requested TID-To-Link mapping can be accepted or not. * If it's not accepted the driver may suggest a preferred mapping and * modify @ttlm parameter with the suggested TID-to-Link mapping. + * @iface_usage: notify about intended usage of added interfaces. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -4822,6 +4823,9 @@ struct ieee80211_ops { enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_neg_ttlm *ttlm); + + void (*iface_usage)(struct ieee80211_hw *hw, + struct cfg80211_iface_usage *iface_usage); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 890590146fa4..b121fc65eb09 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -5104,6 +5104,17 @@ ieee80211_set_ttlm(struct wiphy *wiphy, struct net_device *dev, return ieee80211_req_neg_ttlm(sdata, params); } +static void +ieee80211_iface_usage(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_iface_usage *iface_usage) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + + lockdep_assert_wiphy(wiphy); + + drv_iface_usage(local, iface_usage); +} + const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -5217,4 +5228,5 @@ const struct cfg80211_ops mac80211_config_ops = { .del_link_station = ieee80211_del_link_station, .set_hw_timestamp = ieee80211_set_hw_timestamp, .set_ttlm = ieee80211_set_ttlm, + .iface_usage = ieee80211_iface_usage, }; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index d4e73d3630e0..ccc697bd98ff 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1728,4 +1728,18 @@ drv_can_neg_ttlm(struct ieee80211_local *local, return res; } + +static inline void drv_iface_usage(struct ieee80211_local *local, + struct cfg80211_iface_usage *iface_usage) +{ + might_sleep(); + + lockdep_assert_wiphy(local->hw.wiphy); + + trace_drv_iface_usage(local, iface_usage); + if (local->ops->iface_usage) + local->ops->iface_usage(&local->hw, iface_usage); + + trace_drv_return_void(local); +} #endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 8e758b5074bd..b2f2588c7f82 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -3145,6 +3145,29 @@ TRACE_EVENT(drv_neg_ttlm_res, LOCAL_PR_ARG, VIF_PR_ARG, __entry->res ) ); + +TRACE_EVENT(drv_iface_usage, + TP_PROTO(struct ieee80211_local *local, + struct cfg80211_iface_usage *iface_usage), + + TP_ARGS(local, iface_usage), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, types_mask) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->types_mask = iface_usage->types_mask; + ), + + TP_printk( + LOCAL_PR_FMT " types_mask=0x%x", + LOCAL_PR_ARG, __entry->types_mask + ) +); + #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH