From patchwork Wed Jul 3 03:43:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13720913 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 2FF18224D1 for ; Wed, 3 Jul 2024 03:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978211; cv=none; b=tknUqae+nsRTcpZggFr23I0+EUBgwuAP7dd9vPOoj2bkqn6d1YQSldNAtJLmdsMP7zT4u9HPnFsy7pdETEj6scMLNlpm4SmlEBJRT9nq8CqfKJJ/jZpGIcgdFXSS92jGWP8+q3h7yoE/HhCH50fBt2L8jz3BiG87hBRuUbrJqeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978211; c=relaxed/simple; bh=rxkY6yust3JXy2TrIqy/PaFaZ3iMSz4YF1gmAPLvUcI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bAow6HfeM1yJkcRmceBlFX+7+tAlaHRUlUhE9gYL5wbEbm5si4hS8+150j96PwaVv28VQ0ZV7RVlPlMReVrtP38g9LtQVeulMBsZ2826Q84iM/SngOyiyYDLaJcZUsO1DM0S5YRJvw6aIKAYWSrEo949Z5/On0d0oVugzSQhkPg= 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=ZRNXv2ta; arc=none smtp.client-ip=198.175.65.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZRNXv2ta" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719978209; x=1751514209; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rxkY6yust3JXy2TrIqy/PaFaZ3iMSz4YF1gmAPLvUcI=; b=ZRNXv2taainZOjIyQywMAE/qRFUhYHVRP+uwHspwYyrOUl/xv/TQo5Io mOGgodw0ES3tS87/wYFRJqYcZFiuAYkmQZCia22xWgaGnmPa99OuZnYRx mNDuOGJz8PQ7ViCC9yxjW+XJnaGO6u7YOk0DceyyrQja6PKDJNwIkYojc QAVpoVb9bR54jtukC8hdfnsRzKhQi8+m596quFW+OYqrve1VoERPGdaJO GDkKr644RckYXcQSBJ5acqO2/rqxbtUc5aVJ8DVBGXoFQSs2N3KcLaotD 9SPI8n75WqOCul+3xNE5XtdyfmNo7swihTQ5Rszehw1iFO649qmVm7RwU w==; X-CSE-ConnectionGUID: 6YUFWa7ISDSiYHVyAb4nEw== X-CSE-MsgGUID: QvYxt3qhRVW7lrk4+Pb2GA== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17304037" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17304037" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:29 -0700 X-CSE-ConnectionGUID: Xq6HUHqWTWK1CCMbtq4vjA== X-CSE-MsgGUID: 4tUM46gBQGWzry9mnlMbdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="51291062" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:27 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Daniel Gabay Subject: [PATCH 1/5] wifi: iwlwifi: properly set WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK Date: Wed, 3 Jul 2024 06:43:13 +0300 Message-Id: <20240703064026.a0f162108575.If1a9785727d2a1b0197a396680965df1b53d4096@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703034317.595020-1-miriam.rachel.korenblit@intel.com> References: <20240703034317.595020-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: Daniel Gabay The WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK should be set based on the WOWLAN_KEK_KCK_MATERIAL command version. Currently, the command version in the firmware has advanced to 4, which prevents the flag from being set correctly, fix that. Signed-off-by: Daniel Gabay Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 18ce060df9b5..b1e6d4eee68d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -654,7 +654,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, - IWL_FW_CMD_VER_UNKNOWN) == 3) + IWL_FW_CMD_VER_UNKNOWN) >= 3) hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK; if (fw_has_api(&mvm->fw->ucode_capa, From patchwork Wed Jul 3 03:43:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13720914 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 930E717BBE for ; Wed, 3 Jul 2024 03:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978212; cv=none; b=LUbhq8uGmDsfBgJ931CnvD/18JGqMfCX4gwVjq1iCGLN5LAvjbgH5fHw3DQeaKnX4JcLtY96Sa5sx9/ufbVTRSWCRFtY/4RAKq6jcADEic98iuuDlYyidL6EwWFVD9KqUNP3jL4XMymcq/CJBOZ7idh1o3CIMsHuB0ULw0S1oC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978212; c=relaxed/simple; bh=d1LBJFOV9RiLlyT6QZGIf814dNeSg88ky26RZtUypcc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b8ejCzDULiNS9uGCuH5YjrCJj2S7Z26tFNgHWXF4Z8NDCAL+A6LQ6HIJQPYaWGUYAmBtyXIq8SkJrG8b95c3aKJlBIRtgqIFs4NcZoVtHsD0tYOMcdtc7kp0c5KR9Wq6mtWN1GyA1n9U87KnQEsFWkckffXfjL1wOggraQ9BnSQ= 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=PiC93lKy; arc=none smtp.client-ip=198.175.65.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PiC93lKy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719978211; x=1751514211; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d1LBJFOV9RiLlyT6QZGIf814dNeSg88ky26RZtUypcc=; b=PiC93lKyC3Jw08s48EOebE6md4b9v0FQZynZ0px+N868Fyexc3pHKJJj TPlV0zGjmEaO880ep7+hTZ52bVDCcBTSHOA+XZz96Ksg02fvGxCa9rj75 lV7fb9CEoAJ+j4uTHgYWY0OK8qbF82O26oWDt7S60BICIfY90pto1A4z5 zWpc5/gC4WpiMzUnoTSRw6LWZQR0NSrKR2jjNcRH59rstZuzJQ5H/7Qi3 f8K95viAVpIG/dkRvMkC+xTZJHnY+/h1fUYjXdyr4cayzCc76VV8T7uNl RUaTceIjP4PjddR6tMmfyw2UJvAV9+8pPhzjW3rhlSX6Z8JHUICPKYJt3 Q==; X-CSE-ConnectionGUID: hmxp5zKzSVe2rYHS+ZGMvQ== X-CSE-MsgGUID: dbb4+zFHTgO22uqLR5zEww== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17304041" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17304041" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:30 -0700 X-CSE-ConnectionGUID: kZDIkayGSE6UWVrdJCSAvw== X-CSE-MsgGUID: cFPcqZBjTS+7U2Ag7TrPkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="51291065" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:28 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Ilan Peer Subject: [PATCH 2/5] wifi: iwlwifi: mvm: avoid link lookup in statistics Date: Wed, 3 Jul 2024 06:43:14 +0300 Message-Id: <20240703064026.346a6ef67a86.Iba5d65d728ca9f58518c88d029496c1250670544@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703034317.595020-1-miriam.rachel.korenblit@intel.com> References: <20240703034317.595020-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: Johannes Berg We already iterate the link bss_conf/link_info and have the pointer, or know that deflink/bss_conf is used, so avoid an extra lookup and just pass the pointer. This may also avoid a crash when this is processed during restart, where the FW to link conf array (link_id_to_link_conf) may be NULLed out. Fixes: c1e458b987f2 ("wifi: iwlwifi: mvm: Move beacon filtering to be per link") Signed-off-by: Johannes Berg Reviewed-by: Ilan Peer Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 4fa8066a89b6..773cc2bdcb0b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -557,12 +557,10 @@ struct iwl_mvm_stat_data_all_macs { }; static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, - struct iwl_mvm_vif_link_info *link_info) + struct iwl_mvm_vif_link_info *link_info, + struct ieee80211_bss_conf *bss_conf) { struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(vif)->mvm; - struct ieee80211_bss_conf *bss_conf = - iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, link_info->fw_link_id, - false); int thold = bss_conf->cqm_rssi_thold; int hyst = bss_conf->cqm_rssi_hyst; int last_event; @@ -670,7 +668,7 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac, mvmvif->deflink.beacon_stats.num_beacons; /* This is used in pre-MLO API so use deflink */ - iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); + iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf); } static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac, @@ -705,7 +703,7 @@ static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac, sig = -le32_to_cpu(mac_stats->beacon_filter_average_energy); /* This is used in pre-MLO API so use deflink */ - iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); + iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf); } static inline void @@ -921,7 +919,8 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, mvmvif->link[link_id]->beacon_stats.num_beacons; sig = -le32_to_cpu(link_stats->beacon_filter_average_energy); - iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info); + iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info, + bss_conf); if (WARN_ONCE(mvmvif->id >= MAC_INDEX_AUX, "invalid mvmvif id: %d", mvmvif->id)) From patchwork Wed Jul 3 03:43:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13720915 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 ABEFB18042 for ; Wed, 3 Jul 2024 03:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978213; cv=none; b=ZI+swxr0OBG+2xta9AqIqrIN7p9Fn2sGzgqZkNcruwcT1w7XpjNvoNCxf6FscvEYWkS3NSCN/vVAr4A2NHRAhKYw8SGA9OXjoUFvn4ZFOcR8b5wytt7G36zJ8I2eKrgNsq9hV4kdyp4wO7PAuLe8W4enn7jfW9Ukkkelrk0Mm24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978213; c=relaxed/simple; bh=rqP6/9BKyf61Qf4lRR4jvm0ThC7nbK3Dt5peDRM/3+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ESj4Ehdn/RIpDyfIHjcVGMD51mJZtrQgtyb26LZdH2su2QGh4yxpRiPPgQLnzsrkZ2zcZ/gi6Icvs6K5BhOO1T0V+9NmRVM5N84W3knyjHuYeZdcDGU88m6glNOjHMbliMXQAV7XgpXvN9kLkzYnwOkw0dYXm9xM2+J60Ao3exU= 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=mQx77Cev; arc=none smtp.client-ip=198.175.65.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mQx77Cev" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719978212; x=1751514212; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rqP6/9BKyf61Qf4lRR4jvm0ThC7nbK3Dt5peDRM/3+w=; b=mQx77CevcMjsKyRHnuX7gC6fZLQkjZBb4qMjNjh3GUwktFnoSQxHgPkH OfoUjwJaTkeRqg/a5BM32nnTPSGP3sgNBXkNnEb+YXiVP9ln4CuWNo5tE dSOjmIEau9y9XkXBQccZ3CGc+9hJ5xMimRiQ67B2m9sMyE+WQL+T/7ydt ONODEKn4vTfPX5h+511oUwCm/re4cxU9FmCjcRgs/4rh7uyhiXmKRoGBw dxwJ7AINkBV/BWq223/X+R8woIIT+J8FD6bZwd2dQ4CtTe3dpjFrbwMWH PldmFgeR5Rzob1UVDIybbhmfpK7wWuvOCtADcqOfvRI4P+9abiooip+2t Q==; X-CSE-ConnectionGUID: aLxEnzemRxOAv7/BzDGIzA== X-CSE-MsgGUID: xbX/74fFS5qrJ3cvGGSK7g== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17304043" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17304043" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:32 -0700 X-CSE-ConnectionGUID: gUVQenbqS/qoy+EcC/lgwg== X-CSE-MsgGUID: 4gjIErzPSWOwZuq8koHgQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="51291066" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:30 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Subject: [PATCH 3/5] wifi: iwlwifi: mvm: avoid NULL dereference Date: Wed, 3 Jul 2024 06:43:15 +0300 Message-Id: <20240703064027.a661f8c65aac.I45cf09b01af8ee3d55828863958ead741ea43b7f@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703034317.595020-1-miriam.rachel.korenblit@intel.com> References: <20240703034317.595020-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 iwl_mvm_get_bss_vif might return a NULL or ERR_PTR. Some of the callers check only the NULL case, and some doesn't check at all. Some of the callers even have a pointer to the mvmvif of the bss vif, so we don't even need to call this function, and can simply get the vif from mvmvif. Do it for those cases, and for the others - properly check if IS_ERR_OR_NULL Fixes: ec0d43d26f2c ("wifi: iwlwifi: mvm: Activate EMLSR based on traffic volume") Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 ++++-- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index b1e6d4eee68d..678744a6fc6e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1656,7 +1656,8 @@ static void iwl_mvm_prevent_esr_done_wk(struct wiphy *wiphy, struct iwl_mvm_vif *mvmvif = container_of(wk, struct iwl_mvm_vif, prevent_esr_done_wk.work); struct iwl_mvm *mvm = mvmvif->mvm; - struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); + struct ieee80211_vif *vif = + container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); mutex_lock(&mvm->mutex); iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_PREVENTION); @@ -1682,7 +1683,8 @@ static void iwl_mvm_unblock_esr_tpt(struct wiphy *wiphy, struct wiphy_work *wk) struct iwl_mvm_vif *mvmvif = container_of(wk, struct iwl_mvm_vif, unblock_esr_tpt_wk); struct iwl_mvm *mvm = mvmvif->mvm; - struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); + struct ieee80211_vif *vif = + container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); mutex_lock(&mvm->mutex); iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 53283d052e18..48671540f37a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -153,7 +153,7 @@ static void iwl_mvm_rx_esr_mode_notif(struct iwl_mvm *mvm, struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); /* FW recommendations is only for entering EMLSR */ - if (!vif || iwl_mvm_vif_from_mac80211(vif)->esr_active) + if (IS_ERR_OR_NULL(vif) || iwl_mvm_vif_from_mac80211(vif)->esr_active) return; if (le32_to_cpu(notif->action) == ESR_RECOMMEND_ENTER) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 773cc2bdcb0b..6e933907f985 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -966,7 +966,7 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) lockdep_assert_held(&mvm->mutex); - if (!bss_vif) + if (IS_ERR_OR_NULL(bss_vif)) return; mvmvif = iwl_mvm_vif_from_mac80211(bss_vif); From patchwork Wed Jul 3 03:43:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13720916 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 2350F1B95B for ; Wed, 3 Jul 2024 03:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978215; cv=none; b=bWJRJN8z4hdN9I6hvriApSk+O22wyLZfR2c2D/I3feFSZqlOZW0Y9qkHocb15leKNS+NJHjpoKUhUpoc5Wpt5ZBh0cARGa9LjaoMiNZISzfbXL2WWSed+2x8lhQWp5tbdiyJWROWy6yUHprQ+sGqRR0e3cGI+jETm7iP/23AuV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978215; c=relaxed/simple; bh=J7QCqso5HMHxuzQThUG5ZutPMCGJ4SPmZFJlyzEmaJg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WQmT3XR0Ns77nndV0MCHXyQS9bCYcNbOJU0WQutvHikgZ61m9V/H6nCIjQNupNbMjS+Crk6D//jUubTzCWLNWo5NJVR6c/8rbGF3qFrZR6oMXe5XoxfQIWLxIBGiAGQ78B+0O3EgitSATrLIyjuKX5N9Nl9bkmttD64kPfskT3o= 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=YUeOq6dd; arc=none smtp.client-ip=198.175.65.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YUeOq6dd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719978214; x=1751514214; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J7QCqso5HMHxuzQThUG5ZutPMCGJ4SPmZFJlyzEmaJg=; b=YUeOq6ddk/q5EBrFMPI5ukk4tYpyyzR2+U2xkp04PrDZNksUSQgN6ciD KvntuzHjSQam0VDEIi6mcoBE8DV6FoJLaBHbey9CE+d2UrIASytM77c07 etcTLUYkUn5Qo60nO4y/SPZJcZt3PicFLdrjdcXHoBp73oy7QpKtnY11B ixrYNqjl4E5bfSnDpHEA8Fs6c6rEWKTNnqeSpbqLAycZogRDIWzx/ugIo PxRpJOJ8nuOQ2fCa80sX5Phxc4LKj/Hg1Su9++0A0QJOOy7XKwpvh7QOu Hr16aFaysubVcKNN1zBNRmZ/4LwHoxDc6kcVUPzExvIs7A5z/+GWAaIyq g==; X-CSE-ConnectionGUID: ayAA91cdRXCsjDIyT9uRRQ== X-CSE-MsgGUID: qG02kSKqTqG0rV+nboHNcg== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17304046" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17304046" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:33 -0700 X-CSE-ConnectionGUID: TbasTAv4TO2XRAamLWiSvg== X-CSE-MsgGUID: R4Bo8AnwQz2/3x6dfU2N1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="51291071" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:31 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Johannes Berg Subject: [PATCH 4/5] wifi: iwlwifi: mvm: don't wake up rx_sync_waitq upon RFKILL Date: Wed, 3 Jul 2024 06:43:16 +0300 Message-Id: <20240703064027.be7a9dbeacde.I5586cb3ca8d6e44f79d819a48a0c22351ff720c9@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703034317.595020-1-miriam.rachel.korenblit@intel.com> References: <20240703034317.595020-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: Emmanuel Grumbach Since we now want to sync the queues even when we're in RFKILL, we shouldn't wake up the wait queue since we still expect to get all the notifications from the firmware. Fixes: 4d08c0b3357c ("wifi: iwlwifi: mvm: handle BA session teardown in RF-kill") Signed-off-by: Emmanuel Grumbach Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 ++---- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 678744a6fc6e..dac6155ae1bd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -6412,11 +6412,9 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, if (sync) { lockdep_assert_held(&mvm->mutex); ret = wait_event_timeout(mvm->rx_sync_waitq, - READ_ONCE(mvm->queue_sync_state) == 0 || - iwl_mvm_is_radio_hw_killed(mvm), + READ_ONCE(mvm->queue_sync_state) == 0, SYNC_RX_QUEUE_TIMEOUT); - WARN_ONCE(!ret && !iwl_mvm_is_radio_hw_killed(mvm), - "queue sync: failed to sync, state is 0x%lx, cookie %d\n", + WARN_ONCE(!ret, "queue sync: failed to sync, state is 0x%lx, cookie %d\n", mvm->queue_sync_state, mvm->queue_sync_cookie); } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 48671540f37a..d343432474db 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1912,12 +1912,10 @@ static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) bool rfkill_safe_init_done = READ_ONCE(mvm->rfkill_safe_init_done); bool unified = iwl_mvm_has_unified_ucode(mvm); - if (state) { + if (state) set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); - wake_up(&mvm->rx_sync_waitq); - } else { + else clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); - } iwl_mvm_set_rfkill_state(mvm); From patchwork Wed Jul 3 03:43:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13720917 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 B4511944D for ; Wed, 3 Jul 2024 03:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978217; cv=none; b=Uq8KgfZPViYdEw3mnI6pup/6VXQLZHCGSosB7BSTNhAf9dRiHxaZVf30JAl03ihK6wWkJuDGWuZuYKewIfFV1u4pYheOz2oHcI53Y/haSPG7DVuSPudDOoj9KUiuHNi05dTvXvEhD/GSPBJUyvZXNehWVZCsCOR/c3i1bgIp+ew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719978217; c=relaxed/simple; bh=ORu4esC9TC6tZAAg/yPCb6rBYdG0EYVV9zFvby4edIo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DvXa8jZFWvEe9xom8chewvJCFmvcXHEuB2KNgfgnwwrMmPR8LUB6N95ht4Qzj2aaf4ajMZIKrEIYZMuudxoJMZlz9f+kW/fNuhGHGat2B1ZaXk1rg8QkJw1uhY09NkPy9EMZ3FYjoxkJlReOgNpWu8JhA0x+CAJQOaA9FiIe5rg= 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=LKdkKrpA; arc=none smtp.client-ip=198.175.65.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LKdkKrpA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719978216; x=1751514216; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ORu4esC9TC6tZAAg/yPCb6rBYdG0EYVV9zFvby4edIo=; b=LKdkKrpAFjXpomCmIYc8tOcGyoAupxISJFka/Lc7TIfHxFLNN9Nb+zav 9rUiEUWXpxPITbmjXYM7yR2bRZCaTYN38tApWXnIR+Y5TFIrl8V2ZdIai xuaC+tW+jNpwGNEtFVIx1an+ZQb3PPKtosyUTZAo0gtJQCM6b5RY0OpFg uNNvV8WXwdmUZ3n7xRfdg/wXaxxyl7JFR4WbSjb18yW3ACuR6/TpaU/Gp mdaqncC8Nnj1GWYwPjy+wHyfp3MoHTVm9noTtD/Kaoq/klbJgyJRe6H2L Ip1ma9pk9KPGeCyXaV/HNqgVdy0J6yWPVEkdum/OC6cafd8/XmOp9CSyr Q==; X-CSE-ConnectionGUID: UZdLzIgSTwmhMFOKeuACcA== X-CSE-MsgGUID: 8rQee/XnRLanF1fJoAcIZQ== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="17304049" X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="17304049" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:35 -0700 X-CSE-ConnectionGUID: HRBiT78HSoKubnaaGeBnOA== X-CSE-MsgGUID: YVR9NZF5TsODEyh/TUJSRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,181,1716274800"; d="scan'208";a="51291080" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2024 20:43:33 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Johannes Berg Subject: [PATCH 5/5] wifi: iwlwifi: mvm: don't send an ROC command with max_delay = 0 Date: Wed, 3 Jul 2024 06:43:17 +0300 Message-Id: <20240703064027.e12f8d84c8fd.I3dd9f720c678c06ec7a5bf7ca56e21cf0b614c8c@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703034317.595020-1-miriam.rachel.korenblit@intel.com> References: <20240703034317.595020-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: Emmanuel Grumbach The firmware can't handle that (it will crash with ASSERT 300A). This happened because we looked at vif->bss_conf which is not the right bss_conf to look at in case of an MLD connection. Fix iwl_mvm_roc_duration_and_delay to iterate on the active links to get the right value for the dtim_interval. Signed-off-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit Reviewed-by: Johannes Berg --- .../net/wireless/intel/iwlwifi/mvm/time-event.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c index 31bc80cdcb7d..97cfd72312f2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -984,12 +984,21 @@ void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif, u32 *duration_tu, u32 *delay) { - u32 dtim_interval = vif->bss_conf.dtim_period * - vif->bss_conf.beacon_int; + struct ieee80211_bss_conf *link_conf; + unsigned int link_id; + u32 dtim_interval = 0; *delay = AUX_ROC_MIN_DELAY; *duration_tu = MSEC_TO_TU(duration_ms); + rcu_read_lock(); + for_each_vif_active_link(vif, link_conf, link_id) { + dtim_interval = + max_t(u32, dtim_interval, + link_conf->dtim_period * link_conf->beacon_int); + } + rcu_read_unlock(); + /* * If we are associated we want the delay time to be at least one * dtim interval so that the FW can wait until after the DTIM and @@ -998,8 +1007,10 @@ void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif, * Since we want to use almost a whole dtim interval we would also * like the delay to be for 2-3 dtim intervals, in case there are * other time events with higher priority. + * dtim_interval should never be 0, it can be 1 if we don't know it + * (we haven't heard any beacon yet). */ - if (vif->cfg.assoc) { + if (vif->cfg.assoc && !WARN_ON(!dtim_interval)) { *delay = min_t(u32, dtim_interval * 3, AUX_ROC_MAX_DELAY); /* We cannot remain off-channel longer than the DTIM interval */ if (dtim_interval <= *duration_tu) {