.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * net/sched/gen_estimator.c Simple rate estimator. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or |
---|
5 | | - * modify it under the terms of the GNU General Public License |
---|
6 | | - * as published by the Free Software Foundation; either version |
---|
7 | | - * 2 of the License, or (at your option) any later version. |
---|
8 | 4 | * |
---|
9 | 5 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
---|
10 | 6 | * Eric Dumazet <edumazet@google.com> |
---|
.. | .. |
---|
46 | 42 | struct net_rate_estimator { |
---|
47 | 43 | struct gnet_stats_basic_packed *bstats; |
---|
48 | 44 | spinlock_t *stats_lock; |
---|
49 | | - net_seqlock_t *running; |
---|
| 45 | + seqcount_t *running; |
---|
50 | 46 | struct gnet_stats_basic_cpu __percpu *cpu_bstats; |
---|
51 | 47 | u8 ewma_log; |
---|
52 | 48 | u8 intvl_log; /* period : (250ms << intvl_log) */ |
---|
53 | 49 | |
---|
54 | 50 | seqcount_t seq; |
---|
55 | | - u32 last_packets; |
---|
| 51 | + u64 last_packets; |
---|
56 | 52 | u64 last_bytes; |
---|
57 | 53 | |
---|
58 | 54 | u64 avpps; |
---|
.. | .. |
---|
87 | 83 | brate = (b.bytes - est->last_bytes) << (10 - est->intvl_log); |
---|
88 | 84 | brate = (brate >> est->ewma_log) - (est->avbps >> est->ewma_log); |
---|
89 | 85 | |
---|
90 | | - rate = (u64)(b.packets - est->last_packets) << (10 - est->intvl_log); |
---|
| 86 | + rate = (b.packets - est->last_packets) << (10 - est->intvl_log); |
---|
91 | 87 | rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log); |
---|
92 | 88 | |
---|
93 | 89 | write_seqcount_begin(&est->seq); |
---|
.. | .. |
---|
129 | 125 | struct gnet_stats_basic_cpu __percpu *cpu_bstats, |
---|
130 | 126 | struct net_rate_estimator __rcu **rate_est, |
---|
131 | 127 | spinlock_t *lock, |
---|
132 | | - net_seqlock_t *running, |
---|
| 128 | + seqcount_t *running, |
---|
133 | 129 | struct nlattr *opt) |
---|
134 | 130 | { |
---|
135 | 131 | struct gnet_estimator *parm = nla_data(opt); |
---|
.. | .. |
---|
230 | 226 | struct gnet_stats_basic_cpu __percpu *cpu_bstats, |
---|
231 | 227 | struct net_rate_estimator __rcu **rate_est, |
---|
232 | 228 | spinlock_t *lock, |
---|
233 | | - net_seqlock_t *running, struct nlattr *opt) |
---|
| 229 | + seqcount_t *running, struct nlattr *opt) |
---|
234 | 230 | { |
---|
235 | 231 | return gen_new_estimator(bstats, cpu_bstats, rate_est, |
---|
236 | 232 | lock, running, opt); |
---|