1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _XT_RATEEST_H
3 #define _XT_RATEEST_H
4 
5 #include <net/gen_stats.h>
6 
7 struct xt_rateest {
8 	/* keep lock and bstats on same cache line to speedup xt_rateest_tg() */
9 	struct gnet_stats_basic_packed	bstats;
10 	spinlock_t			lock;
11 
12 
13 	/* following fields not accessed in hot path */
14 	unsigned int			refcnt;
15 	struct hlist_node		list;
16 	char				name[IFNAMSIZ];
17 	struct gnet_estimator		params;
18 	struct rcu_head			rcu;
19 
20 	/* keep this field far away to speedup xt_rateest_mt() */
21 	struct net_rate_estimator __rcu *rate_est;
22 };
23 
24 struct xt_rateest *xt_rateest_lookup(struct net *net, const char *name);
25 void xt_rateest_put(struct net *net, struct xt_rateest *est);
26 
27 #endif /* _XT_RATEEST_H */
28