Linux wireless drivers development
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Guy Cohen <guy.cohen@intel.com>,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH 26/43] iwlwifi: fix in-column rate scaling
Date: Thu, 29 May 2008 16:35:11 +0800	[thread overview]
Message-ID: <1212050128-17132-27-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1212050128-17132-26-git-send-email-yi.zhu@intel.com>

From: Guy Cohen <guy.cohen@intel.com>

This patch fixes cases that the code raised or didn't decrease
the rate although the success ratio was not good.

Signed-off-by: Guy Cohen <guy.cohen@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965-rs.c |   45 ++++++++++++++-------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index ccdd3ec..347fbeb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -1335,7 +1335,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
 				lq_sta->search_better_tbl = 1;
 				goto out;
 			}
-
+			break;
 		case IWL_LEGACY_SWITCH_SISO:
 			IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n");
 
@@ -1421,9 +1421,9 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
 				lq_sta->search_better_tbl = 1;
 				goto out;
 			}
-
+			break;
 		case IWL_SISO_SWITCH_MIMO2:
-			IWL_DEBUG_RATE("LQ: SISO switch to MIMO\n");
+			IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n");
 			memcpy(search_tbl, tbl, sz);
 			search_tbl->is_SGI = 0;
 			search_tbl->ant_type = ANT_AB; /*FIXME:RS*/
@@ -1688,6 +1688,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 	u8 active_tbl = 0;
 	u8 done_search = 0;
 	u16 high_low;
+	s32 sr;
 #ifdef CONFIG_IWL4965_HT
 	u8 tid = MAX_TID_COUNT;
 #endif
@@ -1863,6 +1864,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 	low = high_low & 0xff;
 	high = (high_low >> 8) & 0xff;
 
+	sr = window->success_ratio;
+
 	/* Collect measured throughputs for current and adjacent rates */
 	current_tpt = window->average_tpt;
 	if (low != IWL_RATE_INVALID)
@@ -1870,19 +1873,22 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 	if (high != IWL_RATE_INVALID)
 		high_tpt = tbl->win[high].average_tpt;
 
-	/* Assume rate increase */
-	scale_action = 1;
+	scale_action = 0;
 
 	/* Too many failures, decrease rate */
-	if ((window->success_ratio <= IWL_RATE_DECREASE_TH) ||
-	    (current_tpt == 0)) {
+	if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) {
 		IWL_DEBUG_RATE("decrease rate because of low success_ratio\n");
 		scale_action = -1;
 
 	/* No throughput measured yet for adjacent rates; try increase. */
 	} else if ((low_tpt == IWL_INVALID_VALUE) &&
-		   (high_tpt == IWL_INVALID_VALUE))
-		scale_action = 1;
+		   (high_tpt == IWL_INVALID_VALUE)) {
+
+		if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH)
+			scale_action = 1;
+		else if (low != IWL_RATE_INVALID)
+			scale_action = -1;
+	}
 
 	/* Both adjacent throughputs are measured, but neither one has better
 	 * throughput; we're using the best rate, don't change it! */
@@ -1898,9 +1904,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 		/* Higher adjacent rate's throughput is measured */
 		if (high_tpt != IWL_INVALID_VALUE) {
 			/* Higher rate has better throughput */
-			if (high_tpt > current_tpt)
+			if (high_tpt > current_tpt &&
+					sr >= IWL_RATE_INCREASE_TH) {
 				scale_action = 1;
-			else {
+			} else {
 				IWL_DEBUG_RATE
 				    ("decrease rate because of high tpt\n");
 				scale_action = -1;
@@ -1913,23 +1920,17 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 				IWL_DEBUG_RATE
 				    ("decrease rate because of low tpt\n");
 				scale_action = -1;
-			} else
+			} else if (sr >= IWL_RATE_INCREASE_TH) {
 				scale_action = 1;
+			}
 		}
 	}
 
 	/* Sanity check; asked for decrease, but success rate or throughput
 	 * has been good at old rate.  Don't change it. */
-	if (scale_action == -1) {
-		if ((low != IWL_RATE_INVALID) &&
-		    ((window->success_ratio > IWL_RATE_HIGH_TH) ||
+	if ((scale_action == -1) && (low != IWL_RATE_INVALID) &&
+		    ((sr > IWL_RATE_HIGH_TH) ||
 		     (current_tpt > (100 * tbl->expected_tpt[low]))))
-			scale_action = 0;
-
-	/* Sanity check; asked for increase, but success rate has not been great
-	 * even at old rate, higher rate will be worse.  Don't change it. */
-	} else if ((scale_action == 1) &&
-		   (window->success_ratio < IWL_RATE_INCREASE_TH))
 		scale_action = 0;
 
 	switch (scale_action) {
@@ -1958,7 +1959,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 		    "high %d type %d\n",
 		     index, scale_action, low, high, tbl->lq_type);
 
- lq_update:
+lq_update:
 	/* Replace uCode's rate table for the destination station. */
 	if (update_lq) {
 		rate = rate_n_flags_from_tbl(tbl, index, is_green);
-- 
1.5.3.6


  reply	other threads:[~2008-05-29  8:37 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29  8:34 [PATCH 00/43] iwlwifi driver 05/29 updates Zhu Yi
2008-05-29  8:34 ` [PATCH 01/43] iwlwifi: move iwl_dump_nic_error_log to iwlcore module Zhu Yi
2008-05-29  8:34   ` [PATCH 02/43] iwlwifi: add RTC data address for iwl5000 Zhu Yi
2008-05-29  8:34     ` [PATCH 03/43] iwlwifi: use uCode error and event tables pointer w.r.t loaded image Zhu Yi
2008-05-29  8:34       ` [PATCH 04/43] iwlwifi: increase max payload of iwl_cmd Zhu Yi
2008-05-29  8:34         ` [PATCH 05/43] iwlwifi: create drivers debugfs dir under wiphy->debugfsdir Zhu Yi
2008-05-29  8:34           ` [PATCH 06/43] iwlwifi: mark 4965 ucode types Zhu Yi
2008-05-29  8:34             ` [PATCH 07/43] iwlwifi: remove unused variable form __iwl4965_down Zhu Yi
2008-05-29  8:34               ` [PATCH 08/43] iwlwifi: remove notif_missed_beacons variable Zhu Yi
2008-05-29  8:34                 ` [PATCH 09/43] iwlwifi: clean up alive_start routine Zhu Yi
2008-05-29  8:34                   ` [PATCH 10/43] iwlwifi: remove 4965 from alive_resp structures Zhu Yi
2008-05-29  8:34                     ` [PATCH 11/43] iwlwifi: setup correctly L1 L0S pi link values Zhu Yi
2008-05-29  8:34                       ` [PATCH 12/43] iwlwifi: implement apm reset flow Zhu Yi
2008-05-29  8:34                         ` [PATCH 13/43] iwlwifi: implement apm stop function Zhu Yi
2008-05-29  8:34                           ` [PATCH 14/43] iwlwifi: refactor stop master function Zhu Yi
2008-05-29  8:35                             ` [PATCH 15/43] iwlwifi: move txq_ctx_stop into iwl-tx.c Zhu Yi
2008-05-29  8:35                               ` [PATCH 16/43] iwlwifi: move iwl_rxq_stop into iwl-rx.c Zhu Yi
2008-05-29  8:35                                 ` [PATCH 17/43] iwlwifi: add remove station functionality Zhu Yi
2008-05-29  8:35                                   ` [PATCH 18/43] iwlwifi: move add sta handler to iwl-sta.c Zhu Yi
2008-05-29  8:35                                     ` [PATCH 19/43] iwlwifi: move iwl_rx_missed_beacon_notif to iwl-rx.c Zhu Yi
2008-05-29  8:35                                       ` [PATCH 20/43] iwlwifi-5000: implement initial calibration for 5000 Zhu Yi
2008-05-29  8:35                                         ` [PATCH 21/43] iwlwifi: activate status ready timeout only for run time ucode Zhu Yi
2008-05-29  8:35                                           ` [PATCH 22/43] iwlwifi: add iwl5000_tx_response structure Zhu Yi
2008-05-29  8:35                                             ` [PATCH 23/43] iwlwifi: move tx response common handlers to iwlcore Zhu Yi
2008-05-29  8:35                                               ` [PATCH 24/43] iwlwlifi: impelemnt 5000 tx response path Zhu Yi
2008-05-29  8:35                                                 ` [PATCH 25/43] iwlwifi: move 4965 tx response into iwl-4965.c Zhu Yi
2008-05-29  8:35                                                   ` Zhu Yi [this message]
2008-05-29  8:35                                                     ` [PATCH 27/43] iwlwifi: move tx reclaim flow into iwl-tx Zhu Yi
2008-05-29  8:35                                                       ` [PATCH 28/43] iwlwifi: implement txq invalidate byte count table Zhu Yi
2008-05-29  8:35                                                         ` [PATCH 29/43] iwlwifi: iwl-5000 add rxon_assoc Zhu Yi
2008-05-29  8:35                                                           ` [PATCH 30/43] iwlwifi: move iwl_sta_modify_enable_tid_tx to iwl-sta.c Zhu Yi
2008-05-29  8:35                                                             ` [PATCH 31/43] iwlwifi: move aggregation code to iwl-tx.c Zhu Yi
2008-05-29  8:35                                                               ` [PATCH 32/43] iwlwifi: add frame count limit to link quality command Zhu Yi
2008-05-29  8:35                                                                 ` [PATCH 33/43] iwlwifi: Rx handlers common use for 4965 and 5000 Zhu Yi
2008-05-29  8:35                                                                   ` [PATCH 34/43] iwlwifi: move iwl_get_hw_mode to iwl-core.h Zhu Yi
2008-05-29  8:35                                                                     ` [PATCH 35/43] mac80211: fix ieee80211_get_buffered_bc Zhu Yi
2008-05-29  8:35                                                                       ` [PATCH 36/43] mac80211: fix deadlock in sta->lock Zhu Yi
2008-05-29  8:35                                                                         ` [PATCH 37/43] mac80211: sends HT IE to user level through wext Zhu Yi
2008-05-29  8:35                                                                           ` [PATCH 38/43] mac80211: allow disable FAT in specific configurations Zhu Yi
2008-05-29  8:35                                                                             ` [PATCH 39/43] iwlwifi: disable FAT channel when not permitted Zhu Yi
2008-05-29  8:35                                                                               ` [PATCH 40/43] iwlwifi: fix a memory leak in scan Zhu Yi
2008-05-29  8:35                                                                                 ` [PATCH 41/43] iwlwifi: remove debugfs entries before cfg80211 Zhu Yi
2008-05-29  8:35                                                                                   ` [PATCH 42/43] iwlwifi: send calibration results as HUGE commands Zhu Yi
2008-05-29  8:35                                                                                     ` [PATCH 43/43] iwlwifi: clean iwl4965_mac_config Zhu Yi
2008-05-30 11:47                                                                                 ` [PATCH 40/43] iwlwifi: fix a memory leak in scan Tomas Winkler
2008-05-29  9:37                                                                             ` [PATCH 38/43] mac80211: allow disable FAT in specific configurations Johannes Berg
2008-05-29  9:58                                                                               ` Tomas Winkler
2008-05-29 10:12                                                                                 ` Johannes Berg
2008-05-29 10:39                                                                                   ` Tomas Winkler
2008-05-29 10:49                                                                                     ` Johannes Berg

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=1212050128-17132-27-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=guy.cohen@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    /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