Skip to content

Commit

Permalink
mlxsw: spectrum_cnt: Fix 64-bit division in mlxsw_sp_counter_resource…
Browse files Browse the repository at this point in the history
…s_register

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> 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: ab8c4cc ("mlxsw: spectrum_cnt: Move config validation along with resource register")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nathan Chancellor authored and David S. Miller committed Mar 24, 2020
1 parent 0dfb2d8 commit c31f0ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c31f0ea

Please sign in to comment.