static int ft_fw_sync(int value) { int result = -FI_EOTHER; if (listen_sock < 0) { ft_fw_send(sock, &value, sizeof value); ft_fw_recv(sock, &result, sizeof result); } else { ft_fw_recv(sock, &result, sizeof result); ft_fw_send(sock, &value, sizeof value); } return result; }
static int ft_load_av(void) { struct ft_msg msg; size_t len; int ret; memset(&msg, 0, sizeof(struct ft_msg)); len = sizeof(msg.data); ret = fi_getname(&ep->fid, msg.data, &len); if (ret) { FT_PRINTERR("fi_getname", ret); return ret; } msg.len = (uint32_t) len; ret = ft_fw_send(sock, &msg, sizeof msg); if (ret) return ret; ret = ft_fw_recv(sock, &msg, sizeof msg); if (ret) return ret; ret = ft_av_insert(av, msg.data, 1, &ft_tx_ctrl.addr, 0, NULL); if (ret) return ret; return 0; }
static int ft_fw_process_list(struct fi_info *hints, struct fi_info *info) { int ret, subindex, result, sresult; for (subindex = 1, fabric_info = info; fabric_info; fabric_info = fabric_info->next, subindex++) { printf("Starting test %d-%d: ", series->test_index, subindex); ft_show_test_info(); ret = ft_check_info(hints, fabric_info); if (ret) return ret; ft_fw_update_info(&test_info, fabric_info, subindex); ret = ft_fw_send(sock, &test_info, sizeof test_info); if (ret) return ret; result = ft_run_test(); ret = ft_fw_recv(sock, &sresult, sizeof sresult); if (result) return result; else if (ret) return ret; else if (sresult) return sresult; } return 0; }
static int ft_fw_server(void) { struct fi_info *hints, *info; int ret; hints = fi_allocinfo(); if (!hints) return -FI_ENOMEM; do { ret = ft_fw_recv(sock, &test_info, sizeof test_info); if (ret) { if (ret == -FI_ENOTCONN) ret = 0; break; } ft_fw_convert_info(hints, &test_info); printf("Starting test %d-%d: ", test_info.test_index, test_info.test_subindex); ft_show_test_info(); ret = fi_getinfo(FT_FIVERSION, ft_strptr(test_info.node), ft_strptr(test_info.service), FI_SOURCE, hints, &info); if (ret) { FT_PRINTERR("fi_getinfo", ret); } else { if (info->next) { printf("fi_getinfo returned multiple matches\n"); ret = -FI_E2BIG; } else { /* fabric_info is replaced when connecting */ fabric_info = info; ret = ft_run_test(); if (fabric_info != info) fi_freeinfo(fabric_info); } fi_freeinfo(info); } if (ret) { printf("Node: %s\nService: %s\n", test_info.node, test_info.service); printf("%s\n", fi_tostr(hints, FI_TYPE_INFO)); } printf("Ending test %d-%d, result: %s\n", test_info.test_index, test_info.test_subindex, fi_strerror(-ret)); results[ft_fw_result_index(-ret)]++; ret = ft_fw_send(sock, &ret, sizeof ret); } while (!ret); fi_freeinfo(hints); return ret; }