Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fa44327c06492c9bd625dbc8dbe35e5d5965fec6 Commit: fa44327c06492c9bd625dbc8dbe35e5d5965fec6 Parent: ca5fbca924b845863ab9da00ac90b3384445f497 Author: Stefano Brivio <[EMAIL PROTECTED]> AuthorDate: Sun Dec 23 04:41:19 2007 +0100 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Mon Jan 28 15:00:52 2008 -0800
rc80211-pid: simplify and fix shift_adjust Simplify and fix rate_control_pid_shift_adjust(). A bug prevented correct mapping of sorted rates, and readability was seriously flawed. Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]> Signed-off-by: John W. Linville <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- 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 b84e514..3e26280 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, { int i, j, k, tmp; - if (cur + adj < 0) - return 0; - if (cur + adj >= l) - return l - 1; + j = r[cur].rev_index; + i = j + adj; - i = r[cur + adj].rev_index; + if (i < 0) + return r[0].index; + if (i >= l - 1) + return r[l - 1].index; - j = r[cur].rev_index; + tmp = i; if (adj < 0) { - tmp = i; - for (k = j; k >= i; k--) - if (r[k].diff <= r[j].diff) - tmp = k; - return r[tmp].index; - } else if (adj > 0) { - tmp = i; - for (k = i + 1; k + i < l; k++) - if (r[k].diff <= r[i].diff) - tmp = k; - return r[tmp].index; + for (k = j; k >= i; k--) + if (r[k].diff <= r[j].diff) + tmp = k; + } else { + for (k = i + 1; k + i < l; k++) + if (r[k].diff <= r[i].diff) + tmp = k; } - return cur + adj; + + return r[tmp].index; } static void rate_control_pid_adjust_rate(struct ieee80211_local *local, - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html