LCOV - code coverage report
Current view: top level - vnsw/agent/vrouter/ksync - ksync_init.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 19 31 61.3 %
Date: 2026-11-09 02:10:49 Functions: 10 16 62.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_ksync_init_h
       7             : #define vnsw_agent_ksync_init_h
       8             : 
       9             : #include <vrouter/ksync/flowtable_ksync.h>
      10             : #include <vrouter/ksync/mpls_ksync.h>
      11             : #include <vrouter/ksync/nexthop_ksync.h>
      12             : #include <vrouter/ksync/mirror_ksync.h>
      13             : #include <vrouter/ksync/route_ksync.h>
      14             : #include <vrouter/ksync/vxlan_ksync.h>
      15             : #include <vrouter/ksync/vrf_assign_ksync.h>
      16             : #include <vrouter/ksync/ksync_flow_index_manager.h>
      17             : #include <oper/agent_profile.h>
      18             : #include <vrouter/ksync/qos_queue_ksync.h>
      19             : #include <vrouter/ksync/forwarding_class_ksync.h>
      20             : #include <vrouter/ksync/qos_config_ksync.h>
      21             : #include <vrouter/ksync/ksync_bridge_table.h>
      22             : #include "vnswif_listener.h"
      23             : 
      24             : class KSyncFlowMemory;
      25             : class FlowTableKSyncObject;
      26             : class BridgeRouteAuditKSyncObject;
      27             : 
      28             : class KSync {
      29             : public:
      30             :     KSync(Agent *agent);
      31             :     virtual ~KSync();
      32             : 
      33             :     virtual void Init(bool create_vhost);
      34             :     virtual void InitDone();
      35             :     virtual void RegisterDBClients(DB *db);
      36             :     void VnswInterfaceListenerInit();
      37             :     void Shutdown();
      38             : 
      39             :     void UpdateVhostMac();
      40       71160 :     Agent *agent() const  { return agent_; }
      41         818 :     MirrorKSyncObject *mirror_ksync_obj() const {
      42         818 :         return mirror_ksync_obj_.get();
      43             :     }
      44       20338 :     NHKSyncObject *nh_ksync_obj() const {
      45       20338 :         return nh_ksync_obj_.get();
      46             :     }
      47           1 :     MplsKSyncObject *mpls_ksync_obj() const {
      48           1 :         return mpls_ksync_obj_.get();
      49             :     }
      50       15514 :     InterfaceKSyncObject *interface_ksync_obj() const {
      51       15514 :         return interface_ksync_obj_.get();
      52             :     }
      53        6706 :     VrfKSyncObject *vrf_ksync_obj() const {
      54        6706 :         return vrf_ksync_obj_.get();
      55             :     }
      56             :     FlowTableKSyncObject *flow_table_ksync_obj(uint16_t index) const {
      57             :         return flow_table_ksync_obj_list_[index];
      58             :     }
      59           0 :     VnswInterfaceListener *vnsw_interface_listner() const  {
      60           0 :         return vnsw_interface_listner_.get();
      61             :     }
      62         354 :     KSyncFlowMemory *ksync_flow_memory() const  {
      63         354 :         return ksync_flow_memory_.get();
      64             :     }
      65        2108 :     KSyncFlowIndexManager *ksync_flow_index_manager() const  {
      66        2108 :         return ksync_flow_index_manager_.get();
      67             :     }
      68             : 
      69             :     void SetProfileData(ProfileData *data);
      70           0 :     QosQueueKSyncObject *qos_queue_ksync_obj() const {
      71           0 :         return qos_queue_ksync_obj_.get();
      72             :     }
      73             : 
      74           0 :     ForwardingClassKSyncObject*  forwarding_class_ksync_obj() const {
      75           0 :         return forwarding_class_ksync_obj_.get();
      76             :     }
      77             : 
      78        1238 :     QosConfigKSyncObject* qos_config_ksync_obj() const {
      79        1238 :         return qos_config_ksync_obj_.get();
      80             :     }
      81             : 
      82           0 :     BridgeRouteAuditKSyncObject* bridge_route_audit_ksync_obj() const {
      83           0 :         return bridge_route_audit_ksync_obj_.get();
      84             :     }
      85             : 
      86           9 :     KSyncBridgeMemory* ksync_bridge_memory() const {
      87           9 :         return ksync_bridge_memory_.get();
      88             :     }
      89             : 
      90           0 :     void *btable_huge_page_mem_get() const {
      91           0 :         return huge_pages_[btable_huge_pages_index_];
      92             :     }
      93             : 
      94           0 :     void *ftable_huge_page_mem_get() const {
      95           0 :         return huge_pages_[ftable_huge_pages_index_];
      96             :     }
      97             : protected:
      98             :     Agent *agent_;
      99             :     boost::scoped_ptr<InterfaceKSyncObject> interface_ksync_obj_;
     100             :     std::vector<FlowTableKSyncObject *> flow_table_ksync_obj_list_;
     101             :     boost::scoped_ptr<MplsKSyncObject> mpls_ksync_obj_;
     102             :     boost::scoped_ptr<NHKSyncObject> nh_ksync_obj_;
     103             :     boost::scoped_ptr<MirrorKSyncObject> mirror_ksync_obj_;
     104             :     boost::scoped_ptr<VrfKSyncObject> vrf_ksync_obj_;
     105             :     boost::scoped_ptr<VxLanKSyncObject> vxlan_ksync_obj_;
     106             :     boost::scoped_ptr<VrfAssignKSyncObject> vrf_assign_ksync_obj_;
     107             :     boost::scoped_ptr<VnswInterfaceListener> vnsw_interface_listner_;
     108             :     boost::scoped_ptr<KSyncFlowMemory> ksync_flow_memory_;
     109             :     boost::scoped_ptr<KSyncFlowIndexManager> ksync_flow_index_manager_;
     110             :     boost::scoped_ptr<QosQueueKSyncObject> qos_queue_ksync_obj_;
     111             :     boost::scoped_ptr<ForwardingClassKSyncObject> forwarding_class_ksync_obj_;
     112             :     boost::scoped_ptr<QosConfigKSyncObject> qos_config_ksync_obj_;
     113             :     boost::scoped_ptr<BridgeRouteAuditKSyncObject>
     114             :         bridge_route_audit_ksync_obj_;
     115             :     boost::scoped_ptr<KSyncBridgeMemory> ksync_bridge_memory_;
     116             :     virtual void InitFlowMem();
     117             :     void SetHugePages();
     118             :     void ResetVRouter(bool run_sync_mode);
     119             :     int Encode(Sandesh &encoder, uint8_t *buf, int buf_len);
     120             : private:
     121             :     void InitVrouterOps(vrouter_ops *v);
     122             :     void NetlinkInit();
     123             :     void CreateVhostIntf();
     124             : 
     125             :     static const int kHugePageFiles = 4;
     126             :     int huge_fd_[kHugePageFiles];
     127             :     void *huge_pages_[kHugePageFiles];
     128             :     // index into huge_pages_[] where bridge table is mapped
     129             :     int btable_huge_pages_index_;
     130             :     // index into huge_pages_[] where flow table is mapped
     131             :     int ftable_huge_pages_index_;
     132             : 
     133             :     DISALLOW_COPY_AND_ASSIGN(KSync);
     134             : };
     135             : 
     136             : class KSyncTcp : public KSync {
     137             : public:
     138             :     KSyncTcp(Agent *agent);
     139             :     virtual ~KSyncTcp();
     140             :     virtual void Init(bool create_vhost);
     141             :     void TcpInit();
     142             : protected:
     143             :     virtual void InitFlowMem();
     144             : };
     145             : 
     146             : class KSyncUds : public KSync {
     147             : public:
     148             :     KSyncUds(Agent *agent);
     149             :     virtual ~KSyncUds();
     150             :     virtual void Init(bool create_vhost);
     151             :     void UdsInit();
     152             : protected:
     153             :     virtual void InitFlowMem();
     154             : };
     155             : 
     156             : int GenenericNetlinkFamily();
     157             : void GenericNetlinkInit();
     158             : 
     159             : #endif //vnsw_agent_ksync_init_h

Generated by: LCOV version 1.14