From: Ido Schimmel <idosch@idosch.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
jakub.kicinski@netronome.com, jiri@mellanox.com,
petrm@mellanox.com, mlxsw@mellanox.com,
Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 2/2] mlxsw: spectrum_buffers: Calculate the size of the main pool
Date: Wed, 30 Oct 2019 09:57:51 +0200 [thread overview]
Message-ID: <20191030075751.GA16499@splinter> (raw)
In-Reply-To: <20191030033154.GA43266@ubuntu-m2-xlarge-x86>
On Tue, Oct 29, 2019 at 08:31:54PM -0700, Nathan Chancellor wrote:
> On Wed, Oct 23, 2019 at 09:05:00AM +0300, Ido Schimmel wrote:
> > static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp,
> > const struct mlxsw_sp_sb_pr *prs,
> > + const struct mlxsw_sp_sb_pool_des *pool_dess,
> > size_t prs_len)
> > {
> > + /* Round down, unlike mlxsw_sp_bytes_cells(). */
> > + u32 sb_cells = mlxsw_sp->sb->sb_size / mlxsw_sp->sb->cell_size;
>
> This causes a link time error on arm32. It can be simply reproduced with
> the following configs + multi_v7_defconfig:
>
> CONFIG_MLXSW_CORE=y
> CONFIG_MLXSW_PCI=y
> CONFIG_NET_SWITCHDEV=y
> CONFIG_VLAN_8021Q=y
> CONFIG_MLXSW_SPECTRUM=y
>
> arm-linux-gnueabi-ld: drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.o: in function `mlxsw_sp_buffers_init':
> spectrum_buffers.c:(.text+0x1c88): undefined reference to `__aeabi_uldivmod'
>
> It can be solved by something like this but I am not sure if that is
> proper or not since div_u64 returns a u64, which would implicitly get
> converted to u32. I can submit it as a formal patch if needed but I
> figured I would reach out first in case you want to go in a different
> direction.
Yes, this looks fine to me. The value can fit in a u32. Tested on my
system without issues.
Thanks for reaching out
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
> index 33a978af80d6..968f0902e4fe 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
> @@ -470,7 +470,7 @@ static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp,
> size_t prs_len)
> {
> /* Round down, unlike mlxsw_sp_bytes_cells(). */
> - u32 sb_cells = mlxsw_sp->sb->sb_size / mlxsw_sp->sb->cell_size;
> + u32 sb_cells = div_u64(mlxsw_sp->sb->sb_size, mlxsw_sp->sb->cell_size);
> u32 rest_cells[2] = {sb_cells, sb_cells};
> int i;
> int err;
next prev parent reply other threads:[~2019-10-30 7:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 6:04 [PATCH net-next 0/2] mlxsw: Update main pool computation and pool size limits Ido Schimmel
2019-10-23 6:04 ` [PATCH net-next 1/2] mlxsw: spectrum: Use guaranteed buffer size as pool size limit Ido Schimmel
2019-10-23 6:05 ` [PATCH net-next 2/2] mlxsw: spectrum_buffers: Calculate the size of the main pool Ido Schimmel
2019-10-30 3:31 ` Nathan Chancellor
2019-10-30 7:57 ` Ido Schimmel [this message]
2019-10-24 4:31 ` [PATCH net-next 0/2] mlxsw: Update main pool computation and pool size limits David Miller
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=20191030075751.GA16499@splinter \
--to=idosch@idosch.org \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@mellanox.com \
--cc=mlxsw@mellanox.com \
--cc=natechancellor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.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 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).