X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlibapi%2Fapi_common.h;h=915ddabaca12a85abaca22f7562bf418905004ee;hb=b2525922cd7932413a370c212c09485367d15464;hp=c3ef57338bc402c395d7339ad56018e73d33a9f2;hpb=39d69112fcec114fde34955ceb41555221d3ba11;p=vpp.git diff --git a/src/vlibapi/api_common.h b/src/vlibapi/api_common.h index c3ef57338bc..915ddabaca1 100644 --- a/src/vlibapi/api_common.h +++ b/src/vlibapi/api_common.h @@ -20,7 +20,8 @@ #ifndef included_api_common_h #define included_api_common_h -/** \file API common definitions +/** \file api_common.h + * API common definitions * See api_doc.md for more info */ @@ -131,6 +132,7 @@ typedef struct int replay; /**< is this message to be replayed? */ int message_bounce; /**< do not free message after processing */ int is_mp_safe; /**< worker thread barrier required? */ + int is_autoendian; /**< endian conversion required? */ } vl_msg_api_msg_config_t; /** Message header structure */ @@ -201,7 +203,9 @@ void vl_msg_api_set_first_available_msg_id (u16 first_avail); u16 vl_msg_api_get_msg_ids (const char *name, int n); u32 vl_msg_api_get_msg_index (u8 * name_and_crc); void *vl_msg_push_heap (void); +void *vl_msg_push_heap_w_region (svm_region_t * vlib_rp); void vl_msg_pop_heap (void *oldheap); +void vl_msg_pop_heap_w_region (svm_region_t * vlib_rp, void *oldheap); typedef clib_error_t *(vl_msg_api_init_function_t) (u32 client_index); @@ -220,7 +224,7 @@ typedef struct } api_version_t; /** API main structure, used by both vpp and binary API clients */ -typedef struct +typedef struct api_main_t { /** Message handler vector */ void (**msg_handlers) (void *); @@ -245,6 +249,9 @@ typedef struct /** Message is mp safe vector */ u8 *is_mp_safe; + /** Message requires us to do endian conversion */ + u8 *is_autoendian; + /** Allocator ring vectors (in shared memory) */ struct ring_alloc_ *arings; @@ -367,6 +374,12 @@ typedef struct elog_main_t *elog_main; int elog_trace_api_messages; + /** performance counter callback **/ + void (**perf_counter_cbs) + (struct api_main_t *, u32 id, int before_or_after); + void (**perf_counter_cbs_tmp) + (struct api_main_t *, u32 id, int before_or_after); + } api_main_t; extern __thread api_main_t *my_api_main; @@ -378,6 +391,12 @@ vlibapi_get_main (void) return my_api_main; } +always_inline void +vlibapi_set_main (api_main_t * am) +{ + my_api_main = am; +} + #endif /* included_api_common_h */ /*