OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ksync_init.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_ksync_init_h
6 #define vnsw_agent_ksync_init_h
7 
16 #include <oper/agent_profile.h>
21 #include "vnswif_listener.h"
22 
23 class KSyncFlowMemory;
26 
27 class KSync {
28 public:
29  KSync(Agent *agent);
30  virtual ~KSync();
31 
32  virtual void Init(bool create_vhost);
33  virtual void InitDone();
34  virtual void RegisterDBClients(DB *db);
36  void Shutdown();
37 
38  void UpdateVhostMac();
39  Agent *agent() const { return agent_; }
41  return mirror_ksync_obj_.get();
42  }
44  return nh_ksync_obj_.get();
45  }
47  return interface_ksync_obj_.get();
48  }
50  return vrf_ksync_obj_.get();
51  }
52  FlowTableKSyncObject *flow_table_ksync_obj(uint16_t index) const {
53  return flow_table_ksync_obj_list_[index];
54  }
56  return vnsw_interface_listner_.get();
57  }
59  return ksync_flow_memory_.get();
60  }
62  return ksync_flow_index_manager_.get();
63  }
64 
65  void SetProfileData(ProfileData *data);
67  return qos_queue_ksync_obj_.get();
68  }
69 
71  return forwarding_class_ksync_obj_.get();
72  }
73 
75  return qos_config_ksync_obj_.get();
76  }
77 
79  return bridge_route_audit_ksync_obj_.get();
80  }
81 
83  return ksync_bridge_memory_.get();
84  }
85 
86  void *btable_huge_page_mem_get() const {
88  }
89 
90  void *ftable_huge_page_mem_get() const {
92  }
93 protected:
95  boost::scoped_ptr<InterfaceKSyncObject> interface_ksync_obj_;
96  std::vector<FlowTableKSyncObject *> flow_table_ksync_obj_list_;
97  boost::scoped_ptr<MplsKSyncObject> mpls_ksync_obj_;
98  boost::scoped_ptr<NHKSyncObject> nh_ksync_obj_;
99  boost::scoped_ptr<MirrorKSyncObject> mirror_ksync_obj_;
100  boost::scoped_ptr<VrfKSyncObject> vrf_ksync_obj_;
101  boost::scoped_ptr<VxLanKSyncObject> vxlan_ksync_obj_;
102  boost::scoped_ptr<VrfAssignKSyncObject> vrf_assign_ksync_obj_;
103  boost::scoped_ptr<VnswInterfaceListener> vnsw_interface_listner_;
104  boost::scoped_ptr<KSyncFlowMemory> ksync_flow_memory_;
105  boost::scoped_ptr<KSyncFlowIndexManager> ksync_flow_index_manager_;
106  boost::scoped_ptr<QosQueueKSyncObject> qos_queue_ksync_obj_;
107  boost::scoped_ptr<ForwardingClassKSyncObject> forwarding_class_ksync_obj_;
108  boost::scoped_ptr<QosConfigKSyncObject> qos_config_ksync_obj_;
109  boost::scoped_ptr<BridgeRouteAuditKSyncObject>
111  boost::scoped_ptr<KSyncBridgeMemory> ksync_bridge_memory_;
112  virtual void InitFlowMem();
113  void SetHugePages();
114  void ResetVRouter(bool run_sync_mode);
115  int Encode(Sandesh &encoder, uint8_t *buf, int buf_len);
116 private:
117  void InitVrouterOps(vrouter_ops *v);
118  void NetlinkInit();
119  void CreateVhostIntf();
120 
121  static const int kHugePageFiles = 4;
124  // index into huge_pages_[] where bridge table is mapped
126  // index into huge_pages_[] where flow table is mapped
128 
130 };
131 
132 class KSyncTcp : public KSync {
133 public:
134  KSyncTcp(Agent *agent);
135  virtual ~KSyncTcp();
136  virtual void Init(bool create_vhost);
137  void TcpInit();
138 protected:
139  virtual void InitFlowMem();
140 };
141 
142 class KSyncUds : public KSync {
143 public:
144  KSyncUds(Agent *agent);
145  virtual ~KSyncUds();
146  virtual void Init(bool create_vhost);
147  void UdsInit();
148 protected:
149  virtual void InitFlowMem();
150 };
151 
153 void GenericNetlinkInit();
154 
155 #endif //vnsw_agent_ksync_init_h
virtual ~KSyncTcp()
Definition: ksync_init.cc:552
ForwardingClassKSyncObject * forwarding_class_ksync_obj() const
Definition: ksync_init.h:70
void CreateVhostIntf()
Definition: ksync_init.cc:412
void SetHugePages()
Definition: ksync_init.cc:256
boost::scoped_ptr< BridgeRouteAuditKSyncObject > bridge_route_audit_ksync_obj_
Definition: ksync_init.h:110
boost::scoped_ptr< VxLanKSyncObject > vxlan_ksync_obj_
Definition: ksync_init.h:101
int Encode(Sandesh &encoder, uint8_t *buf, int buf_len)
Definition: ksync_init.cc:172
KSync(Agent *agent)
Definition: ksync_init.cc:67
virtual void Init(bool create_vhost)
Definition: ksync_init.cc:601
Agent * agent() const
Definition: ksync_init.h:39
void * btable_huge_page_mem_get() const
Definition: ksync_init.h:86
virtual void RegisterDBClients(DB *db)
Definition: ksync_init.cc:104
void NetlinkInit()
Definition: ksync_init.cc:156
boost::scoped_ptr< NHKSyncObject > nh_ksync_obj_
Definition: ksync_init.h:98
std::vector< FlowTableKSyncObject * > flow_table_ksync_obj_list_
Definition: ksync_init.h:96
void UdsInit()
Definition: ksync_init.cc:577
VnswInterfaceListener * vnsw_interface_listner() const
Definition: ksync_init.h:55
virtual void InitFlowMem()
Definition: ksync_init.cc:151
int ftable_huge_pages_index_
Definition: ksync_init.h:127
void UpdateVhostMac()
Definition: ksync_init.cc:452
virtual void Init(bool create_vhost)
Definition: ksync_init.cc:554
KSyncTcp(Agent *agent)
Definition: ksync_init.cc:523
void Shutdown()
Definition: ksync_init.cc:488
virtual void Init(bool create_vhost)
Definition: ksync_init.cc:119
DISALLOW_COPY_AND_ASSIGN(KSync)
KSyncUds(Agent *agent)
Definition: ksync_init.cc:569
virtual void InitDone()
Definition: ksync_init.cc:137
boost::scoped_ptr< VnswInterfaceListener > vnsw_interface_listner_
Definition: ksync_init.h:103
Definition: db.h:24
void ResetVRouter(bool run_sync_mode)
Definition: ksync_init.cc:370
boost::scoped_ptr< InterfaceKSyncObject > interface_ksync_obj_
Definition: ksync_init.h:95
boost::scoped_ptr< VrfKSyncObject > vrf_ksync_obj_
Definition: ksync_init.h:100
QosQueueKSyncObject * qos_queue_ksync_obj() const
Definition: ksync_init.h:66
virtual void InitFlowMem()
Definition: ksync_init.cc:526
Definition: agent.h:358
MirrorKSyncObject * mirror_ksync_obj() const
Definition: ksync_init.h:40
NHKSyncObject * nh_ksync_obj() const
Definition: ksync_init.h:43
int GenenericNetlinkFamily()
static const int kHugePageFiles
Definition: ksync_init.h:121
int btable_huge_pages_index_
Definition: ksync_init.h:125
Agent * agent_
Definition: ksync_init.h:94
boost::scoped_ptr< KSyncFlowMemory > ksync_flow_memory_
Definition: ksync_init.h:104
boost::scoped_ptr< ForwardingClassKSyncObject > forwarding_class_ksync_obj_
Definition: ksync_init.h:107
void InitVrouterOps(vrouter_ops *v)
Definition: ksync_init.cc:223
BridgeRouteAuditKSyncObject * bridge_route_audit_ksync_obj() const
Definition: ksync_init.h:78
virtual ~KSyncUds()
Definition: ksync_init.cc:599
boost::scoped_ptr< MplsKSyncObject > mpls_ksync_obj_
Definition: ksync_init.h:97
boost::scoped_ptr< VrfAssignKSyncObject > vrf_assign_ksync_obj_
Definition: ksync_init.h:102
void GenericNetlinkInit()
Definition: ksync_init.cc:509
FlowTableKSyncObject * flow_table_ksync_obj(uint16_t index) const
Definition: ksync_init.h:52
KSyncBridgeMemory * ksync_bridge_memory() const
Definition: ksync_init.h:82
int huge_fd_[kHugePageFiles]
Definition: ksync_init.h:122
virtual void InitFlowMem()
Definition: ksync_init.cc:572
boost::scoped_ptr< QosQueueKSyncObject > qos_queue_ksync_obj_
Definition: ksync_init.h:106
boost::scoped_ptr< KSyncBridgeMemory > ksync_bridge_memory_
Definition: ksync_init.h:111
void VnswInterfaceListenerInit()
Definition: ksync_init.cc:408
VrfKSyncObject * vrf_ksync_obj() const
Definition: ksync_init.h:49
QosConfigKSyncObject * qos_config_ksync_obj() const
Definition: ksync_init.h:74
KSyncFlowMemory * ksync_flow_memory() const
Definition: ksync_init.h:58
KSyncFlowIndexManager * ksync_flow_index_manager() const
Definition: ksync_init.h:61
boost::scoped_ptr< MirrorKSyncObject > mirror_ksync_obj_
Definition: ksync_init.h:99
boost::scoped_ptr< KSyncFlowIndexManager > ksync_flow_index_manager_
Definition: ksync_init.h:105
boost::scoped_ptr< QosConfigKSyncObject > qos_config_ksync_obj_
Definition: ksync_init.h:108
void SetProfileData(ProfileData *data)
Definition: ksync_init.cc:178
InterfaceKSyncObject * interface_ksync_obj() const
Definition: ksync_init.h:46
void * ftable_huge_page_mem_get() const
Definition: ksync_init.h:90
virtual ~KSync()
Definition: ksync_init.cc:96
void TcpInit()
Definition: ksync_init.cc:531
void * huge_pages_[kHugePageFiles]
Definition: ksync_init.h:123