Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp408372lqp; Wed, 12 Jun 2024 05:34:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfPVH1YGPzQtlj5CV/cyGEB5ZeS6yIbEMPJ3RqSzdl7nK1lLppJ/+MVnMzEIez5flpfYBkAZxYO17t/nANjDpTQeMhmQ0U1/4nN9LyPA== X-Google-Smtp-Source: AGHT+IGkDvRxtIRi369uw9x9ODNY1szDbD4SWInpuAIZvXM3hKS4xpIkq/Q7CT8Ysj5sn27weKJA X-Received: by 2002:a05:6808:2120:b0:3d2:1c26:74c5 with SMTP id 5614622812f47-3d23e1ad64emr1974284b6e.37.1718195680236; Wed, 12 Jun 2024 05:34:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718195680; cv=pass; d=google.com; s=arc-20160816; b=s7I0N7gOi2lkG9iDKyz292Gw1NqgS0Lg3dG3b5DkXjo4KjHQxoUbaM2PJ91k5XsQ50 6Ipqc9kK53AIhNCeD5n+lyoUstkjyVWyGuDJPCfp9o6vZn9WP0hN0E2SOHHuKl+wrxP9 NZYj2BHyhHLmhSxVt1HWypiHUBoRLN6taBio1t4jPslxayzfHx4XFbJPfpNEt3prV2/R Jpr50DSOtjDbBIMwDsOafziugRuj+6c6dU7JXw3nd6/ZNrAs49b0CFsMOnfYPc5encaA Fb3J8ER9T3Us36xYeOzENNEkZlG5JXNfTxCGkrSj878JkwAxVMJjvruD1kInlhK8KHLf u34g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XqbOh2EGOBkOOEQRUxV6dA7QNGUI8SulRh/n39nQ1Ig=; fh=0ZKV22Mpi0Z+/zRlCC9GRUAKl0wLMxmYgR1nXO1NAEs=; b=EH48sS02z5Jw+xHg/M4UAd+Vc+IbvUp1racCXBHunrEtMWy/qOFtSNqVmOvYCFhz0p dd4nxyfbs5XuT+eQDww5C+NpLLi5nbbGCPcACeeFrT8j/l0gJshvGQGSM6WfM3HhT9Wz mQclA2Q5OTSIFjjPAADpQznJwv2YZLSGp4+0HCUe5WRccEIrS5JU/tZmw1PHwcPrxsbA 0Dl4ZRdIdjgcsFrVnazjcWGwbEvzpV0W7keenA7k0NJPXsxVzkfe1IMg6DvajlU+ccr9 mvyBGcNhoNrnfjl7OC0MAoUxBv6X8gMZkeCVXXtCOSEPAHUK6hw5X/P9tELFThV7SIxJ +hbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="N2BG2/lU"; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-8871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-4412ff3cc3dsi53561331cf.758.2024.06.12.05.34.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:34:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="N2BG2/lU"; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-8871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E553E1C20F34 for ; Wed, 12 Jun 2024 12:34:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 881BE171070; Wed, 12 Jun 2024 12:34:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="N2BG2/lU" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.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 E2D3F170835 for ; Wed, 12 Jun 2024 12:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718195667; cv=none; b=c/9HQDFVtkhs62FKMrMDW0mFQbZBC70e7j0Z8wArmLURXnoBON5zqxOfdEQ0q0+HWpPz5GoZ/tUVvh7X+MZWvoyaEkY2x4Q2ouXmeVB/3/mQXUQCuGBNxW7HaQ5woQghi7Ov5i96MUkQWmOU/ZmFZfhe3jXxdvsIgFAX9YS7muY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718195667; c=relaxed/simple; bh=ViPg+b77dY/b7ADHoGyE5QHAzkhi4MrEt//yHLk/xqM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9qJKvpHipxl6ARWIcl1a5tiPGvt9pGPJj4+PLJfGJheX353Che4IAGwnq0bAGq/pIAGz+XxBgIL5cqi3RpoZzDUKb+n3HpB3dXj3oK/fw49bkpCztQbjEIJW78/w/XznDNdNYnxesS4DUjipsOw1OeYM6q4Vrw3r25HOJrV7UE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=N2BG2/lU; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=XqbOh2EGOBkOOEQRUxV6dA7QNGUI8SulRh/n39nQ1Ig=; t=1718195666; x=1719405266; b=N2BG2/lUMltj6GHCZoj0cuabQwdB2Q834cy/SgtouenmGl2 YBU1q1rr8gzD6+F6ULmiSSQJDvrttKvcEwMCLraMtbR18rrMYwkr+0Z4VDaaLhB7v3dVxZ1edxs8q +lM23uky5noftG3QTSvj2S5TNYKnqCLX3zs1UYhN0xMG0wV4+8UASNPMASsEcycLqxNPJS5B7wfFg M7wdA8vOEYVq4UXs4oiSsrWD0mVgYt2o+UrTsp/F2Mnw8zkAPlEb7PbDJSqHcZ1TVgUKMj7wXGXx4 IS0CnefYKMwLPLc9V4eXIOjxwK+mc9P2xQIT0pLJCWIb7DnVZxbgcOb1hhl/z5Mg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sHNBG-0000000AGkC-462a; Wed, 12 Jun 2024 14:34:23 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH 3/4] wifi: mac80211: make ieee80211_chan_bw_change() able to use reserved Date: Wed, 12 Jun 2024 14:32:05 +0200 Message-ID: <20240612143418.1a08cf83b8cb.Ie567bb272eb25ce487651088f13ad041f549651c@changeid> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240612123418.37295-6-johannes@sipsolutions.net> References: <20240612123418.37295-6-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg Make ieee80211_chan_bw_change() able to use the reserved chanreq (really the chandef part of it) for the calculations, so it can be used _without_ applying the changes first. Remove the comment that indicates this is required, since it no longer is. However, this capability only gets used later. Also, this is not ideal, we really should not different so much between reserved and non-reserved usage, to simplify. That's a further cleanup later though. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/chan.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index ec16d7676088..a42ab3179d99 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -396,12 +396,9 @@ _ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, return IEEE80211_CHANCTX_CHANGE_MIN_WIDTH; } -/* calling this function is assuming that station vif is updated to - * lates changes by calling ieee80211_link_update_chanreq - */ static void ieee80211_chan_bw_change(struct ieee80211_local *local, struct ieee80211_chanctx *ctx, - bool narrowed) + bool reserved, bool narrowed) { struct sta_info *sta; struct ieee80211_supported_band *sband = @@ -418,13 +415,17 @@ static void ieee80211_chan_bw_change(struct ieee80211_local *local, continue; for (link_id = 0; link_id < ARRAY_SIZE(sta->sdata->link); link_id++) { - struct ieee80211_bss_conf *link_conf = - rcu_dereference(sdata->vif.link_conf[link_id]); + struct ieee80211_link_data *link = + rcu_dereference(sdata->link[link_id]); + struct ieee80211_bss_conf *link_conf; + struct cfg80211_chan_def *new_chandef; struct link_sta_info *link_sta; - if (!link_conf) + if (!link) continue; + link_conf = link->conf; + if (rcu_access_pointer(link_conf->chanctx_conf) != &ctx->conf) continue; @@ -432,7 +433,13 @@ static void ieee80211_chan_bw_change(struct ieee80211_local *local, if (!link_sta) continue; - new_sta_bw = ieee80211_sta_cur_vht_bw(link_sta); + if (reserved) + new_chandef = &link->reserved.oper; + else + new_chandef = &link_conf->chanreq.oper; + + new_sta_bw = _ieee80211_sta_cur_vht_bw(link_sta, + new_chandef); /* nothing change */ if (new_sta_bw == link_sta->pub->bandwidth) @@ -466,12 +473,12 @@ void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, return; /* check is BW narrowed */ - ieee80211_chan_bw_change(local, ctx, true); + ieee80211_chan_bw_change(local, ctx, false, true); drv_change_chanctx(local, ctx, changed); /* check is BW wider */ - ieee80211_chan_bw_change(local, ctx, false); + ieee80211_chan_bw_change(local, ctx, false, false); } static void _ieee80211_change_chanctx(struct ieee80211_local *local, @@ -505,7 +512,7 @@ static void _ieee80211_change_chanctx(struct ieee80211_local *local, * due to maybe not returning from it, e.g in case new context was added * first time with all parameters up to date. */ - ieee80211_chan_bw_change(local, old_ctx, true); + ieee80211_chan_bw_change(local, old_ctx, false, true); if (ieee80211_chanreq_identical(&ctx_req, chanreq)) { ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for); @@ -536,7 +543,7 @@ static void _ieee80211_change_chanctx(struct ieee80211_local *local, drv_change_chanctx(local, ctx, changed); /* check if BW is wider */ - ieee80211_chan_bw_change(local, old_ctx, false); + ieee80211_chan_bw_change(local, old_ctx, false, false); } static void ieee80211_change_chanctx(struct ieee80211_local *local, -- 2.45.2