All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Joe Perches <joe@perches.com>
Cc: Arnd Hannemann <hannemann@nets.rwth-aachen.de>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: Fix output of minstrels rc_stats
Date: Mon, 24 Aug 2009 14:20:15 -0400	[thread overview]
Message-ID: <1251138015.13464.2.camel@mj> (raw)
In-Reply-To: <1251136676.3873.28.camel@Joe-Laptop.home>

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.

-- 
Regards,
Pavel Roskin

  parent reply	other threads:[~2009-08-24 18:20 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 [this message]
2009-08-24 18:36     ` Arnd Hannemann
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=1251138015.13464.2.camel@mj \
    --to=proski@gnu.org \
    --cc=hannemann@nets.rwth-aachen.de \
    --cc=joe@perches.com \
    --cc=linux-wireless@vger.kernel.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.