提交 e7392364 编写于 作者: S Stanislaw Gruszka

iwlegacy: indentions and whitespaces

Process iwlegacy source files using:

indent -npro -l500 -nhnl
indent -npro -kr -i8 -ts8 -sob -l80 -nbbo -ss -ncs -cp1 -il0 -psl

Plus manual compilation fixes.
Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
上级 f02579e3
...@@ -97,7 +97,8 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = { ...@@ -97,7 +97,8 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = {
#define RATE_DECREASE_TH 1920 #define RATE_DECREASE_TH 1920
#define RATE_RETRY_TH 15 #define RATE_RETRY_TH 15
static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) static u8
il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band)
{ {
u32 idx = 0; u32 idx = 0;
u32 table_size = 0; u32 table_size = 0;
...@@ -130,7 +131,8 @@ static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) ...@@ -130,7 +131,8 @@ static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band)
return tpt_table[idx].idx; return tpt_table[idx].idx;
} }
static void il3945_clear_win(struct il3945_rate_scale_data *win) static void
il3945_clear_win(struct il3945_rate_scale_data *win)
{ {
win->data = 0; win->data = 0;
win->success_counter = 0; win->success_counter = 0;
...@@ -147,7 +149,8 @@ static void il3945_clear_win(struct il3945_rate_scale_data *win) ...@@ -147,7 +149,8 @@ static void il3945_clear_win(struct il3945_rate_scale_data *win)
* not flushed. If there were any that were not flushed, then * not flushed. If there were any that were not flushed, then
* reschedule the rate flushing routine. * reschedule the rate flushing routine.
*/ */
static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) static int
il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
{ {
int unflushed = 0; int unflushed = 0;
int i; int i;
...@@ -164,11 +167,9 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) ...@@ -164,11 +167,9 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
continue; continue;
spin_lock_irqsave(&rs_sta->lock, flags); spin_lock_irqsave(&rs_sta->lock, flags);
if (time_after(jiffies, rs_sta->win[i].stamp + if (time_after(jiffies, rs_sta->win[i].stamp + RATE_WIN_FLUSH)) {
RATE_WIN_FLUSH)) { D_RATE("flushing %d samples of rate " "idx %d\n",
D_RATE("flushing %d samples of rate " rs_sta->win[i].counter, i);
"idx %d\n",
rs_sta->win[i].counter, i);
il3945_clear_win(&rs_sta->win[i]); il3945_clear_win(&rs_sta->win[i]);
} else } else
unflushed++; unflushed++;
...@@ -182,7 +183,8 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) ...@@ -182,7 +183,8 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
#define RATE_FLUSH_MIN 50 /* msec */ #define RATE_FLUSH_MIN 50 /* msec */
#define IL_AVERAGE_PACKETS 1500 #define IL_AVERAGE_PACKETS 1500
static void il3945_bg_rate_scale_flush(unsigned long data) static void
il3945_bg_rate_scale_flush(unsigned long data)
{ {
struct il3945_rs_sta *rs_sta = (void *)data; struct il3945_rs_sta *rs_sta = (void *)data;
struct il_priv *il __maybe_unused = rs_sta->il; struct il_priv *il __maybe_unused = rs_sta->il;
...@@ -205,8 +207,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) ...@@ -205,8 +207,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
duration = duration =
jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
D_RATE("Tx'd %d packets in %dms\n", D_RATE("Tx'd %d packets in %dms\n", packet_count, duration);
packet_count, duration);
/* Determine packets per second */ /* Determine packets per second */
if (duration) if (duration)
...@@ -225,11 +226,11 @@ static void il3945_bg_rate_scale_flush(unsigned long data) ...@@ -225,11 +226,11 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
rs_sta->flush_time = msecs_to_jiffies(duration); rs_sta->flush_time = msecs_to_jiffies(duration);
D_RATE("new flush period: %d msec ave %d\n", D_RATE("new flush period: %d msec ave %d\n", duration,
duration, packet_count); packet_count);
mod_timer(&rs_sta->rate_scale_flush, jiffies + mod_timer(&rs_sta->rate_scale_flush,
rs_sta->flush_time); jiffies + rs_sta->flush_time);
rs_sta->last_partial_flush = jiffies; rs_sta->last_partial_flush = jiffies;
} else { } else {
...@@ -253,9 +254,10 @@ static void il3945_bg_rate_scale_flush(unsigned long data) ...@@ -253,9 +254,10 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
* at this rate. win->data contains the bitmask of successful * at this rate. win->data contains the bitmask of successful
* packets. * packets.
*/ */
static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, static void
struct il3945_rate_scale_data *win, il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
int success, int retries, int idx) struct il3945_rate_scale_data *win, int success,
int retries, int idx)
{ {
unsigned long flags; unsigned long flags;
s32 fail_count; s32 fail_count;
...@@ -306,8 +308,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, ...@@ -306,8 +308,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
/* Calculate current success ratio, avoid divide-by-0! */ /* Calculate current success ratio, avoid divide-by-0! */
if (win->counter > 0) if (win->counter > 0)
win->success_ratio = 128 * (100 * win->success_counter) win->success_ratio =
/ win->counter; 128 * (100 * win->success_counter) / win->counter;
else else
win->success_ratio = IL_INVALID_VALUE; win->success_ratio = IL_INVALID_VALUE;
...@@ -316,8 +318,9 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, ...@@ -316,8 +318,9 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
/* Calculate average throughput, if we have enough history. */ /* Calculate average throughput, if we have enough history. */
if (fail_count >= RATE_MIN_FAILURE_TH || if (fail_count >= RATE_MIN_FAILURE_TH ||
win->success_counter >= RATE_MIN_SUCCESS_TH) win->success_counter >= RATE_MIN_SUCCESS_TH)
win->average_tpt = ((win->success_ratio * win->average_tpt =
rs_sta->expected_tpt[idx] + 64) / 128); ((win->success_ratio * rs_sta->expected_tpt[idx] +
64) / 128);
else else
win->average_tpt = IL_INVALID_VALUE; win->average_tpt = IL_INVALID_VALUE;
...@@ -331,7 +334,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, ...@@ -331,7 +334,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
/* /*
* Called after adding a new station to initialize rate scaling * Called after adding a new station to initialize rate scaling
*/ */
void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) void
il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
{ {
struct ieee80211_hw *hw = il->hw; struct ieee80211_hw *hw = il->hw;
struct ieee80211_conf *conf = &il->hw->conf; struct ieee80211_conf *conf = &il->hw->conf;
...@@ -344,7 +348,7 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i ...@@ -344,7 +348,7 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i
if (sta_id == il->ctx.bcast_sta_id) if (sta_id == il->ctx.bcast_sta_id)
goto out; goto out;
psta = (struct il3945_sta_priv *) sta->drv_priv; psta = (struct il3945_sta_priv *)sta->drv_priv;
rs_sta = &psta->rs_sta; rs_sta = &psta->rs_sta;
sband = hw->wiphy->bands[conf->channel->band]; sband = hw->wiphy->bands[conf->channel->band];
...@@ -382,8 +386,8 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i ...@@ -382,8 +386,8 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i
/* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */
if (sband->band == IEEE80211_BAND_5GHZ) { if (sband->band == IEEE80211_BAND_5GHZ) {
rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
il->_3945.sta_supp_rates = il->_3945.sta_supp_rates << il->_3945.sta_supp_rates =
IL_FIRST_OFDM_RATE; il->_3945.sta_supp_rates << IL_FIRST_OFDM_RATE;
} }
out: out:
...@@ -392,21 +396,24 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i ...@@ -392,21 +396,24 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i
D_INFO("leave\n"); D_INFO("leave\n");
} }
static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) static void *
il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
{ {
return hw->priv; return hw->priv;
} }
/* rate scale requires free function to be implemented */ /* rate scale requires free function to be implemented */
static void il3945_rs_free(void *il) static void
il3945_rs_free(void *il)
{ {
return; return;
} }
static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp) static void *
il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp)
{ {
struct il3945_rs_sta *rs_sta; struct il3945_rs_sta *rs_sta;
struct il3945_sta_priv *psta = (void *) sta->drv_priv; struct il3945_sta_priv *psta = (void *)sta->drv_priv;
struct il_priv *il __maybe_unused = il_priv; struct il_priv *il __maybe_unused = il_priv;
D_RATE("enter\n"); D_RATE("enter\n");
...@@ -421,8 +428,8 @@ static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t ...@@ -421,8 +428,8 @@ static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t
return rs_sta; return rs_sta;
} }
static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, static void
void *il_sta) il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, void *il_sta)
{ {
struct il3945_rs_sta *rs_sta = il_sta; struct il3945_rs_sta *rs_sta = il_sta;
...@@ -434,16 +441,16 @@ static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, ...@@ -434,16 +441,16 @@ static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
del_timer_sync(&rs_sta->rate_scale_flush); del_timer_sync(&rs_sta->rate_scale_flush);
} }
/** /**
* il3945_rs_tx_status - Update rate control values based on Tx results * il3945_rs_tx_status - Update rate control values based on Tx results
* *
* NOTE: Uses il_priv->retry_rate for the # of retries attempted by * NOTE: Uses il_priv->retry_rate for the # of retries attempted by
* the hardware for each rate. * the hardware for each rate.
*/ */
static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband, static void
struct ieee80211_sta *sta, void *il_sta, il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
struct sk_buff *skb) struct ieee80211_sta *sta, void *il_sta,
struct sk_buff *skb)
{ {
s8 retries = 0, current_count; s8 retries = 0, current_count;
int scale_rate_idx, first_idx, last_idx; int scale_rate_idx, first_idx, last_idx;
...@@ -476,7 +483,6 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * ...@@ -476,7 +483,6 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
return; return;
} }
rs_sta->tx_packets++; rs_sta->tx_packets++;
scale_rate_idx = first_idx; scale_rate_idx = first_idx;
...@@ -498,32 +504,27 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * ...@@ -498,32 +504,27 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
last_idx = scale_rate_idx; last_idx = scale_rate_idx;
} else { } else {
current_count = il->retry_rate; current_count = il->retry_rate;
last_idx = il3945_rs_next_rate(il, last_idx = il3945_rs_next_rate(il, scale_rate_idx);
scale_rate_idx);
} }
/* Update this rate accounting for as many retries /* Update this rate accounting for as many retries
* as was used for it (per current_count) */ * as was used for it (per current_count) */
il3945_collect_tx_data(rs_sta, il3945_collect_tx_data(rs_sta, &rs_sta->win[scale_rate_idx], 0,
&rs_sta->win[scale_rate_idx], current_count, scale_rate_idx);
0, current_count, scale_rate_idx); D_RATE("Update rate %d for %d retries.\n", scale_rate_idx,
D_RATE("Update rate %d for %d retries.\n", current_count);
scale_rate_idx, current_count);
retries -= current_count; retries -= current_count;
scale_rate_idx = last_idx; scale_rate_idx = last_idx;
} }
/* Update the last idx win with success/failure based on ACK */ /* Update the last idx win with success/failure based on ACK */
D_RATE("Update rate %d with %s.\n", D_RATE("Update rate %d with %s.\n", last_idx,
last_idx, (info->flags & IEEE80211_TX_STAT_ACK) ? "success" : "failure");
(info->flags & IEEE80211_TX_STAT_ACK) ? il3945_collect_tx_data(rs_sta, &rs_sta->win[last_idx],
"success" : "failure"); info->flags & IEEE80211_TX_STAT_ACK, 1,
il3945_collect_tx_data(rs_sta, last_idx);
&rs_sta->win[last_idx],
info->flags & IEEE80211_TX_STAT_ACK, 1, last_idx);
/* We updated the rate scale win -- if its been more than /* We updated the rate scale win -- if its been more than
* flush_time since the last run, schedule the flush * flush_time since the last run, schedule the flush
...@@ -531,8 +532,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * ...@@ -531,8 +532,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
spin_lock_irqsave(&rs_sta->lock, flags); spin_lock_irqsave(&rs_sta->lock, flags);
if (!rs_sta->flush_pending && if (!rs_sta->flush_pending &&
time_after(jiffies, rs_sta->last_flush + time_after(jiffies, rs_sta->last_flush + rs_sta->flush_time)) {
rs_sta->flush_time)) {
rs_sta->last_partial_flush = jiffies; rs_sta->last_partial_flush = jiffies;
rs_sta->flush_pending = 1; rs_sta->flush_pending = 1;
...@@ -545,8 +545,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * ...@@ -545,8 +545,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
D_RATE("leave\n"); D_RATE("leave\n");
} }
static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, static u16
u8 idx, u16 rate_mask, enum ieee80211_band band) il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 idx, u16 rate_mask,
enum ieee80211_band band)
{ {
u8 high = RATE_INVALID; u8 high = RATE_INVALID;
u8 low = RATE_INVALID; u8 low = RATE_INVALID;
...@@ -569,8 +570,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, ...@@ -569,8 +570,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
/* Find the next rate that is in the rate mask */ /* Find the next rate that is in the rate mask */
i = idx + 1; i = idx + 1;
for (mask = (1 << i); i < RATE_COUNT_3945; for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) {
i++, mask <<= 1) {
if (rate_mask & mask) { if (rate_mask & mask) {
high = i; high = i;
break; break;
...@@ -625,8 +625,9 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, ...@@ -625,8 +625,9 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
* rate table and must reference the driver allocated rate table * rate table and must reference the driver allocated rate table
* *
*/ */
static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, static void
void *il_sta, struct ieee80211_tx_rate_control *txrc) il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
struct ieee80211_tx_rate_control *txrc)
{ {
struct ieee80211_supported_band *sband = txrc->sband; struct ieee80211_supported_band *sband = txrc->sband;
struct sk_buff *skb = txrc->skb; struct sk_buff *skb = txrc->skb;
...@@ -679,7 +680,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -679,7 +680,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
*/ */
if (rs_sta->start_rate != RATE_INVALID) { if (rs_sta->start_rate != RATE_INVALID) {
if (rs_sta->start_rate < idx && if (rs_sta->start_rate < idx &&
(rate_mask & (1 << rs_sta->start_rate))) (rate_mask & (1 << rs_sta->start_rate)))
idx = rs_sta->start_rate; idx = rs_sta->start_rate;
rs_sta->start_rate = RATE_INVALID; rs_sta->start_rate = RATE_INVALID;
} }
...@@ -699,14 +700,12 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -699,14 +700,12 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
spin_unlock_irqrestore(&rs_sta->lock, flags); spin_unlock_irqrestore(&rs_sta->lock, flags);
D_RATE("Invalid average_tpt on rate %d: " D_RATE("Invalid average_tpt on rate %d: "
"counter: %d, success_counter: %d, " "counter: %d, success_counter: %d, "
"expected_tpt is %sNULL\n", "expected_tpt is %sNULL\n", idx, win->counter,
idx, win->success_counter,
win->counter, rs_sta->expected_tpt ? "not " : "");
win->success_counter,
rs_sta->expected_tpt ? "not " : ""); /* Can't calculate this yet; not enough history */
/* Can't calculate this yet; not enough history */
win->average_tpt = IL_INVALID_VALUE; win->average_tpt = IL_INVALID_VALUE;
goto out; goto out;
...@@ -714,8 +713,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -714,8 +713,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
current_tpt = win->average_tpt; current_tpt = win->average_tpt;
high_low = il3945_get_adjacent_rate(rs_sta, idx, rate_mask, high_low =
sband->band); il3945_get_adjacent_rate(rs_sta, idx, rate_mask, sband->band);
low = high_low & 0xff; low = high_low & 0xff;
high = (high_low >> 8) & 0xff; high = (high_low >> 8) & 0xff;
...@@ -738,46 +737,42 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -738,46 +737,42 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) { if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) {
D_RATE("decrease rate because of low success_ratio\n"); D_RATE("decrease rate because of low success_ratio\n");
scale_action = -1; scale_action = -1;
/* No throughput measured yet for adjacent rates, /* No throughput measured yet for adjacent rates,
* try increase */ * try increase */
} else if (low_tpt == IL_INVALID_VALUE && } else if (low_tpt == IL_INVALID_VALUE && high_tpt == IL_INVALID_VALUE) {
high_tpt == IL_INVALID_VALUE) {
if (high != RATE_INVALID && win->success_ratio >= RATE_INCREASE_TH) if (high != RATE_INVALID &&
win->success_ratio >= RATE_INCREASE_TH)
scale_action = 1; scale_action = 1;
else if (low != RATE_INVALID) else if (low != RATE_INVALID)
scale_action = 0; scale_action = 0;
/* Both adjacent throughputs are measured, but neither one has /* Both adjacent throughputs are measured, but neither one has
* better throughput; we're using the best rate, don't change * better throughput; we're using the best rate, don't change
* it! */ * it! */
} else if (low_tpt != IL_INVALID_VALUE && } else if (low_tpt != IL_INVALID_VALUE && high_tpt != IL_INVALID_VALUE
high_tpt != IL_INVALID_VALUE && && low_tpt < current_tpt && high_tpt < current_tpt) {
low_tpt < current_tpt && high_tpt < current_tpt) {
D_RATE("No action -- low [%d] & high [%d] < " D_RATE("No action -- low [%d] & high [%d] < "
"current_tpt [%d]\n", "current_tpt [%d]\n", low_tpt, high_tpt, current_tpt);
low_tpt, high_tpt, current_tpt);
scale_action = 0; scale_action = 0;
/* At least one of the rates has better throughput */ /* At least one of the rates has better throughput */
} else { } else {
if (high_tpt != IL_INVALID_VALUE) { if (high_tpt != IL_INVALID_VALUE) {
/* High rate has better throughput, Increase /* High rate has better throughput, Increase
* rate */ * rate */
if (high_tpt > current_tpt && if (high_tpt > current_tpt &&
win->success_ratio >= RATE_INCREASE_TH) win->success_ratio >= RATE_INCREASE_TH)
scale_action = 1; scale_action = 1;
else { else {
D_RATE( D_RATE("decrease rate because of high tpt\n");
"decrease rate because of high tpt\n");
scale_action = 0; scale_action = 0;
} }
} else if (low_tpt != IL_INVALID_VALUE) { } else if (low_tpt != IL_INVALID_VALUE) {
if (low_tpt > current_tpt) { if (low_tpt > current_tpt) {
D_RATE( D_RATE("decrease rate because of low tpt\n");
"decrease rate because of low tpt\n");
scale_action = -1; scale_action = -1;
} else if (win->success_ratio >= RATE_INCREASE_TH) { } else if (win->success_ratio >= RATE_INCREASE_TH) {
/* Lower rate has better /* Lower rate has better
...@@ -815,10 +810,10 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -815,10 +810,10 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
break; break;
} }
D_RATE("Selected %d (action %d) - low %d high %d\n", D_RATE("Selected %d (action %d) - low %d high %d\n", idx, scale_action,
idx, scale_action, low, high); low, high);
out: out:
if (sband->band == IEEE80211_BAND_5GHZ) { if (sband->band == IEEE80211_BAND_5GHZ) {
if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE)) if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE))
...@@ -834,15 +829,16 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, ...@@ -834,15 +829,16 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
} }
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
static int il3945_open_file_generic(struct inode *inode, struct file *file) static int
il3945_open_file_generic(struct inode *inode, struct file *file)
{ {
file->private_data = inode->i_private; file->private_data = inode->i_private;
return 0; return 0;
} }
static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, static ssize_t
char __user *user_buf, il3945_sta_dbgfs_stats_table_read(struct file *file, char __user * user_buf,
size_t count, loff_t *ppos) size_t count, loff_t * ppos)
{ {
char *buff; char *buff;
int desc = 0; int desc = 0;
...@@ -854,17 +850,18 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, ...@@ -854,17 +850,18 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file,
if (!buff) if (!buff)
return -ENOMEM; return -ENOMEM;
desc += sprintf(buff + desc, "tx packets=%d last rate idx=%d\n" desc +=
"rate=0x%X flush time %d\n", sprintf(buff + desc,
lq_sta->tx_packets, "tx packets=%d last rate idx=%d\n"
lq_sta->last_txrate_idx, "rate=0x%X flush time %d\n", lq_sta->tx_packets,
lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); lq_sta->last_txrate_idx, lq_sta->start_rate,
jiffies_to_msecs(lq_sta->flush_time));
for (j = 0; j < RATE_COUNT_3945; j++) { for (j = 0; j < RATE_COUNT_3945; j++) {
desc += sprintf(buff+desc, desc +=
"counter=%d success=%d %%=%d\n", sprintf(buff + desc, "counter=%d success=%d %%=%d\n",
lq_sta->win[j].counter, lq_sta->win[j].counter,
lq_sta->win[j].success_counter, lq_sta->win[j].success_counter,
lq_sta->win[j].success_ratio); lq_sta->win[j].success_ratio);
} }
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
kfree(buff); kfree(buff);
...@@ -877,18 +874,19 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { ...@@ -877,18 +874,19 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
static void il3945_add_debugfs(void *il, void *il_sta, static void
struct dentry *dir) il3945_add_debugfs(void *il, void *il_sta, struct dentry *dir)
{ {
struct il3945_rs_sta *lq_sta = il_sta; struct il3945_rs_sta *lq_sta = il_sta;
lq_sta->rs_sta_dbgfs_stats_table_file = lq_sta->rs_sta_dbgfs_stats_table_file =
debugfs_create_file("rate_stats_table", 0600, dir, debugfs_create_file("rate_stats_table", 0600, dir, lq_sta,
lq_sta, &rs_sta_dbgfs_stats_table_ops); &rs_sta_dbgfs_stats_table_ops);
} }
static void il3945_remove_debugfs(void *il, void *il_sta) static void
il3945_remove_debugfs(void *il, void *il_sta)
{ {
struct il3945_rs_sta *lq_sta = il_sta; struct il3945_rs_sta *lq_sta = il_sta;
debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
...@@ -900,9 +898,9 @@ static void il3945_remove_debugfs(void *il, void *il_sta) ...@@ -900,9 +898,9 @@ static void il3945_remove_debugfs(void *il, void *il_sta)
* the station is added. Since mac80211 calls this function before a * the station is added. Since mac80211 calls this function before a
* station is added we ignore it. * station is added we ignore it.
*/ */
static void il3945_rs_rate_init_stub(void *il_r, static void
struct ieee80211_supported_band *sband, il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *il_sta) struct ieee80211_sta *sta, void *il_sta)
{ {
} }
...@@ -922,7 +920,9 @@ static struct rate_control_ops rs_ops = { ...@@ -922,7 +920,9 @@ static struct rate_control_ops rs_ops = {
#endif #endif
}; };
void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
void
il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
{ {
struct il_priv *il = hw->priv; struct il_priv *il = hw->priv;
s32 rssi = 0; s32 rssi = 0;
...@@ -935,15 +935,15 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) ...@@ -935,15 +935,15 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
rcu_read_lock(); rcu_read_lock();
sta = ieee80211_find_sta(il->ctx.vif, sta =
il->stations[sta_id].sta.sta.addr); ieee80211_find_sta(il->ctx.vif, il->stations[sta_id].sta.sta.addr);
if (!sta) { if (!sta) {
D_RATE("Unable to find station to initialize rate scaling.\n"); D_RATE("Unable to find station to initialize rate scaling.\n");
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
psta = (void *) sta->drv_priv; psta = (void *)sta->drv_priv;
rs_sta = &psta->rs_sta; rs_sta = &psta->rs_sta;
spin_lock_irqsave(&rs_sta->lock, flags); spin_lock_irqsave(&rs_sta->lock, flags);
...@@ -952,8 +952,7 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) ...@@ -952,8 +952,7 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
switch (il->band) { switch (il->band) {
case IEEE80211_BAND_2GHZ: case IEEE80211_BAND_2GHZ:
/* TODO: this always does G, not a regression */ /* TODO: this always does G, not a regression */
if (il->ctx.active.flags & if (il->ctx.active.flags & RXON_FLG_TGG_PROTECT_MSK) {
RXON_FLG_TGG_PROTECT_MSK) {
rs_sta->tgg = 1; rs_sta->tgg = 1;
rs_sta->expected_tpt = il3945_expected_tpt_g_prot; rs_sta->expected_tpt = il3945_expected_tpt_g_prot;
} else } else
...@@ -978,18 +977,19 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) ...@@ -978,18 +977,19 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
rs_sta->start_rate = il3945_get_rate_idx_by_rssi(rssi, il->band); rs_sta->start_rate = il3945_get_rate_idx_by_rssi(rssi, il->band);
D_RATE("leave: rssi %d assign rate idx: " D_RATE("leave: rssi %d assign rate idx: " "%d (plcp 0x%x)\n", rssi,
"%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, rs_sta->start_rate, il3945_rates[rs_sta->start_rate].plcp);
il3945_rates[rs_sta->start_rate].plcp);
rcu_read_unlock(); rcu_read_unlock();
} }
int il3945_rate_control_register(void) int
il3945_rate_control_register(void)
{ {
return ieee80211_rate_control_register(&rs_ops); return ieee80211_rate_control_register(&rs_ops);
} }
void il3945_rate_control_unregister(void) void
il3945_rate_control_unregister(void)
{ {
ieee80211_rate_control_unregister(&rs_ops); ieee80211_rate_control_unregister(&rs_ops);
} }
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#ifndef __il_3945_h__ #ifndef __il_3945_h__
#define __il_3945_h__ #define __il_3945_h__
#include <linux/pci.h> /* for struct pci_device_id */ #include <linux/pci.h> /* for struct pci_device_id */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <net/ieee80211_radiotap.h> #include <net/ieee80211_radiotap.h>
...@@ -93,7 +93,6 @@ struct il3945_rs_sta { ...@@ -93,7 +93,6 @@ struct il3945_rs_sta {
int last_txrate_idx; int last_txrate_idx;
}; };
/* /*
* The common struct MUST be first because it is shared between * The common struct MUST be first because it is shared between
* 3945 and 4965! * 3945 and 4965!
...@@ -186,7 +185,6 @@ struct il3945_ibss_seq { ...@@ -186,7 +185,6 @@ struct il3945_ibss_seq {
#define IL_RX_STATS(x) (&x->u.rx_frame.stats) #define IL_RX_STATS(x) (&x->u.rx_frame.stats)
#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload) #define IL_RX_DATA(x) (IL_RX_HDR(x)->payload)
/****************************************************************************** /******************************************************************************
* *
* Functions implemented in iwl3945-base.c which are forward declared here * Functions implemented in iwl3945-base.c which are forward declared here
...@@ -197,9 +195,10 @@ extern int il3945_calc_db_from_ratio(int sig_ratio); ...@@ -197,9 +195,10 @@ extern int il3945_calc_db_from_ratio(int sig_ratio);
extern void il3945_rx_replenish(void *data); extern void il3945_rx_replenish(void *data);
extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, extern unsigned int il3945_fill_beacon_frame(struct il_priv *il,
struct ieee80211_hdr *hdr, int left); struct ieee80211_hdr *hdr,
int left);
extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log,
char **buf, bool display); char **buf, bool display);
extern void il3945_dump_nic_error_log(struct il_priv *il); extern void il3945_dump_nic_error_log(struct il_priv *il);
/****************************************************************************** /******************************************************************************
...@@ -229,34 +228,29 @@ extern void il3945_hw_txq_ctx_free(struct il_priv *il); ...@@ -229,34 +228,29 @@ extern void il3945_hw_txq_ctx_free(struct il_priv *il);
extern void il3945_hw_txq_ctx_stop(struct il_priv *il); extern void il3945_hw_txq_ctx_stop(struct il_priv *il);
extern int il3945_hw_nic_reset(struct il_priv *il); extern int il3945_hw_nic_reset(struct il_priv *il);
extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
struct il_tx_queue *txq, struct il_tx_queue *txq,
dma_addr_t addr, u16 len, dma_addr_t addr, u16 len, u8 reset,
u8 reset, u8 pad); u8 pad);
extern void il3945_hw_txq_free_tfd(struct il_priv *il, extern void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq);
struct il_tx_queue *txq);
extern int il3945_hw_get_temperature(struct il_priv *il); extern int il3945_hw_get_temperature(struct il_priv *il);
extern int il3945_hw_tx_queue_init(struct il_priv *il, extern int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq);
struct il_tx_queue *txq);
extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il,
struct il3945_frame *frame, u8 rate); struct il3945_frame *frame,
void il3945_hw_build_tx_cmd_rate(struct il_priv *il, u8 rate);
struct il_device_cmd *cmd, void il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd,
struct ieee80211_tx_info *info, struct ieee80211_tx_info *info,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr, int sta_id,
int sta_id, int tx_id); int tx_id);
extern int il3945_hw_reg_send_txpower(struct il_priv *il); extern int il3945_hw_reg_send_txpower(struct il_priv *il);
extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
extern void il3945_hdl_stats(struct il_priv *il, extern void il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb);
struct il_rx_buf *rxb); void il3945_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb);
void il3945_hdl_c_stats(struct il_priv *il,
struct il_rx_buf *rxb);
extern void il3945_disable_events(struct il_priv *il); extern void il3945_disable_events(struct il_priv *il);
extern int il4965_get_temperature(const struct il_priv *il); extern int il4965_get_temperature(const struct il_priv *il);
extern void il3945_post_associate(struct il_priv *il); extern void il3945_post_associate(struct il_priv *il);
extern void il3945_config_ap(struct il_priv *il); extern void il3945_config_ap(struct il_priv *il);
extern int il3945_commit_rxon(struct il_priv *il, extern int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx);
struct il_rxon_context *ctx);
/** /**
* il3945_hw_find_station - Find station id for a given BSSID * il3945_hw_find_station - Find station id for a given BSSID
...@@ -266,7 +260,7 @@ extern int il3945_commit_rxon(struct il_priv *il, ...@@ -266,7 +260,7 @@ extern int il3945_commit_rxon(struct il_priv *il,
* not yet been merged into a single common layer for managing the * not yet been merged into a single common layer for managing the
* station tables. * station tables.
*/ */
extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid); extern u8 il3945_hw_find_station(struct il_priv *il, const u8 * bssid);
extern struct ieee80211_ops il3945_hw_ops; extern struct ieee80211_ops il3945_hw_ops;
...@@ -275,8 +269,10 @@ extern int il3945_init_hw_rate_table(struct il_priv *il); ...@@ -275,8 +269,10 @@ extern int il3945_init_hw_rate_table(struct il_priv *il);
extern void il3945_reg_txpower_periodic(struct il_priv *il); extern void il3945_reg_txpower_periodic(struct il_priv *il);
extern int il3945_txpower_set_from_eeprom(struct il_priv *il); extern int il3945_txpower_set_from_eeprom(struct il_priv *il);
extern const struct il_channel_info *il3945_get_channel_info( extern const struct il_channel_info *il3945_get_channel_info(const struct
const struct il_priv *il, enum ieee80211_band band, u16 channel); il_priv *il,
enum ieee80211_band
band, u16 channel);
extern int il3945_rs_next_rate(struct il_priv *il, int rate); extern int il3945_rs_next_rate(struct il_priv *il, int rate);
...@@ -287,8 +283,6 @@ void il3945_post_scan(struct il_priv *il); ...@@ -287,8 +283,6 @@ void il3945_post_scan(struct il_priv *il);
/* rates */ /* rates */
extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945];
/* RSSI to dBm */ /* RSSI to dBm */
#define IL39_RSSI_OFFSET 95 #define IL39_RSSI_OFFSET 95
...@@ -323,7 +317,7 @@ struct il3945_eeprom_txpower_sample { ...@@ -323,7 +317,7 @@ struct il3945_eeprom_txpower_sample {
* DO NOT ALTER THIS STRUCTURE!!! * DO NOT ALTER THIS STRUCTURE!!!
*/ */
struct il3945_eeprom_txpower_group { struct il3945_eeprom_txpower_group {
struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
s32 a, b, c, d, e; /* coefficients for voltage->power s32 a, b, c, d, e; /* coefficients for voltage->power
* formula (signed) */ * formula (signed) */
s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
...@@ -354,7 +348,7 @@ struct il3945_eeprom_temperature_corr { ...@@ -354,7 +348,7 @@ struct il3945_eeprom_temperature_corr {
*/ */
struct il3945_eeprom { struct il3945_eeprom {
u8 reserved0[16]; u8 reserved0[16];
u16 device_id; /* abs.ofs: 16 */ u16 device_id; /* abs.ofs: 16 */
u8 reserved1[2]; u8 reserved1[2];
u16 pmc; /* abs.ofs: 20 */ u16 pmc; /* abs.ofs: 20 */
u8 reserved2[20]; u8 reserved2[20];
...@@ -389,7 +383,7 @@ struct il3945_eeprom { ...@@ -389,7 +383,7 @@ struct il3945_eeprom {
* 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
*/ */
u16 band_1_count; /* abs.ofs: 196 */ u16 band_1_count; /* abs.ofs: 196 */
struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */
/* /*
* 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
...@@ -397,28 +391,28 @@ struct il3945_eeprom { ...@@ -397,28 +391,28 @@ struct il3945_eeprom {
* (4915-5080MHz) (none of these is ever supported) * (4915-5080MHz) (none of these is ever supported)
*/ */
u16 band_2_count; /* abs.ofs: 226 */ u16 band_2_count; /* abs.ofs: 226 */
struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
/* /*
* 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
* (5170-5320MHz) * (5170-5320MHz)
*/ */
u16 band_3_count; /* abs.ofs: 254 */ u16 band_3_count; /* abs.ofs: 254 */
struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
/* /*
* 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
* (5500-5700MHz) * (5500-5700MHz)
*/ */
u16 band_4_count; /* abs.ofs: 280 */ u16 band_4_count; /* abs.ofs: 280 */
struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
/* /*
* 5.7 GHz channels 145, 149, 153, 157, 161, 165 * 5.7 GHz channels 145, 149, 153, 157, 161, 165
* (5725-5825MHz) * (5725-5825MHz)
*/ */
u16 band_5_count; /* abs.ofs: 304 */ u16 band_5_count; /* abs.ofs: 304 */
struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
u8 reserved9[194]; u8 reserved9[194];
...@@ -428,7 +422,7 @@ struct il3945_eeprom { ...@@ -428,7 +422,7 @@ struct il3945_eeprom {
#define IL_NUM_TX_CALIB_GROUPS 5 #define IL_NUM_TX_CALIB_GROUPS 5
struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS]; struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS];
/* abs.ofs: 512 */ /* abs.ofs: 512 */
struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
u8 reserved16[172]; /* fill out to full 1024 byte block */ u8 reserved16[172]; /* fill out to full 1024 byte block */
} __packed; } __packed;
...@@ -474,7 +468,8 @@ struct il3945_eeprom { ...@@ -474,7 +468,8 @@ struct il3945_eeprom {
/* Size of uCode instruction memory in bootstrap state machine */ /* Size of uCode instruction memory in bootstrap state machine */
#define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE #define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE
static inline int il3945_hw_valid_rtc_data_addr(u32 addr) static inline int
il3945_hw_valid_rtc_data_addr(u32 addr)
{ {
return (addr >= IL39_RTC_DATA_LOWER_BOUND && return (addr >= IL39_RTC_DATA_LOWER_BOUND &&
addr < IL39_RTC_DATA_UPPER_BOUND); addr < IL39_RTC_DATA_UPPER_BOUND);
...@@ -486,19 +481,22 @@ struct il3945_shared { ...@@ -486,19 +481,22 @@ struct il3945_shared {
__le32 tx_base_ptr[8]; __le32 tx_base_ptr[8];
} __packed; } __packed;
static inline u8 il3945_hw_get_rate(__le16 rate_n_flags) static inline u8
il3945_hw_get_rate(__le16 rate_n_flags)
{ {
return le16_to_cpu(rate_n_flags) & 0xFF; return le16_to_cpu(rate_n_flags) & 0xFF;
} }
static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags) static inline u16
il3945_hw_get_rate_n_flags(__le16 rate_n_flags)
{ {
return le16_to_cpu(rate_n_flags); return le16_to_cpu(rate_n_flags);
} }
static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags) static inline __le16
il3945_hw_set_rate_n_flags(u8 rate, u16 flags)
{ {
return cpu_to_le16((u16)rate|flags); return cpu_to_le16((u16) rate | flags);
} }
/************************************/ /************************************/
...@@ -553,7 +551,6 @@ static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags) ...@@ -553,7 +551,6 @@ static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags)
#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008) #define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008)
#define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010) #define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010)
/* DBM */ /* DBM */
#define FH39_SRVC_CHNL (6) #define FH39_SRVC_CHNL (6)
...@@ -622,29 +619,31 @@ struct il3945_tfd { ...@@ -622,29 +619,31 @@ struct il3945_tfd {
} __packed; } __packed;
#ifdef CONFIG_IWLEGACY_DEBUGFS #ifdef CONFIG_IWLEGACY_DEBUGFS
ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user * user_buf,
size_t count, loff_t *ppos); size_t count, loff_t * ppos);
ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user * user_buf,
size_t count, loff_t *ppos); size_t count, loff_t * ppos);
ssize_t il3945_ucode_general_stats_read(struct file *file, ssize_t il3945_ucode_general_stats_read(struct file *file,
char __user *user_buf, size_t count, char __user * user_buf, size_t count,
loff_t *ppos); loff_t * ppos);
#else #else
static ssize_t il3945_ucode_rx_stats_read(struct file *file, static ssize_t
char __user *user_buf, size_t count, il3945_ucode_rx_stats_read(struct file *file, char __user * user_buf,
loff_t *ppos) size_t count, loff_t * ppos)
{ {
return 0; return 0;
} }
static ssize_t il3945_ucode_tx_stats_read(struct file *file,
char __user *user_buf, size_t count, static ssize_t
loff_t *ppos) il3945_ucode_tx_stats_read(struct file *file, char __user * user_buf,
size_t count, loff_t * ppos)
{ {
return 0; return 0;
} }
static ssize_t il3945_ucode_general_stats_read(struct file *file,
char __user *user_buf, static ssize_t
size_t count, loff_t *ppos) il3945_ucode_general_stats_read(struct file *file, char __user * user_buf,
size_t count, loff_t * ppos)
{ {
return 0; return 0;
} }
......
...@@ -82,13 +82,13 @@ ...@@ -82,13 +82,13 @@
*/ */
#define CSR_BASE (0x000) #define CSR_BASE (0x000)
#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */
#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */
#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */
#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */
#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack */
#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ #define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */
#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc */
#define CSR_GP_CNTRL (CSR_BASE+0x024) #define CSR_GP_CNTRL (CSR_BASE+0x024)
/* 2nd byte of CSR_INT_COALESCING, not accessible via _il_wr()! */ /* 2nd byte of CSR_INT_COALESCING, not accessible via _il_wr()! */
...@@ -166,26 +166,26 @@ ...@@ -166,26 +166,26 @@
#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) #define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000)
#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
#define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */ #define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */
#define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */ #define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */
#define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */ #define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */
#define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int*/ #define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int */
#define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec*/ #define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec */
/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
* acknowledged (reset) by host writing "1" to flagged bits. */ * acknowledged (reset) by host writing "1" to flagged bits. */
#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ #define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ #define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
#define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */ #define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */
#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ #define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */ #define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ #define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ #define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ #define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */ #define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */
#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */ #define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */ #define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ #define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
CSR_INT_BIT_HW_ERR | \ CSR_INT_BIT_HW_ERR | \
...@@ -197,21 +197,20 @@ ...@@ -197,21 +197,20 @@
CSR_INT_BIT_ALIVE) CSR_INT_BIT_ALIVE)
/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */ #define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */ #define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
#define CSR39_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */ #define CSR39_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */
#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */ #define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */ #define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
#define CSR39_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */ #define CSR39_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */
#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */ #define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */ #define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
#define CSR39_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ #define CSR39_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
CSR39_FH_INT_BIT_RX_CHNL2 | \ CSR39_FH_INT_BIT_RX_CHNL2 | \
CSR_FH_INT_BIT_RX_CHNL1 | \ CSR_FH_INT_BIT_RX_CHNL1 | \
CSR_FH_INT_BIT_RX_CHNL0) CSR_FH_INT_BIT_RX_CHNL0)
#define CSR39_FH_INT_TX_MASK (CSR39_FH_INT_BIT_TX_CHNL6 | \ #define CSR39_FH_INT_TX_MASK (CSR39_FH_INT_BIT_TX_CHNL6 | \
CSR_FH_INT_BIT_TX_CHNL1 | \ CSR_FH_INT_BIT_TX_CHNL1 | \
CSR_FH_INT_BIT_TX_CHNL0) CSR_FH_INT_BIT_TX_CHNL0)
...@@ -285,7 +284,6 @@ ...@@ -285,7 +284,6 @@
#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) #define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000)
#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
/* EEPROM REG */ /* EEPROM REG */
#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
#define CSR_EEPROM_REG_BIT_CMD (0x00000002) #define CSR_EEPROM_REG_BIT_CMD (0x00000002)
...@@ -293,19 +291,18 @@ ...@@ -293,19 +291,18 @@
#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) #define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
/* EEPROM GP */ /* EEPROM GP */
#define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */ #define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */
#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) #define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
#define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002) #define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002)
#define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004) #define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004)
/* GP REG */ /* GP REG */
#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */ #define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */
#define CSR_GP_REG_NO_POWER_SAVE (0x00000000) #define CSR_GP_REG_NO_POWER_SAVE (0x00000000)
#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000) #define CSR_GP_REG_MAC_POWER_SAVE (0x01000000)
#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000) #define CSR_GP_REG_PHY_POWER_SAVE (0x02000000)
#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000) #define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000)
/* CSR GIO */ /* CSR GIO */
#define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002) #define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002)
......
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
#define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) #define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000)
#define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) #define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000)
#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000)
#define APMG_PS_CTRL_VAL_PWR_SRC_MAX (0x01000000) /* 3945 only */ #define APMG_PS_CTRL_VAL_PWR_SRC_MAX (0x01000000) /* 3945 only */
#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000) #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000)
#define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0) /* bit 8:5 */ #define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0) /* bit 8:5 */
#define APMG_SVR_DIGITAL_VOLTAGE_1_32 (0x00000060) #define APMG_SVR_DIGITAL_VOLTAGE_1_32 (0x00000060)
#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)
...@@ -202,19 +202,19 @@ ...@@ -202,19 +202,19 @@
*/ */
/* BSM bit fields */ /* BSM bit fields */
#define BSM_WR_CTRL_REG_BIT_START (0x80000000) /* start boot load now */ #define BSM_WR_CTRL_REG_BIT_START (0x80000000) /* start boot load now */
#define BSM_WR_CTRL_REG_BIT_START_EN (0x40000000) /* enable boot after pwrup*/ #define BSM_WR_CTRL_REG_BIT_START_EN (0x40000000) /* enable boot after pwrup */
#define BSM_DRAM_INST_LOAD (0x80000000) /* start program load now */ #define BSM_DRAM_INST_LOAD (0x80000000) /* start program load now */
/* BSM addresses */ /* BSM addresses */
#define BSM_BASE (PRPH_BASE + 0x3400) #define BSM_BASE (PRPH_BASE + 0x3400)
#define BSM_END (PRPH_BASE + 0x3800) #define BSM_END (PRPH_BASE + 0x3800)
#define BSM_WR_CTRL_REG (BSM_BASE + 0x000) /* ctl and status */ #define BSM_WR_CTRL_REG (BSM_BASE + 0x000) /* ctl and status */
#define BSM_WR_MEM_SRC_REG (BSM_BASE + 0x004) /* source in BSM mem */ #define BSM_WR_MEM_SRC_REG (BSM_BASE + 0x004) /* source in BSM mem */
#define BSM_WR_MEM_DST_REG (BSM_BASE + 0x008) /* dest in SRAM mem */ #define BSM_WR_MEM_DST_REG (BSM_BASE + 0x008) /* dest in SRAM mem */
#define BSM_WR_DWCOUNT_REG (BSM_BASE + 0x00C) /* bytes */ #define BSM_WR_DWCOUNT_REG (BSM_BASE + 0x00C) /* bytes */
#define BSM_WR_STATUS_REG (BSM_BASE + 0x010) /* bit 0: 1 == done */ #define BSM_WR_STATUS_REG (BSM_BASE + 0x010) /* bit 0: 1 == done */
/* /*
* Pointers and size regs for bootstrap load and data SRAM save/restore. * Pointers and size regs for bootstrap load and data SRAM save/restore.
...@@ -231,8 +231,7 @@ ...@@ -231,8 +231,7 @@
* Read/write, address range from LOWER_BOUND to (LOWER_BOUND + SIZE -1) * Read/write, address range from LOWER_BOUND to (LOWER_BOUND + SIZE -1)
*/ */
#define BSM_SRAM_LOWER_BOUND (PRPH_BASE + 0x3800) #define BSM_SRAM_LOWER_BOUND (PRPH_BASE + 0x3800)
#define BSM_SRAM_SIZE (1024) /* bytes */ #define BSM_SRAM_SIZE (1024) /* bytes */
/* 3945 Tx scheduler registers */ /* 3945 Tx scheduler registers */
#define ALM_SCD_BASE (PRPH_BASE + 0x2E00) #define ALM_SCD_BASE (PRPH_BASE + 0x2E00)
...@@ -520,4 +519,4 @@ ...@@ -520,4 +519,4 @@
/*********************** END TX SCHEDULER *************************************/ /*********************** END TX SCHEDULER *************************************/
#endif /* __il_prph_h__ */ #endif /* __il_prph_h__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册