Skip to contentSkip to conversation

mlxsw: spectrum_cnt: Fix 64-bit division in mlxsw_sp_counter_resources_register

PATCH Applied Nathan Chancellor 3 participants 3 messages Mar 20, 2020 – Mar 24, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlxsw: spectrum_cnt: Fix 64-bit division in mlxsw_sp_counter_resources_register

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by spectrum_cnt.c
net/ethernet/mellanox/mlxsw/spectrum_cnt.o:(mlxsw_sp_counter_resources_register) in archive drivers/built-in.a
did you mean: __aeabi_uidivmod
defined in: arch/arm/lib/lib.a(lib1funcs.o)

pool_size and bank_size are u64; use div64_u64 so that 32-bit platforms do not error.

Fixes ab8c4cc60420 ("mlxsw: spectrum_cnt: Move config validation along with resource register")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c +1 -1
index 0268f0a6662a..7974982533b5 100644
@@ -303,7 +303,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core)
 	}
 
 	/* Check config is valid, no bank over subscription */
-	if (WARN_ON(total_bank_config > pool_size / bank_size + 1))
+	if (WARN_ON(total_bank_config > div64_u64(pool_size, bank_size) + 1))
 		return -EINVAL;
 
 	return 0;
Signature · 1 line
2.26.0.rc1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Fri, Mar 20, 2020 at 03:16:38AM CET, [email protected] wrote:

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by spectrum_cnt.c
net/ethernet/mellanox/mlxsw/spectrum_cnt.o:(mlxsw_sp_counter_resources_register) in archive drivers/built-in.a
did you mean: __aeabi_uidivmod
defined in: arch/arm/lib/lib.a(lib1funcs.o)

Quoted 5 lines

pool_size and bank_size are u64; use div64_u64 so that 32-bit platforms do not error.

Fixes ab8c4cc60420 ("mlxsw: spectrum_cnt: Move config validation along with resource register")

Thanks!

maintainer Applied
#2 lore raw
In reply to Nathan Chancellor

From: Nathan Chancellor <[email protected]>
Date: Thu, 19 Mar 2020 19:16:38 -0700

Quoted 8 lines

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by spectrum_cnt.c
net/ethernet/mellanox/mlxsw/spectrum_cnt.o:(mlxsw_sp_counter_resources_register) in archive drivers/built-in.a
did you mean: __aeabi_uidivmod
defined in: arch/arm/lib/lib.a(lib1funcs.o)

Quoted 5 lines

pool_size and bank_size are u64; use div64_u64 so that 32-bit platforms do not error.

Fixes ab8c4cc60420 ("mlxsw: spectrum_cnt: Move config validation along with resource register")

Applied to net-next.

Please be clear about the intended target GIT tree for your changes in the Subject line in the future, thank you.