diff options
-rw-r--r-- | net/mac80211/rc80211_pid_algo.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index b84e51480c84..3e26280d3142 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -74,29 +74,27 @@ static int rate_control_pid_shift_adjust(struct rc_pid_rateinfo *r, | |||
74 | { | 74 | { |
75 | int i, j, k, tmp; | 75 | int i, j, k, tmp; |
76 | 76 | ||
77 | if (cur + adj < 0) | 77 | j = r[cur].rev_index; |
78 | return 0; | 78 | i = j + adj; |
79 | if (cur + adj >= l) | ||
80 | return l - 1; | ||
81 | 79 | ||
82 | i = r[cur + adj].rev_index; | 80 | if (i < 0) |
81 | return r[0].index; | ||
82 | if (i >= l - 1) | ||
83 | return r[l - 1].index; | ||
83 | 84 | ||
84 | j = r[cur].rev_index; | 85 | tmp = i; |
85 | 86 | ||
86 | if (adj < 0) { | 87 | if (adj < 0) { |
87 | tmp = i; | 88 | for (k = j; k >= i; k--) |
88 | for (k = j; k >= i; k--) | 89 | if (r[k].diff <= r[j].diff) |
89 | if (r[k].diff <= r[j].diff) | 90 | tmp = k; |
90 | tmp = k; | 91 | } else { |
91 | return r[tmp].index; | 92 | for (k = i + 1; k + i < l; k++) |
92 | } else if (adj > 0) { | 93 | if (r[k].diff <= r[i].diff) |
93 | tmp = i; | 94 | tmp = k; |
94 | for (k = i + 1; k + i < l; k++) | ||
95 | if (r[k].diff <= r[i].diff) | ||
96 | tmp = k; | ||
97 | return r[tmp].index; | ||
98 | } | 95 | } |
99 | return cur + adj; | 96 | |
97 | return r[tmp].index; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | static void rate_control_pid_adjust_rate(struct ieee80211_local *local, | 100 | static void rate_control_pid_adjust_rate(struct ieee80211_local *local, |