Date: Tue, 24 Aug 2010 21:27:02 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r211777 - projects/ofed/head/contrib/ofed/libibverbs/examples Message-ID: <201008242127.o7OLR2q9088535@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Tue Aug 24 21:27:02 2010 New Revision: 211777 URL: http://svn.freebsd.org/changeset/base/211777 Log: - Port the test programs to bsd and allow them to use an inet4 socket to communicate parameters before establishing an actual infiniband connection. This works around not having ipoib yet. - Add a Makefile to complile the various verbs tests. Sponsored by: Isilon Systems, iX Systems, and Panasas Added: projects/ofed/head/contrib/ofed/libibverbs/examples/Makefile Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/pingpong.h projects/ofed/head/contrib/ofed/libibverbs/examples/rc_pingpong.c projects/ofed/head/contrib/ofed/libibverbs/examples/srq_pingpong.c projects/ofed/head/contrib/ofed/libibverbs/examples/uc_pingpong.c projects/ofed/head/contrib/ofed/libibverbs/examples/ud_pingpong.c Added: projects/ofed/head/contrib/ofed/libibverbs/examples/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/Makefile Tue Aug 24 21:27:02 2010 (r211777) @@ -0,0 +1,28 @@ +CFLAGS= -I../../../../sys/ofed/include -libverbs -lmlx4 -lmthca -pthread + +all: asyncwatch devinfo device_list rc_pingpong srq_pingpong uc_pingpong ud_pingpong + +clean: + rm asyncwatch devinfo device_list rc_pingpong srq_pingpong uc_pingpong ud_pingpong + +asyncwatch: + gcc -o asyncwatch asyncwatch.c ${CFLAGS} + +devinfo: + gcc -o devinfo devinfo.c ${CFLAGS} + +device_list: + gcc -o device_list device_list.c ${CFLAGS} + +rc_pingpong: + gcc -o rc_pingpong rc_pingpong.c pingpong.c ${CFLAGS} + +srq_pingpong: + gcc -o srq_pingpong srq_pingpong.c pingpong.c ${CFLAGS} + +uc_pingpong: + gcc -o uc_pingpong uc_pingpong.c pingpong.c ${CFLAGS} + +ud_pingpong: + gcc -o ud_pingpong ud_pingpong.c pingpong.c ${CFLAGS} + Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/pingpong.h ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/examples/pingpong.h Tue Aug 24 21:25:58 2010 (r211776) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/pingpong.h Tue Aug 24 21:27:02 2010 (r211777) @@ -33,6 +33,8 @@ #ifndef IBV_PINGPONG_H #define IBV_PINGPONG_H +#include <sys/param.h> + #include <infiniband/verbs.h> enum ibv_mtu pp_mtu_to_enum(int mtu); Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/rc_pingpong.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/examples/rc_pingpong.c Tue Aug 24 21:25:58 2010 (r211776) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/rc_pingpong.c Tue Aug 24 21:27:02 2010 (r211777) @@ -42,7 +42,7 @@ #include <sys/socket.h> #include <sys/time.h> #include <netdb.h> -#include <malloc.h> +#include <stdlib.h> #include <getopt.h> #include <arpa/inet.h> #include <time.h> @@ -131,7 +131,7 @@ static struct pingpong_dest *pp_client_e { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -202,7 +202,7 @@ static struct pingpong_dest *pp_server_e struct addrinfo *res, *t; struct addrinfo hints = { .ai_flags = AI_PASSIVE, - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -287,6 +287,8 @@ out: return rem_dest; } +#include <sys/param.h> + static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size, int rx_depth, int port, int use_event) @@ -300,7 +302,7 @@ static struct pingpong_context *pp_init_ ctx->size = size; ctx->rx_depth = rx_depth; - ctx->buf = memalign(page_size, size); + ctx->buf = malloc(roundup(size, page_size)); if (!ctx->buf) { fprintf(stderr, "Couldn't allocate work buf.\n"); return NULL; @@ -537,7 +539,7 @@ int main(int argc, char *argv[]) break; case 'd': - ib_devname = strdupa(optarg); + ib_devname = strdup(optarg); break; case 'i': @@ -583,7 +585,7 @@ int main(int argc, char *argv[]) } if (optind == argc - 1) - servername = strdupa(argv[optind]); + servername = strdup(argv[optind]); else if (optind < argc) { usage(argv[0]); return 1; Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/srq_pingpong.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/examples/srq_pingpong.c Tue Aug 24 21:25:58 2010 (r211776) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/srq_pingpong.c Tue Aug 24 21:27:02 2010 (r211777) @@ -42,7 +42,6 @@ #include <sys/socket.h> #include <sys/time.h> #include <netdb.h> -#include <malloc.h> #include <getopt.h> #include <arpa/inet.h> #include <time.h> @@ -139,7 +138,7 @@ static struct pingpong_dest *pp_client_e { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -223,7 +222,7 @@ static struct pingpong_dest *pp_server_e struct addrinfo *res, *t; struct addrinfo hints = { .ai_flags = AI_PASSIVE, - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -335,7 +334,7 @@ static struct pingpong_context *pp_init_ ctx->num_qp = num_qp; ctx->rx_depth = rx_depth; - ctx->buf = memalign(page_size, size); + ctx->buf = malloc(roundup(size, page_size)); if (!ctx->buf) { fprintf(stderr, "Couldn't allocate work buf.\n"); return NULL; @@ -612,7 +611,7 @@ int main(int argc, char *argv[]) break; case 'd': - ib_devname = strdupa(optarg); + ib_devname = strdup(optarg); break; case 'i': @@ -662,7 +661,7 @@ int main(int argc, char *argv[]) } if (optind == argc - 1) - servername = strdupa(argv[optind]); + servername = strdup(argv[optind]); else if (optind < argc) { usage(argv[0]); return 1; Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/uc_pingpong.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/examples/uc_pingpong.c Tue Aug 24 21:25:58 2010 (r211776) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/uc_pingpong.c Tue Aug 24 21:27:02 2010 (r211777) @@ -42,7 +42,6 @@ #include <sys/socket.h> #include <sys/time.h> #include <netdb.h> -#include <malloc.h> #include <getopt.h> #include <arpa/inet.h> #include <time.h> @@ -119,7 +118,7 @@ static struct pingpong_dest *pp_client_e { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -190,7 +189,7 @@ static struct pingpong_dest *pp_server_e struct addrinfo *res, *t; struct addrinfo hints = { .ai_flags = AI_PASSIVE, - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -288,7 +287,7 @@ static struct pingpong_context *pp_init_ ctx->size = size; ctx->rx_depth = rx_depth; - ctx->buf = memalign(page_size, size); + ctx->buf = malloc(roundup(size, page_size)); if (!ctx->buf) { fprintf(stderr, "Couldn't allocate work buf.\n"); return NULL; @@ -525,7 +524,7 @@ int main(int argc, char *argv[]) break; case 'd': - ib_devname = strdupa(optarg); + ib_devname = strdup(optarg); break; case 'i': @@ -571,7 +570,7 @@ int main(int argc, char *argv[]) } if (optind == argc - 1) - servername = strdupa(argv[optind]); + servername = strdup(argv[optind]); else if (optind < argc) { usage(argv[0]); return 1; Modified: projects/ofed/head/contrib/ofed/libibverbs/examples/ud_pingpong.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/examples/ud_pingpong.c Tue Aug 24 21:25:58 2010 (r211776) +++ projects/ofed/head/contrib/ofed/libibverbs/examples/ud_pingpong.c Tue Aug 24 21:27:02 2010 (r211777) @@ -42,7 +42,6 @@ #include <sys/socket.h> #include <sys/time.h> #include <netdb.h> -#include <malloc.h> #include <getopt.h> #include <arpa/inet.h> #include <time.h> @@ -119,7 +118,7 @@ static struct pingpong_dest *pp_client_e { struct addrinfo *res, *t; struct addrinfo hints = { - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -189,7 +188,7 @@ static struct pingpong_dest *pp_server_e struct addrinfo *res, *t; struct addrinfo hints = { .ai_flags = AI_PASSIVE, - .ai_family = AF_UNSPEC, + .ai_family = AF_INET, .ai_socktype = SOCK_STREAM }; char *service; @@ -287,7 +286,7 @@ static struct pingpong_context *pp_init_ ctx->size = size; ctx->rx_depth = rx_depth; - ctx->buf = memalign(page_size, size + 40); + ctx->buf = malloc(roundup(size + 40, page_size)); if (!ctx->buf) { fprintf(stderr, "Couldn't allocate work buf.\n"); return NULL; @@ -532,7 +531,7 @@ int main(int argc, char *argv[]) break; case 'd': - ib_devname = strdupa(optarg); + ib_devname = strdup(optarg); break; case 'i': @@ -570,7 +569,7 @@ int main(int argc, char *argv[]) } if (optind == argc - 1) - servername = strdupa(argv[optind]); + servername = strdup(argv[optind]); else if (optind < argc) { usage(argv[0]); return 1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008242127.o7OLR2q9088535>