12 #include <linux/netdevice.h>
13 #include <linux/types.h>
16 #include <linux/slab.h>
77 int cur_sorted, new_sorted, probe,
tmp, n_bitrates, band;
85 new_sorted = cur_sorted + adj;
90 else if (new_sorted >= n_bitrates)
91 new_sorted = rinfo[n_bitrates - 1].
rev_index;
97 for (probe = cur_sorted; probe >= new_sorted; probe--)
98 if (rinfo[probe].diff <= rinfo[cur_sorted].diff &&
99 rate_supported(sta, band, rinfo[probe].
index))
103 for (probe = new_sorted + 1; probe < n_bitrates; probe++)
104 if (rinfo[probe].diff <= rinfo[new_sorted].diff &&
105 rate_supported(sta, band, rinfo[probe].
index))
111 if (rate_supported(sta, band, rinfo[tmp].
index)) {
119 }
while (tmp < n_bitrates && tmp >= 0);
121 #ifdef CONFIG_MAC80211_DEBUGFS
134 if (r[0].
diff > norm_offset)
135 r[0].
diff -= norm_offset;
136 else if (r[0].
diff < -norm_offset)
137 r[0].
diff += norm_offset;
138 for (i = 0; i < l - 1; i++)
139 if (r[i + 1].
diff > r[i].
diff + norm_offset)
140 r[i + 1].
diff -= norm_offset;
141 else if (r[i + 1].
diff <= r[i].
diff)
142 r[i + 1].
diff += norm_offset;
145 static void rate_control_pid_sample(
struct rc_pid_info *pinfo,
189 rate_control_pid_normalize(pinfo, sband->
n_bitrates);
198 err_der = (pf - spinfo->
last_pf) *
204 #ifdef CONFIG_MAC80211_DEBUGFS
216 rate_control_pid_adjust_rate(sband, sta, spinfo, adj, rinfo);
238 #ifdef CONFIG_MAC80211_DEBUGFS
248 }
else if (info->
status.rates[0].count > 1) {
256 rate_control_pid_sample(pinfo, sband, sta, spinfo);
260 rate_control_pid_get_rate(
void *priv,
struct ieee80211_sta *sta,
272 txrc->
hw->conf.long_frame_max_tx_count;
275 txrc->
hw->conf.short_frame_max_tx_count;
286 info->
control.rates[0].idx = rateidx;
288 #ifdef CONFIG_MAC80211_DEBUGFS
290 rateidx, sband->
bitrates[rateidx].bitrate);
336 spinfo->
txrate_idx = rate_lowest_index(sband, sta);
340 struct dentry *debugfsdir)
345 int i, max_rates = 0;
346 #ifdef CONFIG_MAC80211_DEBUGFS
355 sband = hw->
wiphy->bands[
i];
375 pinfo->
rinfo = rinfo;
378 #ifdef CONFIG_MAC80211_DEBUGFS
379 de = &pinfo->dentries;
381 debugfsdir, &pinfo->
target);
408 static void rate_control_pid_free(
void *priv)
411 #ifdef CONFIG_MAC80211_DEBUGFS
429 static void *rate_control_pid_alloc_sta(
void *priv,
struct ieee80211_sta *sta,
434 spinfo = kzalloc(
sizeof(*spinfo), gfp);
440 #ifdef CONFIG_MAC80211_DEBUGFS
448 static void rate_control_pid_free_sta(
void *priv,
struct ieee80211_sta *sta,
456 .tx_status = rate_control_pid_tx_status,
457 .get_rate = rate_control_pid_get_rate,
458 .rate_init = rate_control_pid_rate_init,
459 .alloc = rate_control_pid_alloc,
460 .free = rate_control_pid_free,
461 .alloc_sta = rate_control_pid_alloc_sta,
462 .free_sta = rate_control_pid_free_sta,
463 #ifdef CONFIG_MAC80211_DEBUGFS