int ft_run_test() { int ret; ret = ft_init_control(); if (ret) { FT_PRINTERR("ft_init_control", ret); goto cleanup; } ret = ft_open_control(); if (ret) { FT_PRINTERR("ft_open_control", ret); goto cleanup; } if (test_info.ep_type == FI_EP_MSG && listen_sock >= 0) { ret = ft_open_passive(); if (ret) { FT_PRINTERR("ft_open_passive", ret); goto cleanup; } } else { ret = ft_open_active(); if (ret) { FT_PRINTERR("ft_open_active", ret); goto cleanup; } } ft_sock_sync(0); ret = ft_enable_comm(); if (ret) { FT_PRINTERR("ft_enable_comm", ret); goto cleanup; } switch (test_info.test_type) { case FT_TEST_LATENCY: ret = ft_run_latency(); if (ret) FT_PRINTERR("ft_run_latency", ret); break; case FT_TEST_BANDWIDTH: ret = ft_run_bandwidth(); if (ret) FT_PRINTERR("ft_run_bandwidth", ret); break; default: ret = -FI_ENOSYS; break; } ft_sync_test(0); cleanup: ft_cleanup(); return ret ? ret : -ft_ctrl.error; }
static int ft_accept(void) { struct fi_eq_cm_entry entry; uint32_t event; ssize_t rd; int ret; rd = ft_get_event(&event, &entry, sizeof entry, FI_CONNREQ, sizeof entry); if (rd < 0) return (int) rd; fabric_info = entry.info; ret = ft_open_active(); if (ret) return ret; ret = fi_accept(ep, NULL, 0); if (ret) { FT_PRINTERR("fi_accept", ret); return ret; } rd = ft_get_event(&event, &entry, sizeof entry, FI_CONNECTED, sizeof entry); if (rd < 0) return (int) rd; return 0; }