[openib-general] RE: netperf for RDS needed
Ranjit Pandit
rpandit at silverstorm.com
Wed Apr 26 17:04:02 PDT 2006
> can you generate the patch in the standard unifined manner that is by
>
> $ diff -rup netperf-2.4.1rc1 netperf-2.4.1rc1.rds
>
Attached.
-------------- next part --------------
diff -rup netperf-2.4.1rc1/src/netlib.c netperf-2.4.1rc1.rds/src/netlib.c
--- netperf-2.4.1rc1/src/netlib.c 2005-09-07 16:39:34.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/netlib.c 2006-04-26 19:00:18.000000000 -0700
@@ -1,6 +1,8 @@
char netlib_id[]="\
@(#)netlib.c (c) Copyright 1993-2004 Hewlett-Packard Company. Version 2.3pl2";
+#define AF_INET_OFFLOAD 30
+#define AF_INET_SDP 27
/****************************************************************/
/* */
/* netlib.c */
@@ -466,6 +468,12 @@ inet_ftos(int family)
case AF_INET:
return("AF_INET");
break;
+ case AF_INET_OFFLOAD:
+ return("AF_INET_OFFLOAD");
+ break;
+ case AF_INET_SDP:
+ return("AF_INET_SDP");
+ break;
#if defined(AF_INET6)
case AF_INET6:
return("AF_INET6");
@@ -483,6 +491,8 @@ inet_nton(int af, const void *src, char
switch (af) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
/* magic constants again... :) */
if (cnt >= 4) {
memcpy(dst,src,4);
diff -rup netperf-2.4.1rc1/src/netserver.c netperf-2.4.1rc1.rds/src/netserver.c
--- netperf-2.4.1rc1/src/netserver.c 2005-09-07 16:40:49.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/netserver.c 2006-04-26 19:00:18.000000000 -0700
@@ -149,11 +149,12 @@ FILE *afp;
char listen_port[10];
extern char *optarg;
extern int optind, opterr;
+extern int rds_enable;
#ifndef WIN32
-#define SERVER_ARGS "dL:n:p:v:46"
+#define SERVER_ARGS "dL:n:p:rv:46"
#else
-#define SERVER_ARGS "dL:n:p:v:46I:i:"
+#define SERVER_ARGS "dL:n:p:rv:46I:i:"
#endif
/* This routine implements the "main event loop" of the netperf */
@@ -249,11 +250,11 @@ process_requests()
#endif /* DO_NBRR */
case DO_UDP_STREAM:
- recv_udp_stream();
+ recv_udp_stream(local_host_name);
break;
case DO_UDP_RR:
- recv_udp_rr();
+ recv_udp_rr(local_host_name);
break;
#ifdef WANT_DLPI
@@ -526,7 +527,7 @@ set_up_server(char hostname[], char port
printf("server_control: accept failed errno %d\n",errno);
exit(1);
}
-#if defined(MPE) || defined(__VMS)
+#if defined(MPE) || defined(__VMS) || 1
/*
* Since we cannot fork this process , we cant fire any threads
* as they all share the same global data . So we better allow
@@ -748,6 +749,9 @@ main(int argc, char *argv[])
strncpy(listen_port,optarg,sizeof(listen_port));
not_inetd = 1;
break;
+ case 'r':
+ rds_enable=1;
+ break;
case '4':
local_address_family = AF_INET;
break;
Only in netperf-2.4.1rc1.rds/src: netserver.o
diff -rup netperf-2.4.1rc1/src/netsh.c netperf-2.4.1rc1.rds/src/netsh.c
--- netperf-2.4.1rc1/src/netsh.c 2005-09-07 11:46:16.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/netsh.c 2006-04-26 19:00:18.000000000 -0700
@@ -1,6 +1,9 @@
char netsh_id[]="\
@(#)netsh.c (c) Copyright 1993-2004 Hewlett-Packard Company. Version 2.4.0";
+#define WANT_RDS
+#define AF_INET_OFFLOAD 30
+#define AF_INET_SDP 27
/****************************************************************/
/* */
@@ -94,7 +97,7 @@ double atof(const char *);
/* Some of the args take optional parameters. Since we are using */
/* getopt to parse the command line, we will tell getopt that they do */
/* not take parms, and then look for them ourselves */
-#define GLOBAL_CMD_LINE_ARGS "A:a:b:CcdDf:F:H:hi:I:l:L:n:O:o:P:p:t:T:v:W:w:46"
+#define GLOBAL_CMD_LINE_ARGS "A:a:b:CcdDf:F:H:hi:I:l:L:n:O:o:P:p:rt:T:v:W:w:46"
/************************************************************************/
/* */
@@ -127,7 +130,9 @@ char test_port[PORTBUFSIZE]; /* where i
char local_test_port[PORTBUFSIZE]; /* from whence we should start */
int address_family; /* which address family remote */
int local_address_family; /* which address family local */
-
+#ifdef WANT_RDS
+int rds_enable; /* enable RDS testing */
+#endif
/* the source of data for filling the buffers */
char fill_file[BUFSIZ];
@@ -255,6 +260,7 @@ Global options:\n\
-n numcpu Set the number of processors for CPU util\n\
-p port,lport* Specify netserver port number and/or local port\n\
-P 0|1 Don't/Do display test headers\n\
+ -r Enable RDS usage for UDP tests\n\
-t testname Specify test to perform\n\
-T lcpu,rcpu Request netperf/netserver be bound to local/remote cpu\n\
-v verbosity Specify the verbosity level\n\
@@ -619,6 +625,9 @@ scan_cmd_line(int argc, char *argv[])
/* the header question */
print_headers = convert(optarg);
break;
+ case 'r':
+ rds_enable = 1;
+ break;
case 't':
/* set the test name */
strcpy(test_name,optarg);
@@ -733,6 +742,8 @@ scan_cmd_line(int argc, char *argv[])
/* host_name was not set */
switch (address_family) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
strcpy(host_name,"localhost");
break;
case AF_UNSPEC:
@@ -740,6 +751,8 @@ scan_cmd_line(int argc, char *argv[])
suppose */
switch (local_address_family) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
case AF_UNSPEC:
strcpy(host_name,"localhost");
break;
@@ -771,11 +784,15 @@ scan_cmd_line(int argc, char *argv[])
if ('\0' == local_host_name[0]) {
switch (local_address_family) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
strcpy(local_host_name,"0.0.0.0");
break;
case AF_UNSPEC:
switch (address_family) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
case AF_UNSPEC:
strcpy(local_host_name,"0.0.0.0");
break;
diff -rup netperf-2.4.1rc1/src/netsh.h netperf-2.4.1rc1.rds/src/netsh.h
--- netperf-2.4.1rc1/src/netsh.h 2005-04-06 13:26:40.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/netsh.h 2006-04-26 19:00:18.000000000 -0700
@@ -76,6 +76,12 @@ extern int
remote_send_offset,
remote_recv_offset;
+#ifdef WANT_RDS
+extern int rds_enable;
+#define AF_INET_OFFLOAD 30
+#define AF_INET_SDP 27
+#endif
+
#ifdef WANT_INTERVALS
extern int interval_usecs;
extern int interval_wate;
diff -rup netperf-2.4.1rc1/src/nettest_bsd.c netperf-2.4.1rc1.rds/src/nettest_bsd.c
--- netperf-2.4.1rc1/src/nettest_bsd.c 2005-09-07 15:41:38.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/nettest_bsd.c 2006-04-26 19:00:18.000000000 -0700
@@ -7,6 +7,12 @@ char nettest_id[]="\
#define WANT_INTERVALS
#endif /* lint */
+#define WANT_RDS
+#ifdef WANT_RDS
+#define AF_INET_OFFLOAD 30
+#define AF_INET_SDP 27
+#endif
+
/****************************************************************/
/* */
/* nettest_bsd.c */
@@ -334,6 +340,12 @@ comma.\n";
int
nf_to_af(int nf) {
switch(nf) {
+ case NF_INET_OFFLOAD:
+ return AF_INET_OFFLOAD;
+ break;
+ case NF_INET_SDP:
+ return AF_INET_SDP;
+ break;
case NF_INET:
return AF_INET;
break;
@@ -357,6 +369,12 @@ int
af_to_nf(int af) {
switch(af) {
+ case AF_INET_OFFLOAD:
+ return NF_INET_OFFLOAD;
+ break;
+ case AF_INET_SDP:
+ return NF_INET_SDP;
+ break;
case AF_INET:
return NF_INET;
break;
@@ -430,7 +448,7 @@ complete_addrinfo(char *controlhost, cha
hostname = data_address;
else
hostname = controlhost;
-
+
if (debug) {
fprintf(where,
"complete_addrinfo using hostname %s port %s family %s type %s prot %s flags 0x%x\n",
@@ -442,13 +460,20 @@ complete_addrinfo(char *controlhost, cha
flags);
fflush(where);
}
-
+
memset(&hints, 0, sizeof(hints));
- hints.ai_family = family;
+
+#if 0
+ if (rds_enable && type == SOCK_DGRAM)
+ hints.ai_family = AF_INET_OFFLOAD;
+ else
+#endif
+ hints.ai_family = family;
+
switch (type) {
case 0:
- case SOCK_STREAM:
case SOCK_DGRAM:
+ case SOCK_STREAM:
/* Right now most implementations only support these socket
* types.
*/
@@ -472,7 +497,7 @@ complete_addrinfo(char *controlhost, cha
change_info |= CHANGE_PROTOCOL;
break;
}
-
+
hints.ai_flags = flags|AI_CANONNAME;
count = 0;
do {
@@ -527,7 +552,24 @@ complete_addrinfo(char *controlhost, cha
dump_addrinfo(where, res, hostname, port, family);
}
-
+#ifdef WANT_RDS
+ /* this should be done before getaddrinfo - but there is currently a bug */
+ /* and getaddrinfo does not recognize AF_INET_OFFLOAD */
+ if (rds_enable && type == SOCK_DGRAM)
+ {
+ res->ai_family = AF_INET_OFFLOAD;
+#if 0
+ res->ai_protocol = 0;
+#endif
+ }
+ if (rds_enable && type == SOCK_STREAM)
+ {
+ res->ai_family = AF_INET_SDP;
+#if 0
+ res->ai_protocol = 0;
+#endif
+ }
+#endif
return(res);
}
@@ -588,6 +630,8 @@ static unsigned short
get_port_number(struct addrinfo *res)
{
switch(res->ai_family) {
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
case AF_INET: {
struct sockaddr_in *foo = (struct sockaddr_in *)res->ai_addr;
return(ntohs(foo->sin_port));
@@ -614,6 +658,8 @@ void
set_port_number(struct addrinfo *res, unsigned short port)
{
switch(res->ai_family) {
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
case AF_INET: {
struct sockaddr_in *foo = (struct sockaddr_in *)res->ai_addr;
foo->sin_port = htons(port);
@@ -849,6 +895,7 @@ create_data_socket(struct addrinfo *res)
errno);
fprintf(where," port: %d\n",get_port_number(res));
fflush(where);
+ exit(1);
}
}
@@ -924,6 +971,8 @@ get_address_address(struct addrinfo *inf
switch(info->ai_family) {
case AF_INET:
+ case AF_INET_OFFLOAD:
+ case AF_INET_SDP:
sin = (struct sockaddr_in *)info->ai_addr;
return(&(sin->sin_addr));
break;
@@ -4206,6 +4255,10 @@ recv_tcp_stream()
loc_rcvavoid = tcp_stream_request->so_rcvavoid;
loc_sndavoid = tcp_stream_request->so_sndavoid;
+ /* hack to deal with getaddrinfo not recognizing af_inet_offload */
+ if (rds_enable)
+ tcp_stream_request->ipfamily = AF_INET;
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(tcp_stream_request->ipfamily),
@@ -5785,10 +5838,16 @@ bytes bytes secs #
send_ring->buffer_ptr,
send_size,
0)) != send_size) {
- if ((len >= 0) ||
- SOCKET_EINTR(len))
- break;
- if (errno == ENOBUFS) {
+ if ((len >= 0) ||
+ SOCKET_EINTR(len)) {
+
+ fprintf(where, "send_udp_stream: aborting send len %d, %d\n",len,
+ SOCKET_EINTR(len));
+ fflush(where);
+ break;
+ }
+ if (errno == ENOBUFS || errno == EWOULDBLOCK) {
+ usleep(100);
failed_sends++;
continue;
}
@@ -5832,7 +5891,7 @@ bytes bytes secs #
#endif /* WANT_INTERVALS */
}
-
+
/* This is a timed test, so the remote will be returning to us after */
/* a time. We should not need to send any "strange" messages to tell */
/* the remote that the test is completed, unless we decide to add a */
@@ -5841,6 +5900,11 @@ bytes bytes secs #
/* the test is over, so get stats and stuff */
cpu_stop(local_cpu_usage,
&elapsed_time);
+#if 1
+ fprintf(where, "send_udp_stream: sent %d, failed %d\n",messages_sent,
+ failed_sends);
+ fflush(where);
+#endif
/* Get the statistics from the remote end */
recv_response();
@@ -6063,7 +6127,7 @@ bytes bytes secs #
/* UDP_STREAM performance test. */
void
-recv_udp_stream()
+recv_udp_stream(char local_host[])
{
struct ring_elt *recv_ring;
@@ -6158,13 +6222,17 @@ recv_udp_stream()
loc_rcvavoid = udp_stream_request->so_rcvavoid;
loc_sndavoid = udp_stream_request->so_sndavoid;
+ /* hack to deal with getaddrinfo not recognizing af_inet_offload */
+ if (rds_enable)
+ udp_stream_request->ipfamily = AF_INET;
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(udp_stream_request->ipfamily),
udp_stream_request->port);
- local_res = complete_addrinfo(local_name,
- local_name,
+ local_res = complete_addrinfo(rds_enable ? local_host : local_name,
+ rds_enable ? local_host : local_name,
port_buffer,
nf_to_af(udp_stream_request->ipfamily),
SOCK_DGRAM,
@@ -6275,6 +6343,9 @@ recv_udp_stream()
{
if ((len == SOCKET_ERROR) && !SOCKET_EINTR(len)) {
netperf_response.content.serv_errno = errno;
+ fprintf(where,"recv_udp_stream: got error, len %d, %d\n",
+ len, SOCKET_EINTR(len));
+fflush(where);
send_response();
exit(1);
}
@@ -6978,7 +7049,7 @@ bytes bytes bytes bytes secs. per
/* this routine implements the receive side (netserver) of a UDP_RR */
/* test. */
void
-recv_udp_rr()
+recv_udp_rr(char local_host[])
{
struct ring_elt *recv_ring;
@@ -7087,13 +7158,17 @@ recv_udp_rr()
loc_rcvavoid = udp_rr_request->so_rcvavoid;
loc_sndavoid = udp_rr_request->so_sndavoid;
+ /* hack to deal with getaddrinfo not recognizing af_inet_offload */
+ if (rds_enable)
+ udp_rr_request->ipfamily = AF_INET;
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(udp_rr_request->ipfamily),
udp_rr_request->port);
- local_res = complete_addrinfo(local_name,
- local_name,
+ local_res = complete_addrinfo(rds_enable ? local_host : local_name,
+ rds_enable ? local_host : local_name,
port_buffer,
nf_to_af(udp_rr_request->ipfamily),
SOCK_DGRAM,
@@ -7397,6 +7472,9 @@ recv_tcp_rr()
loc_rcvavoid = tcp_rr_request->so_rcvavoid;
loc_sndavoid = tcp_rr_request->so_sndavoid;
+ if (rds_enable)
+ tcp_rr_request->ipfamily = AF_INET;
+
set_hostname_and_port(local_name,
port_buffer,
nf_to_af(tcp_rr_request->ipfamily),
diff -rup netperf-2.4.1rc1/src/nettest_bsd.h netperf-2.4.1rc1.rds/src/nettest_bsd.h
--- netperf-2.4.1rc1/src/nettest_bsd.h 2005-04-18 16:39:16.000000000 -0700
+++ netperf-2.4.1rc1.rds/src/nettest_bsd.h 2006-04-26 19:00:18.000000000 -0700
@@ -14,6 +14,8 @@
#define NF_UNSPEC 0
#define NF_INET 4
#define NF_INET6 6
+#define NF_INET_OFFLOAD 30
+#define NF_INET_SDP 27
struct tcp_stream_request_struct {
int send_buf_size;
@@ -443,8 +445,8 @@ extern void recv_tcp_maerts();
extern void recv_tcp_rr();
extern void recv_tcp_conn_rr();
extern void recv_tcp_cc();
-extern void recv_udp_stream();
-extern void recv_udp_rr();
+extern void recv_udp_stream(char local_host[]);
+extern void recv_udp_rr(char local_host[]);
extern void loc_cpu_rate();
extern void rem_cpu_rate();
More information about the general
mailing list