linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Eyal Shapira <eyal@wizery.com>, <stable@vger.kernel.org>,
	Eyal Shapira <eyalx.shapira@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 09/13] iwlwifi: mvm: rs: reinit rs if no tx for a long time
Date: Sun, 13 Apr 2014 16:01:59 +0300	[thread overview]
Message-ID: <1397394123-25102-9-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <1397394123-25102-1-git-send-email-egrumbach@gmail.com>

From: Eyal Shapira <eyal@wizery.com>

After being idle for a long time (>5sec) the rs statistics
will be stale so we prefer to reset rs and start from legacy
rates again. This gives better results when the attenuation
increased signficantly (e.g. we got further from the AP) and
after a while we start Tx
Note that the first Tx after the idle period will still go out
in the old modulation and rate but this seemed a simpler approach
compared to adding a timer or modifying mac80211 for this.
The negative impact is negligble as we'll recover quickly.

Cc: <stable@vger.kernel.org> [3.14]
Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/mvm/rs.c | 22 +++++++++++++++++++++-
 drivers/net/wireless/iwlwifi/mvm/rs.h |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 97b8fac..0d03dcd 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -59,7 +59,7 @@
 /* max allowed rate miss before sync LQ cmd */
 #define IWL_MISSED_RATE_MAX		15
 #define RS_STAY_IN_COLUMN_TIMEOUT       (5*HZ)
-
+#define RS_IDLE_TIMEOUT                 (5*HZ)
 
 static u8 rs_ht_to_legacy[] = {
 	[IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX,
@@ -992,6 +992,13 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband,
 		return;
 	}
 
+#ifdef CPTCFG_MAC80211_DEBUGFS
+	/* Disable last tx check if we are debugging with fixed rate */
+	if (lq_sta->dbg_fixed_rate) {
+		IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n");
+		return;
+	}
+#endif
 	if (!ieee80211_is_data(hdr->frame_control) ||
 	    info->flags & IEEE80211_TX_CTL_NO_ACK)
 		return;
@@ -1034,6 +1041,18 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband,
 			mac_index++;
 	}
 
+	if (time_after(jiffies,
+		       (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) {
+		int tid;
+		IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n");
+		for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++)
+			ieee80211_stop_tx_ba_session(sta, tid);
+
+		iwl_mvm_rs_rate_init(mvm, sta, sband->band, false);
+		return;
+	}
+	lq_sta->last_tx = jiffies;
+
 	/* Here we actually compare this rate to the latest LQ command */
 	if ((mac_index < 0) ||
 	    (rate.sgi != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) ||
@@ -2354,6 +2373,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 		rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]);
 
 	lq_sta->flush_timer = 0;
+	lq_sta->last_tx = jiffies;
 
 	IWL_DEBUG_RATE(mvm,
 		       "LQ: *** rate scale station global init for station %d ***\n",
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h
index fbb476a..0acfac9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.h
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.h
@@ -311,6 +311,7 @@ struct iwl_lq_sta {
 	u32 visited_columns;    /* Bitmask marking which Tx columns were
 				 * explored during a search cycle
 				 */
+	u64 last_tx;
 	bool is_vht;
 	enum ieee80211_band band;
 
-- 
1.8.3.2


  parent reply	other threads:[~2014-04-13 13:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-13 12:59 pull request: iwlwifi 2014-04-13 Emmanuel Grumbach
2014-04-13 13:01 ` [PATCH 01/13] iwlwifi: mvm: delay enabling smart FIFO until after beacon RX Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 02/13] iwlwifi: mvm: rs: fix mimo delimiter in LQ cmd Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 03/13] iwlwifi: mvm: BT Coex - send the new LUT upon antenna coupling change Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 04/13] iwlwifi: add new 7265 HW IDs Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 05/13] iwlwifi: 7000: bump API to 9 Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 06/13] iwlwifi: add MODULE_FIRMWARE for 7265 Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 07/13] iwlwifi: mvm: rs: use correct max expected throughput figures Emmanuel Grumbach
2014-04-13 13:01   ` [PATCH 08/13] iwlwifi: mvm: rs: fix and cleanup rs_get_rate_action Emmanuel Grumbach
2014-04-13 13:01   ` Emmanuel Grumbach [this message]
2014-04-13 13:02   ` [PATCH 10/13] iwlwifi: mvm: rs: fallback to legacy Tx columns Emmanuel Grumbach
2014-04-13 13:02   ` [PATCH 11/13] iwlwifi: mvm: avoid searching unnecessary columns Emmanuel Grumbach
2014-04-13 13:02   ` [PATCH 12/13] iwlwifi: mvm: rs: clear per rate stats when aggregation changes Emmanuel Grumbach
2014-04-13 13:02   ` [PATCH 13/13] iwlwifi: mvm: BT Coex - fix Look Up Table Emmanuel Grumbach
2014-04-13 13:53 ` pull request: iwlwifi 2014-04-13 Emmanuel Grumbach
2014-04-14 18:22   ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397394123-25102-9-git-send-email-egrumbach@gmail.com \
    --to=egrumbach@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=eyal@wizery.com \
    --cc=eyalx.shapira@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).