[B.A.T.M.A.N.] [PATCH-maint] batman-adv: Replace gw_reselect 64 bit div with shift

Marek Lindner mareklindner at neomailbox.ch
Fri Jul 10 10:12:29 CEST 2015


On Monday, June 22, 2015 09:13:23 Sven Eckelmann wrote:
> The 64-bit gw_factor is divided by BATADV_TQ_LOCAL_WINDOW_SIZE ** 2 * 64.
> But the rest of the calculation has nothing to do with the tq window size
> end therefore the calculation is just (tmp_gw_factor / (64 ** 3)).
> 
> The problem with 64 bit div is that it doesn't work on systems without
> native 64 bit div support. It has to be emulated using do_div or div_u64.
> The change in f63c54bba31d ("batman-adv: Avoid u32 overflow during gateway
> select") only compiled on such systems because the compiler converted the
> div to a (tmp_gw_factor >> 18). Making this explicit avoids having build
> problems in the future when BATADV_TQ_LOCAL_WINDOW_SIZE is changed in such
> a way that (BATADV_TQ_LOCAL_WINDOW_SIZE ** 2 * 64) is not a power of two.
> 
> Signed-off-by: Sven Eckelmann <sven at narfation.org>
> ---
>  gateway_client.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Applied in revision 013aab3.

Thanks,
Marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n/attachments/20150710/1d8830e8/attachment.sig>


More information about the B.A.T.M.A.N mailing list