[cc Vishwanath Pai]
On 27.09.2016 11:42, Maciej Żenczykowski wrote:
>> Please just use do_div here and go back to the first version of the
>> patch. Variable names could be more aligned with the RFC maybe?
>
> So I tried:
>
> static inline s32 rfc3315_s14_backoff_init(s32 irt)
> {
> /* multiply 'initial retransmission time' by 0.9 .. 1.1 */
> u64 tmp = (900000 + prandom_u32() % 200001) * (u64)irt;
> do_div(tmp, 1000000);
> return (s32)tmp;
> }
>
> static inline s32 rfc3315_s14_backoff_update(s32 rt, s32 mrt)
> {
> /* multiply 'retransmission timeout' by 1.9 .. 2.1 */
> u64 tmp = (1900000 + prandom_u32() % 200001) * (u64)rt;
> do_div(tmp, 1000000);
> if ((s32)tmp > mrt) {
> /* multiply 'maximum retransmission time' by 0.9 .. 1.1 */
> tmp = (900000 + prandom_u32() % 200001) * (u64)mrt;
> do_div(tmp, 1000000);
> }
> return (s32)tmp;
> }
>
> but then building for i386 I get:
>
> ERROR: "__udivdi3" [net/netfilter/xt_hashlimit.ko] undefined!
Hmm, evidently we have some u64 divisions in xt_hashlimit.c which should
be replaced by do_div?