Thread (64 messages) 64 messages, 7 authors, 2016-09-27

Re: [PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router solicitation backoff

flat view

From: Hannes Frederic Sowa <hidden>
Date: 2016-09-27 10:20:52

[cc Vishwanath Pai]

On 27.09.2016 11:42, Maciej Żenczykowski wrote:
quoted
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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help