Line data Source code
1 : /* 2 : * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef __src_vnsw_agent_vrouter_ksync_ksync_flow_memory_h 6 : #define __src_vnsw_agent_vrouter_ksync_ksync_flow_memory_h 7 : 8 : /* 9 : * Module responsible to manage the VRouter memory mapped to agent 10 : */ 11 : #include <list> 12 : #include <base/address.h> 13 : #include <vrouter/ksync/ksync_memory.h> 14 : 15 : class Timer; 16 : class KSync; 17 : struct FlowKey; 18 : struct vr_flow_entry; 19 : struct vr_flow_stats; 20 : struct KFlowData; 21 : 22 : class KSyncFlowMemory : public KSyncMemory { 23 : public: 24 : KSyncFlowMemory(KSync *ksync, uint32_t minor_id); 25 6 : virtual ~KSyncFlowMemory() {} 26 : 27 : virtual void Init(); 28 : 29 : static void VrFlowToIp(const vr_flow_entry *kflow, IpAddress *sip, 30 : IpAddress *dip); 31 : const vr_flow_entry *GetKernelFlowEntry(uint32_t idx, 32 : bool ignore_active_status) const; 33 : const vr_flow_entry *GetValidKFlowEntry(const FlowKey &key, 34 : uint32_t idx, uint8_t gen_id) const; 35 : const vr_flow_entry *GetKFlowStats(const FlowKey &key, uint32_t idx, 36 : uint8_t gen_id, 37 : vr_flow_stats *stats) const; 38 : const vr_flow_entry *GetKFlowStatsAndInfo(const FlowKey &key, 39 : uint32_t idx, 40 : uint8_t gen_id, 41 : vr_flow_stats *stats, 42 : KFlowData *info) const; 43 : bool GetFlowKey(uint32_t index, FlowKey *key, bool *is_nat_flow); 44 : 45 : bool IsEvictionMarked(const vr_flow_entry *entry, uint16_t flags) const; 46 : 47 : virtual int get_entry_size(); 48 : virtual bool IsInactiveEntry(uint32_t idx, uint8_t &gen_id); 49 : virtual void SetTableSize(); 50 : virtual int EncodeReq(nl_client *nl, uint32_t attr_len); 51 : virtual void CreateProtoAuditEntry(uint32_t index, uint8_t gen_id); 52 : virtual void InitTest(); 53 : virtual void Shutdown(); 54 : void DecrementHoldFlowCounter(); 55 : void IncrementHoldFlowCounter(); 56 : void UpdateAgentHoldFlowCounter(); 57 : 58 : private: 59 : uint32_t hold_flow_counter_; 60 : void KFlow2FlowKey(const vr_flow_entry *entry, FlowKey *key) const; 61 : void ReadFlowInfo(const vr_flow_entry *k_flow, vr_flow_stats *stats, 62 : KFlowData *info) const; 63 : const vr_flow_entry *flow_table_; 64 : }; 65 : 66 : #endif // __src_vnsw_agent_vrouter_ksync_ksync_flow_memory_h