Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1164283lqb; Thu, 18 Apr 2024 01:53:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUH6dAXd92LEJC2GRSI+ua/Q8ZIES2xdQkp0R6DNYDKyL2SaiR8tqXj1uq2ADgufBjLZ+Jpmm35DmNZyU5+4ATh8Ej3rXDbAerlY9GWYg== X-Google-Smtp-Source: AGHT+IFf3aakZmSYVEE959hHmaIpDL9pIQYNl3CpUi1+Z+s6EwyzR6JqGGXr6MHGiclguDo3zWUH X-Received: by 2002:a17:906:1b15:b0:a55:55b9:57d1 with SMTP id o21-20020a1709061b1500b00a5555b957d1mr1277758ejg.66.1713430380698; Thu, 18 Apr 2024 01:53:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713430380; cv=pass; d=google.com; s=arc-20160816; b=ETiyX3RhsaOKGQ5XMJnda8WHpv9Sx4Lu/US/H0RnwOU7QaMdhThFZIxOdzivY8Ycui DlKvAphvlf1+7QG2ZhwfK7xFNgI0Vywr+M6zQG23comW4uWFin0cE9VS/kDyF1UVrGu8 /RgYRBQt3VOjZmRfOtj1ZE2KGXgYKfjUuTeF7MuTbZQPbpqkkzcUAlyDsz07aThQkCX2 KbkCvzaqc149pCQ05QfZGtbSCHO/HHYKSUVeQQlRW34WuLbF6ShDMq7yylnwCKL9gyTZ PTK9dlh1Ln7gCRnac+EzeTl6e3tdGeBzp0W3Tr9l3mDRT9Pgp6Vp2YsAKevYhfeFxXMu /WtA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=VyBcvUdkHv130+nutZFFWhe86AxTJkftAD0IEJ1h/Zs=; fh=0ZKV22Mpi0Z+/zRlCC9GRUAKl0wLMxmYgR1nXO1NAEs=; b=KL+aqDM2NrAYhavnPIR3b5kk9vt2eQJZZeu+Jovmv/yPlm2qxQuSuMtR/t8O7rQwJl Ef+aRFlGBc6DcC19qXk6140ObC9kqyXfdng7nyOhv/TSfySz8UsqMR1T1Cg3RiNrOOEh drl/5nSgqZuZ18x8jWc9GKR6C8heKt2kC95ZQxFu5gZgd4HaYFlQlwMfgVizApKFhSSY Wyhy8G+47pAvbLpXfADDW4M+Fv0PbsZV07twr3FshJp1vm5jrH01qmZcWA04chs62ham fJDabnGNf9xLiQ/Fh7WesY9frjsMMw4IynoPXSSCo0niZ7NVhUaSW9ayHXhOStG6MRZe AC3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=gavP0t2T; 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-6509-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6509-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4-20020a170906310400b00a52277dbe76si586306ejx.854.2024.04.18.01.53.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 01:53:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6509-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=pass header.i=@sipsolutions.net header.s=mail header.b=gavP0t2T; 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-6509-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6509-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6429A1F218A9 for ; Thu, 18 Apr 2024 08:53:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0338815AD82; Thu, 18 Apr 2024 08:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="gavP0t2T" 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 651DB15A499 for ; Thu, 18 Apr 2024 08:52:32 +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=1713430356; cv=none; b=RjRhi688cAqw8gL9vMREdVybSeIOEm9uGeMDA8P+8UXwM/apCMkirfFww6JvGgtFBbTs5UNzzYazIl2VSveIFFxmooy8bodOpAnNhkcScX+GelxtDXSuA2i116MOAsD0zmKf80Us01ieb3/OST3d7ebHmb1LVC5qEXqEuk/bZ+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; c=relaxed/simple; bh=ic1msN5tmISeUCdOjVCKVfBcVNyyzBxWsBminIYjo1o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BDdeuodQLjN8eMTH2GS6rLxxr1FQOCqElzcQ1SvgclMn2pkYAjwcUb7BIGloF1+sG1TdXPoCRh1oOafOjFOXf52TKJVPBGMx00FPwCMWx2aZifffnVhchpuTY0jC6/PptYelN/lDQcWVWECzOhAQP1AwiJV9+2RQVUfT1dFHGow= 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=gavP0t2T; 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: 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:In-Reply-To:References; bh=VyBcvUdkHv130+nutZFFWhe86AxTJkftAD0IEJ1h/Zs=; t=1713430353; x=1714639953; b=gavP0t2TQbZ0aW0npn0XUkRz41LWgNPQHvaP2j4J36ebP6nfspoGfHHztcRXqzn9Ui3a8OygHX/ 4UvqVRU8z7jGyH8Q7tFWkDIv3zfS4+hnTVhNbl6xcyL9jW6asyQm9S3C1IVC4sPdaNhgcHyBe5kim mzi+1TxpPGxXnnu6yhOw1Nv9jS0KpjH+PsuZvYSxwOFsqZFut4dW5d8FBMhp85Dh92ZvORvRhQ2bb WPowEzU2fivAnkZSm/r6EnMpZqBV6piLixtBeuB6ugys+YK7V+n/5kr7NqxOKU8fG+EvMui/LTjGf 97qz4ASmyaAMgkQu9FIDL+AL9AB1GIt2SLOw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVI-0000000CIvO-156A; Thu, 18 Apr 2024 10:52:24 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 1/8] wifi: mac80211: fix idle calculation with multi-link Date: Thu, 18 Apr 2024 10:52:19 +0200 Message-ID: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> X-Mailer: git-send-email 2.44.0 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 The vif's idle state doesn't automatically go to true when any link removes the channel context, it's only idle when _all_ links no longer have a channel context. Fix that. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/chan.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 80e4b9784131..ccacaed32817 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -797,6 +797,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, struct ieee80211_local *local = sdata->local; struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx *curr_ctx = NULL; + bool new_idle; int ret = 0; if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN)) @@ -829,8 +830,6 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, out: rcu_assign_pointer(link->conf->chanctx_conf, conf); - sdata->vif.cfg.idle = !conf; - if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) { ieee80211_recalc_chanctx_chantype(local, curr_ctx); ieee80211_recalc_smps_chanctx(local, curr_ctx); @@ -843,9 +842,27 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL); } - if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && - sdata->vif.type != NL80211_IFTYPE_MONITOR) - ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE); + if (conf) { + new_idle = false; + } else { + struct ieee80211_link_data *tmp; + + new_idle = true; + for_each_sdata_link(local, tmp) { + if (rcu_access_pointer(tmp->conf->chanctx_conf)) { + new_idle = false; + break; + } + } + } + + if (new_idle != sdata->vif.cfg.idle) { + sdata->vif.cfg.idle = new_idle; + + if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && + sdata->vif.type != NL80211_IFTYPE_MONITOR) + ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE); + } ieee80211_check_fast_xmit_iface(sdata); -- 2.44.0