diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2009-05-26 01:47:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-26 01:47:01 -0400 |
commit | a1dcb6628b9489504a3be2515580fc4de891f94a (patch) | |
tree | b78b964c1264b43f1c2899a27c48daf1a254802d /net/core | |
parent | dfa9264fe1a0c1b46e11c6a4cd3251cd5e1afb71 (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>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/gen_estimator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 6d62d4618cfc..78e5bfc454ae 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -128,12 +128,12 @@ static void est_timer(unsigned long arg) | |||
128 | npackets = e->bstats->packets; | 128 | npackets = e->bstats->packets; |
129 | brate = (nbytes - e->last_bytes)<<(7 - idx); | 129 | brate = (nbytes - e->last_bytes)<<(7 - idx); |
130 | e->last_bytes = nbytes; | 130 | e->last_bytes = nbytes; |
131 | e->avbps += ((s64)(brate - e->avbps)) >> e->ewma_log; | 131 | e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log); |
132 | e->rate_est->bps = (e->avbps+0xF)>>5; | 132 | e->rate_est->bps = (e->avbps+0xF)>>5; |
133 | 133 | ||
134 | rate = (npackets - e->last_packets)<<(12 - idx); | 134 | rate = (npackets - e->last_packets)<<(12 - idx); |
135 | e->last_packets = npackets; | 135 | e->last_packets = npackets; |
136 | e->avpps += ((long)rate - (long)e->avpps) >> e->ewma_log; | 136 | e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log); |
137 | e->rate_est->pps = (e->avpps+0x1FF)>>10; | 137 | e->rate_est->pps = (e->avpps+0x1FF)>>10; |
138 | skip: | 138 | skip: |
139 | read_unlock(&est_lock); | 139 | read_unlock(&est_lock); |