forked from juhulian/mpi-dissector
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpacket-mpi.c
2732 lines (2501 loc) · 102 KB
/
packet-mpi.c
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
/* packet-mpi.c
* Routines for Message Passing Interface (MPI) Protocol dissection
* Copyright 2015, Julian Rilli [email protected]
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <[email protected]>
* Copyright 1998 Gerald Combs
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Try to dissect the Open MPI (http://www.open-mpi.org/) protocol ;-)
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/prefs.h>
#include "packet-mpi.h"
#define MPI_DEBUG 0
/* Initialize the protocol and registered fields */
static int proto_mpi = -1;
/* Global sample preference ("controls" display of numbers) */
static gboolean pref_little_endian = TRUE;
/*
* #define MPI_TCP_PORT 1024
* static guint tcp_port_pref = MPI_TCP_PORT;
*/
#define DEFAULT_MPI_PORT_RANGE "1024-65535"
static range_t *global_mpi_tcp_port_range;
/* mpi_abort with 5 bytes */
#define MPI_MIN_LENGTH 5
/* Initialize the subtree pointers */
static gint ett_mpi = -1;
static gint ett_mpi_oob_hdr = -1;
static gint ett_mpi_oob_msg = -1;
static gint ett_mpi_base = -1;
static gint ett_mpi_common = -1;
static gint ett_mpi_common_flags = -1;
static gint ett_mpi_match = -1;
static gint ett_mpi_rndv = -1;
static gint ett_mpi_rget = -1;
static gint ett_mpi_frag = -1;
static gint ett_mpi_ack = -1;
static gint ett_mpi_rdma = -1;
static gint ett_mpi_fin = -1;
static gint ett_mpi_rndvrestartnotify = -1;
/* variables declaration */
static int hf_mpi_jobid = -1;
static int hf_mpi_vpid = -1;
static int hf_mpi_dst_vpid = -1;
static int hf_mpi_padding2 = -1;
static int hf_mpi_padding3 = -1;
static int hf_mpi_padding4 = -1;
static int hf_mpi_padding6 = -1;
static int hf_mpi_response_in = -1;
static int hf_mpi_response_to = -1;
static int hf_mpi_time = -1;
static int hf_mpi_src_req32_1 = -1;
static int hf_mpi_src_req32_2 = -1;
static int hf_mpi_src_req64 = -1;
static int hf_mpi_dst_req32_1 = -1;
static int hf_mpi_dst_req32_2 = -1;
static int hf_mpi_dst_req64 = -1;
static int hf_mpi_seg_cnt = -1;
static int hf_mpi_src_des32_1 = -1;
static int hf_mpi_src_des32_2 = -1;
static int hf_mpi_src_des64 = -1;
/* OOB header */
static int hf_mpi_oob_hdr_jobid_origin = -1;
static int hf_mpi_oob_hdr_vpid_origin = -1;
static int hf_mpi_oob_hdr_jobid_dst = -1;
static int hf_mpi_oob_hdr_vpid_dst = -1;
static int hf_mpi_oob_hdr_msg_type = -1;
static int hf_mpi_oob_hdr_rml_tag = -1;
static int hf_mpi_oob_hdr_nbytes = -1;
static int hf_mpi_oob_version = -1;
static int hf_mpi_oob_credential = -1;
static int hf_mpi_oob_data = -1;
static int hf_mpi_oob_iof_type = -1;
static int hf_mpi_oob_len = -1;
static int hf_mpi_oob_num_vals = -1;
static int hf_mpi_oob_odles_data_type = -1;
static int hf_mpi_oob_opal_data_type = -1;
static int hf_mpi_oob_orte_data_type = -1;
static int hf_mpi_oob_uri = -1;
static int hf_mpi_oob_nodename = -1;
/* BTL base header */
static int hf_mpi_base_hdr_base = -1;
static int hf_mpi_base_hdr_type = -1;
static int hf_mpi_base_hdr_count = -1;
static int hf_mpi_base_hdr_size = -1;
/* common header */
static int hf_mpi_common_hdr_type = -1;
static int hf_mpi_common_hdr_flags = -1;
static int hf_mpi_common_hdr_flags_ack = -1;
static int hf_mpi_common_hdr_flags_nbo = -1;
static int hf_mpi_common_hdr_flags_pin = -1;
static int hf_mpi_common_hdr_flags_contig = -1;
static int hf_mpi_common_hdr_flags_nordma = -1;
static int hf_mpi_common_hdr_flags_restart = -1;
/* match header */
static int hf_mpi_match_hdr_ctx = -1;
static int hf_mpi_match_hdr_src = -1;
static int hf_mpi_match_hdr_tag = -1;
static int hf_mpi_match_hdr_seq = -1;
/* rendezvous header */
static int hf_mpi_rndv_hdr_len = -1;
static int hf_mpi_rndv_hdr_restartseq = -1;
/* frag header */
static int hf_mpi_frag_hdr_frag_offset = -1;
/* ack header */
static int hf_mpi_ack_hdr_send_offset = -1;
/* rdma header */
static int hf_mpi_rdma_hdr_recv_req32_1 = -1;
static int hf_mpi_rdma_hdr_recv_req32_2 = -1;
static int hf_mpi_rdma_hdr_recv_req64 = -1;
static int hf_mpi_rdma_hdr_rdma_offset = -1;
static int hf_mpi_rdma_hdr_seg_addr32_1 = -1;
static int hf_mpi_rdma_hdr_seg_addr32_2 = -1;
static int hf_mpi_rdma_hdr_seg_addr64 = -1;
static int hf_mpi_rdma_hdr_seg_len = -1;
/* fin header */
static int hf_mpi_fin_hdr_fail = -1;
static int hf_mpi_fin_hdr_des32_1 = -1;
static int hf_mpi_fin_hdr_des32_2 = -1;
static int hf_mpi_fin_hdr_des64 = -1;
static const int *common_hdr_flags[] = {
&hf_mpi_common_hdr_flags_ack,
&hf_mpi_common_hdr_flags_nbo,
&hf_mpi_common_hdr_flags_pin,
&hf_mpi_common_hdr_flags_contig,
&hf_mpi_common_hdr_flags_nordma,
&hf_mpi_common_hdr_flags_restart,
NULL
};
static const value_string msgtypenames[] = {
{ 0, "IDENT" },
{ 1, "PROBE" },
{ 2, "PING" },
{ 3, "USER" },
{ 0, NULL }
};
/* rml_types.h */
#define ORTE_RML_TAG_INVALID 0
#define ORTE_RML_TAG_DAEMON 1
#define ORTE_RML_TAG_IOF_HNP 2
#define ORTE_RML_TAG_IOF_PROXY 3
#define ORTE_RML_TAG_XCAST_BARRIER 4
#define ORTE_RML_TAG_PLM 5
#define ORTE_RML_TAG_PLM_PROXY 6
#define ORTE_RML_TAG_ERRMGR 7
#define ORTE_RML_TAG_WIREUP 8
#define ORTE_RML_TAG_RML_INFO_UPDATE 9
#define ORTE_RML_TAG_ORTED_CALLBACK 10
#define ORTE_RML_TAG_ROLLUP 11
#define ORTE_RML_TAG_REPORT_REMOTE_LAUNCH 12
#define ORTE_RML_TAG_CKPT 13
#define ORTE_RML_TAG_RML_ROUTE 14
#define ORTE_RML_TAG_XCAST 15
#define ORTE_RML_TAG_UPDATE_ROUTE_ACK 19
#define ORTE_RML_TAG_SYNC 20
/* For FileM Base */
#define ORTE_RML_TAG_FILEM_BASE 21
#define ORTE_RML_TAG_FILEM_BASE_RESP 22
/* For FileM RSH Component */
#define ORTE_RML_TAG_FILEM_RSH 23
/* For SnapC Framework */
#define ORTE_RML_TAG_SNAPC 24
#define ORTE_RML_TAG_SNAPC_FULL 25
/* For tools */
#define ORTE_RML_TAG_TOOL 26
/* support data store/lookup */
#define ORTE_RML_TAG_DATA_SERVER 27
#define ORTE_RML_TAG_DATA_CLIENT 28
/* timing related */
#define ORTE_RML_TAG_COLLECTIVE_TIMER 29
/* collectives */
#define ORTE_RML_TAG_COLLECTIVE 30
#define ORTE_RML_TAG_COLL_ID 31
#define ORTE_RML_TAG_DAEMON_COLL 32
#define ORTE_RML_TAG_COLL_ID_REQ 33
/* show help */
#define ORTE_RML_TAG_SHOW_HELP 34
/* debugger release */
#define ORTE_RML_TAG_DEBUGGER_RELEASE 35
/* bootstrap */
#define ORTE_RML_TAG_BOOTSTRAP 36
/* report a missed msg */
#define ORTE_RML_TAG_MISSED_MSG 37
/* tag for receiving ack of abort msg */
#define ORTE_RML_TAG_ABORT 38
/* tag for receiving heartbeats */
#define ORTE_RML_TAG_HEARTBEAT 39
/* Process Migration Tool Tag */
#define ORTE_RML_TAG_MIGRATE 40
/* For SStore Framework */
#define ORTE_RML_TAG_SSTORE 41
#define ORTE_RML_TAG_SSTORE_INTERNAL 42
#define ORTE_RML_TAG_SUBSCRIBE 43
/* Notify of failed processes */
#define ORTE_RML_TAG_FAILURE_NOTICE 44
/* distributed file system */
#define ORTE_RML_TAG_DFS_CMD 45
#define ORTE_RML_TAG_DFS_DATA 46
/* sensor data */
#define ORTE_RML_TAG_SENSOR_DATA 47
/* direct modex support */
#define ORTE_RML_TAG_DIRECT_MODEX 48
#define ORTE_RML_TAG_DIRECT_MODEX_RESP 49
#define ORTE_RML_TAG_MAX 100
static const value_string rmltagnames[] = {
{ ORTE_RML_TAG_INVALID, "Invalid" },
{ ORTE_RML_TAG_DAEMON, "Daemon" },
{ ORTE_RML_TAG_IOF_HNP, "IOF HNP" },
{ ORTE_RML_TAG_IOF_PROXY, "IOF Proxy" },
{ ORTE_RML_TAG_XCAST_BARRIER, "XCAST Barrier" },
{ ORTE_RML_TAG_PLM, "PLM" },
{ ORTE_RML_TAG_PLM_PROXY, "PLM Proxy" },
{ ORTE_RML_TAG_ERRMGR, "Error Message" },
{ ORTE_RML_TAG_WIREUP, "Wireup" },
{ ORTE_RML_TAG_RML_INFO_UPDATE, "RML Info Update" },
{ ORTE_RML_TAG_ORTED_CALLBACK, "ORTED Callback" },
{ ORTE_RML_TAG_ROLLUP, "Rollup" },
{ ORTE_RML_TAG_REPORT_REMOTE_LAUNCH, "Report Remote Launch" },
{ ORTE_RML_TAG_CKPT, "CKPT" },
{ ORTE_RML_TAG_RML_ROUTE, "RML Route" },
{ ORTE_RML_TAG_XCAST, "XCAST" },
{ ORTE_RML_TAG_UPDATE_ROUTE_ACK, "Update Route ACK" },
{ ORTE_RML_TAG_SYNC, "SYNC" },
{ ORTE_RML_TAG_FILEM_BASE, "FileM Base" },
{ ORTE_RML_TAG_FILEM_BASE_RESP, "FileM Base Response" },
{ ORTE_RML_TAG_FILEM_RSH, "FileM RSH" },
{ ORTE_RML_TAG_SNAPC, "SNAPC" },
{ ORTE_RML_TAG_SNAPC_FULL, "SNAPC Full" },
{ ORTE_RML_TAG_TOOL, "Tool" },
{ ORTE_RML_TAG_DATA_SERVER, "Data Server" },
{ ORTE_RML_TAG_DATA_CLIENT, "Data Client" },
{ ORTE_RML_TAG_COLLECTIVE_TIMER, "Collective Timer" },
{ ORTE_RML_TAG_COLLECTIVE, "Collective" },
{ ORTE_RML_TAG_COLL_ID, "Collective ID" },
{ ORTE_RML_TAG_DAEMON_COLL, "Daemon Collective" },
{ ORTE_RML_TAG_COLL_ID_REQ, "Collective ID Request" },
{ ORTE_RML_TAG_SHOW_HELP, "Show Help" },
{ ORTE_RML_TAG_DEBUGGER_RELEASE, "Debugg Release" },
{ ORTE_RML_TAG_BOOTSTRAP, "Bootstrap" },
{ ORTE_RML_TAG_MISSED_MSG, "Missed Message" },
{ ORTE_RML_TAG_ABORT, "Abort" },
{ ORTE_RML_TAG_HEARTBEAT, "Heatbeat" },
{ ORTE_RML_TAG_MIGRATE, "Migrate" },
{ ORTE_RML_TAG_SSTORE, "SStore" },
{ ORTE_RML_TAG_SSTORE_INTERNAL, "SStore Internal" },
{ ORTE_RML_TAG_SUBSCRIBE, "Subscribe" },
{ ORTE_RML_TAG_FAILURE_NOTICE, "Failure Notice" },
{ ORTE_RML_TAG_DFS_CMD, "DFS Command "},
{ ORTE_RML_TAG_DFS_DATA, "DFS Data" },
{ ORTE_RML_TAG_SENSOR_DATA, "Sensor Data" },
{ ORTE_RML_TAG_DIRECT_MODEX, "Direct Modex" },
{ ORTE_RML_TAG_DIRECT_MODEX_RESP, "Direct Modex Response" },
{ ORTE_RML_TAG_MAX, "MAX Tag" },
{ 0, NULL }
};
/* pml_ob1_hdr.h pml_bfo_hdr.h */
#define MPI_PML_OB1_HDR_TYPE_MATCH 65
#define MPI_PML_BFO_HDR_TYPE_RNDV 66
#define MPI_PML_OB1_HDR_TYPE_RGET 67
#define MPI_PML_OB1_HDR_TYPE_ACK 68
#define MPI_PML_OB1_HDR_TYPE_NACK 69
#define MPI_PML_OB1_HDR_TYPE_FRAG 70
#define MPI_PML_OB1_HDR_TYPE_GET 71
#define MPI_PML_OB1_HDR_TYPE_PUT 72
#define MPI_PML_OB1_HDR_TYPE_FIN 73
#define MPI_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY 74
#define MPI_PML_BFO_HDR_TYPE_RNDVRESTARTACK 75
#define MPI_PML_BFO_HDR_TYPE_RNDVRESTARTNACK 76
#define MPI_PML_BFO_HDR_TYPE_RECVERRNOTIFY 77
static const value_string packetbasenames[] = {
{ MPI_PML_OB1_HDR_TYPE_MATCH, "MATCH" },
{ MPI_PML_BFO_HDR_TYPE_RNDV, "RNDV" },
{ MPI_PML_OB1_HDR_TYPE_RGET, "RGET" },
{ MPI_PML_OB1_HDR_TYPE_ACK, "ACK" },
{ MPI_PML_OB1_HDR_TYPE_NACK, "NACK" },
{ MPI_PML_OB1_HDR_TYPE_FRAG, "FRAG" },
{ MPI_PML_OB1_HDR_TYPE_GET, "GET" },
{ MPI_PML_OB1_HDR_TYPE_PUT, "PUT" },
{ MPI_PML_OB1_HDR_TYPE_FIN, "FIN" },
{ MPI_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY, "RNDVRESTARTNOTIFY" },
{ MPI_PML_BFO_HDR_TYPE_RNDVRESTARTACK, "RNDVRESTARTACK" },
{ MPI_PML_BFO_HDR_TYPE_RNDVRESTARTNACK, "RNDVRESTARTNACK" },
{ MPI_PML_BFO_HDR_TYPE_RECVERRNOTIFY, "RECVERRNOTIFY" },
{ 0, NULL }
};
static const value_string packettypenames[] = {
{ 1, "Send" },
{ 2, "Put" },
{ 3, "Get" },
{ 0, NULL }
};
static const value_string communicatornames[] = {
{ 0, "MPI_COMM_WORLD" },
{ 1, "MPI_COMM_SELF" },
{ 2, "MPI_COMM_NULL" },
{ 3, "MPI_GROUP" },
{ 0, NULL }
};
/* coll_tags.h */
static const value_string colltagnames[] = {
{ -10, "Allgather" },
{ -11, "Allgetherv" },
{ -12, "AllReduce" },
{ -13, "Alltoall" },
{ -14, "Alltoallv" },
{ -15, "Alltoallw" },
{ -16, "Barrier" },
{ -17, "Bcast" },
{ -18, "Exscan" },
{ -19, "Gather" },
{ -20, "Gatherv" },
{ -21, "Reduce" },
{ -22, "Reduce_scatter" },
{ -23, "Scan" },
{ -24, "Scatter" },
{ -25, "Scatterv" },
{ -26, "Nonblocking_base" },
{ -32767, "Nonblocking_end" }, /* ((-1 * INT_MAX/2) + 1) */
{ -32768, "Hcoll_base" }, /* (-1 * INT_MAX/2) */
{ -65535, "Hcoll_end" }, /* (-1 * INT_MAX) */
{ 0, NULL }
};
static const value_string paddingnames[] = {
{ 0, "heterogeneous support (maybe wrong!!)" },
{ 0, NULL }
};
/* iof_types.h */
#define ORTE_IOF_STDIN 0x01
#define ORTE_IOF_STDOUT 0x02
#define ORTE_IOF_STDERR 0x04
#define ORTE_IOF_STDDIAG 0x08
#define ORTE_IOF_STDOUTALL 0x0e
static const value_string ioftypenames[] = {
{ ORTE_IOF_STDIN, "STDIN" },
{ ORTE_IOF_STDOUT, "STDOUT" },
{ ORTE_IOF_STDERR, "STDERR" },
{ ORTE_IOF_STDDIAG, "STDDIAG" },
{ ORTE_IOF_STDOUTALL, "STDOUTALL" },
{ 0, NULL }
};
static const value_string opaldatatypenames[] = {
{ 0, "OPAL_UNDEF" },
{ 1, "OPAL_BYTE" },
{ 2, "OPAL_BOOL" },
{ 3, "OPAL_STRING" },
{ 4, "OPAL_SIZE" },
{ 5, "OPAL_PID" },
{ 6, "OPAL_INT" },
{ 7, "OPAL_INT8" },
{ 8, "OPAL_INT16" },
{ 9, "OPAL_INT32" },
{ 10, "OPAL_INT64" },
{ 11, "OPAL_UINT" },
{ 12, "OPAL_UINT8" },
{ 13, "OPAL_UINT16" },
{ 14, "OPAL_UINT32" },
{ 15, "OPAL_UINT64" },
{ 16, "OPAL_FLOAT" },
{ 17, "OPAL_TIMEVAL" },
{ 18, "OPAL_BYTE_OBJECT" },
{ 19, "OPAL_DATA_TYPE" },
{ 20, "OPAL_NULL" },
{ 21, "OPAL_PSTAT" },
{ 22, "OPAL_NODE_STAT" },
{ 23, "OPAL_HWLOC_TOPO" },
{ 24, "OPAL_VALUE" },
{ 25, "OPAL_BUFFER" },
{ 30, "OPAL_DSS_ID_DYNAMIC" },
{ 0, NULL }
};
static const value_string ortedatatypenames[] = {
{ 31, "ORTE_STD_CNTR" },
{ 32, "ORTE_NAME" },
{ 33, "ORTE_VPID" },
{ 34, "ORTE_JOBID" },
{ 35, "undefine?" },
{ 36, "ORTE_NODE_STATE" },
{ 37, "ORTE_PROC_STATE" },
{ 38, "ORTE_JOB_STATE" },
{ 39, "ORTE_EXIT_CODE" },
{ 40, "ORTE_VALUE" },
{ 41, "ORTE_APP_CONTEXT" },
{ 42, "ORTE_NODE_DESC" },
{ 43, "ORTE_SLOT_DESC" },
{ 44, "ORTE_JOB" },
{ 45, "ORTE_NODE" },
{ 46, "ORTE_PROC" },
{ 47, "ORTE_JOB_MAP" },
{ 48, "ORTE_RML_TAG" },
{ 49, "ORTE_DAEMON_CMD" },
{ 50, "ORTE_IOF_TAG" },
{ 80, "ORTE_DSS_ID_DYNAMIC" },
{ 0, NULL }
};
/* odls_types.h */
#define ORTE_DAEMON_CONTACT_QUERY_CMD 1
#define ORTE_DAEMON_KILL_LOCAL_PROCS 2
#define ORTE_DAEMON_SIGNAL_LOCAL_PROCS 3
#define ORTE_DAEMON_ADD_LOCAL_PROCS 4
#define ORTE_DAEMON_TREE_SPAWN 5
#define ORTE_DAEMON_HEARTBEAT_CMD 6
#define ORTE_DAEMON_EXIT_CMD 7
#define ORTE_DAEMON_PROCESS_AND_RELAY_CMD 9
#define ORTE_DAEMON_MESSAGE_LOCAL_PROCS 10
#define ORTE_DAEMON_NULL_CMD 11
#define ORTE_DAEMON_SYNC_BY_PROC 12
#define ORTE_DAEMON_SYNC_WANT_NIDMAP 13
/* commands for use by tools */
#define ORTE_DAEMON_REPORT_JOB_INFO_CMD 14
#define ORTE_DAEMON_REPORT_NODE_INFO_CMD 15
#define ORTE_DAEMON_REPORT_PROC_INFO_CMD 16
#define ORTE_DAEMON_SPAWN_JOB_CMD 17
#define ORTE_DAEMON_TERMINATE_JOB_CMD 18
#define ORTE_DAEMON_HALT_VM_CMD 19
/* request proc resource usage */
#define ORTE_DAEMON_TOP_CMD 22
/* bootstrap */
#define ORTE_DAEMON_NAME_REQ_CMD 23
#define ORTE_DAEMON_CHECKIN_CMD 24
#define ORTE_TOOL_CHECKIN_CMD 25
/* process msg command */
#define ORTE_DAEMON_PROCESS_CMD 26
/* process called "errmgr.abort_procs" */
#define ORTE_DAEMON_ABORT_PROCS_CALLED 28
static const value_string odlesdatatypenames[] = {
{ ORTE_DAEMON_CONTACT_QUERY_CMD, "Contact Query CMD" },
{ ORTE_DAEMON_KILL_LOCAL_PROCS, "Kill Local Procs" },
{ ORTE_DAEMON_SIGNAL_LOCAL_PROCS, "Signal Local Procs" },
{ ORTE_DAEMON_ADD_LOCAL_PROCS, "Add Local Procs" },
{ ORTE_DAEMON_TREE_SPAWN, "Tree Spawn" },
{ ORTE_DAEMON_HEARTBEAT_CMD, "Heartbeat CMD" },
{ ORTE_DAEMON_EXIT_CMD, "Exit CMD" },
{ ORTE_DAEMON_PROCESS_AND_RELAY_CMD, "Process and Relay CMD" },
{ ORTE_DAEMON_MESSAGE_LOCAL_PROCS, "Message Local Procs" },
{ ORTE_DAEMON_NULL_CMD, "Null CMD" },
{ ORTE_DAEMON_SYNC_BY_PROC, "SYNC by Proc" },
{ ORTE_DAEMON_SYNC_WANT_NIDMAP, "SYNC Want NIDMAP" },
{ ORTE_DAEMON_REPORT_JOB_INFO_CMD, "Report Job Info CMD" },
{ ORTE_DAEMON_REPORT_NODE_INFO_CMD, "Report Node Info CMD" },
{ ORTE_DAEMON_REPORT_PROC_INFO_CMD, "Report Proc Info CMD" },
{ ORTE_DAEMON_SPAWN_JOB_CMD, "Spawn Job CMD" },
{ ORTE_DAEMON_TERMINATE_JOB_CMD, "Terminate Job CMD" },
{ ORTE_DAEMON_HALT_VM_CMD, "Halt VM CMD" },
{ ORTE_DAEMON_TOP_CMD, "Top CMD" },
{ ORTE_DAEMON_NAME_REQ_CMD, "Name REQ CMD" },
{ ORTE_DAEMON_CHECKIN_CMD, "Checkin CMD" },
{ ORTE_TOOL_CHECKIN_CMD, "Tool Checkin CMD" },
{ ORTE_DAEMON_PROCESS_CMD, "Process CMD" },
{ ORTE_DAEMON_ABORT_PROCS_CALLED, "Abort Procs Called" },
{ 0, NULL }
};
typedef struct _mpi_info_t {
wmem_tree_t *pdus;
} mpi_info_t;
typedef struct _mpi_sync_trans_t {
guint32 jobid;
guint32 vpid;
guint32 req_frame;
guint32 rep_frame;
nstime_t req_time;
} mpi_sync_trans_t;
typedef struct _mpi_oob_trans_t {
guint32 rml_tag_1;
guint32 nbytes_1;
guint32 rml_tag_2;
guint32 nbytes_2;
GHashTable *old;
} mpi_oob_trans_t;
typedef struct _mpi_oob_old_t {
guint32 rml_tag;
guint32 nbytes;
} mpi_oob_old_t;
/* data handler */
/* static dissector_handle_t data_handle; */
/* static dissector_handle_t mpi_sync_handler; */
static guint
address_hash_func(gconstpointer v)
{
return GPOINTER_TO_UINT(v);
}
static gint
address_equal_func(gconstpointer v, gconstpointer v2)
{
return v == v2;
}
static int
dissect_mpi_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint the_offset)
{
guint32 jobid;
guint32 vpid;
proto_item *ti = NULL;
proto_tree *mpi_tree = NULL;
conversation_t *conversation;
mpi_info_t *mpi_info;
mpi_sync_trans_t *mpi_sync_trans;
gboolean is_request;
wmem_tree_key_t key[3];
if (8 != tvb_captured_length(tvb) - the_offset) {
return the_offset;
}
if (MPI_DEBUG)
g_print("%d dissect_mpi_sync, reported_length: %d offset: %d, tree: %s\n",
pinfo->fd->num, tvb_reported_length(tvb), the_offset,
tree ? "true":"false");
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPI");
/* Network-to-host-order accessors for 32-bit integers (guint32) */
jobid = tvb_get_ntohl(tvb, 0);
vpid = tvb_get_ntohl(tvb, 4);
/* create or get conversation */
conversation = find_or_create_conversation(pinfo);
/* get conversation data */
mpi_info = (mpi_info_t *)
conversation_get_proto_data(conversation, proto_mpi);
/* create conversation data if this not exist */
if (!mpi_info) {
mpi_info = wmem_new(wmem_file_scope(), mpi_info_t);
mpi_info->pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_mpi, mpi_info);
is_request = TRUE; /* determine the request temporairily */
} else {
is_request = FALSE;
}
key[0].length = 1;
key[0].key = &jobid;
key[1].length = 1;
key[1].key = &pinfo->fd->num;
key[2].length = 0;
key[2].key = NULL;
/* fill the mpi_sync_trans struct only the first time */
if (!pinfo->fd->flags.visited) {
if (is_request) {
mpi_sync_trans = wmem_new(wmem_file_scope(), mpi_sync_trans_t);
mpi_sync_trans->jobid = jobid;
mpi_sync_trans->vpid = vpid;
mpi_sync_trans->req_frame = pinfo->fd->num;
mpi_sync_trans->rep_frame = 0;
mpi_sync_trans->req_time = pinfo->fd->abs_ts;
wmem_tree_insert32_array(mpi_info->pdus, key,
(void *)mpi_sync_trans);
} else {
mpi_sync_trans = (mpi_sync_trans_t *)
wmem_tree_lookup32_array_le(mpi_info->pdus, key);
if (mpi_sync_trans) {
if (mpi_sync_trans->jobid != jobid) {
mpi_sync_trans = NULL;
} else {
mpi_sync_trans->rep_frame = pinfo->fd->num;
}
}
}
} else {
mpi_sync_trans = (mpi_sync_trans_t *)
wmem_tree_lookup32_array_le(mpi_info->pdus, key);
if (mpi_sync_trans) {
if (mpi_sync_trans->jobid != jobid) {
mpi_sync_trans = NULL;
/* redetermine the request, because the dissector is called a few times... */
} else if (mpi_sync_trans->vpid != vpid) {
is_request = FALSE;
} else {
is_request = TRUE;
}
}
}
if (!mpi_sync_trans) {
/* create a "fake" mpi_sync_trans structure */
mpi_sync_trans = wmem_new(wmem_packet_scope(), mpi_sync_trans_t);
mpi_sync_trans->req_frame = 0;
mpi_sync_trans->rep_frame = 0;
mpi_sync_trans->req_time = pinfo->fd->abs_ts;
}
/* \xe2\x86\x92 UTF8_RIGHTWARDS_ARROW */
col_add_fstr(pinfo->cinfo, COL_INFO, "%d\xe2\x86\x92%d [SYNC] Jobid=%d Vpid=%d (%s)",
pinfo->srcport, pinfo->destport,
jobid, vpid, (is_request ? "Request":"Response"));
if (tree) {
/* add the new tree node, from 0 to the end (-1) of this data
* ENC_NA ("not applicable") is specified as the "encoding" parameter
*/
/* ti = proto_tree_add_item(tree, proto_mpi, tvb, 0, -1, ENC_NA); */
ti = proto_tree_add_protocol_format(tree, proto_mpi, tvb, 0, -1,
"Message Passing Interface Protocol: Synchronization %s",
is_request ? "Request":"Response");
/* added a child node to the protocol tree
* which is where we will do our detail dissection
*/
mpi_tree = proto_item_add_subtree(ti, ett_mpi);
}
/* print in the tree */
if (is_request) {
if (mpi_sync_trans->rep_frame) {
proto_item *it;
it = proto_tree_add_uint(mpi_tree, hf_mpi_response_in, tvb, 0, 0,
mpi_sync_trans->rep_frame);
PROTO_ITEM_SET_GENERATED(it);
}
} else {
if (mpi_sync_trans->req_frame) {
proto_item *it;
nstime_t ns;
it = proto_tree_add_uint(mpi_tree, hf_mpi_response_to, tvb, 0, 0,
mpi_sync_trans->req_frame);
PROTO_ITEM_SET_GENERATED(it);
nstime_delta(&ns, &pinfo->fd->abs_ts, &mpi_sync_trans->req_time);
it = proto_tree_add_time(mpi_tree, hf_mpi_time, tvb, 0, 0, &ns);
PROTO_ITEM_SET_GENERATED(it);
}
}
if (tree) {
proto_tree_add_item(mpi_tree, hf_mpi_jobid, tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(mpi_tree, hf_mpi_vpid, tvb, 4, 4, ENC_BIG_ENDIAN);
}
return tvb_captured_length(tvb);
}
static int
dissect_mpi_oop_opal_string(tvbuff_t *tvb, proto_tree *tree, guint offset, gboolean debug)
{
if (debug) {
proto_tree_add_item(tree, hf_mpi_oob_opal_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_oob_num_vals,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_oob_opal_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_oob_len,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else {
proto_tree_add_item(tree, hf_mpi_oob_num_vals,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_oob_len,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
return offset;
}
static int
dissect_mpi_oob_name(tvbuff_t *tvb, proto_tree *tree, guint offset, gboolean debug)
{
if (debug) {
proto_tree_add_item(tree, hf_mpi_oob_opal_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_oob_num_vals,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_oob_orte_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_oob_opal_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_jobid, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_oob_opal_data_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_mpi_vpid, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else {
proto_tree_add_item(tree, hf_mpi_oob_num_vals,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_jobid, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_mpi_vpid, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
return offset;
}
static int
dissect_mpi_oob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint the_offset)
{
proto_item *ti = NULL;
proto_tree *mpi_tree = NULL;
proto_tree *mpi_oob_tree = NULL;
conversation_t *conversation;
void *conv_data;
mpi_oob_trans_t *mpi_oob_trans;
guint offset;
guint32 jobid_origin;
guint32 vpid_origin;
guint32 jobid_dst;
guint32 vpid_dst;
guint32 msg_type;
guint32 rml_tag;
guint32 nbytes;
mpi_oob_old_t *value = NULL;
/* invalid */
int vers_len;
int cred_len;
const guint8 *version;
const guint8 *credential;
/* iof */
guint8 fully_des;
guint8 iof_type;
guint32 jobid;
guint32 vpid;
/* orte callback */
int uri_len;
int nodename_len;
const guint8 *uri;
const guint8 *nodename;
guint32 hwloc_len;
/* xcast */
guint8 odles;
offset = 0;
if (!(32768 <= pinfo->srcport && MAX_TCP_PORT >= pinfo->srcport &&
32768 <= pinfo->destport && MAX_TCP_PORT >= pinfo->destport)) {
return the_offset;
}
if (MPI_DEBUG)
g_print("%d dissect_mpi_oob, reported_length: %d, offset: %d, tree: %s\n",
pinfo->fd->num, tvb_reported_length(tvb), the_offset,
tree ? "true":"false");
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPI");
col_clear(pinfo->cinfo,COL_INFO);
col_add_fstr(pinfo->cinfo, COL_INFO, "%d\xe2\x86\x92%d [OOB]",
pinfo->srcport, pinfo->destport);
if (tree) {
ti = proto_tree_add_item(tree, proto_mpi, tvb, 0, -1, ENC_NA);
mpi_tree = proto_item_add_subtree(ti, ett_mpi);
}
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (!conversation) {
conversation = conversation_new(pinfo->fd->num, &pinfo->src,
&pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
conv_data = conversation_get_proto_data(conversation, proto_mpi);
if (conv_data) {
mpi_oob_trans = (mpi_oob_trans_t *)conv_data;
} else {
if (28 > tvb_captured_length(tvb) - the_offset) {
g_print("%d start new conversation without a header?\n",
pinfo->fd->num);
return the_offset;
}
mpi_oob_trans = (mpi_oob_trans_t *)
wmem_alloc0(wmem_file_scope(), sizeof(mpi_oob_trans_t));
mpi_oob_trans->rml_tag_1 = 0;
mpi_oob_trans->nbytes_1 = 0;
mpi_oob_trans->rml_tag_2 = 0;
mpi_oob_trans->nbytes_2 = 0;
mpi_oob_trans->old = g_hash_table_new(address_hash_func,
address_equal_func);
conversation_add_proto_data(conversation, proto_mpi,
(void *)mpi_oob_trans);
}
value = (mpi_oob_old_t *)
g_hash_table_lookup(mpi_oob_trans->old, &pinfo->fd->num);
if (NULL == value) {
value = (mpi_oob_old_t *)
wmem_alloc0(wmem_file_scope(), sizeof(mpi_oob_old_t));
value->rml_tag = 0;
value->nbytes = 0;
g_hash_table_insert(mpi_oob_trans->old, &pinfo->fd->num, value);
}
/* (re)store the old values */
if (pinfo->fd->flags.visited) {
if (pinfo->srcport > pinfo->destport) {
mpi_oob_trans->rml_tag_1 = value->rml_tag;
mpi_oob_trans->nbytes_1 = value->nbytes;
} else {
mpi_oob_trans->rml_tag_2 = value->rml_tag;
mpi_oob_trans->nbytes_2 = value->nbytes;
}
/* g_print("%d reload rml_tag: %d, nbytes: %d\n", pinfo->fd->num, value->rml_tag, value->nbytes); */
} else {
if (pinfo->srcport > pinfo->destport) {
value->rml_tag = mpi_oob_trans->rml_tag_1;
value->nbytes = mpi_oob_trans->nbytes_1;
} else {
value->rml_tag = mpi_oob_trans->rml_tag_2;
value->nbytes = mpi_oob_trans->nbytes_2;
}
/* g_print("%d store rml_tag: %d, nbytes: %d\n", pinfo->fd->num, value->rml_tag, value->nbytes); */
}
while (tvb_captured_length(tvb) > the_offset) {
offset = the_offset;
if (pinfo->srcport > pinfo->destport) {
nbytes = mpi_oob_trans->nbytes_1;
rml_tag = mpi_oob_trans->rml_tag_1;
} else {
nbytes = mpi_oob_trans->nbytes_2;
rml_tag = mpi_oob_trans->rml_tag_2;
}
if (0 == nbytes){ /* header */
if (28 > tvb_captured_length(tvb) - offset) {
return offset;
}
jobid_origin = tvb_get_ntohl(tvb, offset);
offset += 4;
vpid_origin = tvb_get_ntohl(tvb, offset);
offset += 4;
jobid_dst = tvb_get_ntohl(tvb, offset);
offset += 4;
vpid_dst = tvb_get_ntohl(tvb, offset);
offset += 4;
msg_type = tvb_get_ntohl(tvb, offset);
offset += 4;
rml_tag = tvb_get_ntohl(tvb, offset);
offset += 4;
nbytes = tvb_get_ntohl(tvb, offset);
offset += 4;
col_append_fstr(pinfo->cinfo, COL_INFO, " Header: "
"Jobid-Origin=%d Vpid-Origin=%d Jobid-Dst=%d Vpid-Dst=%d "
"Type=%s Tag=%s Length=%d",
jobid_origin, vpid_origin, jobid_dst, vpid_dst,
val_to_str(msg_type, msgtypenames, "%d"),
val_to_str(rml_tag, rmltagnames, "%d"), nbytes);
if (tree) {
offset = the_offset; //reset offset
mpi_oob_tree = proto_tree_add_subtree(mpi_tree, tvb, 0, 0,
ett_mpi_oob_hdr, &ti, "OOB Header: ");
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_jobid_origin, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_vpid_origin, tvb,
offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_jobid_dst, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_vpid_dst, tvb,
offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_msg_type, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_rml_tag, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(mpi_oob_tree, hf_mpi_oob_hdr_nbytes, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_item_append_text(ti,
"jobid_origin: %d, vpid_origin: %d, "
"jobid_dst: %d, vpid_dst: %d, "
"type: %s, tag: %s, length: %d",
jobid_origin, vpid_origin, jobid_dst, vpid_dst,
val_to_str(msg_type, msgtypenames, "%d"),
val_to_str(rml_tag, rmltagnames, "%d"), nbytes);
}
if (pinfo->srcport > pinfo->destport) {
mpi_oob_trans->rml_tag_1 = rml_tag;
mpi_oob_trans->nbytes_1 = nbytes;
} else {
mpi_oob_trans->rml_tag_2 = rml_tag;
mpi_oob_trans->nbytes_2 = nbytes;
}
the_offset = offset;
} else { /* message */
if (tvb_captured_length(tvb) - offset < nbytes) {
if (pinfo->srcport > pinfo->destport) {
mpi_oob_trans->nbytes_1 = nbytes -
(tvb_captured_length(tvb) - offset);
} else {
mpi_oob_trans->nbytes_2 = nbytes -
(tvb_captured_length(tvb) - offset);
}
nbytes = tvb_captured_length(tvb) - offset;
} else {
if (pinfo->srcport > pinfo->destport) {
mpi_oob_trans->nbytes_1 = 0;
} else {
mpi_oob_trans->nbytes_2 = 0;
}
}
col_append_fstr(pinfo->cinfo, COL_INFO, " Message: RML-Tag=%s",
val_to_str(rml_tag, rmltagnames, "%d"));
if (tree) {
mpi_oob_tree = proto_tree_add_subtree(mpi_tree, tvb, 0, 0,
ett_mpi_oob_msg, &ti, "OOB Message: ");
proto_item_append_text(ti, "rml-tag: %s (%d)",
val_to_str(rml_tag, rmltagnames, "%d"), rml_tag);
}
if (MPI_DEBUG)
g_print("%d dissect_mpi_oob_msg, rml_tag: %s (%d), offset: %d, "
"tree: %s\n",
pinfo->fd->num, val_to_str(rml_tag, rmltagnames, "%d"),
rml_tag, offset, tree ? "true":"false");