From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yang Yingliang <yangyingliang@huawei.com>,
davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net] sch_tbf: use do_div() for 64-bit divide
Date: Thu, 12 Dec 2013 17:21:18 +0400 [thread overview]
Message-ID: <52A9B84E.9030301@cogentembedded.com> (raw)
In-Reply-To: <1386814923-56180-1-git-send-email-yangyingliang@huawei.com>
Hello.
On 12-12-2013 6:22, Yang Yingliang wrote:
> It's doing a 64-bit divide which is not supported
> on 32-bit architectures in psched_ns_t2l(). The
> correct way to do this is to use do_div().
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> net/sched/sch_tbf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> index a44928c..887e672 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -131,8 +131,10 @@ static u64 psched_ns_t2l(const struct psched_ratecfg *r,
>
> do_div(len, NSEC_PER_SEC);
>
> - if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
> - len = (len / 53) * 48;
> + if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) {
> + do_div(len, 53);
> + len = len * 48;
Why not simply len *= 48? You're coding in C, after all. :-)
WBR, Sergei
prev parent reply other threads:[~2013-12-12 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 2:22 [PATCH net] sch_tbf: use do_div() for 64-bit divide Yang Yingliang
2013-12-12 2:57 ` [PATCH resend " Yang Yingliang
2013-12-12 3:54 ` David Miller
2013-12-12 10:28 ` David Laight
2013-12-12 13:21 ` Sergei Shtylyov [this message]
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=52A9B84E.9030301@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=yangyingliang@huawei.com \
/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.