Commit 77626355 authored by Ben Cahill's avatar Ben Cahill Committed by David S. Miller

iwl4965: add comments to rate scaling code

Add comments to rate scaling code.
Signed-off-by: default avatarBen Cahill <ben.m.cahill@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f58177b9
This diff is collapsed.
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#include "iwl-4965.h" #include "iwl-4965.h"
struct iwl4965_rate_info { struct iwl4965_rate_info {
u8 plcp; u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
u8 plcp_siso; u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
u8 plcp_mimo; u8 plcp_mimo; /* uCode API: IWL_RATE_MIMO_6M_PLCP, etc. */
u8 ieee; u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */
u8 prev_ieee; /* previous rate in IEEE speeds */ u8 prev_ieee; /* previous rate in IEEE speeds */
u8 next_ieee; /* next rate in IEEE speeds */ u8 next_ieee; /* next rate in IEEE speeds */
u8 prev_rs; /* previous rate used in rs algo */ u8 prev_rs; /* previous rate used in rs algo */
...@@ -42,6 +42,7 @@ struct iwl4965_rate_info { ...@@ -42,6 +42,7 @@ struct iwl4965_rate_info {
u8 next_rs_tgg; /* next rate used in TGG rs algo */ u8 next_rs_tgg; /* next rate used in TGG rs algo */
}; };
/* For driver (not uCode API) */
enum { enum {
IWL_RATE_1M_INDEX = 0, IWL_RATE_1M_INDEX = 0,
IWL_RATE_2M_INDEX, IWL_RATE_2M_INDEX,
...@@ -83,6 +84,7 @@ enum { ...@@ -83,6 +84,7 @@ enum {
#define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX) #define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX)
#define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX) #define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX)
/* 4965 uCode API values for legacy bit rates, both OFDM and CCK */
enum { enum {
IWL_RATE_6M_PLCP = 13, IWL_RATE_6M_PLCP = 13,
IWL_RATE_9M_PLCP = 15, IWL_RATE_9M_PLCP = 15,
...@@ -99,7 +101,7 @@ enum { ...@@ -99,7 +101,7 @@ enum {
IWL_RATE_11M_PLCP = 110, IWL_RATE_11M_PLCP = 110,
}; };
/* OFDM HT rate plcp */ /* 4965 uCode API values for OFDM high-throughput (HT) bit rates */
enum { enum {
IWL_RATE_SISO_6M_PLCP = 0, IWL_RATE_SISO_6M_PLCP = 0,
IWL_RATE_SISO_12M_PLCP = 1, IWL_RATE_SISO_12M_PLCP = 1,
...@@ -121,6 +123,7 @@ enum { ...@@ -121,6 +123,7 @@ enum {
IWL_RATE_MIMO_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, IWL_RATE_MIMO_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP,
}; };
/* MAC header values for bit rates */
enum { enum {
IWL_RATE_6M_IEEE = 12, IWL_RATE_6M_IEEE = 12,
IWL_RATE_9M_IEEE = 18, IWL_RATE_9M_IEEE = 18,
...@@ -170,13 +173,8 @@ enum { ...@@ -170,13 +173,8 @@ enum {
#define IWL_MIN_RSSI_VAL -100 #define IWL_MIN_RSSI_VAL -100
#define IWL_MAX_RSSI_VAL 0 #define IWL_MAX_RSSI_VAL 0
#define IWL_LEGACY_SWITCH_ANTENNA 0 /* These values specify how many Tx frame attempts before
#define IWL_LEGACY_SWITCH_SISO 1 * searching for a new modulation mode */
#define IWL_LEGACY_SWITCH_MIMO 2
#define IWL_RS_GOOD_RATIO 12800
#define IWL_ACTION_LIMIT 3
#define IWL_LEGACY_FAILURE_LIMIT 160 #define IWL_LEGACY_FAILURE_LIMIT 160
#define IWL_LEGACY_SUCCESS_LIMIT 480 #define IWL_LEGACY_SUCCESS_LIMIT 480
#define IWL_LEGACY_TABLE_COUNT 160 #define IWL_LEGACY_TABLE_COUNT 160
...@@ -185,29 +183,44 @@ enum { ...@@ -185,29 +183,44 @@ enum {
#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500 #define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500
#define IWL_NONE_LEGACY_TABLE_COUNT 1500 #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_ANTENNA 0
#define IWL_SISO_SWITCH_MIMO 1 #define IWL_SISO_SWITCH_MIMO 1
#define IWL_SISO_SWITCH_GI 2 #define IWL_SISO_SWITCH_GI 2
/* possible actions when in mimo mode */
#define IWL_MIMO_SWITCH_ANTENNA_A 0 #define IWL_MIMO_SWITCH_ANTENNA_A 0
#define IWL_MIMO_SWITCH_ANTENNA_B 1 #define IWL_MIMO_SWITCH_ANTENNA_B 1
#define IWL_MIMO_SWITCH_GI 2 #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]; extern const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT];
enum iwl4965_table_type { enum iwl4965_table_type {
LQ_NONE, LQ_NONE,
LQ_G, LQ_G, /* legacy types */
LQ_A, LQ_A,
LQ_SISO, LQ_SISO, /* high-throughput types */
LQ_MIMO, LQ_MIMO,
LQ_MAX, LQ_MAX,
}; };
/* 4965 has 2 antennas/chains for Tx (but 3 for Rx) */
enum iwl4965_antenna_type { enum iwl4965_antenna_type {
ANT_NONE, ANT_NONE,
ANT_MAIN, ANT_MAIN,
......
...@@ -489,7 +489,7 @@ struct sta_ht_info { ...@@ -489,7 +489,7 @@ struct sta_ht_info {
u8 supported_chan_width; u8 supported_chan_width;
u8 extension_chan_offset; u8 extension_chan_offset;
u8 is_green_field; u8 is_green_field;
u8 sgf; u8 sgf; /* HT_SHORT_GI_* short guard interval */
u8 supp_rates[16]; u8 supp_rates[16];
u8 tx_chan_width; u8 tx_chan_width;
u8 chan_width_cap; u8 chan_width_cap;
......
...@@ -1488,6 +1488,7 @@ int iwl4965_rate_index_from_plcp(int plcp) ...@@ -1488,6 +1488,7 @@ int iwl4965_rate_index_from_plcp(int plcp)
{ {
int i = 0; int i = 0;
/* 4965 HT rate format */
if (plcp & RATE_MCS_HT_MSK) { if (plcp & RATE_MCS_HT_MSK) {
i = (plcp & 0xff); i = (plcp & 0xff);
...@@ -1501,6 +1502,8 @@ int iwl4965_rate_index_from_plcp(int plcp) ...@@ -1501,6 +1502,8 @@ int iwl4965_rate_index_from_plcp(int plcp)
if ((i >= IWL_FIRST_OFDM_RATE) && if ((i >= IWL_FIRST_OFDM_RATE) &&
(i <= IWL_LAST_OFDM_RATE)) (i <= IWL_LAST_OFDM_RATE))
return i; return i;
/* 4965 legacy rate format, search for match in table */
} else { } else {
for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++) for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++)
if (iwl4965_rates[i].plcp == (plcp &0xFF)) if (iwl4965_rates[i].plcp == (plcp &0xFF))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment