Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0c2c8852
Commit
0c2c8852
authored
Nov 15, 2011
by
Stanislaw Gruszka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iwlegacy: s/index/idx/
Signed-off-by:
Stanislaw Gruszka
<
sgruszka@redhat.com
>
parent
2d09b062
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
618 additions
and
618 deletions
+618
-618
drivers/net/wireless/iwlegacy/iwl-3945-hw.h
drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+3
-3
drivers/net/wireless/iwlegacy/iwl-3945-rs.c
drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+55
-55
drivers/net/wireless/iwlegacy/iwl-3945.c
drivers/net/wireless/iwlegacy/iwl-3945.c
+157
-157
drivers/net/wireless/iwlegacy/iwl-4965-hw.h
drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+18
-18
drivers/net/wireless/iwlegacy/iwl-4965-lib.c
drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+2
-2
drivers/net/wireless/iwlegacy/iwl-4965-rs.c
drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+145
-145
drivers/net/wireless/iwlegacy/iwl-4965-sta.c
drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+7
-7
drivers/net/wireless/iwlegacy/iwl-4965-tx.c
drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+17
-17
drivers/net/wireless/iwlegacy/iwl-4965.c
drivers/net/wireless/iwlegacy/iwl-4965.c
+42
-42
drivers/net/wireless/iwlegacy/iwl-4965.h
drivers/net/wireless/iwlegacy/iwl-4965.h
+2
-2
drivers/net/wireless/iwlegacy/iwl-commands.h
drivers/net/wireless/iwlegacy/iwl-commands.h
+21
-21
drivers/net/wireless/iwlegacy/iwl-csr.h
drivers/net/wireless/iwlegacy/iwl-csr.h
+3
-3
drivers/net/wireless/iwlegacy/iwl-dev.h
drivers/net/wireless/iwlegacy/iwl-dev.h
+17
-17
drivers/net/wireless/iwlegacy/iwl-eeprom.c
drivers/net/wireless/iwlegacy/iwl-eeprom.c
+15
-15
drivers/net/wireless/iwlegacy/iwl-eeprom.h
drivers/net/wireless/iwlegacy/iwl-eeprom.h
+1
-1
drivers/net/wireless/iwlegacy/iwl-fh.h
drivers/net/wireless/iwlegacy/iwl-fh.h
+15
-15
drivers/net/wireless/iwlegacy/iwl-helpers.h
drivers/net/wireless/iwlegacy/iwl-helpers.h
+8
-8
drivers/net/wireless/iwlegacy/iwl-led.c
drivers/net/wireless/iwlegacy/iwl-led.c
+1
-1
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+3
-3
drivers/net/wireless/iwlegacy/iwl-prph.h
drivers/net/wireless/iwlegacy/iwl-prph.h
+9
-9
drivers/net/wireless/iwlegacy/iwl-rx.c
drivers/net/wireless/iwlegacy/iwl-rx.c
+11
-11
drivers/net/wireless/iwlegacy/iwl-sta.c
drivers/net/wireless/iwlegacy/iwl-sta.c
+7
-7
drivers/net/wireless/iwlegacy/iwl-sta.h
drivers/net/wireless/iwlegacy/iwl-sta.h
+1
-1
drivers/net/wireless/iwlegacy/iwl-tx.c
drivers/net/wireless/iwlegacy/iwl-tx.c
+18
-18
drivers/net/wireless/iwlegacy/iwl3945-base.c
drivers/net/wireless/iwlegacy/iwl3945-base.c
+22
-22
drivers/net/wireless/iwlegacy/iwl4965-base.c
drivers/net/wireless/iwlegacy/iwl4965-base.c
+18
-18
No files found.
drivers/net/wireless/iwlegacy/iwl-3945-hw.h
View file @
0c2c8852
...
...
@@ -81,7 +81,7 @@
/*
* Mapping of a Tx power level, at factory calibration temperature,
* to a radio/DSP gain table i
nde
x.
* to a radio/DSP gain table i
d
x.
* One for each of 5 "sample" power levels in each band.
* v_det is measured at the factory, using the 3945's built-in power amplifier
* (PA) output voltage detector. This same detector is used during Tx of
...
...
@@ -91,13 +91,13 @@
* DO NOT ALTER THIS STRUCTURE!!!
*/
struct
il3945_eeprom_txpower_sample
{
u8
gain_i
ndex
;
/* inde
x into power (gain) setup table ... */
u8
gain_i
dx
;
/* id
x into power (gain) setup table ... */
s8
power
;
/* ... for this pwr level for this chnl group */
u16
v_det
;
/* PA output voltage */
}
__packed
;
/*
* Mappings of Tx power levels -> nominal radio/DSP gain table i
nde
xes.
* Mappings of Tx power levels -> nominal radio/DSP gain table i
d
xes.
* One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
* Tx power setup code interpolates between the 5 "sample" power levels
* to determine the nominal setup for a requested power level.
...
...
drivers/net/wireless/iwlegacy/iwl-3945-rs.c
View file @
0c2c8852
...
...
@@ -60,7 +60,7 @@ static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = {
struct
il3945_tpt_entry
{
s8
min_rssi
;
u8
i
nde
x
;
u8
i
d
x
;
};
static
struct
il3945_tpt_entry
il3945_tpt_table_a
[]
=
{
...
...
@@ -98,9 +98,9 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = {
#define RATE_DECREASE_TH 1920
#define RATE_RETRY_TH 15
static
u8
il3945_get_rate_i
nde
x_by_rssi
(
s32
rssi
,
enum
ieee80211_band
band
)
static
u8
il3945_get_rate_i
d
x_by_rssi
(
s32
rssi
,
enum
ieee80211_band
band
)
{
u32
i
nde
x
=
0
;
u32
i
d
x
=
0
;
u32
table_size
=
0
;
struct
il3945_tpt_entry
*
tpt_table
=
NULL
;
...
...
@@ -123,12 +123,12 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
break
;
}
while
(
i
ndex
<
table_size
&&
rssi
<
tpt_table
[
inde
x
].
min_rssi
)
i
nde
x
++
;
while
(
i
dx
<
table_size
&&
rssi
<
tpt_table
[
id
x
].
min_rssi
)
i
d
x
++
;
i
ndex
=
min
(
inde
x
,
(
table_size
-
1
));
i
dx
=
min
(
id
x
,
(
table_size
-
1
));
return
tpt_table
[
i
ndex
].
inde
x
;
return
tpt_table
[
i
dx
].
id
x
;
}
static
void
il3945_clear_win
(
struct
il3945_rate_scale_data
*
win
)
...
...
@@ -168,7 +168,7 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
if
(
time_after
(
jiffies
,
rs_sta
->
win
[
i
].
stamp
+
RATE_WIN_FLUSH
))
{
D_RATE
(
"flushing %d samples of rate "
"i
nde
x %d
\n
"
,
"i
d
x %d
\n
"
,
rs_sta
->
win
[
i
].
counter
,
i
);
il3945_clear_win
(
&
rs_sta
->
win
[
i
]);
}
else
...
...
@@ -256,7 +256,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
*/
static
void
il3945_collect_tx_data
(
struct
il3945_rs_sta
*
rs_sta
,
struct
il3945_rate_scale_data
*
win
,
int
success
,
int
retries
,
int
i
nde
x
)
int
success
,
int
retries
,
int
i
d
x
)
{
unsigned
long
flags
;
s32
fail_count
;
...
...
@@ -318,7 +318,7 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
if
(
fail_count
>=
RATE_MIN_FAILURE_TH
||
win
->
success_counter
>=
RATE_MIN_SUCCESS_TH
)
win
->
average_tpt
=
((
win
->
success_ratio
*
rs_sta
->
expected_tpt
[
i
nde
x
]
+
64
)
/
128
);
rs_sta
->
expected_tpt
[
i
d
x
]
+
64
)
/
128
);
else
win
->
average_tpt
=
IL_INVALID_VALUE
;
...
...
@@ -447,7 +447,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
struct
sk_buff
*
skb
)
{
s8
retries
=
0
,
current_count
;
int
scale_rate_i
ndex
,
first_index
,
last_inde
x
;
int
scale_rate_i
dx
,
first_idx
,
last_id
x
;
unsigned
long
flags
;
struct
il_priv
*
il
=
(
struct
il_priv
*
)
il_rate
;
struct
il3945_rs_sta
*
rs_sta
=
il_sta
;
...
...
@@ -460,9 +460,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
if
(
retries
>
RATE_RETRY_TH
)
retries
=
RATE_RETRY_TH
;
first_i
nde
x
=
sband
->
bitrates
[
info
->
status
.
rates
[
0
].
idx
].
hw_value
;
if
(
first_i
ndex
<
0
||
first_inde
x
>=
RATE_COUNT_3945
)
{
D_RATE
(
"leave: Rate out of bounds: %d
\n
"
,
first_i
nde
x
);
first_i
d
x
=
sband
->
bitrates
[
info
->
status
.
rates
[
0
].
idx
].
hw_value
;
if
(
first_i
dx
<
0
||
first_id
x
>=
RATE_COUNT_3945
)
{
D_RATE
(
"leave: Rate out of bounds: %d
\n
"
,
first_i
d
x
);
return
;
}
...
...
@@ -480,8 +480,8 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
rs_sta
->
tx_packets
++
;
scale_rate_i
ndex
=
first_inde
x
;
last_i
ndex
=
first_inde
x
;
scale_rate_i
dx
=
first_id
x
;
last_i
dx
=
first_id
x
;
/*
* Update the win for each rate. We determine which rates
...
...
@@ -489,42 +489,42 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
* of retries configured for each rate -- currently set to the
* il value 'retry_rate' vs. rate specific
*
* On exit from this while loop last_i
nde
x indicates the rate
* On exit from this while loop last_i
d
x indicates the rate
* at which the frame was finally transmitted (or failed if no
* ACK)
*/
while
(
retries
>
1
)
{
if
((
retries
-
1
)
<
il
->
retry_rate
)
{
current_count
=
(
retries
-
1
);
last_i
ndex
=
scale_rate_inde
x
;
last_i
dx
=
scale_rate_id
x
;
}
else
{
current_count
=
il
->
retry_rate
;
last_i
nde
x
=
il3945_rs_next_rate
(
il
,
scale_rate_i
nde
x
);
last_i
d
x
=
il3945_rs_next_rate
(
il
,
scale_rate_i
d
x
);
}
/* Update this rate accounting for as many retries
* as was used for it (per current_count) */
il3945_collect_tx_data
(
rs_sta
,
&
rs_sta
->
win
[
scale_rate_i
nde
x
],
0
,
current_count
,
scale_rate_i
nde
x
);
&
rs_sta
->
win
[
scale_rate_i
d
x
],
0
,
current_count
,
scale_rate_i
d
x
);
D_RATE
(
"Update rate %d for %d retries.
\n
"
,
scale_rate_i
nde
x
,
current_count
);
scale_rate_i
d
x
,
current_count
);
retries
-=
current_count
;
scale_rate_i
ndex
=
last_inde
x
;
scale_rate_i
dx
=
last_id
x
;
}
/* Update the last i
nde
x win with success/failure based on ACK */
/* Update the last i
d
x win with success/failure based on ACK */
D_RATE
(
"Update rate %d with %s.
\n
"
,
last_i
nde
x
,
last_i
d
x
,
(
info
->
flags
&
IEEE80211_TX_STAT_ACK
)
?
"success"
:
"failure"
);
il3945_collect_tx_data
(
rs_sta
,
&
rs_sta
->
win
[
last_i
nde
x
],
info
->
flags
&
IEEE80211_TX_STAT_ACK
,
1
,
last_i
nde
x
);
&
rs_sta
->
win
[
last_i
d
x
],
info
->
flags
&
IEEE80211_TX_STAT_ACK
,
1
,
last_i
d
x
);
/* We updated the rate scale win -- if its been more than
* flush_time since the last run, schedule the flush
...
...
@@ -547,7 +547,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
}
static
u16
il3945_get_adjacent_rate
(
struct
il3945_rs_sta
*
rs_sta
,
u8
i
nde
x
,
u16
rate_mask
,
enum
ieee80211_band
band
)
u8
i
d
x
,
u16
rate_mask
,
enum
ieee80211_band
band
)
{
u8
high
=
RATE_INVALID
;
u8
low
=
RATE_INVALID
;
...
...
@@ -560,7 +560,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
u32
mask
;
/* Find the previous rate that is in the rate mask */
i
=
i
nde
x
-
1
;
i
=
i
d
x
-
1
;
for
(
mask
=
(
1
<<
i
);
i
>=
0
;
i
--
,
mask
>>=
1
)
{
if
(
rate_mask
&
mask
)
{
low
=
i
;
...
...
@@ -569,7 +569,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
}
/* Find the next rate that is in the rate mask */
i
=
i
nde
x
+
1
;
i
=
i
d
x
+
1
;
for
(
mask
=
(
1
<<
i
);
i
<
RATE_COUNT_3945
;
i
++
,
mask
<<=
1
)
{
if
(
rate_mask
&
mask
)
{
...
...
@@ -581,7 +581,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
return
(
high
<<
8
)
|
low
;
}
low
=
i
nde
x
;
low
=
i
d
x
;
while
(
low
!=
RATE_INVALID
)
{
if
(
rs_sta
->
tgg
)
low
=
il3945_rates
[
low
].
prev_rs_tgg
;
...
...
@@ -594,7 +594,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
D_RATE
(
"Skipping masked lower rate: %d
\n
"
,
low
);
}
high
=
i
nde
x
;
high
=
i
d
x
;
while
(
high
!=
RATE_INVALID
)
{
if
(
rs_sta
->
tgg
)
high
=
il3945_rates
[
high
].
next_rs_tgg
;
...
...
@@ -622,7 +622,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
* the entire A/B/G spectrum vs. being limited to just one particular
* hw_mode.
*
* As such, we can't convert the i
nde
x obtained below into the hw_mode's
* As such, we can't convert the i
d
x obtained below into the hw_mode's
* rate table and must reference the driver allocated rate table
*
*/
...
...
@@ -634,7 +634,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
u8
low
=
RATE_INVALID
;
u8
high
=
RATE_INVALID
;
u16
high_low
;
int
i
nde
x
;
int
i
d
x
;
struct
il3945_rs_sta
*
rs_sta
=
il_sta
;
struct
il3945_rate_scale_data
*
win
=
NULL
;
int
current_tpt
=
IL_INVALID_VALUE
;
...
...
@@ -668,7 +668,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
if
(
max_rate_idx
<
0
||
max_rate_idx
>=
RATE_COUNT
)
max_rate_idx
=
-
1
;
i
nde
x
=
min
(
rs_sta
->
last_txrate_idx
&
0xffff
,
RATE_COUNT_3945
-
1
);
i
d
x
=
min
(
rs_sta
->
last_txrate_idx
&
0xffff
,
RATE_COUNT_3945
-
1
);
if
(
sband
->
band
==
IEEE80211_BAND_5GHZ
)
rate_mask
=
rate_mask
<<
IL_FIRST_OFDM_RATE
;
...
...
@@ -679,19 +679,19 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
* to rssi value
*/
if
(
rs_sta
->
start_rate
!=
RATE_INVALID
)
{
if
(
rs_sta
->
start_rate
<
i
nde
x
&&
if
(
rs_sta
->
start_rate
<
i
d
x
&&
(
rate_mask
&
(
1
<<
rs_sta
->
start_rate
)))
i
nde
x
=
rs_sta
->
start_rate
;
i
d
x
=
rs_sta
->
start_rate
;
rs_sta
->
start_rate
=
RATE_INVALID
;
}
/* force user max rate if set by user */
if
(
max_rate_idx
!=
-
1
&&
max_rate_idx
<
i
nde
x
)
{
if
(
max_rate_idx
!=
-
1
&&
max_rate_idx
<
i
d
x
)
{
if
(
rate_mask
&
(
1
<<
max_rate_idx
))
i
nde
x
=
max_rate_idx
;
i
d
x
=
max_rate_idx
;
}
win
=
&
(
rs_sta
->
win
[
i
nde
x
]);
win
=
&
(
rs_sta
->
win
[
i
d
x
]);
fail_count
=
win
->
counter
-
win
->
success_counter
;
...
...
@@ -702,7 +702,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
D_RATE
(
"Invalid average_tpt on rate %d: "
"counter: %d, success_counter: %d, "
"expected_tpt is %sNULL
\n
"
,
i
nde
x
,
i
d
x
,
win
->
counter
,
win
->
success_counter
,
rs_sta
->
expected_tpt
?
"not "
:
""
);
...
...
@@ -715,7 +715,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
current_tpt
=
win
->
average_tpt
;
high_low
=
il3945_get_adjacent_rate
(
rs_sta
,
i
nde
x
,
rate_mask
,
high_low
=
il3945_get_adjacent_rate
(
rs_sta
,
i
d
x
,
rate_mask
,
sband
->
band
);
low
=
high_low
&
0xff
;
high
=
(
high_low
>>
8
)
&
0xff
;
...
...
@@ -800,13 +800,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
/* Decrese rate */
if
(
low
!=
RATE_INVALID
)
i
nde
x
=
low
;
i
d
x
=
low
;
break
;
case
1
:
/* Increase rate */
if
(
high
!=
RATE_INVALID
)
i
nde
x
=
high
;
i
d
x
=
high
;
break
;
...
...
@@ -817,21 +817,21 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
}
D_RATE
(
"Selected %d (action %d) - low %d high %d
\n
"
,
i
nde
x
,
scale_action
,
low
,
high
);
i
d
x
,
scale_action
,
low
,
high
);
out:
if
(
sband
->
band
==
IEEE80211_BAND_5GHZ
)
{
if
(
WARN_ON_ONCE
(
i
nde
x
<
IL_FIRST_OFDM_RATE
))
i
nde
x
=
IL_FIRST_OFDM_RATE
;
rs_sta
->
last_txrate_idx
=
i
nde
x
;
info
->
control
.
rates
[
0
].
idx
=
i
nde
x
-
IL_FIRST_OFDM_RATE
;
if
(
WARN_ON_ONCE
(
i
d
x
<
IL_FIRST_OFDM_RATE
))
i
d
x
=
IL_FIRST_OFDM_RATE
;
rs_sta
->
last_txrate_idx
=
i
d
x
;
info
->
control
.
rates
[
0
].
idx
=
i
d
x
-
IL_FIRST_OFDM_RATE
;
}
else
{
rs_sta
->
last_txrate_idx
=
i
nde
x
;
rs_sta
->
last_txrate_idx
=
i
d
x
;
info
->
control
.
rates
[
0
].
idx
=
rs_sta
->
last_txrate_idx
;
}
D_RATE
(
"leave: %d
\n
"
,
i
nde
x
);
D_RATE
(
"leave: %d
\n
"
,
i
d
x
);
}
#ifdef CONFIG_MAC80211_DEBUGFS
...
...
@@ -855,7 +855,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file,
if
(
!
buff
)
return
-
ENOMEM
;
desc
+=
sprintf
(
buff
+
desc
,
"tx packets=%d last rate i
nde
x=%d
\n
"
desc
+=
sprintf
(
buff
+
desc
,
"tx packets=%d last rate i
d
x=%d
\n
"
"rate=0x%X flush time %d
\n
"
,
lq_sta
->
tx_packets
,
lq_sta
->
last_txrate_idx
,
...
...
@@ -977,9 +977,9 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
D_RATE
(
"Network RSSI: %d
\n
"
,
rssi
);
rs_sta
->
start_rate
=
il3945_get_rate_i
nde
x_by_rssi
(
rssi
,
il
->
band
);
rs_sta
->
start_rate
=
il3945_get_rate_i
d
x_by_rssi
(
rssi
,
il
->
band
);
D_RATE
(
"leave: rssi %d assign rate i
nde
x: "
D_RATE
(
"leave: rssi %d assign rate i
d
x: "
"%d (plcp 0x%x)
\n
"
,
rssi
,
rs_sta
->
start_rate
,
il3945_rates
[
rs_sta
->
start_rate
].
plcp
);
rcu_read_unlock
();
...
...
drivers/net/wireless/iwlegacy/iwl-3945.c
View file @
0c2c8852
...
...
@@ -86,12 +86,12 @@ const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = {
IL_DECLARE_RATE_INFO
(
54
,
48
,
INV
,
48
,
INV
,
48
,
INV
),
/* 54mbps */
};
static
inline
u8
il3945_get_prev_ieee_rate
(
u8
rate_i
nde
x
)
static
inline
u8
il3945_get_prev_ieee_rate
(
u8
rate_i
d
x
)
{
u8
rate
=
il3945_rates
[
rate_i
nde
x
].
prev_ieee
;
u8
rate
=
il3945_rates
[
rate_i
d
x
].
prev_ieee
;
if
(
rate
==
RATE_INVALID
)
rate
=
rate_i
nde
x
;
rate
=
rate_i
d
x
;
return
rate
;
}
...
...
@@ -270,12 +270,12 @@ int il3945_rs_next_rate(struct il_priv *il, int rate)
/**
* il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd
*
* When FW advances 'R' i
ndex, all entries between old and new 'R' inde
x
* When FW advances 'R' i
dx, all entries between old and new 'R' id
x
* need to be reclaimed. As result, some free space forms. If there is
* enough free space (> low mark), wake the stack that feeds us.
*/
static
void
il3945_tx_queue_reclaim
(
struct
il_priv
*
il
,
int
txq_id
,
int
i
nde
x
)
int
txq_id
,
int
i
d
x
)
{
struct
il_tx_queue
*
txq
=
&
il
->
txq
[
txq_id
];
struct
il_queue
*
q
=
&
txq
->
q
;
...
...
@@ -283,8 +283,8 @@ static void il3945_tx_queue_reclaim(struct il_priv *il,
BUG_ON
(
txq_id
==
IL39_CMD_QUEUE_NUM
);
for
(
i
ndex
=
il_queue_inc_wrap
(
inde
x
,
q
->
n_bd
);
q
->
read_ptr
!=
i
nde
x
;
for
(
i
dx
=
il_queue_inc_wrap
(
id
x
,
q
->
n_bd
);
q
->
read_ptr
!=
i
d
x
;
q
->
read_ptr
=
il_queue_inc_wrap
(
q
->
read_ptr
,
q
->
n_bd
))
{
tx_info
=
&
txq
->
txb
[
txq
->
q
.
read_ptr
];
...
...
@@ -307,7 +307,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
struct
il_rx_pkt
*
pkt
=
rxb_addr
(
rxb
);
u16
sequence
=
le16_to_cpu
(
pkt
->
hdr
.
sequence
);
int
txq_id
=
SEQ_TO_QUEUE
(
sequence
);
int
i
nde
x
=
SEQ_TO_IDX
(
sequence
);
int
i
d
x
=
SEQ_TO_IDX
(
sequence
);
struct
il_tx_queue
*
txq
=
&
il
->
txq
[
txq_id
];
struct
ieee80211_tx_info
*
info
;
struct
il3945_tx_resp
*
tx_resp
=
(
void
*
)
&
pkt
->
u
.
raw
[
0
];
...
...
@@ -315,10 +315,10 @@ static void il3945_rx_reply_tx(struct il_priv *il,
int
rate_idx
;
int
fail
;
if
(
i
ndex
>=
txq
->
q
.
n_bd
||
il_queue_used
(
&
txq
->
q
,
inde
x
)
==
0
)
{
IL_ERR
(
"Read i
ndex for DMA queue txq_id (%d) inde
x %d "
if
(
i
dx
>=
txq
->
q
.
n_bd
||
il_queue_used
(
&
txq
->
q
,
id
x
)
==
0
)
{
IL_ERR
(
"Read i
dx for DMA queue txq_id (%d) id
x %d "
"is out of range [0-%d] %d %d
\n
"
,
txq_id
,
i
nde
x
,
txq
->
q
.
n_bd
,
txq
->
q
.
write_ptr
,
i
d
x
,
txq
->
q
.
n_bd
,
txq
->
q
.
write_ptr
,
txq
->
q
.
read_ptr
);
return
;
}
...
...
@@ -345,8 +345,8 @@ static void il3945_rx_reply_tx(struct il_priv *il,
txq_id
,
il3945_get_tx_fail_reason
(
status
),
status
,
tx_resp
->
rate
,
tx_resp
->
failure_frame
);
D_TX_REPLY
(
"Tx queue reclaim %d
\n
"
,
i
nde
x
);
il3945_tx_queue_reclaim
(
il
,
txq_id
,
i
nde
x
);
D_TX_REPLY
(
"Tx queue reclaim %d
\n
"
,
i
d
x
);
il3945_tx_queue_reclaim
(
il
,
txq_id
,
i
d
x
);
if
(
status
&
TX_ABORT_REQUIRED_MSK
)
IL_ERR
(
"TODO: Implement Tx ABORT REQUIRED!!!
\n
"
);
...
...
@@ -616,15 +616,15 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
}
/**
* il3945_hw_txq_free_tfd - Free one TFD, those at i
nde
x [txq->q.read_ptr]
* il3945_hw_txq_free_tfd - Free one TFD, those at i
d
x [txq->q.read_ptr]
*
* Does NOT advance any i
nde
xes
* Does NOT advance any i
d
xes
*/
void
il3945_hw_txq_free_tfd
(
struct
il_priv
*
il
,
struct
il_tx_queue
*
txq
)
{
struct
il3945_tfd
*
tfd_tmp
=
(
struct
il3945_tfd
*
)
txq
->
tfds
;
int
i
nde
x
=
txq
->
q
.
read_ptr
;
struct
il3945_tfd
*
tfd
=
&
tfd_tmp
[
i
nde
x
];
int
i
d
x
=
txq
->
q
.
read_ptr
;
struct
il3945_tfd
*
tfd
=
&
tfd_tmp
[
i
d
x
];
struct
pci_dev
*
dev
=
il
->
pci_dev
;
int
i
;
int
counter
;
...
...
@@ -640,8 +640,8 @@ void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
/* Unmap tx_cmd */
if
(
counter
)
pci_unmap_single
(
dev
,
dma_unmap_addr
(
&
txq
->
meta
[
i
nde
x
],
mapping
),
dma_unmap_len
(
&
txq
->
meta
[
i
nde
x
],
len
),
dma_unmap_addr
(
&
txq
->
meta
[
i
d
x
],
mapping
),
dma_unmap_len
(
&
txq
->
meta
[
i
d
x
],
len
),
PCI_DMA_TODEVICE
);
/* unmap chunks if any */
...
...
@@ -675,7 +675,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
int
sta_id
,
int
tx_id
)
{
u16
hw_value
=
ieee80211_get_tx_rate
(
il
->
hw
,
info
)
->
hw_value
;
u16
rate_i
nde
x
=
min
(
hw_value
&
0xffff
,
RATE_COUNT_3945
);
u16
rate_i
d
x
=
min
(
hw_value
&
0xffff
,
RATE_COUNT_3945
);
u16
rate_mask
;
int
rate
;
u8
rts_retry_limit
;
...
...
@@ -684,7 +684,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
__le16
fc
=
hdr
->
frame_control
;
struct
il3945_tx_cmd
*
tx_cmd
=
(
struct
il3945_tx_cmd
*
)
cmd
->
cmd
.
payload
;
rate
=
il3945_rates
[
rate_i
nde
x
].
plcp
;
rate
=
il3945_rates
[
rate_i
d
x
].
plcp
;
tx_flags
=
tx_cmd
->
tx_flags
;
/* We need to figure out how to get the sta->supp_rates while
...
...
@@ -1040,7 +1040,7 @@ void il3945_hw_txq_ctx_stop(struct il_priv *il)
/**
* il3945_hw_reg_adjust_power_by_temp
* return i
nde
x delta into power gain settings table
* return i
d
x delta into power gain settings table
*/
static
int
il3945_hw_reg_adjust_power_by_temp
(
int
new_reading
,
int
old_reading
)
{
...
...
@@ -1298,13 +1298,13 @@ static struct il3945_tx_power power_gain_table[2][IL_MAX_GAIN_ENTRIES] = {
{
3
,
120
}
}
/* 5.x GHz, lowest power */
};
static
inline
u8
il3945_hw_reg_fix_power_i
ndex
(
int
inde
x
)
static
inline
u8
il3945_hw_reg_fix_power_i
dx
(
int
id
x
)
{
if
(
i
nde
x
<
0
)
if
(
i
d
x
<
0
)
return
0
;
if
(
i
nde
x
>=
IL_MAX_GAIN_ENTRIES
)
if
(
i
d
x
>=
IL_MAX_GAIN_ENTRIES
)
return
IL_MAX_GAIN_ENTRIES
-
1
;
return
(
u8
)
i
nde
x
;
return
(
u8
)
i
d
x
;
}
/* Kick off thermal recalibration check every 60 seconds */
...
...
@@ -1316,16 +1316,16 @@ static inline u8 il3945_hw_reg_fix_power_index(int index)
* Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
* or 6 Mbit (OFDM) rates.
*/
static
void
il3945_hw_reg_set_scan_power
(
struct
il_priv
*
il
,
u32
scan_tbl_i
nde
x
,
s32
rate_i
nde
x
,
const
s8
*
clip_pwrs
,
static
void
il3945_hw_reg_set_scan_power
(
struct
il_priv
*
il
,
u32
scan_tbl_i
d
x
,
s32
rate_i
d
x
,
const
s8
*
clip_pwrs
,
struct
il_channel_info
*
ch_info
,
int
band_i
nde
x
)
int
band_i
d
x
)
{
struct
il3945_scan_power_info
*
scan_power_info
;
s8
power
;
u8
power_i
nde
x
;
u8
power_i
d
x
;
scan_power_info
=
&
ch_info
->
scan_pwr_info
[
scan_tbl_i
nde
x
];
scan_power_info
=
&
ch_info
->
scan_pwr_info
[
scan_tbl_i
d
x
];
/* use this channel group's 6Mbit clipping/saturation pwr,
* but cap at regulatory scan power restriction (set during init
...
...
@@ -1337,30 +1337,30 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
/* find difference between new scan *power* and current "normal"
* Tx *power* for 6Mb. Use this difference (x2) to adjust the
* current "normal" temperature-compensated Tx power *i
nde
x* for
* current "normal" temperature-compensated Tx power *i
d
x* for
* this rate (1Mb or 6Mb) to yield new temp-compensated scan power
* *i
nde
x*. */
power_i
ndex
=
ch_info
->
power_info
[
rate_index
].
power_table_inde
x
* *i
d
x*. */
power_i
dx
=
ch_info
->
power_info
[
rate_idx
].
power_table_id
x
-
(
power
-
ch_info
->
power_info
[
RATE_6M_IDX_TABLE
].
requested_power
)
*
2
;
/* store reference i
nde
x that we use when adjusting *all* scan
/* store reference i
d
x that we use when adjusting *all* scan
* powers. So we can accommodate user (all channel) or spectrum
* management (single channel) power changes "between" temperature
* feedback compensation procedures.
* don't force fit this reference i
nde
x into gain table; it may be a
* don't force fit this reference i
d
x into gain table; it may be a
* negative number. This will help avoid errors when we're at
* the lower bounds (highest gains, for warmest temperatures)
* of the table. */
/* don't exceed table bounds for "real" setting */
power_i
ndex
=
il3945_hw_reg_fix_power_index
(
power_inde
x
);
power_i
dx
=
il3945_hw_reg_fix_power_idx
(
power_id
x
);
scan_power_info
->
power_table_i
ndex
=
power_inde
x
;
scan_power_info
->
power_table_i
dx
=
power_id
x
;
scan_power_info
->
tpc
.
tx_gain
=
power_gain_table
[
band_i
ndex
][
power_inde
x
].
tx_gain
;
power_gain_table
[
band_i
dx
][
power_id
x
].
tx_gain
;
scan_power_info
->
tpc
.
dsp_atten
=
power_gain_table
[
band_i
ndex
][
power_inde
x
].
dsp_atten
;
power_gain_table
[
band_i
dx
][
power_id
x
].
dsp_atten
;
}
/**
...
...
@@ -1438,7 +1438,7 @@ static int il3945_send_tx_power(struct il_priv *il)
* il3945_hw_reg_set_new_power - Configures power tables at new levels
* @ch_info: Channel to update. Uses power_info.requested_power.
*
* Replace requested_power and base_power_i
nde
x ch_info fields for
* Replace requested_power and base_power_i
d
x ch_info fields for
* one channel.
*
* Called if user or spectrum management changes power preferences.
...
...
@@ -1460,7 +1460,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
int
power
;
/* Get this chnlgrp's rate-to-max/clip-powers table */
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
nde
x
].
clip_powers
;
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
d
x
].
clip_powers
;
/* Get this channel's rate-to-current-power settings table */
power_info
=
ch_info
->
power_info
;
...
...
@@ -1476,9 +1476,9 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
continue
;
/* find difference between old and new requested powers,
* update base (non-temp-compensated) power i
nde
x */
* update base (non-temp-compensated) power i
d
x */
delta_idx
=
(
power
-
power_info
->
requested_power
)
*
2
;
power_info
->
base_power_i
nde
x
-=
delta_idx
;
power_info
->
base_power_i
d
x
-=
delta_idx
;
/* save new requested power value */
power_info
->
requested_power
=
power
;
...
...
@@ -1496,9 +1496,9 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
/* do all CCK rates' il3945_channel_power_info structures */
for
(
i
=
RATE_1M_IDX_TABLE
;
i
<=
RATE_11M_IDX_TABLE
;
i
++
)
{
power_info
->
requested_power
=
power
;
power_info
->
base_power_i
nde
x
=
power_info
->
base_power_i
d
x
=
ch_info
->
power_info
[
RATE_12M_IDX_TABLE
].
base_power_i
nde
x
+
IL_CCK_FROM_OFDM_IDX_DIFF
;
base_power_i
d
x
+
IL_CCK_FROM_OFDM_IDX_DIFF
;
++
power_info
;
}
}
...
...
@@ -1537,7 +1537,7 @@ static int il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info)
* Compensate txpower settings of *all* channels for temperature.
* This only accounts for the difference between current temperature
* and the factory calibration temperatures, and bases the new settings
* on the channel's base_power_i
nde
x.
* on the channel's base_power_i
d
x.
*
* If RxOn is "associated", this sends the new Txpower to NIC!
*/
...
...
@@ -1545,11 +1545,11 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
{
struct
il_channel_info
*
ch_info
=
NULL
;
struct
il3945_eeprom
*
eeprom
=
(
struct
il3945_eeprom
*
)
il
->
eeprom
;
int
delta_i
nde
x
;
int
delta_i
d
x
;
const
s8
*
clip_pwrs
;
/* array of h/w max power levels for each rate */
u8
a_band
;
u8
rate_i
nde
x
;
u8
scan_tbl_i
nde
x
;
u8
rate_i
d
x
;
u8
scan_tbl_i
d
x
;
u8
i
;
int
ref_temp
;
int
temperature
=
il
->
temperature
;
...
...
@@ -1565,41 +1565,41 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
a_band
=
il_is_channel_a_band
(
ch_info
);
/* Get this chnlgrp's factory calibration temperature */
ref_temp
=
(
s16
)
eeprom
->
groups
[
ch_info
->
group_i
nde
x
].
ref_temp
=
(
s16
)
eeprom
->
groups
[
ch_info
->
group_i
d
x
].
temperature
;
/* get power i
nde
x adjustment based on current and factory
/* get power i
d
x adjustment based on current and factory
* temps */
delta_i
nde
x
=
il3945_hw_reg_adjust_power_by_temp
(
temperature
,
delta_i
d
x
=
il3945_hw_reg_adjust_power_by_temp
(
temperature
,
ref_temp
);
/* set tx power value for all rates, OFDM and CCK */
for
(
rate_i
ndex
=
0
;
rate_inde
x
<
RATE_COUNT_3945
;
rate_i
nde
x
++
)
{
for
(
rate_i
dx
=
0
;
rate_id
x
<
RATE_COUNT_3945
;
rate_i
d
x
++
)
{
int
power_idx
=
ch_info
->
power_info
[
rate_i
ndex
].
base_power_inde
x
;
ch_info
->
power_info
[
rate_i
dx
].
base_power_id
x
;
/* temperature compensate */
power_idx
+=
delta_i
nde
x
;
power_idx
+=
delta_i
d
x
;
/* stay within table range */
power_idx
=
il3945_hw_reg_fix_power_i
nde
x
(
power_idx
);
ch_info
->
power_info
[
rate_i
nde
x
].
power_table_i
nde
x
=
(
u8
)
power_idx
;
ch_info
->
power_info
[
rate_i
nde
x
].
tpc
=
power_idx
=
il3945_hw_reg_fix_power_i
d
x
(
power_idx
);
ch_info
->
power_info
[
rate_i
d
x
].
power_table_i
d
x
=
(
u8
)
power_idx
;
ch_info
->
power_info
[
rate_i
d
x
].
tpc
=
power_gain_table
[
a_band
][
power_idx
];
}
/* Get this chnlgrp's rate-to-max/clip-powers table */
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
nde
x
].
clip_powers
;
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
d
x
].
clip_powers
;
/* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
for
(
scan_tbl_i
nde
x
=
0
;
scan_tbl_i
ndex
<
IL_NUM_SCAN_RATES
;
scan_tbl_inde
x
++
)
{
s32
actual_i
ndex
=
(
scan_tbl_inde
x
==
0
)
?
for
(
scan_tbl_i
d
x
=
0
;
scan_tbl_i
dx
<
IL_NUM_SCAN_RATES
;
scan_tbl_id
x
++
)
{
s32
actual_i
dx
=
(
scan_tbl_id
x
==
0
)
?
RATE_1M_IDX_TABLE
:
RATE_6M_IDX_TABLE
;
il3945_hw_reg_set_scan_power
(
il
,
scan_tbl_i
nde
x
,
actual_i
nde
x
,
clip_pwrs
,
il3945_hw_reg_set_scan_power
(
il
,
scan_tbl_i
d
x
,
actual_i
d
x
,
clip_pwrs
,
ch_info
,
a_band
);
}
}
...
...
@@ -1878,7 +1878,7 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
}
/**
* il3945_hw_reg_get_ch_grp_i
ndex - find the channel-group inde
x (0-4)
* il3945_hw_reg_get_ch_grp_i
dx - find the channel-group id
x (0-4)
* for the channel.
*
* This function is used when initializing channel-info structs.
...
...
@@ -1888,48 +1888,48 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
* on A-band, EEPROM's "group frequency" entries represent the top
* channel in each group 1-4. Group 5 All B/G channels are in group 0.
*/
static
u16
il3945_hw_reg_get_ch_grp_i
nde
x
(
struct
il_priv
*
il
,
static
u16
il3945_hw_reg_get_ch_grp_i
d
x
(
struct
il_priv
*
il
,
const
struct
il_channel_info
*
ch_info
)
{
struct
il3945_eeprom
*
eeprom
=
(
struct
il3945_eeprom
*
)
il
->
eeprom
;
struct
il3945_eeprom_txpower_group
*
ch_grp
=
&
eeprom
->
groups
[
0
];
u8
group
;
u16
group_i
nde
x
=
0
;
/* based on factory calib frequencies */
u16
group_i
d
x
=
0
;
/* based on factory calib frequencies */
u8
grp_channel
;
/* Find the group i
ndex for the channel ... don't use inde
x 1(?) */
/* Find the group i
dx for the channel ... don't use id
x 1(?) */
if
(
il_is_channel_a_band
(
ch_info
))
{
for
(
group
=
1
;
group
<
5
;
group
++
)
{
grp_channel
=
ch_grp
[
group
].
group_channel
;
if
(
ch_info
->
channel
<=
grp_channel
)
{
group_i
nde
x
=
group
;
group_i
d
x
=
group
;
break
;
}
}
/* group 4 has a few channels *above* its factory cal freq */
if
(
group
==
5
)
group_i
nde
x
=
4
;
group_i
d
x
=
4
;
}
else
group_i
nde
x
=
0
;
/* 2.4 GHz, group 0 */
group_i
d
x
=
0
;
/* 2.4 GHz, group 0 */
D_POWER
(
"Chnl %d mapped to grp %d
\n
"
,
ch_info
->
channel
,
group_i
nde
x
);
return
group_i
nde
x
;
group_i
d
x
);
return
group_i
d
x
;
}
/**
* il3945_hw_reg_get_matched_power_i
ndex - Interpolate to get nominal inde
x
* il3945_hw_reg_get_matched_power_i
dx - Interpolate to get nominal id
x
*
* Interpolate to get nominal (i.e. at factory calibration temperature) i
nde
x
* Interpolate to get nominal (i.e. at factory calibration temperature) i
d
x
* into radio/DSP gain settings table for requested power.
*/
static
int
il3945_hw_reg_get_matched_power_i
nde
x
(
struct
il_priv
*
il
,
static
int
il3945_hw_reg_get_matched_power_i
d
x
(
struct
il_priv
*
il
,
s8
requested_power
,
s32
setting_i
ndex
,
s32
*
new_inde
x
)
s32
setting_i
dx
,
s32
*
new_id
x
)
{
const
struct
il3945_eeprom_txpower_group
*
chnl_grp
=
NULL
;
struct
il3945_eeprom
*
eeprom
=
(
struct
il3945_eeprom
*
)
il
->
eeprom
;
s32
i
ndex0
,
inde
x1
;
s32
i
dx0
,
id
x1
;
s32
power
=
2
*
requested_power
;
s32
i
;
const
struct
il3945_eeprom_txpower_sample
*
samples
;
...
...
@@ -1937,45 +1937,45 @@ static int il3945_hw_reg_get_matched_power_index(struct il_priv *il,
s32
res
;
s32
denominator
;
chnl_grp
=
&
eeprom
->
groups
[
setting_i
nde
x
];
chnl_grp
=
&
eeprom
->
groups
[
setting_i
d
x
];
samples
=
chnl_grp
->
samples
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
if
(
power
==
samples
[
i
].
power
)
{
*
new_i
ndex
=
samples
[
i
].
gain_inde
x
;
*
new_i
dx
=
samples
[
i
].
gain_id
x
;
return
0
;
}
}
if
(
power
>
samples
[
1
].
power
)
{
i
nde
x0
=
0
;
i
nde
x1
=
1
;
i
d
x0
=
0
;
i
d
x1
=
1
;
}
else
if
(
power
>
samples
[
2
].
power
)
{
i
nde
x0
=
1
;
i
nde
x1
=
2
;
i
d
x0
=
1
;
i
d
x1
=
2
;
}
else
if
(
power
>
samples
[
3
].
power
)
{
i
nde
x0
=
2
;
i
nde
x1
=
3
;
i
d
x0
=
2
;
i
d
x1
=
3
;
}
else
{
i
nde
x0
=
3
;
i
nde
x1
=
4
;
i
d
x0
=
3
;
i
d
x1
=
4
;
}
denominator
=
(
s32
)
samples
[
i
ndex1
].
power
-
(
s32
)
samples
[
inde
x0
].
power
;
denominator
=
(
s32
)
samples
[
i
dx1
].
power
-
(
s32
)
samples
[
id
x0
].
power
;
if
(
denominator
==
0
)
return
-
EINVAL
;
gains0
=
(
s32
)
samples
[
i
ndex0
].
gain_inde
x
*
(
1
<<
19
);
gains1
=
(
s32
)
samples
[
i
ndex1
].
gain_inde
x
*
(
1
<<
19
);
gains0
=
(
s32
)
samples
[
i
dx0
].
gain_id
x
*
(
1
<<
19
);
gains1
=
(
s32
)
samples
[
i
dx1
].
gain_id
x
*
(
1
<<
19
);
res
=
gains0
+
(
gains1
-
gains0
)
*
((
s32
)
power
-
(
s32
)
samples
[
i
nde
x0
].
power
)
/
denominator
+
((
s32
)
power
-
(
s32
)
samples
[
i
d
x0
].
power
)
/
denominator
+
(
1
<<
18
);
*
new_i
nde
x
=
res
>>
19
;
*
new_i
d
x
=
res
>>
19
;
return
0
;
}
static
void
il3945_hw_reg_init_channel_groups
(
struct
il_priv
*
il
)
{
u32
i
;
s32
rate_i
nde
x
;
s32
rate_i
d
x
;
struct
il3945_eeprom
*
eeprom
=
(
struct
il3945_eeprom
*
)
il
->
eeprom
;
const
struct
il3945_eeprom_txpower_group
*
group
;
...
...
@@ -2009,9 +2009,9 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
satur_pwr
=
(
s8
)
(
group
->
saturation_power
>>
1
);
/* fill in channel group's nominal powers for each rate */
for
(
rate_i
nde
x
=
0
;
rate_i
ndex
<
RATE_COUNT_3945
;
rate_inde
x
++
,
clip_pwrs
++
)
{
switch
(
rate_i
nde
x
)
{
for
(
rate_i
d
x
=
0
;
rate_i
dx
<
RATE_COUNT_3945
;
rate_id
x
++
,
clip_pwrs
++
)
{
switch
(
rate_i
d
x
)
{
case
RATE_36M_IDX_TABLE
:
if
(
i
==
0
)
/* B/G */
*
clip_pwrs
=
satur_pwr
;
...
...
@@ -2058,13 +2058,13 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
struct
il_channel_info
*
ch_info
=
NULL
;
struct
il3945_channel_power_info
*
pwr_info
;
struct
il3945_eeprom
*
eeprom
=
(
struct
il3945_eeprom
*
)
il
->
eeprom
;
int
delta_i
nde
x
;
u8
rate_i
nde
x
;
u8
scan_tbl_i
nde
x
;
int
delta_i
d
x
;
u8
rate_i
d
x
;
u8
scan_tbl_i
d
x
;
const
s8
*
clip_pwrs
;
/* array of power levels for each rate */
u8
gain
,
dsp_atten
;
s8
power
;
u8
pwr_i
ndex
,
base_pwr_inde
x
,
a_band
;
u8
pwr_i
dx
,
base_pwr_id
x
,
a_band
;
u8
i
;
int
temperature
;
...
...
@@ -2082,56 +2082,56 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
if
(
!
il_is_channel_valid
(
ch_info
))
continue
;
/* find this channel's channel group (*not* "band") i
nde
x */
ch_info
->
group_i
nde
x
=
il3945_hw_reg_get_ch_grp_i
nde
x
(
il
,
ch_info
);
/* find this channel's channel group (*not* "band") i
d
x */
ch_info
->
group_i
d
x
=
il3945_hw_reg_get_ch_grp_i
d
x
(
il
,
ch_info
);
/* Get this chnlgrp's rate->max/clip-powers table */
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
nde
x
].
clip_powers
;
clip_pwrs
=
il
->
_3945
.
clip_groups
[
ch_info
->
group_i
d
x
].
clip_powers
;
/* calculate power i
nde
x *adjustment* value according to
/* calculate power i
d
x *adjustment* value according to
* diff between current temperature and factory temperature */
delta_i
nde
x
=
il3945_hw_reg_adjust_power_by_temp
(
temperature
,
eeprom
->
groups
[
ch_info
->
group_i
nde
x
].
delta_i
d
x
=
il3945_hw_reg_adjust_power_by_temp
(
temperature
,
eeprom
->
groups
[
ch_info
->
group_i
d
x
].
temperature
);
D_POWER
(
"Delta i
nde
x for channel %d: %d [%d]
\n
"
,
ch_info
->
channel
,
delta_i
nde
x
,
temperature
+
D_POWER
(
"Delta i
d
x for channel %d: %d [%d]
\n
"
,
ch_info
->
channel
,
delta_i
d
x
,
temperature
+
IL_TEMP_CONVERT
);
/* set tx power value for all OFDM rates */
for
(
rate_i
ndex
=
0
;
rate_inde
x
<
IL_OFDM_RATES
;
rate_i
nde
x
++
)
{
for
(
rate_i
dx
=
0
;
rate_id
x
<
IL_OFDM_RATES
;
rate_i
d
x
++
)
{
s32
uninitialized_var
(
power_idx
);
int
rc
;
/* use channel group's clip-power table,
* but don't exceed channel's max power */
s8
pwr
=
min
(
ch_info
->
max_power_avg
,
clip_pwrs
[
rate_i
nde
x
]);
clip_pwrs
[
rate_i
d
x
]);
pwr_info
=
&
ch_info
->
power_info
[
rate_i
nde
x
];
pwr_info
=
&
ch_info
->
power_info
[
rate_i
d
x
];
/* get base (i.e. at factory-measured temperature)
* power table i
nde
x for this rate's power */
rc
=
il3945_hw_reg_get_matched_power_i
nde
x
(
il
,
pwr
,
ch_info
->
group_i
nde
x
,
* power table i
d
x for this rate's power */
rc
=
il3945_hw_reg_get_matched_power_i
d
x
(
il
,
pwr
,
ch_info
->
group_i
d
x
,
&
power_idx
);
if
(
rc
)
{
IL_ERR
(
"Invalid power i
nde
x
\n
"
);
IL_ERR
(
"Invalid power i
d
x
\n
"
);
return
rc
;
}
pwr_info
->
base_power_i
nde
x
=
(
u8
)
power_idx
;
pwr_info
->
base_power_i
d
x
=
(
u8
)
power_idx
;
/* temperature compensate */
power_idx
+=
delta_i
nde
x
;
power_idx
+=
delta_i
d
x
;
/* stay within range of gain table */
power_idx
=
il3945_hw_reg_fix_power_i
nde
x
(
power_idx
);
power_idx
=
il3945_hw_reg_fix_power_i
d
x
(
power_idx
);
/* fill 1 OFDM rate's il3945_channel_power_info struct */
pwr_info
->
requested_power
=
pwr
;
pwr_info
->
power_table_i
nde
x
=
(
u8
)
power_idx
;
pwr_info
->
power_table_i
d
x
=
(
u8
)
power_idx
;
pwr_info
->
tpc
.
tx_gain
=
power_gain_table
[
a_band
][
power_idx
].
tx_gain
;
pwr_info
->
tpc
.
dsp_atten
=
...
...
@@ -2142,36 +2142,36 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
pwr_info
=
&
ch_info
->
power_info
[
RATE_12M_IDX_TABLE
];
power
=
pwr_info
->
requested_power
+
IL_CCK_FROM_OFDM_POWER_DIFF
;
pwr_i
ndex
=
pwr_info
->
power_table_inde
x
+
pwr_i
dx
=
pwr_info
->
power_table_id
x
+
IL_CCK_FROM_OFDM_IDX_DIFF
;
base_pwr_i
ndex
=
pwr_info
->
base_power_inde
x
+
base_pwr_i
dx
=
pwr_info
->
base_power_id
x
+
IL_CCK_FROM_OFDM_IDX_DIFF
;
/* stay within table range */
pwr_i
ndex
=
il3945_hw_reg_fix_power_index
(
pwr_inde
x
);
gain
=
power_gain_table
[
a_band
][
pwr_i
nde
x
].
tx_gain
;
dsp_atten
=
power_gain_table
[
a_band
][
pwr_i
nde
x
].
dsp_atten
;
pwr_i
dx
=
il3945_hw_reg_fix_power_idx
(
pwr_id
x
);
gain
=
power_gain_table
[
a_band
][
pwr_i
d
x
].
tx_gain
;
dsp_atten
=
power_gain_table
[
a_band
][
pwr_i
d
x
].
dsp_atten
;
/* fill each CCK rate's il3945_channel_power_info structure
* NOTE: All CCK-rate Txpwrs are the same for a given chnl!
* NOTE: CCK rates start at end of OFDM rates! */
for
(
rate_i
nde
x
=
0
;
rate_i
ndex
<
IL_CCK_RATES
;
rate_inde
x
++
)
{
pwr_info
=
&
ch_info
->
power_info
[
rate_i
nde
x
+
IL_OFDM_RATES
];
for
(
rate_i
d
x
=
0
;
rate_i
dx
<
IL_CCK_RATES
;
rate_id
x
++
)
{
pwr_info
=
&
ch_info
->
power_info
[
rate_i
d
x
+
IL_OFDM_RATES
];
pwr_info
->
requested_power
=
power
;
pwr_info
->
power_table_i
ndex
=
pwr_inde
x
;
pwr_info
->
base_power_i
ndex
=
base_pwr_inde
x
;
pwr_info
->
power_table_i
dx
=
pwr_id
x
;
pwr_info
->
base_power_i
dx
=
base_pwr_id
x
;
pwr_info
->
tpc
.
tx_gain
=
gain
;
pwr_info
->
tpc
.
dsp_atten
=
dsp_atten
;
}
/* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
for
(
scan_tbl_i
nde
x
=
0
;
scan_tbl_i
ndex
<
IL_NUM_SCAN_RATES
;
scan_tbl_inde
x
++
)
{
s32
actual_i
ndex
=
(
scan_tbl_inde
x
==
0
)
?
for
(
scan_tbl_i
d
x
=
0
;
scan_tbl_i
dx
<
IL_NUM_SCAN_RATES
;
scan_tbl_id
x
++
)
{
s32
actual_i
dx
=
(
scan_tbl_id
x
==
0
)
?
RATE_1M_IDX_TABLE
:
RATE_6M_IDX_TABLE
;
il3945_hw_reg_set_scan_power
(
il
,
scan_tbl_i
nde
x
,
actual_i
nde
x
,
clip_pwrs
,
ch_info
,
a_band
);
il3945_hw_reg_set_scan_power
(
il
,
scan_tbl_i
d
x
,
actual_i
d
x
,
clip_pwrs
,
ch_info
,
a_band
);
}
}
...
...
@@ -2304,21 +2304,21 @@ static int il3945_manage_ibss_station(struct il_priv *il,
*/
int
il3945_init_hw_rate_table
(
struct
il_priv
*
il
)
{
int
rc
,
i
,
i
ndex
,
prev_inde
x
;
int
rc
,
i
,
i
dx
,
prev_id
x
;
struct
il3945_rate_scaling_cmd
rate_cmd
=
{
.
reserved
=
{
0
,
0
,
0
},
};
struct
il3945_rate_scaling_info
*
table
=
rate_cmd
.
table
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
il3945_rates
);
i
++
)
{
i
ndex
=
il3945_rates
[
i
].
table_rs_inde
x
;
i
dx
=
il3945_rates
[
i
].
table_rs_id
x
;
table
[
i
nde
x
].
rate_n_flags
=
table
[
i
d
x
].
rate_n_flags
=
il3945_hw_set_rate_n_flags
(
il3945_rates
[
i
].
plcp
,
0
);
table
[
i
nde
x
].
try_cnt
=
il
->
retry_rate
;
prev_i
nde
x
=
il3945_get_prev_ieee_rate
(
i
);
table
[
i
ndex
].
next_rate_inde
x
=
il3945_rates
[
prev_i
ndex
].
table_rs_inde
x
;
table
[
i
d
x
].
try_cnt
=
il
->
retry_rate
;
prev_i
d
x
=
il3945_get_prev_ieee_rate
(
i
);
table
[
i
dx
].
next_rate_id
x
=
il3945_rates
[
prev_i
dx
].
table_rs_id
x
;
}
switch
(
il
->
band
)
{
...
...
@@ -2328,16 +2328,16 @@ int il3945_init_hw_rate_table(struct il_priv *il)
* have it fall back to the 6M OFDM rate */
for
(
i
=
RATE_1M_IDX_TABLE
;
i
<=
RATE_11M_IDX_TABLE
;
i
++
)
table
[
i
].
next_rate_i
nde
x
=
il3945_rates
[
IL_FIRST_OFDM_RATE
].
table_rs_i
nde
x
;
table
[
i
].
next_rate_i
d
x
=
il3945_rates
[
IL_FIRST_OFDM_RATE
].
table_rs_i
d
x
;
/* Don't fall back to CCK rates */
table
[
RATE_12M_IDX_TABLE
].
next_rate_i
nde
x
=
table
[
RATE_12M_IDX_TABLE
].
next_rate_i
d
x
=
RATE_9M_IDX_TABLE
;
/* Don't drop out of OFDM rates */
table
[
RATE_6M_IDX_TABLE
].
next_rate_i
nde
x
=
il3945_rates
[
IL_FIRST_OFDM_RATE
].
table_rs_i
nde
x
;
table
[
RATE_6M_IDX_TABLE
].
next_rate_i
d
x
=
il3945_rates
[
IL_FIRST_OFDM_RATE
].
table_rs_i
d
x
;
break
;
case
IEEE80211_BAND_2GHZ
:
...
...
@@ -2348,15 +2348,15 @@ int il3945_init_hw_rate_table(struct il_priv *il)
if
(
!
(
il
->
_3945
.
sta_supp_rates
&
IL_OFDM_RATES_MASK
)
&&
il_is_associated
(
il
))
{
i
nde
x
=
IL_FIRST_CCK_RATE
;
i
d
x
=
IL_FIRST_CCK_RATE
;
for
(
i
=
RATE_6M_IDX_TABLE
;
i
<=
RATE_54M_IDX_TABLE
;
i
++
)
table
[
i
].
next_rate_i
nde
x
=
il3945_rates
[
i
ndex
].
table_rs_inde
x
;
table
[
i
].
next_rate_i
d
x
=
il3945_rates
[
i
dx
].
table_rs_id
x
;
i
nde
x
=
RATE_11M_IDX_TABLE
;
i
d
x
=
RATE_11M_IDX_TABLE
;
/* CCK shouldn't fall back to OFDM... */
table
[
i
ndex
].
next_rate_inde
x
=
RATE_5M_IDX_TABLE
;
table
[
i
dx
].
next_rate_id
x
=
RATE_5M_IDX_TABLE
;
}
break
;
...
...
drivers/net/wireless/iwlegacy/iwl-4965-hw.h
View file @
0c2c8852
...
...
@@ -203,7 +203,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel.
* Do not exceed regulatory limit; reduce target txpower if necessary.
*
* If setting up txpowers for MIMO rates (rate i
nde
xes 8-15, 24-31),
* If setting up txpowers for MIMO rates (rate i
d
xes 8-15, 24-31),
* 2 transmitters will be used simultaneously; driver must reduce the
* regulatory limit by 3 dB (half-power) for each transmitter, so the
* combined total output of the 2 transmitters is within regulatory limits.
...
...
@@ -269,7 +269,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* be used (although only one at a time) even for non-MIMO transmissions.
*
* Driver should interpolate factory values for temperature, gain table
* i
nde
x, and actual power. The power amplifier detector values are
* i
d
x, and actual power. The power amplifier detector values are
* not used by the driver.
*
* Sanity check: If the target channel happens to be one of the sample
...
...
@@ -278,13 +278,13 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
*
* 5) Find difference between desired txpower and (interpolated)
* factory-measured txpower. Using (interpolated) factory gain table i
nde
x
* (shown elsewhere) as a starting point, adjust this i
nde
x lower to
* factory-measured txpower. Using (interpolated) factory gain table i
d
x
* (shown elsewhere) as a starting point, adjust this i
d
x lower to
* increase txpower, or higher to decrease txpower, until the target
* txpower is reached. Each step in the gain table is 1/2 dB.
*
* For example, if factory measured txpower is 16 dBm, and target txpower
* is 13 dBm, add 6 steps to the factory gain i
nde
x to reduce txpower
* is 13 dBm, add 6 steps to the factory gain i
d
x to reduce txpower
* by 3 dB.
*
*
...
...
@@ -294,7 +294,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* "4965 temperature calculation".
*
* If current temperature is higher than factory temperature, driver must
* increase gain (lower gain table i
nde
x), and vice verse.
* increase gain (lower gain table i
d
x), and vice verse.
*
* Temperature affects gain differently for different channels:
*
...
...
@@ -313,16 +313,16 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* indicator (EEPROM).
*
* If the current voltage is higher (indicator is lower) than factory
* voltage, gain should be reduced (gain table i
nde
x increased) by:
* voltage, gain should be reduced (gain table i
d
x increased) by:
*
* (eeprom - current) / 7
*
* If the current voltage is lower (indicator is higher) than factory
* voltage, gain should be increased (gain table i
nde
x decreased) by:
* voltage, gain should be increased (gain table i
d
x decreased) by:
*
* 2 * (current - eeprom) / 7
*
* If number of i
nde
x steps in either direction turns out to be > 2,
* If number of i
d
x steps in either direction turns out to be > 2,
* something is wrong ... just use 0.
*
* NOTE: Voltage compensation is independent of band/channel.
...
...
@@ -333,7 +333,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* may be calculated once and used until the next uCode bootload.
*
*
* 8) If setting up txpowers for MIMO rates (rate i
nde
xes 8-15, 24-31),
* 8) If setting up txpowers for MIMO rates (rate i
d
xes 8-15, 24-31),
* adjust txpower for each transmitter chain, so txpower is balanced
* between the two chains. There are 5 pairs of tx_atten[group][chain]
* values in "initialize alive", one pair for each of 5 channel ranges:
...
...
@@ -344,7 +344,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* Group 3: 5 GHz channel 125-200
* Group 4: 2.4 GHz all channels
*
* Add the tx_atten[group][chain] value to the i
nde
x for the target chain.
* Add the tx_atten[group][chain] value to the i
d
x for the target chain.
* The values are signed, but are in pairs of 0 and a non-negative number,
* so as to reduce gain (if necessary) of the "hotter" channel. This
* avoids any need to double-check for regulatory compliance after
...
...
@@ -352,7 +352,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
*
* 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation
* value to the i
nde
x:
* value to the i
d
x:
*
* Hardware rev B: 9 steps (4.5 dB)
* Hardware rev C: 5 steps (2.5 dB)
...
...
@@ -366,7 +366,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
* 10) Select the gain table, based on band (2.4 vs 5 GHz).
*
* Limit the adjusted i
nde
x to stay within the table!
* Limit the adjusted i
d
x to stay within the table!
*
*
* 11) Read gain table entries for DSP and radio gain, place into appropriate
...
...
@@ -389,7 +389,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
*
* When calculating txpowers for CCK, after making sure that the target power
* is within regulatory and saturation limits, driver must additionally
* back off gain by adding these values to the gain table i
nde
x.
* back off gain by adding these values to the gain table i
d
x.
*
* Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG,
* bits [3:2], 1 = B, 2 = C.
...
...
@@ -428,9 +428,9 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
* driver work with the same table).
*
* There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table
* has an extension (into negative i
nde
xes), in case the driver needs to
* has an extension (into negative i
d
xes), in case the driver needs to
* boost power setting for high device temperatures (higher than would be
* present during factory calibration). A 5 Ghz EEPROM i
nde
x of "40"
* present during factory calibration). A 5 Ghz EEPROM i
d
x of "40"
* corresponds to the 49th entry in the table used by the driver.
*/
#define MIN_TX_GAIN_IDX (0)
/* highest gain, lowest idx, 2.4 */
...
...
@@ -778,8 +778,8 @@ enum {
*
* When driver sets up a new TFD, it must also enter the total byte count
* of the frame to be transmitted into the corresponding entry in the byte
* count table for the chosen Tx queue. If the TFD i
nde
x is 0-63, the driver
* must duplicate the byte count entry in corresponding i
nde
x 256-319.
* count table for the chosen Tx queue. If the TFD i
d
x is 0-63, the driver
* must duplicate the byte count entry in corresponding i
d
x 256-319.
*
* padding puts each byte count table on a 1024-byte boundary;
* 4965 assumes tables are separated by 1024 bytes.
...
...
drivers/net/wireless/iwlegacy/iwl-4965-lib.c
View file @
0c2c8852
...
...
@@ -105,7 +105,7 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
/* Stop Rx DMA */
il_wr
(
il
,
FH_MEM_RCSR_CHNL0_CONFIG_REG
,
0
);
/* Reset driver's Rx queue write i
nde
x */
/* Reset driver's Rx queue write i
d
x */
il_wr
(
il
,
FH_RSCSR_CHNL0_RBDCB_WPTR_REG
,
0
);
/* Tell device where to find RBD circular buffer in DRAM */
...
...
@@ -222,7 +222,7 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il,
* and we have free pre-allocated buffers, fill the ranks as much
* as we can, pulling from rx_free.
*
* This moves the 'write' i
nde
x forward to catch up with 'processed', and
* This moves the 'write' i
d
x forward to catch up with 'processed', and
* also updates the memory address in the firmware to reference the new
* target buffer.
*/
...
...
drivers/net/wireless/iwlegacy/iwl-4965-rs.c
View file @
0c2c8852
...
...
@@ -151,10 +151,10 @@ static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta,
#ifdef CONFIG_MAC80211_DEBUGFS
static
void
il4965_rs_dbgfs_set_mcs
(
struct
il_lq_sta
*
lq_sta
,
u32
*
rate_n_flags
,
int
i
nde
x
);
u32
*
rate_n_flags
,
int
i
d
x
);
#else
static
void
il4965_rs_dbgfs_set_mcs
(
struct
il_lq_sta
*
lq_sta
,
u32
*
rate_n_flags
,
int
i
nde
x
)
u32
*
rate_n_flags
,
int
i
d
x
)
{}
#endif
...
...
@@ -271,7 +271,7 @@ static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data,
{
u32
curr_time
=
jiffies_to_msecs
(
jiffies
);
u32
time_diff
;
s32
i
nde
x
;
s32
i
d
x
;
struct
il_traffic_load
*
tl
=
NULL
;
u8
tid
;
...
...
@@ -299,19 +299,19 @@ static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data,
}
time_diff
=
TIME_WRAP_AROUND
(
tl
->
time_stamp
,
curr_time
);
i
nde
x
=
time_diff
/
TID_QUEUE_CELL_SPACING
;
i
d
x
=
time_diff
/
TID_QUEUE_CELL_SPACING
;
/* The history is too long: remove data that is older than */
/* TID_MAX_TIME_DIFF */
if
(
i
nde
x
>=
TID_QUEUE_MAX_SIZE
)
if
(
i
d
x
>=
TID_QUEUE_MAX_SIZE
)
il4965_rs_tl_rm_old_stats
(
tl
,
curr_time
);
i
ndex
=
(
tl
->
head
+
inde
x
)
%
TID_QUEUE_MAX_SIZE
;
tl
->
packet_count
[
i
ndex
]
=
tl
->
packet_count
[
inde
x
]
+
1
;
i
dx
=
(
tl
->
head
+
id
x
)
%
TID_QUEUE_MAX_SIZE
;
tl
->
packet_count
[
i
dx
]
=
tl
->
packet_count
[
id
x
]
+
1
;
tl
->
total
=
tl
->
total
+
1
;
if
((
i
nde
x
+
1
)
>
tl
->
queue_count
)
tl
->
queue_count
=
i
nde
x
+
1
;
if
((
i
d
x
+
1
)
>
tl
->
queue_count
)
tl
->
queue_count
=
i
d
x
+
1
;
return
tid
;
}
...
...
@@ -323,7 +323,7 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid)
{
u32
curr_time
=
jiffies_to_msecs
(
jiffies
);
u32
time_diff
;
s32
i
nde
x
;
s32
i
d
x
;
struct
il_traffic_load
*
tl
=
NULL
;
if
(
tid
>=
TID_MAX_LOAD_COUNT
)
...
...
@@ -337,11 +337,11 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid)
return
0
;
time_diff
=
TIME_WRAP_AROUND
(
tl
->
time_stamp
,
curr_time
);
i
nde
x
=
time_diff
/
TID_QUEUE_CELL_SPACING
;
i
d
x
=
time_diff
/
TID_QUEUE_CELL_SPACING
;
/* The history is too long: remove data that is older than */
/* TID_MAX_TIME_DIFF */
if
(
i
nde
x
>=
TID_QUEUE_MAX_SIZE
)
if
(
i
d
x
>=
TID_QUEUE_MAX_SIZE
)
il4965_rs_tl_rm_old_stats
(
tl
,
curr_time
);
return
tl
->
total
;
...
...
@@ -400,10 +400,10 @@ static inline int il4965_get_il4965_num_of_ant_from_rate(u32 rate_n_flags)
* that wraps a NULL pointer check
*/
static
s32
il4965_get_expected_tpt
(
struct
il_scale_tbl_info
*
tbl
,
int
rs_i
nde
x
)
il4965_get_expected_tpt
(
struct
il_scale_tbl_info
*
tbl
,
int
rs_i
d
x
)
{
if
(
tbl
->
expected_tpt
)
return
tbl
->
expected_tpt
[
rs_i
nde
x
];
return
tbl
->
expected_tpt
[
rs_i
d
x
];
return
0
;
}
...
...
@@ -415,20 +415,20 @@ il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index)
* packets.
*/
static
int
il4965_rs_collect_tx_data
(
struct
il_scale_tbl_info
*
tbl
,
int
scale_i
nde
x
,
int
attempts
,
int
successes
)
int
scale_i
d
x
,
int
attempts
,
int
successes
)
{
struct
il_rate_scale_data
*
win
=
NULL
;
static
const
u64
mask
=
(((
u64
)
1
)
<<
(
RATE_MAX_WINDOW
-
1
));
s32
fail_count
,
tpt
;
if
(
scale_i
ndex
<
0
||
scale_inde
x
>=
RATE_COUNT
)
if
(
scale_i
dx
<
0
||
scale_id
x
>=
RATE_COUNT
)
return
-
EINVAL
;
/* Select win for current tx bit rate */
win
=
&
(
tbl
->
win
[
scale_i
nde
x
]);
win
=
&
(
tbl
->
win
[
scale_i
d
x
]);
/* Get expected throughput */
tpt
=
il4965_get_expected_tpt
(
tbl
,
scale_i
nde
x
);
tpt
=
il4965_get_expected_tpt
(
tbl
,
scale_i
d
x
);
/*
* Keep track of only the latest 62 tx frame attempts in this rate's
...
...
@@ -493,26 +493,26 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
*/
static
u32
il4965_rate_n_flags_from_tbl
(
struct
il_priv
*
il
,
struct
il_scale_tbl_info
*
tbl
,
int
i
nde
x
,
u8
use_green
)
int
i
d
x
,
u8
use_green
)
{
u32
rate_n_flags
=
0
;
if
(
is_legacy
(
tbl
->
lq_type
))
{
rate_n_flags
=
il_rates
[
i
nde
x
].
plcp
;
if
(
i
ndex
>=
IL_FIRST_CCK_RATE
&&
inde
x
<=
IL_LAST_CCK_RATE
)
rate_n_flags
=
il_rates
[
i
d
x
].
plcp
;
if
(
i
dx
>=
IL_FIRST_CCK_RATE
&&
id
x
<=
IL_LAST_CCK_RATE
)
rate_n_flags
|=
RATE_MCS_CCK_MSK
;
}
else
if
(
is_Ht
(
tbl
->
lq_type
))
{
if
(
i
nde
x
>
IL_LAST_OFDM_RATE
)
{
IL_ERR
(
"Invalid HT rate i
ndex %d
\n
"
,
inde
x
);
i
nde
x
=
IL_LAST_OFDM_RATE
;
if
(
i
d
x
>
IL_LAST_OFDM_RATE
)
{
IL_ERR
(
"Invalid HT rate i
dx %d
\n
"
,
id
x
);
i
d
x
=
IL_LAST_OFDM_RATE
;
}
rate_n_flags
=
RATE_MCS_HT_MSK
;
if
(
is_siso
(
tbl
->
lq_type
))
rate_n_flags
|=
il_rates
[
i
nde
x
].
plcp_siso
;
rate_n_flags
|=
il_rates
[
i
d
x
].
plcp_siso
;
else
rate_n_flags
|=
il_rates
[
i
nde
x
].
plcp_mimo2
;
rate_n_flags
|=
il_rates
[
i
d
x
].
plcp_mimo2
;
}
else
{
IL_ERR
(
"Invalid tbl->lq_type %d
\n
"
,
tbl
->
lq_type
);
}
...
...
@@ -666,7 +666,7 @@ static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta,
}
static
u16
il4965_rs_get_adjacent_rate
(
struct
il_priv
*
il
,
u8
i
nde
x
,
u16
rate_mask
,
il4965_rs_get_adjacent_rate
(
struct
il_priv
*
il
,
u8
i
d
x
,
u16
rate_mask
,
int
rate_type
)
{
u8
high
=
RATE_INVALID
;
...
...
@@ -679,7 +679,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
u32
mask
;
/* Find the previous rate that is in the rate mask */
i
=
i
nde
x
-
1
;
i
=
i
d
x
-
1
;
for
(
mask
=
(
1
<<
i
);
i
>=
0
;
i
--
,
mask
>>=
1
)
{
if
(
rate_mask
&
mask
)
{
low
=
i
;
...
...
@@ -688,7 +688,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
}
/* Find the next rate that is in the rate mask */
i
=
i
nde
x
+
1
;
i
=
i
d
x
+
1
;
for
(
mask
=
(
1
<<
i
);
i
<
RATE_COUNT
;
i
++
,
mask
<<=
1
)
{
if
(
rate_mask
&
mask
)
{
high
=
i
;
...
...
@@ -699,7 +699,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
return
(
high
<<
8
)
|
low
;
}
low
=
i
nde
x
;
low
=
i
d
x
;
while
(
low
!=
RATE_INVALID
)
{
low
=
il_rates
[
low
].
prev_rs
;
if
(
low
==
RATE_INVALID
)
...
...
@@ -709,7 +709,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
D_RATE
(
"Skipping masked lower rate: %d
\n
"
,
low
);
}
high
=
i
nde
x
;
high
=
i
d
x
;
while
(
high
!=
RATE_INVALID
)
{
high
=
il_rates
[
high
].
next_rs
;
if
(
high
==
RATE_INVALID
)
...
...
@@ -724,7 +724,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
static
u32
il4965_rs_get_lower_rate
(
struct
il_lq_sta
*
lq_sta
,
struct
il_scale_tbl_info
*
tbl
,
u8
scale_i
nde
x
,
u8
ht_possible
)
u8
scale_i
d
x
,
u8
ht_possible
)
{
s32
low
;
u16
rate_mask
;
...
...
@@ -736,9 +736,9 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
/* check if we need to switch from HT to legacy rates.
* assumption is that mandatory rates (1Mbps or 6Mbps)
* are always supported (spec demand) */
if
(
!
is_legacy
(
tbl
->
lq_type
)
&&
(
!
ht_possible
||
!
scale_i
nde
x
))
{
if
(
!
is_legacy
(
tbl
->
lq_type
)
&&
(
!
ht_possible
||
!
scale_i
d
x
))
{
switch_to_legacy
=
1
;
scale_i
ndex
=
rs_ht_to_legacy
[
scale_inde
x
];
scale_i
dx
=
rs_ht_to_legacy
[
scale_id
x
];
if
(
lq_sta
->
band
==
IEEE80211_BAND_5GHZ
)
tbl
->
lq_type
=
LQ_A
;
else
...
...
@@ -766,18 +766,18 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
}
/* If we switched from HT to legacy, check current rate */
if
(
switch_to_legacy
&&
(
rate_mask
&
(
1
<<
scale_i
nde
x
)))
{
low
=
scale_i
nde
x
;
if
(
switch_to_legacy
&&
(
rate_mask
&
(
1
<<
scale_i
d
x
)))
{
low
=
scale_i
d
x
;
goto
out
;
}
high_low
=
il4965_rs_get_adjacent_rate
(
lq_sta
->
drv
,
scale_i
nde
x
,
rate_mask
,
scale_i
d
x
,
rate_mask
,
tbl
->
lq_type
);
low
=
high_low
&
0xff
;
if
(
low
==
RATE_INVALID
)
low
=
scale_i
nde
x
;
low
=
scale_i
d
x
;
out:
return
il4965_rate_n_flags_from_tbl
(
lq_sta
->
drv
,
tbl
,
low
,
is_green
);
...
...
@@ -803,7 +803,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
{
int
legacy_success
;
int
retries
;
int
rs_i
ndex
,
mac_inde
x
,
i
;
int
rs_i
dx
,
mac_id
x
,
i
;
struct
il_lq_sta
*
lq_sta
=
il_sta
;
struct
il_link_quality_cmd
*
table
;
struct
ieee80211_hdr
*
hdr
=
(
struct
ieee80211_hdr
*
)
skb
->
data
;
...
...
@@ -848,35 +848,35 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
table
=
&
lq_sta
->
lq
;
tx_rate
=
le32_to_cpu
(
table
->
rs_table
[
0
].
rate_n_flags
);
il4965_rs_get_tbl_info_from_mcs
(
tx_rate
,
il
->
band
,
&
tbl_type
,
&
rs_i
nde
x
);
il
->
band
,
&
tbl_type
,
&
rs_i
d
x
);
if
(
il
->
band
==
IEEE80211_BAND_5GHZ
)
rs_i
nde
x
-=
IL_FIRST_OFDM_RATE
;
rs_i
d
x
-=
IL_FIRST_OFDM_RATE
;
mac_flags
=
info
->
status
.
rates
[
0
].
flags
;
mac_i
nde
x
=
info
->
status
.
rates
[
0
].
idx
;
mac_i
d
x
=
info
->
status
.
rates
[
0
].
idx
;
/* For HT packets, map MCS to PLCP */
if
(
mac_flags
&
IEEE80211_TX_RC_MCS
)
{
mac_i
nde
x
&=
RATE_MCS_CODE_MSK
;
/* Remove # of streams */
if
(
mac_i
nde
x
>=
(
RATE_9M_IDX
-
IL_FIRST_OFDM_RATE
))
mac_i
nde
x
++
;
mac_i
d
x
&=
RATE_MCS_CODE_MSK
;
/* Remove # of streams */
if
(
mac_i
d
x
>=
(
RATE_9M_IDX
-
IL_FIRST_OFDM_RATE
))
mac_i
d
x
++
;
/*
* mac80211 HT i
ndex is always zero-inde
xed; we need to move
* mac80211 HT i
dx is always zero-id
xed; we need to move
* HT OFDM rates after CCK rates in 2.4 GHz band
*/
if
(
il
->
band
==
IEEE80211_BAND_2GHZ
)
mac_i
nde
x
+=
IL_FIRST_OFDM_RATE
;
mac_i
d
x
+=
IL_FIRST_OFDM_RATE
;
}
/* Here we actually compare this rate to the latest LQ command */
if
(
mac_i
nde
x
<
0
||
if
(
mac_i
d
x
<
0
||
tbl_type
.
is_SGI
!=
!!
(
mac_flags
&
IEEE80211_TX_RC_SHORT_GI
)
||
tbl_type
.
is_ht40
!=
!!
(
mac_flags
&
IEEE80211_TX_RC_40_MHZ_WIDTH
)
||
tbl_type
.
is_dup
!=
!!
(
mac_flags
&
IEEE80211_TX_RC_DUP_DATA
)
||
tbl_type
.
ant_type
!=
info
->
antenna_sel_tx
||
!!
(
tx_rate
&
RATE_MCS_HT_MSK
)
!=
!!
(
mac_flags
&
IEEE80211_TX_RC_MCS
)
||
!!
(
tx_rate
&
RATE_MCS_GF_MSK
)
!=
!!
(
mac_flags
&
IEEE80211_TX_RC_GREEN_FIELD
)
||
rs_i
ndex
!=
mac_inde
x
)
{
rs_i
dx
!=
mac_id
x
)
{
D_RATE
(
"initial rate %d does not match %d (0x%x)
\n
"
,
mac_i
ndex
,
rs_inde
x
,
tx_rate
);
mac_i
dx
,
rs_id
x
,
tx_rate
);
/*
* Since rates mis-match, the last LQ command may have failed.
* After IL_MISSED_RATE_MAX mis-matches, resync the uCode with
...
...
@@ -927,13 +927,13 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
* aggregated.
*
* For aggregation, all packets were transmitted at the same rate, the
* first i
nde
x into rate scale table.
* first i
d
x into rate scale table.
*/
if
(
info
->
flags
&
IEEE80211_TX_STAT_AMPDU
)
{
tx_rate
=
le32_to_cpu
(
table
->
rs_table
[
0
].
rate_n_flags
);
il4965_rs_get_tbl_info_from_mcs
(
tx_rate
,
il
->
band
,
&
tbl_type
,
&
rs_i
nde
x
);
il4965_rs_collect_tx_data
(
curr_tbl
,
rs_i
nde
x
,
&
rs_i
d
x
);
il4965_rs_collect_tx_data
(
curr_tbl
,
rs_i
d
x
,
info
->
status
.
ampdu_len
,
info
->
status
.
ampdu_ack_len
);
...
...
@@ -957,7 +957,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
for
(
i
=
0
;
i
<=
retries
;
++
i
)
{
tx_rate
=
le32_to_cpu
(
table
->
rs_table
[
i
].
rate_n_flags
);
il4965_rs_get_tbl_info_from_mcs
(
tx_rate
,
il
->
band
,
&
tbl_type
,
&
rs_i
nde
x
);
&
tbl_type
,
&
rs_i
d
x
);
/*
* Only collect stats if retried rate is in the same RS
* table as active/search.
...
...
@@ -969,7 +969,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
tmp_tbl
=
other_tbl
;
else
continue
;
il4965_rs_collect_tx_data
(
tmp_tbl
,
rs_i
nde
x
,
1
,
il4965_rs_collect_tx_data
(
tmp_tbl
,
rs_i
d
x
,
1
,
i
<
retries
?
0
:
legacy_success
);
}
...
...
@@ -1074,20 +1074,20 @@ static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta,
static
s32
il4965_rs_get_best_rate
(
struct
il_priv
*
il
,
struct
il_lq_sta
*
lq_sta
,
struct
il_scale_tbl_info
*
tbl
,
/* "search" */
u16
rate_mask
,
s8
i
nde
x
)
u16
rate_mask
,
s8
i
d
x
)
{
/* "active" values */
struct
il_scale_tbl_info
*
active_tbl
=
&
(
lq_sta
->
lq_info
[
lq_sta
->
active_tbl
]);
s32
active_sr
=
active_tbl
->
win
[
i
nde
x
].
success_ratio
;
s32
active_tpt
=
active_tbl
->
expected_tpt
[
i
nde
x
];
s32
active_sr
=
active_tbl
->
win
[
i
d
x
].
success_ratio
;
s32
active_tpt
=
active_tbl
->
expected_tpt
[
i
d
x
];
/* expected "search" throughput */
s32
*
tpt_tbl
=
tbl
->
expected_tpt
;
s32
new_rate
,
high
,
low
,
start_hi
;
u16
high_low
;
s8
rate
=
i
nde
x
;
s8
rate
=
i
d
x
;
new_rate
=
high
=
low
=
start_hi
=
RATE_INVALID
;
...
...
@@ -1169,7 +1169,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,
struct
il_lq_sta
*
lq_sta
,
struct
ieee80211_conf
*
conf
,
struct
ieee80211_sta
*
sta
,
struct
il_scale_tbl_info
*
tbl
,
int
i
nde
x
)
struct
il_scale_tbl_info
*
tbl
,
int
i
d
x
)
{
u16
rate_mask
;
s32
rate
;
...
...
@@ -1203,20 +1203,20 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,
il4965_rs_set_expected_tpt_table
(
lq_sta
,
tbl
);
rate
=
il4965_rs_get_best_rate
(
il
,
lq_sta
,
tbl
,
rate_mask
,
i
nde
x
);
rate
=
il4965_rs_get_best_rate
(
il
,
lq_sta
,
tbl
,
rate_mask
,
i
d
x
);
D_RATE
(
"LQ: MIMO2 best rate %d mask %X
\n
"
,
rate
,
rate_mask
);
if
(
rate
==
RATE_INVALID
||
!
((
1
<<
rate
)
&
rate_mask
))
{
D_RATE
(
"Can't switch with i
nde
x %d rate mask %x
\n
"
,
"Can't switch with i
d
x %d rate mask %x
\n
"
,
rate
,
rate_mask
);
return
-
1
;
}
tbl
->
current_rate
=
il4965_rate_n_flags_from_tbl
(
il
,
tbl
,
rate
,
is_green
);
D_RATE
(
"LQ: Switch to new mcs %X i
nde
x is green %X
\n
"
,
D_RATE
(
"LQ: Switch to new mcs %X i
d
x is green %X
\n
"
,
tbl
->
current_rate
,
is_green
);
return
0
;
}
...
...
@@ -1228,7 +1228,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
struct
il_lq_sta
*
lq_sta
,
struct
ieee80211_conf
*
conf
,
struct
ieee80211_sta
*
sta
,
struct
il_scale_tbl_info
*
tbl
,
int
i
nde
x
)
struct
il_scale_tbl_info
*
tbl
,
int
i
d
x
)
{
u16
rate_mask
;
u8
is_green
=
lq_sta
->
is_green
;
...
...
@@ -1256,18 +1256,18 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
tbl
->
is_SGI
=
0
;
/*11n spec: no SGI in SISO+Greenfield*/
il4965_rs_set_expected_tpt_table
(
lq_sta
,
tbl
);
rate
=
il4965_rs_get_best_rate
(
il
,
lq_sta
,
tbl
,
rate_mask
,
i
nde
x
);
rate
=
il4965_rs_get_best_rate
(
il
,
lq_sta
,
tbl
,
rate_mask
,
i
d
x
);
D_RATE
(
"LQ: get best rate %d mask %X
\n
"
,
rate
,
rate_mask
);
if
(
rate
==
RATE_INVALID
||
!
((
1
<<
rate
)
&
rate_mask
))
{
D_RATE
(
"can not switch with i
nde
x %d rate mask %x
\n
"
,
"can not switch with i
d
x %d rate mask %x
\n
"
,
rate
,
rate_mask
);
return
-
1
;
}
tbl
->
current_rate
=
il4965_rate_n_flags_from_tbl
(
il
,
tbl
,
rate
,
is_green
);
D_RATE
(
"LQ: Switch to new mcs %X i
nde
x is green %X
\n
"
,
D_RATE
(
"LQ: Switch to new mcs %X i
d
x is green %X
\n
"
,
tbl
->
current_rate
,
is_green
);
return
0
;
}
...
...
@@ -1279,12 +1279,12 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
struct
il_lq_sta
*
lq_sta
,
struct
ieee80211_conf
*
conf
,
struct
ieee80211_sta
*
sta
,
int
i
nde
x
)
int
i
d
x
)
{
struct
il_scale_tbl_info
*
tbl
=
&
(
lq_sta
->
lq_info
[
lq_sta
->
active_tbl
]);
struct
il_scale_tbl_info
*
search_tbl
=
&
(
lq_sta
->
lq_info
[(
1
-
lq_sta
->
active_tbl
)]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
nde
x
]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
d
x
]);
u32
sz
=
(
sizeof
(
struct
il_scale_tbl_info
)
-
(
sizeof
(
struct
il_rate_scale_data
)
*
RATE_COUNT
));
u8
start_action
;
...
...
@@ -1331,7 +1331,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
memcpy
(
search_tbl
,
tbl
,
sz
);
search_tbl
->
is_SGI
=
0
;
ret
=
il4965_rs_switch_to_siso
(
il
,
lq_sta
,
conf
,
sta
,
search_tbl
,
i
nde
x
);
search_tbl
,
i
d
x
);
if
(
!
ret
)
{
lq_sta
->
action_counter
=
0
;
goto
out
;
...
...
@@ -1360,7 +1360,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
ret
=
il4965_rs_switch_to_mimo2
(
il
,
lq_sta
,
conf
,
sta
,
search_tbl
,
i
nde
x
);
search_tbl
,
i
d
x
);
if
(
!
ret
)
{
lq_sta
->
action_counter
=
0
;
goto
out
;
...
...
@@ -1395,13 +1395,13 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
static
int
il4965_rs_move_siso_to_other
(
struct
il_priv
*
il
,
struct
il_lq_sta
*
lq_sta
,
struct
ieee80211_conf
*
conf
,
struct
ieee80211_sta
*
sta
,
int
i
nde
x
)
struct
ieee80211_sta
*
sta
,
int
i
d
x
)
{
u8
is_green
=
lq_sta
->
is_green
;
struct
il_scale_tbl_info
*
tbl
=
&
(
lq_sta
->
lq_info
[
lq_sta
->
active_tbl
]);
struct
il_scale_tbl_info
*
search_tbl
=
&
(
lq_sta
->
lq_info
[(
1
-
lq_sta
->
active_tbl
)]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
nde
x
]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
d
x
]);
struct
ieee80211_sta_ht_cap
*
ht_cap
=
&
sta
->
ht_cap
;
u32
sz
=
(
sizeof
(
struct
il_scale_tbl_info
)
-
(
sizeof
(
struct
il_rate_scale_data
)
*
RATE_COUNT
));
...
...
@@ -1455,7 +1455,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
ret
=
il4965_rs_switch_to_mimo2
(
il
,
lq_sta
,
conf
,
sta
,
search_tbl
,
i
nde
x
);
search_tbl
,
i
d
x
);
if
(
!
ret
)
goto
out
;
break
;
...
...
@@ -1481,12 +1481,12 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
il4965_rs_set_expected_tpt_table
(
lq_sta
,
search_tbl
);
if
(
tbl
->
is_SGI
)
{
s32
tpt
=
lq_sta
->
last_tpt
/
100
;
if
(
tpt
>=
search_tbl
->
expected_tpt
[
i
nde
x
])
if
(
tpt
>=
search_tbl
->
expected_tpt
[
i
d
x
])
break
;
}
search_tbl
->
current_rate
=
il4965_rate_n_flags_from_tbl
(
il
,
search_tbl
,
i
nde
x
,
is_green
);
i
d
x
,
is_green
);
update_search_tbl_counter
=
1
;
goto
out
;
}
...
...
@@ -1517,13 +1517,13 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
static
int
il4965_rs_move_mimo2_to_other
(
struct
il_priv
*
il
,
struct
il_lq_sta
*
lq_sta
,
struct
ieee80211_conf
*
conf
,
struct
ieee80211_sta
*
sta
,
int
i
nde
x
)
struct
ieee80211_sta
*
sta
,
int
i
d
x
)
{
s8
is_green
=
lq_sta
->
is_green
;
struct
il_scale_tbl_info
*
tbl
=
&
(
lq_sta
->
lq_info
[
lq_sta
->
active_tbl
]);
struct
il_scale_tbl_info
*
search_tbl
=
&
(
lq_sta
->
lq_info
[(
1
-
lq_sta
->
active_tbl
)]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
nde
x
]);
struct
il_rate_scale_data
*
win
=
&
(
tbl
->
win
[
i
d
x
]);
struct
ieee80211_sta_ht_cap
*
ht_cap
=
&
sta
->
ht_cap
;
u32
sz
=
(
sizeof
(
struct
il_scale_tbl_info
)
-
(
sizeof
(
struct
il_rate_scale_data
)
*
RATE_COUNT
));
...
...
@@ -1575,7 +1575,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
ret
=
il4965_rs_switch_to_siso
(
il
,
lq_sta
,
conf
,
sta
,
search_tbl
,
i
nde
x
);
search_tbl
,
i
d
x
);
if
(
!
ret
)
goto
out
;
...
...
@@ -1603,12 +1603,12 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
*/
if
(
tbl
->
is_SGI
)
{
s32
tpt
=
lq_sta
->
last_tpt
/
100
;
if
(
tpt
>=
search_tbl
->
expected_tpt
[
i
nde
x
])
if
(
tpt
>=
search_tbl
->
expected_tpt
[
i
d
x
])
break
;
}
search_tbl
->
current_rate
=
il4965_rate_n_flags_from_tbl
(
il
,
search_tbl
,
i
nde
x
,
is_green
);
i
d
x
,
is_green
);
update_search_tbl_counter
=
1
;
goto
out
;
...
...
@@ -1728,12 +1728,12 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *il,
struct
il_rxon_context
*
ctx
,
struct
il_lq_sta
*
lq_sta
,
struct
il_scale_tbl_info
*
tbl
,
int
i
nde
x
,
u8
is_green
)
int
i
d
x
,
u8
is_green
)
{
u32
rate
;
/* Update uCode's rate table. */
rate
=
il4965_rate_n_flags_from_tbl
(
il
,
tbl
,
i
nde
x
,
is_green
);
rate
=
il4965_rate_n_flags_from_tbl
(
il
,
tbl
,
i
d
x
,
is_green
);
il4965_rs_fill_link_cmd
(
il
,
lq_sta
,
rate
);
il_send_lq_cmd
(
il
,
ctx
,
&
lq_sta
->
lq
,
CMD_ASYNC
,
false
);
...
...
@@ -1754,7 +1754,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
struct
ieee80211_hdr
*
hdr
=
(
struct
ieee80211_hdr
*
)
skb
->
data
;
int
low
=
RATE_INVALID
;
int
high
=
RATE_INVALID
;
int
i
nde
x
;
int
i
d
x
;
int
i
;
struct
il_rate_scale_data
*
win
=
NULL
;
int
current_tpt
=
IL_INVALID_VALUE
;
...
...
@@ -1765,7 +1765,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
u16
rate_mask
;
u8
update_lq
=
0
;
struct
il_scale_tbl_info
*
tbl
,
*
tbl1
;
u16
rate_scale_i
nde
x_msk
=
0
;
u16
rate_scale_i
d
x_msk
=
0
;
u32
rate
;
u8
is_green
=
0
;
u8
active_tbl
=
0
;
...
...
@@ -1818,9 +1818,9 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
is_green
=
lq_sta
->
is_green
;
/* current tx rate */
i
nde
x
=
lq_sta
->
last_txrate_idx
;
i
d
x
=
lq_sta
->
last_txrate_idx
;
D_RATE
(
"Rate scale i
ndex %d for type %d
\n
"
,
inde
x
,
D_RATE
(
"Rate scale i
dx %d for type %d
\n
"
,
id
x
,
tbl
->
lq_type
);
/* rates available for this association, and for modulation mode */
...
...
@@ -1832,19 +1832,19 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
if
(
is_legacy
(
tbl
->
lq_type
))
{
if
(
lq_sta
->
band
==
IEEE80211_BAND_5GHZ
)
/* supp_rates has no CCK bits in A mode */
rate_scale_i
nde
x_msk
=
(
u16
)
(
rate_mask
&
rate_scale_i
d
x_msk
=
(
u16
)
(
rate_mask
&
(
lq_sta
->
supp_rates
<<
IL_FIRST_OFDM_RATE
));
else
rate_scale_i
nde
x_msk
=
(
u16
)
(
rate_mask
&
rate_scale_i
d
x_msk
=
(
u16
)
(
rate_mask
&
lq_sta
->
supp_rates
);
}
else
rate_scale_i
nde
x_msk
=
rate_mask
;
rate_scale_i
d
x_msk
=
rate_mask
;
if
(
!
rate_scale_i
nde
x_msk
)
rate_scale_i
nde
x_msk
=
rate_mask
;
if
(
!
rate_scale_i
d
x_msk
)
rate_scale_i
d
x_msk
=
rate_mask
;
if
(
!
((
1
<<
i
ndex
)
&
rate_scale_inde
x_msk
))
{
if
(
!
((
1
<<
i
dx
)
&
rate_scale_id
x_msk
))
{
IL_ERR
(
"Current Rate is not valid
\n
"
);
if
(
lq_sta
->
search_better_tbl
)
{
/* revert to active table if search table is not valid*/
...
...
@@ -1852,9 +1852,9 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
lq_sta
->
search_better_tbl
=
0
;
tbl
=
&
(
lq_sta
->
lq_info
[
lq_sta
->
active_tbl
]);
/* get "active" rate info */
i
nde
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
i
d
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
rate
=
il4965_rs_update_rate_tbl
(
il
,
ctx
,
lq_sta
,
tbl
,
i
nde
x
,
is_green
);
tbl
,
i
d
x
,
is_green
);
}
return
;
}
...
...
@@ -1867,14 +1867,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* force user max rate if set by user */
if
(
lq_sta
->
max_rate_idx
!=
-
1
&&
lq_sta
->
max_rate_idx
<
i
nde
x
)
{
i
nde
x
=
lq_sta
->
max_rate_idx
;
lq_sta
->
max_rate_idx
<
i
d
x
)
{
i
d
x
=
lq_sta
->
max_rate_idx
;
update_lq
=
1
;
win
=
&
(
tbl
->
win
[
i
nde
x
]);
win
=
&
(
tbl
->
win
[
i
d
x
]);
goto
lq_update
;
}
win
=
&
(
tbl
->
win
[
i
nde
x
]);
win
=
&
(
tbl
->
win
[
i
d
x
]);
/*
* If there is not enough history to calculate actual average
...
...
@@ -1887,8 +1887,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
if
(
fail_count
<
RATE_MIN_FAILURE_TH
&&
win
->
success_counter
<
RATE_MIN_SUCCESS_TH
)
{
D_RATE
(
"LQ: still below TH. succ=%d total=%d "
"for i
nde
x %d
\n
"
,
win
->
success_counter
,
win
->
counter
,
i
nde
x
);
"for i
d
x %d
\n
"
,
win
->
success_counter
,
win
->
counter
,
i
d
x
);
/* Can't calculate this yet; not enough history */
win
->
average_tpt
=
IL_INVALID_VALUE
;
...
...
@@ -1902,11 +1902,11 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* Else we have enough samples; calculate estimate of
* actual average throughput */
if
(
win
->
average_tpt
!=
((
win
->
success_ratio
*
tbl
->
expected_tpt
[
i
nde
x
]
+
64
)
/
128
))
{
tbl
->
expected_tpt
[
i
d
x
]
+
64
)
/
128
))
{
IL_ERR
(
"expected_tpt should have been calculated by now
\n
"
);
win
->
average_tpt
=
((
win
->
success_ratio
*
tbl
->
expected_tpt
[
i
nde
x
]
+
64
)
/
128
);
tbl
->
expected_tpt
[
i
d
x
]
+
64
)
/
128
);
}
/* If we are searching for better modulation mode, check success. */
...
...
@@ -1946,7 +1946,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
tbl
=
&
(
lq_sta
->
lq_info
[
active_tbl
]);
/* Revert to "active" rate and throughput info */
i
nde
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
i
d
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
current_tpt
=
lq_sta
->
last_tpt
;
/* Need to set up a new rate table in uCode */
...
...
@@ -1962,8 +1962,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* (Else) not in search of better modulation mode, try for better
* starting rate, while staying in this mode. */
high_low
=
il4965_rs_get_adjacent_rate
(
il
,
i
nde
x
,
rate_scale_i
nde
x_msk
,
high_low
=
il4965_rs_get_adjacent_rate
(
il
,
i
d
x
,
rate_scale_i
d
x_msk
,
tbl
->
lq_type
);
low
=
high_low
&
0xff
;
high
=
(
high_low
>>
8
)
&
0xff
;
...
...
@@ -2043,7 +2043,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* Decrease starting rate, update uCode's rate table */
if
(
low
!=
RATE_INVALID
)
{
update_lq
=
1
;
i
nde
x
=
low
;
i
d
x
=
low
;
}
break
;
...
...
@@ -2051,7 +2051,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
/* Increase starting rate, update uCode's rate table */
if
(
high
!=
RATE_INVALID
)
{
update_lq
=
1
;
i
nde
x
=
high
;
i
d
x
=
high
;
}
break
;
...
...
@@ -2061,15 +2061,15 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
break
;
}
D_RATE
(
"choose rate scale i
nde
x %d action %d low %d "
D_RATE
(
"choose rate scale i
d
x %d action %d low %d "
"high %d type %d
\n
"
,
i
nde
x
,
scale_action
,
low
,
high
,
tbl
->
lq_type
);
i
d
x
,
scale_action
,
low
,
high
,
tbl
->
lq_type
);
lq_update:
/* Replace uCode's rate table for the destination station. */
if
(
update_lq
)
rate
=
il4965_rs_update_rate_tbl
(
il
,
ctx
,
lq_sta
,
tbl
,
i
nde
x
,
is_green
);
tbl
,
i
d
x
,
is_green
);
/* Should we stay with this modulation mode,
* or search for a new one? */
...
...
@@ -2090,13 +2090,13 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
* If one is found, set up the new "search" table. */
if
(
is_legacy
(
tbl
->
lq_type
))
il4965_rs_move_legacy_other
(
il
,
lq_sta
,
conf
,
sta
,
i
nde
x
);
conf
,
sta
,
i
d
x
);
else
if
(
is_siso
(
tbl
->
lq_type
))
il4965_rs_move_siso_to_other
(
il
,
lq_sta
,
conf
,
sta
,
i
nde
x
);
conf
,
sta
,
i
d
x
);
else
/* (is_mimo2(tbl->lq_type)) */
il4965_rs_move_mimo2_to_other
(
il
,
lq_sta
,
conf
,
sta
,
i
nde
x
);
conf
,
sta
,
i
d
x
);
/* If new "search" mode was selected, set up in uCode table */
if
(
lq_sta
->
search_better_tbl
)
{
...
...
@@ -2107,11 +2107,11 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
&
(
tbl
->
win
[
i
]));
/* Use new "search" start rate */
i
nde
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
i
d
x
=
il4965_hwrate_to_plcp_idx
(
tbl
->
current_rate
);
D_RATE
(
"Switch current mcs: %X i
nde
x: %d
\n
"
,
tbl
->
current_rate
,
i
nde
x
);
"Switch current mcs: %X i
d
x: %d
\n
"
,
tbl
->
current_rate
,
i
d
x
);
il4965_rs_fill_link_cmd
(
il
,
lq_sta
,
tbl
->
current_rate
);
il_send_lq_cmd
(
il
,
ctx
,
...
...
@@ -2157,8 +2157,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
out:
tbl
->
current_rate
=
il4965_rate_n_flags_from_tbl
(
il
,
tbl
,
i
nde
x
,
is_green
);
i
=
i
nde
x
;
i
d
x
,
is_green
);
i
=
i
d
x
;
lq_sta
->
last_txrate_idx
=
i
;
}
...
...
@@ -2272,7 +2272,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
if
(
lq_sta
->
last_rate_n_flags
&
RATE_MCS_HT_MSK
)
{
rate_idx
-=
IL_FIRST_OFDM_RATE
;
/* 6M and 9M shared same MCS i
nde
x */
/* 6M and 9M shared same MCS i
d
x */
rate_idx
=
(
rate_idx
>
0
)
?
(
rate_idx
-
1
)
:
0
;
if
(
il4965_rs_extract_rate
(
lq_sta
->
last_rate_n_flags
)
>=
RATE_MIMO2_6M_PLCP
)
...
...
@@ -2296,7 +2296,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
(
sband
->
band
==
IEEE80211_BAND_5GHZ
&&
rate_idx
<
IL_FIRST_OFDM_RATE
))
rate_idx
=
rate_lowest_index
(
sband
,
sta
);
/* On valid 5 GHz rate, adjust i
nde
x */
/* On valid 5 GHz rate, adjust i
d
x */
else
if
(
sband
->
band
==
IEEE80211_BAND_5GHZ
)
rate_idx
-=
IL_FIRST_OFDM_RATE
;
info
->
control
.
rates
[
0
].
flags
=
0
;
...
...
@@ -2419,7 +2419,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
struct
il_lq_sta
*
lq_sta
,
u32
new_rate
)
{
struct
il_scale_tbl_info
tbl_type
;
int
i
nde
x
=
0
;
int
i
d
x
=
0
;
int
rate_idx
;
int
repeat_rate
=
0
;
u8
ant_toggle_cnt
=
0
;
...
...
@@ -2427,8 +2427,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
u8
valid_tx_ant
=
0
;
struct
il_link_quality_cmd
*
lq_cmd
=
&
lq_sta
->
lq
;
/* Override starting rate (i
nde
x 0) if needed for debug purposes */
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
nde
x
);
/* Override starting rate (i
d
x 0) if needed for debug purposes */
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
d
x
);
/* Interpret new_rate (rate_n_flags) */
il4965_rs_get_tbl_info_from_mcs
(
new_rate
,
lq_sta
->
band
,
...
...
@@ -2445,8 +2445,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
lq_cmd
->
general_params
.
mimo_delimiter
=
is_mimo
(
tbl_type
.
lq_type
)
?
1
:
0
;
/* Fill 1st table entry (i
nde
x 0) */
lq_cmd
->
rs_table
[
i
nde
x
].
rate_n_flags
=
cpu_to_le32
(
new_rate
);
/* Fill 1st table entry (i
d
x 0) */
lq_cmd
->
rs_table
[
i
d
x
].
rate_n_flags
=
cpu_to_le32
(
new_rate
);
if
(
il4965_num_of_ant
(
tbl_type
.
ant_type
)
==
1
)
{
lq_cmd
->
general_params
.
single_stream_ant_msk
=
...
...
@@ -2456,17 +2456,17 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
tbl_type
.
ant_type
;
}
/* otherwise we don't modify the existing value */
i
nde
x
++
;
i
d
x
++
;
repeat_rate
--
;
if
(
il
)
valid_tx_ant
=
il
->
hw_params
.
valid_tx_ant
;
/* Fill rest of rate table */
while
(
i
nde
x
<
LINK_QUAL_MAX_RETRY_NUM
)
{
while
(
i
d
x
<
LINK_QUAL_MAX_RETRY_NUM
)
{
/* Repeat initial/next rate.
* For legacy IL_NUMBER_TRY == 1, this loop will not execute.
* For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
while
(
repeat_rate
>
0
&&
i
nde
x
<
LINK_QUAL_MAX_RETRY_NUM
)
{
while
(
repeat_rate
>
0
&&
i
d
x
<
LINK_QUAL_MAX_RETRY_NUM
)
{
if
(
is_legacy
(
tbl_type
.
lq_type
))
{
if
(
ant_toggle_cnt
<
NUM_TRY_BEFORE_ANT_TOGGLE
)
ant_toggle_cnt
++
;
...
...
@@ -2477,13 +2477,13 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
}
/* Override next rate if needed for debug purposes */
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
nde
x
);
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
d
x
);
/* Fill next table entry */
lq_cmd
->
rs_table
[
i
nde
x
].
rate_n_flags
=
lq_cmd
->
rs_table
[
i
d
x
].
rate_n_flags
=
cpu_to_le32
(
new_rate
);
repeat_rate
--
;
i
nde
x
++
;
i
d
x
++
;
}
il4965_rs_get_tbl_info_from_mcs
(
new_rate
,
...
...
@@ -2494,7 +2494,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
* If initial rate was MIMO, this will finally end up
* as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */
if
(
is_mimo
(
tbl_type
.
lq_type
))
lq_cmd
->
general_params
.
mimo_delimiter
=
i
nde
x
;
lq_cmd
->
general_params
.
mimo_delimiter
=
i
d
x
;
/* Get next rate */
new_rate
=
il4965_rs_get_lower_rate
(
lq_sta
,
...
...
@@ -2520,12 +2520,12 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
use_ht_possible
=
0
;
/* Override next rate if needed for debug purposes */
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
nde
x
);
il4965_rs_dbgfs_set_mcs
(
lq_sta
,
&
new_rate
,
i
d
x
);
/* Fill next table entry */
lq_cmd
->
rs_table
[
i
nde
x
].
rate_n_flags
=
cpu_to_le32
(
new_rate
);
lq_cmd
->
rs_table
[
i
d
x
].
rate_n_flags
=
cpu_to_le32
(
new_rate
);
i
nde
x
++
;
i
d
x
++
;
repeat_rate
--
;
}
...
...
@@ -2564,7 +2564,7 @@ static int il4965_open_file_generic(struct inode *inode, struct file *file)
return
0
;
}
static
void
il4965_rs_dbgfs_set_mcs
(
struct
il_lq_sta
*
lq_sta
,
u32
*
rate_n_flags
,
int
i
nde
x
)
u32
*
rate_n_flags
,
int
i
d
x
)
{
struct
il_priv
*
il
;
u8
valid_tx_ant
;
...
...
@@ -2636,7 +2636,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file,
char
*
buff
;
int
desc
=
0
;
int
i
=
0
;
int
i
nde
x
=
0
;
int
i
d
x
=
0
;
ssize_t
ret
;
struct
il_lq_sta
*
lq_sta
=
file
->
private_data
;
...
...
@@ -2687,25 +2687,25 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file,
desc
+=
sprintf
(
buff
+
desc
,
"Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x
\n
"
,
lq_sta
->
lq
.
general_params
.
start_rate_i
nde
x
[
0
],
lq_sta
->
lq
.
general_params
.
start_rate_i
nde
x
[
1
],
lq_sta
->
lq
.
general_params
.
start_rate_i
nde
x
[
2
],
lq_sta
->
lq
.
general_params
.
start_rate_i
nde
x
[
3
]);
lq_sta
->
lq
.
general_params
.
start_rate_i
d
x
[
0
],
lq_sta
->
lq
.
general_params
.
start_rate_i
d
x
[
1
],
lq_sta
->
lq
.
general_params
.
start_rate_i
d
x
[
2
],
lq_sta
->
lq
.
general_params
.
start_rate_i
d
x
[
3
]);
for
(
i
=
0
;
i
<
LINK_QUAL_MAX_RETRY_NUM
;
i
++
)
{
i
nde
x
=
il4965_hwrate_to_plcp_idx
(
i
d
x
=
il4965_hwrate_to_plcp_idx
(
le32_to_cpu
(
lq_sta
->
lq
.
rs_table
[
i
].
rate_n_flags
));
if
(
is_legacy
(
tbl
->
lq_type
))
{
desc
+=
sprintf
(
buff
+
desc
,
" rate[%d] 0x%X %smbps
\n
"
,
i
,
le32_to_cpu
(
lq_sta
->
lq
.
rs_table
[
i
].
rate_n_flags
),
il_rate_mcs
[
i
nde
x
].
mbps
);
il_rate_mcs
[
i
d
x
].
mbps
);
}
else
{
desc
+=
sprintf
(
buff
+
desc
,
" rate[%d] 0x%X %smbps (%s)
\n
"
,
i
,
le32_to_cpu
(
lq_sta
->
lq
.
rs_table
[
i
].
rate_n_flags
),
il_rate_mcs
[
i
ndex
].
mbps
,
il_rate_mcs
[
inde
x
].
mcs
);
il_rate_mcs
[
i
dx
].
mbps
,
il_rate_mcs
[
id
x
].
mcs
);
}
}
...
...
drivers/net/wireless/iwlegacy/iwl-4965-sta.c
View file @
0c2c8852
...
...
@@ -157,7 +157,7 @@ static int il4965_static_wepkey_cmd(struct il_priv *il,
(
sizeof
(
struct
il_wep_key
)
*
WEP_KEYS_MAX
));
for
(
i
=
0
;
i
<
WEP_KEYS_MAX
;
i
++
)
{
wep_cmd
->
key
[
i
].
key_i
nde
x
=
i
;
wep_cmd
->
key
[
i
].
key_i
d
x
=
i
;
if
(
ctx
->
wep_keys
[
i
].
key_size
)
{
wep_cmd
->
key
[
i
].
key_offset
=
i
;
not_empty
=
1
;
...
...
@@ -283,7 +283,7 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *il,
if
((
il
->
stations
[
sta_id
].
sta
.
key
.
key_flags
&
STA_KEY_FLG_ENCRYPT_MSK
)
==
STA_KEY_FLG_NO_ENC
)
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
=
il_get_free_ucode_key_i
nde
x
(
il
);
il_get_free_ucode_key_i
d
x
(
il
);
/* else, we are overriding an existing key => no need to allocated room
* in uCode. */
...
...
@@ -334,7 +334,7 @@ static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
if
((
il
->
stations
[
sta_id
].
sta
.
key
.
key_flags
&
STA_KEY_FLG_ENCRYPT_MSK
)
==
STA_KEY_FLG_NO_ENC
)
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
=
il_get_free_ucode_key_i
nde
x
(
il
);
il_get_free_ucode_key_i
d
x
(
il
);
/* else, we are overriding an existing key => no need to allocated room
* in uCode. */
...
...
@@ -379,7 +379,7 @@ static int il4965_set_tkip_dynamic_key_info(struct il_priv *il,
if
((
il
->
stations
[
sta_id
].
sta
.
key
.
key_flags
&
STA_KEY_FLG_ENCRYPT_MSK
)
==
STA_KEY_FLG_NO_ENC
)
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
=
il_get_free_ucode_key_i
nde
x
(
il
);
il_get_free_ucode_key_i
d
x
(
il
);
/* else, we are overriding an existing key => no need to allocated room
* in uCode. */
...
...
@@ -457,9 +457,9 @@ int il4965_remove_dynamic_key(struct il_priv *il,
keyconf
->
keyidx
,
sta_id
);
if
(
keyconf
->
keyidx
!=
keyidx
)
{
/* We need to remove a key with i
nde
x different that the one
/* We need to remove a key with i
d
x different that the one
* in the uCode. This means that the key we need to remove has
* been replaced by another one with different i
nde
x.
* been replaced by another one with different i
d
x.
* Don't do anything and return ok
*/
spin_unlock_irqrestore
(
&
il
->
sta_lock
,
flags
);
...
...
@@ -475,7 +475,7 @@ int il4965_remove_dynamic_key(struct il_priv *il,
if
(
!
test_and_clear_bit
(
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
,
&
il
->
ucode_key_table
))
IL_ERR
(
"i
nde
x %d not used in uCode key table.
\n
"
,
IL_ERR
(
"i
d
x %d not used in uCode key table.
\n
"
,
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
);
memset
(
&
il
->
stations
[
sta_id
].
keyinfo
,
0
,
sizeof
(
struct
il_hw_key
));
...
...
drivers/net/wireless/iwlegacy/iwl-4965-tx.c
View file @
0c2c8852
...
...
@@ -183,7 +183,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
/* DATA packets will use the uCode station table for rate/antenna
* selection */
if
(
ieee80211_is_data
(
fc
))
{
tx_cmd
->
initial_rate_i
nde
x
=
0
;
tx_cmd
->
initial_rate_i
d
x
=
0
;
tx_cmd
->
tx_flags
|=
TX_CMD_FLG_STA_RATE_MSK
;
return
;
}
...
...
@@ -192,7 +192,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
* If the current TX rate stored in mac80211 has the MCS bit set, it's
* not really a TX rate. Thus, we use the lowest supported rate for
* this band. Also use the lowest supported rate if the stored rate
* i
nde
x is invalid.
* i
d
x is invalid.
*/
rate_idx
=
info
->
control
.
rates
[
0
].
idx
;
if
((
info
->
control
.
rates
[
0
].
flags
&
IEEE80211_TX_RC_MCS
)
||
...
...
@@ -319,7 +319,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
if
(
!
ieee80211_is_data
(
fc
))
sta_id
=
ctx
->
bcast_sta_id
;
else
{
/* Find i
nde
x into station table for destination station */
/* Find i
d
x into station table for destination station */
sta_id
=
il_sta_id_or_broadcast
(
il
,
ctx
,
info
->
control
.
sta
);
if
(
sta_id
==
IL_INVALID_STATION
)
{
...
...
@@ -417,7 +417,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
/*
* Set up the Tx-command (not MAC!) header.
* Store the chosen Tx queue and TFD i
nde
x within the sequence field;
* Store the chosen Tx queue and TFD i
d
x within the sequence field;
* after Tx, uCode's Tx response will return this value so driver can
* locate the frame within the tx queue and do post-tx processing.
*/
...
...
@@ -513,7 +513,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
pci_dma_sync_single_for_device
(
il
->
pci_dev
,
txcmd_phys
,
firstlen
,
PCI_DMA_BIDIRECTIONAL
);
/* Tell device the write i
nde
x *just past* this latest filled TFD */
/* Tell device the write i
d
x *just past* this latest filled TFD */
q
->
write_ptr
=
il_queue_inc_wrap
(
q
->
write_ptr
,
q
->
n_bd
);
il_txq_update_write_ptr
(
il
,
txq
);
spin_unlock_irqrestore
(
&
il
->
lock
,
flags
);
...
...
@@ -828,7 +828,7 @@ static int il4965_txq_agg_enable(struct il_priv *il, int txq_id,
/* Set this queue as a chain-building queue */
il_set_bits_prph
(
il
,
IL49_SCD_QUEUECHAIN_SEL
,
(
1
<<
txq_id
));
/* Place first TFD at i
nde
x corresponding to start sequence number.
/* Place first TFD at i
d
x corresponding to start sequence number.
* Assumes that ssn_idx is valid (!= 0xFFF) */
il
->
txq
[
txq_id
].
q
.
read_ptr
=
(
ssn_idx
&
0xff
);
il
->
txq
[
txq_id
].
q
.
write_ptr
=
(
ssn_idx
&
0xff
);
...
...
@@ -1105,7 +1105,7 @@ il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info,
ieee80211_tx_status_irqsafe
(
il
->
hw
,
tx_info
->
skb
);
}
int
il4965_tx_queue_reclaim
(
struct
il_priv
*
il
,
int
txq_id
,
int
i
nde
x
)
int
il4965_tx_queue_reclaim
(
struct
il_priv
*
il
,
int
txq_id
,
int
i
d
x
)
{
struct
il_tx_queue
*
txq
=
&
il
->
txq
[
txq_id
];
struct
il_queue
*
q
=
&
txq
->
q
;
...
...
@@ -1113,15 +1113,15 @@ int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index)
int
nfreed
=
0
;
struct
ieee80211_hdr
*
hdr
;
if
(
i
ndex
>=
q
->
n_bd
||
il_queue_used
(
q
,
inde
x
)
==
0
)
{
IL_ERR
(
"Read i
ndex for DMA queue txq id (%d), inde
x %d, "
if
(
i
dx
>=
q
->
n_bd
||
il_queue_used
(
q
,
id
x
)
==
0
)
{
IL_ERR
(
"Read i
dx for DMA queue txq id (%d), id
x %d, "
"is out of range [0-%d] %d %d.
\n
"
,
txq_id
,
i
nde
x
,
q
->
n_bd
,
q
->
write_ptr
,
q
->
read_ptr
);
i
d
x
,
q
->
n_bd
,
q
->
write_ptr
,
q
->
read_ptr
);
return
0
;
}
for
(
i
ndex
=
il_queue_inc_wrap
(
inde
x
,
q
->
n_bd
);
q
->
read_ptr
!=
i
nde
x
;
for
(
i
dx
=
il_queue_inc_wrap
(
id
x
,
q
->
n_bd
);
q
->
read_ptr
!=
i
d
x
;
q
->
read_ptr
=
il_queue_inc_wrap
(
q
->
read_ptr
,
q
->
n_bd
))
{
tx_info
=
&
txq
->
txb
[
txq
->
q
.
read_ptr
];
...
...
@@ -1252,7 +1252,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
struct
il_compressed_ba_resp
*
ba_resp
=
&
pkt
->
u
.
compressed_ba
;
struct
il_tx_queue
*
txq
=
NULL
;
struct
il_ht_agg
*
agg
;
int
i
nde
x
;
int
i
d
x
;
int
sta_id
;
int
tid
;
unsigned
long
flags
;
...
...
@@ -1260,7 +1260,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
/* "flow" corresponds to Tx queue */
u16
scd_flow
=
le16_to_cpu
(
ba_resp
->
scd_flow
);
/* "ssn" is start of block-ack Tx win, corresponds to i
nde
x
/* "ssn" is start of block-ack Tx win, corresponds to i
d
x
* (in Tx queue's circular buffer) of first TFD/frame in win */
u16
ba_resp_scd_ssn
=
le16_to_cpu
(
ba_resp
->
scd_ssn
);
...
...
@@ -1287,8 +1287,8 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
return
;
}
/* Find i
nde
x just before block-ack win */
i
nde
x
=
il_queue_dec_wrap
(
ba_resp_scd_ssn
&
0xff
,
txq
->
q
.
n_bd
);
/* Find i
d
x just before block-ack win */
i
d
x
=
il_queue_dec_wrap
(
ba_resp_scd_ssn
&
0xff
,
txq
->
q
.
n_bd
);
spin_lock_irqsave
(
&
il
->
sta_lock
,
flags
);
...
...
@@ -1317,7 +1317,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
* transmitted ... if not, it's too late anyway). */
if
(
txq
->
q
.
read_ptr
!=
(
ba_resp_scd_ssn
&
0xff
))
{
/* calculate mac80211 ampdu sw queue to wake */
int
freed
=
il4965_tx_queue_reclaim
(
il
,
scd_flow
,
i
nde
x
);
int
freed
=
il4965_tx_queue_reclaim
(
il
,
scd_flow
,
i
d
x
);
il4965_free_tfds_in_queue
(
il
,
sta_id
,
tid
,
freed
);
if
(
il_queue_space
(
&
txq
->
q
)
>
txq
->
q
.
low_mark
&&
...
...
drivers/net/wireless/iwlegacy/iwl-4965.c
View file @
0c2c8852
...
...
@@ -446,12 +446,12 @@ static s32 il4965_math_div_round(s32 num, s32 denom, s32 *res)
* il4965_get_voltage_compensation - Power supply voltage comp for txpower
*
* Determines power supply voltage compensation for txpower calculations.
* Returns number of 1/2-dB steps to subtract from gain table i
nde
x,
* Returns number of 1/2-dB steps to subtract from gain table i
d
x,
* to compensate for difference between power supply voltage during
* factory measurements, vs. current power supply voltage.
*
* Voltage indication is higher for lower voltage.
* Lower voltage requires more gain (lower gain table i
nde
x).
* Lower voltage requires more gain (lower gain table i
d
x).
*/
static
s32
il4965_get_voltage_compensation
(
s32
eeprom_voltage
,
s32
current_voltage
)
...
...
@@ -628,10 +628,10 @@ static struct il4965_txpower_comp_entry {
{
3
,
1
}
/* group 4 2.4, ch all */
};
static
s32
get_min_power_i
ndex
(
s32
rate_power_inde
x
,
u32
band
)
static
s32
get_min_power_i
dx
(
s32
rate_power_id
x
,
u32
band
)
{
if
(
!
band
)
{
if
((
rate_power_i
nde
x
&
7
)
<=
4
)
if
((
rate_power_i
d
x
&
7
)
<=
4
)
return
MIN_TX_GAIN_IDX_52GHZ_EXT
;
}
return
MIN_TX_GAIN_IDX
;
...
...
@@ -643,7 +643,7 @@ struct gain_entry {
};
static
const
struct
gain_entry
gain_table
[
2
][
108
]
=
{
/* 5.2GHz power gain i
nde
x table */
/* 5.2GHz power gain i
d
x table */
{
{
123
,
0x3F
},
/* highest txpower */
{
117
,
0x3F
},
...
...
@@ -754,7 +754,7 @@ static const struct gain_entry gain_table[2][108] = {
{
83
,
0x00
},
{
78
,
0x00
},
},
/* 2.4GHz power gain i
nde
x table */
/* 2.4GHz power gain i
d
x table */
{
{
110
,
0x3f
},
/* highest txpower */
{
104
,
0x3f
},
...
...
@@ -891,12 +891,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
s32
degrees_per_05db_denom
;
s32
factory_temp
;
s32
temperature_comp
[
2
];
s32
factory_gain_i
nde
x
[
2
];
s32
factory_gain_i
d
x
[
2
];
s32
factory_actual_pwr
[
2
];
s32
power_i
nde
x
;
s32
power_i
d
x
;
/* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units
* are used for i
nde
xing into txpower table) */
* are used for i
d
xing into txpower table) */
user_target_power
=
2
*
il
->
tx_power_user_lmt
;
/* Get current (RXON) channel, band, width */
...
...
@@ -995,7 +995,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
degrees_per_05db_num
,
&
temperature_comp
[
c
]);
factory_gain_i
nde
x
[
c
]
=
measurement
->
gain_idx
;
factory_gain_i
d
x
[
c
]
=
measurement
->
gain_idx
;
factory_actual_pwr
[
c
]
=
measurement
->
actual_pow
;
D_TXPOWER
(
"chain = %d
\n
"
,
c
);
...
...
@@ -1005,7 +1005,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
temperature_comp
[
c
]);
D_TXPOWER
(
"fctry idx %d, fctry pwr %d
\n
"
,
factory_gain_i
nde
x
[
c
],
factory_gain_i
d
x
[
c
],
factory_actual_pwr
[
c
]);
}
...
...
@@ -1053,50 +1053,50 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
else
atten_value
=
0
;
/* calculate i
ndex; higher inde
x means lower txpower */
power_i
ndex
=
(
u8
)
(
factory_gain_inde
x
[
c
]
-
/* calculate i
dx; higher id
x means lower txpower */
power_i
dx
=
(
u8
)
(
factory_gain_id
x
[
c
]
-
(
target_power
-
factory_actual_pwr
[
c
])
-
temperature_comp
[
c
]
-
voltage_compensation
+
atten_value
);
/* D_TXPOWER("calculated txpower i
nde
x %d\n",
power_i
nde
x); */
/* D_TXPOWER("calculated txpower i
d
x %d\n",
power_i
d
x); */
if
(
power_i
ndex
<
get_min_power_inde
x
(
i
,
band
))
power_i
ndex
=
get_min_power_inde
x
(
i
,
band
);
if
(
power_i
dx
<
get_min_power_id
x
(
i
,
band
))
power_i
dx
=
get_min_power_id
x
(
i
,
band
);
/* adjust 5 GHz i
ndex to support negative inde
xes */
/* adjust 5 GHz i
dx to support negative id
xes */
if
(
!
band
)
power_i
nde
x
+=
9
;
power_i
d
x
+=
9
;
/* CCK, rate 32, reduce txpower for CCK */
if
(
i
==
POWER_TABLE_CCK_ENTRY
)
power_i
nde
x
+=
power_i
d
x
+=
IL_TX_POWER_CCK_COMPENSATION_C_STEP
;
/* stay within the table! */
if
(
power_i
nde
x
>
107
)
{
IL_WARN
(
"txpower i
nde
x %d > 107
\n
"
,
power_i
nde
x
);
power_i
nde
x
=
107
;
if
(
power_i
d
x
>
107
)
{
IL_WARN
(
"txpower i
d
x %d > 107
\n
"
,
power_i
d
x
);
power_i
d
x
=
107
;
}
if
(
power_i
nde
x
<
0
)
{
IL_WARN
(
"txpower i
nde
x %d < 0
\n
"
,
power_i
nde
x
);
power_i
nde
x
=
0
;
if
(
power_i
d
x
<
0
)
{
IL_WARN
(
"txpower i
d
x %d < 0
\n
"
,
power_i
d
x
);
power_i
d
x
=
0
;
}
/* fill txpower command for this rate/chain */
tx_power
.
s
.
radio_tx_gain
[
c
]
=
gain_table
[
band
][
power_i
nde
x
].
radio
;
gain_table
[
band
][
power_i
d
x
].
radio
;
tx_power
.
s
.
dsp_predis_atten
[
c
]
=
gain_table
[
band
][
power_i
nde
x
].
dsp
;
gain_table
[
band
][
power_i
d
x
].
dsp
;
D_TXPOWER
(
"chain %d mimo %d i
nde
x %d "
D_TXPOWER
(
"chain %d mimo %d i
d
x %d "
"gain 0x%02x dsp %d
\n
"
,
c
,
atten_value
,
power_i
nde
x
,
c
,
atten_value
,
power_i
d
x
,
tx_power
.
s
.
radio_tx_gain
[
c
],
tx_power
.
s
.
dsp_predis_atten
[
c
]);
}
/* for each chain */
...
...
@@ -1777,7 +1777,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
struct
il_rx_pkt
*
pkt
=
rxb_addr
(
rxb
);
u16
sequence
=
le16_to_cpu
(
pkt
->
hdr
.
sequence
);
int
txq_id
=
SEQ_TO_QUEUE
(
sequence
);
int
i
nde
x
=
SEQ_TO_IDX
(
sequence
);
int
i
d
x
=
SEQ_TO_IDX
(
sequence
);
struct
il_tx_queue
*
txq
=
&
il
->
txq
[
txq_id
];
struct
ieee80211_hdr
*
hdr
;
struct
ieee80211_tx_info
*
info
;
...
...
@@ -1789,10 +1789,10 @@ static void il4965_rx_reply_tx(struct il_priv *il,
u8
*
qc
=
NULL
;
unsigned
long
flags
;
if
(
i
ndex
>=
txq
->
q
.
n_bd
||
il_queue_used
(
&
txq
->
q
,
inde
x
)
==
0
)
{
IL_ERR
(
"Read i
ndex for DMA queue txq_id (%d) inde
x %d "
if
(
i
dx
>=
txq
->
q
.
n_bd
||
il_queue_used
(
&
txq
->
q
,
id
x
)
==
0
)
{
IL_ERR
(
"Read i
dx for DMA queue txq_id (%d) id
x %d "
"is out of range [0-%d] %d %d
\n
"
,
txq_id
,
i
nde
x
,
txq
->
q
.
n_bd
,
txq
->
q
.
write_ptr
,
i
d
x
,
txq
->
q
.
n_bd
,
txq
->
q
.
write_ptr
,
txq
->
q
.
read_ptr
);
return
;
}
...
...
@@ -1801,7 +1801,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
info
=
IEEE80211_SKB_CB
(
txq
->
txb
[
txq
->
q
.
read_ptr
].
skb
);
memset
(
&
info
->
status
,
0
,
sizeof
(
info
->
status
));
hdr
=
il_tx_queue_get_hdr
(
il
,
txq_id
,
i
nde
x
);
hdr
=
il_tx_queue_get_hdr
(
il
,
txq_id
,
i
d
x
);
if
(
ieee80211_is_data_qos
(
hdr
->
frame_control
))
{
qc
=
ieee80211_get_qos_ctl
(
hdr
);
tid
=
qc
[
0
]
&
0xf
;
...
...
@@ -1821,18 +1821,18 @@ static void il4965_rx_reply_tx(struct il_priv *il,
agg
=
&
il
->
stations
[
sta_id
].
tid
[
tid
].
agg
;
il4965_tx_status_reply_tx
(
il
,
agg
,
tx_resp
,
txq_id
,
i
nde
x
);
il4965_tx_status_reply_tx
(
il
,
agg
,
tx_resp
,
txq_id
,
i
d
x
);
/* check if BAR is needed */
if
((
tx_resp
->
frame_count
==
1
)
&&
!
il4965_is_tx_success
(
status
))
info
->
flags
|=
IEEE80211_TX_STAT_AMPDU_NO_BACK
;
if
(
txq
->
q
.
read_ptr
!=
(
scd_ssn
&
0xff
))
{
i
nde
x
=
il_queue_dec_wrap
(
scd_ssn
&
0xff
,
i
d
x
=
il_queue_dec_wrap
(
scd_ssn
&
0xff
,
txq
->
q
.
n_bd
);
D_TX_REPLY
(
"Retry scheduler reclaim scd_ssn "
"%d i
ndex %d
\n
"
,
scd_ssn
,
inde
x
);
freed
=
il4965_tx_queue_reclaim
(
il
,
txq_id
,
i
nde
x
);
"%d i
dx %d
\n
"
,
scd_ssn
,
id
x
);
freed
=
il4965_tx_queue_reclaim
(
il
,
txq_id
,
i
d
x
);
if
(
qc
)
il4965_free_tfds_in_queue
(
il
,
sta_id
,
tid
,
freed
);
...
...
@@ -1856,7 +1856,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
le32_to_cpu
(
tx_resp
->
rate_n_flags
),
tx_resp
->
failure_frame
);
freed
=
il4965_tx_queue_reclaim
(
il
,
txq_id
,
i
nde
x
);
freed
=
il4965_tx_queue_reclaim
(
il
,
txq_id
,
i
d
x
);
if
(
qc
&&
likely
(
sta_id
!=
IL_INVALID_STATION
))
il4965_free_tfds_in_queue
(
il
,
sta_id
,
tid
,
freed
);
else
if
(
sta_id
==
IL_INVALID_STATION
)
...
...
drivers/net/wireless/iwlegacy/iwl-4965.h
View file @
0c2c8852
...
...
@@ -123,7 +123,7 @@ int il4965_txq_check_empty(struct il_priv *il,
int
sta_id
,
u8
tid
,
int
txq_id
);
void
il4965_rx_reply_compressed_ba
(
struct
il_priv
*
il
,
struct
il_rx_buf
*
rxb
);
int
il4965_tx_queue_reclaim
(
struct
il_priv
*
il
,
int
txq_id
,
int
i
nde
x
);
int
il4965_tx_queue_reclaim
(
struct
il_priv
*
il
,
int
txq_id
,
int
i
d
x
);
void
il4965_hw_txq_ctx_free
(
struct
il_priv
*
il
);
int
il4965_txq_ctx_alloc
(
struct
il_priv
*
il
);
void
il4965_txq_ctx_reset
(
struct
il_priv
*
il
);
...
...
@@ -133,7 +133,7 @@ void il4965_txq_set_sched(struct il_priv *il, u32 mask);
/*
* Acquire il->lock before calling this function !
*/
void
il4965_set_wr_ptrs
(
struct
il_priv
*
il
,
int
txq_id
,
u32
i
nde
x
);
void
il4965_set_wr_ptrs
(
struct
il_priv
*
il
,
int
txq_id
,
u32
i
d
x
);
/**
* il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue
* @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed
...
...
drivers/net/wireless/iwlegacy/iwl-commands.h
View file @
0c2c8852
...
...
@@ -197,7 +197,7 @@ struct il_cmd_header {
*
* The Linux driver uses the following format:
*
* 0:7 tfd i
nde
x - position within TX queue
* 0:7 tfd i
d
x - position within TX queue
* 8:12 TX queue id
* 13 reserved
* 14 huge - driver sets this to indicate command is in the
...
...
@@ -454,7 +454,7 @@ struct il_init_alive_resp {
* __le32 log_size; log capacity (in number of entries)
* __le32 type; (1) timestamp with each entry, (0) no timestamp
* __le32 wraps; # times uCode has wrapped to top of circular buffer
* __le32 write_i
nde
x; next circular buffer entry that uCode would fill
* __le32 write_i
d
x; next circular buffer entry that uCode would fill
*
* The header is followed by the circular buffer of log entries. Entries
* with timestamps have the following format:
...
...
@@ -901,7 +901,7 @@ struct il_qosparam_cmd {
#define STA_MODIFY_DELBA_TID_MSK 0x10
#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
/* Receiver address (actually, Rx station's i
nde
x into station table),
/* Receiver address (actually, Rx station's i
d
x into station table),
* combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
...
...
@@ -918,12 +918,12 @@ struct il4965_keyinfo {
/**
* struct sta_id_modify
* @addr[ETH_ALEN]: station's MAC address
* @sta_id: i
nde
x of station in uCode's station table
* @sta_id: i
d
x of station in uCode's station table
* @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
*
* Driver selects unused table i
nde
x when adding new station,
* or the i
nde
x to a pre-existing station entry when modifying that station.
* Some i
ndexes have special purposes (IL_AP_ID, inde
x 0, is for AP).
* Driver selects unused table i
d
x when adding new station,
* or the i
d
x to a pre-existing station entry when modifying that station.
* Some i
dxes have special purposes (IL_AP_ID, id
x 0, is for AP).
*
* modify_mask flags select which parameters to modify vs. leave alone.
*/
...
...
@@ -959,7 +959,7 @@ struct sta_id_modify {
* in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
* are all that are needed for a BSS client station. If the device is
* used as AP, or in an IBSS network, driver must set up station table
* entries for all STAs in network, starting with i
nde
x IL_STA_ID.
* entries for all STAs in network, starting with i
d
x IL_STA_ID.
*/
struct
il3945_addsta_cmd
{
...
...
@@ -1109,7 +1109,7 @@ struct il_rem_sta_cmd {
* REPLY_WEP_KEY = 0x20
*/
struct
il_wep_key
{
u8
key_i
nde
x
;
u8
key_i
d
x
;
u8
key_offset
;
u8
reserved1
[
2
];
u8
key_size
;
...
...
@@ -1297,7 +1297,7 @@ struct il_rx_mpdu_res_start {
/* For 4965 devices:
* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
* Tx command's initial_rate_i
nde
x indicates first rate to try;
* Tx command's initial_rate_i
d
x indicates first rate to try;
* uCode walks through table for additional Tx attempts.
* 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
* This rate will be used for all Tx attempts; it will not be scaled. */
...
...
@@ -1499,7 +1499,7 @@ struct il_tx_cmd {
* rate (via non-0 value) for special frames (e.g. management), while
* still supporting rate scaling for all frames.
*/
u8
initial_rate_i
nde
x
;
u8
initial_rate_i
d
x
;
u8
reserved
;
u8
key
[
16
];
__le16
next_frame_flags
;
...
...
@@ -1792,7 +1792,7 @@ struct il4965_txpowertable_cmd {
struct
il3945_rate_scaling_info
{
__le16
rate_n_flags
;
u8
try_cnt
;
u8
next_rate_i
nde
x
;
u8
next_rate_i
d
x
;
}
__packed
;
struct
il3945_rate_scaling_cmd
{
...
...
@@ -1825,7 +1825,7 @@ struct il3945_rate_scaling_cmd {
struct
il_link_qual_general_params
{
u8
flags
;
/* No entries at or above this (driver chosen) i
nde
x contain MIMO */
/* No entries at or above this (driver chosen) i
d
x contain MIMO */
u8
mimo_delimiter
;
/* Best single antenna to use for single stream (legacy, SISO). */
...
...
@@ -1837,7 +1837,7 @@ struct il_link_qual_general_params {
/*
* If driver needs to use different initial rates for different
* EDCA QOS access categories (as implemented by tx fifos 0-3),
* this table will set that up, by indicating the i
nde
xes in the
* this table will set that up, by indicating the i
d
xes in the
* rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
* Otherwise, driver should set all entries to 0.
*
...
...
@@ -1845,7 +1845,7 @@ struct il_link_qual_general_params {
* 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
* TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
*/
u8
start_rate_i
nde
x
[
LINK_QUAL_AC_NUM
];
u8
start_rate_i
d
x
[
LINK_QUAL_AC_NUM
];
}
__packed
;
#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000)
/* 4 milliseconds */
...
...
@@ -2089,8 +2089,8 @@ struct il_link_quality_cmd {
struct
il_link_qual_agg_params
agg_params
;
/*
* Rate info; when using rate-scaling, Tx command's initial_rate_i
nde
x
* specifies 1st Tx rate attempted, via i
nde
x into this table.
* Rate info; when using rate-scaling, Tx command's initial_rate_i
d
x
* specifies 1st Tx rate attempted, via i
d
x into this table.
* 4965 devices works its way through table when retrying Tx.
*/
struct
{
...
...
@@ -2233,7 +2233,7 @@ enum il_measure_type {
struct
il_spectrum_notification
{
u8
id
;
/* measurement id -- 0 or 1 */
u8
token
;
u8
channel_i
ndex
;
/* inde
x in measurement channel list */
u8
channel_i
dx
;
/* id
x in measurement channel list */
u8
state
;
/* 0 - start, 1 - stop */
__le32
start_time
;
/* lower 32-bits of TSF */
u8
band
;
/* 0 - 5.2GHz, 1 - 2.4GHz */
...
...
@@ -3220,7 +3220,7 @@ struct il_missed_beacon_notif {
* Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd)
*/
#define HD_TABLE_SIZE (11)
/* number of entries */
#define HD_MIN_ENERGY_CCK_DET_IDX (0)
/* table i
nde
xes */
#define HD_MIN_ENERGY_CCK_DET_IDX (0)
/* table i
d
xes */
#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
...
...
@@ -3239,13 +3239,13 @@ struct il_missed_beacon_notif {
/**
* struct il_sensitivity_cmd
* @control: (1) updates working table, (0) updates default table
* @table: energy threshold values, use HD_* as i
nde
x into table
* @table: energy threshold values, use HD_* as i
d
x into table
*
* Always use "1" in "control" to update uCode's working table and DSP.
*/
struct
il_sensitivity_cmd
{
__le16
control
;
/* always use "1" */
__le16
table
[
HD_TABLE_SIZE
];
/* use HD_* as i
nde
x */
__le16
table
[
HD_TABLE_SIZE
];
/* use HD_* as i
d
x */
}
__packed
;
...
...
drivers/net/wireless/iwlegacy/iwl-csr.h
View file @
0c2c8852
...
...
@@ -411,10 +411,10 @@
#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
/*
* Per-Tx-queue write pointer (i
nde
x, really!)
* Indicates i
nde
x to next TFD that driver will fill (1 past latest filled).
* Per-Tx-queue write pointer (i
d
x, really!)
* Indicates i
d
x to next TFD that driver will fill (1 past latest filled).
* Bit usage:
* 0-7: queue write i
nde
x
* 0-7: queue write i
d
x
* 11-8: queue selector
*/
#define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
...
...
drivers/net/wireless/iwlegacy/iwl-dev.h
View file @
0c2c8852
...
...
@@ -125,8 +125,8 @@ struct il_cmd_meta {
*/
struct
il_queue
{
int
n_bd
;
/* number of BDs in this queue */
int
write_ptr
;
/* 1-st empty entry (i
nde
x) host_w*/
int
read_ptr
;
/* last used entry (i
nde
x) host_r*/
int
write_ptr
;
/* 1-st empty entry (i
d
x) host_w*/
int
read_ptr
;
/* last used entry (i
d
x) host_r*/
/* use for monitoring and recovering the stuck queue */
dma_addr_t
dma_addr
;
/* physical addr for BD's */
int
n_win
;
/* safe queue win */
...
...
@@ -152,7 +152,7 @@ struct il_tx_info {
* @dma_addr_cmd: physical address of cmd/tx buffer array
* @txb: array of per-TFD driver data
* @time_stamp: time (in jiffies) of last read_ptr change
* @need_update: indicates need to update read/write i
nde
x
* @need_update: indicates need to update read/write i
d
x
* @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
*
* A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
...
...
@@ -199,11 +199,11 @@ struct il3945_clip_group {
* -- hardware capabilities (clip-powers)
* -- spectrum management
* -- user preference (e.g. iwconfig)
* when requested power is set, base power i
nde
x must also be set. */
* when requested power is set, base power i
d
x must also be set. */
struct
il3945_channel_power_info
{
struct
il3945_tx_power
tpc
;
/* actual radio and DSP gain settings */
s8
power_table_i
ndex
;
/* actual (compenst'd) inde
x into gain table */
s8
base_power_i
ndex
;
/* gain inde
x for power at factory temp. */
s8
power_table_i
dx
;
/* actual (compenst'd) id
x into gain table */
s8
base_power_i
dx
;
/* gain id
x for power at factory temp. */
s8
requested_power
;
/* power (dBm) requested for this chnl/rate */
};
...
...
@@ -211,7 +211,7 @@ struct il3945_channel_power_info {
* channel. */
struct
il3945_scan_power_info
{
struct
il3945_tx_power
tpc
;
/* actual radio and DSP gain settings */
s8
power_table_i
ndex
;
/* actual (compenst'd) inde
x into gain table */
s8
power_table_i
dx
;
/* actual (compenst'd) id
x into gain table */
s8
requested_power
;
/* scan pwr (dBm) requested for chnl/rate */
};
...
...
@@ -234,8 +234,8 @@ struct il_channel_info {
s8
min_power
;
/* always 0 */
s8
scan_power
;
/* (dBm) regul. eeprom, direct scans, any rate */
u8
group_i
nde
x
;
/* 0-4, maps channel to group1/2/3/4/5 */
u8
band_i
nde
x
;
/* 0-4, maps channel to band1/2/3/4/5 */
u8
group_i
d
x
;
/* 0-4, maps channel to group1/2/3/4/5 */
u8
band_i
d
x
;
/* 0-4, maps channel to band1/2/3/4/5 */
enum
ieee80211_band
band
;
/* HT40 channel info */
...
...
@@ -245,7 +245,7 @@ struct il_channel_info {
/* Radio/DSP gain settings for each "normal" data Tx rate.
* These include, in addition to RF and DSP gain, a few fields for
* remembering/modifying gain settings (i
nde
xes). */
* remembering/modifying gain settings (i
d
xes). */
struct
il3945_channel_power_info
power_info
[
IL4965_MAX_RATE
];
/* Radio/DSP gain settings for each scan rate, for directed scans. */
...
...
@@ -337,12 +337,12 @@ struct il_host_cmd {
* struct il_rx_queue - Rx queue
* @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
* @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
* @read: Shared i
nde
x to newest available Rx buffer
* @write: Shared i
nde
x to oldest written Rx packet
* @read: Shared i
d
x to newest available Rx buffer
* @write: Shared i
d
x to oldest written Rx packet
* @free_count: Number of pre-allocated buffers in rx_free
* @rx_free: list of free SKBs for use
* @rx_used: List of Rx buffers with no SKB
* @need_update: flag to indicate we need to update read/write i
nde
x
* @need_update: flag to indicate we need to update read/write i
d
x
* @rb_stts: driver's pointer to receive buffer status
* @rb_stts_dma: bus address of receive buffer status
*
...
...
@@ -636,7 +636,7 @@ static inline int il_queue_used(const struct il_queue *q, int i)
}
static
inline
u8
il_get_cmd_i
ndex
(
struct
il_queue
*
q
,
u32
inde
x
,
static
inline
u8
il_get_cmd_i
dx
(
struct
il_queue
*
q
,
u32
id
x
,
int
is_huge
)
{
/*
...
...
@@ -648,7 +648,7 @@ static inline u8 il_get_cmd_index(struct il_queue *q, u32 index,
return
q
->
n_win
;
/* must be power of 2 */
/* Otherwise, use normal size buffers */
return
i
nde
x
&
(
q
->
n_win
-
1
);
return
i
d
x
&
(
q
->
n_win
-
1
);
}
...
...
@@ -987,7 +987,7 @@ struct il_priv {
struct
il_force_reset
force_reset
;
/* we allocate array of il_channel_info for NIC's valid channels.
* Access via channel # using indirect i
nde
x array */
* Access via channel # using indirect i
d
x array */
struct
il_channel_info
*
channel_info
;
/* channel info array */
u8
channel_count
;
/* # of channels */
...
...
@@ -1033,7 +1033,7 @@ struct il_priv {
struct
mac_address
addresses
[
1
];
/* uCode images, save to reload in case of failure */
int
fw_i
nde
x
;
/* firmware we're trying to load */
int
fw_i
d
x
;
/* firmware we're trying to load */
u32
ucode_ver
;
/* version of ucode, copy of
il_ucode.ver */
struct
fw_desc
ucode_code
;
/* runtime inst */
...
...
drivers/net/wireless/iwlegacy/iwl-eeprom.c
View file @
0c2c8852
...
...
@@ -89,7 +89,7 @@
* During init, we copy the eeprom information and channel map
* information into il->channel_info_24/52 and il->channel_map_24/52
*
* channel_map_24/52 provides the i
nde
x in the channel_info array for a
* channel_map_24/52 provides the i
d
x in the channel_info array for a
* given channel. We have to have two separate maps as there is channel
* overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and
* band_2
...
...
@@ -267,7 +267,7 @@ EXPORT_SYMBOL(il_eeprom_free);
static
void
il_init_band_reference
(
const
struct
il_priv
*
il
,
int
eep_band
,
int
*
eeprom_ch_count
,
const
struct
il_eeprom_channel
**
eeprom_ch_info
,
const
u8
**
eeprom_ch_i
nde
x
)
const
u8
**
eeprom_ch_i
d
x
)
{
u32
offset
=
il
->
cfg
->
ops
->
lib
->
eeprom_ops
.
regulatory_bands
[
eep_band
-
1
];
...
...
@@ -276,43 +276,43 @@ static void il_init_band_reference(const struct il_priv *il,
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_1
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_1
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_1
;
break
;
case
2
:
/* 4.9GHz band */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_2
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_2
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_2
;
break
;
case
3
:
/* 5.2GHz band */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_3
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_3
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_3
;
break
;
case
4
:
/* 5.5GHz band */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_4
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_4
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_4
;
break
;
case
5
:
/* 5.7GHz band */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_5
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_5
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_5
;
break
;
case
6
:
/* 2.4GHz ht40 channels */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_6
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_6
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_6
;
break
;
case
7
:
/* 5 GHz ht40 channels */
*
eeprom_ch_count
=
ARRAY_SIZE
(
il_eeprom_band_7
);
*
eeprom_ch_info
=
(
struct
il_eeprom_channel
*
)
il_eeprom_query_addr
(
il
,
offset
);
*
eeprom_ch_i
nde
x
=
il_eeprom_band_7
;
*
eeprom_ch_i
d
x
=
il_eeprom_band_7
;
break
;
default:
BUG
();
...
...
@@ -374,7 +374,7 @@ static int il_mod_ht40_chan_info(struct il_priv *il,
int
il_init_channel_map
(
struct
il_priv
*
il
)
{
int
eeprom_ch_count
=
0
;
const
u8
*
eeprom_ch_i
nde
x
=
NULL
;
const
u8
*
eeprom_ch_i
d
x
=
NULL
;
const
struct
il_eeprom_channel
*
eeprom_ch_info
=
NULL
;
int
band
,
ch
;
struct
il_channel_info
*
ch_info
;
...
...
@@ -412,11 +412,11 @@ int il_init_channel_map(struct il_priv *il)
for
(
band
=
1
;
band
<=
5
;
band
++
)
{
il_init_band_reference
(
il
,
band
,
&
eeprom_ch_count
,
&
eeprom_ch_info
,
&
eeprom_ch_i
nde
x
);
&
eeprom_ch_info
,
&
eeprom_ch_i
d
x
);
/* Loop through each band adding each of the channels */
for
(
ch
=
0
;
ch
<
eeprom_ch_count
;
ch
++
)
{
ch_info
->
channel
=
eeprom_ch_i
nde
x
[
ch
];
ch_info
->
channel
=
eeprom_ch_i
d
x
[
ch
];
ch_info
->
band
=
(
band
==
1
)
?
IEEE80211_BAND_2GHZ
:
IEEE80211_BAND_5GHZ
;
...
...
@@ -486,7 +486,7 @@ int il_init_channel_map(struct il_priv *il)
enum
ieee80211_band
ieeeband
;
il_init_band_reference
(
il
,
band
,
&
eeprom_ch_count
,
&
eeprom_ch_info
,
&
eeprom_ch_i
nde
x
);
&
eeprom_ch_info
,
&
eeprom_ch_i
d
x
);
/* EEPROM band 6 is 2.4, band 7 is 5 GHz */
ieeeband
=
...
...
@@ -496,13 +496,13 @@ int il_init_channel_map(struct il_priv *il)
for
(
ch
=
0
;
ch
<
eeprom_ch_count
;
ch
++
)
{
/* Set up driver's info for lower half */
il_mod_ht40_chan_info
(
il
,
ieeeband
,
eeprom_ch_i
nde
x
[
ch
],
eeprom_ch_i
d
x
[
ch
],
&
eeprom_ch_info
[
ch
],
IEEE80211_CHAN_NO_HT40PLUS
);
/* Set up driver's info for upper half */
il_mod_ht40_chan_info
(
il
,
ieeeband
,
eeprom_ch_i
nde
x
[
ch
]
+
4
,
eeprom_ch_i
d
x
[
ch
]
+
4
,
&
eeprom_ch_info
[
ch
],
IEEE80211_CHAN_NO_HT40MINUS
);
}
...
...
drivers/net/wireless/iwlegacy/iwl-eeprom.h
View file @
0c2c8852
...
...
@@ -153,7 +153,7 @@ extern const u8 il_eeprom_band_1[14];
*
* 1) Temperature (degrees Celsius) of device when measurement was made.
*
* 2) Gain table i
nde
x used to achieve the target measurement power.
* 2) Gain table i
d
x used to achieve the target measurement power.
* This refers to the "well-known" gain tables (see iwl-4965-hw.h).
*
* 3) Actual measured output power, in half-dBm ("34" = 17 dBm).
...
...
drivers/net/wireless/iwlegacy/iwl-fh.h
View file @
0c2c8852
...
...
@@ -141,7 +141,7 @@
* into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0].
*
* 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers
* (RBs) have been filled, via a "write pointer", actually the i
nde
x of
* (RBs) have been filled, via a "write pointer", actually the i
d
x of
* the RB's corresponding RBD within the circular buffer. Driver sets
* physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
*
...
...
@@ -153,33 +153,33 @@
*
* As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must
* enter pointers to these RBs into contiguous RBD circular buffer entries,
* and update the 4965's "write" i
nde
x register,
* and update the 4965's "write" i
d
x register,
* FH_RSCSR_CHNL0_RBDCB_WPTR_REG.
*
* This "write" i
nde
x corresponds to the *next* RBD that the driver will make
* This "write" i
d
x corresponds to the *next* RBD that the driver will make
* available, i.e. one RBD past the tail of the ready-to-fill RBDs within
* the circular buffer. This value should initially be 0 (before preparing any
* RBs), should be 8 after preparing the first 8 RBs (for example), and must
* wrap back to 0 at the end of the circular buffer (but don't wrap before
* "read" i
nde
x has advanced past 1! See below).
* "read" i
d
x has advanced past 1! See below).
* NOTE: 4965 EXPECTS THE WRITE IDX TO BE INCREMENTED IN MULTIPLES OF 8.
*
* As the 4965 fills RBs (referenced from contiguous RBDs within the circular
* buffer), it updates the Rx status buffer in host DRAM, 2) described above,
* to tell the driver the i
nde
x of the latest filled RBD. The driver must
* read this "read" i
nde
x from DRAM after receiving an Rx interrupt from 4965.
* to tell the driver the i
d
x of the latest filled RBD. The driver must
* read this "read" i
d
x from DRAM after receiving an Rx interrupt from 4965.
*
* The driver must also internally keep track of a third i
nde
x, which is the
* The driver must also internally keep track of a third i
d
x, which is the
* next RBD to process. When receiving an Rx interrupt, driver should process
* all filled but unprocessed RBs up to, but not including, the RB
* corresponding to the "read" i
ndex. For example, if "read" inde
x becomes "1",
* corresponding to the "read" i
dx. For example, if "read" id
x becomes "1",
* driver may process the RB pointed to by RBD 0. Depending on volume of
* traffic, there may be many RBs to process.
*
* If read i
ndex == write inde
x, 4965 thinks there is no room to put new data.
* If read i
dx == write id
x, 4965 thinks there is no room to put new data.
* Due to this, the maximum number of filled RBs is 255, instead of 256. To
* be safe, make sure that there is a gap of at least 2 RBDs between "write"
* and "read" i
nde
xes; that is, make sure that there are no more than 254
* and "read" i
d
xes; that is, make sure that there are no more than 254
* buffers waiting to be filled.
*/
#define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0)
...
...
@@ -201,7 +201,7 @@
#define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004)
/**
* Rx write pointer (i
nde
x, really!).
* Rx write pointer (i
d
x, really!).
* Bit fields:
* 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1.
* NOTE: For 256-entry circular buffer, use only bits [7:0].
...
...
@@ -431,11 +431,11 @@
/**
* struct il_rb_status - reseve buffer status
* host memory mapped FH registers
* @closed_rb_num [0:11] - Indicates the i
nde
x of the RB which was closed
* @closed_fr_num [0:11] - Indicates the i
nde
x of the RX Frame which was closed
* @finished_rb_num [0:11] - Indicates the i
nde
x of the current RB
* @closed_rb_num [0:11] - Indicates the i
d
x of the RB which was closed
* @closed_fr_num [0:11] - Indicates the i
d
x of the RX Frame which was closed
* @finished_rb_num [0:11] - Indicates the i
d
x of the current RB
* in which the last frame was written to
* @finished_fr_num [0:11] - Indicates the i
nde
x of the RX Frame
* @finished_fr_num [0:11] - Indicates the i
d
x of the RX Frame
* which was transferred
*/
struct
il_rb_status
{
...
...
drivers/net/wireless/iwlegacy/iwl-helpers.h
View file @
0c2c8852
...
...
@@ -45,23 +45,23 @@ static inline struct ieee80211_conf *il_ieee80211_get_hw_conf(
}
/**
* il_queue_inc_wrap - increment queue i
nde
x, wrap back to beginning
* @i
ndex -- current inde
x
* il_queue_inc_wrap - increment queue i
d
x, wrap back to beginning
* @i
dx -- current id
x
* @n_bd -- total number of entries in queue (must be power of 2)
*/
static
inline
int
il_queue_inc_wrap
(
int
i
nde
x
,
int
n_bd
)
static
inline
int
il_queue_inc_wrap
(
int
i
d
x
,
int
n_bd
)
{
return
++
i
nde
x
&
(
n_bd
-
1
);
return
++
i
d
x
&
(
n_bd
-
1
);
}
/**
* il_queue_dec_wrap - decrement queue i
nde
x, wrap back to end
* @i
ndex -- current inde
x
* il_queue_dec_wrap - decrement queue i
d
x, wrap back to end
* @i
dx -- current id
x
* @n_bd -- total number of entries in queue (must be power of 2)
*/
static
inline
int
il_queue_dec_wrap
(
int
i
nde
x
,
int
n_bd
)
static
inline
int
il_queue_dec_wrap
(
int
i
d
x
,
int
n_bd
)
{
return
--
i
nde
x
&
(
n_bd
-
1
);
return
--
i
d
x
&
(
n_bd
-
1
);
}
/* TODO: Move fw_desc functions to iwl-pci.ko */
...
...
drivers/net/wireless/iwlegacy/iwl-led.c
View file @
0c2c8852
...
...
@@ -41,7 +41,7 @@
#include "iwl-core.h"
#include "iwl-io.h"
/* default: IL_LED_BLINK(0) using blinking i
nde
x table */
/* default: IL_LED_BLINK(0) using blinking i
d
x table */
static
int
led_mode
;
module_param
(
led_mode
,
int
,
S_IRUGO
);
MODULE_PARM_DESC
(
led_mode
,
"0=system default, "
...
...
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
View file @
0c2c8852
...
...
@@ -49,13 +49,13 @@ struct il3945_rate_info {
u8
next_rs
;
/* next rate used in rs algo */
u8
prev_rs_tgg
;
/* previous rate used in TGG rs algo */
u8
next_rs_tgg
;
/* next rate used in TGG rs algo */
u8
table_rs_i
ndex
;
/* inde
x in rate scale table cmd */
u8
table_rs_i
dx
;
/* id
x in rate scale table cmd */
u8
prev_table_rs
;
/* prev in rate table cmd */
};
/*
* These serve as i
nde
xes into
* These serve as i
d
xes into
* struct il_rate_info il_rates[RATE_COUNT];
*/
enum
{
...
...
@@ -351,7 +351,7 @@ struct il_traffic_load {
* Pointer to this gets passed back and forth between driver and mac80211.
*/
struct
il_lq_sta
{
u8
active_tbl
;
/* i
nde
x of active table, range 0-1 */
u8
active_tbl
;
/* i
d
x of active table, range 0-1 */
u8
enable_counter
;
/* indicates HT mode */
u8
stay_in_tbl
;
/* 1: disallow, 0: allow search for new mode */
u8
search_better_tbl
;
/* 1: currently trying alternate mode */
...
...
drivers/net/wireless/iwlegacy/iwl-prph.h
View file @
0c2c8852
...
...
@@ -336,7 +336,7 @@
/*
* Driver may need to update queue-empty bits after changing queue's
* write and read pointers (i
nde
xes) during (re-)initialization (i.e. when
* write and read pointers (i
d
xes) during (re-)initialization (i.e. when
* scheduler is not tracking what's happening).
* Bit fields:
* 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit
...
...
@@ -351,7 +351,7 @@
* This register points to BC CB for queue 0, must be on 1024-byte boundary.
* Others are spaced by 1024 bytes.
* Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad.
* (Index into a queue's BC CB) = (i
nde
x into queue's TFD CB) = (SSN & 0xff).
* (Index into a queue's BC CB) = (i
d
x into queue's TFD CB) = (SSN & 0xff).
* Bit fields:
* 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned.
*/
...
...
@@ -366,18 +366,18 @@
*/
#define IL49_SCD_TXFACT (IL49_SCD_START_OFFSET + 0x1c)
/*
* Queue (x) Write Pointers (i
nde
xes, really!), one for each Tx queue.
* Queue (x) Write Pointers (i
d
xes, really!), one for each Tx queue.
* Initialized and updated by driver as new TFDs are added to queue.
* NOTE: If using Block Ack, i
nde
x must correspond to frame's
* Start Sequence Number; i
nde
x = (SSN & 0xff)
* NOTE: If using Block Ack, i
d
x must correspond to frame's
* Start Sequence Number; i
d
x = (SSN & 0xff)
* NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses?
*/
#define IL49_SCD_QUEUE_WRPTR(x) (IL49_SCD_START_OFFSET + 0x24 + (x) * 4)
/*
* Queue (x) Read Pointers (i
nde
xes, really!), one for each Tx queue.
* For FIFO mode, i
nde
x indicates next frame to transmit.
* For Scheduler-ACK mode, i
nde
x indicates first frame in Tx win.
* Queue (x) Read Pointers (i
d
xes, really!), one for each Tx queue.
* For FIFO mode, i
d
x indicates next frame to transmit.
* For Scheduler-ACK mode, i
d
x indicates first frame in Tx win.
* Initialized by driver, updated by scheduler.
*/
#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4)
...
...
@@ -395,7 +395,7 @@
/*
* Select which queues interrupt driver when scheduler increments
* a queue's read pointer (i
nde
x).
* a queue's read pointer (i
d
x).
* Bit fields:
* 31-16: Reserved
* 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled
...
...
drivers/net/wireless/iwlegacy/iwl-rx.c
View file @
0c2c8852
...
...
@@ -45,17 +45,17 @@
* each of which point to Receive Buffers to be filled by the NIC. These get
* used not only for Rx frames, but for any command response or notification
* from the NIC. The driver and NIC manage the Rx buffers by means
* of i
nde
xes into the circular buffer.
* of i
d
xes into the circular buffer.
*
* Rx Queue Indexes
* The host/firmware share two i
nde
x registers for managing the Rx buffers.
* The host/firmware share two i
d
x registers for managing the Rx buffers.
*
* The READ i
nde
x maps to the first position that the firmware may be writing
* The READ i
d
x maps to the first position that the firmware may be writing
* to -- the driver can read up to (but not including) this position and get
* good data.
* The READ i
nde
x is managed by the firmware once the card is enabled.
* The READ i
d
x is managed by the firmware once the card is enabled.
*
* The WRITE i
nde
x maps to the last position the driver has read from -- the
* The WRITE i
d
x maps to the last position the driver has read from -- the
* position preceding WRITE is the last slot the firmware can place a packet.
*
* The queue is empty (no good data) if WRITE = READ - 1, and is full if
...
...
@@ -64,9 +64,9 @@
* During initialization, the host sets up the READ queue position to the first
* IDX position, and WRITE to the last (READ - 1 wrapped)
*
* When the firmware places a packet in a buffer, it will advance the READ i
nde
x
* and fire the RX interrupt. The driver can then query the READ i
nde
x and
* process as many packets as possible, moving the WRITE i
nde
x forward as it
* When the firmware places a packet in a buffer, it will advance the READ i
d
x
* and fire the RX interrupt. The driver can then query the READ i
d
x and
* process as many packets as possible, moving the WRITE i
d
x forward as it
* resets the Rx queue buffers with new memory.
*
* The management in the driver is as follows:
...
...
@@ -75,9 +75,9 @@
* to replenish the iwl->rxq->rx_free.
* + In il_rx_replenish (scheduled) if 'processed' != 'read' then the
* iwl->rxq is replenished and the READ IDX is updated (updating the
* 'processed' and 'read' driver i
nde
xes as well)
* 'processed' and 'read' driver i
d
xes as well)
* + A received packet is processed and handed to the kernel network stack,
* detached from the iwl->rxq. The driver 'processed' i
nde
x is updated.
* detached from the iwl->rxq. The driver 'processed' i
d
x is updated.
* + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
* list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
* IDX is not incremented and iwl->status(RX_STALLED) is set. If there
...
...
@@ -91,7 +91,7 @@
* il_rx_queue_restock
* il_rx_queue_restock() Moves available buffers from rx_free into Rx
* queue, updates firmware pointers, and updates
* the WRITE i
nde
x. If insufficient rx_free buffers
* the WRITE i
d
x. If insufficient rx_free buffers
* are available, schedules il_rx_replenish
*
* -- enable interrupts --
...
...
drivers/net/wireless/iwlegacy/iwl-sta.c
View file @
0c2c8852
...
...
@@ -174,7 +174,7 @@ int il_send_add_sta(struct il_priv *il,
}
EXPORT_SYMBOL
(
il_send_add_sta
);
static
void
il_set_ht_add_station
(
struct
il_priv
*
il
,
u8
i
nde
x
,
static
void
il_set_ht_add_station
(
struct
il_priv
*
il
,
u8
i
d
x
,
struct
ieee80211_sta
*
sta
,
struct
il_rxon_context
*
ctx
)
{
...
...
@@ -192,7 +192,7 @@ static void il_set_ht_add_station(struct il_priv *il, u8 index,
(
mimo_ps_mode
==
WLAN_HT_CAP_SM_PS_DYNAMIC
)
?
"dynamic"
:
"disabled"
);
sta_flags
=
il
->
stations
[
i
nde
x
].
sta
.
station_flags
;
sta_flags
=
il
->
stations
[
i
d
x
].
sta
.
station_flags
;
sta_flags
&=
~
(
STA_FLG_RTS_MIMO_PROT_MSK
|
STA_FLG_MIMO_DIS_MSK
);
...
...
@@ -221,7 +221,7 @@ static void il_set_ht_add_station(struct il_priv *il, u8 index,
else
sta_flags
&=
~
STA_FLG_HT40_EN_MSK
;
il
->
stations
[
i
nde
x
].
sta
.
station_flags
=
sta_flags
;
il
->
stations
[
i
d
x
].
sta
.
station_flags
=
sta_flags
;
done:
return
;
}
...
...
@@ -649,7 +649,7 @@ il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
}
EXPORT_SYMBOL
(
il_restore_stations
);
int
il_get_free_ucode_key_i
nde
x
(
struct
il_priv
*
il
)
int
il_get_free_ucode_key_i
d
x
(
struct
il_priv
*
il
)
{
int
i
;
...
...
@@ -659,7 +659,7 @@ int il_get_free_ucode_key_index(struct il_priv *il)
return
WEP_INVALID_OFFSET
;
}
EXPORT_SYMBOL
(
il_get_free_ucode_key_i
nde
x
);
EXPORT_SYMBOL
(
il_get_free_ucode_key_i
d
x
);
void
il_dealloc_bcast_stations
(
struct
il_priv
*
il
)
{
...
...
@@ -692,7 +692,7 @@ static void il_dump_lq_cmd(struct il_priv *il,
lq
->
general_params
.
dual_stream_ant_msk
);
for
(
i
=
0
;
i
<
LINK_QUAL_MAX_RETRY_NUM
;
i
++
)
D_RATE
(
"lq i
nde
x %d 0x%X
\n
"
,
D_RATE
(
"lq i
d
x %d 0x%X
\n
"
,
i
,
lq
->
rs_table
[
i
].
rate_n_flags
);
}
#else
...
...
@@ -728,7 +728,7 @@ static bool il_is_lq_table_valid(struct il_priv *il,
if
(
le32_to_cpu
(
lq
->
rs_table
[
i
].
rate_n_flags
)
&
RATE_MCS_HT_MSK
)
{
D_INFO
(
"i
nde
x %d of LQ expects HT channel
\n
"
,
"i
d
x %d of LQ expects HT channel
\n
"
,
i
);
return
false
;
}
...
...
drivers/net/wireless/iwlegacy/iwl-sta.h
View file @
0c2c8852
...
...
@@ -48,7 +48,7 @@ void il_restore_stations(struct il_priv *il,
void
il_clear_ucode_stations
(
struct
il_priv
*
il
,
struct
il_rxon_context
*
ctx
);
void
il_dealloc_bcast_stations
(
struct
il_priv
*
il
);
int
il_get_free_ucode_key_i
nde
x
(
struct
il_priv
*
il
);
int
il_get_free_ucode_key_i
d
x
(
struct
il_priv
*
il
);
int
il_send_add_sta
(
struct
il_priv
*
il
,
struct
il_addsta_cmd
*
sta
,
u8
flags
);
int
il_add_station_common
(
struct
il_priv
*
il
,
...
...
drivers/net/wireless/iwlegacy/iwl-tx.c
View file @
0c2c8852
...
...
@@ -39,7 +39,7 @@
#include "iwl-helpers.h"
/**
* il_txq_update_write_ptr - Send new write i
nde
x to hardware
* il_txq_update_write_ptr - Send new write i
d
x to hardware
*/
void
il_txq_update_write_ptr
(
struct
il_priv
*
il
,
struct
il_tx_queue
*
txq
)
...
...
@@ -152,7 +152,7 @@ void il_cmd_queue_unmap(struct il_priv *il)
return
;
while
(
q
->
read_ptr
!=
q
->
write_ptr
)
{
i
=
il_get_cmd_i
nde
x
(
q
,
q
->
read_ptr
,
0
);
i
=
il_get_cmd_i
d
x
(
q
,
q
->
read_ptr
,
0
);
if
(
txq
->
meta
[
i
].
flags
&
CMD_MAPPED
)
{
pci_unmap_single
(
il
->
pci_dev
,
...
...
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(il_queue_space);
/**
* il_queue_init - Initialize queue's high/low-water and read/write i
nde
xes
* il_queue_init - Initialize queue's high/low-water and read/write i
d
xes
*/
static
int
il_queue_init
(
struct
il_priv
*
il
,
struct
il_queue
*
q
,
int
count
,
int
slots_num
,
u32
id
)
...
...
@@ -268,7 +268,7 @@ static int il_queue_init(struct il_priv *il, struct il_queue *q,
BUG_ON
(
!
is_power_of_2
(
count
));
/* slots_num must be power-of-two size, otherwise
* il_get_cmd_i
nde
x is broken. */
* il_get_cmd_i
d
x is broken. */
BUG_ON
(
!
is_power_of_2
(
slots_num
));
q
->
low_mark
=
q
->
n_win
/
4
;
...
...
@@ -385,7 +385,7 @@ int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq,
* il_queue_inc_wrap and il_queue_dec_wrap are broken. */
BUILD_BUG_ON
(
TFD_QUEUE_SIZE_MAX
&
(
TFD_QUEUE_SIZE_MAX
-
1
));
/* Initialize queue's high/low-water marks, and head/tail i
nde
xes */
/* Initialize queue's high/low-water marks, and head/tail i
d
xes */
il_queue_init
(
il
,
&
txq
->
q
,
TFD_QUEUE_SIZE_MAX
,
slots_num
,
txq_id
);
...
...
@@ -416,7 +416,7 @@ void il_tx_queue_reset(struct il_priv *il, struct il_tx_queue *txq,
txq
->
need_update
=
0
;
/* Initialize queue's high/low-water marks, and head/tail i
nde
xes */
/* Initialize queue's high/low-water marks, and head/tail i
d
xes */
il_queue_init
(
il
,
&
txq
->
q
,
TFD_QUEUE_SIZE_MAX
,
slots_num
,
txq_id
);
...
...
@@ -433,7 +433,7 @@ EXPORT_SYMBOL(il_tx_queue_reset);
* @cmd: a point to the ucode command structure
*
* The function returns < 0 values to indicate the operation is
* failed. On success, it turns the i
nde
x (> 0) of command in the
* failed. On success, it turns the i
d
x (> 0) of command in the
* command queue.
*/
int
il_enqueue_hcmd
(
struct
il_priv
*
il
,
struct
il_host_cmd
*
cmd
)
...
...
@@ -476,7 +476,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
return
-
ENOSPC
;
}
idx
=
il_get_cmd_i
nde
x
(
q
,
q
->
write_ptr
,
cmd
->
flags
&
CMD_SIZE_HUGE
);
idx
=
il_get_cmd_i
d
x
(
q
,
q
->
write_ptr
,
cmd
->
flags
&
CMD_SIZE_HUGE
);
out_cmd
=
txq
->
cmd
[
idx
];
out_meta
=
&
txq
->
meta
[
idx
];
...
...
@@ -543,7 +543,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
phys_addr
,
fix_size
,
1
,
U32_PAD
(
cmd
->
len
));
/* Increment and update queue's write i
nde
x */
/* Increment and update queue's write i
d
x */
q
->
write_ptr
=
il_queue_inc_wrap
(
q
->
write_ptr
,
q
->
n_bd
);
il_txq_update_write_ptr
(
il
,
txq
);
...
...
@@ -554,7 +554,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
/**
* il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd
*
* When FW advances 'R' i
ndex, all entries between old and new 'R' inde
x
* When FW advances 'R' i
dx, all entries between old and new 'R' id
x
* need to be reclaimed. As result, some free space forms. If there is
* enough free space (> low mark), wake the stack that feeds us.
*/
...
...
@@ -566,7 +566,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
int
nfreed
=
0
;
if
(
idx
>=
q
->
n_bd
||
il_queue_used
(
q
,
idx
)
==
0
)
{
IL_ERR
(
"Read i
ndex for DMA queue txq id (%d), inde
x %d, "
IL_ERR
(
"Read i
dx for DMA queue txq id (%d), id
x %d, "
"is out of range [0-%d] %d %d.
\n
"
,
txq_id
,
idx
,
q
->
n_bd
,
q
->
write_ptr
,
q
->
read_ptr
);
return
;
...
...
@@ -576,7 +576,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
q
->
read_ptr
=
il_queue_inc_wrap
(
q
->
read_ptr
,
q
->
n_bd
))
{
if
(
nfreed
++
>
0
)
{
IL_ERR
(
"HCMD skipped: i
nde
x (%d) %d %d
\n
"
,
idx
,
IL_ERR
(
"HCMD skipped: i
d
x (%d) %d %d
\n
"
,
idx
,
q
->
write_ptr
,
q
->
read_ptr
);
queue_work
(
il
->
workqueue
,
&
il
->
restart
);
}
...
...
@@ -598,8 +598,8 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
struct
il_rx_pkt
*
pkt
=
rxb_addr
(
rxb
);
u16
sequence
=
le16_to_cpu
(
pkt
->
hdr
.
sequence
);
int
txq_id
=
SEQ_TO_QUEUE
(
sequence
);
int
i
nde
x
=
SEQ_TO_IDX
(
sequence
);
int
cmd_i
nde
x
;
int
i
d
x
=
SEQ_TO_IDX
(
sequence
);
int
cmd_i
d
x
;
bool
huge
=
!!
(
pkt
->
hdr
.
sequence
&
SEQ_HUGE_FRAME
);
struct
il_device_cmd
*
cmd
;
struct
il_cmd_meta
*
meta
;
...
...
@@ -618,9 +618,9 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
return
;
}
cmd_i
ndex
=
il_get_cmd_index
(
&
txq
->
q
,
inde
x
,
huge
);
cmd
=
txq
->
cmd
[
cmd_i
nde
x
];
meta
=
&
txq
->
meta
[
cmd_i
nde
x
];
cmd_i
dx
=
il_get_cmd_idx
(
&
txq
->
q
,
id
x
,
huge
);
cmd
=
txq
->
cmd
[
cmd_i
d
x
];
meta
=
&
txq
->
meta
[
cmd_i
d
x
];
txq
->
time_stamp
=
jiffies
;
...
...
@@ -638,7 +638,7 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
spin_lock_irqsave
(
&
il
->
hcmd_lock
,
flags
);
il_hcmd_queue_reclaim
(
il
,
txq_id
,
i
ndex
,
cmd_inde
x
);
il_hcmd_queue_reclaim
(
il
,
txq_id
,
i
dx
,
cmd_id
x
);
if
(
!
(
meta
->
flags
&
CMD_ASYNC
))
{
clear_bit
(
STATUS_HCMD_ACTIVE
,
&
il
->
status
);
...
...
drivers/net/wireless/iwlegacy/iwl3945-base.c
View file @
0c2c8852
...
...
@@ -163,7 +163,7 @@ static int il3945_set_ccmp_dynamic_key_info(struct il_priv *il,
if
((
il
->
stations
[
sta_id
].
sta
.
key
.
key_flags
&
STA_KEY_FLG_ENCRYPT_MSK
)
==
STA_KEY_FLG_NO_ENC
)
il
->
stations
[
sta_id
].
sta
.
key
.
key_offset
=
il_get_free_ucode_key_i
nde
x
(
il
);
il_get_free_ucode_key_i
d
x
(
il
);
/* else, we are overriding an existing key => no need to allocated room
* in uCode. */
...
...
@@ -513,7 +513,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
hdr_len
=
ieee80211_hdrlen
(
fc
);
/* Find i
nde
x into station table for destination station */
/* Find i
d
x into station table for destination station */
sta_id
=
il_sta_id_or_broadcast
(
il
,
&
il
->
ctx
,
info
->
control
.
sta
);
...
...
@@ -541,7 +541,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
spin_lock_irqsave
(
&
il
->
lock
,
flags
);
idx
=
il_get_cmd_i
nde
x
(
q
,
q
->
write_ptr
,
0
);
idx
=
il_get_cmd_i
d
x
(
q
,
q
->
write_ptr
,
0
);
/* Set up driver data for this TFD */
memset
(
&
(
txq
->
txb
[
q
->
write_ptr
]),
0
,
sizeof
(
struct
il_tx_info
));
...
...
@@ -557,7 +557,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
/*
* Set up the Tx-command (not MAC!) header.
* Store the chosen Tx queue and TFD i
nde
x within the sequence field;
* Store the chosen Tx queue and TFD i
d
x within the sequence field;
* after Tx, uCode's Tx response will return this value so driver can
* locate the frame within the tx queue and do post-tx processing.
*/
...
...
@@ -641,7 +641,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
}
/* Tell device the write i
nde
x *just past* this latest filled TFD */
/* Tell device the write i
d
x *just past* this latest filled TFD */
q
->
write_ptr
=
il_queue_inc_wrap
(
q
->
write_ptr
,
q
->
n_bd
);
il_txq_update_write_ptr
(
il
,
txq
);
spin_unlock_irqrestore
(
&
il
->
lock
,
flags
);
...
...
@@ -889,14 +889,14 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* 0 to 31
*
* Rx Queue Indexes
* The host/firmware share two i
nde
x registers for managing the Rx buffers.
* The host/firmware share two i
d
x registers for managing the Rx buffers.
*
* The READ i
nde
x maps to the first position that the firmware may be writing
* The READ i
d
x maps to the first position that the firmware may be writing
* to -- the driver can read up to (but not including) this position and get
* good data.
* The READ i
nde
x is managed by the firmware once the card is enabled.
* The READ i
d
x is managed by the firmware once the card is enabled.
*
* The WRITE i
nde
x maps to the last position the driver has read from -- the
* The WRITE i
d
x maps to the last position the driver has read from -- the
* position preceding WRITE is the last slot the firmware can place a packet.
*
* The queue is empty (no good data) if WRITE = READ - 1, and is full if
...
...
@@ -905,9 +905,9 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* During initialization, the host sets up the READ queue position to the first
* IDX position, and WRITE to the last (READ - 1 wrapped)
*
* When the firmware places a packet in a buffer, it will advance the READ i
nde
x
* and fire the RX interrupt. The driver can then query the READ i
nde
x and
* process as many packets as possible, moving the WRITE i
nde
x forward as it
* When the firmware places a packet in a buffer, it will advance the READ i
d
x
* and fire the RX interrupt. The driver can then query the READ i
d
x and
* process as many packets as possible, moving the WRITE i
d
x forward as it
* resets the Rx queue buffers with new memory.
*
* The management in the driver is as follows:
...
...
@@ -916,9 +916,9 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* to replenish the iwl->rxq->rx_free.
* + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the
* iwl->rxq is replenished and the READ IDX is updated (updating the
* 'processed' and 'read' driver i
nde
xes as well)
* 'processed' and 'read' driver i
d
xes as well)
* + A received packet is processed and handed to the kernel network stack,
* detached from the iwl->rxq. The driver 'processed' i
nde
x is updated.
* detached from the iwl->rxq. The driver 'processed' i
d
x is updated.
* + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
* list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
* IDX is not incremented and iwl->status(RX_STALLED) is set. If there
...
...
@@ -931,7 +931,7 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
* il3945_rx_queue_restock
* il3945_rx_queue_restock() Moves available buffers from rx_free into Rx
* queue, updates firmware pointers, and updates
* the WRITE i
nde
x. If insufficient rx_free buffers
* the WRITE i
d
x. If insufficient rx_free buffers
* are available, schedules il3945_rx_replenish
*
* -- enable interrupts --
...
...
@@ -960,7 +960,7 @@ static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *il,
* and we have free pre-allocated buffers, fill the ranks as much
* as we can, pulling from rx_free.
*
* This moves the 'write' i
nde
x forward to catch up with 'processed', and
* This moves the 'write' i
d
x forward to catch up with 'processed', and
* also updates the memory address in the firmware to reference the new
* target buffer.
*/
...
...
@@ -1211,7 +1211,7 @@ static void il3945_rx_handle(struct il_priv *il)
u32
count
=
8
;
int
total_empty
=
0
;
/* uCode's read i
nde
x (stored in shared DRAM) indicates the last Rx
/* uCode's read i
d
x (stored in shared DRAM) indicates the last Rx
* buffer that the driver may process (last buffer filled by ucode). */
r
=
le16_to_cpu
(
rxq
->
rb_stts
->
closed_rb_num
)
&
0x0FFF
;
i
=
rxq
->
read
;
...
...
@@ -1656,7 +1656,7 @@ static void il3945_init_hw_rates(struct il_priv *il,
for
(
i
=
0
;
i
<
RATE_COUNT_LEGACY
;
i
++
)
{
rates
[
i
].
bitrate
=
il3945_rates
[
i
].
ieee
*
5
;
rates
[
i
].
hw_value
=
i
;
/* Rate scaling will work on i
nde
xes */
rates
[
i
].
hw_value
=
i
;
/* Rate scaling will work on i
d
xes */
rates
[
i
].
hw_value_short
=
i
;
rates
[
i
].
flags
=
0
;
if
(
i
>
IL39_LAST_OFDM_RATE
||
i
<
IL_FIRST_OFDM_RATE
)
{
...
...
@@ -1850,7 +1850,7 @@ IL3945_UCODE_GET(boot_size);
static
int
il3945_read_ucode
(
struct
il_priv
*
il
)
{
const
struct
il_ucode_header
*
ucode
;
int
ret
=
-
EINVAL
,
i
nde
x
;
int
ret
=
-
EINVAL
,
i
d
x
;
const
struct
firmware
*
ucode_raw
;
/* firmware file name contains uCode/driver compatibility version */
const
char
*
name_pre
=
il
->
cfg
->
fw_name_pre
;
...
...
@@ -1863,8 +1863,8 @@ static int il3945_read_ucode(struct il_priv *il)
/* Ask kernel firmware_class module to get the boot firmware off disk.
* request_firmware() is synchronous, file is in memory on return. */
for
(
i
ndex
=
api_max
;
index
>=
api_min
;
inde
x
--
)
{
sprintf
(
buf
,
"%s%u%s"
,
name_pre
,
i
nde
x
,
".ucode"
);
for
(
i
dx
=
api_max
;
idx
>=
api_min
;
id
x
--
)
{
sprintf
(
buf
,
"%s%u%s"
,
name_pre
,
i
d
x
,
".ucode"
);
ret
=
request_firmware
(
&
ucode_raw
,
buf
,
&
il
->
pci_dev
->
dev
);
if
(
ret
<
0
)
{
IL_ERR
(
"%s firmware file req failed: %d
\n
"
,
...
...
@@ -1874,7 +1874,7 @@ static int il3945_read_ucode(struct il_priv *il)
else
goto
error
;
}
else
{
if
(
i
nde
x
<
api_max
)
if
(
i
d
x
<
api_max
)
IL_ERR
(
"Loaded firmware %s, "
"which is deprecated. "
" Please use API v%u instead.
\n
"
,
...
...
drivers/net/wireless/iwlegacy/iwl4965-base.c
View file @
0c2c8852
...
...
@@ -173,7 +173,7 @@ static void il4965_set_beacon_tim(struct il_priv *il,
struct
ieee80211_mgmt
*
mgmt
=
(
struct
ieee80211_mgmt
*
)
beacon
;
/*
* The i
nde
x is relative to frame start but we start looking at the
* The i
d
x is relative to frame start but we start looking at the
* variable-length part of the beacon.
*/
tim_idx
=
mgmt
->
u
.
beacon
.
variable
-
beacon
;
...
...
@@ -318,7 +318,7 @@ static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd)
* @il - driver ilate data
* @txq - tx queue
*
* Does NOT advance any TFD circular buffer read/write i
nde
xes
* Does NOT advance any TFD circular buffer read/write i
d
xes
* Does NOT free the TFD itself (which is within circular buffer)
*/
void
il4965_hw_txq_free_tfd
(
struct
il_priv
*
il
,
struct
il_tx_queue
*
txq
)
...
...
@@ -326,11 +326,11 @@ void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
struct
il_tfd
*
tfd_tmp
=
(
struct
il_tfd
*
)
txq
->
tfds
;
struct
il_tfd
*
tfd
;
struct
pci_dev
*
dev
=
il
->
pci_dev
;
int
i
nde
x
=
txq
->
q
.
read_ptr
;
int
i
d
x
=
txq
->
q
.
read_ptr
;
int
i
;
int
num_tbs
;
tfd
=
&
tfd_tmp
[
i
nde
x
];
tfd
=
&
tfd_tmp
[
i
d
x
];
/* Sanity check on number of chunks */
num_tbs
=
il4965_tfd_get_num_tbs
(
tfd
);
...
...
@@ -344,8 +344,8 @@ void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
/* Unmap tx_cmd */
if
(
num_tbs
)
pci_unmap_single
(
dev
,
dma_unmap_addr
(
&
txq
->
meta
[
i
nde
x
],
mapping
),
dma_unmap_len
(
&
txq
->
meta
[
i
nde
x
],
len
),
dma_unmap_addr
(
&
txq
->
meta
[
i
d
x
],
mapping
),
dma_unmap_len
(
&
txq
->
meta
[
i
d
x
],
len
),
PCI_DMA_BIDIRECTIONAL
);
/* Unmap chunks, if any. */
...
...
@@ -643,7 +643,7 @@ void il4965_rx_handle(struct il_priv *il)
u32
count
=
8
;
int
total_empty
;
/* uCode's read i
nde
x (stored in shared DRAM) indicates the last Rx
/* uCode's read i
d
x (stored in shared DRAM) indicates the last Rx
* buffer that the driver may process (last buffer filled by ucode). */
r
=
le16_to_cpu
(
rxq
->
rb_stts
->
closed_rb_num
)
&
0x0FFF
;
i
=
rxq
->
read
;
...
...
@@ -1106,14 +1106,14 @@ static int __must_check il4965_request_firmware(struct il_priv *il, bool first)
char
tag
[
8
];
if
(
first
)
{
il
->
fw_i
nde
x
=
il
->
cfg
->
ucode_api_max
;
sprintf
(
tag
,
"%d"
,
il
->
fw_i
nde
x
);
il
->
fw_i
d
x
=
il
->
cfg
->
ucode_api_max
;
sprintf
(
tag
,
"%d"
,
il
->
fw_i
d
x
);
}
else
{
il
->
fw_i
nde
x
--
;
sprintf
(
tag
,
"%d"
,
il
->
fw_i
nde
x
);
il
->
fw_i
d
x
--
;
sprintf
(
tag
,
"%d"
,
il
->
fw_i
d
x
);
}
if
(
il
->
fw_i
nde
x
<
il
->
cfg
->
ucode_api_min
)
{
if
(
il
->
fw_i
d
x
<
il
->
cfg
->
ucode_api_min
)
{
IL_ERR
(
"no suitable firmware found!
\n
"
);
return
-
ENOENT
;
}
...
...
@@ -1213,7 +1213,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
memset
(
&
pieces
,
0
,
sizeof
(
pieces
));
if
(
!
ucode_raw
)
{
if
(
il
->
fw_i
nde
x
<=
il
->
cfg
->
ucode_api_max
)
if
(
il
->
fw_i
d
x
<=
il
->
cfg
->
ucode_api_max
)
IL_ERR
(
"request for firmware file '%s' failed.
\n
"
,
il
->
firmware_name
);
...
...
@@ -1655,7 +1655,7 @@ static int il4965_alive_notify(struct il_priv *il)
/* Initialize each Tx queue (including the command queue) */
for
(
i
=
0
;
i
<
il
->
hw_params
.
max_txq_num
;
i
++
)
{
/* TFD circular buffer read/write i
nde
xes */
/* TFD circular buffer read/write i
d
xes */
il_wr_prph
(
il
,
IL49_SCD_QUEUE_RDPTR
(
i
),
0
);
il_wr
(
il
,
HBUS_TARG_WRPTR
,
0
|
(
i
<<
8
));
...
...
@@ -2713,7 +2713,7 @@ static void il4965_init_hw_rates(struct il_priv *il,
for
(
i
=
0
;
i
<
RATE_COUNT_LEGACY
;
i
++
)
{
rates
[
i
].
bitrate
=
il_rates
[
i
].
ieee
*
5
;
rates
[
i
].
hw_value
=
i
;
/* Rate scaling will work on i
nde
xes */
rates
[
i
].
hw_value
=
i
;
/* Rate scaling will work on i
d
xes */
rates
[
i
].
hw_value_short
=
i
;
rates
[
i
].
flags
=
0
;
if
((
i
>=
IL_FIRST_CCK_RATE
)
&&
(
i
<=
IL_LAST_CCK_RATE
))
{
...
...
@@ -2729,11 +2729,11 @@ static void il4965_init_hw_rates(struct il_priv *il,
/*
* Acquire il->lock before calling this function !
*/
void
il4965_set_wr_ptrs
(
struct
il_priv
*
il
,
int
txq_id
,
u32
i
nde
x
)
void
il4965_set_wr_ptrs
(
struct
il_priv
*
il
,
int
txq_id
,
u32
i
d
x
)
{
il_wr
(
il
,
HBUS_TARG_WRPTR
,
(
i
nde
x
&
0xff
)
|
(
txq_id
<<
8
));
il_wr_prph
(
il
,
IL49_SCD_QUEUE_RDPTR
(
txq_id
),
i
nde
x
);
(
i
d
x
&
0xff
)
|
(
txq_id
<<
8
));
il_wr_prph
(
il
,
IL49_SCD_QUEUE_RDPTR
(
txq_id
),
i
d
x
);
}
void
il4965_tx_queue_set_status
(
struct
il_priv
*
il
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment