From patchwork Wed Feb 12 06:22:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 865084 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 B43CC1FBC9B for ; Wed, 12 Feb 2025 06:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739341392; cv=none; b=ZPg1AxH0xKU1S1qfWLnD7add8V5DL+0vVQW/wtysilliUhn4nCy2B7sQ89pazK+I6CnZqQoKQizrXlDuBLRz0fiuWVXXtC2Npn6k+s+jKCc/YhvahhMe9HLzgFpiv7bSIuPyhjv3kzMl+mjWI+dHNq3//McL6AcvIMINRlNcjDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739341392; c=relaxed/simple; bh=9NWtWCKZrnxiaeRZnae9w0HJ3+CfGtNtv7+Fy2mxsR4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N9DME4ZDiZLanoG22AgopBlP9/AmKGXpJGi7mTGBLNpmXboVI7AQ+LBUWf75RKIGuk6t3PZYKmilZN7LYYnTgy0pHro3lDCxux6Ako262ueQPTShCo2ppAKx0HGDtU3VQ3B3bDuTsOzEAASf7WRqYsM/TeRPHGXaVUU01JVak5g= 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=FvLEmSXz; arc=none smtp.client-ip=198.175.65.15 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="FvLEmSXz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1739341391; x=1770877391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9NWtWCKZrnxiaeRZnae9w0HJ3+CfGtNtv7+Fy2mxsR4=; b=FvLEmSXzhVT4u9OjF1HoLE4cjC8eMR29aDm4WIi3GkKgpPEYbVuC1Kdr K466Vwolovwn6uj8tq1wHHXgJnfORkz14+MqAvSMLcLKG2AZKAZme+E6q HnEVQQVO6mH4BY7CrdKNNk7h+9tz5u4Z9VtGzzFpUVyNPyKwfYlamI7sa it8Tx6iucj1+AFi6LJEM9LmaZx0DF9h/KgZTHeyozqlNSrS6ozz46iv3H kjbI3rGNrazXQWdk1YfwmkZ/CVKUQhyFzSFOytFjjsv9BwLGn5rWXsSUZ y0bhD+hP0Uz2LJyxaYW3a4Y4CtwE27g2ExCmQvYo88PBCxdYvt82hykkb Q==; X-CSE-ConnectionGUID: Vb+batPmQrq2DxNOaC2/QA== X-CSE-MsgGUID: z2W4+nSeQWycZCzH4AjfOw== X-IronPort-AV: E=McAfee;i="6700,10204,11342"; a="43637627" X-IronPort-AV: E=Sophos;i="6.13,279,1732608000"; d="scan'208";a="43637627" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2025 22:23:10 -0800 X-CSE-ConnectionGUID: oPxxxnuLQYy4z5Tz6RXn+w== X-CSE-MsgGUID: R4AhXtQGR8maeNNUIUvc2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,279,1732608000"; d="scan'208";a="112944135" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2025 22:23:09 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 1/2] wifi: mac80211: add ieee80211_iter_chan_contexts_mtx Date: Wed, 12 Feb 2025 08:22:57 +0200 Message-Id: <20250212082137.d85eef3024de.Icda0616416c5fd4b2cbf892bdab2476f26e644ec@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250212062258.454981-1-miriam.rachel.korenblit@intel.com> References: <20250212062258.454981-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 Add a chanctx iterator that can be called from a wiphy-locked context. Signed-off-by: Miri Korenblit Reviewed-by: Johannes Berg --- include/net/mac80211.h | 25 +++++++++++++++++++++++++ net/mac80211/chan.c | 20 +++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 22d32419e8a0..64e666fc5adc 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -6671,6 +6671,31 @@ void ieee80211_iter_chan_contexts_atomic( void *data), void *iter_data); +/** + * ieee80211_iter_chan_contexts_atomic - iterate channel contexts + * @hw: pointer obtained from ieee80211_alloc_hw(). + * @iter: iterator function + * @iter_data: data passed to iterator function + * + * Iterate all active channel contexts. This function can only be used while + * holding the wiphy mutex. + * + * The iterator will not find a context that's being added (during + * the driver callback to add it) but will find it while it's being + * removed. + * + * Note that during hardware restart, all contexts that existed + * before the restart are considered already present so will be + * found while iterating, whether they've been re-added already + * or not. + */ +void ieee80211_iter_chan_contexts_mtx( + struct ieee80211_hw *hw, + void (*iter)(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf, + void *data), + void *iter_data); + /** * ieee80211_ap_probereq_get - retrieve a Probe Request template * @hw: pointer obtained from ieee80211_alloc_hw(). diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index dc28f2b0957a..c3bfac58151f 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * mac80211 - channel management - * Copyright 2020 - 2024 Intel Corporation + * Copyright 2020 - 2025 Intel Corporation */ #include @@ -2178,3 +2178,21 @@ void ieee80211_iter_chan_contexts_atomic( rcu_read_unlock(); } EXPORT_SYMBOL_GPL(ieee80211_iter_chan_contexts_atomic); + +void ieee80211_iter_chan_contexts_mtx( + struct ieee80211_hw *hw, + void (*iter)(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf, + void *data), + void *iter_data) +{ + struct ieee80211_local *local = hw_to_local(hw); + struct ieee80211_chanctx *ctx; + + lockdep_assert_wiphy(hw->wiphy); + + list_for_each_entry(ctx, &local->chanctx_list, list) + if (ctx->driver_present) + iter(hw, &ctx->conf, iter_data); +} +EXPORT_SYMBOL_GPL(ieee80211_iter_chan_contexts_mtx); From patchwork Wed Feb 12 06:22:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 864787 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 E30E01FBE9B for ; Wed, 12 Feb 2025 06:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739341396; cv=none; b=gsihy/7Yy5RIR+Qfmp8Ru5Nh0nwtTzJ8JLkcdjj+U/wRqoFm6pWyHApN0N/sPfL/oLXTt6fTkIop7Y/Qord6tnrvOTYa0/niTXMsFrlIYTauxPK88St++cm9CrFBqpFwkcafhu1kEx66OGpQ0jVIKxmw4c2u358qSzh3FH7tCWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739341396; c=relaxed/simple; bh=K3qLytahI/Hnwg89C2kqDbPswhNIvQMD8KpmS9BOANg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hmod6+81GTbxBx+s0c5tX+q9lSr76ObD37dixtWdY4ORa1BZ1yhDQsSCsNDzB5pIhLAU464NmiHpj1MczHpTvTc50PXN2Zh/D+Tq3r1r9tcCm5DRGH8eiHZZKM7c4zvCetfdF2/XLlI1A88rkWef4VZGah3dX8KYaC0pHqxRuX4= 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=jSyo7aYL; arc=none smtp.client-ip=198.175.65.15 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="jSyo7aYL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1739341392; x=1770877392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K3qLytahI/Hnwg89C2kqDbPswhNIvQMD8KpmS9BOANg=; b=jSyo7aYLmT+4WSb+utETw+sfUyPWbN527YwtOaBVKwi+3dkCHWesclm/ N2p+HGABmUX7hky+/GJjvdR65z12bOCojnbtZL5TPMudtSumKZz6vojae DAYtIDE8kuwWNBNvhEXOJZPyEFb02Wk1Q1ZcvMlWKoEAyzpT8kovYGh9z nV+Wret1iOVMMQkVZFZYmrQK6bSd7yRv3KKdOTKwJptr1azHvJKL8ZBdH fe0g0s6mQ4kZ/wv7eiLR47P7pB5GiUil/3OraTwF7bNfwA1S6KvbBXx2J XtT1Wbl1gdQCP2K38g5iTB48qjHhhF15p0Z62VCQ2noUoK1cgODrngieD g==; X-CSE-ConnectionGUID: zBECJ22SRHy3izn06KcUZQ== X-CSE-MsgGUID: njtjUZ+JQjWdPApTJ+JwVg== X-IronPort-AV: E=McAfee;i="6700,10204,11342"; a="43637630" X-IronPort-AV: E=Sophos;i="6.13,279,1732608000"; d="scan'208";a="43637630" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2025 22:23:12 -0800 X-CSE-ConnectionGUID: dCk4QNssT36rdsmnV7hGWA== X-CSE-MsgGUID: kwbULl00QZSGz2mazjR/DA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,279,1732608000"; d="scan'208";a="112944140" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2025 22:23:10 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 2/2] wifi: cfg80211: expose update timestamp to drivers Date: Wed, 12 Feb 2025 08:22:58 +0200 Message-Id: <20250212082137.b682ee7aebc8.I0f7cca9effa2b1cee79f4f2eb8b549c99b4e0571@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250212062258.454981-1-miriam.rachel.korenblit@intel.com> References: <20250212062258.454981-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: Benjamin Berg This information is exposed to userspace but not drivers. Make this field public so that drivers are also able to access it. The information is for example useful for link selection to determine whether the BSS corresponding to an MLO link has been seen in a recent scan. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- include/net/cfg80211.h | 3 +++ net/wireless/core.h | 1 - net/wireless/nl80211.c | 4 ++-- net/wireless/scan.c | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a72e7eb7027f..3580f3f5f44e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2947,6 +2947,7 @@ struct cfg80211_bss_ies { * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one * (multi-BSSID support) * @signal: signal strength value (type depends on the wiphy's signal_type) + * @ts_boottime: timestamp of the last BSS update in nanoseconds since boot * @chains: bitmask for filled values in @chain_signal. * @chain_signal: per-chain signal strength of last received BSS in dBm. * @bssid_index: index in the multiple BSS set @@ -2971,6 +2972,8 @@ struct cfg80211_bss { s32 signal; + u64 ts_boottime; + u16 beacon_interval; u16 capability; diff --git a/net/wireless/core.h b/net/wireless/core.h index 826299f3d781..b094b526b05d 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -180,7 +180,6 @@ struct cfg80211_internal_bss { struct list_head list; struct list_head hidden_list; struct rb_node rbn; - u64 ts_boottime; unsigned long ts; unsigned long refcount; atomic_t hold; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8bd09110d393..79b3f34e72e2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10519,9 +10519,9 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, intbss->parent_bssid))) goto nla_put_failure; - if (intbss->ts_boottime && + if (res->ts_boottime && nla_put_u64_64bit(msg, NL80211_BSS_LAST_SEEN_BOOTTIME, - intbss->ts_boottime, NL80211_BSS_PAD)) + res->ts_boottime, NL80211_BSS_PAD)) goto nla_put_failure; if (!nl80211_put_signal(msg, intbss->pub.chains, diff --git a/net/wireless/scan.c b/net/wireless/scan.c index cd2124329521..65c04d4bfc24 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -5,7 +5,7 @@ * Copyright 2008 Johannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2016 Intel Deutschland GmbH - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation */ #include #include @@ -1934,7 +1934,7 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, known->pub.signal = new->pub.signal; known->pub.capability = new->pub.capability; known->ts = new->ts; - known->ts_boottime = new->ts_boottime; + known->pub.ts_boottime = new->pub.ts_boottime; known->parent_tsf = new->parent_tsf; known->pub.chains = new->pub.chains; memcpy(known->pub.chain_signal, new->pub.chain_signal, @@ -2291,7 +2291,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy, tmp.pub.signal = 0; tmp.pub.beacon_interval = data->beacon_interval; tmp.pub.capability = data->capability; - tmp.ts_boottime = drv_data->boottime_ns; + tmp.pub.ts_boottime = drv_data->boottime_ns; tmp.parent_tsf = drv_data->parent_tsf; ether_addr_copy(tmp.parent_bssid, drv_data->parent_bssid); tmp.pub.chains = drv_data->chains;