From: Mattias Nissler <mattias.nissler@gmx.de>
To: Bob Copeland <me@bobcopeland.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
stefano.brivio@polimi.it
Subject: Re: [PATCH 1/2] mac80211: fix sign error in pid controller
Date: Sun, 17 Jan 2010 23:49:13 +0100 [thread overview]
Message-ID: <1263768553.3402.9.camel@kea> (raw)
In-Reply-To: <1263670613-10864-2-git-send-email-me@bobcopeland.com>
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
On Sat, 2010-01-16 at 14:36 -0500, Bob Copeland wrote:
> While testing the pid rate controller in mac80211_hwsim, I noticed
> that once the controller reached 54 Mbit rates, it would fail to
> lower the rate when necessary. The debug log shows:
>
> 1945 186786 pf_sample 50 3534 3577 50
>
> My interpretation is that the fixed point scaling of the target
> error value (pf) is incorrect: the error value of 50 compared to
> a target of 14 case should result in a scaling value of
> (14-50) = -36 * 256 or -9216, but instead it is (14 * 256)-50, or
> 3534.
>
> Correct this by doing fixed point scaling after subtraction.
>
> Cc: stefano.brivio@polimi.it
> Cc: mattias.nissler@gmx.de
> Signed-off-by: Bob Copeland <me@bobcopeland.com>
I took a quick look and found that you're right. pf is an unscaled
value, so we should subtract it before scaling.
Acked-by: Mattias Nissler <mattias.nissler@gmx.de>
> ---
>
> Mattias / Stefano, please advise if I missed something.
>
> net/mac80211/rc80211_pid_algo.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
> index 699d3ed..29bc4c5 100644
> --- a/net/mac80211/rc80211_pid_algo.c
> +++ b/net/mac80211/rc80211_pid_algo.c
> @@ -190,7 +190,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
> rate_control_pid_normalize(pinfo, sband->n_bitrates);
>
> /* Compute the proportional, integral and derivative errors. */
> - err_prop = (pinfo->target << RC_PID_ARITH_SHIFT) - pf;
> + err_prop = (pinfo->target - pf) << RC_PID_ARITH_SHIFT;
>
> err_avg = spinfo->err_avg_sc >> pinfo->smoothing_shift;
> spinfo->err_avg_sc = spinfo->err_avg_sc - err_avg + err_prop;
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2010-01-17 22:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-16 19:36 [PATCH 0/2] PID controller fixes Bob Copeland
2010-01-16 19:36 ` [PATCH 1/2] mac80211: fix sign error in pid controller Bob Copeland
2010-01-16 21:35 ` Stefano Brivio
2010-01-17 22:49 ` Mattias Nissler [this message]
2010-01-16 19:36 ` [PATCH 2/2] mac80211: pid: replace open-coded msecs_to_jiffies Bob Copeland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263768553.3402.9.camel@kea \
--to=mattias.nissler@gmx.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=me@bobcopeland.com \
--cc=stefano.brivio@polimi.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).