From: Nathan Chancellor <natechancellor@gmail.com>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Jiri Pirko <jiri@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
"David S. Miller" <davem@davemloft.net>,
Petr Machata <petrm@mellanox.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mlxsw: spectrum_qdisc: Fix 64-bit division error in mlxsw_sp_qdisc_tbf_rate_kbps
Date: Thu, 30 Jan 2020 18:48:16 -0700 [thread overview]
Message-ID: <20200131014816.GA54472@ubuntu-x2-xlarge-x86> (raw)
In-Reply-To: <31537c12-8f17-660d-256d-e702d1121367@infradead.org>
On Thu, Jan 30, 2020 at 05:43:56PM -0800, Randy Dunlap wrote:
> On 1/30/20 3:26 PM, Nathan Chancellor wrote:
> > When building arm32 allmodconfig:
> >
> > ERROR: "__aeabi_uldivmod"
> > [drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko] undefined!
> >
> > rate_bytes_ps has type u64, we need to use a 64-bit division helper to
> > avoid a build error.
> >
> > Fixes: a44f58c41bfb ("mlxsw: spectrum_qdisc: Support offloading of TBF Qdisc")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
> > index 79a2801d59f6..65e681ef01e8 100644
> > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
> > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
> > @@ -614,7 +614,7 @@ mlxsw_sp_qdisc_tbf_rate_kbps(struct tc_tbf_qopt_offload_replace_params *p)
> > /* TBF interface is in bytes/s, whereas Spectrum ASIC is configured in
> > * Kbits/s.
> > */
> > - return p->rate.rate_bytes_ps / 1000 * 8;
> > + return div_u64(p->rate.rate_bytes_ps, 1000 * 8);
>
> not quite right AFAICT.
>
> try either
> return div_u64(p->rate.rate_bytes_ps * 8, 1000);
> or
> return div_u64(p->rate.rate_bytes_ps, 1000) * 8;
>
Gah, I swear I can math... Thank you for catching this, v2 incoming with
the later because I think it looks better.
Cheers,
Nathan
> > }
> >
> > static int
> >
>
>
> --
> ~Randy
>
next prev parent reply other threads:[~2020-01-31 1:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 23:26 [PATCH] mlxsw: spectrum_qdisc: Fix 64-bit division error in mlxsw_sp_qdisc_tbf_rate_kbps Nathan Chancellor
2020-01-31 1:43 ` Randy Dunlap
2020-01-31 1:48 ` Nathan Chancellor [this message]
2020-02-03 10:03 ` Petr Machata
2020-01-31 1:51 ` [PATCH v2] " Nathan Chancellor
2020-01-31 13:47 ` Ido Schimmel
2020-01-31 14:27 ` Jiri Pirko
2020-01-31 16:55 ` Jakub Kicinski
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=20200131014816.GA54472@ubuntu-x2-xlarge-x86 \
--to=natechancellor@gmail.com \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.com \
--cc=rdunlap@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox