diff mbox

[net-next] netem: fix build error on 32bit arches

Message ID 1322731934.2335.12.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Dec. 1, 2011, 9:32 a.m. UTC
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

Comments

Hagen Paul Pfeifer Dec. 1, 2011, 9:46 a.m. UTC | #1
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
David Laight Dec. 1, 2011, 11:04 a.m. UTC | #2
> +	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
Eric Dumazet Dec. 1, 2011, 11:19 a.m. UTC | #3
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
David Miller Dec. 1, 2011, 5:46 p.m. UTC | #4
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 mbox

Patch

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);
 }
 
 /*