Improved timeout handling and other fixes

master
Johann George 2009-03-22 02:16:15 -07:00
parent 9639237d36
commit c86b501270
7 changed files with 42 additions and 35 deletions

View File

@ -1,5 +1,5 @@
AC_INIT(qperf, 0.4.3, general@lists.openfabrics.org)
AM_INIT_AUTOMAKE(qperf, 0.4.3)
AC_INIT(qperf, 0.4.4, general@lists.openfabrics.org)
AM_INIT_AUTOMAKE(qperf, 0.4.4)
AC_PROG_CC
AC_CHECK_LIB(ibverbs, ibv_open_device, RDMA=1)
AC_CHECK_LIB(rdmacm, rdma_create_id)

View File

@ -1,6 +1,6 @@
Name: qperf
Summary: Measure socket and RDMA performance
Version: 0.4.3
Version: 0.4.4
Release: 1
License: BSD 3-Clause, GPL v2
Group: Networking/Diagnostic

View File

@ -351,7 +351,7 @@ Options
The current version of qperf is printed.
--wait_server Time (-ws)
If the server is not ready, continue to try connecting for Time
seconds before giving up.
seconds before giving up. The default is 5 seconds.
Tests -RDMA
Miscellaneous
conf Show configuration
@ -902,14 +902,15 @@ ver_rc_compare_swap +RDMA
--cq_poll OnOff Set polling mode on/off
--time (-t) Set test duration
Other Options
--cpu_affinity, --listen_port, --mtu_size, --rd_atomic, --static_rate,
--timeout
--cpu_affinity, --listen_port, --msg_size, --mtu_size, --rd_atomic,
--static_rate, --timeout
Display Options
--precision, --unify_nodes, --unify_units, --verbose
Description
Test the RC Compare and Swap Atomic operation. The server's memory
location starts with zero and the client successively exchanges, 0 for
1, 1 for 2, etc. The results are checked for correctness.
location starts with zero and the client successively makes exchanges
with a variety of different values. The results are checked for
correctness.
ver_rc_fetch_add +RDMA
Purpose
Verify RC fetch and add
@ -918,8 +919,8 @@ ver_rc_fetch_add +RDMA
--cq_poll OnOff Set polling mode on/off
--time (-t) Set test duration
Other Options
--cpu_affinity, --listen_port, --mtu_size, --rd_atomic, --static_rate,
--timeout
--cpu_affinity, --listen_port, --msg_size, --mtu_size, --rd_atomic,
--static_rate, --timeout
Display Options
--precision, --unify_nodes, --unify_units, --use_bits_per_sec,
--verbose

View File

@ -62,7 +62,7 @@
*/
#define VER_MAJ 0 /* Major version */
#define VER_MIN 4 /* Minor version */
#define VER_INC 3 /* Incremental version */
#define VER_INC 4 /* Incremental version */
#define LISTENQ 5 /* Size of listen queue */
#define BUFSIZE 1024 /* Size of buffers */
@ -246,6 +246,7 @@ static void view_time(int type, char *pref, char *name, double value);
*/
static int ListenPort = DEF_LISTEN_PORT;
static int Precision = DEF_PRECISION;
static int ServerWait = DEF_TIMEOUT;
static int UseBitsPerSec = 0;
@ -266,7 +267,6 @@ static int VerboseConf;
static int VerboseStat;
static int VerboseTime;
static int VerboseUsed;
static int Wait;
/*
@ -957,7 +957,7 @@ do_option(OPTION *option, char ***argvp)
VerboseUsed = 2;
*argvp += 1;
} else if (streq(t, "wait")) {
Wait = arg_time(argvp);
ServerWait = arg_time(argvp);
} else
error(BUG, "do_option: unknown type: %s", t);
}
@ -1370,10 +1370,8 @@ server(void)
TestName = test->name;
debug("received request: %s", TestName);
init_lstat();
Finished = 0;
set_affinity();
(test->server)();
stop_test_timer();
exit(0);
}
close(ListenFD);
@ -1490,7 +1488,6 @@ client(TEST *test)
debug("sending request: %s", TestName);
init_lstat();
printf("%s:\n", TestName);
Finished = 0;
(*test->client)();
remotefd_close();
place_show();
@ -1512,31 +1509,34 @@ client_send_request(void)
AI *ailist = getaddrinfo_port(ServerName, ListenPort, &hints);
RemoteFD = -1;
if (Wait)
start_test_timer(Wait);
if (ServerWait)
start_test_timer(ServerWait);
for (;;) {
for (a = ailist; a; a = a->ai_next) {
if (Finished)
break;
RemoteFD = socket(a->ai_family, a->ai_socktype, a->ai_protocol);
if (RemoteFD >= 0) {
if (connect(RemoteFD, a->ai_addr, a->ai_addrlen) == SUCCESS0) {
ServerAddrLen = a->ai_addrlen;
memcpy(&ServerAddr, a->ai_addr, ServerAddrLen);
break;
}
if (RemoteFD < 0)
continue;
if (connect(RemoteFD, a->ai_addr, a->ai_addrlen) != SUCCESS0) {
remotefd_close();
continue;
}
ServerAddrLen = a->ai_addrlen;
memcpy(&ServerAddr, a->ai_addr, ServerAddrLen);
break;
}
if (RemoteFD >= 0 || !Wait || Finished)
if (RemoteFD >= 0 || !ServerWait || Finished)
break;
sleep(1);
}
if (Wait)
if (ServerWait)
stop_test_timer();
freeaddrinfo(ailist);
if (RemoteFD < 0)
error(0, "failed to connect");
error(0, "%s: failed to connect", ServerName);
remotefd_setup();
enc_init(&req);
enc_req(&RReq);
@ -1804,6 +1804,7 @@ start_test_timer(int seconds)
{
struct itimerval itimerval = {{0}};
Finished = 0;
get_times(LStat.time_s);
setitimer(ITIMER_REAL, &itimerval, 0);
if (!seconds)
@ -1824,7 +1825,8 @@ start_test_timer(int seconds)
* executed and it will take the second SIGALRM call generated by the interval
* timer to wake it up. Hence, we save the end times in sig_alrm. Note that
* if Finished is set, we reject any packets that are sent or arrive in order
* not to cheat.
* not to cheat. We clear Finished since code assumes that it is the default
* state.
*/
void
stop_test_timer(void)
@ -1833,6 +1835,7 @@ stop_test_timer(void)
set_finished();
setitimer(ITIMER_REAL, &itimerval, 0);
Finished = 0;
debug("stopping timer");
}

View File

@ -1682,7 +1682,10 @@ rd_create_qp(DEVICE *dev, struct ibv_context *context, struct rdma_cm_id *id)
/*
* Allocate a memory region and register it.
* Allocate a memory region and register it. I thought this routine should
* never be called with a size of 0 as prior code checks for that and sets it
* to some default value. I appear to be wrong. In that case, size is set to
* 1 so other code does not break.
*/
static void
rd_mralloc(DEVICE *dev, int size)
@ -1693,7 +1696,7 @@ rd_mralloc(DEVICE *dev, int size)
if (dev->buffer)
error(BUG, "rd_mralloc: memory region already allocated");
if (size == 0)
return;
size = 1;
pagesize = sysconf(_SC_PAGESIZE);
if (posix_memalign((void **)&dev->buffer, pagesize, size) != 0)
@ -1720,11 +1723,11 @@ rd_mrfree(DEVICE *dev)
{
if (dev->mr)
ibv_dereg_mr(dev->mr);
dev->mr = 0;
dev->mr = NULL;
if (dev->buffer)
free(dev->buffer);
dev->buffer = 0;
dev->buffer = NULL;
dev->buf_size = 0;
dev->lnode.rkey = 0;

View File

@ -296,7 +296,7 @@ server_get_hosts(char *lhost, char *rhost)
laddr.sin_addr.s_addr = INADDR_ANY;
laddr.sin_port = htons(0);
if (bind(lfd, (SA *)&laddr, sizeof(laddr)) < 0)
error(SYS, "bind failed");
error(SYS, "bind INET failed");
port = get_socket_port(lfd);
encode_uint32(&port, port);
@ -358,7 +358,7 @@ rds_socket(char *host, int port)
setsockopt_one(sockfd, SO_REUSEADDR);
rds_makeaddr(&sockaddr, &socklen, host, port);
if (bind(sockfd, (SA *)&sockaddr, socklen) != SUCCESS0)
error(SYS, "bind failed");
error(SYS, "bind RDS failed");
set_socket_buffer_size(sockfd);
return sockfd;
}

View File

@ -252,7 +252,7 @@ run_client_udp_lat(void)
/*
* Measure UDP latency (server side).
*/
void
void
run_server_udp_lat(void)
{
datagram_server_lat(K_UDP);