Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef _NET_DST_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _NET_DST_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/percpu_counter.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) struct dst_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) struct kmem_cachep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct net_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct sk_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct sock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct dst_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	unsigned short		family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	unsigned int		gc_thresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	int			(*gc)(struct dst_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct dst_entry *	(*check)(struct dst_entry *, __u32 cookie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	unsigned int		(*default_advmss)(const struct dst_entry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	unsigned int		(*mtu)(const struct dst_entry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	u32 *			(*cow_metrics)(struct dst_entry *, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	void			(*destroy)(struct dst_entry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	void			(*ifdown)(struct dst_entry *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 					  struct net_device *dev, int how);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	struct dst_entry *	(*negative_advice)(struct dst_entry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	void			(*link_failure)(struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	void			(*update_pmtu)(struct dst_entry *dst, struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 					       struct sk_buff *skb, u32 mtu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 					       bool confirm_neigh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	void			(*redirect)(struct dst_entry *dst, struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 					    struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	int			(*local_out)(struct net *net, struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	struct neighbour *	(*neigh_lookup)(const struct dst_entry *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 						struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 						const void *daddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	void			(*confirm_neigh)(const struct dst_entry *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 						 const void *daddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct kmem_cache	*kmem_cachep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct percpu_counter	pcpuc_entries ____cacheline_aligned_in_smp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline int dst_entries_get_fast(struct dst_ops *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return percpu_counter_read_positive(&dst->pcpuc_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline int dst_entries_get_slow(struct dst_ops *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	return percpu_counter_sum_positive(&dst->pcpuc_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define DST_PERCPU_COUNTER_BATCH 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static inline void dst_entries_add(struct dst_ops *dst, int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	percpu_counter_add_batch(&dst->pcpuc_entries, val,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 				 DST_PERCPU_COUNTER_BATCH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static inline int dst_entries_init(struct dst_ops *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	return percpu_counter_init(&dst->pcpuc_entries, 0, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static inline void dst_entries_destroy(struct dst_ops *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	percpu_counter_destroy(&dst->pcpuc_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #endif