PageRenderTime 64ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/components/open-fabrics/qperf/patches/base.patch

https://github.com/aszeszo/userland
Patch | 506 lines | 454 code | 52 blank | 0 comment | 0 complexity | 4a0b2454c840a1fc251c5236a718455c MD5 | raw file
  1. diff -r -u /tmp/730054/qperf-0.4.6/src/socket.c qperf-0.4.6/src/socket.c
  2. --- /tmp/730054/qperf-0.4.6/src/socket.c Mon Aug 31 00:00:40 2009
  3. +++ qperf-0.4.6/src/socket.c Mon Nov 8 11:10:20 2010
  4. @@ -44,7 +44,9 @@
  5. /*
  6. * Parameters.
  7. */
  8. +#if !(defined(__SVR4) && defined(__sun))
  9. #define AF_INET_SDP 27 /* Family for SDP */
  10. +#endif
  11. /*
  12. @@ -707,10 +709,16 @@
  13. ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
  14. for (aip = ailist; aip; aip = aip->ai_next) {
  15. if (kind == K_SDP) {
  16. +#if (defined(__SVR4) && defined(__sun))
  17. + aip->ai_family = AF_INET;
  18. + aip->ai_socktype = SOCK_STREAM;
  19. + aip->ai_protocol = PROTO_SDP;
  20. +#else
  21. if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
  22. aip->ai_family = AF_INET_SDP;
  23. else
  24. aip->ai_family = 0;
  25. +#endif
  26. } else if (kind == K_SCTP) {
  27. if (aip->ai_protocol == IPPROTO_TCP)
  28. aip->ai_protocol = IPPROTO_SCTP;
  29. diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.c qperf-0.4.6/src/qperf.c
  30. --- /tmp/730054/qperf-0.4.6/src/qperf.c Mon Aug 31 00:00:40 2009
  31. +++ qperf-0.4.6/src/qperf.c Mon Nov 8 11:10:17 2010
  32. @@ -53,7 +53,17 @@
  33. #include <sys/utsname.h>
  34. #include "qperf.h"
  35. +#if (defined(__SVR4) && defined(__sun))
  36. +#include <sys/filio.h>
  37. +#include <limits.h> /* times() */
  38. +#include <sys/types.h>
  39. +#include <sys/processor.h>
  40. +#include <sys/procset.h>
  41. +#include <strings.h>
  42. +#include <infiniband/ofa_solaris.h>
  43. +#endif
  44. +
  45. /*
  46. * Configurable parameters. If your change makes this version of qperf
  47. * incompatible with previous versions (usually a change to the Req structure),
  48. @@ -224,7 +234,9 @@
  49. static void sig_alrm(int signo, siginfo_t *siginfo, void *ucontext);
  50. static void sig_quit(int signo, siginfo_t *siginfo, void *ucontext);
  51. static void sig_urg(int signo, siginfo_t *siginfo, void *ucontext);
  52. -static char *skip_colon(char *s);
  53. +#if !(defined(__SVR4) && defined(__sun))
  54. +static char *skip_colon(char *s);
  55. +#endif
  56. static void start_test_timer(int seconds);
  57. static long str_size(char *arg, char *str);
  58. static void strncopy(char *d, char *s, int n);
  59. @@ -257,7 +269,9 @@
  60. static STAT IStat;
  61. static int ListenFD;
  62. static LOOP *Loops;
  63. +#if !(defined(__SVR4) && defined(__sun))
  64. static int ProcStatFD;
  65. +#endif
  66. static STAT RStat;
  67. static int ShowIndex;
  68. static SHOW ShowTable[256];
  69. @@ -601,6 +615,9 @@
  70. initialize();
  71. set_signals();
  72. do_args(&argv[1]);
  73. +#if (defined(__SVR4) && defined(__sun))
  74. + solaris_fini();
  75. +#endif
  76. return 0;
  77. }
  78. @@ -617,14 +634,19 @@
  79. for (i = 0; i < P_N; ++i)
  80. if (ParInfo[i].index != i)
  81. error(BUG, "initialize: ParInfo: out of order: %d", i);
  82. +#if (defined(__SVR4) && defined(__sun))
  83. + solaris_init();
  84. +#else
  85. ProcStatFD = open("/proc/stat", 0);
  86. if (ProcStatFD < 0)
  87. error(SYS, "cannot open /proc/stat");
  88. +#endif
  89. IStat.no_cpus = sysconf(_SC_NPROCESSORS_ONLN);
  90. IStat.no_ticks = sysconf(_SC_CLK_TCK);
  91. }
  92. +#if !(defined(__SVR4) && defined(__sun))
  93. /*
  94. * Look for a colon and skip past it and any spaces.
  95. */
  96. @@ -643,6 +665,7 @@
  97. s++;
  98. return s;
  99. }
  100. +#endif
  101. /*
  102. @@ -1667,13 +1690,18 @@
  103. {
  104. char count[STRSIZE];
  105. char speed[STRSIZE];
  106. - char buf[BUFSIZE];
  107. char cpu[BUFSIZE];
  108. - char mhz[BUFSIZE];
  109. int cpus = 0;
  110. +#if !(defined(__SVR4) && defined(__sun))
  111. + char buf[BUFSIZE];
  112. + char mhz[BUFSIZE];
  113. int mixed = 0;
  114. FILE *fp = fopen("/proc/cpuinfo", "r");
  115. +#else
  116. + sol_cpu_info_t *info;
  117. +#endif
  118. +#if !(defined(__SVR4) && defined(__sun))
  119. if (!fp)
  120. error(0, "cannot open /proc/cpuinfo");
  121. cpu[0] = '\0';
  122. @@ -1732,6 +1760,7 @@
  123. /* CPU speed */
  124. speed[0] = '\0';
  125. +
  126. if (!mixed) {
  127. int n = strlen(cpu);
  128. if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
  129. @@ -1745,7 +1774,24 @@
  130. }
  131. }
  132. }
  133. +#else
  134. + cpu[0] = '\0';
  135. + speed[0] = '\0';
  136. + if ((cpus = sol_get_cpu_info(&info)) > 0 ) {
  137. + (void) strcpy(cpu, info[0].cpu_name);
  138. +
  139. + if (info[0].cpu_mhz < 1000)
  140. + snprintf(speed, sizeof(speed), " %dMHz", info[0].cpu_mhz);
  141. + else
  142. + snprintf(speed, sizeof(speed), " %.1fGHz",
  143. + info[0].cpu_mhz/1000.0);
  144. + free(info);
  145. + } else {
  146. + return;
  147. + }
  148. +#endif
  149. +
  150. /* Number of CPUs */
  151. if (cpus == 1)
  152. count[0] = '\0';
  153. @@ -2615,9 +2661,15 @@
  154. static void
  155. set_affinity(void)
  156. {
  157. +#if !(defined(__SVR4) && defined(__sun))
  158. cpu_set_t set;
  159. +#endif
  160. int a = Req.affinity;
  161. +#if defined(__SVR4) && defined(__sun)
  162. + if (processor_bind(P_LWPID, P_MYID, a, NULL) != 0)
  163. + error(SYS, "cannot set processor affinity (cpu %d)", a);
  164. +#else
  165. if (!a)
  166. return;
  167. CPU_ZERO(&set);
  168. @@ -2624,6 +2676,7 @@
  169. CPU_SET(a-1, &set);
  170. if (sched_setaffinity(0, sizeof(set), &set) < 0)
  171. error(SYS, "cannot set processor affinity (cpu %d)", a-1);
  172. +#endif
  173. }
  174. @@ -2771,9 +2824,36 @@
  175. /*
  176. * Get various temporal parameters.
  177. */
  178. +#if (defined(__SVR4) && defined(__sun))
  179. +
  180. +#define NSEC_TO_TICK(v) (v * sysconf(_SC_CLK_TCK)/1000000000)
  181. +
  182. static void
  183. get_times(CLOCK timex[T_N])
  184. {
  185. + struct tms tms;
  186. + sol_cpu_stats_t stats;
  187. +
  188. + timex[T_REAL] = times(&tms);
  189. +
  190. + if ((sol_get_cpu_stats(&stats)) < 0)
  191. + return;
  192. +
  193. + timex[T_USER] = stats.t_user;
  194. + timex[T_NICE] = 0;
  195. + timex[T_KERNEL] = stats.t_kernel;
  196. + timex[T_IDLE] = stats.t_idle;
  197. + timex[T_IOWAIT] = stats.t_iowait;
  198. + timex[T_IRQ] = NSEC_TO_TICK(stats.t_intr); /* NSEC_TO_TICK */
  199. + timex[T_SOFTIRQ] = 0;
  200. + timex[T_STEAL] = 0;
  201. +}
  202. +
  203. +#else
  204. +
  205. +static void
  206. +get_times(CLOCK timex[T_N])
  207. +{
  208. int n;
  209. char *p;
  210. char buf[BUFSIZE];
  211. @@ -2802,6 +2882,7 @@
  212. while (n < T_N)
  213. timex[n++] = 0;
  214. }
  215. +#endif
  216. /*
  217. diff -r -u /tmp/730054/qperf-0.4.6/src/rdma.c qperf-0.4.6/src/rdma.c
  218. --- /tmp/730054/qperf-0.4.6/src/rdma.c Mon Aug 31 00:00:40 2009
  219. +++ qperf-0.4.6/src/rdma.c Mon Nov 8 11:10:19 2010
  220. @@ -37,7 +37,11 @@
  221. #include <errno.h>
  222. #include <stdio.h>
  223. #include <stdlib.h>
  224. +#if (defined(__SVR4) && defined(__sun))
  225. +#include <strings.h>
  226. +#else
  227. #include <string.h>
  228. +#endif
  229. #include <unistd.h>
  230. #include <netinet/in.h>
  231. #include <rdma/rdma_cma.h>
  232. @@ -110,7 +114,8 @@
  233. uint32_t srqn; /* Shared queue number */
  234. uint32_t rkey; /* Remote key */
  235. uint32_t alt_lid; /* Alternate Path Local LID */
  236. - uint32_t rd_atomic; /* Number of read/atomics supported */
  237. + uint32_t rd_atomic /* Number of read/atomics supported */
  238. + __attribute__ ((aligned (8))); /* align struct size to 64-bit binary */
  239. } NODE;
  240. @@ -566,11 +571,15 @@
  241. void
  242. run_client_uc_bi_bw(void)
  243. {
  244. +#if (defined(__SVR4) && defined(__sun))
  245. + error(RET, "UC Not Supported");
  246. +#else
  247. par_use(L_ACCESS_RECV);
  248. par_use(R_ACCESS_RECV);
  249. rd_params(IBV_QPT_UC, K64, 1, 0);
  250. rd_bi_bw(IBV_QPT_UC);
  251. show_results(BANDWIDTH_SR);
  252. +#endif
  253. }
  254. @@ -580,7 +589,11 @@
  255. void
  256. run_server_uc_bi_bw(void)
  257. {
  258. +#if (defined(__SVR4) && defined(__sun))
  259. + error(RET, "UC Not Supported");
  260. +#else
  261. rd_bi_bw(IBV_QPT_UC);
  262. +#endif
  263. }
  264. @@ -590,6 +603,9 @@
  265. void
  266. run_client_uc_bw(void)
  267. {
  268. +#if (defined(__SVR4) && defined(__sun))
  269. + error(RET, "UC Not Supported");
  270. +#else
  271. par_use(L_ACCESS_RECV);
  272. par_use(R_ACCESS_RECV);
  273. par_use(L_NO_MSGS);
  274. @@ -597,6 +613,7 @@
  275. rd_params(IBV_QPT_UC, K64, 1, 0);
  276. rd_client_bw(IBV_QPT_UC);
  277. show_results(BANDWIDTH_SR);
  278. +#endif
  279. }
  280. @@ -606,7 +623,11 @@
  281. void
  282. run_server_uc_bw(void)
  283. {
  284. +#if (defined(__SVR4) && defined(__sun))
  285. + error(RET, "UC Not Supported");
  286. +#else
  287. rd_server_def(IBV_QPT_UC);
  288. +#endif
  289. }
  290. @@ -616,8 +637,12 @@
  291. void
  292. run_client_uc_lat(void)
  293. {
  294. +#if (defined(__SVR4) && defined(__sun))
  295. + error(RET, "UC Not Supported");
  296. +#else
  297. rd_params(IBV_QPT_UC, 1, 1, 0);
  298. rd_pp_lat(IBV_QPT_UC, IO_SR);
  299. +#endif
  300. }
  301. @@ -627,7 +652,11 @@
  302. void
  303. run_server_uc_lat(void)
  304. {
  305. +#if (defined(__SVR4) && defined(__sun))
  306. + error(RET, "UC Not Supported");
  307. +#else
  308. rd_pp_lat(IBV_QPT_UC, IO_SR);
  309. +#endif
  310. }
  311. @@ -637,9 +666,13 @@
  312. void
  313. run_client_uc_rdma_write_bw(void)
  314. {
  315. +#if (defined(__SVR4) && defined(__sun))
  316. + error(RET, "UC Not Supported");
  317. +#else
  318. rd_params(IBV_QPT_UC, K64, 1, 0);
  319. rd_client_rdma_bw(IBV_QPT_UC, IBV_WR_RDMA_WRITE_WITH_IMM);
  320. show_results(BANDWIDTH_SR);
  321. +#endif
  322. }
  323. @@ -649,7 +682,11 @@
  324. void
  325. run_server_uc_rdma_write_bw(void)
  326. {
  327. +#if (defined(__SVR4) && defined(__sun))
  328. + error(RET, "UC Not Supported");
  329. +#else
  330. rd_server_def(IBV_QPT_UC);
  331. +#endif
  332. }
  333. @@ -659,8 +696,12 @@
  334. void
  335. run_client_uc_rdma_write_lat(void)
  336. {
  337. +#if (defined(__SVR4) && defined(__sun))
  338. + error(RET, "UC Not Supported");
  339. +#else
  340. rd_params(IBV_QPT_UC, 1, 1, 0);
  341. rd_pp_lat(IBV_QPT_UC, IO_RDMA);
  342. +#endif
  343. }
  344. @@ -670,7 +711,11 @@
  345. void
  346. run_server_uc_rdma_write_lat(void)
  347. {
  348. +#if (defined(__SVR4) && defined(__sun))
  349. + error(RET, "UC Not Supported");
  350. +#else
  351. rd_pp_lat(IBV_QPT_UC, IO_RDMA);
  352. +#endif
  353. }
  354. @@ -680,9 +725,13 @@
  355. void
  356. run_client_uc_rdma_write_poll_lat(void)
  357. {
  358. +#if (defined(__SVR4) && defined(__sun))
  359. + error(RET, "UC Not Supported");
  360. +#else
  361. rd_params(IBV_QPT_UC, 1, 1, 0);
  362. rd_rdma_write_poll_lat(IBV_QPT_UC);
  363. show_results(LATENCY);
  364. +#endif
  365. }
  366. @@ -692,7 +741,11 @@
  367. void
  368. run_server_uc_rdma_write_poll_lat(void)
  369. {
  370. +#if (defined(__SVR4) && defined(__sun))
  371. + error(RET, "UC Not Supported");
  372. +#else
  373. rd_rdma_write_poll_lat(IBV_QPT_UC);
  374. +#endif
  375. }
  376. @@ -1864,10 +1917,16 @@
  377. error(0, "rdma_bind_addr failed");
  378. port = ntohs(rdma_get_src_port(cm->id));
  379. encode_uint32(&port, port);
  380. +#if !(defined(__SVR4) && defined(__sun))
  381. send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
  382. +#endif
  383. if (rdma_listen(cm->id, 0) != 0)
  384. error(0, "rdma_listen failed");
  385. +
  386. +#if (defined(__SVR4) && defined(__sun))
  387. + send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
  388. +#endif
  389. cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
  390. rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
  391. diff -r -u /tmp/730054/qperf-0.4.6/src/rds.c qperf-0.4.6/src/rds.c
  392. --- /tmp/730054/qperf-0.4.6/src/rds.c Mon Aug 31 00:00:40 2009
  393. +++ qperf-0.4.6/src/rds.c Mon Nov 8 11:10:19 2010
  394. @@ -44,6 +44,9 @@
  395. #include <netinet/in.h>
  396. #include "qperf.h"
  397. +#if (defined(__SVR4) && defined(__sun))
  398. +#include <sys/rds.h>
  399. +#else
  400. /*
  401. * Parameters.
  402. @@ -50,6 +53,7 @@
  403. */
  404. #define AF_INET_RDS 28 /* Family for RDS */
  405. +#endif
  406. /*
  407. * Function prototypes.
  408. @@ -352,7 +356,11 @@
  409. SS sockaddr;
  410. socklen_t socklen;
  411. +#if (defined(__SVR4) && defined(__sun))
  412. + sockfd = socket(PF_RDS, SOCK_SEQPACKET, 0);
  413. +#else
  414. sockfd = socket(AF_INET_RDS, SOCK_SEQPACKET, 0);
  415. +#endif
  416. if (sockfd < 0)
  417. error(SYS, "socket failed");
  418. setsockopt_one(sockfd, SO_REUSEADDR);
  419. @@ -373,7 +381,11 @@
  420. struct sockaddr_in *sap = (struct sockaddr_in *)addr;
  421. memset(sap, 0, sizeof(*sap));
  422. +#if (defined(__SVR4) && defined(__sun))
  423. + sap->sin_family = AF_INET_OFFLOAD;
  424. +#else
  425. sap->sin_family = AF_INET;
  426. +#endif
  427. inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
  428. sap->sin_port = htons(port);
  429. *len = sizeof(struct sockaddr_in);
  430. @@ -431,6 +443,14 @@
  431. if (getsockname(fd, (SA *)&sa, &salen) < 0)
  432. error(SYS, "getsockname failed");
  433. +#if (defined(__SVR4) && defined(__sun))
  434. + /*
  435. + * getnameinfo() does not support AF_INET_OFFLOAD, so
  436. + * use ss_family as AF_INET to get port info.
  437. + */
  438. + if (sa.ss_family == AF_INET_OFFLOAD)
  439. + sa.ss_family = AF_INET;
  440. +#endif
  441. qgetnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV);
  442. port = atoi(p);
  443. if (!port)
  444. diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.h qperf-0.4.6/src/qperf.h
  445. --- /tmp/730054/qperf-0.4.6/src/qperf.h Mon Aug 31 00:00:40 2009
  446. +++ qperf-0.4.6/src/qperf.h Tue Oct 18 16:40:59 2011
  447. @@ -193,6 +193,7 @@
  448. uint32_t no_cpus; /* Number of processors */
  449. uint32_t no_ticks; /* Ticks per second */
  450. uint32_t max_cqes; /* Maximum CQ entries */
  451. + __attribute__ ((aligned (8))) /* align with 32-bit & 64-bit binary */
  452. CLOCK time_s[T_N]; /* Start times */
  453. CLOCK time_e[T_N]; /* End times */
  454. USTAT s; /* Send statistics */