From patchwork Wed Aug 28 20:26:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 824387 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C86815749A for ; Wed, 28 Aug 2024 20:26:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724876796; cv=none; b=uM46rUBPiEMhDyVt0ApHpQvs63s9XZAwNgI7w/5WtWsGqStXOw2goAvNe+eUrgtLmhOONR8l+HdKpmLbBbMqjWvMNlNlMCOCIH2RTahdukDQ7atPHpyASkUq59X7lw8v6uIJqZW2n6fqT9nVYSDAEfr2z3Br7koB7uS/pCRQVds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724876796; c=relaxed/simple; bh=uPdMv4BxE7F7s7PzXwRRrPGCM4aNvT7kBPQzAPjRiT0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SoN1FMRVOf2oJLNYNUNypS8/k+SwMjcb4lze/imQ/GsDIzhm/Yc05HKXDf3e78A4wu/4m6G4ASKC1j2WYH1maEc9ScE9HmH98PWSEisl8DYsUKwT9HqQDwT6qrW75ouo4+6kx5UhS6tVvDGzKQhyG/KLurFw8QDd6ZuA9qSjNwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=DWTrRypH; arc=none smtp.client-ip=67.231.154.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="DWTrRypH" X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 30744340085 for ; Wed, 28 Aug 2024 20:26:32 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 9B01113C2B0; Wed, 28 Aug 2024 13:26:31 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 9B01113C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1724876791; bh=uPdMv4BxE7F7s7PzXwRRrPGCM4aNvT7kBPQzAPjRiT0=; h=From:To:Cc:Subject:Date:From; b=DWTrRypHDvsmS2bESy0k7GQ6Axenq3VYe+xlBtYQnGiEifbHVwSHDuuG/+AuXoEIi r5FZ8swO8/Qk6ukqSDnTfEm6NPnii2jo/cnOnsO+9pMeQxKQ7Phbs4/af3KlzaAL+u kJiyYzWn6aa0WxEs2/8hPuoHHhxo054k9UJfcMXs= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 1/2] wifi: iwlwifi: Fix eMLSR band comparison. Date: Wed, 28 Aug 2024 13:26:29 -0700 Message-ID: <20240828202630.2151365-1-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1724876792-t7KJgrjSlWoR X-MDID-O: us5; at1; 1724876792; t7KJgrjSlWoR; ; f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Do not make assumptions about what band 'a' or 'b' are on. And add new reason code for when eMLSR is disabled due to band. Signed-off-by: Ben Greear --- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 13 ++++++++++--- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index bb3de07bc6be..f3fb37fec8a8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -16,6 +16,7 @@ HOW(EXIT_LOW_RSSI) \ HOW(EXIT_COEX) \ HOW(EXIT_BANDWIDTH) \ + HOW(EXIT_BAND) \ HOW(EXIT_CSA) \ HOW(EXIT_LINK_USAGE) @@ -750,11 +751,17 @@ bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif, iwl_mvm_esr_disallowed_with_link(mvm, vif, b, false)) return false; - if (a->chandef->width != b->chandef->width || - !(a->chandef->chan->band == NL80211_BAND_6GHZ && - b->chandef->chan->band == NL80211_BAND_5GHZ)) + if (a->chandef->width != b->chandef->width) ret |= IWL_MVM_ESR_EXIT_BANDWIDTH; + /* Only supports 5g and 6g bands at the moment */ + if (((a->chandef->chan->band != NL80211_BAND_6GHZ) && + (a->chandef->chan->band != NL80211_BAND_5GHZ)) || + ((b->chandef->chan->band != NL80211_BAND_6GHZ) && + (b->chandef->chan->band != NL80211_BAND_5GHZ)) || + (a->chandef->chan->band == b->chandef->chan->band)) + ret |= IWL_MVM_ESR_EXIT_BAND; + if (ret) { IWL_DEBUG_INFO(mvm, "Links %d and %d are not a valid pair for EMLSR, a->chwidth: %d b: %d band-a: %d band-b: %d\n", diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index ac4e135ed91b..22bec9ca46bb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -368,6 +368,7 @@ struct iwl_mvm_vif_link_info { * preventing the enablement of EMLSR * @IWL_MVM_ESR_EXIT_CSA: CSA happened, so exit EMLSR * @IWL_MVM_ESR_EXIT_LINK_USAGE: Exit EMLSR due to low tpt on secondary link + * @IWL_MVM_ESR_EXIT_BAND: Exit EMLSR due to incompatible Bands */ enum iwl_mvm_esr_state { IWL_MVM_ESR_BLOCKED_PREVENTION = 0x1, @@ -382,6 +383,7 @@ enum iwl_mvm_esr_state { IWL_MVM_ESR_EXIT_BANDWIDTH = 0x80000, IWL_MVM_ESR_EXIT_CSA = 0x100000, IWL_MVM_ESR_EXIT_LINK_USAGE = 0x200000, + IWL_MVM_ESR_EXIT_BAND = 0x400000, }; #define IWL_MVM_BLOCK_ESR_REASONS 0xffff From patchwork Wed Aug 28 20:26:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 823500 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 386CB1AAE3F for ; Wed, 28 Aug 2024 20:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724876797; cv=none; b=i8aTRwqeXAGZKHY3/9wcjGiJAxzAwaPy4yX61aSDWujugNHwpVA7vaICxPKc+szj03++UnhInhqVmTgStVOwRZDIA5STIKiQ9Rvmn67BVMtHOBwHPgzlqs3AFcg9WNLYVq2IqiNcaMzRjAMckDMi8XD3FQlI84KEifIoBGBW7So= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724876797; c=relaxed/simple; bh=rUzpzIQc7/5hv4Z3yNkWksgaZcXkhtQWacjy2RigLe8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XiptUK7pQKiQyEkoq5HVTf3UANIoQvUb/IC1B1TRfWjZGnO5tdzpjVHG44EH24t01kgCgja0eQOmQQurnEhLcfmCkf72o5oBjv/7RXLPCYt36ztoXVoVEcdwh6YW/cnp50lsYyRbGgYMxXQNAtQUFfw11Qj39Ke4Ugtd8s4GtNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=ZsKMrrWG; arc=none smtp.client-ip=148.163.129.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="ZsKMrrWG" X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 02115A80070 for ; Wed, 28 Aug 2024 20:26:32 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id A0AE413C2B0; Wed, 28 Aug 2024 13:26:32 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com A0AE413C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1724876792; bh=rUzpzIQc7/5hv4Z3yNkWksgaZcXkhtQWacjy2RigLe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsKMrrWGe5gmumnvWT31aCRHzpLeRx0QyP/YuLxh1pznkNgJ1dT1kfwXrYd5aSpIr VE9T3AnwNke3bJBdY9n283EXWCaRJUMELtM2QzRxOvQcpY75NGcIUrDkSXUqeAYiZH NXI4xNWCOQsgJ+Ux25ZF3As+l8CnoXViYP8pjbXc= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 2/2] wifi: iwlwifi: Fix emlsr exit due to tput sampling too fast. Date: Wed, 28 Aug 2024 13:26:30 -0700 Message-ID: <20240828202630.2151365-2-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240828202630.2151365-1-greearb@candelatech.com> References: <20240828202630.2151365-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1724876793-g7ZynLhXcJiQ X-MDID-O: us5; ut7; 1724876793; g7ZynLhXcJiQ; ; f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear I noticed that the tput check was running very often (and often right after we entered emlsr mode), putting the radio in and out of emlsr mode often. That caused link instability as well as poor performance. Add timer so that we only check stats after at least 5 seconds. Signed-off-by: Ben Greear --- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 5 +++++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 1 + drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 12 ++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index f3fb37fec8a8..d4e232d2818b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -1112,6 +1112,11 @@ static void iwl_mvm_esr_unblocked(struct iwl_mvm *mvm, IWL_DEBUG_INFO(mvm, "EMLSR is unblocked\n"); + /* Don't block based on tput until at least our sample period, + * by faking that we sampled just now. + */ + mvm->esr_tpt_ts = jiffies; + /* If we exited due to an EXIT reason, and the exit was in less than * 30 seconds, then a MLO scan was scheduled already. */ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 22bec9ca46bb..5bbb8063bd1f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1101,6 +1101,7 @@ struct iwl_mvm { unsigned long init_status; unsigned long status; + unsigned long esr_tpt_ts; /* last time we compared tput for ESR */ u32 queue_sync_cookie; unsigned long queue_sync_state; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 41301070d23c..49442dd7ddd5 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -1035,6 +1035,8 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, #define SEC_LINK_MIN_PERC 10 #define SEC_LINK_MIN_TX 3000 #define SEC_LINK_MIN_RX 400 +/* Compare tput over this interval to determine in/out of ESR mode */ +#define MVM_ESR_TPT_INTERVAL (5 * HZ) static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) { @@ -1061,6 +1063,10 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) if (!mvmsta->mpdu_counters) return; + if (!time_after(jiffies, mvm->esr_tpt_ts + MVM_ESR_TPT_INTERVAL)) + return; /* check back later */ + mvm->esr_tpt_ts = jiffies; + /* Get the FW ID of the secondary link */ sec_link = iwl_mvm_get_other_link(bss_vif, iwl_mvm_get_primary_link(bss_vif)); @@ -1084,6 +1090,8 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) /* * In EMLSR we have statistics every 5 seconds, so we can reset * the counters upon every statistics notification. + * NOTE: This is not actually correct, I see this method called + * often. Thus the back-off timer 'esr_tpt_ts' above. --Ben */ memset(mvmsta->mpdu_counters[q].per_link, 0, sizeof(mvmsta->mpdu_counters[q].per_link)); @@ -1091,8 +1099,8 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) spin_unlock_bh(&mvmsta->mpdu_counters[q].lock); } - IWL_DEBUG_STATS(mvm, "total Tx MPDUs: %ld. total Rx MPDUs: %ld\n", - total_tx, total_rx); + IWL_DEBUG_INFO(mvm, "EMLSR: total Tx MPDUs: %ld. Rx: %ld sec-link tx: %ld rx: %ld mvm-tput-thresh: %d\n", + total_tx, total_rx, sec_link_tx, sec_link_rx, IWL_MVM_ENTER_ESR_TPT_THRESH); /* If we don't have enough MPDUs - exit EMLSR */ if (total_tx < IWL_MVM_ENTER_ESR_TPT_THRESH &&