blob: 30fe34841cedde62d7093b72670026df7c9cb22a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef MPOA_CACHES_H
2#define MPOA_CACHES_H
3
4#include <linux/netdevice.h>
5#include <linux/types.h>
6#include <linux/atm.h>
7#include <linux/atmdev.h>
8#include <linux/atmmpc.h>
Reshetova, Elena93714912017-07-04 15:53:03 +03009#include <linux/refcount.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11struct mpoa_client;
12
13void atm_mpoa_init_cache(struct mpoa_client *mpc);
14
15typedef struct in_cache_entry {
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090016 struct in_cache_entry *next;
17 struct in_cache_entry *prev;
18 struct timeval tv;
19 struct timeval reply_wait;
20 struct timeval hold_down;
21 uint32_t packets_fwded;
22 uint16_t entry_state;
23 uint32_t retry_time;
24 uint32_t refresh_time;
25 uint32_t count;
26 struct atm_vcc *shortcut;
27 uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
28 struct in_ctrl_info ctrl_info;
Reshetova, Elena93714912017-07-04 15:53:03 +030029 refcount_t use;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030} in_cache_entry;
31
32struct in_cache_ops{
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090033 in_cache_entry *(*add_entry)(__be32 dst_ip,
34 struct mpoa_client *client);
35 in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
36 in_cache_entry *(*get_with_mask)(__be32 dst_ip,
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 struct mpoa_client *client,
Al Viro30d492d2006-11-14 21:11:29 -080038 __be32 mask);
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090039 in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
40 struct mpoa_client *client);
41 void (*put)(in_cache_entry *entry);
42 void (*remove_entry)(in_cache_entry *delEntry,
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 struct mpoa_client *client );
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090044 int (*cache_hit)(in_cache_entry *entry,
45 struct mpoa_client *client);
46 void (*clear_count)(struct mpoa_client *client);
47 void (*check_resolving)(struct mpoa_client *client);
48 void (*refresh)(struct mpoa_client *client);
49 void (*destroy_cache)(struct mpoa_client *mpc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050};
51
52typedef struct eg_cache_entry{
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090053 struct eg_cache_entry *next;
54 struct eg_cache_entry *prev;
55 struct timeval tv;
56 uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
57 struct atm_vcc *shortcut;
58 uint32_t packets_rcvd;
59 uint16_t entry_state;
60 __be32 latest_ip_addr; /* The src IP address of the last packet */
61 struct eg_ctrl_info ctrl_info;
Reshetova, Elenae00bdbe2017-07-04 15:53:04 +030062 refcount_t use;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063} eg_cache_entry;
64
65struct eg_cache_ops{
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090066 eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
67 eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
68 eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
69 eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
70 eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
71 void (*put)(eg_cache_entry *entry);
72 void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
73 void (*update)(eg_cache_entry *entry, uint16_t holding_time);
74 void (*clear_expired)(struct mpoa_client *client);
75 void (*destroy_cache)(struct mpoa_client *mpc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076};
77
78
79/* Ingress cache entry states */
80
81#define INGRESS_REFRESHING 3
82#define INGRESS_RESOLVED 2
83#define INGRESS_RESOLVING 1
84#define INGRESS_INVALID 0
85
86/* VCC states */
87
88#define OPEN 1
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090089#define CLOSED 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
91/* Egress cache entry states */
92
93#define EGRESS_RESOLVED 2
94#define EGRESS_PURGE 1
95#define EGRESS_INVALID 0
96
97#endif