static int run(void) { int i, ret = 0; ret = ft_init_fabric(); if (ret) return ret; ret = ft_exchange_keys(&remote); if (ret) goto out; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } ft_sync(); ft_finalize(); out: return ret; }
static int run_test(void) { int ret = 0; const char *message = "Hello from Client!"; size_t message_len = strlen(message) + 1; ret = ft_init_fabric(); if (ret) return ret; ret = ft_exchange_keys(&remote); if (ret) return ret; if (opts.dst_addr) { fprintf(stdout, "RMA write to server\n"); if (snprintf(tx_buf, tx_size, "%s", message) >= tx_size) { fprintf(stderr, "Transmit buffer too small.\n"); return -FI_ETOOSMALL; } ret = fi_write(ep, tx_buf, message_len, mr_desc, remote_fi_addr, remote.addr, remote.key, &fi_ctx_write); if (ret) return ret; ret = ft_get_tx_comp(++tx_seq); if (ret) return ret; fprintf(stdout, "Received a completion event for RMA write\n"); } else { ret = ft_get_rx_comp(rx_seq); if (ret) return ret; ret = check_recv_msg(message); if (ret) return ret; fprintf(stdout, "Received data from Client: %s\n", (char *) rx_buf); } /* TODO: need support for finalize operation to sync test */ return 0; }
static int run(void) { int i, ret; if (!opts.dst_addr) { ret = ft_start_server(); if (ret) return ret; } ret = opts.dst_addr ? ft_client_connect() : ft_server_connect(); if (ret) return ret; ret = ft_exchange_keys(&remote); if (ret) return ret; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } ft_sync(); ft_finalize(); out: fi_shutdown(ep, 0); return ret; }