5 #ifndef __AGENT_FLOWTABLE_KSYNC_H__
6 #define __AGENT_FLOWTABLE_KSYNC_H__
8 #include <boost/asio.hpp>
9 #include <boost/bind/bind.hpp>
18 #include <vrouter/ksync/agent_ksync_types.h>
25 using namespace boost::placeholders;
42 evict_flow_bytes_ = 0;
43 evict_flow_packets_ = 0;
44 evict_flow_oflow_ = 0;
62 uint32_t
hash_id()
const {
return hash_id_;}
71 int AddMsg(
char *buf,
int buf_len);
72 int ChangeMsg(
char *buf,
int buf_len);
73 int DeleteMsg(
char *buf,
int buf_len);
74 void SetPcapData(
FlowEntryPtr fe, std::vector<int8_t> &data);
79 virtual uint32_t GetTableIndex()
const;
88 virtual void ErrorHandler(
int, uint32_t, KSyncEvent)
const;
89 virtual std::string VrouterError(uint32_t error)
const;
99 ksync_response_info_.Reset();
102 uint8_t gen_id, uint64_t evict_flow_bytes,
103 uint64_t evict_flow_packets,
104 int32_t evict_flow_oflow) {
105 ksync_response_info_.ksync_error_ = ksync_error;
106 ksync_response_info_.flow_handle_ = flow_handle;
107 ksync_response_info_.gen_id_ = gen_id;
108 ksync_response_info_.evict_flow_bytes_ = evict_flow_bytes;
109 ksync_response_info_.evict_flow_packets_ = evict_flow_packets;
110 ksync_response_info_.evict_flow_oflow_ = evict_flow_oflow;
113 return &ksync_response_info_;
117 return ksync_response_info_.ksync_error_;
121 return old_first_mirror_index_;
124 transaction_id_ = transaction_id;
176 static const uint32_t kInitCount = (25 * 1000);
177 static const uint32_t kTestInitCount = (5 * 1000);
178 static const uint32_t kGrowSize = (1 * 1000);
179 static const uint32_t kMinThreshold = (4 * 1000);
180 static const uint32_t kMaxThreshold = (100 * 1000);
183 boost::intrusive::list_member_hook<>,
185 typedef boost::intrusive::list<FlowTableKSyncEntry, Node>
FreeList;
200 uint32_t
alloc_count()
const {
return (max_count_ - free_list_.size()); }
217 static const uint32_t kFlowDepSyncTimeout = 1000;
218 static const uint32_t KFlowUnresolvedListYield = 32;
236 void UpdateKey(
KSyncEntry *entry, uint32_t flow_handle);
static bool IsLess(const ShowRoute &lhs, const ShowRoute &rhs, const BgpSandeshContext *bsc, const string &table_name)
static const uint32_t kInvalidFlowHandle
uint32_t get_transaction_id() const
FlowKSyncResponseInfo ksync_response_info_
boost::intrusive::list_member_hook free_list_node_
int ksync_response_error() const
bool AllowDeleteStateComp()
void set_evict_gen_id(uint8_t gen_id)
void set_gen_id(uint8_t gen_id)
FlowTableKSyncObject * ksync_obj_
virtual bool ShouldReEvalBackReference() const
void SetKSyncResponseInfo(int ksync_error, uint32_t flow_handle, uint8_t gen_id, uint64_t evict_flow_bytes, uint64_t evict_flow_packets, int32_t evict_flow_oflow)
uint32_t old_component_nh_idx_
const FlowKSyncResponseInfo * ksync_response_info() const
FlowEvent::Event last_event() const
uint32_t old_first_mirror_index_
uint32_t old_reverse_flow_id_
FlowEntryPtr flow_entry() const
void set_hash_id(uint32_t hash_id)
uint16_t old_drop_reason_
uint32_t old_second_mirror_index_
uint32_t vrouter_hash_id() const
uint32_t vrouter_hash_id_
DISALLOW_COPY_AND_ASSIGN(FlowTableKSyncEntry)
void ResetKSyncResponseInfo()
boost::shared_ptr< Token > token_
FlowEvent::Event last_event_
uint32_t old_first_mirror_index()
uint8_t underlay_gw_index
virtual bool pre_alloc_rx_buffer() const
void set_transaction_id(uint32_t transaction_id)
DISALLOW_COPY_AND_ASSIGN(FlowTableKSyncObject)
KSyncFlowEntryFreeList free_list_
std::list< FlowEntryPtr > unresolved_flow_list_
void set_flow_table(FlowTable *table)
FlowTable * flow_table() const
KSyncFlowEntryFreeList * free_list()
boost::intrusive::member_hook< FlowTableKSyncEntry, boost::intrusive::list_member_hook<>, &FlowTableKSyncEntry::free_list_node_ > Node
uint32_t max_count() const
uint32_t alloc_count() const
KSyncFlowEntryFreeList(FlowTableKSyncObject *object, FlowEntry *flow, uint32_t hash_id)
FlowTableKSyncObject * object_
uint32_t free_count() const
boost::intrusive::list< FlowTableKSyncEntry, Node > FreeList
uint32_t total_alloc() const
DISALLOW_COPY_AND_ASSIGN(KSyncFlowEntryFreeList)
void Reset(FlowEntryPtr fe, uint32_t hash_id)
uint32_t total_free() const
boost::intrusive_ptr< FlowEntry > FlowEntryPtr
static string ToString(PhysicalDevice::ManagementProtocol proto)
int32_t evict_flow_oflow_
uint64_t evict_flow_bytes_
uint64_t evict_flow_packets_