FD.io VPP  v17.07.01-10-g3be13f0
Vector Packet Processing
mc.h File Reference
+ Include dependency graph for mc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  mc_peer_id_t
 
struct  mc_serialize_stream_msg_t
 
struct  mc_transport_t
 
struct  mc_stream_peer_stats_t
 
struct  mc_stream_peer_t
 
struct  mc_retry_t
 
struct  mc_stream_stats_t
 
struct  mc_stream_config_t
 
struct  mc_stream_t
 
struct  mc_catchup_process_arg_t
 
struct  mc_mastership_peer_t
 
struct  mc_stream_and_buffer_t
 
struct  mc_main_t
 

Macros

#define MC_EVENT_LOGGING   1
 
#define foreach_mc_msg_type
 
#define MC_SERIALIZE_MSG(x, ...)
 
#define foreach_mc_stream_state
 
#define MC_STREAM_INDEX_INTERNAL   0
 
#define mc_serialize_stream(mc, si, msg, args...)   mc_serialize_internal((mc),(si),(0),(msg),(msg)->serialize,args)
 
#define mc_serialize(mc, msg, args...)   mc_serialize_internal((mc),(~0),(0),(msg),(msg)->serialize,args)
 
#define mc_serialize2(mc, add, msg, args...)   mc_serialize_internal((mc),(~0),(add),(msg),(msg)->serialize,args)
 

Typedefs

typedef struct _mc_serialize_msg mc_serialize_msg_t
 
typedef struct mc_stream_t mc_stream_t
 
typedef struct mc_main_t mc_main_t
 

Enumerations

enum  mc_relay_msg_type_t { foreach_mc_msg_type }
 
enum  mc_transport_type_t {
  MC_TRANSPORT_MASTERSHIP, MC_TRANSPORT_JOIN, MC_TRANSPORT_USER_REQUEST_TO_RELAY, MC_TRANSPORT_USER_REQUEST_FROM_RELAY,
  MC_N_TRANSPORT_TYPE
}
 
enum  mc_stream_state_t { foreach_mc_stream_state }
 
enum  mc_relay_state_t { MC_RELAY_STATE_NEGOTIATE, MC_RELAY_STATE_MASTER, MC_RELAY_STATE_SLAVE }
 

Functions

static uword mc_need_byte_swap (void)
 
static mc_peer_id_t mc_byte_swap_peer_id (mc_peer_id_t i)
 
static int mc_peer_id_compare (mc_peer_id_t a, mc_peer_id_t b)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;u32 global_sequence;}) mc_msg_master_assert_t
 
static void mc_byte_swap_msg_master_assert (mc_msg_master_assert_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;mc_relay_msg_type_t type:32;u32 stream_index;u8 is_join;}) mc_msg_join_or_leave_request_t
 
static void mc_byte_swap_msg_join_or_leave_request (mc_msg_join_or_leave_request_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;mc_relay_msg_type_t type:32;u32 stream_index;mc_peer_id_t catchup_peer_id;}) mc_msg_join_reply_t
 
static void mc_byte_swap_msg_join_reply (mc_msg_join_reply_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;u32 stream_index;u32 global_sequence;u32 local_sequence;u32 n_data_bytes;u8 data[0];}) mc_msg_user_request_t
 
static void mc_byte_swap_msg_user_request (mc_msg_user_request_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;u32 global_sequence;u32 stream_index;u32 local_sequence;i32 seq_cmp_result;}) mc_msg_user_ack_t
 
static void mc_byte_swap_msg_user_ack (mc_msg_user_ack_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;u32 stream_index;}) mc_msg_catchup_request_t
 
static void mc_byte_swap_msg_catchup_request (mc_msg_catchup_request_t *r)
 
typedef CLIB_PACKED (struct{mc_peer_id_t peer_id;u32 stream_index;u32 last_global_sequence_included;u32 n_data_bytes;u8 data[0];}) mc_msg_catchup_reply_t
 
static void mc_byte_swap_msg_catchup_reply (mc_msg_catchup_reply_t *r)
 
static void mc_stream_free (mc_stream_t *s)
 
static void mc_stream_init (mc_stream_t *s)
 
static mc_stream_tmc_stream_by_name (mc_main_t *m, char *name)
 
static mc_stream_tmc_stream_by_index (mc_main_t *m, u32 i)
 
static void mc_clear_stream_stats (mc_main_t *m)
 
foreach_mc_msg_type u32 mc_stream_join (mc_main_t *mcm, mc_stream_config_t *)
 
void mc_stream_leave (mc_main_t *mcm, u32 stream_index)
 
void mc_wait_for_stream_ready (mc_main_t *m, char *stream_name)
 
u32 mc_stream_send (mc_main_t *mcm, u32 stream_index, u32 buffer_index)
 
void mc_main_init (mc_main_t *mcm, char *tag)
 
void mc_enable_disable_mastership (mc_main_t *mcm, int we_can_be_master)
 
void * mc_get_vlib_buffer (struct vlib_main_t *vm, u32 n_bytes, u32 *bi_return)
 
clib_error_tmc_serialize_internal (mc_main_t *mc, u32 stream_index, u32 multiple_messages_per_vlib_buffer, mc_serialize_msg_t *msg,...)
 
clib_error_tmc_serialize_va (mc_main_t *mc, u32 stream_index, u32 multiple_messages_per_vlib_buffer, mc_serialize_msg_t *msg, va_list *va)
 
void mc_unserialize (mc_main_t *mcm, mc_stream_t *s, u32 buffer_index)
 
uword mc_unserialize_message (mc_main_t *mcm, mc_stream_t *s, serialize_main_t *m)
 
static uword mc_max_message_size_in_bytes (mc_main_t *mcm)
 
static word mc_serialize_n_bytes_left (mc_main_t *mcm, serialize_main_t *m)
 
void unserialize_mc_stream (serialize_main_t *m, va_list *va)
 
void mc_stream_join_process_hold (void)
 

Variables

format_function_t format_mc_main
 
serialize_function_t serialize_mc_main
 
serialize_function_t unserialize_mc_main
 

Macro Definition Documentation

#define foreach_mc_msg_type
Value:
_ (master_assert) \
_ (join_or_leave_request) \
_ (join_reply) \
_ (user_request) \
_ (user_ack) \
_ (catchup_request) \
_ (catchup_reply)

Definition at line 79 of file mc.h.

#define foreach_mc_stream_state
Value:
_ (invalid) \
_ (name_known) \
_ (join_in_progress) \
_ (catchup) \
_ (ready)

Definition at line 389 of file mc.h.

#define MC_EVENT_LOGGING   1

Definition at line 27 of file mc.h.

#define mc_serialize (   mc,
  msg,
  args... 
)    mc_serialize_internal((mc),(~0),(0),(msg),(msg)->serialize,args)

Definition at line 651 of file mc.h.

#define mc_serialize2 (   mc,
  add,
  msg,
  args... 
)    mc_serialize_internal((mc),(~0),(add),(msg),(msg)->serialize,args)

Definition at line 654 of file mc.h.

#define MC_SERIALIZE_MSG (   x,
  ... 
)
Value:
__VA_ARGS__ mc_serialize_msg_t x; \
static void __mc_serialize_msg_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __mc_serialize_msg_registration_##x (void) \
{ \
x.next_registration = vm->mc_msg_registrations; \
vm->mc_msg_registrations = &x; \
} \
__VA_ARGS__ mc_serialize_msg_t x
struct vlib_main_t vlib_main_t
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
struct _mc_serialize_msg mc_serialize_msg_t

Definition at line 254 of file mc.h.

#define mc_serialize_stream (   mc,
  si,
  msg,
  args... 
)    mc_serialize_internal((mc),(si),(0),(msg),(msg)->serialize,args)

Definition at line 648 of file mc.h.

#define MC_STREAM_INDEX_INTERNAL   0

Definition at line 413 of file mc.h.

Typedef Documentation

typedef struct mc_main_t mc_main_t
typedef struct _mc_serialize_msg mc_serialize_msg_t
typedef struct mc_stream_t mc_stream_t

Enumeration Type Documentation

Enumerator
foreach_mc_msg_type 

Definition at line 88 of file mc.h.

Enumerator
MC_RELAY_STATE_NEGOTIATE 
MC_RELAY_STATE_MASTER 
MC_RELAY_STATE_SLAVE 

Definition at line 502 of file mc.h.

Enumerator
foreach_mc_stream_state 

Definition at line 396 of file mc.h.

Enumerator
MC_TRANSPORT_MASTERSHIP 
MC_TRANSPORT_JOIN 
MC_TRANSPORT_USER_REQUEST_TO_RELAY 
MC_TRANSPORT_USER_REQUEST_FROM_RELAY 
MC_N_TRANSPORT_TYPE 

Definition at line 266 of file mc.h.

Function Documentation

typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;u32 global_sequence;}  )

+ Here is the caller graph for this function:

typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;mc_relay_msg_type_t type:32;u32 stream_index;u8 is_join;}  )
typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;mc_relay_msg_type_t type:32;u32 stream_index;mc_peer_id_t catchup_peer_id;}  )
typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;u32 stream_index;u32 global_sequence;u32 local_sequence;u32 n_data_bytes;u8 data[0];}  )
typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;u32 global_sequence;u32 stream_index;u32 local_sequence;i32 seq_cmp_result;}  )
typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;u32 stream_index;}  )
typedef CLIB_PACKED ( struct{mc_peer_id_t peer_id;u32 stream_index;u32 last_global_sequence_included;u32 n_data_bytes;u8 data[0];}  )
static void mc_byte_swap_msg_catchup_reply ( mc_msg_catchup_reply_t *  r)
inlinestatic

Definition at line 213 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_catchup_request ( mc_msg_catchup_request_t *  r)
inlinestatic

Definition at line 192 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_join_or_leave_request ( mc_msg_join_or_leave_request_t *  r)
inlinestatic

Definition at line 106 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_join_reply ( mc_msg_join_reply_t *  r)
inlinestatic

Definition at line 126 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_master_assert ( mc_msg_master_assert_t *  r)
inlinestatic

Definition at line 70 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_user_ack ( mc_msg_user_ack_t *  r)
inlinestatic

Definition at line 173 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_byte_swap_msg_user_request ( mc_msg_user_request_t *  r)
inlinestatic

Definition at line 152 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static mc_peer_id_t mc_byte_swap_peer_id ( mc_peer_id_t  i)
inlinestatic

Definition at line 47 of file mc.h.

+ Here is the caller graph for this function:

static void mc_clear_stream_stats ( mc_main_t m)
inlinestatic

Definition at line 602 of file mc.h.

+ Here is the call graph for this function:

void mc_enable_disable_mastership ( mc_main_t mcm,
int  we_can_be_master 
)

Definition at line 1879 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* mc_get_vlib_buffer ( struct vlib_main_t vm,
u32  n_bytes,
u32 bi_return 
)

Definition at line 110 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mc_main_init ( mc_main_t mcm,
char *  tag 
)

Definition at line 2417 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword mc_max_message_size_in_bytes ( mc_main_t mcm)
inlinestatic

Definition at line 664 of file mc.h.

+ Here is the caller graph for this function:

static uword mc_need_byte_swap ( void  )
inlinestatic

Definition at line 31 of file mc.h.

+ Here is the caller graph for this function:

static int mc_peer_id_compare ( mc_peer_id_t  a,
mc_peer_id_t  b 
)
inlinestatic

Definition at line 54 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* mc_serialize_internal ( mc_main_t mc,
u32  stream_index,
u32  multiple_messages_per_vlib_buffer,
mc_serialize_msg_t msg,
  ... 
)

Definition at line 2076 of file mc.c.

+ Here is the call graph for this function:

static word mc_serialize_n_bytes_left ( mc_main_t mcm,
serialize_main_t m 
)
inlinestatic

Definition at line 670 of file mc.h.

+ Here is the call graph for this function:

clib_error_t* mc_serialize_va ( mc_main_t mc,
u32  stream_index,
u32  multiple_messages_per_vlib_buffer,
mc_serialize_msg_t msg,
va_list *  va 
)

Definition at line 1993 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static mc_stream_t* mc_stream_by_index ( mc_main_t m,
u32  i 
)
inlinestatic

Definition at line 596 of file mc.h.

+ Here is the caller graph for this function:

static mc_stream_t* mc_stream_by_name ( mc_main_t m,
char *  name 
)
inlinestatic

Definition at line 589 of file mc.h.

+ Here is the caller graph for this function:

static void mc_stream_free ( mc_stream_t s)
inlinestatic

Definition at line 477 of file mc.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void mc_stream_init ( mc_stream_t s)
inlinestatic

Definition at line 489 of file mc.h.

+ Here is the caller graph for this function:

foreach_mc_msg_type u32 mc_stream_join ( mc_main_t mcm,
mc_stream_config_t  
)

Definition at line 879 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mc_stream_join_process_hold ( void  )

Definition at line 722 of file mc.c.

+ Here is the caller graph for this function:

void mc_stream_leave ( mc_main_t mcm,
u32  stream_index 
)

Definition at line 885 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 mc_stream_send ( mc_main_t mcm,
u32  stream_index,
u32  buffer_index 
)

Definition at line 1016 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mc_unserialize ( mc_main_t mcm,
mc_stream_t s,
u32  buffer_index 
)

Definition at line 2264 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword mc_unserialize_message ( mc_main_t mcm,
mc_stream_t s,
serialize_main_t m 
)

Definition at line 2101 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mc_wait_for_stream_ready ( mc_main_t m,
char *  stream_name 
)

Definition at line 993 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void unserialize_mc_stream ( serialize_main_t m,
va_list *  va 
)

Definition at line 1467 of file mc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

format_function_t format_mc_main

Definition at line 636 of file mc.h.

serialize_function_t serialize_mc_main

Definition at line 661 of file mc.h.

serialize_function_t unserialize_mc_main

Definition at line 661 of file mc.h.