30 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_UT 63 .hlp_id_remote = *id_remote,
64 .hlp_id_connection = *id_connection,
66 .hlcc_rpc_service_fid =
M0_FID0,
70 .hlcc_disconnect_timeout =
M0_MKTIME(5, 0),
71 .hlcc_resend_interval =
M0_MKTIME(0, 15000000),
72 .hlcc_nr_sent_max = 1,
87 .hlc_reqh_service = hl_service,
88 .hlc_rpc_machine = &
rpc_ctx->hurc_rpc_machine,
116 id_connection, tag_even,
246 test->ulmt_hl_service, &
test->ulmt_id_local,
247 &
test->ulmt_id_remote, &
test->ulmt_id_connection,
248 test->ulmt_tag_even,
true);
253 hl = &
test->ulmt_link_ctx.ulc_link;
256 &
test->ulmt_tags_out[
i]);
271 test->ulmt_msgs_in[
i] = *msg;
327 .ulmt_id_local = id1,
328 .ulmt_id_remote = id2,
329 .ulmt_id_connection =
id,
330 .ulmt_tag_even =
true,
333 .ulmt_id_local = id2,
334 .ulmt_id_remote = id1,
335 .ulmt_id_connection =
id,
336 .ulmt_tag_even =
false,
341 tests[
i].ulmt_hl_service = hl_service;
371 for (j = 0; j < 2; ++j) {
381 test2 = &
tests[
i * 2 + 1];
430 for (
i = 0;
i < nr_links; ++
i) {
434 &id1[
i], &id2[
i], &
id[
i], tag_even[
i] != 0,
436 (*hl)[
i] = &(*ctx)[
i]->ulc_link;
448 for (
i = 0;
i < nr_links; ++
i) {
519 for (
i = 0;
i < 3; ++
i) {
530 for (
i = 0;
i < 2; ++
i) {
616 tag_even[
i] =
i == 0;
620 &
ctx, &hl, id1, id2,
id, tag_even,
false);
636 &
id[
i], !tag_even[
i],
ep);
638 &
id[
i], tag_even[
i],
ep);
640 &hl_conn_cfg[1].hlcc_params,
641 &id1[
i], &id2[
i], &
id[
i]);
668 #undef M0_TRACE_SUBSYSTEM static void ha_ut_link_cfg_create(struct m0_ha_link_cfg *hl_cfg, struct m0_ha_ut_rpc_ctx *rpc_ctx, struct m0_reqh_service *hl_service)
static void ha_ut_link_set_some_msg(struct m0_ha_msg *msg)
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
#define M0_ALLOC_ARR(arr, nr)
M0_UT_THREADS_DEFINE(ha_ut_link_mt, &ha_ut_link_mt_thread)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
M0_INTERNAL void m0_ha_link_stop(struct m0_ha_link *hl, struct m0_clink *clink)
const char * hlcc_rpc_endpoint
static void ha_ut_link_msg_transfer(struct m0_ha_link *hl1, struct m0_ha_link *hl2)
M0_INTERNAL void m0_ha_link_wait_arrival(struct m0_ha_link *hl)
static uint64_t tag(uint8_t code, uint64_t id)
M0_INTERNAL struct m0_ha_msg * m0_ha_link_recv(struct m0_ha_link *hl, uint64_t *tag)
#define M0_FID_INIT(container, key)
M0_INTERNAL void m0_ha_ut_rpc_ctx_init(struct m0_ha_ut_rpc_ctx *ctx)
struct m0_clink ulc_stop_clink
struct m0_ha_link_tags hlp_tags_local
M0_INTERNAL const char * m0_rpc_machine_ep(const struct m0_rpc_machine *rmach)
M0_INTERNAL void m0_ha_link_flush(struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_link_start(struct m0_ha_link *hl, struct m0_ha_link_conn_cfg *hl_conn_cfg)
M0_INTERNAL void m0_ha_link_send(struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
struct m0_uint128 ulmt_id_remote
struct m0_ha_link_conn_cfg ulc_conn_cfg
struct m0_ha_ut_rpc_ctx * ulmt_ctx
struct m0_uint128 hlp_id_local
struct m0_ha_msg * ulmt_msgs_out
struct m0_ha_msg * ulmt_msgs_in
m0_time_t m0_time_now(void)
struct m0_uint128 ulmt_id_connection
void m0_ha_ut_link_reconnect_simple(void)
struct m0_ha_link ulc_link
static void ha_ut_links_init(struct m0_ha_ut_rpc_ctx **rpc_ctx, struct m0_reqh_service **hl_service, int nr_links, struct ha_ut_link_ctx ***ctx, struct m0_ha_link ***hl, struct m0_uint128 *id1, struct m0_uint128 *id2, struct m0_uint128 *id, int *tag_even, bool start)
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
M0_INTERNAL bool m0_ha_msg_eq(const struct m0_ha_msg *msg1, const struct m0_ha_msg *msg2)
M0_INTERNAL void m0_ha_link_reconnect_begin(struct m0_ha_link *hl, struct m0_ha_link_params *lp)
static void ha_ut_link_fini(struct ha_ut_link_ctx *link_ctx)
M0_INTERNAL uint64_t m0_ha_msg_tag(const struct m0_ha_msg *msg)
M0_INTERNAL void m0_ha_link_tags_initial(struct m0_ha_link_tags *tags, bool tag_even)
M0_INTERNAL void m0_ha_link_reconnect_end(struct m0_ha_link *hl, const struct m0_ha_link_conn_cfg *hl_conn_cfg)
M0_INTERNAL int m0_ha_link_service_init(struct m0_reqh_service **hl_service, struct m0_reqh *reqh)
struct m0_ha_link_tags hlp_tags_remote
void m0_ha_ut_link_multithreaded(void)
static struct fdmi_ctx ctx
M0_INTERNAL uint64_t m0_ha_link_delivered_consume(struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_link_delivered(struct m0_ha_link *hl, struct m0_ha_msg *msg)
static void ha_ut_link_conn_cfg_create(struct m0_ha_link_conn_cfg *hl_conn_cfg, struct m0_uint128 *id_local, struct m0_uint128 *id_remote, struct m0_uint128 *id_connection, bool tag_even, const char *ep)
struct m0_reqh_service * ulmt_hl_service
struct ha_ut_link_ctx ulmt_link_ctx
M0_INTERNAL void m0_ha_ut_rpc_ctx_fini(struct m0_ha_ut_rpc_ctx *ctx)
static void ha_ut_link_conn_cfg_free(struct m0_ha_link_conn_cfg *hl_conn_cfg)
struct m0_ha_link_cfg ulc_cfg
void m0_ha_ut_link_reconnect_multiple(void)
void m0_ha_ut_link_usecase(void)
M0_INTERNAL uint64_t m0_rnd64(uint64_t *seed)
static void ha_ut_link_init(struct ha_ut_link_ctx *link_ctx, struct m0_ha_ut_rpc_ctx *rpc_ctx, struct m0_reqh_service *hl_service, struct m0_uint128 *id_local, struct m0_uint128 *id_remote, struct m0_uint128 *id_connection, bool tag_even, bool start)
struct m0_reqh * hlc_reqh
M0_INTERNAL void m0_ha_link_service_fini(struct m0_reqh_service *hl_service)
M0_INTERNAL void m0_ha_link_wait_delivery(struct m0_ha_link *hl, uint64_t tag)
static void ha_ut_links_fini(struct m0_ha_ut_rpc_ctx *rpc_ctx, struct m0_reqh_service *hl_service, int nr_links, struct ha_ut_link_ctx **ctx, struct m0_ha_link **hl)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
struct m0_uint128 ulmt_id_local
struct m0_ha_link_params hlcc_params
static int start(struct m0_fom *fom)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
#define M0_UT_THREADS_STOP(name)
#define M0_UINT128(hi, lo)
#define M0_MKTIME(secs, ns)
struct m0_semaphore ulmt_barrier_done
M0_INTERNAL void m0_ha_link_reconnect_params(const struct m0_ha_link_params *lp_alive, struct m0_ha_link_params *lp_alive_new, struct m0_ha_link_params *lp_dead_new, const struct m0_uint128 *id_alive, const struct m0_uint128 *id_dead, const struct m0_uint128 *id_connection)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
#define M0_UT_THREADS_START(name, thread_nr, param_array)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
M0_INTERNAL int m0_ha_link_init(struct m0_ha_link *hl, struct m0_ha_link_cfg *hl_cfg)
static void ha_ut_link_mt_thread(void *param)
struct m0_semaphore ulmt_barrier_wait
M0_INTERNAL void m0_ha_link_fini(struct m0_ha_link *hl)
M0_INTERNAL uint64_t m0_ha_link_not_delivered_consume(struct m0_ha_link *hl)