forked from linux-rdma/perftest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperftest_parameters.c
More file actions
executable file
·4680 lines (4140 loc) · 156 KB
/
perftest_parameters.c
File metadata and controls
executable file
·4680 lines (4140 loc) · 156 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <limits.h>
#include <arpa/inet.h>
#if defined(__FreeBSD__)
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h>
#endif
#include "perftest_parameters.h"
#include "mlx5_devx.h"
#include "raw_ethernet_resources.h"
#include "host_memory.h"
#include "mmap_memory.h"
#include "cuda_memory.h"
#include "rocm_memory.h"
#include "neuron_memory.h"
#include "hl_memory.h"
#include "mlu_memory.h"
#include "opencl_memory.h"
#include<math.h>
#ifdef HAVE_RO
#include <stdbool.h>
#include <pci/pci.h>
#endif
#define MAC_LEN (17)
#define ETHERTYPE_LEN (6)
#define MAC_ARR_LEN (6)
#define HEX_BASE (16)
#define DEFAULT_JSON_FILE_NAME "perftest_out.json"
static const char *connStr[] = {"RC","UC","UD","RawEth","XRC","DC","SRD"};
static const char *testsStr[] = {"Send","RDMA_Write","RDMA_Write_imm","RDMA_Read","Atomic"};
static const char *portStates[] = {"Nop","Down","Init","Armed","","Active Defer"};
static const char *qp_state[] = {"OFF","ON"};
static const char *exchange_state[] = {"Ethernet","rdma_cm"};
static const char *atomicTypesStr[] = {"CMP_AND_SWAP","FETCH_AND_ADD"};
#ifdef HAVE_HNSDV
static const char *congestStr[] = {"DCQCN","LDCP","HC3","DIP"};
#endif
/******************************************************************************
* parse_mac_from_str.
*
* Description : parse string by format of"XX:XX:XX:XX:XX:XX" to uint8_t array in size 6 for MAC adderes
*
* Parameters :
* mac - char*.
* *addr - pointer to output array
*
* Return Value : SUCCESS, FAILURE.
******************************************************************************/
#if defined(__FreeBSD__)
#define strdupa(_s) \
({ \
char *_d; \
int _len; \
\
_len = strlen(_s) + 1; \
_d = alloca(_len); \
if (_d) \
memcpy(_d, _s, _len); \
_d; \
})
#endif
static int parse_mac_from_str(char *mac, u_int8_t *addr)
{
char tmpMac[MAC_LEN+1];
char *tmpField;
int fieldNum = 0;
if (strlen(mac) != MAC_LEN) {
fprintf(stderr, "invalid MAC length\n");
return FAILURE;
}
if (addr == NULL) {
fprintf(stderr, "invalid output addr array\n");
return FAILURE;
}
strcpy(tmpMac, mac);
tmpField = strtok(tmpMac, ":");
while (tmpField != NULL && fieldNum < MAC_ARR_LEN) {
char *chk;
int tmpVal;
tmpVal = strtoul(tmpField, &chk, HEX_BASE);
if (tmpVal > 0xff) {
fprintf(stderr, "field %d value %X out of range\n", fieldNum, tmpVal);
return FAILURE;
}
if (*chk != 0) {
fprintf(stderr, "Non-digit character %c (%0x) detected in field %d\n", *chk, *chk, fieldNum);
return FAILURE;
}
addr[fieldNum++] = (u_int8_t) tmpVal;
tmpField = strtok(NULL, ":");
}
if (tmpField != NULL || fieldNum != MAC_ARR_LEN) {
fprintf(stderr, "MAC address longer than six fields\n");
return FAILURE;
}
return SUCCESS;
}
static int parse_ethertype_from_str(char *ether_str, uint16_t *ethertype_val)
{
if (strlen(ether_str) != ETHERTYPE_LEN) {
fprintf(stderr, "invalid ethertype length\n");
return FAILURE;
}
*ethertype_val = strtoul(ether_str, NULL, HEX_BASE);
if (!*ethertype_val)
return FAILURE;
return SUCCESS;
}
static int parse_flow_label_from_str(struct perftest_parameters *user_param, char *flow_label_str)
{
int fl_cnt = 1;
int i;
const char* sep = NULL;
sep = strchr(flow_label_str, ',');
if (sep != NULL)
do {
fl_cnt++;
sep = strchr(sep + 1, ',');
} while (sep);
int *flow_label = calloc(fl_cnt + 2, sizeof(int));
flow_label[0] = fl_cnt;
flow_label[1] = 0;
flow_label[2] = strtol(flow_label_str, NULL, 0);
sep = strchr(flow_label_str, ',');
for (i = 3; i < fl_cnt + 2; i++) {
flow_label[i] = strtol(sep + 1, NULL, 0);
sep = strchr(sep + 1, ',');
}
if (user_param->connection_type == RawEth) {
for (i = 2; i < fl_cnt + 2; i++) {
if (flow_label[i] < 0) {
fprintf(stderr," flow label must be non-negative for RawEth\n");
return -1;
}
}
}
user_param->flow_label = flow_label;
return 0;
}
/******************************************************************************
parse_ip_from_str.
*
* Description : Convert from presentation format of an Internet number in nuffer
starting at CP to the binary network format and store result for
interface type AF in buffer starting at BUF.
*
* Parameters :
* *ip - char* ip string.
* *addr - pointer to output array
*
* Return Value : SUCCESS, FAILURE.
*
******************************************************************************/
int parse_ip_from_str(char *ip, u_int32_t *addr)
{
return inet_pton(AF_INET, ip, addr);
}
/******************************************************************************/
int parse_ip6_from_str(char *ip6, struct in6_addr *addr)
{
return inet_pton(AF_INET6, ip6, addr);
}
/******************************************************************************
check_valid_udp_port.
******************************************************************************/
int check_if_valid_udp_port(int udp_port)
{
return ON;
}
/******************************************************************************
get cache line size from system
******************************************************************************/
static int get_cache_line_size()
{
int size = 0;
#if !defined(__FreeBSD__)
size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
if (size == 0) {
#if defined(__sparc__) && defined(__arch64__)
char* file_name =
"/sys/devices/system/cpu/cpu0/l2_cache_line_size";
#else
char* file_name =
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size";
#endif
FILE *fp;
char line[10];
fp = fopen(file_name, "r");
if (fp == NULL) {
return DEF_CACHE_LINE_SIZE;
}
if(fgets(line,10,fp) != NULL) {
size = atoi(line);
}
fclose(fp);
}
#endif
// cppcheck-suppress knownConditionTrueFalse
if (size <= 0)
size = DEF_CACHE_LINE_SIZE;
return size;
}
#ifdef HAVE_RO
/******************************************************************************
Check PCIe Relaxed Ordering
Stolen from https://github.com/pciutils/pciutils/blob/master/example.c
******************************************************************************/
static bool check_pcie_relaxed_ordering_compliant(void) {
struct pci_access *pacc;
struct pci_dev *dev;
bool cpu_is_RO_compliant = true;
pacc = pci_alloc();
pci_init(pacc);
pci_scan_bus(pacc);
for (dev = pacc->devices; dev && cpu_is_RO_compliant;
dev = dev->next) {
pci_fill_info(dev,
PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS);
/* https://lore.kernel.org/patchwork/patch/820922/ */
if ((dev->vendor_id == 0x8086) &&
(((dev->device_id >= 0x6f01 && dev->device_id <= 0x6f0e) ||
(dev->device_id >= 0x2f01 && dev->device_id <= 0x2f01))))
cpu_is_RO_compliant = false;
}
pci_cleanup(pacc);
return cpu_is_RO_compliant;
}
#endif
/******************************************************************************
*
******************************************************************************/
static void usage(const char *argv0, VerbType verb, TestType tst, int connection_type)
{
printf("Usage:\n");
if (tst != FS_RATE) {
printf(" %s start a server and wait for connection\n", argv0);
printf(" %s <host> connect to server at <host>\n", argv0);
} else
printf(" %s run a server to measure FS rate \n", argv0);
printf("\n");
printf("Note: Some options must match on both server and client for consistent behavior (marked 'SYMMETRIC').\n");
printf("\n");
printf("Options:\n");
if (verb != ATOMIC && connection_type != RawEth) {
printf(" -a, --all ");
printf(" Run sizes from 2 till 2^23 (SYMMETRIC)\n");
}
if (verb == ATOMIC) {
printf(" -A, --atomic_type=<type> ");
printf(" type of atomic operation from {CMP_AND_SWAP,FETCH_AND_ADD} (default FETCH_AND_ADD) (SYMMETRIC)\n");
}
if (tst == BW) {
printf(" -b, --bidirectional ");
printf(" Measure bidirectional bandwidth (default unidirectional) (SYMMETRIC)\n");
}
if (connection_type != RawEth) {
if (verb == SEND) {
printf(" -c, --connection=<RC/XRC/UC/UD/DC/SRD> ");
printf(" Connection type RC/XRC/UC/UD/DC/SRD (default RC) (SYMMETRIC)\n");
} else if (verb == WRITE || verb == WRITE_IMM) {
printf(" -c, --connection=<RC/XRC/UC/DC> ");
printf(" Connection type RC/XRC/UC/DC (default RC) (SYMMETRIC)\n");
} else if (verb == READ || verb == ATOMIC) {
printf(" -c, --connection=<RC/XRC/DC> ");
printf(" Connection type RC/XRC/DC (default RC) (SYMMETRIC)\n");
}
#ifdef HAVE_DCS
printf(" --log_dci_streams=<log_num_dci_stream_channels> (default 0) ");
printf(" Run DC initiator as DCS instead of DCI with <log_num dci_stream_channels>\n");
printf(" --log_active_dci_streams=<log_num_active_dci_stream_channels> (default log_num_dci_stream_channels)\n");
#endif
#ifdef HAVE_AES_XTS
printf(" --aes_xts Runs traffic with AES_XTS feature (encryption)\n");
printf(" --encrypt_on_tx Runs traffic with encryption on tx (default decryption on tx)\n");
printf(" --sig_before Puts signature on data before encrypting it (default after)\n");
printf(" --aes_block_size=<512,520,4048,4096,4160> (default 512)\n");
printf(" --data_enc_keys_number=<number of data encryption keys> (default 1)\n");
printf(" --kek_path path to the key encryption key file\n");
printf(" --credentials_path path to the credentials file\n");
printf(" --data_enc_key_app_path path to the data encryption key app\n");
#endif
}
if (tst == LAT) {
printf(" -C, --report-cycles ");
printf(" report times in cpu cycle units (default microseconds)\n");
}
printf(" -d, --ib-dev=<dev> ");
printf(" Use IB device <dev> (default first device found)\n");
printf(" -D, --duration ");
printf(" Run test for a customized period of seconds. (SYMMETRIC)\n");
if (verb != WRITE && verb != WRITE_IMM && connection_type != RawEth) {
printf(" -e, --events ");
printf(" Sleep on CQ events (default poll)\n");
printf(" -X, --vector=<completion vector> ");
printf(" Set <completion vector> used for events\n");
}
printf(" -f, --margin ");
printf(" measure results within margins. (default=2sec) (SYMMETRIC)\n");
printf(" -F, --CPU-freq ");
printf(" Do not show a warning even if cpufreq_ondemand module is loaded, and cpu-freq is not on max.\n");
if (verb == SEND && tst != FS_RATE) {
printf(" -g, --mcg ");
printf(" Send messages to multicast group with 1 QP attached to it. (SYMMETRIC)\n");
printf(" When there is no multicast gid specified, a default IPv6 typed gid will be used.\n");
}
printf(" -h, --help ");
printf(" Show this help screen.\n");
if (tst == LAT || tst == LAT_BY_BW || tst == FS_RATE) {
printf(" -H, --report-histogram ");
printf(" Print out all results (default print summary only)\n");
}
printf(" -i, --ib-port=<port> ");
printf(" Use port <port> of IB device (default %d)\n",DEF_IB_PORT);
if (verb != READ && verb != ATOMIC) {
printf(" -I, --inline_size=<size> ");
printf(" Max size of message to be sent in inline\n");
}
if (tst == BW || tst == LAT_BY_BW) {
printf(" -l, --post_list=<list size>\n");
printf(" Post list of send WQEs of <list size> size (instead of single post)\n");
printf(" --recv_post_list=<list size>");
printf(" Post list of receive WQEs of <list size> size (instead of single post)\n");
}
if (tst != FS_RATE) {
printf(" -L, --hop_limit=<hop_limit> ");
printf(" Set hop limit value (ttl for IPv4 RawEth QP). Values 0-255 (default %d)\n", DEF_HOP_LIMIT);
if (connection_type == RawEth) {
printf(" -m, --mtu=<mtu> ");
printf(" MTU size : 64 - 9600 (default port mtu) (SYMMETRIC)\n");
} else {
printf(" -m, --mtu=<mtu> ");
printf(" MTU size : 256 - 4096 (default port mtu) (SYMMETRIC)\n");
}
if (verb == SEND) {
printf(" -M, --MGID=<multicast_gid> ");
printf(" In multicast, uses <multicast_gid> as the group MGID.\n");
if (tst == BW) {
printf(" --connectionless ");
printf(" Open a connectionless server instance for multicast traffic.\n");
}
}
}
printf(" -n, --iters=<iters> ");
printf(" Number of exchanges (at least %d, default %d) (SYMMETRIC)\n", MIN_ITER, ((verb == WRITE || verb == WRITE_IMM) && (tst == BW)) ? DEF_ITERS_WB : DEF_ITERS);
if (tst == BW) {
printf(" -N, --noPeak");
printf(" Cancel peak-bw calculation (default with peak up to iters=20000)\n");
}
if (verb == READ || verb == ATOMIC) {
printf(" -o, --outs=<num> ");
printf(" num of outstanding read/atom(default max of device)\n");
}
if (tst == BW && connection_type != RawEth) {
printf(" -O, --dualport ");
printf(" Run test in dual-port mode. (SYMMETRIC)\n");
}
printf(" -p, --port=<port> ");
printf(" Listen on/connect to port <port> (default %d) (SYMMETRIC)\n",DEF_PORT);
if (tst == BW ) {
printf(" -q, --qp=<num of qp's> Num of qp's(default %d) (SYMMETRIC)\n", DEF_NUM_QPS);
printf(" -Q, --cq-mod ");
printf(" Generate Cqe only after <--cq-mod> completion\n");
}
if ((verb == SEND || verb == WRITE_IMM) && tst != FS_RATE) {
printf(" -r, --rx-depth=<dep> ");
printf(" Rx queue size (default %d).",DEF_RX_SEND);
printf(" If using srq, rx-depth controls max-wr size of the srq\n");
}
if (connection_type != RawEth) {
printf(" -R, --rdma_cm ");
printf(" Connect QPs with rdma_cm and run test on those QPs\n");
}
if (verb != ATOMIC) {
printf(" -s, --size=<size> ");
printf(" Size of message to exchange (default %d) (SYMMETRIC)\n", tst == LAT ? DEF_SIZE_LAT : DEF_SIZE_BW);
}
if (tst != FS_RATE) {
printf(" -S, --sl=<sl> ");
printf(" SL (default %d)\n",DEF_SL);
if (tst == BW || tst == LAT_BY_BW) {
printf(" -t, --tx-depth=<dep> ");
printf(" Size of tx queue (default %d)\n", tst == LAT ? DEF_TX_LAT : DEF_TX_BW);
}
printf(" -T, --tos=<tos value> ");
printf(" Set <tos_value> to RDMA-CM QPs. available only with -R flag. values 0-256 (default off)\n");
}
printf(" -u, --qp-timeout=<timeout> ");
printf(" QP timeout, timeout value is 4 usec * 2 ^(timeout), default %d\n",DEF_QP_TIME);
if (tst == LAT || tst == LAT_BY_BW || tst == FS_RATE) {
printf(" -U, --report-unsorted ");
printf(" (implies -H) print out unsorted results (default sorted)\n");
}
printf(" -V, --version ");
printf(" Display version number\n");
if (tst == BW) {
printf(" -w, --limit_bw=<value> ");
printf(" Set verifier limit for bandwidth\n");
}
printf(" -W, --report-counters=<list of counter names> ");
printf(" Report performance counter change (example: \"counters/port_xmit_data,hw_counters/out_of_buffer\")\n");
if (connection_type != RawEth) {
printf(" -x, --gid-index=<index> ");
printf(" Test uses GID with GID index\n");
}
if (tst == BW) {
printf(" -y, --limit_msgrate=<value> ");
printf(" Set verifier limit for Msg Rate\n");
}
if (connection_type != RawEth) {
printf(" -z, --comm_rdma_cm ");
printf(" Communicate with rdma_cm module to exchange data - use regular QPs (SYMMETRIC)\n");
}
/*Long flags*/
putchar('\n');
printf(" --out_json ");
printf(" Save the report in a json file\n");
printf(" --out_json_file=<file> ");
printf(" Name of the report json file. (Default: %s in the working directory) \n",DEFAULT_JSON_FILE_NAME);
printf(" --cpu_util ");
printf(" Show CPU Utilization in report, valid only in Duration mode \n");
printf(" --cqe_poll ");
printf(" Number of CQEs polled per iteration \n");
#ifdef HAVE_HNSDV
printf(" --congest_type=<DCQCN, LDCP, HC3, DIP> ");
printf(" Use the hnsdv interface to set congestion control algorithm.\n");
#endif
if (tst != FS_RATE) {
printf(" --dlid ");
printf(" Set a Destination LID instead of getting it from the other side.\n");
}
if (connection_type != RawEth) {
printf(" --dont_xchg_versions ");
printf(" Do not exchange versions and MTU with other side \n");
}
if (tst != FS_RATE) {
printf(" --force-link=<value> ");
printf(" Force the link(s) to a specific type: IB or Ethernet.\n");
}
if (verb == SEND) {
printf(" --use-srq ");
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
}
#ifdef HAVE_TD_API
printf(" --no_lock ");
printf(" No lock in IO, including post send, post recv, post srq recv and poll cq \n");
#endif
#ifdef HAVE_OOO_RECV_WRS
printf(" --no_ddp ");
printf(" Disable the receiver capability to consume out-of-order WRs. (SYMMETRIC)\n");
#endif
if (connection_type != RawEth) {
printf(" --ipv6 ");
printf(" Use IPv6 GID. Default is IPv4\n");
printf(" --ipv6-addr (SYMMETRIC)");
printf(" Use IPv6 address for parameters negotiation. Default is IPv4\n");
}
// please note it is a different source_ip from raw_ethernet case
if (connection_type != RawEth) {
printf(" --bind_source_ip ");
printf(" Source IP of the interface used for connection establishment. By default taken from routing table.\n");
printf(" --ipv6-addr flag must be used when specifying an IPv6 source IP.\n");
}
if (tst == LAT) {
printf(" --latency_gap=<delay_time> ");
printf(" delay time between each post send\n");
}
if (connection_type != RawEth) {
printf(" --mmap=file ");
printf(" Use an mmap'd file as the buffer for testing P2P transfers.\n");
printf(" --mmap-offset=<offset> ");
printf(" Use an mmap'd file as the buffer for testing P2P transfers.\n");
}
if (tst == BW) {
printf(" --mr_per_qp ");
printf(" Create memory region for each qp.\n");
}
#if defined HAVE_EX_ODP
printf(" --odp ");
printf(" Use On Demand Paging instead of Memory Registration.\n");
#endif
printf(" --output=<units>");
printf(" Set verbosity output level: bandwidth , message_rate, latency \n");
if (connection_type != RawEth && !((verb == WRITE || verb == WRITE_IMM) && tst == LAT)) {
printf(" --payload_file_path=<payload_txt_file_path>");
printf(" Set the payload by passing a txt file containing a pattern in the next form(little endian): '0xaaaaaaaa,0xbbbbbbbb,...' .\n");
}
printf(" Latency measurement is Average calculation \n");
printf(" --use_old_post_send");
printf(" Use old post send flow (ibv_post_send).\n");
if (tst != FS_RATE) {
printf(" --perform_warm_up");
printf(" Perform some iterations before start measuring in order to warming-up memory cache, valid in Atomic, Read and Write BW tests\n");
printf(" --pkey_index=<pkey index> PKey index to use for QP\n");
}
if ( tst == BW ) {
printf(" --report-both ");
printf(" Report RX & TX results separately on Bidirectional BW tests\n");
printf(" --report_gbits ");
printf(" Report Max/Average BW of test in Gbit/sec (instead of MiB/sec) (SYMMETRIC)\n");
printf(" Note: MiB=2^20 byte, while Gb=10^9 bits. Use these formulas for conversion:\n");
printf(" Factor=10^9/(2^20*8)=119.2; MiB=Gb_result * factor; Gb=MiB_result / factor\n");
if (connection_type != RawEth) {
printf(" --report-per-port ");
printf(" Report BW data on both ports when running Dualport and Duration mode\n");
}
printf(" --reversed ");
printf(" Reverse traffic direction - Server send to client (SYMMETRIC)\n");
printf(" --run_infinitely ");
printf(" Run test forever, print results every <duration> seconds (SYMMETRIC)\n");
printf(" --report-min-bw=<sample iterations>\n");
printf(" Sample minimum bandwidth over X iterations\n");
}
if (connection_type != RawEth) {
printf(" --retry_count=<value> ");
printf(" Set retry count value in rdma_cm mode\n");
}
if (tst != FS_RATE) {
printf(" --tclass=<value> ");
printf(" Set the Traffic Class in GRH (if GRH is in use)\n");
if (connection_type != RawEth) {
printf(" --flow_label=<fl0,fl1,fl2,...> ");
printf(" Set the flow_label in GRH for each qp in roundrobin method(if GRH is in use)\n");
}
if (cuda_memory_supported()) {
printf(" --use_cuda=<cuda device id>");
printf(" Use CUDA specific device for GPUDirect RDMA testing\n");
printf(" --cuda_mem_type=<value>");
printf(" Set CUDA memory type <value>=0(device,default),1(managed),4(malloc)\n");
printf(" --use_cuda_bus_id=<cuda full BUS id>");
printf(" Use CUDA specific device, based on its full PCIe address, for GPUDirect RDMA testing\n");
if (cuda_memory_dmabuf_supported()) {
printf(" --use_cuda_dmabuf");
printf(" Use CUDA DMA-BUF for GPUDirect RDMA testing\n");
printf(" --use_cuda_pcie_mapping");
printf(" Use CUDA DMABUF handle mapping via PCIe BAR1\n");
if (data_direct_supported()) {
printf(" --use_data_direct");
printf(" Use Data-Direct CUDA DMA-BUF for GPUDirect RDMA testing\n");
}
}
}
if (rocm_memory_supported()) {
printf(" --use_rocm=<rocm device id>");
printf(" Use selected ROCm device for GPUDirect RDMA testing\n");
if (rocm_memory_dmabuf_supported()) {
printf(" --use_rocm_dmabuf");
printf(" Use ROCm DMA-BUF for GPUDirect RDMA testing\n");
}
}
if (neuron_memory_supported()) {
printf(" --use_neuron=<logical neuron core id>");
printf(" Use selected logical neuron core for NeuronDirect RDMA testing\n");
if (neuron_memory_dmabuf_supported()) {
printf(" --use_neuron_dmabuf");
printf(" Use DMA-BUF for HW accelerator direct RDMA testing\n");
}
}
if (hl_memory_supported()) {
printf(" --use_hl=<hl device id>");
printf(" Use selected Habana Labs device for RDMA testing\n");
}
if (mlu_memory_supported()) {
printf(" --use_mlu=<mlu device id>");
printf(" Use selected MLU device for MLUDirect RDMA testing\n");
if (mlu_memory_dmabuf_supported()) {
printf(" --use_mlu_dmabuf");
printf(" Use DMA-BUF for HW accelerator direct RDMA testing\n");
}
}
if (opencl_memory_supported()) {
printf(" --use_opencl=<opencl device id>");
printf(" Use OpenCl specific device for GPUDirect RDMA testing\n");
printf(" --opencl_platform_id=<opencl platform id>");
printf(" Use OpenCl specific platform ID\n");
}
if (cuda_memory_supported() ||
opencl_memory_supported()) {
printf(" --gpu_touch=<once\\infinite> ");
printf(" Set GPU touch mode to test memory accesses during the testing process.\n");
}
printf(" --use_hugepages ");
printf(" Use Hugepages instead of contig, memalign allocations.\n");
}
if (verb == WRITE || verb == WRITE_IMM || verb == READ) {
printf(" --use-null-mr ");
printf(" Allocate a null memory region with ibv_alloc_null_mr.\n");
}
if (tst == BW || tst == LAT_BY_BW) {
printf(" --wait_destroy=<seconds> ");
printf(" Wait <seconds> before destroying allocated resources (QP/CQ/PD/MR..)\n");
#if defined HAVE_RO
printf(" --disable_pcie_relaxed");
printf(" Disable PCIe relaxed ordering\n");
#endif
printf("\n Rate Limiter:\n");
printf(" --burst_size=<size>");
printf(" Set the amount of messages to send in a burst when using rate limiter\n");
printf(" --typical_pkt_size=<bytes>");
printf(" Set the size of packet to send in a burst. Only supports PP rate limiter\n");
printf(" --rate_limit=<rate>");
printf(" Set the maximum rate of sent packages. default unit is [Gbps]. use --rate_units to change that.\n");
printf(" --rate_units=<units>");
printf(" [Mgp] Set the units for rate limit to MiBps (M), Gbps (g) or pps (p). default is Gbps (g).\n");
printf(" Note (1): pps not supported with HW limit.\n");
printf(" Note (2): When using PP rate_units is forced to Kbps.\n");
printf(" --rate_limit_type=<type>");
printf(" [HW/SW/PP] Limit the QP's by HW, PP or by SW. Disabled by default. When rate_limit is not specified HW limit is Default.\n");
printf(" Note: in Latency under load test SW rate limit is forced\n");
}
#if defined HAVE_OOO_ATTR
printf(" --use_ooo ");
printf(" Use out of order data placement\n");
#endif
if ((tst == LAT || tst == BW) && verb == WRITE) {
printf(" --write_with_imm ");
printf(" Use write-with-immediate verb instead of write (SYMMETRIC)\n");
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
printf(" --unsolicited_write ");
printf(" Use unsolicited receive for write-with-immediate\n");
#endif
}
putchar('\n');
}
/******************************************************************************
usage
******************************************************************************/
void usage_raw_ethernet(TestType tst)
{
printf(" Raw Ethernet options :\n");
printf(" -B, --source_mac ");
printf(" source MAC address by this format XX:XX:XX:XX:XX:XX **MUST** be entered \n");
printf(" -E, --dest_mac ");
printf(" destination MAC address by this format XX:XX:XX:XX:XX:XX **MUST** be entered \n");
printf(" -G, --use_rss ");
printf(" use RSS on server side. need to open 2^x qps (using -q flag. default is -q 2). open 2^x clients that transmit to this server\n");
printf(" -J, --dest_ip ");
#ifdef HAVE_IPV6
printf(" destination ip address by this format X.X.X.X for IPv4 or X:X:X:X:X:X for IPv6 (using to send packets with IP header)\n");
#else
printf(" destination ip address by this format X.X.X.X (using to send packets with IP header)\n");
#endif
printf(" -j, --source_ip ");
#ifdef HAVE_IPV6
printf(" source ip address by this format X.X.X.X for IPv4 or X:X:X:X:X:X for IPv6 (using to send packets with IP header)\n");
#else
printf(" source ip address by this format X.X.X.X (using to send packets with IP header)\n");
#endif
printf(" -K, --dest_port ");
printf(" destination port number (using to send packets with UDP header as default, or you can use --tcp flag to send TCP Header)\n");
printf(" -k, --source_port ");
printf(" source port number (using to send packets with UDP header as default, or you can use --tcp flag to send TCP Header)\n");
printf(" -Y, --ethertype ");
printf(" ethertype value in the ethernet frame by this format 0xXXXX\n");
printf(" -Z, --server ");
printf(" choose server side for the current machine (--server/--client must be selected )\n");
printf(" --vlan_en ");
printf(" insert vlan tag in ethernet header.\n");
printf(" --vlan_pcp ");
printf(" specify vlan_pcp value for vlan tag, 0~7. 8 means different vlan_pcp for each packet\n");
if (tst != FS_RATE) {
printf(" -P, --client ");
printf(" choose client side for the current machine (--server/--client must be selected)\n");
printf(" -v, --mac_fwd ");
printf(" run mac forwarding test \n");
printf(" --flows");
printf(" set number of TCP/UDP flows, starting from <src_port, dst_port>. \n");
printf(" --flows_burst");
printf(" set number of burst size per TCP/UDP flow. \n");
printf(" --promiscuous");
printf(" run promiscuous mode.\n");
printf(" --reply_every ");
printf(" in latency test, receiver pong after number of received pings\n");
#if defined HAVE_SNIFFER
printf(" --sniffer");
printf(" run sniffer mode.\n");
#endif
printf(" --flow_label ");
printf(" IPv6 flow label\n");
}
printf(" --tcp ");
printf(" send TCP Packets. must include IP and Ports information.\n");
#ifdef HAVE_IPV6
printf(" --raw_ipv6 ");
printf(" send IPv6 Packets.\n");
#endif
if (tst == BW) {
printf(" --raw_mcast ");
printf(" send raw ethernet multicast traffic. No need to specify dest MAC address\n");
}
printf("\n");
}
/******************************************************************************
*
******************************************************************************/
static void init_perftest_params(struct perftest_parameters *user_param)
{
user_param->port = DEF_PORT;
user_param->ib_port = DEF_IB_PORT;
user_param->ib_port2 = DEF_IB_PORT2;
user_param->link_type = LINK_UNSPEC;
user_param->link_type2 = LINK_UNSPEC;
user_param->size = (user_param->tst == BW ) ? DEF_SIZE_BW : DEF_SIZE_LAT;
user_param->tx_depth = (user_param->tst == BW || user_param->tst == LAT_BY_BW ) ? DEF_TX_BW : DEF_TX_LAT;
user_param->qp_timeout = DEF_QP_TIME;
user_param->test_method = RUN_REGULAR;
user_param->cpu_freq_f = OFF;
user_param->connection_type = (user_param->connection_type == RawEth) ? RawEth : RC;
user_param->use_null_mr = 0;
user_param->use_event = OFF;
user_param->eq_num = 0;
user_param->use_eq_num = OFF;
user_param->num_of_qps = DEF_NUM_QPS;
user_param->gid_index = DEF_GID_INDEX;
user_param->gid_index2 = DEF_GID_INDEX;
user_param->use_gid_user = 0;
user_param->inline_size = DEF_INLINE;
user_param->use_mcg = OFF;
user_param->use_rdma_cm = OFF;
user_param->work_rdma_cm = OFF;
user_param->rx_depth = (user_param->verb == SEND || user_param->verb == WRITE || user_param->verb == WRITE_IMM)
? DEF_RX_SEND : DEF_RX_RDMA;
user_param->duplex = OFF;
user_param->noPeak = OFF;
user_param->req_cq_mod = 0;
user_param->req_size = 0;
user_param->cq_mod = DEF_CQ_MOD;
user_param->iters = (user_param->tst == BW && (user_param->verb == WRITE || user_param->verb == WRITE_IMM))
? DEF_ITERS_WB : DEF_ITERS;
user_param->dualport = OFF;
user_param->post_list = 1;
user_param->recv_post_list = 1;
user_param->use_srq = OFF;
user_param->use_xrc = OFF;
user_param->use_rss = OFF;
user_param->srq_exists = OFF;
user_param->duration = DEF_DURATION;
user_param->margin = DEF_INIT_MARGIN;
user_param->test_type = ITERATIONS;
user_param->state = START_STATE;
user_param->tos = DEF_TOS;
user_param->hop_limit = DEF_HOP_LIMIT;
user_param->mac_fwd = OFF;
user_param->report_fmt = MBS;
user_param->report_both = OFF;
user_param->is_reversed = OFF;
user_param->is_limit_bw = OFF;
user_param->limit_bw = 0;
user_param->is_limit_msgrate = OFF;
user_param->limit_msgrate = 0;
user_param->pkey_index = 0;
user_param->raw_qos = 0;
user_param->tcp = 0;
user_param->burst_size = 0;
user_param->typical_pkt_size = 0;
user_param->rate_limit = 0;
user_param->valid_hw_rate_limit_index = 0;
user_param->rate_units = GIGA_BIT_PS;
user_param->rate_limit_type = DISABLE_RATE_LIMIT;
user_param->is_rate_limit_type = 0;
user_param->data_enc_keys_number = 1;
user_param->log_dci_streams = 0;
user_param->log_active_dci_streams = 0;
user_param->output = -1;
user_param->memory_type = MEMORY_HOST;
user_param->memory_create = host_memory_create;
user_param->cuda_device_id = 0;
user_param->cuda_device_bus_id = NULL;
user_param->use_cuda_dmabuf = 0;
user_param->use_cuda_pcie_mapping = 0;
user_param->use_rocm_dmabuf = 0;
user_param->use_data_direct = 0;
user_param->cuda_mem_type = CUDA_MEM_DEVICE;
user_param->rocm_device_id = 0;
user_param->neuron_core_id = 0;
user_param->mlu_device_id = 0;
user_param->use_mlu_dmabuf = 0;
user_param->opencl_platform_id = 0;
user_param->opencl_device_id = 0;
user_param->gpu_touch = GPU_NO_TOUCH;
user_param->mmap_file = NULL;
user_param->mmap_offset = 0;
user_param->iters_per_port[0] = 0;
user_param->iters_per_port[1] = 0;
user_param->wait_destroy = 0;
user_param->is_old_raw_eth_param = 0;
user_param->is_new_raw_eth_param = 0;
user_param->reply_every = 1;
user_param->vlan_en = OFF;
user_param->vlan_pcp = 1;
user_param->print_eth_func = &print_ethernet_header;
user_param->report_min_bw = 0;
if (user_param->tst == LAT) {
user_param->r_flag->unsorted = OFF;
user_param->r_flag->histogram = OFF;
user_param->r_flag->cycles = OFF;
}
if (user_param->tst == FS_RATE) {
user_param->r_flag->cycles = OFF;
}
if (user_param->verb == ATOMIC) {
user_param->atomicType = FETCH_AND_ADD;
user_param->size = DEF_SIZE_ATOMIC;
}
user_param->cpu_util = 0;
user_param->out_json = 0;
user_param->out_json_file_name = strdup(DEFAULT_JSON_FILE_NAME);
user_param->cpu_util_data.enable = 0;
user_param->retry_count = DEF_RETRY_COUNT;
user_param->dont_xchg_versions = 0;
user_param->ipv6 = 0;
user_param->ai_family = AF_INET;
user_param->report_per_port = 0;
user_param->use_odp = 0;
user_param->use_hugepages = 0;
user_param->use_old_post_send = 0;
user_param->use_promiscuous = 0;
user_param->use_sniffer = 0;
user_param->check_alive_exited = 0;
user_param->raw_mcast = 0;
user_param->cache_line_size = get_cache_line_size();
user_param->cycle_buffer = sysconf(_SC_PAGESIZE);
if (user_param->cycle_buffer <= 0) {
user_param->cycle_buffer = DEF_PAGE_SIZE;
}
user_param->mr_per_qp = 0;
user_param->dlid = 0;
user_param->traffic_class = 0;
user_param->flow_label = NULL;
user_param->flows = DEF_FLOWS;
user_param->flows_burst = 1;
user_param->perform_warm_up = 0;
user_param->use_ooo = 0;
user_param->disable_pcir = 0;
user_param->source_ip = NULL;
user_param->has_source_ip = 0;
user_param->use_write_with_imm = 0;
user_param->use_unsolicited_write = 0;
user_param->congest_type = OFF;
user_param->no_lock = OFF;
user_param->use_ddp = OFF;
user_param->no_ddp = OFF;
user_param->connectionless = OFF;
user_param->cqe_poll = CTX_POLL_BATCH;
user_param->use_cqe_poll = OFF;
}