OpenSDN source code
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
ksync_flow_index_manager.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
3
*/
4
#ifndef __VNSW_AGENT_VROUTER_KSYNC_KSYNC_FLOW_INDEX_MANAGER_H__
5
#define __VNSW_AGENT_VROUTER_KSYNC_KSYNC_FLOW_INDEX_MANAGER_H__
6
7
#include <tbb/mutex.h>
8
#include <
pkt/flow_entry.h
>
9
11
// The module is responsible to manage assignment of vrouter flow-table index
12
// to the flow.
13
//
14
// The module maintains following information,
15
//
16
// KSyncFlowIndexManager::IndexTree
17
// Common table containing information about which flow owns the index.
18
// Each entry in tree is of type KSyncFlowIndexManager::IndexEntry.
19
// It contains,
20
// owner_ : Flow owning the index
22
class
FlowEntry
;
23
class
FlowProto
;
24
class
KSyncFlowIndexManager
;
25
class
FlowTableKSyncObject
;
26
class
SandeshFlowIndexInfo;
27
28
class
KSyncFlowIndexManager
{
29
public
:
30
// use buffer of 127 (half of the gen-id range) to identify Active
31
// gen id while accounting for roll-over of gen-id
32
static
const
uint8_t
kActiveGenIdDiffMax
= 127;
33
34
struct
IndexEntry
{
35
IndexEntry
() :
owner_
(NULL) { }
36
virtual
~IndexEntry
() {
37
assert(
owner_
.get() == NULL);
38
}
39
// copy-contructor is needed by std::vector but should never be used
40
IndexEntry
(
const
IndexEntry
& i) {
41
assert(0);
42
}
43
44
tbb::mutex
mutex_
;
45
FlowEntryPtr
owner_
;
46
};
47
KSyncFlowIndexManager
(
KSync
*ksync);
48
virtual
~KSyncFlowIndexManager
();
49
void
InitDone
(uint32_t count);
50
51
FlowEntryPtr
FindByIndex
(uint32_t idx);
52
53
void
Update
(
FlowEntry
*flow);
54
void
Delete
(
FlowEntry
*flow);
55
void
DisableSend
(
FlowEntry
*flow, uint8_t evict_gen_id);
56
void
UpdateFlowHandle
(
FlowTableKSyncEntry
*kentry, uint32_t index,
57
uint8_t gen_id);
58
void
TriggerKSyncEvent
(
FlowTableKSyncEntry
*kentry,
59
KSyncEntry::KSyncEvent
event);
60
61
uint16_t
sm_log_count
()
const
{
return
sm_log_count_
; }
62
63
private
:
64
uint8_t
AcquireIndexUnLocked
(uint32_t index, uint8_t gen_id,
65
FlowEntry
*flow);
66
void
ReleaseIndexUnLocked
(
FlowEntry
*flow);
67
68
void
CreateInternal
(
FlowEntry
*flow);
69
70
KSync
*
ksync_
;
71
FlowProto
*
proto_
;
72
uint32_t
count_
;
73
struct
IndexEntry
*
index_list_
;
74
uint16_t
sm_log_count_
;
75
};
76
77
#endif // __VNSW_AGENT_VROUTER_KSYNC_KSYNC_FLOW_INDEX_MANAGER_H__
KSyncFlowIndexManager::Delete
void Delete(FlowEntry *flow)
Definition:
ksync_flow_index_manager.cc:89
KSync
Definition:
ksync_init.h:27
KSyncFlowIndexManager::IndexEntry::IndexEntry
IndexEntry()
Definition:
ksync_flow_index_manager.h:35
FlowProto
Definition:
flow_proto.h:46
KSyncFlowIndexManager::IndexEntry
Definition:
ksync_flow_index_manager.h:34
KSyncFlowIndexManager::FindByIndex
FlowEntryPtr FindByIndex(uint32_t idx)
Definition:
ksync_flow_index_manager.cc:43
KSyncFlowIndexManager::IndexEntry::~IndexEntry
virtual ~IndexEntry()
Definition:
ksync_flow_index_manager.h:36
KSyncFlowIndexManager::IndexEntry::owner_
FlowEntryPtr owner_
Definition:
ksync_flow_index_manager.h:45
KSyncFlowIndexManager::proto_
FlowProto * proto_
Definition:
ksync_flow_index_manager.h:71
KSyncFlowIndexManager::KSyncFlowIndexManager
KSyncFlowIndexManager(KSync *ksync)
Definition:
ksync_flow_index_manager.cc:24
KSyncFlowIndexManager::IndexEntry::mutex_
tbb::mutex mutex_
Definition:
ksync_flow_index_manager.h:44
flow_entry.h
KSyncFlowIndexManager::sm_log_count_
uint16_t sm_log_count_
Definition:
ksync_flow_index_manager.h:74
KSyncFlowIndexManager::~KSyncFlowIndexManager
virtual ~KSyncFlowIndexManager()
Definition:
ksync_flow_index_manager.cc:28
KSyncFlowIndexManager::index_list_
struct IndexEntry * index_list_
Definition:
ksync_flow_index_manager.h:73
FlowEntry
Definition:
flow_entry.h:460
KSyncFlowIndexManager::ksync_
KSync * ksync_
Definition:
ksync_flow_index_manager.h:70
KSyncFlowIndexManager::CreateInternal
void CreateInternal(FlowEntry *flow)
Definition:
ksync_flow_index_manager.cc:268
KSyncFlowIndexManager::IndexEntry::IndexEntry
IndexEntry(const IndexEntry &i)
Definition:
ksync_flow_index_manager.h:40
KSyncFlowIndexManager::sm_log_count
uint16_t sm_log_count() const
Definition:
ksync_flow_index_manager.h:61
KSyncFlowIndexManager::InitDone
void InitDone(uint32_t count)
Definition:
ksync_flow_index_manager.cc:33
FlowTableKSyncEntry
Definition:
flowtable_ksync.h:49
KSyncFlowIndexManager::Update
void Update(FlowEntry *flow)
Definition:
ksync_flow_index_manager.cc:57
KSyncEntry::KSyncEvent
KSyncEvent
Definition:
ksync_entry.h:51
KSyncFlowIndexManager::UpdateFlowHandle
void UpdateFlowHandle(FlowTableKSyncEntry *kentry, uint32_t index, uint8_t gen_id)
Definition:
ksync_flow_index_manager.cc:130
KSyncFlowIndexManager::TriggerKSyncEvent
void TriggerKSyncEvent(FlowTableKSyncEntry *kentry, KSyncEntry::KSyncEvent event)
Definition:
ksync_flow_index_manager.cc:200
KSyncFlowIndexManager
Definition:
ksync_flow_index_manager.h:28
KSyncFlowIndexManager::count_
uint32_t count_
Definition:
ksync_flow_index_manager.h:72
KSyncFlowIndexManager::ReleaseIndexUnLocked
void ReleaseIndexUnLocked(FlowEntry *flow)
Definition:
ksync_flow_index_manager.cc:258
KSyncFlowIndexManager::kActiveGenIdDiffMax
static const uint8_t kActiveGenIdDiffMax
Definition:
ksync_flow_index_manager.h:32
KSyncFlowIndexManager::DisableSend
void DisableSend(FlowEntry *flow, uint8_t evict_gen_id)
Definition:
ksync_flow_index_manager.cc:111
KSyncFlowIndexManager::AcquireIndexUnLocked
uint8_t AcquireIndexUnLocked(uint32_t index, uint8_t gen_id, FlowEntry *flow)
Definition:
ksync_flow_index_manager.cc:213
FlowTableKSyncObject
Definition:
flowtable_ksync.h:212
FlowEntryPtr
boost::intrusive_ptr< FlowEntry > FlowEntryPtr
Definition:
flow_entry.h:125
contrail
controller
src
vnsw
agent
vrouter
ksync
ksync_flow_index_manager.h
Generated by
1.8.5