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) /* linux/net/inet/arp.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #ifndef _ARP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #define _ARP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/if_arp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <net/neighbour.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) extern struct neigh_table arp_tbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) static inline u32 arp_hashfn(const void *pkey, const struct net_device *dev, u32 *hash_rnd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	u32 key = *(const u32 *)pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	u32 val = key ^ hash32_ptr(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	return val * hash_rnd[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifdef CONFIG_INET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		key = INADDR_ANY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	struct neighbour *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	rcu_read_lock_bh();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	n = __ipv4_neigh_lookup_noref(dev, key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	if (n && !refcount_inc_not_zero(&n->refcnt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		n = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	rcu_read_unlock_bh();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static inline void __ipv4_confirm_neigh(struct net_device *dev, u32 key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	struct neighbour *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	rcu_read_lock_bh();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	n = __ipv4_neigh_lookup_noref(dev, key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	if (n) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		unsigned long now = jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		/* avoid dirtying neighbour */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 		if (READ_ONCE(n->confirmed) != now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 			WRITE_ONCE(n->confirmed, now);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	rcu_read_unlock_bh();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void arp_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) void arp_send(int type, int ptype, __be32 dest_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	      struct net_device *dev, __be32 src_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	      const unsigned char *dest_hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	      const unsigned char *src_hw, const unsigned char *th);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) void arp_ifdown(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 			   struct net_device *dev, __be32 src_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 			   const unsigned char *dest_hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 			   const unsigned char *src_hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 			   const unsigned char *target_hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void arp_xmit(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #endif	/* _ARP_H */