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