- return r[tmp].index;
-}
-
-static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
- struct sta_info *sta, int adj,
- struct rc_pid_rateinfo *rinfo)
-{
- struct ieee80211_sub_if_data *sdata;
- struct ieee80211_supported_band *sband;
- int newidx;
- int maxrate;
- int back = (adj > 0) ? 1 : -1;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
- maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
-
- newidx = rate_control_pid_shift_adjust(rinfo, adj, sta->txrate_idx,
- sband->n_bitrates);
-
- while (newidx != sta->txrate_idx) {
- if (rate_supported(sta, sband->band, newidx) &&
- (maxrate < 0 || newidx <= maxrate)) {
- sta->txrate_idx = newidx;
+ /* Fit the rate found to the nearest supported rate. */
+ do {
+ if (rate_supported(sta, band, rinfo[tmp].index)) {
+ spinfo->txrate_idx = rinfo[tmp].index;