Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1978027lqp; Tue, 16 Apr 2024 03:55:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlD58W7kRee31DBvAoedQ1gNjihzcdPcnmBHmUjWdEE2cbch1UxC8QXX3iWaEbG4Xo+WLyc/9QWrFcL1MURCPBVoKGFJxvObU0dVtE7w== X-Google-Smtp-Source: AGHT+IGLn69Cez5tC3LhO+qRnkLglM2GCMbwA4Gh0PKTomhudjashYFDrXEuhuHS4J9ZdbyOeXA9 X-Received: by 2002:a05:6a21:1f04:b0:1a3:6c9e:1e31 with SMTP id ry4-20020a056a211f0400b001a36c9e1e31mr11805954pzb.19.1713264924543; Tue, 16 Apr 2024 03:55:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713264924; cv=pass; d=google.com; s=arc-20160816; b=nb1oKprZPd4DdSkvK0LmfSmjIiIK9TX1GdjFR2nOnp75tO96ZE44HCm/ror5UYX0cp taQITkryt6T83CvvP6NCvKCOtqNXtRai7fFVopAU+zVo4s30/ioFdGvJuEGKktdAckzn /5PpqcwJZlAPa50KBMVi7oSLc34hcpOkXbt7d8TnjduAd/QdIn8NFJfsbXII8fYJjjdV iN5y7kZzn8pE6WTsAsD+wCWLZXp08Kb4tTxQU41P878HjjkEJG1vfqGbebSQEKFe9/nj Qg3gnGinnBK+pi3lClh/adPUPjPbsKeVOVihGUvckJq7fA6EjPh3Y/jfLMZkuBpuFiZY RcdQ== 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=xzjqkOV6yfviu9a0E0NAhTEQEYuIXBko32VbKQ/32EY=; fh=TquNsOiV+zNY1csTpltVB6A9QFW5SbuNs6JlqcKCQkw=; b=L4RlRTdCtyzXc4rwuBGHeRC7oZFchEmOJpaW4doQIjDfCJ7Vlho0oKqSm1cglAlET/ jw0to4ztAkpl1Lor5Fwb0KlpKSC3jV81r54SN5/spCyi2mnuHrPgXlxeBKWl0Gpca8md hvzMG6annBBrncm2z5R2ru8w1q7uSSymxXx3NI1QCceoPrdLqOuxWKyLyr+LUD6Q2Jrm xa+veGEIX7qY0AtBsE9OwP+qLbSBcC0fbceJSRkANLN0vSOTX+2xLSLIVsxuJ02KVyJB Qe9dD4hol9MouIPGZ05Gfv2+llytf6HLicMt9wt21k0vw11QepW2+atrwKKoh/V1urKA rQog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KE5O0DPI; 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-6387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6387-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 bv24-20020a17090af19800b002a1f9e74c23si5150383pjb.67.2024.04.16.03.55.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 03:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6387-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=KE5O0DPI; 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-6387-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6387-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 40B90281D45 for ; Tue, 16 Apr 2024 10:55:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 222D6128807; Tue, 16 Apr 2024 10:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KE5O0DPI" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 7D4F2127E32 for ; Tue, 16 Apr 2024 10:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713264884; cv=none; b=PKtMfLbwaazNNhc2FxfW28XNj4kfNwQ8gbhhDJSCWWskBm9jF937Qzk53UUEifOtxjFmh9jTXHj3T5+vIOJi/nQlyPiS/HuMZxCWHESlc8cw1uJxnilyub1blPc3RdxpwcegcbHALN+36KMNmwLPf0jrYaivvFAvXNMiLCsEhw4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713264884; c=relaxed/simple; bh=6JFOi7rW2E67w13fLzZKE23FbHnQp6+kapanCUHT9c0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nEzeSfP+fuGJK4s4UDzzDSNp65FkXb1KyOY7uma1CRxkWbspXrLpxlsET6IyGy/cbiG6J9di5GcljbnpLqJf6anlPCICqZj4Feer5Cp4xPRzJW5HPohDaWxy5qQwk0PAQwVgimxrudIRjc4O6g6/IPhFr6zXU38wWiM1lNo8g3A= 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=KE5O0DPI; arc=none smtp.client-ip=192.198.163.17 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=1713264883; x=1744800883; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6JFOi7rW2E67w13fLzZKE23FbHnQp6+kapanCUHT9c0=; b=KE5O0DPI4WeaX+CdGlJ08pFwTSYmbwPUxot4d8GBKbv8XBmlzG//FbGo xr+WbwaZsmaQuqusl9IZY/vK28tMsMhom0TuqeEscxvTlR1yFf+i42dMO 6lY9VuCWmGP8NDmPG6QZwB5tN3TeMlBNswGt1Op4M+stTIUo7QlfgyJWg z4OB4aY1LeDDk7j4wHXn2NEPuu76L7DCujhAYjZXjfDvn+OiArgl5N3RY bOOLxAoI6LiyT3N6aUzXSL0vllmngA9fZLeX8M7QIw4JfkLmn8O6A4xfX 0KmlL3HUN927RezTxo/Kium1eWdI1ioojYuUW3ArfHCv0uSzRcGUzX6OR A==; X-CSE-ConnectionGUID: 03w3B7YZQBuIVuaWgFfb2g== X-CSE-MsgGUID: qX6ZlN7ASXKeH4trIq5QJw== X-IronPort-AV: E=McAfee;i="6600,9927,11045"; a="8556057" X-IronPort-AV: E=Sophos;i="6.07,205,1708416000"; d="scan'208";a="8556057" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 03:54:41 -0700 X-CSE-ConnectionGUID: GsDqfJh0ScKYLloL7tuA2Q== X-CSE-MsgGUID: Oc2HNAlRRSiv/d2NlErozg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,205,1708416000"; d="scan'208";a="26872538" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 03:54:39 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 10/16] wifi: iwlwifi: mvm: init vif works only once Date: Tue, 16 Apr 2024 13:54:05 +0300 Message-Id: <20240416134215.ddf8eece5eac.I4164f5c9c444b64a9abbaab14c23858713778e35@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416105411.706221-1-miriam.rachel.korenblit@intel.com> References: <20240416105411.706221-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: Johannes Berg It's dangerous to re-initialize works repeatedly, especially delayed ones that have an associated timer, and even more so if they're not necessarily canceled inbetween. This can be the case for these workers here during FW restart scenarios, so make sure to initialize it only once. While at it, also ensure it is cancelled correctly. Fixes: f67806140220 ("iwlwifi: mvm: disconnect in case of bad channel switch parameters") Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 19 +++++++++++++++++-- .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 2 ++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index a9bcf235cde9..efe9205a7cf2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1612,6 +1612,17 @@ static int iwl_mvm_alloc_bcast_mcast_sta(struct iwl_mvm *mvm, IWL_STA_MULTICAST); } +void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif) +{ + lockdep_assert_held(&mvm->mutex); + + if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) + return; + + INIT_DELAYED_WORK(&mvmvif->csa_work, + iwl_mvm_channel_switch_disconnect_wk); +} + static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { @@ -1622,6 +1633,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, mutex_lock(&mvm->mutex); + iwl_mvm_mac_init_mvmvif(mvm, mvmvif); + mvmvif->mvm = mvm; /* the first link always points to the default one */ @@ -1703,8 +1716,6 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, mvm->p2p_device_vif = vif; iwl_mvm_tcm_add_vif(mvm, vif); - INIT_DELAYED_WORK(&mvmvif->csa_work, - iwl_mvm_channel_switch_disconnect_wk); if (vif->type == NL80211_IFTYPE_MONITOR) { mvm->monitor_on = true; @@ -1742,6 +1753,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, struct ieee80211_vif *vif) { + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { /* * Flush the ROC worker which will flush the OFFCHANNEL queue. @@ -1750,6 +1763,8 @@ void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, */ flush_work(&mvm->roc_done_wk); } + + cancel_delayed_work_sync(&mvmvif->csa_work); } /* This function is doing the common part of removing the interface for diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index 2a7d7d4e0649..61f4c5dc3cec 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -14,6 +14,8 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw, mutex_lock(&mvm->mutex); + iwl_mvm_mac_init_mvmvif(mvm, mvmvif); + mvmvif->mvm = mvm; /* Not much to do here. The stack will not allow interface diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 3b726c8b9261..edeea988e819 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1805,6 +1805,8 @@ int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm); int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm); +void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif); + /* * FW notifications / CMD responses handlers * Convention: iwl_mvm_rx_ -- 2.34.1