Loading drivers/net/wireless/iwlegacy/iwl-3945-hw.h +3 −3 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ /* * Mapping of a Tx power level, at factory calibration temperature, * to a radio/DSP gain table index. * to a radio/DSP gain table idx. * One for each of 5 "sample" power levels in each band. * v_det is measured at the factory, using the 3945's built-in power amplifier * (PA) output voltage detector. This same detector is used during Tx of Loading @@ -91,13 +91,13 @@ * DO NOT ALTER THIS STRUCTURE!!! */ struct il3945_eeprom_txpower_sample { u8 gain_index; /* index into power (gain) setup table ... */ u8 gain_idx; /* idx into power (gain) setup table ... */ s8 power; /* ... for this pwr level for this chnl group */ u16 v_det; /* PA output voltage */ } __packed; /* * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. * Mappings of Tx power levels -> nominal radio/DSP gain table idxes. * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). * Tx power setup code interpolates between the 5 "sample" power levels * to determine the nominal setup for a requested power level. Loading drivers/net/wireless/iwlegacy/iwl-3945-rs.c +55 −55 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = { struct il3945_tpt_entry { s8 min_rssi; u8 index; u8 idx; }; static struct il3945_tpt_entry il3945_tpt_table_a[] = { Loading Loading @@ -98,9 +98,9 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = { #define RATE_DECREASE_TH 1920 #define RATE_RETRY_TH 15 static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) { u32 index = 0; u32 idx = 0; u32 table_size = 0; struct il3945_tpt_entry *tpt_table = NULL; Loading @@ -123,12 +123,12 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) break; } while (index < table_size && rssi < tpt_table[index].min_rssi) index++; while (idx < table_size && rssi < tpt_table[idx].min_rssi) idx++; index = min(index, (table_size - 1)); idx = min(idx, (table_size - 1)); return tpt_table[index].index; return tpt_table[idx].idx; } static void il3945_clear_win(struct il3945_rate_scale_data *win) Loading Loading @@ -168,7 +168,7 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) if (time_after(jiffies, rs_sta->win[i].stamp + RATE_WIN_FLUSH)) { D_RATE("flushing %d samples of rate " "index %d\n", "idx %d\n", rs_sta->win[i].counter, i); il3945_clear_win(&rs_sta->win[i]); } else Loading Loading @@ -256,7 +256,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) */ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, struct il3945_rate_scale_data *win, int success, int retries, int index) int success, int retries, int idx) { unsigned long flags; s32 fail_count; Loading Loading @@ -318,7 +318,7 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, if (fail_count >= RATE_MIN_FAILURE_TH || win->success_counter >= RATE_MIN_SUCCESS_TH) win->average_tpt = ((win->success_ratio * rs_sta->expected_tpt[index] + 64) / 128); rs_sta->expected_tpt[idx] + 64) / 128); else win->average_tpt = IL_INVALID_VALUE; Loading Loading @@ -447,7 +447,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * struct sk_buff *skb) { s8 retries = 0, current_count; int scale_rate_index, first_index, last_index; int scale_rate_idx, first_idx, last_idx; unsigned long flags; struct il_priv *il = (struct il_priv *)il_rate; struct il3945_rs_sta *rs_sta = il_sta; Loading @@ -460,9 +460,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * if (retries > RATE_RETRY_TH) retries = RATE_RETRY_TH; first_index = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_index < 0 || first_index >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_index); first_idx = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_idx < 0 || first_idx >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_idx); return; } Loading @@ -480,8 +480,8 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * rs_sta->tx_packets++; scale_rate_index = first_index; last_index = first_index; scale_rate_idx = first_idx; last_idx = first_idx; /* * Update the win for each rate. We determine which rates Loading @@ -489,42 +489,42 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * * of retries configured for each rate -- currently set to the * il value 'retry_rate' vs. rate specific * * On exit from this while loop last_index indicates the rate * On exit from this while loop last_idx indicates the rate * at which the frame was finally transmitted (or failed if no * ACK) */ while (retries > 1) { if ((retries - 1) < il->retry_rate) { current_count = (retries - 1); last_index = scale_rate_index; last_idx = scale_rate_idx; } else { current_count = il->retry_rate; last_index = il3945_rs_next_rate(il, scale_rate_index); last_idx = il3945_rs_next_rate(il, scale_rate_idx); } /* Update this rate accounting for as many retries * as was used for it (per current_count) */ il3945_collect_tx_data(rs_sta, &rs_sta->win[scale_rate_index], 0, current_count, scale_rate_index); &rs_sta->win[scale_rate_idx], 0, current_count, scale_rate_idx); D_RATE("Update rate %d for %d retries.\n", scale_rate_index, current_count); scale_rate_idx, current_count); retries -= current_count; scale_rate_index = last_index; scale_rate_idx = last_idx; } /* Update the last index 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", last_index, last_idx, (info->flags & IEEE80211_TX_STAT_ACK) ? "success" : "failure"); il3945_collect_tx_data(rs_sta, &rs_sta->win[last_index], info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); &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 * flush_time since the last run, schedule the flush Loading @@ -547,7 +547,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * } static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 index, u16 rate_mask, enum ieee80211_band band) u8 idx, u16 rate_mask, enum ieee80211_band band) { u8 high = RATE_INVALID; u8 low = RATE_INVALID; Loading @@ -560,7 +560,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u32 mask; /* Find the previous rate that is in the rate mask */ i = index - 1; i = idx - 1; for (mask = (1 << i); i >= 0; i--, mask >>= 1) { if (rate_mask & mask) { low = i; Loading @@ -569,7 +569,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } /* Find the next rate that is in the rate mask */ i = index + 1; i = idx + 1; for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) { if (rate_mask & mask) { Loading @@ -581,7 +581,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, return (high << 8) | low; } low = index; low = idx; while (low != RATE_INVALID) { if (rs_sta->tgg) low = il3945_rates[low].prev_rs_tgg; Loading @@ -594,7 +594,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, D_RATE("Skipping masked lower rate: %d\n", low); } high = index; high = idx; while (high != RATE_INVALID) { if (rs_sta->tgg) high = il3945_rates[high].next_rs_tgg; Loading Loading @@ -622,7 +622,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, * the entire A/B/G spectrum vs. being limited to just one particular * hw_mode. * * As such, we can't convert the index obtained below into the hw_mode's * As such, we can't convert the idx obtained below into the hw_mode's * rate table and must reference the driver allocated rate table * */ Loading @@ -634,7 +634,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, u8 low = RATE_INVALID; u8 high = RATE_INVALID; u16 high_low; int index; int idx; struct il3945_rs_sta *rs_sta = il_sta; struct il3945_rate_scale_data *win = NULL; int current_tpt = IL_INVALID_VALUE; Loading Loading @@ -668,7 +668,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) max_rate_idx = -1; index = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1); idx = 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 @@ -679,19 +679,19 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, * to rssi value */ if (rs_sta->start_rate != RATE_INVALID) { if (rs_sta->start_rate < index && if (rs_sta->start_rate < idx && (rate_mask & (1 << rs_sta->start_rate))) index = rs_sta->start_rate; idx = rs_sta->start_rate; rs_sta->start_rate = RATE_INVALID; } /* force user max rate if set by user */ if (max_rate_idx != -1 && max_rate_idx < index) { if (max_rate_idx != -1 && max_rate_idx < idx) { if (rate_mask & (1 << max_rate_idx)) index = max_rate_idx; idx = max_rate_idx; } win = &(rs_sta->win[index]); win = &(rs_sta->win[idx]); fail_count = win->counter - win->success_counter; Loading @@ -702,7 +702,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, D_RATE("Invalid average_tpt on rate %d: " "counter: %d, success_counter: %d, " "expected_tpt is %sNULL\n", index, idx, win->counter, win->success_counter, rs_sta->expected_tpt ? "not " : ""); Loading @@ -715,7 +715,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, current_tpt = win->average_tpt; high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask, high_low = il3945_get_adjacent_rate(rs_sta, idx, rate_mask, sband->band); low = high_low & 0xff; high = (high_low >> 8) & 0xff; Loading Loading @@ -800,13 +800,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* Decrese rate */ if (low != RATE_INVALID) index = low; idx = low; break; case 1: /* Increase rate */ if (high != RATE_INVALID) index = high; idx = high; break; Loading @@ -817,21 +817,21 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, } D_RATE("Selected %d (action %d) - low %d high %d\n", index, scale_action, low, high); idx, scale_action, low, high); out: if (sband->band == IEEE80211_BAND_5GHZ) { if (WARN_ON_ONCE(index < IL_FIRST_OFDM_RATE)) index = IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx = index; info->control.rates[0].idx = index - IL_FIRST_OFDM_RATE; if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE)) idx = IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx = idx; info->control.rates[0].idx = idx - IL_FIRST_OFDM_RATE; } else { rs_sta->last_txrate_idx = index; rs_sta->last_txrate_idx = idx; info->control.rates[0].idx = rs_sta->last_txrate_idx; } D_RATE("leave: %d\n", index); D_RATE("leave: %d\n", idx); } #ifdef CONFIG_MAC80211_DEBUGFS Loading @@ -855,7 +855,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, if (!buff) return -ENOMEM; desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n" desc += sprintf(buff + desc, "tx packets=%d last rate idx=%d\n" "rate=0x%X flush time %d\n", lq_sta->tx_packets, lq_sta->last_txrate_idx, Loading Loading @@ -977,9 +977,9 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) D_RATE("Network RSSI: %d\n", rssi); rs_sta->start_rate = il3945_get_rate_index_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 index: " D_RATE("leave: rssi %d assign rate idx: " "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, il3945_rates[rs_sta->start_rate].plcp); rcu_read_unlock(); Loading drivers/net/wireless/iwlegacy/iwl-3945.c +157 −157 File changed.Preview size limit exceeded, changes collapsed. Show changes drivers/net/wireless/iwlegacy/iwl-4965-hw.h +18 −18 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. * Do not exceed regulatory limit; reduce target txpower if necessary. * * If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), * If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), * 2 transmitters will be used simultaneously; driver must reduce the * regulatory limit by 3 dB (half-power) for each transmitter, so the * combined total output of the 2 transmitters is within regulatory limits. Loading Loading @@ -269,7 +269,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * be used (although only one at a time) even for non-MIMO transmissions. * * Driver should interpolate factory values for temperature, gain table * index, and actual power. The power amplifier detector values are * idx, and actual power. The power amplifier detector values are * not used by the driver. * * Sanity check: If the target channel happens to be one of the sample Loading @@ -278,13 +278,13 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * * 5) Find difference between desired txpower and (interpolated) * factory-measured txpower. Using (interpolated) factory gain table index * (shown elsewhere) as a starting point, adjust this index lower to * factory-measured txpower. Using (interpolated) factory gain table idx * (shown elsewhere) as a starting point, adjust this idx lower to * increase txpower, or higher to decrease txpower, until the target * txpower is reached. Each step in the gain table is 1/2 dB. * * For example, if factory measured txpower is 16 dBm, and target txpower * is 13 dBm, add 6 steps to the factory gain index to reduce txpower * is 13 dBm, add 6 steps to the factory gain idx to reduce txpower * by 3 dB. * * Loading @@ -294,7 +294,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * "4965 temperature calculation". * * If current temperature is higher than factory temperature, driver must * increase gain (lower gain table index), and vice verse. * increase gain (lower gain table idx), and vice verse. * * Temperature affects gain differently for different channels: * Loading @@ -313,16 +313,16 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * indicator (EEPROM). * * If the current voltage is higher (indicator is lower) than factory * voltage, gain should be reduced (gain table index increased) by: * voltage, gain should be reduced (gain table idx increased) by: * * (eeprom - current) / 7 * * If the current voltage is lower (indicator is higher) than factory * voltage, gain should be increased (gain table index decreased) by: * voltage, gain should be increased (gain table idx decreased) by: * * 2 * (current - eeprom) / 7 * * If number of index steps in either direction turns out to be > 2, * If number of idx steps in either direction turns out to be > 2, * something is wrong ... just use 0. * * NOTE: Voltage compensation is independent of band/channel. Loading @@ -333,7 +333,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * may be calculated once and used until the next uCode bootload. * * * 8) If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), * 8) If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), * adjust txpower for each transmitter chain, so txpower is balanced * between the two chains. There are 5 pairs of tx_atten[group][chain] * values in "initialize alive", one pair for each of 5 channel ranges: Loading @@ -344,7 +344,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * Group 3: 5 GHz channel 125-200 * Group 4: 2.4 GHz all channels * * Add the tx_atten[group][chain] value to the index for the target chain. * Add the tx_atten[group][chain] value to the idx for the target chain. * The values are signed, but are in pairs of 0 and a non-negative number, * so as to reduce gain (if necessary) of the "hotter" channel. This * avoids any need to double-check for regulatory compliance after Loading @@ -352,7 +352,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation * value to the index: * value to the idx: * * Hardware rev B: 9 steps (4.5 dB) * Hardware rev C: 5 steps (2.5 dB) Loading @@ -366,7 +366,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * 10) Select the gain table, based on band (2.4 vs 5 GHz). * * Limit the adjusted index to stay within the table! * Limit the adjusted idx to stay within the table! * * * 11) Read gain table entries for DSP and radio gain, place into appropriate Loading @@ -389,7 +389,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * When calculating txpowers for CCK, after making sure that the target power * is within regulatory and saturation limits, driver must additionally * back off gain by adding these values to the gain table index. * back off gain by adding these values to the gain table idx. * * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, * bits [3:2], 1 = B, 2 = C. Loading Loading @@ -428,9 +428,9 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * driver work with the same table). * * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table * has an extension (into negative indexes), in case the driver needs to * has an extension (into negative idxes), in case the driver needs to * boost power setting for high device temperatures (higher than would be * present during factory calibration). A 5 Ghz EEPROM index of "40" * present during factory calibration). A 5 Ghz EEPROM idx of "40" * corresponds to the 49th entry in the table used by the driver. */ #define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */ Loading Loading @@ -778,8 +778,8 @@ enum { * * When driver sets up a new TFD, it must also enter the total byte count * of the frame to be transmitted into the corresponding entry in the byte * count table for the chosen Tx queue. If the TFD index is 0-63, the driver * must duplicate the byte count entry in corresponding index 256-319. * count table for the chosen Tx queue. If the TFD idx is 0-63, the driver * must duplicate the byte count entry in corresponding idx 256-319. * * padding puts each byte count table on a 1024-byte boundary; * 4965 assumes tables are separated by 1024 bytes. Loading drivers/net/wireless/iwlegacy/iwl-4965-lib.c +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq) /* Stop Rx DMA */ il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); /* Reset driver's Rx queue write index */ /* Reset driver's Rx queue write idx */ il_wr(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); /* Tell device where to find RBD circular buffer in DRAM */ Loading Loading @@ -222,7 +222,7 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il, * and we have free pre-allocated buffers, fill the ranks as much * as we can, pulling from rx_free. * * This moves the 'write' index forward to catch up with 'processed', and * This moves the 'write' idx forward to catch up with 'processed', and * also updates the memory address in the firmware to reference the new * target buffer. */ Loading Loading
drivers/net/wireless/iwlegacy/iwl-3945-hw.h +3 −3 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ /* * Mapping of a Tx power level, at factory calibration temperature, * to a radio/DSP gain table index. * to a radio/DSP gain table idx. * One for each of 5 "sample" power levels in each band. * v_det is measured at the factory, using the 3945's built-in power amplifier * (PA) output voltage detector. This same detector is used during Tx of Loading @@ -91,13 +91,13 @@ * DO NOT ALTER THIS STRUCTURE!!! */ struct il3945_eeprom_txpower_sample { u8 gain_index; /* index into power (gain) setup table ... */ u8 gain_idx; /* idx into power (gain) setup table ... */ s8 power; /* ... for this pwr level for this chnl group */ u16 v_det; /* PA output voltage */ } __packed; /* * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. * Mappings of Tx power levels -> nominal radio/DSP gain table idxes. * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). * Tx power setup code interpolates between the 5 "sample" power levels * to determine the nominal setup for a requested power level. Loading
drivers/net/wireless/iwlegacy/iwl-3945-rs.c +55 −55 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = { struct il3945_tpt_entry { s8 min_rssi; u8 index; u8 idx; }; static struct il3945_tpt_entry il3945_tpt_table_a[] = { Loading Loading @@ -98,9 +98,9 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = { #define RATE_DECREASE_TH 1920 #define RATE_RETRY_TH 15 static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) { u32 index = 0; u32 idx = 0; u32 table_size = 0; struct il3945_tpt_entry *tpt_table = NULL; Loading @@ -123,12 +123,12 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) break; } while (index < table_size && rssi < tpt_table[index].min_rssi) index++; while (idx < table_size && rssi < tpt_table[idx].min_rssi) idx++; index = min(index, (table_size - 1)); idx = min(idx, (table_size - 1)); return tpt_table[index].index; return tpt_table[idx].idx; } static void il3945_clear_win(struct il3945_rate_scale_data *win) Loading Loading @@ -168,7 +168,7 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) if (time_after(jiffies, rs_sta->win[i].stamp + RATE_WIN_FLUSH)) { D_RATE("flushing %d samples of rate " "index %d\n", "idx %d\n", rs_sta->win[i].counter, i); il3945_clear_win(&rs_sta->win[i]); } else Loading Loading @@ -256,7 +256,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) */ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, struct il3945_rate_scale_data *win, int success, int retries, int index) int success, int retries, int idx) { unsigned long flags; s32 fail_count; Loading Loading @@ -318,7 +318,7 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, if (fail_count >= RATE_MIN_FAILURE_TH || win->success_counter >= RATE_MIN_SUCCESS_TH) win->average_tpt = ((win->success_ratio * rs_sta->expected_tpt[index] + 64) / 128); rs_sta->expected_tpt[idx] + 64) / 128); else win->average_tpt = IL_INVALID_VALUE; Loading Loading @@ -447,7 +447,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * struct sk_buff *skb) { s8 retries = 0, current_count; int scale_rate_index, first_index, last_index; int scale_rate_idx, first_idx, last_idx; unsigned long flags; struct il_priv *il = (struct il_priv *)il_rate; struct il3945_rs_sta *rs_sta = il_sta; Loading @@ -460,9 +460,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * if (retries > RATE_RETRY_TH) retries = RATE_RETRY_TH; first_index = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_index < 0 || first_index >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_index); first_idx = sband->bitrates[info->status.rates[0].idx].hw_value; if (first_idx < 0 || first_idx >= RATE_COUNT_3945) { D_RATE("leave: Rate out of bounds: %d\n", first_idx); return; } Loading @@ -480,8 +480,8 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * rs_sta->tx_packets++; scale_rate_index = first_index; last_index = first_index; scale_rate_idx = first_idx; last_idx = first_idx; /* * Update the win for each rate. We determine which rates Loading @@ -489,42 +489,42 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * * of retries configured for each rate -- currently set to the * il value 'retry_rate' vs. rate specific * * On exit from this while loop last_index indicates the rate * On exit from this while loop last_idx indicates the rate * at which the frame was finally transmitted (or failed if no * ACK) */ while (retries > 1) { if ((retries - 1) < il->retry_rate) { current_count = (retries - 1); last_index = scale_rate_index; last_idx = scale_rate_idx; } else { current_count = il->retry_rate; last_index = il3945_rs_next_rate(il, scale_rate_index); last_idx = il3945_rs_next_rate(il, scale_rate_idx); } /* Update this rate accounting for as many retries * as was used for it (per current_count) */ il3945_collect_tx_data(rs_sta, &rs_sta->win[scale_rate_index], 0, current_count, scale_rate_index); &rs_sta->win[scale_rate_idx], 0, current_count, scale_rate_idx); D_RATE("Update rate %d for %d retries.\n", scale_rate_index, current_count); scale_rate_idx, current_count); retries -= current_count; scale_rate_index = last_index; scale_rate_idx = last_idx; } /* Update the last index 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", last_index, last_idx, (info->flags & IEEE80211_TX_STAT_ACK) ? "success" : "failure"); il3945_collect_tx_data(rs_sta, &rs_sta->win[last_index], info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); &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 * flush_time since the last run, schedule the flush Loading @@ -547,7 +547,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band * } static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 index, u16 rate_mask, enum ieee80211_band band) u8 idx, u16 rate_mask, enum ieee80211_band band) { u8 high = RATE_INVALID; u8 low = RATE_INVALID; Loading @@ -560,7 +560,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u32 mask; /* Find the previous rate that is in the rate mask */ i = index - 1; i = idx - 1; for (mask = (1 << i); i >= 0; i--, mask >>= 1) { if (rate_mask & mask) { low = i; Loading @@ -569,7 +569,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, } /* Find the next rate that is in the rate mask */ i = index + 1; i = idx + 1; for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) { if (rate_mask & mask) { Loading @@ -581,7 +581,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, return (high << 8) | low; } low = index; low = idx; while (low != RATE_INVALID) { if (rs_sta->tgg) low = il3945_rates[low].prev_rs_tgg; Loading @@ -594,7 +594,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, D_RATE("Skipping masked lower rate: %d\n", low); } high = index; high = idx; while (high != RATE_INVALID) { if (rs_sta->tgg) high = il3945_rates[high].next_rs_tgg; Loading Loading @@ -622,7 +622,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, * the entire A/B/G spectrum vs. being limited to just one particular * hw_mode. * * As such, we can't convert the index obtained below into the hw_mode's * As such, we can't convert the idx obtained below into the hw_mode's * rate table and must reference the driver allocated rate table * */ Loading @@ -634,7 +634,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, u8 low = RATE_INVALID; u8 high = RATE_INVALID; u16 high_low; int index; int idx; struct il3945_rs_sta *rs_sta = il_sta; struct il3945_rate_scale_data *win = NULL; int current_tpt = IL_INVALID_VALUE; Loading Loading @@ -668,7 +668,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) max_rate_idx = -1; index = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1); idx = 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 @@ -679,19 +679,19 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, * to rssi value */ if (rs_sta->start_rate != RATE_INVALID) { if (rs_sta->start_rate < index && if (rs_sta->start_rate < idx && (rate_mask & (1 << rs_sta->start_rate))) index = rs_sta->start_rate; idx = rs_sta->start_rate; rs_sta->start_rate = RATE_INVALID; } /* force user max rate if set by user */ if (max_rate_idx != -1 && max_rate_idx < index) { if (max_rate_idx != -1 && max_rate_idx < idx) { if (rate_mask & (1 << max_rate_idx)) index = max_rate_idx; idx = max_rate_idx; } win = &(rs_sta->win[index]); win = &(rs_sta->win[idx]); fail_count = win->counter - win->success_counter; Loading @@ -702,7 +702,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, D_RATE("Invalid average_tpt on rate %d: " "counter: %d, success_counter: %d, " "expected_tpt is %sNULL\n", index, idx, win->counter, win->success_counter, rs_sta->expected_tpt ? "not " : ""); Loading @@ -715,7 +715,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, current_tpt = win->average_tpt; high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask, high_low = il3945_get_adjacent_rate(rs_sta, idx, rate_mask, sband->band); low = high_low & 0xff; high = (high_low >> 8) & 0xff; Loading Loading @@ -800,13 +800,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, /* Decrese rate */ if (low != RATE_INVALID) index = low; idx = low; break; case 1: /* Increase rate */ if (high != RATE_INVALID) index = high; idx = high; break; Loading @@ -817,21 +817,21 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, } D_RATE("Selected %d (action %d) - low %d high %d\n", index, scale_action, low, high); idx, scale_action, low, high); out: if (sband->band == IEEE80211_BAND_5GHZ) { if (WARN_ON_ONCE(index < IL_FIRST_OFDM_RATE)) index = IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx = index; info->control.rates[0].idx = index - IL_FIRST_OFDM_RATE; if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE)) idx = IL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx = idx; info->control.rates[0].idx = idx - IL_FIRST_OFDM_RATE; } else { rs_sta->last_txrate_idx = index; rs_sta->last_txrate_idx = idx; info->control.rates[0].idx = rs_sta->last_txrate_idx; } D_RATE("leave: %d\n", index); D_RATE("leave: %d\n", idx); } #ifdef CONFIG_MAC80211_DEBUGFS Loading @@ -855,7 +855,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file, if (!buff) return -ENOMEM; desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n" desc += sprintf(buff + desc, "tx packets=%d last rate idx=%d\n" "rate=0x%X flush time %d\n", lq_sta->tx_packets, lq_sta->last_txrate_idx, Loading Loading @@ -977,9 +977,9 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) D_RATE("Network RSSI: %d\n", rssi); rs_sta->start_rate = il3945_get_rate_index_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 index: " D_RATE("leave: rssi %d assign rate idx: " "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, il3945_rates[rs_sta->start_rate].plcp); rcu_read_unlock(); Loading
drivers/net/wireless/iwlegacy/iwl-3945.c +157 −157 File changed.Preview size limit exceeded, changes collapsed. Show changes
drivers/net/wireless/iwlegacy/iwl-4965-hw.h +18 −18 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. * Do not exceed regulatory limit; reduce target txpower if necessary. * * If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), * If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), * 2 transmitters will be used simultaneously; driver must reduce the * regulatory limit by 3 dB (half-power) for each transmitter, so the * combined total output of the 2 transmitters is within regulatory limits. Loading Loading @@ -269,7 +269,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * be used (although only one at a time) even for non-MIMO transmissions. * * Driver should interpolate factory values for temperature, gain table * index, and actual power. The power amplifier detector values are * idx, and actual power. The power amplifier detector values are * not used by the driver. * * Sanity check: If the target channel happens to be one of the sample Loading @@ -278,13 +278,13 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * * 5) Find difference between desired txpower and (interpolated) * factory-measured txpower. Using (interpolated) factory gain table index * (shown elsewhere) as a starting point, adjust this index lower to * factory-measured txpower. Using (interpolated) factory gain table idx * (shown elsewhere) as a starting point, adjust this idx lower to * increase txpower, or higher to decrease txpower, until the target * txpower is reached. Each step in the gain table is 1/2 dB. * * For example, if factory measured txpower is 16 dBm, and target txpower * is 13 dBm, add 6 steps to the factory gain index to reduce txpower * is 13 dBm, add 6 steps to the factory gain idx to reduce txpower * by 3 dB. * * Loading @@ -294,7 +294,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * "4965 temperature calculation". * * If current temperature is higher than factory temperature, driver must * increase gain (lower gain table index), and vice verse. * increase gain (lower gain table idx), and vice verse. * * Temperature affects gain differently for different channels: * Loading @@ -313,16 +313,16 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * indicator (EEPROM). * * If the current voltage is higher (indicator is lower) than factory * voltage, gain should be reduced (gain table index increased) by: * voltage, gain should be reduced (gain table idx increased) by: * * (eeprom - current) / 7 * * If the current voltage is lower (indicator is higher) than factory * voltage, gain should be increased (gain table index decreased) by: * voltage, gain should be increased (gain table idx decreased) by: * * 2 * (current - eeprom) / 7 * * If number of index steps in either direction turns out to be > 2, * If number of idx steps in either direction turns out to be > 2, * something is wrong ... just use 0. * * NOTE: Voltage compensation is independent of band/channel. Loading @@ -333,7 +333,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * may be calculated once and used until the next uCode bootload. * * * 8) If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), * 8) If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), * adjust txpower for each transmitter chain, so txpower is balanced * between the two chains. There are 5 pairs of tx_atten[group][chain] * values in "initialize alive", one pair for each of 5 channel ranges: Loading @@ -344,7 +344,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * Group 3: 5 GHz channel 125-200 * Group 4: 2.4 GHz all channels * * Add the tx_atten[group][chain] value to the index for the target chain. * Add the tx_atten[group][chain] value to the idx for the target chain. * The values are signed, but are in pairs of 0 and a non-negative number, * so as to reduce gain (if necessary) of the "hotter" channel. This * avoids any need to double-check for regulatory compliance after Loading @@ -352,7 +352,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation * value to the index: * value to the idx: * * Hardware rev B: 9 steps (4.5 dB) * Hardware rev C: 5 steps (2.5 dB) Loading @@ -366,7 +366,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * 10) Select the gain table, based on band (2.4 vs 5 GHz). * * Limit the adjusted index to stay within the table! * Limit the adjusted idx to stay within the table! * * * 11) Read gain table entries for DSP and radio gain, place into appropriate Loading @@ -389,7 +389,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * * When calculating txpowers for CCK, after making sure that the target power * is within regulatory and saturation limits, driver must additionally * back off gain by adding these values to the gain table index. * back off gain by adding these values to the gain table idx. * * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, * bits [3:2], 1 = B, 2 = C. Loading Loading @@ -428,9 +428,9 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr) * driver work with the same table). * * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table * has an extension (into negative indexes), in case the driver needs to * has an extension (into negative idxes), in case the driver needs to * boost power setting for high device temperatures (higher than would be * present during factory calibration). A 5 Ghz EEPROM index of "40" * present during factory calibration). A 5 Ghz EEPROM idx of "40" * corresponds to the 49th entry in the table used by the driver. */ #define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */ Loading Loading @@ -778,8 +778,8 @@ enum { * * When driver sets up a new TFD, it must also enter the total byte count * of the frame to be transmitted into the corresponding entry in the byte * count table for the chosen Tx queue. If the TFD index is 0-63, the driver * must duplicate the byte count entry in corresponding index 256-319. * count table for the chosen Tx queue. If the TFD idx is 0-63, the driver * must duplicate the byte count entry in corresponding idx 256-319. * * padding puts each byte count table on a 1024-byte boundary; * 4965 assumes tables are separated by 1024 bytes. Loading
drivers/net/wireless/iwlegacy/iwl-4965-lib.c +2 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq) /* Stop Rx DMA */ il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); /* Reset driver's Rx queue write index */ /* Reset driver's Rx queue write idx */ il_wr(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); /* Tell device where to find RBD circular buffer in DRAM */ Loading Loading @@ -222,7 +222,7 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il, * and we have free pre-allocated buffers, fill the ranks as much * as we can, pulling from rx_free. * * This moves the 'write' index forward to catch up with 'processed', and * This moves the 'write' idx forward to catch up with 'processed', and * also updates the memory address in the firmware to reference the new * target buffer. */ Loading