0001
0002 #ifndef MPOA_CACHES_H
0003 #define MPOA_CACHES_H
0004
0005 #include <linux/time64.h>
0006 #include <linux/netdevice.h>
0007 #include <linux/types.h>
0008 #include <linux/atm.h>
0009 #include <linux/atmdev.h>
0010 #include <linux/atmmpc.h>
0011 #include <linux/refcount.h>
0012
0013 struct mpoa_client;
0014
0015 void atm_mpoa_init_cache(struct mpoa_client *mpc);
0016
0017 typedef struct in_cache_entry {
0018 struct in_cache_entry *next;
0019 struct in_cache_entry *prev;
0020 time64_t time;
0021 time64_t reply_wait;
0022 time64_t hold_down;
0023 uint32_t packets_fwded;
0024 uint16_t entry_state;
0025 uint32_t retry_time;
0026 uint32_t refresh_time;
0027 uint32_t count;
0028 struct atm_vcc *shortcut;
0029 uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
0030 struct in_ctrl_info ctrl_info;
0031 refcount_t use;
0032 } in_cache_entry;
0033
0034 struct in_cache_ops{
0035 in_cache_entry *(*add_entry)(__be32 dst_ip,
0036 struct mpoa_client *client);
0037 in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
0038 in_cache_entry *(*get_with_mask)(__be32 dst_ip,
0039 struct mpoa_client *client,
0040 __be32 mask);
0041 in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
0042 struct mpoa_client *client);
0043 void (*put)(in_cache_entry *entry);
0044 void (*remove_entry)(in_cache_entry *delEntry,
0045 struct mpoa_client *client );
0046 int (*cache_hit)(in_cache_entry *entry,
0047 struct mpoa_client *client);
0048 void (*clear_count)(struct mpoa_client *client);
0049 void (*check_resolving)(struct mpoa_client *client);
0050 void (*refresh)(struct mpoa_client *client);
0051 void (*destroy_cache)(struct mpoa_client *mpc);
0052 };
0053
0054 typedef struct eg_cache_entry{
0055 struct eg_cache_entry *next;
0056 struct eg_cache_entry *prev;
0057 time64_t time;
0058 uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
0059 struct atm_vcc *shortcut;
0060 uint32_t packets_rcvd;
0061 uint16_t entry_state;
0062 __be32 latest_ip_addr;
0063 struct eg_ctrl_info ctrl_info;
0064 refcount_t use;
0065 } eg_cache_entry;
0066
0067 struct eg_cache_ops{
0068 eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
0069 eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
0070 eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
0071 eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
0072 eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
0073 void (*put)(eg_cache_entry *entry);
0074 void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
0075 void (*update)(eg_cache_entry *entry, uint16_t holding_time);
0076 void (*clear_expired)(struct mpoa_client *client);
0077 void (*destroy_cache)(struct mpoa_client *mpc);
0078 };
0079
0080
0081
0082
0083 #define INGRESS_REFRESHING 3
0084 #define INGRESS_RESOLVED 2
0085 #define INGRESS_RESOLVING 1
0086 #define INGRESS_INVALID 0
0087
0088
0089
0090 #define OPEN 1
0091 #define CLOSED 0
0092
0093
0094
0095 #define EGRESS_RESOLVED 2
0096 #define EGRESS_PURGE 1
0097 #define EGRESS_INVALID 0
0098
0099 #endif