/components/open-fabrics/qperf/patches/base.patch
Patch | 506 lines | 454 code | 52 blank | 0 comment | 0 complexity | 4a0b2454c840a1fc251c5236a718455c MD5 | raw file
- diff -r -u /tmp/730054/qperf-0.4.6/src/socket.c qperf-0.4.6/src/socket.c
- --- /tmp/730054/qperf-0.4.6/src/socket.c Mon Aug 31 00:00:40 2009
- +++ qperf-0.4.6/src/socket.c Mon Nov 8 11:10:20 2010
- @@ -44,7 +44,9 @@
- /*
- * Parameters.
- */
- +#if !(defined(__SVR4) && defined(__sun))
- #define AF_INET_SDP 27 /* Family for SDP */
- +#endif
-
-
- /*
- @@ -707,10 +709,16 @@
- ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
- for (aip = ailist; aip; aip = aip->ai_next) {
- if (kind == K_SDP) {
- +#if (defined(__SVR4) && defined(__sun))
- + aip->ai_family = AF_INET;
- + aip->ai_socktype = SOCK_STREAM;
- + aip->ai_protocol = PROTO_SDP;
- +#else
- if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
- aip->ai_family = AF_INET_SDP;
- else
- aip->ai_family = 0;
- +#endif
- } else if (kind == K_SCTP) {
- if (aip->ai_protocol == IPPROTO_TCP)
- aip->ai_protocol = IPPROTO_SCTP;
- diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.c qperf-0.4.6/src/qperf.c
- --- /tmp/730054/qperf-0.4.6/src/qperf.c Mon Aug 31 00:00:40 2009
- +++ qperf-0.4.6/src/qperf.c Mon Nov 8 11:10:17 2010
- @@ -53,7 +53,17 @@
- #include <sys/utsname.h>
- #include "qperf.h"
-
- +#if (defined(__SVR4) && defined(__sun))
- +#include <sys/filio.h>
- +#include <limits.h> /* times() */
- +#include <sys/types.h>
- +#include <sys/processor.h>
- +#include <sys/procset.h>
- +#include <strings.h>
- +#include <infiniband/ofa_solaris.h>
-
- +#endif
- +
- /*
- * Configurable parameters. If your change makes this version of qperf
- * incompatible with previous versions (usually a change to the Req structure),
- @@ -224,7 +234,9 @@
- static void sig_alrm(int signo, siginfo_t *siginfo, void *ucontext);
- static void sig_quit(int signo, siginfo_t *siginfo, void *ucontext);
- static void sig_urg(int signo, siginfo_t *siginfo, void *ucontext);
- -static char *skip_colon(char *s);
- +#if !(defined(__SVR4) && defined(__sun))
- +static char *skip_colon(char *s);
- +#endif
- static void start_test_timer(int seconds);
- static long str_size(char *arg, char *str);
- static void strncopy(char *d, char *s, int n);
- @@ -257,7 +269,9 @@
- static STAT IStat;
- static int ListenFD;
- static LOOP *Loops;
- +#if !(defined(__SVR4) && defined(__sun))
- static int ProcStatFD;
- +#endif
- static STAT RStat;
- static int ShowIndex;
- static SHOW ShowTable[256];
- @@ -601,6 +615,9 @@
- initialize();
- set_signals();
- do_args(&argv[1]);
- +#if (defined(__SVR4) && defined(__sun))
- + solaris_fini();
- +#endif
- return 0;
- }
-
- @@ -617,14 +634,19 @@
- for (i = 0; i < P_N; ++i)
- if (ParInfo[i].index != i)
- error(BUG, "initialize: ParInfo: out of order: %d", i);
- +#if (defined(__SVR4) && defined(__sun))
- + solaris_init();
- +#else
- ProcStatFD = open("/proc/stat", 0);
- if (ProcStatFD < 0)
- error(SYS, "cannot open /proc/stat");
- +#endif
- IStat.no_cpus = sysconf(_SC_NPROCESSORS_ONLN);
- IStat.no_ticks = sysconf(_SC_CLK_TCK);
- }
-
-
- +#if !(defined(__SVR4) && defined(__sun))
- /*
- * Look for a colon and skip past it and any spaces.
- */
- @@ -643,6 +665,7 @@
- s++;
- return s;
- }
- +#endif
-
-
- /*
- @@ -1667,13 +1690,18 @@
- {
- char count[STRSIZE];
- char speed[STRSIZE];
- - char buf[BUFSIZE];
- char cpu[BUFSIZE];
- - char mhz[BUFSIZE];
- int cpus = 0;
- +#if !(defined(__SVR4) && defined(__sun))
- + char buf[BUFSIZE];
- + char mhz[BUFSIZE];
- int mixed = 0;
- FILE *fp = fopen("/proc/cpuinfo", "r");
- +#else
- + sol_cpu_info_t *info;
- +#endif
-
- +#if !(defined(__SVR4) && defined(__sun))
- if (!fp)
- error(0, "cannot open /proc/cpuinfo");
- cpu[0] = '\0';
- @@ -1732,6 +1760,7 @@
-
- /* CPU speed */
- speed[0] = '\0';
- +
- if (!mixed) {
- int n = strlen(cpu);
- if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
- @@ -1745,7 +1774,24 @@
- }
- }
- }
- +#else
- + cpu[0] = '\0';
- + speed[0] = '\0';
-
- + if ((cpus = sol_get_cpu_info(&info)) > 0 ) {
- + (void) strcpy(cpu, info[0].cpu_name);
- +
- + if (info[0].cpu_mhz < 1000)
- + snprintf(speed, sizeof(speed), " %dMHz", info[0].cpu_mhz);
- + else
- + snprintf(speed, sizeof(speed), " %.1fGHz",
- + info[0].cpu_mhz/1000.0);
- + free(info);
- + } else {
- + return;
- + }
- +#endif
- +
- /* Number of CPUs */
- if (cpus == 1)
- count[0] = '\0';
- @@ -2615,9 +2661,15 @@
- static void
- set_affinity(void)
- {
- +#if !(defined(__SVR4) && defined(__sun))
- cpu_set_t set;
- +#endif
- int a = Req.affinity;
-
- +#if defined(__SVR4) && defined(__sun)
- + if (processor_bind(P_LWPID, P_MYID, a, NULL) != 0)
- + error(SYS, "cannot set processor affinity (cpu %d)", a);
- +#else
- if (!a)
- return;
- CPU_ZERO(&set);
- @@ -2624,6 +2676,7 @@
- CPU_SET(a-1, &set);
- if (sched_setaffinity(0, sizeof(set), &set) < 0)
- error(SYS, "cannot set processor affinity (cpu %d)", a-1);
- +#endif
- }
-
-
- @@ -2771,9 +2824,36 @@
- /*
- * Get various temporal parameters.
- */
- +#if (defined(__SVR4) && defined(__sun))
- +
- +#define NSEC_TO_TICK(v) (v * sysconf(_SC_CLK_TCK)/1000000000)
- +
- static void
- get_times(CLOCK timex[T_N])
- {
- + struct tms tms;
- + sol_cpu_stats_t stats;
- +
- + timex[T_REAL] = times(&tms);
- +
- + if ((sol_get_cpu_stats(&stats)) < 0)
- + return;
- +
- + timex[T_USER] = stats.t_user;
- + timex[T_NICE] = 0;
- + timex[T_KERNEL] = stats.t_kernel;
- + timex[T_IDLE] = stats.t_idle;
- + timex[T_IOWAIT] = stats.t_iowait;
- + timex[T_IRQ] = NSEC_TO_TICK(stats.t_intr); /* NSEC_TO_TICK */
- + timex[T_SOFTIRQ] = 0;
- + timex[T_STEAL] = 0;
- +}
- +
- +#else
- +
- +static void
- +get_times(CLOCK timex[T_N])
- +{
- int n;
- char *p;
- char buf[BUFSIZE];
- @@ -2802,6 +2882,7 @@
- while (n < T_N)
- timex[n++] = 0;
- }
- +#endif
-
-
- /*
- diff -r -u /tmp/730054/qperf-0.4.6/src/rdma.c qperf-0.4.6/src/rdma.c
- --- /tmp/730054/qperf-0.4.6/src/rdma.c Mon Aug 31 00:00:40 2009
- +++ qperf-0.4.6/src/rdma.c Mon Nov 8 11:10:19 2010
- @@ -37,7 +37,11 @@
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- +#if (defined(__SVR4) && defined(__sun))
- +#include <strings.h>
- +#else
- #include <string.h>
- +#endif
- #include <unistd.h>
- #include <netinet/in.h>
- #include <rdma/rdma_cma.h>
- @@ -110,7 +114,8 @@
- uint32_t srqn; /* Shared queue number */
- uint32_t rkey; /* Remote key */
- uint32_t alt_lid; /* Alternate Path Local LID */
- - uint32_t rd_atomic; /* Number of read/atomics supported */
- + uint32_t rd_atomic /* Number of read/atomics supported */
- + __attribute__ ((aligned (8))); /* align struct size to 64-bit binary */
- } NODE;
-
-
- @@ -566,11 +571,15 @@
- void
- run_client_uc_bi_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- par_use(L_ACCESS_RECV);
- par_use(R_ACCESS_RECV);
- rd_params(IBV_QPT_UC, K64, 1, 0);
- rd_bi_bw(IBV_QPT_UC);
- show_results(BANDWIDTH_SR);
- +#endif
- }
-
-
- @@ -580,7 +589,11 @@
- void
- run_server_uc_bi_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_bi_bw(IBV_QPT_UC);
- +#endif
- }
-
-
- @@ -590,6 +603,9 @@
- void
- run_client_uc_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- par_use(L_ACCESS_RECV);
- par_use(R_ACCESS_RECV);
- par_use(L_NO_MSGS);
- @@ -597,6 +613,7 @@
- rd_params(IBV_QPT_UC, K64, 1, 0);
- rd_client_bw(IBV_QPT_UC);
- show_results(BANDWIDTH_SR);
- +#endif
- }
-
-
- @@ -606,7 +623,11 @@
- void
- run_server_uc_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_server_def(IBV_QPT_UC);
- +#endif
- }
-
-
- @@ -616,8 +637,12 @@
- void
- run_client_uc_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_params(IBV_QPT_UC, 1, 1, 0);
- rd_pp_lat(IBV_QPT_UC, IO_SR);
- +#endif
- }
-
-
- @@ -627,7 +652,11 @@
- void
- run_server_uc_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_pp_lat(IBV_QPT_UC, IO_SR);
- +#endif
- }
-
-
- @@ -637,9 +666,13 @@
- void
- run_client_uc_rdma_write_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_params(IBV_QPT_UC, K64, 1, 0);
- rd_client_rdma_bw(IBV_QPT_UC, IBV_WR_RDMA_WRITE_WITH_IMM);
- show_results(BANDWIDTH_SR);
- +#endif
- }
-
-
- @@ -649,7 +682,11 @@
- void
- run_server_uc_rdma_write_bw(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_server_def(IBV_QPT_UC);
- +#endif
- }
-
-
- @@ -659,8 +696,12 @@
- void
- run_client_uc_rdma_write_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_params(IBV_QPT_UC, 1, 1, 0);
- rd_pp_lat(IBV_QPT_UC, IO_RDMA);
- +#endif
- }
-
-
- @@ -670,7 +711,11 @@
- void
- run_server_uc_rdma_write_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_pp_lat(IBV_QPT_UC, IO_RDMA);
- +#endif
- }
-
-
- @@ -680,9 +725,13 @@
- void
- run_client_uc_rdma_write_poll_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_params(IBV_QPT_UC, 1, 1, 0);
- rd_rdma_write_poll_lat(IBV_QPT_UC);
- show_results(LATENCY);
- +#endif
- }
-
-
- @@ -692,7 +741,11 @@
- void
- run_server_uc_rdma_write_poll_lat(void)
- {
- +#if (defined(__SVR4) && defined(__sun))
- + error(RET, "UC Not Supported");
- +#else
- rd_rdma_write_poll_lat(IBV_QPT_UC);
- +#endif
- }
-
-
- @@ -1864,10 +1917,16 @@
- error(0, "rdma_bind_addr failed");
- port = ntohs(rdma_get_src_port(cm->id));
- encode_uint32(&port, port);
- +#if !(defined(__SVR4) && defined(__sun))
- send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
- +#endif
-
- if (rdma_listen(cm->id, 0) != 0)
- error(0, "rdma_listen failed");
- +
- +#if (defined(__SVR4) && defined(__sun))
- + send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
- +#endif
- cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
- rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
-
- diff -r -u /tmp/730054/qperf-0.4.6/src/rds.c qperf-0.4.6/src/rds.c
- --- /tmp/730054/qperf-0.4.6/src/rds.c Mon Aug 31 00:00:40 2009
- +++ qperf-0.4.6/src/rds.c Mon Nov 8 11:10:19 2010
- @@ -44,6 +44,9 @@
- #include <netinet/in.h>
- #include "qperf.h"
-
- +#if (defined(__SVR4) && defined(__sun))
- +#include <sys/rds.h>
- +#else
-
- /*
- * Parameters.
- @@ -50,6 +53,7 @@
- */
- #define AF_INET_RDS 28 /* Family for RDS */
-
- +#endif
-
- /*
- * Function prototypes.
- @@ -352,7 +356,11 @@
- SS sockaddr;
- socklen_t socklen;
-
- +#if (defined(__SVR4) && defined(__sun))
- + sockfd = socket(PF_RDS, SOCK_SEQPACKET, 0);
- +#else
- sockfd = socket(AF_INET_RDS, SOCK_SEQPACKET, 0);
- +#endif
- if (sockfd < 0)
- error(SYS, "socket failed");
- setsockopt_one(sockfd, SO_REUSEADDR);
- @@ -373,7 +381,11 @@
- struct sockaddr_in *sap = (struct sockaddr_in *)addr;
-
- memset(sap, 0, sizeof(*sap));
- +#if (defined(__SVR4) && defined(__sun))
- + sap->sin_family = AF_INET_OFFLOAD;
- +#else
- sap->sin_family = AF_INET;
- +#endif
- inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
- sap->sin_port = htons(port);
- *len = sizeof(struct sockaddr_in);
- @@ -431,6 +443,14 @@
-
- if (getsockname(fd, (SA *)&sa, &salen) < 0)
- error(SYS, "getsockname failed");
- +#if (defined(__SVR4) && defined(__sun))
- + /*
- + * getnameinfo() does not support AF_INET_OFFLOAD, so
- + * use ss_family as AF_INET to get port info.
- + */
- + if (sa.ss_family == AF_INET_OFFLOAD)
- + sa.ss_family = AF_INET;
- +#endif
- qgetnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV);
- port = atoi(p);
- if (!port)
- diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.h qperf-0.4.6/src/qperf.h
- --- /tmp/730054/qperf-0.4.6/src/qperf.h Mon Aug 31 00:00:40 2009
- +++ qperf-0.4.6/src/qperf.h Tue Oct 18 16:40:59 2011
- @@ -193,6 +193,7 @@
- uint32_t no_cpus; /* Number of processors */
- uint32_t no_ticks; /* Ticks per second */
- uint32_t max_cqes; /* Maximum CQ entries */
- + __attribute__ ((aligned (8))) /* align with 32-bit & 64-bit binary */
- CLOCK time_s[T_N]; /* Start times */
- CLOCK time_e[T_N]; /* End times */
- USTAT s; /* Send statistics */