aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2009-05-25 22:47:01 -0700
committerDavid S. Miller <davem@davemloft.net>2009-05-25 22:47:01 -0700
commita1dcb6628b9489504a3be2515580fc4de891f94a (patch)
treeb78b964c1264b43f1c2899a27c48daf1a254802d
parentdfa9264fe1a0c1b46e11c6a4cd3251cd5e1afb71 (diff)
pkt_sched: gen_estimator: Fix signed integers right-shifts.
Right-shifts of signed integers are implementation-defined so unportable. With feedback from: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/gen_estimator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 6d62d4618cf..78e5bfc454a 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -128,12 +128,12 @@ static void est_timer(unsigned long arg)
npackets = e->bstats->packets;
brate = (nbytes - e->last_bytes)<<(7 - idx);
e->last_bytes = nbytes;
- e->avbps += ((s64)(brate - e->avbps)) >> e->ewma_log;
+ e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log);
e->rate_est->bps = (e->avbps+0xF)>>5;
rate = (npackets - e->last_packets)<<(12 - idx);
e->last_packets = npackets;
- e->avpps += ((long)rate - (long)e->avpps) >> e->ewma_log;
+ e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log);
e->rate_est->pps = (e->avpps+0x1FF)>>10;
skip:
read_unlock(&est_lock);