Skip to content

Commit

Permalink
Merge pull request #28 from shefty/master
Browse files Browse the repository at this point in the history
Keeping in sync
  • Loading branch information
shefty committed Oct 8, 2014
2 parents de8db17 + c19c496 commit 50f1542
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 28 deletions.
7 changes: 6 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
AM_CFLAGS = -g -Wall -D_GNU_SOURCE
AM_CFLAGS = -g -Wall -D_GNU_SOURCE -I$(srcdir)/include

bin_PROGRAMS = \
simple/fi_info \
simple/fi_pingpong \
ported/libibverbs/fi_rc_pingpong

simple_fi_info_SOURCES = \
simple/info.c \
common/shared.c

simple_fi_pingpong_SOURCES = \
simple/pingpong.c \
common/shared.c
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions man/fabtests.7
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
fabtests \- libfabric test programs
.PP
fi_pingpong - simple message pingpong test
.PP
fi_info - simple query test of fabric providers
.SH "SIMPLE TESTS"
The following tests are very simple in nature and can be used as
sample programs to understand the libfabric interfaces and how
they are used.
.SS fi_pingpong
.SS fi_info
.SH "SEE ALSO"
fabric(7)
4 changes: 2 additions & 2 deletions ported/libibverbs/rc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static int pp_accept_ctx(struct pingpong_context *ctx)
goto err;
}

rc = fi_domain(ctx->fabric, entry.info->domain_attr, &ctx->dom, NULL);
rc = fi_domain(ctx->fabric, entry.info, &ctx->dom, NULL);
if (rc) {
FI_ERR_LOG("fi_fdomain", rc);
goto err;
Expand Down Expand Up @@ -258,7 +258,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx)
int rc = 0;

/* Open domain */
rc = fi_domain(ctx->fabric, ctx->prov->domain_attr, &ctx->dom, NULL);
rc = fi_domain(ctx->fabric, ctx->prov, &ctx->dom, NULL);
if (rc) {
FI_ERR_LOG("fi_fdomain", -rc);
goto err;
Expand Down
55 changes: 34 additions & 21 deletions unit/provinfo.c → simple/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,55 +37,68 @@
#include <sys/types.h>

#include <rdma/fabric.h>
#include <rdma/fi_endpoint.h>
#include <rdma/fi_domain.h>
#include "shared.h"


static struct fi_info hints;
static char *dst_addr;
static struct fi_info hints, *info;
static char *node, *port;


static int run(void)
{
struct fi_info *fi, *cur;
struct fi_info *cur;
int ret;

ret = fi_getinfo(dst_addr, NULL, &hints, &fi);
ret = fi_getinfo(FI_VERSION(1, 0), node, port, 0, &hints, &info);
if (ret) {
printf("fi_getinfo %s\n", strerror(-ret));
return ret;
}

for (cur = fi; cur; cur = cur->next) {
printf("domain: %s\n", cur->domain_name);
}
for (cur = info; cur; cur = cur->next)
printf("%s\n", fi_tostr(cur, FI_PP_INFO));

return ret;
fi_freeinfo(info);
return 0;
}

static uint64_t ep_type(char *arg)
{
if (!strcasecmp(arg, "msg"))
return FI_EP_MSG;
else if (!strcasecmp(arg, "rdm"))
return FI_EP_RDM;
else if (!strcasecmp(arg, "dgram"))
return FI_EP_DGRAM;
else
return FI_EP_UNSPEC;
}

int main(int argc, char **argv)
{
int op, ret;

while ((op = getopt(argc, argv, "d:n:s:")) != -1) {
hints.ep_cap = FI_MSG;

while ((op = getopt(argc, argv, "e:n:p:")) != -1) {
switch (op) {
case 'd':
dst_addr = optarg;
case 'e':
hints.type = ep_type(optarg);
break;
case 'n':
hints.domain_name = optarg;
node = optarg;
break;
case 's':
ret = getaddr(optarg, NULL, (struct sockaddr **) &hints.src_addr,
(socklen_t *) &hints.src_addrlen);
if (ret) {
printf("source address error %s\n",
gai_strerror(errno));
}
port = optarg;
break;
default:
printf("usage: %s\n", argv[0]);
printf("\t[-d destination_address]\n");
printf("\t[-n domain_name]\n");
printf("\t[-s source_address]\n");
printf("\t[-e ep_type\n");
printf("\t (msg, dgram, rdm)");
printf("\t[-n node]\n");
printf("\t[-p service_port]\n");
exit(1);
}
}
Expand Down
7 changes: 3 additions & 4 deletions simple/pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <rdma/fi_errno.h>
#include <rdma/fi_endpoint.h>
#include <rdma/fi_cm.h>
#include "../common/shared.h"
#include "shared.h"


struct test_size_param {
Expand Down Expand Up @@ -430,7 +430,7 @@ static int server_connect(void)
}

info = entry.info;
ret = fi_domain(fab, info->domain_attr, &dom, NULL);
ret = fi_domain(fab, info, &dom, NULL);
if (ret) {
printf("fi_fdomain %s\n", fi_strerror(-ret));
goto err1;
Expand Down Expand Up @@ -509,7 +509,7 @@ static int client_connect(void)
goto err1;
}

ret = fi_domain(fab, fi->domain_attr, &dom, NULL);
ret = fi_domain(fab, fi, &dom, NULL);
if (ret) {
printf("fi_fdomain %s %s\n", fi_strerror(-ret),
fi->domain_attr->name);
Expand Down Expand Up @@ -658,7 +658,6 @@ int main(int argc, char **argv)
hints.ep_attr = &ep_hints;
hints.type = FI_EP_MSG;
hints.ep_cap = FI_MSG;
domain_hints.caps = FI_LOCAL_MR;
hints.addr_format = FI_SOCKADDR;

ret = run();
Expand Down

0 comments on commit 50f1542

Please sign in to comment.