Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp83900lqp; Wed, 20 Mar 2024 14:32:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU2w1c2RX2bHqud62zEyJe8VL4z1n7ZiWxcdo/onyzjMIcrayfE2+9u7dom6eWbvtt0GWFnSJcavNyON6DzbLBt9EfmXZkp+EzHtjHnKg== X-Google-Smtp-Source: AGHT+IHAlzFHhvBXYsQHCY62YseZa92PPoI4rydC8AGnT1JhHAu4lpg82cOQQGG/xkV6jdYlrbzu X-Received: by 2002:a05:6a00:2d28:b0:6e7:4605:12d4 with SMTP id fa40-20020a056a002d2800b006e7460512d4mr270131pfb.3.1710970367673; Wed, 20 Mar 2024 14:32:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710970367; cv=pass; d=google.com; s=arc-20160816; b=yji8JsFMnXqEkPWBBElNS+UGxdk0NrsIlS9226COuwCxsHrlxN5b5CtEvqt1N/Qjw2 sY8YR3XkJbK5cdmRPPwclRX3V/I3u/DwUBgn5ALEyCgOhy2KdyzZy2oaWi9ysjIwXcir garkQSWnq6QlbfK6EWcp6up6D+Uf7Pa+0RfF6H5QxSE1AVaOzhZT5Qu4HlWAEeqhMoKW gQfmEdQG8TBZoYcL2V0ieNxkTl7YXGEEHwNjlbvMLXP9Is/mXiT9cKo+RhcNac5iNpMY l7c26hNUGHo3f+CLc8m7SanTfSopd2v2gxq3hqbprr7H7WLnLMnn1ym6j4XYTFJI4wNA mxmw== ARC-Message-Signature: i=2; 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=55Koo4GeG3ERzWVB536/jPp9JZrtgEr05/7O93MmQcM=; fh=cP96cs9K3X2Q+lH/xjkrH8lK/6zZ8UeeH1/SHyTX/1g=; b=UkcEZ09cJDFRnyUzjwoIYA+/B921gRVDs36AmBM1hbvZ2qmgz/N9VxiMfjlgAdgNpu AGOS3O1ScB/aQ61KultJSPDsneV3gc9MYSMmILUSIkq52WVLO+5tJRf5kDRp4NuNYl4n XdCVkX8KLCeDIfl/F04aN9udVWFObyHCmXizBAFtfPPaSupj/bYX1gjFXLwRbOj/2wxP N/AJWlCP9c/gJHwRWV/P4uBtNWOCR25i8h8TEgLi7SR8Ag4hf7cePs486iX78QXm66u8 unP4IkdVeoAb0I5q5LipkJaa1hfKrEDSWHeYR2UneHNsHMeZ5ytYezqZ/eBWXcO4AhtW VW0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1RXqf8n; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-5047-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t23-20020a056a00139700b006e79a5b1199si2249583pfg.35.2024.03.20.14.32.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 14:32:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5047-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1RXqf8n; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-5047-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5CD072842B0 for ; Wed, 20 Mar 2024 21:27:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2170F36B08; Wed, 20 Mar 2024 21:27:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I1RXqf8n" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 55B3D85C7A for ; Wed, 20 Mar 2024 21:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710970020; cv=none; b=FXmXDdVmRlzmGTSQxj4f7GXptL5jg2Riw0e1ufmtizrto9u4n7zdH36DKGNCp5XfBJsFga6RP7LMv5cg2DoOzW/NaoiX4wIvxQPhoXI6sEC139HvWwq4spYGIadQcqJW7j7YowzUrRSKrZXzTgYR0zHjtbzdQt+2w2W7xbrxoBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710970020; c=relaxed/simple; bh=fcJ8CrsPRAVXFoZQOM98OWVdso0c02n6BbLCezAtY1c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n/RJwbtdW7WWz+h92OVtMwJoqLXCLwNXlqmJaMt8FWR3fVzbhahl8/X3pGqw5GqSq1jWVIQSFCa3QYhu62pbyxJ23PgO4cTizYFz9cg/xVTMJ9RIPAX8wD0P9cP0xY8UDUdD+He5u3YaeXSYgFCQGPxpnSi2zMWqRVxc30UBSGE= 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=I1RXqf8n; arc=none smtp.client-ip=192.198.163.12 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710970018; x=1742506018; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fcJ8CrsPRAVXFoZQOM98OWVdso0c02n6BbLCezAtY1c=; b=I1RXqf8nULGK7U0cnGKrPOboKdCzUAkLmGE0k9S4A6rWWWtiSP4tnWJf MiS+HvR4i0G3UGbN7wUx+xPlVQit/cJL74oDbFwkeSxWbW17GqK6zZYsZ F0jRv1Oz9jRp/9KvBZ46dCB9VsID9OBWWJkimdq/b4m3Q3xBm3EC6Q8D+ UMt1LaQQH6JURzbiJvgj6VY5xqglLPAHVUeqRIPuDJUdJMiTaYq+Pm67X GybsXj6v4lEO689+szCgTMrzLHgdpcYh9mIXTGWRrojHq9HvYz/g+zc0x cVYvUi1WrAWyGoFIe/vFmWj8m8mWqrPBkNRjDIrVEEwLoEnEKgZYuz2vJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11019"; a="9698057" X-IronPort-AV: E=Sophos;i="6.07,141,1708416000"; d="scan'208";a="9698057" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 14:26:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,141,1708416000"; d="scan'208";a="14184120" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 14:26:56 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg , Johannes Berg Subject: [PATCH 04/17] wifi: iwlwifi: mvm: fix active link counting during recovery Date: Wed, 20 Mar 2024 23:26:25 +0200 Message-Id: <20240320232419.55f37339e7d1.I57006568a90ffb7a1232def1b2f3264dea711ba6@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240320212638.1446082-1-miriam.rachel.korenblit@intel.com> References: <20240320212638.1446082-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 During recovery, the chanctx_conf in mac80211 is still non-NULL even though the channel context has not yet been assigned again. In that case, the real count is actually lower. Switch to instead count the phy_ctx assignment and ensure that the assignment is cleared at the start of recovery. Fixes: 12bacfc2c065 ("wifi: iwlwifi: handle eSR transitions") Signed-off-by: Benjamin Berg Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index 084314bf6f36..d18304ac126c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -189,17 +189,13 @@ static void iwl_mvm_mld_mac_remove_interface(struct ieee80211_hw *hw, mutex_unlock(&mvm->mutex); } -static unsigned int iwl_mvm_mld_count_active_links(struct ieee80211_vif *vif) +static unsigned int iwl_mvm_mld_count_active_links(struct iwl_mvm_vif *mvmvif) { unsigned int n_active = 0; int i; for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) { - struct ieee80211_bss_conf *link_conf; - - link_conf = link_conf_dereference_protected(vif, i); - if (link_conf && - rcu_access_pointer(link_conf->chanctx_conf)) + if (mvmvif->link[i] && mvmvif->link[i]->phy_ctxt) n_active++; } @@ -245,18 +241,18 @@ __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm, { u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; - unsigned int n_active = iwl_mvm_mld_count_active_links(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + unsigned int n_active = iwl_mvm_mld_count_active_links(mvmvif); unsigned int link_id = link_conf->link_id; int ret; - /* if the assigned one was not counted yet, count it now */ - if (!rcu_access_pointer(link_conf->chanctx_conf)) - n_active++; - if (WARN_ON_ONCE(!mvmvif->link[link_id])) return -EINVAL; + /* if the assigned one was not counted yet, count it now */ + if (!mvmvif->link[link_id]->phy_ctxt) + n_active++; + /* mac parameters such as HE support can change at this stage * For sta, need first to configure correct state from drv_sta_state * and only after that update mac config. @@ -416,7 +412,7 @@ __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm, { struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - unsigned int n_active = iwl_mvm_mld_count_active_links(vif); + unsigned int n_active = iwl_mvm_mld_count_active_links(mvmvif); unsigned int link_id = link_conf->link_id; /* shouldn't happen, but verify link_id is valid before accessing */ -- 2.34.1