Lines Matching refs:est

78 	struct net_rate_estimator *est = from_timer(est, t, timer);  in est_timer()  local
83 est_fetch_counters(est, &b); in est_timer()
87 brate = (b_bytes - est->last_bytes) << (10 - est->intvl_log); in est_timer()
88 brate = (brate >> est->ewma_log) - (est->avbps >> est->ewma_log); in est_timer()
90 rate = (b_packets - est->last_packets) << (10 - est->intvl_log); in est_timer()
91 rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log); in est_timer()
93 write_seqcount_begin(&est->seq); in est_timer()
94 est->avbps += brate; in est_timer()
95 est->avpps += rate; in est_timer()
96 write_seqcount_end(&est->seq); in est_timer()
98 est->last_bytes = b_bytes; in est_timer()
99 est->last_packets = b_packets; in est_timer()
101 est->next_jiffies += ((HZ/4) << est->intvl_log); in est_timer()
103 if (unlikely(time_after_eq(jiffies, est->next_jiffies))) { in est_timer()
105 est->next_jiffies = jiffies + 1; in est_timer()
107 mod_timer(&est->timer, est->next_jiffies); in est_timer()
138 struct net_rate_estimator *old, *est; in gen_new_estimator() local
155 est = kzalloc(sizeof(*est), GFP_KERNEL); in gen_new_estimator()
156 if (!est) in gen_new_estimator()
159 seqcount_init(&est->seq); in gen_new_estimator()
161 est->bstats = bstats; in gen_new_estimator()
162 est->stats_lock = lock; in gen_new_estimator()
163 est->running = running; in gen_new_estimator()
164 est->ewma_log = parm->ewma_log; in gen_new_estimator()
165 est->intvl_log = intvl_log; in gen_new_estimator()
166 est->cpu_bstats = cpu_bstats; in gen_new_estimator()
170 est_fetch_counters(est, &b); in gen_new_estimator()
173 est->last_bytes = u64_stats_read(&b.bytes); in gen_new_estimator()
174 est->last_packets = u64_stats_read(&b.packets); in gen_new_estimator()
181 est->avbps = old->avbps; in gen_new_estimator()
182 est->avpps = old->avpps; in gen_new_estimator()
185 est->next_jiffies = jiffies + ((HZ/4) << intvl_log); in gen_new_estimator()
186 timer_setup(&est->timer, est_timer, 0); in gen_new_estimator()
187 mod_timer(&est->timer, est->next_jiffies); in gen_new_estimator()
189 rcu_assign_pointer(*rate_est, est); in gen_new_estimator()
207 struct net_rate_estimator *est; in gen_kill_estimator() local
209 est = xchg((__force struct net_rate_estimator **)rate_est, NULL); in gen_kill_estimator()
210 if (est) { in gen_kill_estimator()
211 del_timer_sync(&est->timer); in gen_kill_estimator()
212 kfree_rcu(est, rcu); in gen_kill_estimator()
259 struct net_rate_estimator *est; in gen_estimator_read() local
263 est = rcu_dereference(*rate_est); in gen_estimator_read()
264 if (!est) { in gen_estimator_read()
270 seq = read_seqcount_begin(&est->seq); in gen_estimator_read()
271 sample->bps = est->avbps >> 8; in gen_estimator_read()
272 sample->pps = est->avpps >> 8; in gen_estimator_read()
273 } while (read_seqcount_retry(&est->seq, seq)); in gen_estimator_read()