OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ksync_init.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <boost/asio.hpp>
6 #include <boost/bind.hpp>
7 
8 #if defined(__linux__)
9 #include <linux/netlink.h>
10 #include <linux/rtnetlink.h>
11 #include <linux/genetlink.h>
12 #include <linux/if_ether.h>
13 #include <netinet/ether.h>
14 #endif
15 
16 #include "ksync_init.h"
17 
18 #include <sys/mman.h>
19 #include <net/if.h>
20 
21 #include <io/event_manager.h>
22 #include <db/db_entry.h>
23 #include <db/db_table.h>
24 #include <db/db_table_partition.h>
25 #include <cmn/agent_cmn.h>
26 #include <pkt/flow_proto.h>
27 #include <ksync/ksync_index.h>
28 #include <ksync/ksync_entry.h>
29 #include <ksync/ksync_object.h>
30 #include <ksync/ksync_netlink.h>
31 #include <ksync/ksync_sock.h>
32 #include <init/agent_param.h>
33 
34 #include <nl_util.h>
35 #include <vhost.h>
36 #include <vr_message.h>
37 #include <vr_mem.h>
38 
40 #include "interface_ksync.h"
41 #include "route_ksync.h"
42 #include "mirror_ksync.h"
43 #include "vrf_assign_ksync.h"
44 #include "vxlan_ksync.h"
45 #include "sandesh_ksync.h"
46 #include "qos_queue_ksync.h"
47 #include "forwarding_class_ksync.h"
48 #include "qos_config_ksync.h"
49 
50 #define VNSW_GENETLINK_FAMILY_NAME "vnsw"
51 
52 void LogSockInitErrors(bool success_cond, bool use_errno, string err_str) {
53  if(success_cond == false) {
54  if (use_errno) {
55  LOG(ERROR,
56  err_str << " Failed with " << errno << "syscall: "
57  << strerror(errno) << ". BackTrace: " << AgentBackTrace(1));
58  } else {
59  LOG(ERROR,
60  "Failed with " << err_str << ". BackTrace: " << AgentBackTrace(1));
61  }
62  _Exit(0);
63  }
64  return;
65 }
66 
68  : agent_(agent), interface_ksync_obj_(new InterfaceKSyncObject(this)),
69  flow_table_ksync_obj_list_(),
70  mpls_ksync_obj_(new MplsKSyncObject(this)),
71  nh_ksync_obj_(new NHKSyncObject(this)),
72  mirror_ksync_obj_(new MirrorKSyncObject(this)),
73  vrf_ksync_obj_(new VrfKSyncObject(this)),
74  vxlan_ksync_obj_(new VxLanKSyncObject(this)),
75  vrf_assign_ksync_obj_(new VrfAssignKSyncObject(this)),
76  vnsw_interface_listner_(new VnswInterfaceListener(agent)),
77  ksync_flow_memory_(new KSyncFlowMemory(this, VR_MEM_FLOW_TABLE_OBJECT)),
78  ksync_flow_index_manager_(new KSyncFlowIndexManager(this)),
79  qos_queue_ksync_obj_(new QosQueueKSyncObject(this)),
80  forwarding_class_ksync_obj_(new ForwardingClassKSyncObject(this)),
81  qos_config_ksync_obj_(new QosConfigKSyncObject(this)),
82  bridge_route_audit_ksync_obj_(new BridgeRouteAuditKSyncObject(this)),
83  ksync_bridge_memory_(new KSyncBridgeMemory(this, VR_MEM_BRIDGE_TABLE_OBJECT)) {
84  for (uint16_t i = 0; i < kHugePageFiles; i++) {
85  huge_fd_[i] = -1;
86  huge_pages_[i] = NULL;
87  }
90  for (uint16_t i = 0; i < agent->flow_thread_count(); i++) {
92  flow_table_ksync_obj_list_.push_back(obj);
93  }
94 }
95 
97  for (uint16_t i = 0; i < kHugePageFiles; i++) {
98  if (huge_fd_[i] != -1)
99  close (huge_fd_[i]);
100  }
102 }
103 
106  interface_ksync_obj_.get()->RegisterDBClients();
107  vrf_ksync_obj_.get()->RegisterDBClients();
108  nh_ksync_obj_.get()->RegisterDBClients();
109  mpls_ksync_obj_.get()->RegisterDBClients();
110  mirror_ksync_obj_.get()->RegisterDBClients();
111  vrf_assign_ksync_obj_.get()->RegisterDBClients();
112  vxlan_ksync_obj_.get()->RegisterDBClients();
113  qos_queue_ksync_obj_.get()->RegisterDBClients();
114  forwarding_class_ksync_obj_.get()->RegisterDBClients();
115  qos_config_ksync_obj_.get()->RegisterDBClients();
117 }
118 
119 void KSync::Init(bool create_vhost) {
120  NetlinkInit();
121  SetHugePages();
122  InitFlowMem();
123  ResetVRouter(true);
124  if (create_vhost) {
125  CreateVhostIntf();
126  }
127  interface_ksync_obj_.get()->Init();
128  for (uint16_t i = 0; i < flow_table_ksync_obj_list_.size(); i++) {
129  FlowTable *flow_table = agent_->pkt()->get_flow_proto()->GetTable(i);
131  flow_table_ksync_obj_list_[i]->Init();
132  }
133  ksync_flow_memory_.get()->Init();
134  ksync_bridge_memory_.get()->Init();
135 }
136 
138  for (uint16_t i = 0; i < flow_table_ksync_obj_list_.size(); i++) {
139  FlowTable *flow_table = agent_->pkt()->get_flow_proto()->GetTable(i);
140  flow_table_ksync_obj_list_[i]->set_flow_table(flow_table);
142  }
143  uint32_t count = ksync_flow_memory_->table_entries_count();
144  ksync_flow_index_manager_->InitDone(count);
145  AgentProfile *profile = agent_->oper_db()->agent_profile();
146  profile->RegisterKSyncStatsCb(boost::bind(&KSync::SetProfileData,
147  this, _1));
149 }
150 
154 }
155 
157  EventManager *event_mgr;
158  bool use_work_queue = false;
159 
160  event_mgr = agent_->event_manager();
161  boost::asio::io_context &io = *event_mgr->io_service();
162 
163  KSyncSockNetlink::Init(io, NETLINK_GENERIC, use_work_queue,
165  for (int i = 0; i < KSyncSock::kRxWorkQueueCount; i++) {
167  (new KSyncSandeshContext(this), i);
168  }
170 }
171 
172 int KSync::Encode(Sandesh &encoder, uint8_t *buf, int buf_len) {
173  int len, error;
174  len = encoder.WriteBinary(buf, buf_len, &error);
175  return len;
176 }
177 
179  KSyncSock *sock = KSyncSock::Get(0);
180  const KSyncTxQueue *tx_queue = sock->send_queue();
181 
183  stats->name_ = "KSync Send Queue";
184  stats->queue_count_ = tx_queue->queue_len();
185  stats->enqueue_count_ = tx_queue->enqueues();
186  stats->dequeue_count_ = tx_queue->dequeues();
187  stats->max_queue_count_ = tx_queue->max_queue_len();
188  stats->start_count_ = tx_queue->read_events();
189  stats->busy_time_ = tx_queue->busy_time();
190  tx_queue->set_measure_busy_time(agent()->MeasureQueueDelay());
191  if (agent()->MeasureQueueDelay()) {
192  tx_queue->ClearStats();
193  }
194 
195  stats = &data->ksync_rx_queue_count_;
196  stats->queue_count_ = 0;
197  stats->enqueue_count_ = 0;
198  stats->dequeue_count_ = 0;
199  stats->max_queue_count_ = 0;
200  stats->start_count_ = 0;
201  stats->busy_time_ = 0;
202 
203  for (int i = 0; i < IoContext::MAX_WORK_QUEUES; i++) {
204  const KSyncSock::KSyncReceiveQueue *rx_queue =
205  sock->get_receive_work_queue(i);
206  if (i == 0)
207  stats->name_ = rx_queue->Description();
208  stats->queue_count_ += rx_queue->Length();
209  stats->enqueue_count_ += rx_queue->NumEnqueues();
210  stats->dequeue_count_ += rx_queue->NumDequeues();
211  if (stats->max_queue_count_ < rx_queue->max_queue_len()) {
212  stats->max_queue_count_ = rx_queue->max_queue_len();
213  }
214  stats->start_count_ += rx_queue->task_starts();
215  stats->busy_time_ += rx_queue->busy_time();
216  rx_queue->set_measure_busy_time(agent()->MeasureQueueDelay());
217  if (agent()->MeasureQueueDelay()) {
218  rx_queue->ClearStats();
219  }
220  }
221 }
222 
223 void KSync::InitVrouterOps(vrouter_ops *v) {
224  v->set_vo_rid(0);
225  v->set_vo_mpls_labels(-1);
226  v->set_vo_mpls_labels(-1);
227  v->set_vo_nexthops(-1);
228  v->set_vo_bridge_entries(-1);
229  v->set_vo_oflow_bridge_entries(-1);
230  v->set_vo_flow_entries(-1);
231  v->set_vo_oflow_entries(-1);
232  v->set_vo_interfaces(-1);
233  v->set_vo_mirror_entries(-1);
234  v->set_vo_vrfs(-1);
235  v->set_vo_log_level(0);
236  v->set_vo_perfr(-1);
237  v->set_vo_perfs(-1);
238  v->set_vo_from_vm_mss_adj(-1);
239  v->set_vo_to_vm_mss_adj(-1);
240  v->set_vo_perfr1(-1);
241  v->set_vo_perfr2(-1);
242  v->set_vo_perfr3(-1);
243  v->set_vo_perfp(-1);
244  v->set_vo_perfq1(-1);
245  v->set_vo_perfq2(-1);
246  v->set_vo_perfq3(-1);
247  v->set_vo_udp_coff(-1);
248  v->set_vo_flow_hold_limit(-1);
249  v->set_vo_mudp(-1);
250  v->set_vo_burst_tokens(-1);
251  v->set_vo_burst_interval(-1);
252  v->set_vo_burst_step(-1);
253  v->set_vo_memory_alloc_checks(-1);
254 }
255 
257  vr_hugepage_config encoder;
258  bool fail[kHugePageFiles];
259  std::string filename[kHugePageFiles];
260  uint32_t filesize[kHugePageFiles];
261  uint32_t flags[kHugePageFiles];
262  uint32_t pagesize[kHugePageFiles];
263  uint16_t i, j;
264  uint32_t bridge_table_size, flow_table_size;
265 
266  // get the table size for bridge and flow
267  bridge_table_size = ksync_bridge_memory_.get()->GetKernelTableSize();
268  flow_table_size = ksync_flow_memory_.get()->GetKernelTableSize();
269 
270  LOG(INFO, __FUNCTION__ << ": " << "Bridge table size:" << bridge_table_size
271  << " Flow table size:" << flow_table_size << "\n");
272 
273  for (i = 0; i < kHugePageFiles / 2; ++i) {
274  filename[i] = agent_->params()->huge_page_file_1G(i);
275  if ((i % 2) == 0) {
276  filesize[i] = bridge_table_size;
277  } else {
278  filesize[i] = flow_table_size;
279  }
280  // set pagesize array
281  pagesize[i] = 1024 * 1024 * 1024;
282  flags[i] = O_CREAT | O_RDWR;
283  fail[i] = false;
284  }
285  for (j = i; j < kHugePageFiles; ++j) {
286  filename[j] = agent_->params()->huge_page_file_2M(j - i);
287  if ((j % 2) == 0) {
288  filesize[j] = bridge_table_size;
289  } else {
290  filesize[j] = flow_table_size;
291  }
292  // set pagesize array
293  pagesize[j] = 2 * 1024 * 1024;
294  flags[j] = O_CREAT | O_RDWR;
295  fail[j] = false;
296  }
297 
298  for (i = 0; i < kHugePageFiles; ++i) {
299  if (filename[i].empty()) {
300  fail[i] = true;
301  continue;
302  }
303 
304  huge_fd_[i] = open(filename[i].c_str(), flags[i], 0755);
305  if (huge_fd_[i] < 0) {
306  fail[i] = true;
307  continue;
308  }
309 
310  LOG(INFO, "Mem mapping hugepage file:" << filename[i].c_str()
311  << " size:" << filesize[i] << "\n");
312  huge_pages_[i] = (void *) mmap(NULL, filesize[i],
313  PROT_READ | PROT_WRITE, MAP_SHARED,
314  huge_fd_[i], 0);
315  if (huge_pages_[i] == MAP_FAILED) {
316  LOG(ERROR, "Failed to Mmap hugepage file:" << filename[i].c_str() << "\n");
317  huge_pages_[i] = NULL;
318  fail[i] = true;
319  } else {
320  LOG(INFO, "Mem mapped hugepage file:" << filename[i].c_str()
321  << " to addr:" << huge_pages_[i] << "\n");
322  if ((i % 2) == 0) {
324  } else {
326  }
327  }
328  }
329 
330  encoder.set_vhp_op(sandesh_op::ADD);
331 
332  std::vector<uint64_t> huge_mem;
333  std::vector<uint32_t> huge_mem_size;
334  std::vector<uint32_t> huge_page_size;
335  std::vector<int8_t> huge_page_paths;
336  std::vector<uint32_t> huge_page_paths_sz;
337 
338  for (uint16_t i = 0; i < kHugePageFiles; ++i) {
339  if (fail[i] == false) {
340  huge_mem.push_back((uint64_t) huge_pages_[i]);
341  huge_page_size.push_back(pagesize[i]);
342  huge_mem_size.push_back(filesize[i]);
343  const char *path = filename[i].c_str();
344  uint32_t len = strlen(path) + 1;
345  for (uint32_t c = 0; c < len; c++) {
346  huge_page_paths.push_back(path[c]);
347  }
348  huge_page_paths_sz.push_back(len);
349  }
350  }
351  encoder.set_vhp_mem(huge_mem);
352  encoder.set_vhp_psize(huge_page_size);
353  // set huge_mem_size
354  encoder.set_vhp_mem_sz(huge_mem_size);
355  encoder.set_vhp_file_paths(huge_page_paths);
356  encoder.set_vhp_file_path_sz(huge_page_paths_sz);
357  encoder.set_vhp_resp(VR_HPAGE_CFG_RESP_HPAGE_SUCCESS);
358 
359  uint8_t msg[KSYNC_DEFAULT_MSG_SIZE];
360  int len = Encode(encoder, msg, KSYNC_DEFAULT_MSG_SIZE);
361 
362  LOG(INFO, "Sending Huge Page configuration to VROUTER\n");
363  KSyncSock *sock = KSyncSock::Get(0);
364  sock->BlockingSend((char *)msg, len);
365  if (sock->BlockingRecv()) {
366  LOG(ERROR, "Error sending Huge Page configuration to VROUTER. Skipping KSync Start");
367  }
368 }
369 
370 void KSync::ResetVRouter(bool run_sync_mode) {
371  int len = 0;
372  vrouter_ops encoder;
373  encoder.set_h_op(sandesh_op::RESET);
374  uint8_t msg[KSYNC_DEFAULT_MSG_SIZE];
375  len = Encode(encoder, msg, KSYNC_DEFAULT_MSG_SIZE);
376 
377  KSyncSock *sock = KSyncSock::Get(0);
378  sock->BlockingSend((char *)msg, len);
379  if (sock->BlockingRecv()) {
380  LOG(ERROR, "Error resetting VROUTER. Skipping KSync Start");
381  return;
382  }
383 
384  //configure vrouter with priority_tagging configuration
385  encoder.set_h_op(sandesh_op::ADD);
386  encoder.set_vo_priority_tagging(agent_->params()->qos_priority_tagging());
387  //Initialize rest of the fields to values so that vrouter does not take any
388  //action on those field values
389  InitVrouterOps(&encoder);
390  len = Encode(encoder, msg, KSYNC_DEFAULT_MSG_SIZE);
391  sock->BlockingSend((char *)msg, len);
392  if (sock->BlockingRecv()) {
393  LOG(ERROR, "Error setting Qos priority-tagging for vrouter");
394  }
395 
396  //Get configured mpls, vmi, vni and nexthop parameters
397  //from vrouter
398  encoder.set_h_op(sandesh_op::GET);
399  len = Encode(encoder, msg, KSYNC_DEFAULT_MSG_SIZE);
400  sock->BlockingSend((char *)msg, len);
401  if (sock->BlockingRecv()) {
402  LOG(ERROR, "Error getting configured parameter for vrouter");
403  }
404 
405  KSyncSock::Start(run_sync_mode);
406 }
407 
409  vnsw_interface_listner_->Init();
410 }
411 
413 #if defined(__linux__)
414  struct nl_client *cl;
415  int ret;
416 
417  assert((cl = nl_register_client()) != NULL);
418  LogSockInitErrors((cl->cl_sock < 0), false, "cl_sock EEXIST");
419  LogSockInitErrors((nl_socket(cl, AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE) > 0), true, "socket");
420  ret = nl_connect(cl, 0, 0, 0);
421  if(ret != 0) {
422  if(!(cl->cl_sa))
423  LogSockInitErrors(false, false, "cl_sa malloc failure");
424  else
425  LogSockInitErrors(false, true, "connect");
426  }
427 
428  struct vn_if ifm;
429  struct nl_response *resp;
430 
431  memset(&ifm, 0, sizeof(ifm));
432  strncpy(ifm.if_name, agent_->vhost_interface_name().c_str(),
433  IFNAMSIZ);
434  ifm.if_name[IFNAMSIZ - 1] = '\0';
435  strcpy(ifm.if_kind, VHOST_KIND);
436  ifm.if_flags = IFF_UP;
437 
438  assert(nl_build_if_create_msg(cl, &ifm, 1) == 0);
439  LogSockInitErrors((nl_sendmsg(cl) > 0), true, "sendmsg");
440  ret = nl_recvmsg(cl);
441  if(ret == -EOPNOTSUPP) {
442  LogSockInitErrors(false, false, "cl->cl_recv_len > cl->cl_buf_len");
443  } else if (ret < 0) {
444  LogSockInitErrors(false, true, "recvmsg");
445  }
446  assert((resp = nl_parse_reply(cl)) != NULL);
447  assert(resp->nl_type == NL_MSG_TYPE_ERROR);
448  nl_free_client(cl);
449 #endif
450 }
451 
453 #if defined(__linux__)
454  struct nl_client *cl;
455 
456  assert((cl = nl_register_client()) != NULL);
457  assert(nl_socket(cl,AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE) > 0);
458  assert(nl_connect(cl, 0, 0, 0) == 0);
459 
460  struct vn_if ifm;
461  struct nl_response *resp;
462 
463  memset(&ifm, 0, sizeof(ifm));
464  strncpy(ifm.if_name, agent_->vhost_interface_name().c_str(),
465  IFNAMSIZ);
466  ifm.if_name[IFNAMSIZ - 1] = '\0';
467  strcpy(ifm.if_kind, VHOST_KIND);
468  ifm.if_flags = IFF_UP;
469 
470  //on l3mh compute vhost0 mac is set to vrrp mac instead of phy interface mac
471  if (agent_->is_l3mh()) {
472  agent_->vrrp_mac().ToArray((u_int8_t *)ifm.if_mac, sizeof(ifm.if_mac));
473  } else {
475  Interface *eth = static_cast<Interface *>
477  eth->mac().ToArray((u_int8_t *)ifm.if_mac, sizeof(ifm.if_mac));
478  }
479  assert(nl_build_if_create_msg(cl, &ifm, 1) == 0);
480  assert(nl_sendmsg(cl) > 0);
481  assert(nl_recvmsg(cl) > 0);
482  assert((resp = nl_parse_reply(cl)) != NULL);
483  assert(resp->nl_type == NL_MSG_TYPE_ERROR);
484  nl_free_client(cl);
485 #endif
486 }
487 
489  vnsw_interface_listner_->Shutdown();
490  vnsw_interface_listner_.reset(NULL);
491  interface_ksync_obj_.reset(NULL);
492  vrf_ksync_obj_.get()->Shutdown();
493  vrf_ksync_obj_.reset(NULL);
494  nh_ksync_obj_.reset(NULL);
495  mpls_ksync_obj_.reset(NULL);
496  ksync_flow_memory_.reset(NULL);
497  ksync_bridge_memory_.reset(NULL);
498  mirror_ksync_obj_.reset(NULL);
499  vrf_assign_ksync_obj_.reset(NULL);
500  vxlan_ksync_obj_.reset(NULL);
501  qos_queue_ksync_obj_.reset(NULL);
502  forwarding_class_ksync_obj_.reset(NULL);
503  qos_config_ksync_obj_.reset(NULL);
507 }
508 
510  struct nl_client *cl;
511  int family;
512 
513  assert((cl = nl_register_client()) != NULL);
514  assert(nl_socket(cl, AF_NETLINK, SOCK_DGRAM, NETLINK_GENERIC) >= 0);
515  assert(nl_connect(cl, 0, 0, 0) == 0);
516 
517  family = vrouter_obtain_family_id(cl);
518  LOG(DEBUG, "Vrouter family is " << family);
520  nl_free_client(cl);
521 }
522 
523 KSyncTcp::KSyncTcp(Agent *agent): KSync(agent) {
524 }
525 
527  ksync_flow_memory_.get()->MapSharedMemory();
528  ksync_bridge_memory_.get()->MapSharedMemory();
529 }
530 
532  EventManager *event_mgr;
533  event_mgr = agent_->event_manager();
534  boost::system::error_code ec;
535  boost::asio::ip::address ip;
536  ip = agent_->vrouter_server_ip();
537  uint32_t port = agent_->vrouter_server_port();
538  KSyncSockTcp::Init(event_mgr, ip, port,
541 
542  for (int i = 0; i < KSyncSock::kRxWorkQueueCount; i++) {
544  (new KSyncSandeshContext(this), i);
545  }
546  KSyncSockTcp *sock = static_cast<KSyncSockTcp *>(KSyncSock::Get(0));
547  while (sock->connect_complete() == false) {
548  sleep(1);
549  }
550 }
551 
553 
554 void KSyncTcp::Init(bool create_vhost) {
555  TcpInit();
556  InitFlowMem();
557  ResetVRouter(false);
558  //Start async read of socket
559  KSyncSockTcp *sock = static_cast<KSyncSockTcp *>(KSyncSock::Get(0));
560  sock->AsyncReadStart();
561  interface_ksync_obj_.get()->Init();
562  for (uint16_t i = 0; i < flow_table_ksync_obj_list_.size(); i++) {
563  flow_table_ksync_obj_list_[i]->Init();
564  }
565  ksync_flow_memory_.get()->Init();
566  ksync_bridge_memory_.get()->Init();
567 }
568 
569 KSyncUds::KSyncUds(Agent *agent): KSync(agent) {
570 }
571 
573  ksync_flow_memory_.get()->MapSharedMemory();
574  ksync_bridge_memory_.get()->MapSharedMemory();
575 }
576 
578  EventManager *event_mgr;
579  event_mgr = agent_->event_manager();
580  boost::asio::io_context &io = *event_mgr->io_service();
581  boost::system::error_code ec;
582 
583  string ksync_agent_vrouter_sock_path = KSYNC_AGENT_VROUTER_SOCK_PATH;
584 
585  ksync_agent_vrouter_sock_path = agent_->params()->cat_is_agent_mocked() ?
587  "dpdk_netlink":ksync_agent_vrouter_sock_path;
588 
590  ksync_agent_vrouter_sock_path);
592 
593  for (int i = 0; i < KSyncSock::kRxWorkQueueCount; i++) {
595  (new KSyncSandeshContext(this), i);
596  }
597 }
598 
600 
601 void KSyncUds::Init(bool create_vhost) {
602  UdsInit();
603  InitFlowMem();
604  ResetVRouter(false);
605  interface_ksync_obj_.get()->Init();
606  for (uint16_t i = 0; i < flow_table_ksync_obj_list_.size(); i++) {
607  flow_table_ksync_obj_list_[i]->Init();
608  }
609  ksync_flow_memory_.get()->Init();
610  ksync_bridge_memory_.get()->Init();
611 }
bool MeasureQueueDelay()
Definition: agent.cc:1136
virtual ~KSyncTcp()
Definition: ksync_init.cc:552
uint32_t task_starts() const
Definition: queue_task.h:376
void CreateVhostIntf()
Definition: ksync_init.cc:412
static const int kRxWorkQueueCount
Definition: ksync_sock.h:314
void SetHugePages()
Definition: ksync_init.cc:256
boost::scoped_ptr< VxLanKSyncObject > vxlan_ksync_obj_
Definition: ksync_init.h:101
bool qos_priority_tagging() const
Definition: agent_param.h:562
void STLDeleteValues(Container *container)
Definition: util.h:101
std::string cat_ksocketdir() const
Definition: agent_param.h:573
std::size_t BlockingSend(char *msg, int msg_len)
Definition: ksync_sock.cc:444
int Encode(Sandesh &encoder, uint8_t *buf, int buf_len)
Definition: ksync_init.cc:172
KSync(Agent *agent)
Definition: ksync_init.cc:67
bool ToArray(u_int8_t *p, size_t s) const
Definition: mac_address.cc:93
size_t max_queue_len() const
Definition: queue_task.h:377
void AsyncReadStart()
virtual void Init(bool create_vhost)
Definition: ksync_init.cc:601
Agent * agent() const
Definition: ksync_init.h:39
virtual int32_t WriteBinary(u_int8_t *buf, u_int32_t buf_len, int *error)
Definition: sandesh.cc:571
size_t NumDequeues() const
Definition: queue_task.h:364
void * btable_huge_page_mem_get() const
Definition: ksync_init.h:86
bool is_l3mh() const
Definition: agent.h:725
static const MacAddress & vrrp_mac()
Definition: agent.h:439
virtual void RegisterDBClients(DB *db)
Definition: ksync_init.cc:104
WorkQueueStats ksync_rx_queue_count_
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
boost::asio::io_context * io_service()
Definition: event_manager.h:42
void UdsInit()
Definition: ksync_init.cc:577
const std::string & vhost_interface_name() const
Definition: agent.cc:104
AgentDBEntry * FindActiveEntry(const DBEntry *key)
Definition: agent_db.cc:110
InterfaceTable * interface_table() const
Definition: agent.h:465
void set_ksync_object(FlowTableKSyncObject *obj)
Definition: flow_table.h:181
virtual void InitFlowMem()
Definition: ksync_init.cc:151
static void Shutdown()
Definition: ksync_sock.cc:220
const MacAddress & mac() const
Definition: interface.h:131
int ftable_huge_pages_index_
Definition: ksync_init.h:127
uint32_t read_events() const
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
void LogSockInitErrors(bool success_cond, bool use_errno, string err_str)
Definition: ksync_init.cc:52
KSyncUds(Agent *agent)
Definition: ksync_init.cc:569
virtual void InitDone()
Definition: ksync_init.cc:137
void RegisterKSyncStatsCb(ProfileCb cb)
OperDB * oper_db() const
Definition: agent.cc:1013
boost::scoped_ptr< VnswInterfaceListener > vnsw_interface_listner_
Definition: ksync_init.h:103
Definition: db.h:24
uint32_t max_queue_len() const
void ResetVRouter(bool run_sync_mode)
Definition: ksync_init.cc:370
FlowTable * GetTable(uint16_t index) const
Definition: flow_proto.cc:261
boost::scoped_ptr< InterfaceKSyncObject > interface_ksync_obj_
Definition: ksync_init.h:95
boost::scoped_ptr< VrfKSyncObject > vrf_ksync_obj_
Definition: ksync_init.h:100
virtual void InitFlowMem()
Definition: ksync_init.cc:526
#define KSYNC_DEFAULT_MSG_SIZE
Definition: ksync_sock.h:27
Definition: agent.h:358
static KSyncSock * Get(DBTablePartBase *partition)
Definition: ksync_sock.cc:340
size_t Length() const
Definition: queue_task.h:356
static void Start(bool read_inline)
Definition: ksync_sock.cc:252
static const int kHugePageFiles
Definition: ksync_init.h:121
const uint32_t vrouter_server_port() const
Definition: agent.h:973
const std::string & fabric_interface_name() const
Definition: agent.h:1129
bool connect_complete() const
Definition: ksync_sock.h:654
int btable_huge_pages_index_
Definition: ksync_init.h:125
Agent * agent_
Definition: ksync_init.h:94
EventManager * event_manager() const
Definition: agent.h:1103
boost::scoped_ptr< KSyncFlowMemory > ksync_flow_memory_
Definition: ksync_init.h:104
void SetMeasureQueueDelay(bool val)
Definition: ksync_sock.cc:245
boost::scoped_ptr< ForwardingClassKSyncObject > forwarding_class_ksync_obj_
Definition: ksync_init.h:107
void InitVrouterOps(vrouter_ops *v)
Definition: ksync_init.cc:223
size_t enqueues() const
uint64_t busy_time() const
bool BlockingRecv()
Definition: ksync_sock.cc:419
void set_measure_busy_time(bool val) const
Definition: queue_task.h:379
virtual ~KSyncUds()
Definition: ksync_init.cc:599
size_t dequeues() const
boost::scoped_ptr< MplsKSyncObject > mpls_ksync_obj_
Definition: ksync_init.h:97
AgentParam * params() const
Definition: agent.h:1218
void set_router_id_configured(bool value)
Definition: agent.h:677
#define KSYNC_AGENT_VROUTER_SOCK_PATH
Definition: ksync_sock.h:567
static void Init(boost::asio::io_context &ios, const std::string &cpu_pin_policy, const std::string &sockpathvr="")
const KSyncReceiveQueue * get_receive_work_queue(uint16_t index) const
Definition: ksync_sock.h:404
const std::string huge_page_file_1G(uint16_t index) const
Definition: agent_param.h:492
FlowProto * get_flow_proto() const
Definition: pkt_init.h:43
boost::scoped_ptr< VrfAssignKSyncObject > vrf_assign_ksync_obj_
Definition: ksync_init.h:102
std::string Description() const
Definition: queue_task.h:310
std::string AgentBackTrace(int skip=1)
Definition: agent.cc:1187
void GenericNetlinkInit()
Definition: ksync_init.cc:509
static void SetAgentSandeshContext(AgentSandeshContext *ctx, uint32_t idx)
Definition: ksync_sock.h:399
void ClearStats() const
Definition: queue_task.h:382
static void Init(EventManager *evm, boost::asio::ip::address ip_addr, int port, const std::string &cpu_pin_policy)
int huge_fd_[kHugePageFiles]
Definition: ksync_init.h:122
size_t queue_len() const
std::string ksync_thread_cpu_pin_policy() const
Definition: agent_param.h:450
virtual void InitFlowMem()
Definition: ksync_init.cc:572
boost::scoped_ptr< QosQueueKSyncObject > qos_queue_ksync_obj_
Definition: ksync_init.h:106
#define LOG(_Level, _Msg)
Definition: logging.h:33
static void SetNetlinkFamilyId(int id)
Definition: ksync_sock.cc:269
WorkQueueStats ksync_tx_queue_count_
boost::scoped_ptr< KSyncBridgeMemory > ksync_bridge_memory_
Definition: ksync_init.h:111
const Ip4Address vrouter_server_ip() const
Definition: agent.h:967
static KSyncObjectManager * Init()
void VnswInterfaceListenerInit()
Definition: ksync_init.cc:408
uint64_t busy_time() const
Definition: queue_task.h:380
size_t NumEnqueues() const
Definition: queue_task.h:360
const std::string huge_page_file_2M(uint16_t index) const
Definition: agent_param.h:498
static void Shutdown()
PktModule * pkt() const
Definition: agent.cc:965
boost::scoped_ptr< MirrorKSyncObject > mirror_ksync_obj_
Definition: ksync_init.h:99
uint16_t flow_thread_count() const
Definition: agent.h:1202
AgentProfile * agent_profile() const
Definition: operdb_init.h:79
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
void * ftable_huge_page_mem_get() const
Definition: ksync_init.h:90
bool cat_is_agent_mocked() const
Definition: agent_param.h:569
void set_measure_busy_time(bool val) const
const KSyncTxQueue * send_queue() const
Definition: ksync_sock.h:403
void ClearStats() const
virtual ~KSync()
Definition: ksync_init.cc:96
void TcpInit()
Definition: ksync_init.cc:531
void * huge_pages_[kHugePageFiles]
Definition: ksync_init.h:123