Message ID | 1322731934.2335.12.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 01 Dec 2011 10:32:14 +0100, Eric Dumazet wrote: > ERROR: "__udivdi3" [net/sched/sch_netem.ko] undefined! > > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Hagen Paul Pfeifer <hagen@jauu.net> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> + u64 ticks = (u64)len * NSEC_PER_SEC;
Writing:
u64 ticks = len * (u64)NSEC_PER_SEC;
probably generates better code since the compiler
is much more likely to spot that a single 32x32 -> 64
multiply is adequate.
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Le jeudi 01 décembre 2011 à 11:04 +0000, David Laight a écrit : > > + u64 ticks = (u64)len * NSEC_PER_SEC; > Writing: > u64 ticks = len * (u64)NSEC_PER_SEC; > probably generates better code since the compiler > is much more likely to spot that a single 32x32 -> 64 > multiply is adequate. > Your copy if gcc is very dumb then :) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 01 Dec 2011 10:32:14 +0100 > ERROR: "__udivdi3" [net/sched/sch_netem.ko] undefined! > > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 9b7af9f..3bfd733 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -301,7 +301,10 @@ static psched_tdiff_t tabledist(psched_tdiff_t mu, psched_tdiff_t sigma, static psched_time_t packet_len_2_sched_time(unsigned int len, u32 rate) { - return PSCHED_NS2TICKS((u64)len * NSEC_PER_SEC / rate); + u64 ticks = (u64)len * NSEC_PER_SEC; + + do_div(ticks, rate); + return PSCHED_NS2TICKS(ticks); } /*
ERROR: "__udivdi3" [net/sched/sch_netem.ko] undefined! Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> --- net/sched/sch_netem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html