iwl4965: add comments to rate scaling code

Add comments to rate scaling code.

Signed-off-by: Ben Cahill <ben.m.cahill@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Ben Cahill 2007-11-29 11:09:44 +08:00 committed by David S. Miller
parent f58177b9c3
commit 7762635547
4 changed files with 443 additions and 76 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,10 @@
#include "iwl-4965.h"
struct iwl4965_rate_info {
u8 plcp;
u8 plcp_siso;
u8 plcp_mimo;
u8 ieee;
u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
u8 plcp_mimo; /* uCode API: IWL_RATE_MIMO_6M_PLCP, etc. */
u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */
u8 prev_ieee; /* previous rate in IEEE speeds */
u8 next_ieee; /* next rate in IEEE speeds */
u8 prev_rs; /* previous rate used in rs algo */
@ -42,6 +42,7 @@ struct iwl4965_rate_info {
u8 next_rs_tgg; /* next rate used in TGG rs algo */
};
/* For driver (not uCode API) */
enum {
IWL_RATE_1M_INDEX = 0,
IWL_RATE_2M_INDEX,
@ -83,6 +84,7 @@ enum {
#define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX)
#define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX)
/* 4965 uCode API values for legacy bit rates, both OFDM and CCK */
enum {
IWL_RATE_6M_PLCP = 13,
IWL_RATE_9M_PLCP = 15,
@ -99,7 +101,7 @@ enum {
IWL_RATE_11M_PLCP = 110,
};
/* OFDM HT rate plcp */
/* 4965 uCode API values for OFDM high-throughput (HT) bit rates */
enum {
IWL_RATE_SISO_6M_PLCP = 0,
IWL_RATE_SISO_12M_PLCP = 1,
@ -121,6 +123,7 @@ enum {
IWL_RATE_MIMO_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP,
};
/* MAC header values for bit rates */
enum {
IWL_RATE_6M_IEEE = 12,
IWL_RATE_9M_IEEE = 18,
@ -170,13 +173,8 @@ enum {
#define IWL_MIN_RSSI_VAL -100
#define IWL_MAX_RSSI_VAL 0
#define IWL_LEGACY_SWITCH_ANTENNA 0
#define IWL_LEGACY_SWITCH_SISO 1
#define IWL_LEGACY_SWITCH_MIMO 2
#define IWL_RS_GOOD_RATIO 12800
#define IWL_ACTION_LIMIT 3
/* These values specify how many Tx frame attempts before
* searching for a new modulation mode */
#define IWL_LEGACY_FAILURE_LIMIT 160
#define IWL_LEGACY_SUCCESS_LIMIT 480
#define IWL_LEGACY_TABLE_COUNT 160
@ -185,29 +183,44 @@ enum {
#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500
#define IWL_NONE_LEGACY_TABLE_COUNT 1500
#define IWL_RATE_SCALE_SWITCH (10880)
/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
#define IWL_RS_GOOD_RATIO 12800 /* 100% */
#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */
#define IWL_RATE_HIGH_TH 10880 /* 85% */
#define IWL_RATE_INCREASE_TH 8960 /* 70% */
#define IWL_RATE_DECREASE_TH 1920 /* 15% */
/* possible actions when in legacy mode */
#define IWL_LEGACY_SWITCH_ANTENNA 0
#define IWL_LEGACY_SWITCH_SISO 1
#define IWL_LEGACY_SWITCH_MIMO 2
/* possible actions when in siso mode */
#define IWL_SISO_SWITCH_ANTENNA 0
#define IWL_SISO_SWITCH_MIMO 1
#define IWL_SISO_SWITCH_GI 2
/* possible actions when in mimo mode */
#define IWL_MIMO_SWITCH_ANTENNA_A 0
#define IWL_MIMO_SWITCH_ANTENNA_B 1
#define IWL_MIMO_SWITCH_GI 2
#define LQ_SIZE 2
#define IWL_ACTION_LIMIT 3 /* # possible actions */
#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */
extern const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT];
enum iwl4965_table_type {
LQ_NONE,
LQ_G,
LQ_G, /* legacy types */
LQ_A,
LQ_SISO,
LQ_SISO, /* high-throughput types */
LQ_MIMO,
LQ_MAX,
};
/* 4965 has 2 antennas/chains for Tx (but 3 for Rx) */
enum iwl4965_antenna_type {
ANT_NONE,
ANT_MAIN,

View File

@ -489,7 +489,7 @@ struct sta_ht_info {
u8 supported_chan_width;
u8 extension_chan_offset;
u8 is_green_field;
u8 sgf;
u8 sgf; /* HT_SHORT_GI_* short guard interval */
u8 supp_rates[16];
u8 tx_chan_width;
u8 chan_width_cap;

View File

@ -1488,6 +1488,7 @@ int iwl4965_rate_index_from_plcp(int plcp)
{
int i = 0;
/* 4965 HT rate format */
if (plcp & RATE_MCS_HT_MSK) {
i = (plcp & 0xff);
@ -1501,6 +1502,8 @@ int iwl4965_rate_index_from_plcp(int plcp)
if ((i >= IWL_FIRST_OFDM_RATE) &&
(i <= IWL_LAST_OFDM_RATE))
return i;
/* 4965 legacy rate format, search for match in table */
} else {
for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++)
if (iwl4965_rates[i].plcp == (plcp &0xFF))