Loading drivers/net/wireless/iwlegacy/iwl-3945-rs.c +80 −80 Original line number Diff line number Diff line Loading @@ -42,19 +42,19 @@ #define RS_NAME "iwl-3945-rs" static s32 il3945_expected_tpt_g[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_g[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 }; static s32 il3945_expected_tpt_g_prot[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_g_prot[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 }; static s32 il3945_expected_tpt_a[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_a[RATE_COUNT_3945] = { 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 }; static s32 il3945_expected_tpt_b[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 }; Loading @@ -64,39 +64,39 @@ struct il3945_tpt_entry { }; static struct il3945_tpt_entry il3945_tpt_table_a[] = { {-60, IL_RATE_54M_INDEX}, {-64, IL_RATE_48M_INDEX}, {-72, IL_RATE_36M_INDEX}, {-80, IL_RATE_24M_INDEX}, {-84, IL_RATE_18M_INDEX}, {-85, IL_RATE_12M_INDEX}, {-87, IL_RATE_9M_INDEX}, {-89, IL_RATE_6M_INDEX} {-60, RATE_54M_INDEX}, {-64, RATE_48M_INDEX}, {-72, RATE_36M_INDEX}, {-80, RATE_24M_INDEX}, {-84, RATE_18M_INDEX}, {-85, RATE_12M_INDEX}, {-87, RATE_9M_INDEX}, {-89, RATE_6M_INDEX} }; static struct il3945_tpt_entry il3945_tpt_table_g[] = { {-60, IL_RATE_54M_INDEX}, {-64, IL_RATE_48M_INDEX}, {-68, IL_RATE_36M_INDEX}, {-80, IL_RATE_24M_INDEX}, {-84, IL_RATE_18M_INDEX}, {-85, IL_RATE_12M_INDEX}, {-86, IL_RATE_11M_INDEX}, {-88, IL_RATE_5M_INDEX}, {-90, IL_RATE_2M_INDEX}, {-92, IL_RATE_1M_INDEX} {-60, RATE_54M_INDEX}, {-64, RATE_48M_INDEX}, {-68, RATE_36M_INDEX}, {-80, RATE_24M_INDEX}, {-84, RATE_18M_INDEX}, {-85, RATE_12M_INDEX}, {-86, RATE_11M_INDEX}, {-88, RATE_5M_INDEX}, {-90, RATE_2M_INDEX}, {-92, RATE_1M_INDEX} }; #define IL_RATE_MAX_WINDOW 62 #define IL_RATE_FLUSH (3*HZ) #define IL_RATE_WIN_FLUSH (HZ/2) #define RATE_MAX_WINDOW 62 #define RATE_FLUSH (3*HZ) #define RATE_WIN_FLUSH (HZ/2) #define IL39_RATE_HIGH_TH 11520 #define IL_SUCCESS_UP_TH 8960 #define IL_SUCCESS_DOWN_TH 10880 #define IL_RATE_MIN_FAILURE_TH 6 #define IL_RATE_MIN_SUCCESS_TH 8 #define IL_RATE_DECREASE_TH 1920 #define IL_RATE_RETRY_TH 15 #define RATE_MIN_FAILURE_TH 6 #define RATE_MIN_SUCCESS_TH 8 #define RATE_DECREASE_TH 1920 #define RATE_RETRY_TH 15 static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) { Loading Loading @@ -157,16 +157,16 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) /* * For each rate, if we have collected data on that rate * and it has been more than IL_RATE_WIN_FLUSH * and it has been more than RATE_WIN_FLUSH * since we flushed, clear out the gathered stats */ for (i = 0; i < IL_RATE_COUNT_3945; i++) { for (i = 0; i < RATE_COUNT_3945; i++) { if (!rs_sta->win[i].counter) continue; spin_lock_irqsave(&rs_sta->lock, flags); if (time_after(jiffies, rs_sta->win[i].stamp + IL_RATE_WIN_FLUSH)) { RATE_WIN_FLUSH)) { D_RATE("flushing %d samples of rate " "index %d\n", rs_sta->win[i].counter, i); Loading @@ -179,8 +179,8 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) return unflushed; } #define IL_RATE_FLUSH_MAX 5000 /* msec */ #define IL_RATE_FLUSH_MIN 50 /* msec */ #define RATE_FLUSH_MAX 5000 /* msec */ #define RATE_FLUSH_MIN 50 /* msec */ #define IL_AVERAGE_PACKETS 1500 static void il3945_bg_rate_scale_flush(unsigned long data) Loading Loading @@ -217,12 +217,12 @@ static void il3945_bg_rate_scale_flush(unsigned long data) if (pps) { duration = (IL_AVERAGE_PACKETS * 1000) / pps; if (duration < IL_RATE_FLUSH_MIN) duration = IL_RATE_FLUSH_MIN; else if (duration > IL_RATE_FLUSH_MAX) duration = IL_RATE_FLUSH_MAX; if (duration < RATE_FLUSH_MIN) duration = RATE_FLUSH_MIN; else if (duration > RATE_FLUSH_MAX) duration = RATE_FLUSH_MAX; } else duration = IL_RATE_FLUSH_MAX; duration = RATE_FLUSH_MAX; rs_sta->flush_time = msecs_to_jiffies(duration); Loading @@ -234,7 +234,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) rs_sta->last_partial_flush = jiffies; } else { rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->flush_time = RATE_FLUSH; rs_sta->flush_pending = 0; } /* If there weren't any unflushed entries, we don't schedule the timer Loading Loading @@ -278,13 +278,13 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, * we keep these bitmaps!). * */ while (retries > 0) { if (win->counter >= IL_RATE_MAX_WINDOW) { if (win->counter >= RATE_MAX_WINDOW) { /* remove earliest */ win->counter = IL_RATE_MAX_WINDOW - 1; win->counter = RATE_MAX_WINDOW - 1; if (win->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) { win->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1)); if (win->data & (1ULL << (RATE_MAX_WINDOW - 1))) { win->data &= ~(1ULL << (RATE_MAX_WINDOW - 1)); win->success_counter--; } } Loading Loading @@ -315,8 +315,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, fail_count = win->counter - win->success_counter; /* Calculate average throughput, if we have enough history. */ if (fail_count >= IL_RATE_MIN_FAILURE_TH || win->success_counter >= IL_RATE_MIN_SUCCESS_TH) if (fail_count >= RATE_MIN_FAILURE_TH || win->success_counter >= RATE_MIN_SUCCESS_TH) win->average_tpt = ((win->success_ratio * rs_sta->expected_tpt[index] + 64) / 128); else Loading Loading @@ -351,20 +351,20 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i rs_sta->il = il; rs_sta->start_rate = IL_RATE_INVALID; rs_sta->start_rate = RATE_INVALID; /* default to just 802.11b */ rs_sta->expected_tpt = il3945_expected_tpt_b; rs_sta->last_partial_flush = jiffies; rs_sta->last_flush = jiffies; rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->flush_time = RATE_FLUSH; rs_sta->last_tx_packets = 0; rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; for (i = 0; i < IL_RATE_COUNT_3945; i++) for (i = 0; i < RATE_COUNT_3945; i++) il3945_clear_win(&rs_sta->win[i]); /* TODO: what is a good starting rate for STA? About middle? Maybe not Loading Loading @@ -457,11 +457,11 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * retries = info->status.rates[0].count; /* Sanity Check for retries */ if (retries > IL_RATE_RETRY_TH) retries = IL_RATE_RETRY_TH; if (retries > RATE_RETRY_TH) retries = RATE_RETRY_TH; first_index = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_index < 0 || first_index >= IL_RATE_COUNT_3945) { if (first_index < 0 || first_index >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_index); return; } Loading Loading @@ -549,8 +549,8 @@ 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 index, u16 rate_mask, enum ieee80211_band band) { u8 high = IL_RATE_INVALID; u8 low = IL_RATE_INVALID; u8 high = RATE_INVALID; u8 low = RATE_INVALID; struct il_priv *il __maybe_unused = rs_sta->il; /* 802.11A walks to the next literal adjacent rate in Loading @@ -570,7 +570,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, /* Find the next rate that is in the rate mask */ i = index + 1; for (mask = (1 << i); i < IL_RATE_COUNT_3945; for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) { if (rate_mask & mask) { high = i; Loading @@ -582,12 +582,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } low = index; while (low != IL_RATE_INVALID) { while (low != RATE_INVALID) { if (rs_sta->tgg) low = il3945_rates[low].prev_rs_tgg; else low = il3945_rates[low].prev_rs; if (low == IL_RATE_INVALID) if (low == RATE_INVALID) break; if (rate_mask & (1 << low)) break; Loading @@ -595,12 +595,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } high = index; while (high != IL_RATE_INVALID) { while (high != RATE_INVALID) { if (rs_sta->tgg) high = il3945_rates[high].next_rs_tgg; else high = il3945_rates[high].next_rs; if (high == IL_RATE_INVALID) if (high == RATE_INVALID) break; if (rate_mask & (1 << high)) break; Loading Loading @@ -631,8 +631,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, { struct ieee80211_supported_band *sband = txrc->sband; struct sk_buff *skb = txrc->skb; u8 low = IL_RATE_INVALID; u8 high = IL_RATE_INVALID; u8 low = RATE_INVALID; u8 high = RATE_INVALID; u16 high_low; int index; struct il3945_rs_sta *rs_sta = il_sta; Loading Loading @@ -665,10 +665,10 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, max_rate_idx = txrc->max_rate_idx; if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1) max_rate_idx += IL_FIRST_OFDM_RATE; if (max_rate_idx < 0 || max_rate_idx >= IL_RATE_COUNT) if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) max_rate_idx = -1; index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1); index = 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; Loading @@ -678,11 +678,11 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* for recent assoc, choose best rate regarding * to rssi value */ if (rs_sta->start_rate != IL_RATE_INVALID) { if (rs_sta->start_rate != RATE_INVALID) { if (rs_sta->start_rate < index && (rate_mask & (1 << rs_sta->start_rate))) index = rs_sta->start_rate; rs_sta->start_rate = IL_RATE_INVALID; rs_sta->start_rate = RATE_INVALID; } /* force user max rate if set by user */ Loading @@ -695,8 +695,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, fail_count = win->counter - win->success_counter; if (fail_count < IL_RATE_MIN_FAILURE_TH && win->success_counter < IL_RATE_MIN_SUCCESS_TH) { if (fail_count < RATE_MIN_FAILURE_TH && win->success_counter < RATE_MIN_SUCCESS_TH) { spin_unlock_irqrestore(&rs_sta->lock, flags); D_RATE("Invalid average_tpt on rate %d: " Loading @@ -722,13 +722,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* If user set max rate, dont allow higher than user constrain */ if (max_rate_idx != -1 && max_rate_idx < high) high = IL_RATE_INVALID; high = RATE_INVALID; /* Collect Measured throughputs of adjacent rates */ if (low != IL_RATE_INVALID) if (low != RATE_INVALID) low_tpt = rs_sta->win[low].average_tpt; if (high != IL_RATE_INVALID) if (high != RATE_INVALID) high_tpt = rs_sta->win[high].average_tpt; spin_unlock_irqrestore(&rs_sta->lock, flags); Loading @@ -736,7 +736,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, scale_action = 0; /* Low success ratio , need to drop the rate */ if (win->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) { if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) { D_RATE("decrease rate because of low success_ratio\n"); scale_action = -1; /* No throughput measured yet for adjacent rates, Loading @@ -744,9 +744,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, } else if (low_tpt == IL_INVALID_VALUE && high_tpt == IL_INVALID_VALUE) { if (high != IL_RATE_INVALID && win->success_ratio >= IL_RATE_INCREASE_TH) if (high != RATE_INVALID && win->success_ratio >= RATE_INCREASE_TH) scale_action = 1; else if (low != IL_RATE_INVALID) else if (low != RATE_INVALID) scale_action = 0; /* Both adjacent throughputs are measured, but neither one has Loading @@ -768,7 +768,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* High rate has better throughput, Increase * rate */ if (high_tpt > current_tpt && win->success_ratio >= IL_RATE_INCREASE_TH) win->success_ratio >= RATE_INCREASE_TH) scale_action = 1; else { D_RATE( Loading @@ -780,7 +780,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, D_RATE( "decrease rate because of low tpt\n"); scale_action = -1; } else if (win->success_ratio >= IL_RATE_INCREASE_TH) { } else if (win->success_ratio >= RATE_INCREASE_TH) { /* Lower rate has better * throughput,decrease rate */ scale_action = 1; Loading @@ -790,8 +790,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* Sanity check; asked for decrease, but success rate or throughput * has been good at old rate. Don't change it. */ if (scale_action == -1 && low != IL_RATE_INVALID && (win->success_ratio > IL_RATE_HIGH_TH || if (scale_action == -1 && low != RATE_INVALID && (win->success_ratio > RATE_HIGH_TH || current_tpt > 100 * rs_sta->expected_tpt[low])) scale_action = 0; Loading @@ -799,13 +799,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, case -1: /* Decrese rate */ if (low != IL_RATE_INVALID) if (low != RATE_INVALID) index = low; break; case 1: /* Increase rate */ if (high != IL_RATE_INVALID) if (high != RATE_INVALID) index = high; break; Loading Loading @@ -860,7 +860,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, lq_sta->tx_packets, lq_sta->last_txrate_idx, lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); for (j = 0; j < IL_RATE_COUNT_3945; j++) { for (j = 0; j < RATE_COUNT_3945; j++) { desc += sprintf(buff+desc, "counter=%d success=%d %%=%d\n", lq_sta->win[j].counter, Loading drivers/net/wireless/iwlegacy/iwl-3945.c +46 −46 Original line number Diff line number Diff line Loading @@ -52,26 +52,26 @@ #include "iwl-3945-debugfs.h" #define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ IL_RATE_##r##M_IEEE, \ IL_RATE_##ip##M_INDEX, \ IL_RATE_##in##M_INDEX, \ IL_RATE_##rp##M_INDEX, \ IL_RATE_##rn##M_INDEX, \ IL_RATE_##pp##M_INDEX, \ IL_RATE_##np##M_INDEX, \ IL_RATE_##r##M_INDEX_TABLE, \ IL_RATE_##ip##M_INDEX_TABLE } [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \ RATE_##r##M_IEEE, \ RATE_##ip##M_INDEX, \ RATE_##in##M_INDEX, \ RATE_##rp##M_INDEX, \ RATE_##rn##M_INDEX, \ RATE_##pp##M_INDEX, \ RATE_##np##M_INDEX, \ RATE_##r##M_INDEX_TABLE, \ RATE_##ip##M_INDEX_TABLE } /* * Parameter order: * rate, prev rate, next rate, prev tgg rate, next tgg rate * * If there isn't a valid next or previous rate then INV is used which * maps to IL_RATE_INVALID * maps to RATE_INVALID * */ const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945] = { const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = { IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ Loading @@ -90,7 +90,7 @@ static inline u8 il3945_get_prev_ieee_rate(u8 rate_index) { u8 rate = il3945_rates[rate_index].prev_ieee; if (rate == IL_RATE_INVALID) if (rate == RATE_INVALID) rate = rate_index; return rate; } Loading Loading @@ -194,7 +194,7 @@ static int il3945_hwrate_to_plcp_idx(u8 plcp) { int idx; for (idx = 0; idx < IL_RATE_COUNT_3945; idx++) for (idx = 0; idx < RATE_COUNT_3945; idx++) if (il3945_rates[idx].plcp == plcp) return idx; return -1; Loading Loading @@ -246,16 +246,16 @@ int il3945_rs_next_rate(struct il_priv *il, int rate) switch (il->band) { case IEEE80211_BAND_5GHZ: if (rate == IL_RATE_12M_INDEX) next_rate = IL_RATE_9M_INDEX; else if (rate == IL_RATE_6M_INDEX) next_rate = IL_RATE_6M_INDEX; if (rate == RATE_12M_INDEX) next_rate = RATE_9M_INDEX; else if (rate == RATE_6M_INDEX) next_rate = RATE_6M_INDEX; break; case IEEE80211_BAND_2GHZ: if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && il_is_associated(il)) { if (rate == IL_RATE_11M_INDEX) next_rate = IL_RATE_5M_INDEX; if (rate == RATE_11M_INDEX) next_rate = RATE_5M_INDEX; } break; Loading Loading @@ -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_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); u16 rate_index = min(hw_value & 0xffff, RATE_COUNT_3945); u16 rate_mask; int rate; u8 rts_retry_limit; Loading @@ -689,7 +689,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il, /* We need to figure out how to get the sta->supp_rates while * in this running context */ rate_mask = IL_RATES_MASK_3945; rate_mask = RATES_MASK_3945; /* Set retry limit on DATA packets and Probe Responses*/ if (ieee80211_is_probe_resp(fc)) Loading Loading @@ -1330,7 +1330,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, /* use this channel group's 6Mbit clipping/saturation pwr, * but cap at regulatory scan power restriction (set during init * based on eeprom channel data) for this channel. */ power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); power = min(ch_info->scan_power, clip_pwrs[RATE_6M_INDEX_TABLE]); power = min(power, il->tx_power_user_lmt); scan_power_info->requested_power = power; Loading @@ -1342,7 +1342,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, * *index*. */ power_index = ch_info->power_info[rate_index].power_table_index - (power - ch_info->power_info [IL_RATE_6M_INDEX_TABLE].requested_power) * 2; [RATE_6M_INDEX_TABLE].requested_power) * 2; /* store reference index that we use when adjusting *all* scan * powers. So we can accommodate user (all channel) or spectrum Loading Loading @@ -1466,7 +1466,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il, power_info = ch_info->power_info; /* update OFDM Txpower settings */ for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE; i++, ++power_info) { int delta_idx; Loading @@ -1490,14 +1490,14 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il, * ... all CCK power settings for a given channel are the *same*. */ if (power_changed) { power = ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. ch_info->power_info[RATE_12M_INDEX_TABLE]. requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; /* do all CCK rates' il3945_channel_power_info structures */ for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) { for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_TABLE; i++) { power_info->requested_power = power; power_info->base_power_index = ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. ch_info->power_info[RATE_12M_INDEX_TABLE]. base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF; ++power_info; } Loading Loading @@ -1574,7 +1574,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) ref_temp); /* set tx power value for all rates, OFDM and CCK */ for (rate_index = 0; rate_index < IL_RATE_COUNT_3945; for (rate_index = 0; rate_index < RATE_COUNT_3945; rate_index++) { int power_idx = ch_info->power_info[rate_index].base_power_index; Loading @@ -1597,7 +1597,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) for (scan_tbl_index = 0; scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE; il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); Loading Loading @@ -2010,21 +2010,21 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il) /* fill in channel group's nominal powers for each rate */ for (rate_index = 0; rate_index < IL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { rate_index < RATE_COUNT_3945; rate_index++, clip_pwrs++) { switch (rate_index) { case IL_RATE_36M_INDEX_TABLE: case RATE_36M_INDEX_TABLE: if (i == 0) /* B/G */ *clip_pwrs = satur_pwr; else /* A */ *clip_pwrs = satur_pwr - 5; break; case IL_RATE_48M_INDEX_TABLE: case RATE_48M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 7; else *clip_pwrs = satur_pwr - 10; break; case IL_RATE_54M_INDEX_TABLE: case RATE_54M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 9; else Loading Loading @@ -2139,7 +2139,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il) } /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ pwr_info = &ch_info->power_info[IL_RATE_12M_INDEX_TABLE]; pwr_info = &ch_info->power_info[RATE_12M_INDEX_TABLE]; power = pwr_info->requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; pwr_index = pwr_info->power_table_index + Loading Loading @@ -2169,7 +2169,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il) for (scan_tbl_index = 0; scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE; il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } Loading Loading @@ -2289,7 +2289,7 @@ static int il3945_manage_ibss_station(struct il_priv *il, il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, (il->band == IEEE80211_BAND_5GHZ) ? IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); RATE_6M_PLCP : RATE_1M_PLCP); il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); return 0; Loading Loading @@ -2326,17 +2326,17 @@ int il3945_init_hw_rate_table(struct il_priv *il) D_RATE("Select A mode rate scale\n"); /* If one of the following CCK rates is used, * have it fall back to the 6M OFDM rate */ for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_TABLE; i++) table[i].next_rate_index = il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; /* Don't fall back to CCK rates */ table[IL_RATE_12M_INDEX_TABLE].next_rate_index = IL_RATE_9M_INDEX_TABLE; table[RATE_12M_INDEX_TABLE].next_rate_index = RATE_9M_INDEX_TABLE; /* Don't drop out of OFDM rates */ table[IL_RATE_6M_INDEX_TABLE].next_rate_index = table[RATE_6M_INDEX_TABLE].next_rate_index = il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; break; Loading @@ -2349,14 +2349,14 @@ int il3945_init_hw_rate_table(struct il_priv *il) il_is_associated(il)) { index = IL_FIRST_CCK_RATE; for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; i++) for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE; i++) table[i].next_rate_index = il3945_rates[index].table_rs_index; index = IL_RATE_11M_INDEX_TABLE; index = RATE_11M_INDEX_TABLE; /* CCK shouldn't fall back to OFDM... */ table[index].next_rate_index = IL_RATE_5M_INDEX_TABLE; table[index].next_rate_index = RATE_5M_INDEX_TABLE; } break; Loading drivers/net/wireless/iwlegacy/iwl-3945.h +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ struct il3945_rs_sta { u8 flush_pending; u8 start_rate; struct timer_list rate_scale_flush; struct il3945_rate_scale_data win[IL_RATE_COUNT_3945]; struct il3945_rate_scale_data win[RATE_COUNT_3945]; #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_stats_table_file; #endif Loading Loading @@ -300,7 +300,7 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); void il3945_post_scan(struct il_priv *il); /* rates */ extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945]; extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; /* Requires full declaration of il_priv before including */ #include "iwl-io.h" Loading drivers/net/wireless/iwlegacy/iwl-4965-lib.c +4 −4 Original line number Diff line number Diff line Loading @@ -423,7 +423,7 @@ int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) } else { if (band == IEEE80211_BAND_5GHZ) band_offset = IL_FIRST_OFDM_RATE; for (idx = band_offset; idx < IL_RATE_COUNT_LEGACY; idx++) for (idx = band_offset; idx < RATE_COUNT_LEGACY; idx++) if (il_rates[idx].plcp == (rate_n_flags & 0xFF)) return idx - band_offset; } Loading Loading @@ -870,14 +870,14 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) RXON_FLG_CHANNEL_MODE_MSK) >> RXON_FLG_CHANNEL_MODE_POS; if (chan_mod == CHANNEL_MODE_PURE_40) { rate = IL_RATE_6M_PLCP; rate = RATE_6M_PLCP; } else { rate = IL_RATE_1M_PLCP; rate = RATE_1M_PLCP; rate_flags = RATE_MCS_CCK_MSK; } break; case IEEE80211_BAND_5GHZ: rate = IL_RATE_6M_PLCP; rate = RATE_6M_PLCP; break; default: IL_WARN("Invalid scan band\n"); Loading Loading
drivers/net/wireless/iwlegacy/iwl-3945-rs.c +80 −80 Original line number Diff line number Diff line Loading @@ -42,19 +42,19 @@ #define RS_NAME "iwl-3945-rs" static s32 il3945_expected_tpt_g[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_g[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 }; static s32 il3945_expected_tpt_g_prot[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_g_prot[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 }; static s32 il3945_expected_tpt_a[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_a[RATE_COUNT_3945] = { 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 }; static s32 il3945_expected_tpt_b[IL_RATE_COUNT_3945] = { static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = { 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 }; Loading @@ -64,39 +64,39 @@ struct il3945_tpt_entry { }; static struct il3945_tpt_entry il3945_tpt_table_a[] = { {-60, IL_RATE_54M_INDEX}, {-64, IL_RATE_48M_INDEX}, {-72, IL_RATE_36M_INDEX}, {-80, IL_RATE_24M_INDEX}, {-84, IL_RATE_18M_INDEX}, {-85, IL_RATE_12M_INDEX}, {-87, IL_RATE_9M_INDEX}, {-89, IL_RATE_6M_INDEX} {-60, RATE_54M_INDEX}, {-64, RATE_48M_INDEX}, {-72, RATE_36M_INDEX}, {-80, RATE_24M_INDEX}, {-84, RATE_18M_INDEX}, {-85, RATE_12M_INDEX}, {-87, RATE_9M_INDEX}, {-89, RATE_6M_INDEX} }; static struct il3945_tpt_entry il3945_tpt_table_g[] = { {-60, IL_RATE_54M_INDEX}, {-64, IL_RATE_48M_INDEX}, {-68, IL_RATE_36M_INDEX}, {-80, IL_RATE_24M_INDEX}, {-84, IL_RATE_18M_INDEX}, {-85, IL_RATE_12M_INDEX}, {-86, IL_RATE_11M_INDEX}, {-88, IL_RATE_5M_INDEX}, {-90, IL_RATE_2M_INDEX}, {-92, IL_RATE_1M_INDEX} {-60, RATE_54M_INDEX}, {-64, RATE_48M_INDEX}, {-68, RATE_36M_INDEX}, {-80, RATE_24M_INDEX}, {-84, RATE_18M_INDEX}, {-85, RATE_12M_INDEX}, {-86, RATE_11M_INDEX}, {-88, RATE_5M_INDEX}, {-90, RATE_2M_INDEX}, {-92, RATE_1M_INDEX} }; #define IL_RATE_MAX_WINDOW 62 #define IL_RATE_FLUSH (3*HZ) #define IL_RATE_WIN_FLUSH (HZ/2) #define RATE_MAX_WINDOW 62 #define RATE_FLUSH (3*HZ) #define RATE_WIN_FLUSH (HZ/2) #define IL39_RATE_HIGH_TH 11520 #define IL_SUCCESS_UP_TH 8960 #define IL_SUCCESS_DOWN_TH 10880 #define IL_RATE_MIN_FAILURE_TH 6 #define IL_RATE_MIN_SUCCESS_TH 8 #define IL_RATE_DECREASE_TH 1920 #define IL_RATE_RETRY_TH 15 #define RATE_MIN_FAILURE_TH 6 #define RATE_MIN_SUCCESS_TH 8 #define RATE_DECREASE_TH 1920 #define RATE_RETRY_TH 15 static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) { Loading Loading @@ -157,16 +157,16 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) /* * For each rate, if we have collected data on that rate * and it has been more than IL_RATE_WIN_FLUSH * and it has been more than RATE_WIN_FLUSH * since we flushed, clear out the gathered stats */ for (i = 0; i < IL_RATE_COUNT_3945; i++) { for (i = 0; i < RATE_COUNT_3945; i++) { if (!rs_sta->win[i].counter) continue; spin_lock_irqsave(&rs_sta->lock, flags); if (time_after(jiffies, rs_sta->win[i].stamp + IL_RATE_WIN_FLUSH)) { RATE_WIN_FLUSH)) { D_RATE("flushing %d samples of rate " "index %d\n", rs_sta->win[i].counter, i); Loading @@ -179,8 +179,8 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) return unflushed; } #define IL_RATE_FLUSH_MAX 5000 /* msec */ #define IL_RATE_FLUSH_MIN 50 /* msec */ #define RATE_FLUSH_MAX 5000 /* msec */ #define RATE_FLUSH_MIN 50 /* msec */ #define IL_AVERAGE_PACKETS 1500 static void il3945_bg_rate_scale_flush(unsigned long data) Loading Loading @@ -217,12 +217,12 @@ static void il3945_bg_rate_scale_flush(unsigned long data) if (pps) { duration = (IL_AVERAGE_PACKETS * 1000) / pps; if (duration < IL_RATE_FLUSH_MIN) duration = IL_RATE_FLUSH_MIN; else if (duration > IL_RATE_FLUSH_MAX) duration = IL_RATE_FLUSH_MAX; if (duration < RATE_FLUSH_MIN) duration = RATE_FLUSH_MIN; else if (duration > RATE_FLUSH_MAX) duration = RATE_FLUSH_MAX; } else duration = IL_RATE_FLUSH_MAX; duration = RATE_FLUSH_MAX; rs_sta->flush_time = msecs_to_jiffies(duration); Loading @@ -234,7 +234,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) rs_sta->last_partial_flush = jiffies; } else { rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->flush_time = RATE_FLUSH; rs_sta->flush_pending = 0; } /* If there weren't any unflushed entries, we don't schedule the timer Loading Loading @@ -278,13 +278,13 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, * we keep these bitmaps!). * */ while (retries > 0) { if (win->counter >= IL_RATE_MAX_WINDOW) { if (win->counter >= RATE_MAX_WINDOW) { /* remove earliest */ win->counter = IL_RATE_MAX_WINDOW - 1; win->counter = RATE_MAX_WINDOW - 1; if (win->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) { win->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1)); if (win->data & (1ULL << (RATE_MAX_WINDOW - 1))) { win->data &= ~(1ULL << (RATE_MAX_WINDOW - 1)); win->success_counter--; } } Loading Loading @@ -315,8 +315,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, fail_count = win->counter - win->success_counter; /* Calculate average throughput, if we have enough history. */ if (fail_count >= IL_RATE_MIN_FAILURE_TH || win->success_counter >= IL_RATE_MIN_SUCCESS_TH) if (fail_count >= RATE_MIN_FAILURE_TH || win->success_counter >= RATE_MIN_SUCCESS_TH) win->average_tpt = ((win->success_ratio * rs_sta->expected_tpt[index] + 64) / 128); else Loading Loading @@ -351,20 +351,20 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i rs_sta->il = il; rs_sta->start_rate = IL_RATE_INVALID; rs_sta->start_rate = RATE_INVALID; /* default to just 802.11b */ rs_sta->expected_tpt = il3945_expected_tpt_b; rs_sta->last_partial_flush = jiffies; rs_sta->last_flush = jiffies; rs_sta->flush_time = IL_RATE_FLUSH; rs_sta->flush_time = RATE_FLUSH; rs_sta->last_tx_packets = 0; rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; for (i = 0; i < IL_RATE_COUNT_3945; i++) for (i = 0; i < RATE_COUNT_3945; i++) il3945_clear_win(&rs_sta->win[i]); /* TODO: what is a good starting rate for STA? About middle? Maybe not Loading Loading @@ -457,11 +457,11 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * retries = info->status.rates[0].count; /* Sanity Check for retries */ if (retries > IL_RATE_RETRY_TH) retries = IL_RATE_RETRY_TH; if (retries > RATE_RETRY_TH) retries = RATE_RETRY_TH; first_index = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_index < 0 || first_index >= IL_RATE_COUNT_3945) { if (first_index < 0 || first_index >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_index); return; } Loading Loading @@ -549,8 +549,8 @@ 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 index, u16 rate_mask, enum ieee80211_band band) { u8 high = IL_RATE_INVALID; u8 low = IL_RATE_INVALID; u8 high = RATE_INVALID; u8 low = RATE_INVALID; struct il_priv *il __maybe_unused = rs_sta->il; /* 802.11A walks to the next literal adjacent rate in Loading @@ -570,7 +570,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, /* Find the next rate that is in the rate mask */ i = index + 1; for (mask = (1 << i); i < IL_RATE_COUNT_3945; for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) { if (rate_mask & mask) { high = i; Loading @@ -582,12 +582,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } low = index; while (low != IL_RATE_INVALID) { while (low != RATE_INVALID) { if (rs_sta->tgg) low = il3945_rates[low].prev_rs_tgg; else low = il3945_rates[low].prev_rs; if (low == IL_RATE_INVALID) if (low == RATE_INVALID) break; if (rate_mask & (1 << low)) break; Loading @@ -595,12 +595,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } high = index; while (high != IL_RATE_INVALID) { while (high != RATE_INVALID) { if (rs_sta->tgg) high = il3945_rates[high].next_rs_tgg; else high = il3945_rates[high].next_rs; if (high == IL_RATE_INVALID) if (high == RATE_INVALID) break; if (rate_mask & (1 << high)) break; Loading Loading @@ -631,8 +631,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, { struct ieee80211_supported_band *sband = txrc->sband; struct sk_buff *skb = txrc->skb; u8 low = IL_RATE_INVALID; u8 high = IL_RATE_INVALID; u8 low = RATE_INVALID; u8 high = RATE_INVALID; u16 high_low; int index; struct il3945_rs_sta *rs_sta = il_sta; Loading Loading @@ -665,10 +665,10 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, max_rate_idx = txrc->max_rate_idx; if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1) max_rate_idx += IL_FIRST_OFDM_RATE; if (max_rate_idx < 0 || max_rate_idx >= IL_RATE_COUNT) if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) max_rate_idx = -1; index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1); index = 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; Loading @@ -678,11 +678,11 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* for recent assoc, choose best rate regarding * to rssi value */ if (rs_sta->start_rate != IL_RATE_INVALID) { if (rs_sta->start_rate != RATE_INVALID) { if (rs_sta->start_rate < index && (rate_mask & (1 << rs_sta->start_rate))) index = rs_sta->start_rate; rs_sta->start_rate = IL_RATE_INVALID; rs_sta->start_rate = RATE_INVALID; } /* force user max rate if set by user */ Loading @@ -695,8 +695,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, fail_count = win->counter - win->success_counter; if (fail_count < IL_RATE_MIN_FAILURE_TH && win->success_counter < IL_RATE_MIN_SUCCESS_TH) { if (fail_count < RATE_MIN_FAILURE_TH && win->success_counter < RATE_MIN_SUCCESS_TH) { spin_unlock_irqrestore(&rs_sta->lock, flags); D_RATE("Invalid average_tpt on rate %d: " Loading @@ -722,13 +722,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* If user set max rate, dont allow higher than user constrain */ if (max_rate_idx != -1 && max_rate_idx < high) high = IL_RATE_INVALID; high = RATE_INVALID; /* Collect Measured throughputs of adjacent rates */ if (low != IL_RATE_INVALID) if (low != RATE_INVALID) low_tpt = rs_sta->win[low].average_tpt; if (high != IL_RATE_INVALID) if (high != RATE_INVALID) high_tpt = rs_sta->win[high].average_tpt; spin_unlock_irqrestore(&rs_sta->lock, flags); Loading @@ -736,7 +736,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, scale_action = 0; /* Low success ratio , need to drop the rate */ if (win->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) { if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) { D_RATE("decrease rate because of low success_ratio\n"); scale_action = -1; /* No throughput measured yet for adjacent rates, Loading @@ -744,9 +744,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, } else if (low_tpt == IL_INVALID_VALUE && high_tpt == IL_INVALID_VALUE) { if (high != IL_RATE_INVALID && win->success_ratio >= IL_RATE_INCREASE_TH) if (high != RATE_INVALID && win->success_ratio >= RATE_INCREASE_TH) scale_action = 1; else if (low != IL_RATE_INVALID) else if (low != RATE_INVALID) scale_action = 0; /* Both adjacent throughputs are measured, but neither one has Loading @@ -768,7 +768,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* High rate has better throughput, Increase * rate */ if (high_tpt > current_tpt && win->success_ratio >= IL_RATE_INCREASE_TH) win->success_ratio >= RATE_INCREASE_TH) scale_action = 1; else { D_RATE( Loading @@ -780,7 +780,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, D_RATE( "decrease rate because of low tpt\n"); scale_action = -1; } else if (win->success_ratio >= IL_RATE_INCREASE_TH) { } else if (win->success_ratio >= RATE_INCREASE_TH) { /* Lower rate has better * throughput,decrease rate */ scale_action = 1; Loading @@ -790,8 +790,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* Sanity check; asked for decrease, but success rate or throughput * has been good at old rate. Don't change it. */ if (scale_action == -1 && low != IL_RATE_INVALID && (win->success_ratio > IL_RATE_HIGH_TH || if (scale_action == -1 && low != RATE_INVALID && (win->success_ratio > RATE_HIGH_TH || current_tpt > 100 * rs_sta->expected_tpt[low])) scale_action = 0; Loading @@ -799,13 +799,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, case -1: /* Decrese rate */ if (low != IL_RATE_INVALID) if (low != RATE_INVALID) index = low; break; case 1: /* Increase rate */ if (high != IL_RATE_INVALID) if (high != RATE_INVALID) index = high; break; Loading Loading @@ -860,7 +860,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, lq_sta->tx_packets, lq_sta->last_txrate_idx, lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); for (j = 0; j < IL_RATE_COUNT_3945; j++) { for (j = 0; j < RATE_COUNT_3945; j++) { desc += sprintf(buff+desc, "counter=%d success=%d %%=%d\n", lq_sta->win[j].counter, Loading
drivers/net/wireless/iwlegacy/iwl-3945.c +46 −46 Original line number Diff line number Diff line Loading @@ -52,26 +52,26 @@ #include "iwl-3945-debugfs.h" #define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ IL_RATE_##r##M_IEEE, \ IL_RATE_##ip##M_INDEX, \ IL_RATE_##in##M_INDEX, \ IL_RATE_##rp##M_INDEX, \ IL_RATE_##rn##M_INDEX, \ IL_RATE_##pp##M_INDEX, \ IL_RATE_##np##M_INDEX, \ IL_RATE_##r##M_INDEX_TABLE, \ IL_RATE_##ip##M_INDEX_TABLE } [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \ RATE_##r##M_IEEE, \ RATE_##ip##M_INDEX, \ RATE_##in##M_INDEX, \ RATE_##rp##M_INDEX, \ RATE_##rn##M_INDEX, \ RATE_##pp##M_INDEX, \ RATE_##np##M_INDEX, \ RATE_##r##M_INDEX_TABLE, \ RATE_##ip##M_INDEX_TABLE } /* * Parameter order: * rate, prev rate, next rate, prev tgg rate, next tgg rate * * If there isn't a valid next or previous rate then INV is used which * maps to IL_RATE_INVALID * maps to RATE_INVALID * */ const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945] = { const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = { IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ Loading @@ -90,7 +90,7 @@ static inline u8 il3945_get_prev_ieee_rate(u8 rate_index) { u8 rate = il3945_rates[rate_index].prev_ieee; if (rate == IL_RATE_INVALID) if (rate == RATE_INVALID) rate = rate_index; return rate; } Loading Loading @@ -194,7 +194,7 @@ static int il3945_hwrate_to_plcp_idx(u8 plcp) { int idx; for (idx = 0; idx < IL_RATE_COUNT_3945; idx++) for (idx = 0; idx < RATE_COUNT_3945; idx++) if (il3945_rates[idx].plcp == plcp) return idx; return -1; Loading Loading @@ -246,16 +246,16 @@ int il3945_rs_next_rate(struct il_priv *il, int rate) switch (il->band) { case IEEE80211_BAND_5GHZ: if (rate == IL_RATE_12M_INDEX) next_rate = IL_RATE_9M_INDEX; else if (rate == IL_RATE_6M_INDEX) next_rate = IL_RATE_6M_INDEX; if (rate == RATE_12M_INDEX) next_rate = RATE_9M_INDEX; else if (rate == RATE_6M_INDEX) next_rate = RATE_6M_INDEX; break; case IEEE80211_BAND_2GHZ: if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && il_is_associated(il)) { if (rate == IL_RATE_11M_INDEX) next_rate = IL_RATE_5M_INDEX; if (rate == RATE_11M_INDEX) next_rate = RATE_5M_INDEX; } break; Loading Loading @@ -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_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); u16 rate_index = min(hw_value & 0xffff, RATE_COUNT_3945); u16 rate_mask; int rate; u8 rts_retry_limit; Loading @@ -689,7 +689,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il, /* We need to figure out how to get the sta->supp_rates while * in this running context */ rate_mask = IL_RATES_MASK_3945; rate_mask = RATES_MASK_3945; /* Set retry limit on DATA packets and Probe Responses*/ if (ieee80211_is_probe_resp(fc)) Loading Loading @@ -1330,7 +1330,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, /* use this channel group's 6Mbit clipping/saturation pwr, * but cap at regulatory scan power restriction (set during init * based on eeprom channel data) for this channel. */ power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); power = min(ch_info->scan_power, clip_pwrs[RATE_6M_INDEX_TABLE]); power = min(power, il->tx_power_user_lmt); scan_power_info->requested_power = power; Loading @@ -1342,7 +1342,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, * *index*. */ power_index = ch_info->power_info[rate_index].power_table_index - (power - ch_info->power_info [IL_RATE_6M_INDEX_TABLE].requested_power) * 2; [RATE_6M_INDEX_TABLE].requested_power) * 2; /* store reference index that we use when adjusting *all* scan * powers. So we can accommodate user (all channel) or spectrum Loading Loading @@ -1466,7 +1466,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il, power_info = ch_info->power_info; /* update OFDM Txpower settings */ for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE; i++, ++power_info) { int delta_idx; Loading @@ -1490,14 +1490,14 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il, * ... all CCK power settings for a given channel are the *same*. */ if (power_changed) { power = ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. ch_info->power_info[RATE_12M_INDEX_TABLE]. requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; /* do all CCK rates' il3945_channel_power_info structures */ for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) { for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_TABLE; i++) { power_info->requested_power = power; power_info->base_power_index = ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. ch_info->power_info[RATE_12M_INDEX_TABLE]. base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF; ++power_info; } Loading Loading @@ -1574,7 +1574,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) ref_temp); /* set tx power value for all rates, OFDM and CCK */ for (rate_index = 0; rate_index < IL_RATE_COUNT_3945; for (rate_index = 0; rate_index < RATE_COUNT_3945; rate_index++) { int power_idx = ch_info->power_info[rate_index].base_power_index; Loading @@ -1597,7 +1597,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) for (scan_tbl_index = 0; scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE; il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); Loading Loading @@ -2010,21 +2010,21 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il) /* fill in channel group's nominal powers for each rate */ for (rate_index = 0; rate_index < IL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { rate_index < RATE_COUNT_3945; rate_index++, clip_pwrs++) { switch (rate_index) { case IL_RATE_36M_INDEX_TABLE: case RATE_36M_INDEX_TABLE: if (i == 0) /* B/G */ *clip_pwrs = satur_pwr; else /* A */ *clip_pwrs = satur_pwr - 5; break; case IL_RATE_48M_INDEX_TABLE: case RATE_48M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 7; else *clip_pwrs = satur_pwr - 10; break; case IL_RATE_54M_INDEX_TABLE: case RATE_54M_INDEX_TABLE: if (i == 0) *clip_pwrs = satur_pwr - 9; else Loading Loading @@ -2139,7 +2139,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il) } /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ pwr_info = &ch_info->power_info[IL_RATE_12M_INDEX_TABLE]; pwr_info = &ch_info->power_info[RATE_12M_INDEX_TABLE]; power = pwr_info->requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; pwr_index = pwr_info->power_table_index + Loading Loading @@ -2169,7 +2169,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il) for (scan_tbl_index = 0; scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE; il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } Loading Loading @@ -2289,7 +2289,7 @@ static int il3945_manage_ibss_station(struct il_priv *il, il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, (il->band == IEEE80211_BAND_5GHZ) ? IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); RATE_6M_PLCP : RATE_1M_PLCP); il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); return 0; Loading Loading @@ -2326,17 +2326,17 @@ int il3945_init_hw_rate_table(struct il_priv *il) D_RATE("Select A mode rate scale\n"); /* If one of the following CCK rates is used, * have it fall back to the 6M OFDM rate */ for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_TABLE; i++) table[i].next_rate_index = il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; /* Don't fall back to CCK rates */ table[IL_RATE_12M_INDEX_TABLE].next_rate_index = IL_RATE_9M_INDEX_TABLE; table[RATE_12M_INDEX_TABLE].next_rate_index = RATE_9M_INDEX_TABLE; /* Don't drop out of OFDM rates */ table[IL_RATE_6M_INDEX_TABLE].next_rate_index = table[RATE_6M_INDEX_TABLE].next_rate_index = il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; break; Loading @@ -2349,14 +2349,14 @@ int il3945_init_hw_rate_table(struct il_priv *il) il_is_associated(il)) { index = IL_FIRST_CCK_RATE; for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; i++) for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE; i++) table[i].next_rate_index = il3945_rates[index].table_rs_index; index = IL_RATE_11M_INDEX_TABLE; index = RATE_11M_INDEX_TABLE; /* CCK shouldn't fall back to OFDM... */ table[index].next_rate_index = IL_RATE_5M_INDEX_TABLE; table[index].next_rate_index = RATE_5M_INDEX_TABLE; } break; Loading
drivers/net/wireless/iwlegacy/iwl-3945.h +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ struct il3945_rs_sta { u8 flush_pending; u8 start_rate; struct timer_list rate_scale_flush; struct il3945_rate_scale_data win[IL_RATE_COUNT_3945]; struct il3945_rate_scale_data win[RATE_COUNT_3945]; #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_stats_table_file; #endif Loading Loading @@ -300,7 +300,7 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); void il3945_post_scan(struct il_priv *il); /* rates */ extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945]; extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; /* Requires full declaration of il_priv before including */ #include "iwl-io.h" Loading
drivers/net/wireless/iwlegacy/iwl-4965-lib.c +4 −4 Original line number Diff line number Diff line Loading @@ -423,7 +423,7 @@ int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) } else { if (band == IEEE80211_BAND_5GHZ) band_offset = IL_FIRST_OFDM_RATE; for (idx = band_offset; idx < IL_RATE_COUNT_LEGACY; idx++) for (idx = band_offset; idx < RATE_COUNT_LEGACY; idx++) if (il_rates[idx].plcp == (rate_n_flags & 0xFF)) return idx - band_offset; } Loading Loading @@ -870,14 +870,14 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) RXON_FLG_CHANNEL_MODE_MSK) >> RXON_FLG_CHANNEL_MODE_POS; if (chan_mod == CHANNEL_MODE_PURE_40) { rate = IL_RATE_6M_PLCP; rate = RATE_6M_PLCP; } else { rate = IL_RATE_1M_PLCP; rate = RATE_1M_PLCP; rate_flags = RATE_MCS_CCK_MSK; } break; case IEEE80211_BAND_5GHZ: rate = IL_RATE_6M_PLCP; rate = RATE_6M_PLCP; break; default: IL_WARN("Invalid scan band\n"); Loading