18 #ifndef included_vlib_mc_h 19 #define included_vlib_mc_h 26 #ifndef MC_EVENT_LOGGING 27 #define MC_EVENT_LOGGING 1 65 }) mc_msg_master_assert_t;
77 #define foreach_mc_msg_type \ 79 _ (join_or_leave_request) \ 87 #define _(f) MC_MSG_TYPE_##f, 103 }) mc_msg_join_or_leave_request_t;
126 }) mc_msg_join_reply_t;
158 }) mc_msg_user_request_t;
180 }) mc_msg_user_ack_t;
199 }) mc_msg_catchup_request_t;
218 u32 last_global_sequence_included;
225 }) mc_msg_catchup_reply_t;
234 r->last_global_sequence_included =
clib_byte_swap_u32 (r->last_global_sequence_included);
239 typedef struct _mc_serialize_msg {
249 u32 max_n_bytes_serialized;
258 struct _mc_serialize_msg * next_registration;
266 #define MC_SERIALIZE_MSG(x,...) \ 267 __VA_ARGS__ mc_serialize_msg_t x; \ 268 static void __mc_serialize_msg_registration_##x (void) \ 269 __attribute__((__constructor__)) ; \ 270 static void __mc_serialize_msg_registration_##x (void) \ 272 vlib_main_t * vm = vlib_get_main(); \ 273 x.next_registration = vm->mc_msg_registrations; \ 274 vm->mc_msg_registrations = &x; \ 276 __VA_ARGS__ mc_serialize_msg_t x 374 u8 * snapshot_vector,
375 u32 last_global_sequence_included);
380 u32 n_snapshot_data_bytes);
386 u32 n_snapshot_data_bytes);
394 #define foreach_mc_stream_state \ 397 _ (join_in_progress) \ 402 #define _(f) MC_STREAM_STATE_##f, 416 #define MC_STREAM_INDEX_INTERNAL 0 494 memset (s, 0,
sizeof (s[0]));
608 p->stats_last_clear = p->stats;
614 #define _(f) void mc_msg_##f##_handler (mc_main_t * mcm, mc_msg_##f##_t * msg, u32 buffer_index); 637 u32 multiple_messages_per_vlib_buffer,
644 u32 multiple_messages_per_vlib_buffer,
648 #define mc_serialize_stream(mc,si,msg,args...) \ 649 mc_serialize_internal((mc),(si),(0),(msg),(msg)->serialize,args) 651 #define mc_serialize(mc,msg,args...) \ 652 mc_serialize_internal((mc),(~0),(0),(msg),(msg)->serialize,args) 654 #define mc_serialize2(mc,add,msg,args...) \ 655 mc_serialize_internal((mc),(~0),(add),(msg),(msg)->serialize,args) u32 last_global_sequence_processed
always_inline i32 clib_byte_swap_i32(i32 x)
mhash_t mastership_peer_index_by_id
always_inline uword mc_max_message_size_in_bytes(mc_main_t *mcm)
sll srl srl sll sra u16x4 i
void mc_main_init(mc_main_t *mcm, char *tag)
always_inline void mhash_free(mhash_t *h)
always_inline u32 serialize_vlib_buffer_n_bytes(serialize_main_t *m)
u64 user_requests_received
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
always_inline int mc_peer_id_compare(mc_peer_id_t a, mc_peer_id_t b)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
always_inline mc_stream_t * mc_stream_by_index(mc_main_t *m, u32 i)
vlib_one_time_waiting_process_t * procs_waiting_for_join_done
u32 last_sequence_received
always_inline void mc_stream_free(mc_stream_t *s)
always_inline mc_peer_id_t mc_byte_swap_peer_id(mc_peer_id_t i)
void mc_stream_join_process_hold(void)
always_inline void mc_byte_swap_msg_user_request(mc_msg_user_request_t *r)
#define CLIB_ARCH_IS_LITTLE_ENDIAN
mc_serialize_msg_t ** global_msgs
#define foreach_mc_stream_state
struct mc_main_t mc_main_t
always_inline void mc_clear_stream_stats(mc_main_t *m)
always_inline u32 clib_byte_swap_u32(u32 x)
typedef CLIB_PACKED(struct{mc_peer_id_t peer_id;u32 global_sequence;}) mc_msg_master_assert_t
u32 relay_global_sequence
format_function_t format_mc_main
uword * stream_msg_index_by_name
#define pool_foreach(VAR, POOL, BODY)
struct mc_stream_t mc_stream_t
mc_stream_config_t config
clib_error_t * mc_serialize_internal(mc_main_t *mc, u32 stream_index, u32 multiple_messages_per_vlib_buffer, mc_serialize_msg_t *msg,...)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void unserialize_mc_stream(serialize_main_t *m, va_list *va)
mc_peer_id_t our_catchup_peer_id
always_inline mc_stream_t * mc_stream_by_name(mc_main_t *m, char *name)
always_inline void mc_byte_swap_msg_catchup_request(mc_msg_catchup_request_t *r)
uword * stream_index_by_name
uword * procs_waiting_for_stream_name_by_name
void mc_wait_for_stream_ready(mc_main_t *m, char *stream_name)
mc_mastership_peer_t * mastership_peers
serialize_function_t unserialize_mc_main
foreach_mc_msg_type u32 mc_stream_join(mc_main_t *mcm, mc_stream_config_t *)
always_inline void mc_byte_swap_msg_user_ack(mc_msg_user_ack_t *r)
vlib_one_time_waiting_process_t * procs_waiting_for_open_window
uword mc_unserialize_message(mc_main_t *mcm, mc_stream_t *s, serialize_main_t *m)
uword * unacked_by_peer_bitmap
void mc_stream_leave(mc_main_t *mcm, u32 stream_index)
f64 time_last_master_assert_received
mc_catchup_process_arg_t * catchup_process_args
always_inline void mc_byte_swap_msg_join_or_leave_request(mc_msg_join_or_leave_request_t *r)
always_inline void mc_stream_init(mc_stream_t *s)
void mc_enable_disable_mastership(mc_main_t *mcm, int we_can_be_master)
always_inline void mc_byte_swap_msg_join_reply(mc_msg_join_reply_t *r)
u32 mc_stream_send(mc_main_t *mcm, u32 stream_index, u32 buffer_index)
mc_peer_id_t our_ack_peer_id
static void catchup_send_fun(void *transport_main, uword opaque, u8 *data)
always_inline uword mc_need_byte_swap(void)
void * mc_get_vlib_buffer(struct vlib_main_t *vm, u32 n_bytes, u32 *bi_return)
clib_error_t * serialize(serialize_main_t *m,...)
#define vec_free(V)
Free vector's memory (no header).
mhash_t elog_id_by_peer_id
always_inline void mc_byte_swap_msg_master_assert(mc_msg_master_assert_t *r)
mc_retry_t * retired_fifo
always_inline void mc_byte_swap_msg_catchup_reply(mc_msg_catchup_reply_t *r)
void mc_unserialize(mc_main_t *mcm, mc_stream_t *s, u32 buffer_index)
mc_stream_stats_t stats_last_clear
mc_serialize_stream_msg_t * stream_msgs
clib_error_t * unserialize(serialize_main_t *m,...)
u32 we_can_be_relay_master
#define clib_fifo_free(f)
vlib_one_time_waiting_process_t ** procs_waiting_for_stream_name_pool
uword * global_msg_index_by_name
mc_relay_state_t relay_state
struct _mc_serialize_msg mc_serialize_msg_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void( serialize_function_t)(serialize_main_t *m, va_list *va)
mc_stream_peer_stats_t stats_last_clear
uword * retry_index_by_local_sequence
uword * elog_id_by_msg_name
mc_stream_and_buffer_t * mc_unserialize_stream_and_buffers
serialize_function_t serialize_mc_main
format_function_t * format_peer_id
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)
#define vec_foreach(var, vec)
Vector iterator.
#define foreach_mc_msg_type
always_inline word mc_serialize_n_bytes_left(mc_main_t *mcm, serialize_main_t *m)
u32 * stream_msg_index_by_global_index
struct vlib_main_t * vlib_main
static uword catchup_request_fun(void *transport_main, u32 stream_index, mc_peer_id_t catchup_peer_id)
mc_stream_t * stream_vector