hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/net/core/gen_estimator.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * 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.
84 *
95 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
106 * Eric Dumazet <edumazet@google.com>
....@@ -46,13 +42,13 @@
4642 struct net_rate_estimator {
4743 struct gnet_stats_basic_packed *bstats;
4844 spinlock_t *stats_lock;
49
- net_seqlock_t *running;
45
+ seqcount_t *running;
5046 struct gnet_stats_basic_cpu __percpu *cpu_bstats;
5147 u8 ewma_log;
5248 u8 intvl_log; /* period : (250ms << intvl_log) */
5349
5450 seqcount_t seq;
55
- u32 last_packets;
51
+ u64 last_packets;
5652 u64 last_bytes;
5753
5854 u64 avpps;
....@@ -87,7 +83,7 @@
8783 brate = (b.bytes - est->last_bytes) << (10 - est->intvl_log);
8884 brate = (brate >> est->ewma_log) - (est->avbps >> est->ewma_log);
8985
90
- rate = (u64)(b.packets - est->last_packets) << (10 - est->intvl_log);
86
+ rate = (b.packets - est->last_packets) << (10 - est->intvl_log);
9187 rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log);
9288
9389 write_seqcount_begin(&est->seq);
....@@ -129,7 +125,7 @@
129125 struct gnet_stats_basic_cpu __percpu *cpu_bstats,
130126 struct net_rate_estimator __rcu **rate_est,
131127 spinlock_t *lock,
132
- net_seqlock_t *running,
128
+ seqcount_t *running,
133129 struct nlattr *opt)
134130 {
135131 struct gnet_estimator *parm = nla_data(opt);
....@@ -230,7 +226,7 @@
230226 struct gnet_stats_basic_cpu __percpu *cpu_bstats,
231227 struct net_rate_estimator __rcu **rate_est,
232228 spinlock_t *lock,
233
- net_seqlock_t *running, struct nlattr *opt)
229
+ seqcount_t *running, struct nlattr *opt)
234230 {
235231 return gen_new_estimator(bstats, cpu_bstats, rate_est,
236232 lock, running, opt);