Lines Matching defs:rs_sta
152 static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
157 struct iwl_priv *priv __maybe_unused = rs_sta->priv;
165 if (!rs_sta->win[i].counter)
168 spin_lock_irqsave(&rs_sta->lock, flags);
169 if (time_after(jiffies, rs_sta->win[i].stamp +
173 rs_sta->win[i].counter, i);
174 iwl3945_clear_window(&rs_sta->win[i]);
177 spin_unlock_irqrestore(&rs_sta->lock, flags);
189 struct iwl3945_rs_sta *rs_sta = (void *)data;
190 struct iwl_priv *priv __maybe_unused = rs_sta->priv;
197 unflushed = iwl3945_rate_scale_flush_windows(rs_sta);
199 spin_lock_irqsave(&rs_sta->lock, flags);
202 packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1;
204 rs_sta->last_tx_packets = rs_sta->tx_packets + 1;
208 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
228 rs_sta->flush_time = msecs_to_jiffies(duration);
233 mod_timer(&rs_sta->rate_scale_flush, jiffies +
234 rs_sta->flush_time);
236 rs_sta->last_partial_flush = jiffies;
238 rs_sta->flush_time = IWL_RATE_FLUSH;
239 rs_sta->flush_pending = 0;
244 rs_sta->last_flush = jiffies;
246 spin_unlock_irqrestore(&rs_sta->lock, flags);
258 static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
264 struct iwl_priv *priv __maybe_unused = rs_sta->priv;
271 spin_lock_irqsave(&rs_sta->lock, flags);
322 rs_sta->expected_tpt[index] + 64) / 128);
329 spin_unlock_irqrestore(&rs_sta->lock, flags);
341 struct iwl3945_rs_sta *rs_sta;
350 rs_sta = &psta->rs_sta;
353 rs_sta->priv = priv;
355 rs_sta->start_rate = IWL_RATE_INVALID;
358 rs_sta->expected_tpt = iwl3945_expected_tpt_b;
360 rs_sta->last_partial_flush = jiffies;
361 rs_sta->last_flush = jiffies;
362 rs_sta->flush_time = IWL_RATE_FLUSH;
363 rs_sta->last_tx_packets = 0;
365 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
366 rs_sta->rate_scale_flush.function = iwl3945_bg_rate_scale_flush;
369 iwl3945_clear_window(&rs_sta->win[i]);
378 rs_sta->last_txrate_idx = i;
386 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
410 struct iwl3945_rs_sta *rs_sta;
416 rs_sta = &psta->rs_sta;
418 spin_lock_init(&rs_sta->lock);
419 init_timer(&rs_sta->rate_scale_flush);
423 return rs_sta;
429 struct iwl3945_rs_sta *rs_sta = priv_sta;
436 del_timer_sync(&rs_sta->rate_scale_flush);
454 struct iwl3945_rs_sta *rs_sta = priv_sta;
476 if (!rs_sta->priv) {
482 rs_sta->tx_packets++;
509 iwl3945_collect_tx_data(rs_sta,
510 &rs_sta->win[scale_rate_index],
526 iwl3945_collect_tx_data(rs_sta,
527 &rs_sta->win[last_index],
533 spin_lock_irqsave(&rs_sta->lock, flags);
535 if (!rs_sta->flush_pending &&
536 time_after(jiffies, rs_sta->last_flush +
537 rs_sta->flush_time)) {
539 rs_sta->last_partial_flush = jiffies;
540 rs_sta->flush_pending = 1;
541 mod_timer(&rs_sta->rate_scale_flush,
542 jiffies + rs_sta->flush_time);
545 spin_unlock_irqrestore(&rs_sta->lock, flags);
550 static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
555 struct iwl_priv *priv __maybe_unused = rs_sta->priv;
587 if (rs_sta->tgg)
600 if (rs_sta->tgg)
639 struct iwl3945_rs_sta *rs_sta = priv_sta;
655 if (rs_sta && !rs_sta->priv) {
672 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1);
677 spin_lock_irqsave(&rs_sta->lock, flags);
682 if (rs_sta->start_rate != IWL_RATE_INVALID) {
683 if (rs_sta->start_rate < index &&
684 (rate_mask & (1 << rs_sta->start_rate)))
685 index = rs_sta->start_rate;
686 rs_sta->start_rate = IWL_RATE_INVALID;
695 window = &(rs_sta->win[index]);
701 spin_unlock_irqrestore(&rs_sta->lock, flags);
709 rs_sta->expected_tpt ? "not " : "");
719 high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask,
730 low_tpt = rs_sta->win[low].average_tpt;
733 high_tpt = rs_sta->win[high].average_tpt;
735 spin_unlock_irqrestore(&rs_sta->lock, flags);
796 (current_tpt > (100 * rs_sta->expected_tpt[low]))))
825 rs_sta->last_txrate_idx = index;
827 info->control.rates[0].idx = rs_sta->last_txrate_idx -
830 info->control.rates[0].idx = rs_sta->last_txrate_idx;
927 struct iwl3945_rs_sta *rs_sta;
944 rs_sta = &psta->rs_sta;
946 spin_lock_irqsave(&rs_sta->lock, flags);
948 rs_sta->tgg = 0;
953 rs_sta->tgg = 1;
954 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
956 rs_sta->expected_tpt = iwl3945_expected_tpt_g;
960 rs_sta->expected_tpt = iwl3945_expected_tpt_a;
967 spin_unlock_irqrestore(&rs_sta->lock, flags);
975 rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band);
978 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
979 iwl3945_rates[rs_sta->start_rate].plcp);