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

Generated by: LCOV version 1.14