mpoa_caches.h 3.0 KB

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