* [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init
@ 2019-10-30 16:01 Nathan Chancellor
2019-10-31 6:12 ` Ido Schimmel
2019-10-31 20:56 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2019-10-30 16:01 UTC (permalink / raw)
To: Jiri Pirko, Ido Schimmel, David S. Miller
Cc: netdev, linux-kernel, Nathan Chancellor
When building for 32-bit ARM, there is a link time error because of a
64-bit division:
ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> referenced by spectrum_buffers.c
>>> net/ethernet/mellanox/mlxsw/spectrum_buffers.o:(mlxsw_sp_buffers_init) in archive drivers/built-in.a
>>> did you mean: __aeabi_uidivmod
>>> defined in: arch/arm/lib/lib.a(lib1funcs.o
Avoid this by using div_u64, which is designed to avoid this problem.
Fixes: bc9f6e94bcb5 ("mlxsw: spectrum_buffers: Calculate the size of the main pool")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.24.0.rc1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init
2019-10-30 16:01 [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init Nathan Chancellor
@ 2019-10-31 6:12 ` Ido Schimmel
2019-10-31 20:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2019-10-31 6:12 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Jiri Pirko, David S. Miller, netdev, linux-kernel
On Wed, Oct 30, 2019 at 09:01:52AM -0700, Nathan Chancellor wrote:
> When building for 32-bit ARM, there is a link time error because of a
> 64-bit division:
>
> ld.lld: error: undefined symbol: __aeabi_uldivmod
> >>> referenced by spectrum_buffers.c
> >>> net/ethernet/mellanox/mlxsw/spectrum_buffers.o:(mlxsw_sp_buffers_init) in archive drivers/built-in.a
> >>> did you mean: __aeabi_uidivmod
> >>> defined in: arch/arm/lib/lib.a(lib1funcs.o
>
> Avoid this by using div_u64, which is designed to avoid this problem.
>
> Fixes: bc9f6e94bcb5 ("mlxsw: spectrum_buffers: Calculate the size of the main pool")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Thanks, Nathan!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init
2019-10-30 16:01 [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init Nathan Chancellor
2019-10-31 6:12 ` Ido Schimmel
@ 2019-10-31 20:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-10-31 20:56 UTC (permalink / raw)
To: natechancellor; +Cc: jiri, idosch, netdev, linux-kernel
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Wed, 30 Oct 2019 09:01:52 -0700
> When building for 32-bit ARM, there is a link time error because of a
> 64-bit division:
>
> ld.lld: error: undefined symbol: __aeabi_uldivmod
>>>> referenced by spectrum_buffers.c
>>>> net/ethernet/mellanox/mlxsw/spectrum_buffers.o:(mlxsw_sp_buffers_init) in archive drivers/built-in.a
>>>> did you mean: __aeabi_uidivmod
>>>> defined in: arch/arm/lib/lib.a(lib1funcs.o
>
> Avoid this by using div_u64, which is designed to avoid this problem.
>
> Fixes: bc9f6e94bcb5 ("mlxsw: spectrum_buffers: Calculate the size of the main pool")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-31 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 16:01 [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init Nathan Chancellor
2019-10-31 6:12 ` Ido Schimmel
2019-10-31 20:56 ` David Miller
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).