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 MPOA_CACHES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define MPOA_CACHES_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/time64.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/atm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/atmdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/atmmpc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct mpoa_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) void atm_mpoa_init_cache(struct mpoa_client *mpc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) typedef struct in_cache_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	struct in_cache_entry *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	struct in_cache_entry *prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	time64_t  time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	time64_t  reply_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	time64_t  hold_down;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	uint32_t  packets_fwded;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	uint16_t  entry_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	uint32_t retry_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	uint32_t refresh_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	uint32_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	struct   atm_vcc *shortcut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	uint8_t  MPS_ctrl_ATM_addr[ATM_ESA_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	struct   in_ctrl_info ctrl_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	refcount_t use;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) } in_cache_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct in_cache_ops{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	in_cache_entry *(*add_entry)(__be32 dst_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 				      struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	in_cache_entry *(*get_with_mask)(__be32 dst_ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 					 struct mpoa_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 					 __be32 mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 				      struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	void            (*put)(in_cache_entry *entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	void            (*remove_entry)(in_cache_entry *delEntry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 					struct mpoa_client *client );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	int             (*cache_hit)(in_cache_entry *entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 				     struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	void            (*clear_count)(struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	void            (*check_resolving)(struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	void            (*refresh)(struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	void            (*destroy_cache)(struct mpoa_client *mpc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) typedef struct eg_cache_entry{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	struct               eg_cache_entry *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	struct               eg_cache_entry *prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	time64_t	     time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	uint8_t              MPS_ctrl_ATM_addr[ATM_ESA_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	struct atm_vcc       *shortcut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	uint32_t             packets_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	uint16_t             entry_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	__be32             latest_ip_addr;    /* The src IP address of the last packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	struct eg_ctrl_info  ctrl_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	refcount_t             use;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) } eg_cache_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct eg_cache_ops{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	void            (*put)(eg_cache_entry *entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	void            (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	void            (*update)(eg_cache_entry *entry, uint16_t holding_time);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	void            (*clear_expired)(struct mpoa_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	void            (*destroy_cache)(struct mpoa_client *mpc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* Ingress cache entry states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define INGRESS_REFRESHING 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define INGRESS_RESOLVED   2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define INGRESS_RESOLVING  1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define INGRESS_INVALID    0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) /* VCC states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define OPEN   1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define CLOSED 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /* Egress cache entry states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define EGRESS_RESOLVED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define EGRESS_PURGE    1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define EGRESS_INVALID  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #endif