Improve fifo allocator performance
[vpp.git] / src / vlibapi / api.h
index 7538050..0e2c210 100644 (file)
@@ -25,6 +25,7 @@
 #include <vlib/vlib.h>
 #include <vlibmemory/unix_shared_memory_queue.h>
 #include <vlib/unix/unix.h>
+#include <stddef.h>
 
 typedef enum
 {
@@ -192,6 +193,9 @@ typedef struct
 
   i32 vlib_signal;
 
+  /* vlib input queue length */
+  u32 vlib_input_queue_length;
+
   /* client side message index hash table */
   uword *msg_index_by_name_and_crc;
 
@@ -280,6 +284,7 @@ u16 vl_msg_api_get_msg_ids (const char *name, int n);
 void vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string,
                                  u32 id);
 u32 vl_api_get_msg_index (u8 * name_and_crc);
+u32 vl_msg_api_get_msg_length (void *msg_arg);
 
 /* node_serialize.c prototypes */
 u8 *vlib_node_serialize (vlib_node_main_t * nm, u8 * vector,
@@ -336,6 +341,15 @@ static void __vl_msg_api_add_##tag##_function_##x (void)                \
     _error = _f (ci);                                                   \
   })
 
+static inline u32
+vl_msg_api_get_msg_length_inline (void *msg_arg)
+{
+  u8 *msg = (u8 *) msg_arg;
+
+  msgbuf_t *header = (msgbuf_t *) (msg - offsetof (msgbuf_t, data));
+
+  return clib_net_to_host_u32 (header->data_len);
+}
 #endif /* included_api_h */
 
 /*