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