OpenSDN source code
|
#include <ksync_sock.h>
Classes | |
struct | KSyncRxData |
struct | KSyncRxQueueData |
Public Types | |
typedef std::map< uint32_t, KSyncBulkMsgContext > | WaitTree |
typedef std::pair< uint32_t, KSyncBulkMsgContext > | WaitTreePair |
typedef boost::function< void(const boost::system::error_code &, size_t)> | HandlerCb |
typedef WorkQueue< KSyncRxData > | KSyncReceiveQueue |
typedef WorkQueue < KSyncRxQueueData > | KSyncRxWorkQueue |
Public Member Functions | |
KSyncSock () | |
virtual | ~KSyncSock () |
virtual bool | BulkDecoder (char *data, KSyncBulkSandeshContext *ctxt)=0 |
virtual bool | Decoder (char *data, AgentSandeshContext *ctxt)=0 |
void | SendAsync (KSyncEntry *entry, int msg_len, char *msg, KSyncEntry::KSyncEvent event) |
std::size_t | BlockingSend (char *msg, int msg_len) |
bool | BlockingRecv () |
void | GenericSend (IoContext *ctx) |
uint32_t | AllocSeqNo (IoContext::Type type) |
uint32_t | AllocSeqNo (IoContext::Type type, uint32_t instance) |
KSyncReceiveQueue * | GetReceiveQueue (IoContext::Type type, uint32_t instance) |
KSyncReceiveQueue * | GetReceiveQueue (uint32_t seqno) |
KSyncBulkMsgContext * | LocateBulkContext (uint32_t seqno, IoContext::Type io_context_type, uint32_t work_queue_index) |
int | SendBulkMessage (KSyncBulkMsgContext *bulk_context, uint32_t seqno) |
bool | TryAddToBulk (KSyncBulkMsgContext *bulk_context, IoContext *ioc) |
void | OnEmptyQueue (bool done) |
int | tx_count () const |
const KSyncTxQueue * | send_queue () const |
const KSyncReceiveQueue * | get_receive_work_queue (uint16_t index) const |
KSyncReceiveQueue * | AllocQueue (KSyncBulkSandeshContext ctxt[], uint32_t task_id, uint32_t instance, const char *name) |
uint32_t | WaitTreeSize () const |
void | SetSeqno (uint32_t seq) |
void | SetMeasureQueueDelay (bool val) |
void | reset_use_wait_tree () |
void | set_process_data_inline () |
void | EnqueueRxProcessData (KSyncEntry *entry, KSyncEntry::KSyncEvent event) |
Static Public Member Functions | |
static void | Start (bool read_inline) |
static void | Shutdown () |
static KSyncSock * | Get (DBTablePartBase *partition) |
static KSyncSock * | Get (int partition_id) |
static uint32_t | GetPid () |
static int | GetNetlinkFamilyId () |
static void | SetNetlinkFamilyId (int id) |
static AgentSandeshContext * | GetAgentSandeshContext (uint32_t type) |
static void | SetAgentSandeshContext (AgentSandeshContext *ctx, uint32_t idx) |
Static Public Attributes | |
static const int | kRxWorkQueueCount = 2 |
static const int | kMsgGrowSize = 16 |
static const unsigned | kBufLen = (4*1024) |
static const unsigned | kMaxBulkMsgCount = 16 |
static const unsigned | kMaxBulkMsgSize = (4*1024) |
static const unsigned | kInvalidBulkSeqNo = 0xFFFFFFFF |
Protected Member Functions | |
bool | ValidateAndEnqueue (char *data, KSyncBulkMsgContext *context) |
KSyncBulkSandeshContext * | GetBulkSandeshContext (uint32_t seqno) |
void | ProcessDataInline (char *data) |
Static Protected Member Functions | |
static void | Init (bool use_work_queue, const std::string &cpu_pin_policy) |
static void | SetSockTableEntry (KSyncSock *sock) |
Protected Attributes | |
tbb::mutex | mutex_ |
nl_client * | nl_client_ |
WaitTree | wait_tree_ |
KSyncTxQueue | send_queue_ |
KSyncReceiveQueue * | uve_rx_queue [kRxWorkQueueCount] |
KSyncReceiveQueue * | ksync_rx_queue [kRxWorkQueueCount] |
uint32_t | max_bulk_msg_count_ |
uint32_t | max_bulk_buf_size_ |
uint32_t | bulk_seq_no_ |
uint32_t | bulk_buf_size_ |
uint32_t | bulk_msg_count_ |
uint32_t | bmca_prod_ |
uint32_t | bmca_cons_ |
KSyncBulkMsgContext * | bulk_mctx_arr_ [KSYNC_BMC_ARR_SIZE] |
Private Member Functions | |
virtual void | AsyncReceive (boost::asio::mutable_buffers_1, HandlerCb)=0 |
virtual void | AsyncSendTo (KSyncBufferList *iovec, uint32_t seq_no, HandlerCb cb)=0 |
virtual std::size_t | SendTo (KSyncBufferList *iovec, uint32_t seq_no)=0 |
virtual void | Receive (boost::asio::mutable_buffers_1)=0 |
virtual uint32_t | GetSeqno (char *data)=0 |
virtual bool | IsMoreData (char *data)=0 |
virtual bool | Validate (char *data)=0 |
void | ReadHandler (const boost::system::error_code &error, size_t bytes_transferred) |
void | WriteHandler (const boost::system::error_code &error, size_t bytes_transferred) |
bool | ProcessKernelData (KSyncBulkSandeshContext *ksync_context, const KSyncRxData &data) |
bool | ProcessRxData (KSyncRxQueueData data) |
bool | SendAsyncImpl (IoContext *ioc) |
bool | SendAsyncStart () |
DISALLOW_COPY_AND_ASSIGN (KSyncSock) | |
Private Attributes | |
char * | rx_buff_ |
tbb::atomic< uint32_t > | seqno_ |
tbb::atomic< uint32_t > | uve_seqno_ |
bool | read_inline_ |
KSyncBulkMsgContext * | bulk_msg_context_ |
bool | use_wait_tree_ |
bool | process_data_inline_ |
KSyncBulkSandeshContext | ksync_bulk_sandesh_context_ [kRxWorkQueueCount] |
KSyncBulkSandeshContext | uve_bulk_sandesh_context_ [kRxWorkQueueCount] |
int | tx_count_ |
int | ack_count_ |
int | err_count_ |
KSyncRxWorkQueue | rx_process_queue_ |
Static Private Attributes | |
static std::unique_ptr< KSyncSock > | sock_ |
static pid_t | pid_ |
static int | vnsw_netlink_family_id_ |
static AgentSandeshContext * | agent_sandesh_ctx_ [kRxWorkQueueCount] |
static tbb::atomic< bool > | shutdown_ |
Friends | |
class | KSyncTxQueue |
Definition at line 311 of file ksync_sock.h.
typedef boost::function<void(const boost::system::error_code &, size_t)> KSyncSock::HandlerCb |
Definition at line 328 of file ksync_sock.h.
Definition at line 345 of file ksync_sock.h.
Definition at line 355 of file ksync_sock.h.
typedef std::map<uint32_t, KSyncBulkMsgContext> KSyncSock::WaitTree |
Definition at line 325 of file ksync_sock.h.
typedef std::pair<uint32_t, KSyncBulkMsgContext> KSyncSock::WaitTreePair |
Definition at line 326 of file ksync_sock.h.
KSyncSock::KSyncSock | ( | ) |
|
virtual |
KSyncSock::KSyncReceiveQueue * KSyncSock::AllocQueue | ( | KSyncBulkSandeshContext | ctxt[], |
uint32_t | task_id, | ||
uint32_t | instance, | ||
const char * | name | ||
) |
uint32_t KSyncSock::AllocSeqNo | ( | IoContext::Type | type | ) |
Definition at line 299 of file ksync_sock.cc.
uint32_t KSyncSock::AllocSeqNo | ( | IoContext::Type | type, |
uint32_t | instance | ||
) |
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
bool KSyncSock::BlockingRecv | ( | ) |
size_t KSyncSock::BlockingSend | ( | char * | msg, |
int | msg_len | ||
) |
|
pure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
pure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
private |
void KSyncSock::EnqueueRxProcessData | ( | KSyncEntry * | entry, |
KSyncEntry::KSyncEvent | event | ||
) |
void KSyncSock::GenericSend | ( | IoContext * | ctx | ) |
|
static |
Definition at line 340 of file ksync_sock.cc.
|
static |
Definition at line 344 of file ksync_sock.cc.
|
inline |
Definition at line 404 of file ksync_sock.h.
|
inlinestatic |
Definition at line 396 of file ksync_sock.h.
|
protected |
Definition at line 331 of file ksync_sock.cc.
|
inlinestatic |
Definition at line 393 of file ksync_sock.h.
|
inlinestatic |
Definition at line 392 of file ksync_sock.h.
KSyncSock::KSyncReceiveQueue * KSyncSock::GetReceiveQueue | ( | IoContext::Type | type, |
uint32_t | instance | ||
) |
Definition at line 303 of file ksync_sock.cc.
KSyncSock::KSyncReceiveQueue * KSyncSock::GetReceiveQueue | ( | uint32_t | seqno | ) |
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
staticprotected |
Definition at line 226 of file ksync_sock.cc.
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
KSyncBulkMsgContext * KSyncSock::LocateBulkContext | ( | uint32_t | seqno, |
IoContext::Type | io_context_type, | ||
uint32_t | work_queue_index | ||
) |
Definition at line 544 of file ksync_sock.cc.
void KSyncSock::OnEmptyQueue | ( | bool | done | ) |
|
protected |
|
private |
|
private |
|
private |
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
inline |
Definition at line 416 of file ksync_sock.h.
|
inline |
Definition at line 403 of file ksync_sock.h.
void KSyncSock::SendAsync | ( | KSyncEntry * | entry, |
int | msg_len, | ||
char * | msg, | ||
KSyncEntry::KSyncEvent | event | ||
) |
|
private |
|
inlineprivate |
Definition at line 477 of file ksync_sock.h.
int KSyncSock::SendBulkMessage | ( | KSyncBulkMsgContext * | bulk_context, |
uint32_t | seqno | ||
) |
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
inline |
Definition at line 417 of file ksync_sock.h.
|
inlinestatic |
Definition at line 399 of file ksync_sock.h.
void KSyncSock::SetMeasureQueueDelay | ( | bool | val | ) |
|
static |
void KSyncSock::SetSeqno | ( | uint32_t | seq | ) |
Definition at line 278 of file ksync_sock.cc.
|
staticprotected |
Definition at line 264 of file ksync_sock.cc.
|
static |
Definition at line 220 of file ksync_sock.cc.
|
static |
bool KSyncSock::TryAddToBulk | ( | KSyncBulkMsgContext * | bulk_context, |
IoContext * | ioc | ||
) |
|
inline |
Definition at line 382 of file ksync_sock.h.
|
privatepure virtual |
Implemented in KSyncSockTcp, KSyncSockUds, KSyncSockUdp, KSyncSockNetlink, and KSyncSockTypeMap.
|
protected |
uint32_t KSyncSock::WaitTreeSize | ( | ) | const |
Definition at line 274 of file ksync_sock.cc.
|
private |
Definition at line 469 of file ksync_sock.cc.
|
friend |
Definition at line 455 of file ksync_sock.h.
|
private |
Definition at line 497 of file ksync_sock.h.
|
staticprivate |
Definition at line 511 of file ksync_sock.h.
|
protected |
Definition at line 451 of file ksync_sock.h.
|
protected |
Definition at line 450 of file ksync_sock.h.
|
protected |
Definition at line 446 of file ksync_sock.h.
|
protected |
Definition at line 452 of file ksync_sock.h.
|
private |
Definition at line 489 of file ksync_sock.h.
|
protected |
Definition at line 448 of file ksync_sock.h.
|
protected |
Definition at line 444 of file ksync_sock.h.
|
private |
Definition at line 498 of file ksync_sock.h.
|
static |
Definition at line 316 of file ksync_sock.h.
|
static |
Definition at line 323 of file ksync_sock.h.
|
static |
Definition at line 319 of file ksync_sock.h.
|
static |
Definition at line 321 of file ksync_sock.h.
|
static |
Definition at line 315 of file ksync_sock.h.
|
static |
Definition at line 314 of file ksync_sock.h.
|
private |
Definition at line 492 of file ksync_sock.h.
|
protected |
Definition at line 433 of file ksync_sock.h.
|
protected |
Definition at line 440 of file ksync_sock.h.
|
protected |
Definition at line 438 of file ksync_sock.h.
|
protected |
Definition at line 427 of file ksync_sock.h.
|
protected |
Definition at line 428 of file ksync_sock.h.
|
staticprivate |
Definition at line 505 of file ksync_sock.h.
|
private |
Definition at line 491 of file ksync_sock.h.
|
private |
Definition at line 488 of file ksync_sock.h.
|
private |
Definition at line 483 of file ksync_sock.h.
|
private |
Definition at line 503 of file ksync_sock.h.
|
protected |
Definition at line 431 of file ksync_sock.h.
|
private |
Definition at line 484 of file ksync_sock.h.
|
staticprivate |
Definition at line 512 of file ksync_sock.h.
|
staticprivate |
Definition at line 504 of file ksync_sock.h.
|
private |
Definition at line 496 of file ksync_sock.h.
|
private |
Definition at line 490 of file ksync_sock.h.
|
private |
Definition at line 493 of file ksync_sock.h.
|
protected |
Definition at line 432 of file ksync_sock.h.
|
private |
Definition at line 485 of file ksync_sock.h.
|
staticprivate |
Definition at line 506 of file ksync_sock.h.
|
protected |
Definition at line 430 of file ksync_sock.h.