From: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
To: Pavel Roskin <proski@gnu.org>
Cc: Joe Perches <joe@perches.com>,
Arnd Hannemann <Arnd.Hannemann@nets.rwth-aachen.de>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] mac80211: Fix output of minstrels rc_stats
Date: Mon, 24 Aug 2009 20:36:27 +0200 [thread overview]
Message-ID: <4A92DDAB.6040503@nets.rwth-aachen.de> (raw)
In-Reply-To: <1251138015.13464.2.camel@mj>
Pavel Roskin schrieb:
> On Mon, 2009-08-24 at 10:57 -0700, Joe Perches wrote:
>> On Mon, 2009-08-24 at 19:42 +0200, Arnd Hannemann wrote:
>>> An integer overflow in the minstrel debug code prevented the
>>> throughput to be displayed correctly. This patch fixes that,
>>> by swaping the division and multiplication.
>>>
>>> Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
>>> ---
>>> net/mac80211/rc80211_minstrel_debugfs.c | 2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c
>>> index 98f4807..caf9453 100644
>>> --- a/net/mac80211/rc80211_minstrel_debugfs.c
>>> +++ b/net/mac80211/rc80211_minstrel_debugfs.c
>>> @@ -83,7 +83,7 @@ minstrel_stats_open(struct inode *inode, struct file *file)
>>> p += sprintf(p, "%3u%s", mr->bitrate / 2,
>>> (mr->bitrate & 1 ? ".5" : " "));
>>>
>>> - tp = ((mr->cur_tp * 96) / 18000) >> 10;
>>> + tp = ((mr->cur_tp / 18000) * 96) >> 10;
>> Maybe do_div instead?
>
> How about this?
>
> tp = mr->cur_tp / ((18000 << 10) / 96);
>
> ((18000 << 10) / 96) is exactly 192000.
>
Hmm don't seems to be equivalent with the original statement:
a = 61027734;
b = ((a * 96) / 18000) >> 10;
c = a / ((18000 << 10) / 96);
printf("%u %u\n", b, c);
Outputs:
84 317
Best regards,
Arnd
next prev parent reply other threads:[~2009-08-24 18:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-24 17:42 [PATCH] mac80211: Fix output of minstrels rc_stats Arnd Hannemann
2009-08-24 17:57 ` Joe Perches
2009-08-24 18:19 ` Arnd Hannemann
2009-08-24 18:20 ` Pavel Roskin
2009-08-24 18:36 ` Arnd Hannemann [this message]
2009-08-24 18:38 ` Arnd Hannemann
2009-08-24 18:51 ` [PATCH v2] " Arnd Hannemann
2009-09-01 0:54 ` Julian Calaby
2009-09-01 8:05 ` Arnd Hannemann
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=4A92DDAB.6040503@nets.rwth-aachen.de \
--to=hannemann@nets.rwth-aachen.de \
--cc=Arnd.Hannemann@nets.rwth-aachen.de \
--cc=joe@perches.com \
--cc=linux-wireless@vger.kernel.org \
--cc=proski@gnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.