aboutsummaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorJoseph Koshy <jkoshy@FreeBSD.org>2006-02-13 15:03:12 +0000
committerJoseph Koshy <jkoshy@FreeBSD.org>2006-02-13 15:03:12 +0000
commit36db04209833d6cf6afac1988829825bdce3993a (patch)
treea0093b13231717f29b64310a3cd14c2e8b529eb4 /benchmarks
parenta208ba2358742920f5581ea4562e63970e16878f (diff)
downloadports-36db04209833d6cf6afac1988829825bdce3993a.tar.gz
ports-36db04209833d6cf6afac1988829825bdce3993a.zip
Notes
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/netpipe/Makefile10
-rw-r--r--benchmarks/netpipe/distinfo6
-rw-r--r--benchmarks/netpipe/files/patch-doc-README49
-rw-r--r--benchmarks/netpipe/files/patch-dox-netpipe.149
-rw-r--r--benchmarks/netpipe/files/patch-makefile13
-rw-r--r--benchmarks/netpipe/files/patch-src-netpipe.c84
-rw-r--r--benchmarks/netpipe/files/patch-src-netpipe.h54
-rw-r--r--benchmarks/netpipe/files/patch-src-tcp6.c453
-rw-r--r--benchmarks/netpipe/pkg-plist1
9 files changed, 714 insertions, 5 deletions
diff --git a/benchmarks/netpipe/Makefile b/benchmarks/netpipe/Makefile
index 1d1de15a40a0..ab3fba70eaa8 100644
--- a/benchmarks/netpipe/Makefile
+++ b/benchmarks/netpipe/Makefile
@@ -5,7 +5,7 @@
# $FreeBSD$
PORTNAME= NetPIPE
-PORTVERSION= 3.6
+PORTVERSION= 3.6.2
CATEGORIES= benchmarks net
MASTER_SITES= http://www.scl.ameslab.gov/Projects/Netpipe/code/
DISTNAME= ${PORTNAME}_${PORTVERSION}
@@ -19,13 +19,19 @@ MAKEFILE= makefile
# The default port builds and installs only the TCP version of
# netpipe(1). The sources support many other variants.
-ALL_TARGET= tcp
+ALL_TARGET= tcp tcp6
+.if !defined(NOPORTDOCS)
+MAN1= netpipe.1
+MANCOMPRESSED= no
DOCS= README netpipe_paper.ps
+.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/NPtcp ${PREFIX}/bin/NPtcp
+ ${INSTALL_PROGRAM} ${WRKSRC}/NPtcp6 ${PREFIX}/bin/NPtcp6
.if !defined(NOPORTDOCS)
${MKDIR} ${PREFIX}/share/doc/netpipe
+ ${INSTALL_MAN} ${WRKSRC}/dox/netpipe.1 ${PREFIX}/man/man1
.for doc in ${DOCS}
${INSTALL_DATA} ${WRKSRC}/dox/${doc} ${PREFIX}/share/doc/netpipe/${doc}
.endfor
diff --git a/benchmarks/netpipe/distinfo b/benchmarks/netpipe/distinfo
index 442a5dccec93..57712f1998e6 100644
--- a/benchmarks/netpipe/distinfo
+++ b/benchmarks/netpipe/distinfo
@@ -1,3 +1,3 @@
-MD5 (NetPIPE_3.6.tar.gz) = be79a9840f35b1e70277704439ad97b8
-SHA256 (NetPIPE_3.6.tar.gz) = 140475591ed539f81fc2b0f8bb35cd0949f24daeb4fcac1ce0c4e03e8146f75e
-SIZE (NetPIPE_3.6.tar.gz) = 361305
+MD5 (NetPIPE_3.6.2.tar.gz) = 62570140a3617eca4b15b3255d3edbe6
+SHA256 (NetPIPE_3.6.2.tar.gz) = 2301b6fa0bd468f6e6fb036617679626795f599ea504ae282ba075ac26b66da1
+SIZE (NetPIPE_3.6.2.tar.gz) = 369585
diff --git a/benchmarks/netpipe/files/patch-doc-README b/benchmarks/netpipe/files/patch-doc-README
new file mode 100644
index 000000000000..19395257e3fe
--- /dev/null
+++ b/benchmarks/netpipe/files/patch-doc-README
@@ -0,0 +1,49 @@
+Index: dox/README
+===================================================================
+RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/dox/README,v
+retrieving revision 1.1
+retrieving revision 1.3
+diff -u -r1.1 -r1.3
+--- dox/README 9 Sep 2004 08:29:35 -0000 1.1
++++ dox/README 27 Sep 2004 11:26:17 -0000 1.3
+@@ -85,6 +85,7 @@
+ make shmem (1-sided library for Cray and SGI systems)
+
+ make tcp
++ make tcp6 (for IPv6 enabled systems)
+ make gm (for Myrinet cards, you will need to set some paths)
+ make shmem (1-sided library for Cray and SGI systems)
+ make gpshmem (SHMEM interface for other machines)
+@@ -145,7 +146,10 @@
+ -2: Bi-directional communications. Transmit in both directions
+ simultaneously.
+
+- TCP
++ -P: Set the port number used by TCP to something other than
++ default.
++
++ TCP
+ ---
+
+ Compile NetPIPE using 'make tcp'
+@@ -157,6 +161,20 @@
+
+ local_host> nplaunch NPtcp -h remote_host [options]
+
++ TCP6
++ ----
++
++ Compile NetPIPE using 'make tcp6'
++
++ remote_host> NPtcp6 [options]
++ local_host> NPtcp6 -h remote_host [options]
++
++ OR
++
++ local_host> nplaunch NPtcp6 -h remote_host [options]
++
++
++
+ MPICH
+ -----
+
diff --git a/benchmarks/netpipe/files/patch-dox-netpipe.1 b/benchmarks/netpipe/files/patch-dox-netpipe.1
new file mode 100644
index 000000000000..cf13d72c36de
--- /dev/null
+++ b/benchmarks/netpipe/files/patch-dox-netpipe.1
@@ -0,0 +1,49 @@
+--- dox/netpipe.1.orig Wed Jul 7 01:56:25 2004
++++ dox/netpipe.1 Mon Feb 13 19:59:57 2006
+@@ -26,7 +26,7 @@
+ .IB E valuator
+
+ .SH SYNOPSIS
+-.B NPtcp
++.B "NPtcp|NPtcp6"
+ [\c
+ .BI \-h \ receiver_hostname\fR\c
+ ]
+@@ -124,9 +124,9 @@
+
+
+
+-.SH TESTING TCP
++.SH TESTING TCP/TCP6
+ .PP
+-NPtcp can now be launched in two ways, by manually starting NPtcp on
++NPtcp can now be launched in two ways, by manually starting NPtcp or NPtcp6 on
+ both systems or by using a nplaunch script. To manually start NPtcp,
+ the NetPIPE receiver must be
+ started first on the remote system using the command:
+@@ -145,7 +145,12 @@
+ .Ee
+ .PP
+ Any options used must be the same on both sides.
+-
++The \-P parameter can be used to override the default port number.
++This is helpful when running several streams through a router to a
++single endpoint.
++.PP
++The NPtcp6 program is launched in a similar manner.
++.PP
+ The nplaunch script uses ssh to launch the remote receiver
+ before starting the local transmitter. To use rsh, simply change
+ the nplaunch script.
+@@ -366,6 +371,11 @@
+ .I -p
+ .I 0
+ .B .
++.ne 3
++
++.TP
++.BI \-P \ \fIport\fR
++Set the port number used by the TCP and TCP6 tests to \fIport\fR.
+ .ne 3
+
+ .TP
diff --git a/benchmarks/netpipe/files/patch-makefile b/benchmarks/netpipe/files/patch-makefile
index 003a1d7a2399..d69e8142763f 100644
--- a/benchmarks/netpipe/files/patch-makefile
+++ b/benchmarks/netpipe/files/patch-makefile
@@ -11,3 +11,16 @@
SRC = ./src
# For MPI, mpicc will set up the proper include and library paths
+@@ -81,7 +81,11 @@
+
+
+ tcp: $(SRC)/tcp.c $(SRC)/netpipe.c $(SRC)/netpipe.h
+- $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp.c -DTCP -o NPtcp -I$(SRC)
++ $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp.c -DTCP -o NPtcp -I$(SRC)
++
++tcp6: $(SRC)/tcp.c $(SRC)/netpipe.c $(SRC)/netpipe.h
++ $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/tcp6.c -DTCP6 \
++ -o NPtcp6 -I$(SRC)
+
+ memcpy: $(SRC)/memcpy.c $(SRC)/netpipe.c $(SRC)/netpipe.h
+ $(CC) $(CFLAGS) $(SRC)/netpipe.c $(SRC)/memcpy.c \
diff --git a/benchmarks/netpipe/files/patch-src-netpipe.c b/benchmarks/netpipe/files/patch-src-netpipe.c
new file mode 100644
index 000000000000..77744486b135
--- /dev/null
+++ b/benchmarks/netpipe/files/patch-src-netpipe.c
@@ -0,0 +1,84 @@
+Index: src/netpipe.c
+===================================================================
+RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/src/netpipe.c,v
+retrieving revision 1.1
+retrieving revision 1.2
+diff -u -r1.1 -r1.2
+--- src/netpipe.c 9 Sep 2004 08:29:38 -0000 1.1
++++ src/netpipe.c 27 Sep 2004 11:26:17 -0000 1.2
+@@ -84,7 +84,7 @@
+ args.soffset=0; /* default to no offsets */
+ args.roffset=0;
+ args.syncflag=0; /* use normal mpi_send */
+-
++ args.port = DEFPORT; /* just in case the user doesn't set this. */
+
+ /* TCGMSG launches NPtcgmsg with a -master master_hostname
+ * argument, so ignore all arguments and set them manually
+@@ -94,7 +94,7 @@
+ #if ! defined(TCGMSG)
+
+ /* Parse the arguments. See Usage for description */
+- while ((c = getopt(argc, argv, "SO:rIiPszgfaB2h:p:o:l:u:b:m:n:t:c:d:D:")) != -1)
++ while ((c = getopt(argc, argv, "SO:rIiszgfaB2h:p:o:l:u:b:m:n:t:c:d:D:P:")) != -1)
+ {
+ switch(c)
+ {
+@@ -322,6 +322,9 @@
+ printf("Resetting connection after every trial\n");
+ break;
+ #endif
++ case 'P':
++ args.port = atoi(optarg);
++ break;
+
+ default:
+ PrintUsage();
+@@ -369,7 +372,6 @@
+ exit(420132);
+ }
+ args.nbuff = TRIALS;
+- args.port = DEFPORT;
+
+ Setup(&args);
+
+@@ -994,7 +996,7 @@
+ printf("a: asynchronous receive (a.k.a. preposted receive)\n");
+ #endif
+ printf("B: burst all preposts before measuring performance\n");
+-#if defined(TCP) && ! defined(INFINIBAND)
++#if (defined(TCP) || defined(TCP6)) && ! defined(INFINIBAND)
+ printf("b: specify TCP send/receive socket buffer sizes\n");
+ #endif
+
+@@ -1010,7 +1012,7 @@
+ printf(" all MPI-2 implementations\n");
+ #endif
+
+-#if defined(TCP) || defined(INFINIBAND)
++#if defined(TCP) || defined(TCP6) || defined(INFINIBAND)
+ printf("h: specify hostname of the receiver <-h host>\n");
+ #endif
+
+@@ -1030,7 +1032,7 @@
+ printf("p: set the perturbation number <-p 1>\n"
+ " (default = 3 Bytes, set to 0 for no perturbations)\n");
+
+-#if defined(TCP) && ! defined(INFINIBAND)
++#if (defined(TCP) || defined(TCP6)) && ! defined(INFINIBAND)
+ printf("r: reset sockets for every trial\n");
+ #endif
+
+@@ -1053,10 +1055,11 @@
+ #endif
+
+ printf("2: Send data in both directions at the same time.\n");
++ printf("P: Set the port number to one other than the default.\n");
+ #if defined(MPI)
+ printf(" May need to use -a to choose asynchronous communications for MPI/n");
+ #endif
+-#if defined(TCP) && !defined(INFINIBAND)
++#if (defined(TCP) || defined(TCP6)) && !defined(INFINIBAND)
+ printf(" The maximum test size is limited by the TCP buffer size/n");
+ #endif
+ printf("\n");
diff --git a/benchmarks/netpipe/files/patch-src-netpipe.h b/benchmarks/netpipe/files/patch-src-netpipe.h
new file mode 100644
index 000000000000..0de68214aa45
--- /dev/null
+++ b/benchmarks/netpipe/files/patch-src-netpipe.h
@@ -0,0 +1,54 @@
+Index: src/netpipe.h
+===================================================================
+RCS file: /cvs/gnn/Personal/Code/Networking/NetPIPE/src/netpipe.h,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -r1.1.1.1 -r1.2
+--- src/netpipe.h 9 Sep 2004 08:29:38 -0000 1.1.1.1
++++ src/netpipe.h 9 Sep 2004 08:35:07 -0000 1.2
+@@ -23,6 +23,11 @@
+ #include <stdlib.h> /* malloc(3) */
+ #include <unistd.h> /* getopt, read, write, ... */
+
++/* Handle the case of building on MacOS X */
++#if defined(__APPLE__)
++#include <stdint.h>
++#endif
++
+ #ifdef INFINIBAND
+ #include <ib_defs.h> /* ib_mtu_t */
+ #endif
+@@ -89,6 +94,24 @@
+ };
+ #endif
+
++#elif defined(TCP6)
++ #include <netdb.h>
++ #include <sys/socket.h>
++ #include <netinet/in.h>
++ #include <netinet/tcp.h>
++ #include <arpa/inet.h>
++
++ typedef struct protocolstruct ProtocolStruct;
++ struct protocolstruct
++ {
++ struct sockaddr_in6 sin1; /* socket structure #1 */
++ struct sockaddr_in6 sin2; /* socket structure #2 */
++ int nodelay; /* Flag for TCP nodelay */
++ struct hostent *addr; /* Address of host */
++ int sndbufsz; /* Size of TCP send buffer */
++ int rcvbufsz; /* Size of TCP receive buffer */
++ };
++
+ #elif defined(MPI)
+ typedef struct protocolstruct ProtocolStruct;
+ struct protocolstruct
+@@ -197,7 +220,7 @@
+ };
+
+ #else
+- #error "One of TCP, MPI, PVM, TCGMSG, LAPI, SHMEM, ATOLL, MEMCPY, DISK must be defined during compilation"
++ #error "One of TCP, TCP6, MPI, PVM, TCGMSG, LAPI, SHMEM, ATOLL, MEMCPY, DISK must be defined during compilation"
+
+ #endif
+
diff --git a/benchmarks/netpipe/files/patch-src-tcp6.c b/benchmarks/netpipe/files/patch-src-tcp6.c
new file mode 100644
index 000000000000..f076b5987171
--- /dev/null
+++ b/benchmarks/netpipe/files/patch-src-tcp6.c
@@ -0,0 +1,453 @@
+Index: src/tcp6.c
+===================================================================
+RCS file: src/tcp6.c
+diff -N src/tcp6.c
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ src/tcp6.c 9 Sep 2004 08:35:07 -0000 1.1
+@@ -0,0 +1,444 @@
++/*****************************************************************************/
++/* "NetPIPE" -- Network Protocol Independent Performance Evaluator. */
++/* Copyright 1997, 1998 Iowa State University Research Foundation, Inc. */
++/* */
++/* This program is free software; you can redistribute it and/or modify */
++/* it under the terms of the GNU General Public License as published by */
++/* the Free Software Foundation. You should have received a copy of the */
++/* GNU General Public License along with this program; if not, write to the */
++/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
++/* */
++/* TCP6 extension Copyright 2004 George V. Neville-Neil and Neville-Neil */
++/* Consulting */
++/* */
++/* * tcp6.c ---- TCP over IPv6 calls source */
++/* * tcp.h ---- Include file for TCP6 calls and data structs */
++/*****************************************************************************/
++#include "netpipe.h"
++
++#if defined (MPLITE)
++#include "mplite.h"
++#endif
++
++
++int doing_reset = 0;
++
++void Init(ArgStruct *p, int* pargc, char*** pargv)
++{
++ p->reset_conn = 0; /* Default to not resetting connection */
++ p->prot.sndbufsz = p->prot.rcvbufsz = 0;
++ /* The transmitter will be set using the -h host flag. */
++ p->tr = 0;
++ p->rcv = 1;
++}
++
++void Setup(ArgStruct *p)
++{
++ int one = 1;
++ int sockfd = -1;
++ /* ptr to sockaddr_in in ArgStruct */
++ struct sockaddr_in6 *lsin1, *lsin2;
++
++ char *host;
++ struct hostent *hp;
++ struct protoent *proto;
++ int send_size, recv_size, sizeofint = sizeof(int);
++
++ host = p->host; /* copy ptr to hostname */
++
++ lsin1 = &(p->prot.sin1);
++ lsin2 = &(p->prot.sin2);
++
++ bzero((char *) lsin1, sizeof(*lsin1));
++ bzero((char *) lsin2, sizeof(*lsin2));
++
++ if ((sockfd = socket(AF_INET6, SOCK_STREAM, 0)) < 0){
++ printf("NetPIPE: can't open stream socket! errno=%d\n", errno);
++ exit(-4);
++ }
++
++ if(!(proto = getprotobyname("tcp"))){
++ printf("NetPIPE: protocol 'tcp' unknown!\n");
++ exit(555);
++ }
++
++ /* Attempt to set TCP_NODELAY */
++
++ if(setsockopt(sockfd, proto->p_proto, TCP_NODELAY, &one, sizeof(one)) < 0)
++ {
++ printf("NetPIPE: setsockopt: TCP_NODELAY failed! errno=%d\n", errno);
++ exit(556);
++ }
++
++ /* If requested, set the send and receive buffer sizes */
++
++ if(p->prot.sndbufsz > 0)
++ {
++ if(setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &(p->prot.sndbufsz),
++ sizeof(p->prot.sndbufsz)) < 0)
++ {
++ printf("NetPIPE: setsockopt: SO_SNDBUF failed! errno=%d\n", errno);
++ printf("You may have asked for a buffer larger than the system can handle\n");
++ exit(556);
++ }
++ if(setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &(p->prot.rcvbufsz),
++ sizeof(p->prot.rcvbufsz)) < 0)
++ {
++ printf("NetPIPE: setsockopt: SO_RCVBUF failed! errno=%d\n", errno);
++ printf("You may have asked for a buffer larger than the system can handle\n");
++ exit(556);
++ }
++ }
++ getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF,
++ (char *) &send_size, (void *) &sizeofint);
++ getsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,
++ (char *) &recv_size, (void *) &sizeofint);
++
++ if(!doing_reset) {
++ fprintf(stderr,"Send and receive buffers are %d and %d bytes\n",
++ send_size, recv_size);
++ fprintf(stderr, "(A bug in Linux doubles the requested buffer sizes)\n");
++ }
++
++ if( p->tr ) { /* Primary transmitter */
++
++ lsin1->sin6_family = AF_INET6;
++
++ /* First attempt to convert the string to an IPv6 */
++ /* address. */
++ /* If the user supplied a real host name this will fail and */
++ /* we'll then do a name lookup. */
++
++ if (inet_pton(AF_INET6, host, &lsin1->sin6_addr) == 0)
++ {
++ if ((hp = gethostbyname2(host, AF_INET6)) == NULL)
++ {
++ printf("NetPIPE: invalid hostname '%s'\n", host);
++ exit(-5);
++ }
++
++ if (hp->h_addrtype != AF_INET6)
++ {
++ printf("NetPIPE: invalid hostname '%s'\n", host);
++ exit(-5);
++ }
++ bcopy(hp->h_addr, (char*) &(lsin1->sin6_addr),
++ hp->h_length);
++ }
++
++ lsin1->sin6_port = htons(p->port);
++
++ p->commfd = sockfd;
++
++ } else if( p->rcv ) { /* we are the receiver */
++ bzero((char *) lsin1, sizeof(*lsin1));
++ lsin1->sin6_family = AF_INET6;
++ lsin1->sin6_len = sizeof(*lsin1);
++ lsin1->sin6_port = htons(p->port);
++ /* Setting this to all 0 is the "ANY" address. */
++ bzero(&lsin1->sin6_addr, sizeof(lsin1->sin6_addr));
++
++ if (bind(sockfd, (struct sockaddr *) lsin1, sizeof(*lsin1)) < 0){
++ printf("NetPIPE: server: bind on local address failed! errno=%d", errno);
++ exit(-6);
++ }
++
++ p->servicefd = sockfd;
++ }
++ p->upper = send_size + recv_size;
++
++ establish(p); /* Establish connections */
++
++}
++
++static int
++readFully(int fd, void *obuf, int len)
++{
++ int bytesLeft = len;
++ char *buf = (char *) obuf;
++ int bytesRead = 0;
++
++ while (bytesLeft > 0 &&
++ (bytesRead = read(fd, (void *) buf, bytesLeft)) > 0)
++ {
++ bytesLeft -= bytesRead;
++ buf += bytesRead;
++ }
++ if (bytesRead <= 0) return bytesRead;
++ return len;
++}
++
++void Sync(ArgStruct *p)
++{
++ char s[] = "SyncMe", response[] = " ";
++
++ if (write(p->commfd, s, strlen(s)) < 0 || /* Write to nbor */
++ readFully(p->commfd, response, strlen(s)) < 0) /* Read from nbor */
++ {
++ perror("NetPIPE: error writing or reading synchronization string");
++ exit(3);
++ }
++ if (strncmp(s, response, strlen(s)))
++ {
++ fprintf(stderr, "NetPIPE: Synchronization string incorrect! |%s|\n", response);
++ exit(3);
++ }
++}
++
++void PrepareToReceive(ArgStruct *p)
++{
++ /*
++ The Berkeley sockets interface doesn't have a method to pre-post
++ a buffer for reception of data.
++ */
++}
++
++void SendData(ArgStruct *p)
++{
++ int bytesWritten, bytesLeft;
++ char *q;
++
++ bytesLeft = p->bufflen;
++ bytesWritten = 0;
++ q = p->s_ptr;
++ while (bytesLeft > 0 &&
++ (bytesWritten = write(p->commfd, q, bytesLeft)) > 0)
++ {
++ bytesLeft -= bytesWritten;
++ q += bytesWritten;
++ }
++ if (bytesWritten == -1)
++ {
++ printf("NetPIPE: write: error encountered, errno=%d\n", errno);
++ exit(401);
++ }
++}
++
++void RecvData(ArgStruct *p)
++{
++ int bytesLeft;
++ int bytesRead;
++ char *q;
++
++ bytesLeft = p->bufflen;
++ bytesRead = 0;
++ q = p->r_ptr;
++ while (bytesLeft > 0 &&
++ (bytesRead = read(p->commfd, q, bytesLeft)) > 0)
++ {
++ bytesLeft -= bytesRead;
++ q += bytesRead;
++ }
++ if (bytesLeft > 0 && bytesRead == 0)
++ {
++ printf("NetPIPE: \"end of file\" encountered on reading from socket\n");
++ }
++ else if (bytesRead == -1)
++ {
++ printf("NetPIPE: read: error encountered, errno=%d\n", errno);
++ exit(401);
++ }
++}
++
++/* uint32_t is used to insure that the integer size is the same even in tests
++ * between 64-bit and 32-bit architectures. */
++
++void SendTime(ArgStruct *p, double *t)
++{
++ uint32_t ltime, ntime;
++
++ /*
++ Multiply the number of seconds by 1e8 to get time in 0.01 microseconds
++ and convert value to an unsigned 32-bit integer.
++ */
++ ltime = (uint32_t)(*t * 1.e8);
++
++ /* Send time in network order */
++ ntime = htonl(ltime);
++ if (write(p->commfd, (char *)&ntime, sizeof(uint32_t)) < 0)
++ {
++ printf("NetPIPE: write failed in SendTime: errno=%d\n", errno);
++ exit(301);
++ }
++}
++
++void RecvTime(ArgStruct *p, double *t)
++{
++ uint32_t ltime, ntime;
++ int bytesRead;
++
++ bytesRead = readFully(p->commfd, (void *)&ntime, sizeof(uint32_t));
++ if (bytesRead < 0)
++ {
++ printf("NetPIPE: read failed in RecvTime: errno=%d\n", errno);
++ exit(302);
++ }
++ else if (bytesRead != sizeof(uint32_t))
++ {
++ fprintf(stderr, "NetPIPE: partial read in RecvTime of %d bytes\n",
++ bytesRead);
++ exit(303);
++ }
++ ltime = ntohl(ntime);
++
++ /* Result is ltime (in microseconds) divided by 1.0e8 to get seconds */
++
++ *t = (double)ltime / 1.0e8;
++}
++
++void SendRepeat(ArgStruct *p, int rpt)
++{
++ uint32_t lrpt, nrpt;
++
++ lrpt = rpt;
++ /* Send repeat count as a long in network order */
++ nrpt = htonl(lrpt);
++ if (write(p->commfd, (void *) &nrpt, sizeof(uint32_t)) < 0)
++ {
++ printf("NetPIPE: write failed in SendRepeat: errno=%d\n", errno);
++ exit(304);
++ }
++}
++
++void RecvRepeat(ArgStruct *p, int *rpt)
++{
++ uint32_t lrpt, nrpt;
++ int bytesRead;
++
++ bytesRead = readFully(p->commfd, (void *)&nrpt, sizeof(uint32_t));
++ if (bytesRead < 0)
++ {
++ printf("NetPIPE: read failed in RecvRepeat: errno=%d\n", errno);
++ exit(305);
++ }
++ else if (bytesRead != sizeof(uint32_t))
++ {
++ fprintf(stderr, "NetPIPE: partial read in RecvRepeat of %d bytes\n",
++ bytesRead);
++ exit(306);
++ }
++ lrpt = ntohl(nrpt);
++
++ *rpt = lrpt;
++}
++
++void establish(ArgStruct *p)
++{
++ int one = 1;
++ socklen_t clen;
++ struct protoent *proto;
++
++ clen = (socklen_t) sizeof(p->prot.sin2);
++
++ if( p->tr ){
++
++ while( connect(p->commfd, (struct sockaddr *) &(p->prot.sin1),
++ sizeof(p->prot.sin1)) < 0 ) {
++
++ /* If we are doing a reset and we get a connection refused from
++ * the connect() call, assume that the other node has not yet
++ * gotten to its corresponding accept() call and keep trying until
++ * we have success.
++ */
++ if(!doing_reset || errno != ECONNREFUSED) {
++ printf("Client: Cannot Connect! errno=%d\n",errno);
++ exit(-10);
++ }
++
++ }
++
++ } else if( p->rcv ) {
++
++ /* SERVER */
++ listen(p->servicefd, 5);
++ p->commfd = accept(p->servicefd, (struct sockaddr *) &(p->prot.sin2), &clen);
++
++ if(p->commfd < 0){
++ printf("Server: Accept Failed! errno=%d\n",errno);
++ exit(-12);
++ }
++
++ /*
++ Attempt to set TCP_NODELAY. TCP_NODELAY may or may not be propagated
++ to accepted sockets.
++ */
++ if(!(proto = getprotobyname("tcp"))){
++ printf("unknown protocol!\n");
++ exit(555);
++ }
++
++ if(setsockopt(p->commfd, proto->p_proto, TCP_NODELAY,
++ &one, sizeof(one)) < 0)
++ {
++ printf("setsockopt: TCP_NODELAY failed! errno=%d\n", errno);
++ exit(556);
++ }
++
++ /* If requested, set the send and receive buffer sizes */
++ if(p->prot.sndbufsz > 0)
++ {
++/* printf("Send and Receive Buffers on accepted socket set to %d bytes\n",*/
++/* p->prot.sndbufsz);*/
++ if(setsockopt(p->commfd, SOL_SOCKET, SO_SNDBUF, &(p->prot.sndbufsz),
++ sizeof(p->prot.sndbufsz)) < 0)
++ {
++ printf("setsockopt: SO_SNDBUF failed! errno=%d\n", errno);
++ exit(556);
++ }
++ if(setsockopt(p->commfd, SOL_SOCKET, SO_RCVBUF, &(p->prot.rcvbufsz),
++ sizeof(p->prot.rcvbufsz)) < 0)
++ {
++ printf("setsockopt: SO_RCVBUF failed! errno=%d\n", errno);
++ exit(556);
++ }
++ }
++ }
++}
++
++void CleanUp(ArgStruct *p)
++{
++ char *quit="QUIT";
++
++ if (p->tr) {
++
++ write(p->commfd,quit, 5);
++ read(p->commfd, quit, 5);
++ close(p->commfd);
++
++ } else if( p->rcv ) {
++
++ read(p->commfd,quit, 5);
++ write(p->commfd,quit,5);
++ close(p->commfd);
++ close(p->servicefd);
++
++ }
++}
++
++
++void Reset(ArgStruct *p)
++{
++
++ /* Reset sockets */
++
++ if(p->reset_conn) {
++
++ doing_reset = 1;
++
++ /* Close the sockets */
++
++ CleanUp(p);
++
++ /* Now open and connect new sockets */
++
++ Setup(p);
++
++ }
++
++}
++
++void AfterAlignmentInit(ArgStruct *p)
++{
++
++}
++
+
+
diff --git a/benchmarks/netpipe/pkg-plist b/benchmarks/netpipe/pkg-plist
index 448d476944a0..b9e6157ee799 100644
--- a/benchmarks/netpipe/pkg-plist
+++ b/benchmarks/netpipe/pkg-plist
@@ -1,4 +1,5 @@
bin/NPtcp
+bin/NPtcp6
%%PORTDOCS%%share/doc/netpipe/README
%%PORTDOCS%%share/doc/netpipe/netpipe_paper.ps
%%PORTDOCS%%@dirrm share/doc/netpipe