Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-opa.c
bloba76b4dd79e0c5e0c3eab8d9b45829b14218cf31e
1 /* packet-opa.c
2 * Routines for Omni-Path 9B L2, L4, and extended L4 header dissection
3 * Copyright (c) 2016, Intel Corporation.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/tfs.h>
16 #include <wsutil/array.h>
17 #include <wiretap/erf_record.h>
19 void proto_reg_handoff_opa_9b(void);
20 void proto_register_opa_9b(void);
22 /* OpCodeValues
23 * Code Bits [7-5] Connection Type
24 * [4-0] Message Type
25 * Reliable Connection (RC) [7-5] = 000 */
26 #define RC_SEND_FIRST 0 /*0x00000000 */
27 #define RC_SEND_MIDDLE 1 /*0x00000001 */
28 #define RC_SEND_LAST 2 /*0x00000010 */
29 #define RC_SEND_LAST_IMM 3 /*0x00000011 */
30 #define RC_SEND_ONLY 4 /*0x00000100 */
31 #define RC_SEND_ONLY_IMM 5 /*0x00000101 */
32 #define RC_RDMA_WRITE_FIRST 6 /*0x00000110 */
33 #define RC_RDMA_WRITE_MIDDLE 7 /*0x00000111 */
34 #define RC_RDMA_WRITE_LAST 8 /*0x00001000 */
35 #define RC_RDMA_WRITE_LAST_IMM 9 /*0x00001001 */
36 #define RC_RDMA_WRITE_ONLY 10 /*0x00001010 */
37 #define RC_RDMA_WRITE_ONLY_IMM 11 /*0x00001011 */
38 #define RC_RDMA_READ_REQUEST 12 /*0x00001100 */
39 #define RC_RDMA_READ_RESPONSE_FIRST 13 /*0x00001101 */
40 #define RC_RDMA_READ_RESPONSE_MIDDLE 14 /*0x00001110 */
41 #define RC_RDMA_READ_RESPONSE_LAST 15 /*0x00001111 */
42 #define RC_RDMA_READ_RESPONSE_ONLY 16 /*0x00010000 */
43 #define RC_ACKNOWLEDGE 17 /*0x00010001 */
44 #define RC_ATOMIC_ACKNOWLEDGE 18 /*0x00010010 */
45 #define RC_CMP_SWAP 19 /*0x00010011 */
46 #define RC_FETCH_ADD 20 /*0x00010100 */
47 #define RC_SEND_LAST_INVAL 22 /*0x00010110 */
48 #define RC_SEND_ONLY_INVAL 23 /*0x00010111 */
49 /* Reliable Datagram (RD) [7-5] = 010 */
50 #define RD_SEND_FIRST 64 /*0x01000000 */
51 #define RD_SEND_MIDDLE 65 /*0x01000001 */
52 #define RD_SEND_LAST 66 /*0x01000010 */
53 #define RD_SEND_LAST_IMM 67 /*0x01000011 */
54 #define RD_SEND_ONLY 68 /*0x01000100 */
55 #define RD_SEND_ONLY_IMM 69 /*0x01000101 */
56 #define RD_RDMA_WRITE_FIRST 70 /*0x01000110 */
57 #define RD_RDMA_WRITE_MIDDLE 71 /*0x01000111 */
58 #define RD_RDMA_WRITE_LAST 72 /*0x01001000 */
59 #define RD_RDMA_WRITE_LAST_IMM 73 /*0x01001001 */
60 #define RD_RDMA_WRITE_ONLY 74 /*0x01001010 */
61 #define RD_RDMA_WRITE_ONLY_IMM 75 /*0x01001011 */
62 #define RD_RDMA_READ_REQUEST 76 /*0x01001100 */
63 #define RD_RDMA_READ_RESPONSE_FIRST 77 /*0x01001101 */
64 #define RD_RDMA_READ_RESPONSE_MIDDLE 78 /*0x01001110 */
65 #define RD_RDMA_READ_RESPONSE_LAST 79 /*0x01001111 */
66 #define RD_RDMA_READ_RESPONSE_ONLY 80 /*0x01010000 */
67 #define RD_ACKNOWLEDGE 81 /*0x01010001 */
68 #define RD_ATOMIC_ACKNOWLEDGE 82 /*0x01010010 */
69 #define RD_CMP_SWAP 83 /*0x01010011 */
70 #define RD_FETCH_ADD 84 /*0x01010100 */
71 #define RD_RESYNC 85 /*0x01010101 */
72 /* Unreliable Datagram (UD) [7-5] = 011 */
73 #define UD_SEND_ONLY 100 /*0x01100100 */
74 #define UD_SEND_ONLY_IMM 101 /*0x01100101 */
75 /* Unreliable Connection (UC) [7-5] = 001 */
76 #define UC_SEND_FIRST 32 /*0x00100000 */
77 #define UC_SEND_MIDDLE 33 /*0x00100001 */
78 #define UC_SEND_LAST 34 /*0x00100010 */
79 #define UC_SEND_LAST_IMM 35 /*0x00100011 */
80 #define UC_SEND_ONLY 36 /*0x00100100 */
81 #define UC_SEND_ONLY_IMM 37 /*0x00100101 */
82 #define UC_RDMA_WRITE_FIRST 38 /*0x00100110 */
83 #define UC_RDMA_WRITE_MIDDLE 39 /*0x00100111 */
84 #define UC_RDMA_WRITE_LAST 40 /*0x00101000 */
85 #define UC_RDMA_WRITE_LAST_IMM 41 /*0x00101001 */
86 #define UC_RDMA_WRITE_ONLY 42 /*0x00101010 */
87 #define UC_RDMA_WRITE_ONLY_IMM 43 /*0x00101011 */
89 /* Header Ordering Based on OPCODES */
90 #define RDETH_DETH_PAYLD 0
91 #define RDETH_DETH_RETH_PAYLD 1
92 #define RDETH_DETH_IMMDT_PAYLD 2
93 #define RDETH_DETH_RETH_IMMDT_PAYLD 3
94 #define RDETH_DETH_RETH 4
95 #define RDETH_AETH_PAYLD 5
96 #define RDETH_PAYLD 6
97 #define RDETH_AETH 7
98 #define RDETH_AETH_ATOMICACKETH 8
99 #define RDETH_DETH_ATOMICETH 9
100 #define RDETH_DETH 10
101 #define DETH_PAYLD 11
102 #define DETH_IMMDT_PAYLD 12
103 #define PAYLD 13
104 #define IMMDT_PAYLD 14
105 #define RETH_PAYLD 15
106 #define RETH_IMMDT_PAYLD 16
107 #define RETH 17
108 #define AETH_PAYLD 18
109 #define AETH 19
110 #define AETH_ATOMICACKETH 20
111 #define ATOMICETH 21
112 #define IETH_PAYLD 22
113 #define KDETH_PSM 23
114 #define KDETH_TIDRDMA 24
116 /* PSM */
117 #define PSM_RESERVED 0xC0
118 #define PSM_TINY 0xC1
119 #define PSM_SHORT 0xC2
120 #define PSM_MEDIUM 0xC3
121 #define PSM_MEDIUM_DATA 0xC4
122 #define PSM_LONG_RTS 0xC5
123 #define PSM_LONG_CTS 0xC6
124 #define PSM_LONG_DATA 0xC7
125 #define PSM_TIDS_GRANT 0xC8
126 #define PSM_TIDS_GRANT_ACK 0xC9
127 #define PSM_TIDS_RELEASE 0xCA
128 #define PSM_TIDS_RELEASE_CONFIRM 0xCB
129 #define PSM_EXPTID_UNALIGNED 0xCC
130 #define PSM_EXPTID 0xCD
131 #define PSM_ACK 0xCE
132 #define PSM_NAK 0xCF
133 #define PSM_ERR_CHK 0xD0
134 #define PSM_ERR_CHK_BAD 0xD1
135 #define PSM_ERR_CHK_GEN 0xD2
136 #define PSM_FLOW_CCA_BECN 0xD3
137 #define PSM_CONNECT_REQUEST 0xD4
138 #define PSM_CONNECT_REPLY 0xD5
139 #define PSM_DISCONNECT_REQUEST 0xD6
140 #define PSM_DISCONNECT_REPLY 0xD7
141 #define PSM_AM_REQUEST_NOREPLY 0xD8
142 #define PSM_AM_REQUEST 0xD9
143 #define PSM_AM_REPLY 0xDA
145 /* TID RDMA */
146 #define TID_RDMA_WRITE_REQUEST 0xE0
147 #define TID_RDMA_WRITE_RESPONSE 0xE1
148 #define TID_RDMA_WRITE_DATA 0xE2
149 #define TID_RDMA_WRITE_DATA_LAST 0xE3
150 #define TID_RDMA_READ_REQUEST 0xE4
151 #define TID_RDMA_READ_RESPONSE 0xE5
152 #define TID_RDMA_RESYNC 0xE6
153 #define TID_RDMA_ACK 0xE7
155 /* Array of all availavle OpCodes to make matching a bit easier. The OpCodes
156 * dictate the header sequence following in the packet. These arrays tell the
157 * dissector which headers must be decoded for the given OpCode.
159 static uint32_t opCode_RDETH_DETH_ATOMICETH[] = {
160 RD_CMP_SWAP,
161 RD_FETCH_ADD
163 static uint32_t opCode_IETH_PAYLD[] = {
164 RC_SEND_LAST_INVAL,
165 RC_SEND_ONLY_INVAL
167 static uint32_t opCode_ATOMICETH[] = {
168 RC_CMP_SWAP,
169 RC_FETCH_ADD
171 static uint32_t opCode_RDETH_DETH_RETH_PAYLD[] = {
172 RD_RDMA_WRITE_FIRST,
173 RD_RDMA_WRITE_ONLY
175 static uint32_t opCode_RETH_IMMDT_PAYLD[] = {
176 RC_RDMA_WRITE_ONLY_IMM,
177 UC_RDMA_WRITE_ONLY_IMM
179 static uint32_t opCode_RDETH_DETH_IMMDT_PAYLD[] = {
180 RD_SEND_LAST_IMM,
181 RD_SEND_ONLY_IMM,
182 RD_RDMA_WRITE_LAST_IMM
184 static uint32_t opCode_RDETH_AETH_PAYLD[] = {
185 RD_RDMA_READ_RESPONSE_FIRST,
186 RD_RDMA_READ_RESPONSE_LAST,
187 RD_RDMA_READ_RESPONSE_ONLY
189 static uint32_t opCode_AETH_PAYLD[] = {
190 RC_RDMA_READ_RESPONSE_FIRST,
191 RC_RDMA_READ_RESPONSE_LAST,
192 RC_RDMA_READ_RESPONSE_ONLY
194 static uint32_t opCode_RETH_PAYLD[] = {
195 RC_RDMA_WRITE_FIRST,
196 RC_RDMA_WRITE_ONLY,
197 UC_RDMA_WRITE_FIRST,
198 UC_RDMA_WRITE_ONLY
200 static uint32_t opCode_RDETH_DETH_PAYLD[] = {
201 RD_SEND_FIRST,
202 RD_SEND_MIDDLE,
203 RD_SEND_LAST,
204 RD_SEND_ONLY,
205 RD_RDMA_WRITE_MIDDLE,
206 RD_RDMA_WRITE_LAST
208 static uint32_t opCode_IMMDT_PAYLD[] = {
209 RC_SEND_LAST_IMM,
210 RC_SEND_ONLY_IMM,
211 RC_RDMA_WRITE_LAST_IMM,
212 UC_SEND_LAST_IMM,
213 UC_SEND_ONLY_IMM,
214 UC_RDMA_WRITE_LAST_IMM
216 static uint32_t opCode_PAYLD[] = {
217 RC_SEND_FIRST,
218 RC_SEND_MIDDLE,
219 RC_SEND_LAST,
220 RC_SEND_ONLY,
221 RC_RDMA_WRITE_MIDDLE,
222 RC_RDMA_WRITE_LAST,
223 RC_RDMA_READ_RESPONSE_MIDDLE,
224 UC_SEND_FIRST,
225 UC_SEND_MIDDLE,
226 UC_SEND_LAST,
227 UC_SEND_ONLY,
228 UC_RDMA_WRITE_MIDDLE,
229 UC_RDMA_WRITE_LAST
231 static uint32_t opCode_PSM[] = {
232 PSM_RESERVED,
233 PSM_TINY,
234 PSM_SHORT,
235 PSM_MEDIUM,
236 PSM_MEDIUM_DATA,
237 PSM_LONG_RTS,
238 PSM_LONG_CTS,
239 PSM_LONG_DATA,
240 PSM_TIDS_GRANT,
241 PSM_TIDS_GRANT_ACK,
242 PSM_TIDS_RELEASE,
243 PSM_TIDS_RELEASE_CONFIRM,
244 PSM_EXPTID_UNALIGNED,
245 PSM_EXPTID,
246 PSM_ACK,
247 PSM_NAK,
248 PSM_ERR_CHK,
249 PSM_ERR_CHK_BAD,
250 PSM_ERR_CHK_GEN,
251 PSM_FLOW_CCA_BECN,
252 PSM_CONNECT_REQUEST,
253 PSM_CONNECT_REPLY,
254 PSM_DISCONNECT_REQUEST,
255 PSM_DISCONNECT_REPLY,
256 PSM_AM_REQUEST_NOREPLY,
257 PSM_AM_REQUEST,
258 PSM_AM_REPLY
260 static unsigned opCode_TIDRDMA[] = {
261 TID_RDMA_WRITE_REQUEST,
262 TID_RDMA_WRITE_RESPONSE,
263 TID_RDMA_WRITE_DATA,
264 TID_RDMA_WRITE_DATA_LAST,
265 TID_RDMA_READ_REQUEST,
266 TID_RDMA_READ_RESPONSE,
267 TID_RDMA_RESYNC,
268 TID_RDMA_ACK
271 /* OP Codes */
272 static const value_string vals_opa_bth_opcode[] = {
273 { RC_SEND_FIRST, "RC Send First" },
274 { RC_SEND_MIDDLE, "RC Send Middle" },
275 { RC_SEND_LAST, "RC Send Last" },
276 { RC_SEND_LAST_IMM, "RC Send Last Immediate" },
277 { RC_SEND_ONLY, "RC Send Only" },
278 { RC_SEND_ONLY_IMM, "RC Send Only Immediate" },
279 { RC_RDMA_WRITE_FIRST, "RC RDMA Write First" },
280 { RC_RDMA_WRITE_MIDDLE, "RC RDMA Write Middle" },
281 { RC_RDMA_WRITE_LAST, "RC RDMA Write Last" },
282 { RC_RDMA_WRITE_LAST_IMM, "RC RDMA Write Last Immediate" },
283 { RC_RDMA_WRITE_ONLY, "RC RDMA Write Only" },
284 { RC_RDMA_WRITE_ONLY_IMM, "RC RDMA Write Only Immediate" },
285 { RC_RDMA_READ_REQUEST, "RC RDMA Read Request" },
286 { RC_RDMA_READ_RESPONSE_FIRST, "RC RDMA Read Response First" },
287 { RC_RDMA_READ_RESPONSE_MIDDLE, "RC RDMA Read Response Middle" },
288 { RC_RDMA_READ_RESPONSE_LAST, "RC RDMA Read Response Last" },
289 { RC_RDMA_READ_RESPONSE_ONLY, "RC RDMA Read Response Only" },
290 { RC_ACKNOWLEDGE, "RC Acknowledge" },
291 { RC_ATOMIC_ACKNOWLEDGE, "RC Atomic Acknowledge" },
292 { RC_CMP_SWAP, "RC Compare Swap" },
293 { RC_FETCH_ADD, "RC Fetch Add" },
294 { RC_SEND_LAST_INVAL, "RC Send Last Invalidate" },
295 { RC_SEND_ONLY_INVAL, "RC Send Only Invalidate" },
296 { RD_SEND_FIRST, "RD Send First" },
297 { RD_SEND_MIDDLE, "RD Send Middle" },
298 { RD_SEND_LAST, "RD Send Last" },
299 { RD_SEND_LAST_IMM, "RD Last Immediate" },
300 { RD_SEND_ONLY, "RD Send Only" },
301 { RD_SEND_ONLY_IMM, "RD Send Only Immediate" },
302 { RD_RDMA_WRITE_FIRST, "RD RDMA Write First" },
303 { RD_RDMA_WRITE_MIDDLE, "RD RDMA Write Middle" },
304 { RD_RDMA_WRITE_LAST, "RD RDMA Write Last" },
305 { RD_RDMA_WRITE_LAST_IMM, "RD RDMA Write Last Immediate" },
306 { RD_RDMA_WRITE_ONLY, "RD RDMA Write Only" },
307 { RD_RDMA_WRITE_ONLY_IMM, "RD RDMA Write Only Immediate" },
308 { RD_RDMA_READ_REQUEST, "RD RDMA Read Request" },
309 { RD_RDMA_READ_RESPONSE_FIRST, "RD RDMA Read Response First" },
310 { RD_RDMA_READ_RESPONSE_MIDDLE, "RD RDMA Read Response Middle" },
311 { RD_RDMA_READ_RESPONSE_LAST, "RD RDMA Read Response Last" },
312 { RD_RDMA_READ_RESPONSE_ONLY, "RD RDMA Read Response Only" },
313 { RD_ACKNOWLEDGE, "RD Acknowledge" },
314 { RD_ATOMIC_ACKNOWLEDGE, "RD Atomic Acknowledge" },
315 { RD_CMP_SWAP, "RD Compare Swap" },
316 { RD_FETCH_ADD, "RD Fetch Add" },
317 { RD_RESYNC, "RD RESYNC" },
318 { UD_SEND_ONLY, "UD Send Only" },
319 { UD_SEND_ONLY_IMM, "UD Send Only Immediate" },
320 { UC_SEND_FIRST, "UC Send First" },
321 { UC_SEND_MIDDLE, "UC Send Middle" },
322 { UC_SEND_LAST, "UC Send Last" },
323 { UC_SEND_LAST_IMM, "UC Send Last Immediate" },
324 { UC_SEND_ONLY, "UC Send Only" },
325 { UC_SEND_ONLY_IMM, "UC Send Only Immediate" },
326 { UC_RDMA_WRITE_FIRST, "UC RDMA Write First" },
327 { UC_RDMA_WRITE_MIDDLE, "Unreliable Connection RDMA Write Middle" },
328 { UC_RDMA_WRITE_LAST, "UC RDMA Write Last" },
329 { UC_RDMA_WRITE_LAST_IMM, "UC RDMA Write Last Immediate" },
330 { UC_RDMA_WRITE_ONLY, "UC RDMA Write Only" },
331 { UC_RDMA_WRITE_ONLY_IMM, "UC RDMA Write Only Immediate" },
332 { PSM_RESERVED, "PSM Reserved" },
333 { PSM_TINY, "PSM TINY" },
334 { PSM_SHORT, "PSM SHORT" },
335 { PSM_MEDIUM, "PSM MEDIUM" },
336 { PSM_MEDIUM_DATA, "PSM MEDIUM_DATA" },
337 { PSM_LONG_RTS, "PSM LONG RTS" },
338 { PSM_LONG_CTS, "PSM LONG CTS" },
339 { PSM_LONG_DATA, "PSM LONG DATA" },
340 { PSM_TIDS_GRANT, "PSM TIDS GRANT" },
341 { PSM_TIDS_GRANT_ACK, "PSM TIDS GRANT ACK" },
342 { PSM_TIDS_RELEASE, "PSM TIDS RELEASE" },
343 { PSM_TIDS_RELEASE_CONFIRM, "PSM TIDS RELEASE CONFIRM" },
344 { PSM_EXPTID_UNALIGNED, "PSM EXPTID UNALIGNED" },
345 { PSM_EXPTID, "PSM EXPTID" },
346 { PSM_ACK, "PSM ACK" },
347 { PSM_NAK, "PSM NAK" },
348 { PSM_ERR_CHK, "PSM ERR CHK" },
349 { PSM_ERR_CHK_BAD, "PSM ERR CHK BAD" },
350 { PSM_ERR_CHK_GEN, "PSM ERR CHK GEN" },
351 { PSM_FLOW_CCA_BECN, "PSM FLOW CCA BECN" },
352 { PSM_CONNECT_REQUEST, "PSM CONNECT REQUEST" },
353 { PSM_CONNECT_REPLY, "PSM CONNECT REPLY" },
354 { PSM_DISCONNECT_REQUEST, "PSM DISCONNECT REQUEST" },
355 { PSM_DISCONNECT_REPLY, "PSM DISCONNECT REPLY" },
356 { PSM_AM_REQUEST_NOREPLY, "PSM AM REQUEST NOREPLY" },
357 { PSM_AM_REQUEST, "PSM AM REQUEST" },
358 { PSM_AM_REPLY, "PSM AM REPLY" },
359 { TID_RDMA_WRITE_REQUEST, "TID RDMA Write Request" },
360 { TID_RDMA_WRITE_RESPONSE, "TID RDMA Write Response" },
361 { TID_RDMA_WRITE_DATA, "TID RDMA Write Data" },
362 { TID_RDMA_WRITE_DATA_LAST, "TID RDMA Write Data Last" },
363 { TID_RDMA_READ_REQUEST, "TID RDMA Read Request" },
364 { TID_RDMA_READ_RESPONSE, "TID RDMA Read Response" },
365 { TID_RDMA_RESYNC, "TID RDMA ReSync" },
366 { TID_RDMA_ACK, "TID RDMA Ack" },
367 { 0, NULL }
369 static const value_string vals_opa_9b_lnh[] = {
370 { 0, "RAW" },
371 { 3, "GRH" },
372 { 2, "BTH" },
373 { 1, "Ipv6" },
374 { 0, NULL }
376 static const value_string vals_opa_9b_grh_ipver[] = {
377 { 4, "IPv4" },
378 { 6, "IPv6" },
379 { 0, NULL },
381 static const value_string vals_opa_9b_grh_next_hdr[] = {
382 { 0x1B, "BTH Follows" },
383 { 0, NULL }
385 static const true_false_string tfs_opa_bth_migrated_notmigrated = {
386 "Migrated",
387 "Not Migrated"
389 static const true_false_string tfs_opa_kdeth_offset_32_64 = {
390 "32 Byte Words",
391 "64 Byte Words"
393 /* Wireshark ID */
394 static int proto_opa_9b;
396 /* Variables to hold expansion values between packets */
397 static int ett_all_headers;
398 static int ett_9b;
399 static int ett_grh;
400 static int ett_bth;
401 static int ett_rdeth;
402 static int ett_deth;
403 static int ett_reth;
404 static int ett_atomiceth;
405 static int ett_aeth;
406 static int ett_atomicacketh;
407 static int ett_immdt;
408 static int ett_ieth;
409 static int ett_kdeth;
410 static int ett_psm;
411 static int ett_tidrdma;
413 /* 9B Header Fields */
414 static int hf_opa_9B;
415 static int hf_opa_9B_service_channel;
416 static int hf_opa_9B_link_version;
417 static int hf_opa_9B_service_level;
418 static int hf_opa_9B_reserved2;
419 static int hf_opa_9B_lnh;
420 static int hf_opa_9B_dlid;
421 static int hf_opa_9B_reserved3;
422 static int hf_opa_9B_packet_length;
423 static int hf_opa_9B_slid;
424 /* ICRC */
425 static int hf_opa_9b_ICRC;
427 /* GRH */
428 static int hf_opa_grh;
429 static int hf_opa_grh_ip_version;
430 static int hf_opa_grh_traffic_class;
431 static int hf_opa_grh_flow_label;
432 static int hf_opa_grh_payload_length;
433 static int hf_opa_grh_next_header;
434 static int hf_opa_grh_hop_limit;
435 static int hf_opa_grh_source_gid;
436 static int hf_opa_grh_destination_gid;
438 /* BTH */
439 static int hf_opa_bth;
440 static int hf_opa_bth_opcode;
441 static int hf_opa_bth_solicited_event;
442 static int hf_opa_bth_migreq;
443 static int hf_opa_bth_pad_count;
444 static int hf_opa_bth_transport_header_version;
445 static int hf_opa_bth_partition_key;
446 static int hf_opa_bth_fcn;
447 static int hf_opa_bth_bcn;
448 static int hf_opa_bth_Reserved8a;
449 static int hf_opa_bth_destination_qp;
450 static int hf_opa_bth_acknowledge_request;
451 static int hf_opa_bth_packet_sequence_number;
453 /* XXETH */
454 static int hf_opa_RDETH;
455 static int hf_opa_RDETH_reserved8;
456 static int hf_opa_RDETH_ee_context;
457 static int hf_opa_DETH;
458 static int hf_opa_DETH_queue_key;
459 static int hf_opa_DETH_reserved8;
460 static int hf_opa_DETH_source_qp;
461 static int hf_opa_RETH;
462 static int hf_opa_RETH_virtual_address;
463 static int hf_opa_RETH_remote_key;
464 static int hf_opa_RETH_dma_length;
465 static int hf_opa_AtomicETH;
466 static int hf_opa_AtomicETH_virtual_address;
467 static int hf_opa_AtomicETH_remote_key;
468 static int hf_opa_AtomicETH_swap_or_add_data;
469 static int hf_opa_AtomicETH_compare_data;
470 static int hf_opa_AETH;
471 static int hf_opa_AETH_syndrome;
472 static int hf_opa_AETH_message_sequence_number;
473 static int hf_opa_AtomicAckETH;
474 static int hf_opa_AtomicAckETH_original_remote_data;
475 static int hf_opa_IMMDT;
476 static int hf_opa_IMMDT_data;
477 static int hf_opa_IETH;
478 static int hf_opa_IETH_r_key;
479 static int hf_opa_KDETH;
480 static int hf_opa_KDETH_kver;
481 static int hf_opa_KDETH_sh;
482 static int hf_opa_KDETH_intr;
483 static int hf_opa_KDETH_tidctrl;
484 static int hf_opa_KDETH_tid;
485 static int hf_opa_KDETH_offset_mode;
486 static int hf_opa_KDETH_offset;
487 static int * const _opa_KDETH_word1[] = {
488 &hf_opa_KDETH_kver,
489 &hf_opa_KDETH_sh,
490 &hf_opa_KDETH_intr,
491 &hf_opa_KDETH_tidctrl,
492 &hf_opa_KDETH_tid,
493 &hf_opa_KDETH_offset_mode,
494 &hf_opa_KDETH_offset,
495 NULL
497 static int hf_opa_KDETH_hcrc;
498 static int hf_opa_KDETH_j_key;
499 static int * const _opa_KDETH_word2[] = {
500 &hf_opa_KDETH_hcrc,
501 &hf_opa_KDETH_j_key,
502 NULL
504 /* PSM */
505 static int hf_opa_psm;
506 static int hf_opa_psm_a;
507 static int hf_opa_psm_ackpsn;
508 static int hf_opa_psm_flags;
509 static int hf_opa_psm_commidx;
510 static int hf_opa_psm_flowid;
511 static int hf_opa_psm_msglen;
512 static int hf_opa_psm_msgseq;
513 static int hf_opa_psm_tag;
514 static int hf_opa_psm_msgdata;
515 static int hf_opa_psm_short_msglen;
516 static int hf_opa_psm_paylen;
517 static int hf_opa_psm_offset;
518 static int hf_opa_psm_sreqidx;
519 static int hf_opa_psm_rreqidx;
520 static int hf_opa_psm_rdescid;
521 static int hf_opa_psm_sdescid;
522 static int hf_opa_psm_psn;
523 static int hf_opa_psm_hostipv4;
524 static int hf_opa_psm_hostpid;
525 static int hf_opa_psm_dlen;
526 static int hf_opa_psm_nargs;
527 static int hf_opa_psm_hidx;
528 static int hf_opa_psm_arg;
529 static int hf_opa_psm_payload;
530 /* TID RDMA */
531 static int hf_opa_TIDRDMA;
532 static int hf_opa_TIDRDMA_reserved;
533 static int hf_opa_TIDRDMA_TIDFlowPSN_reserved;
534 static int hf_opa_TIDRDMA_TIDFlowPSN;
535 static int hf_opa_TIDRDMA_TIDFlowQP_reserved;
536 static int hf_opa_TIDRDMA_TIDFlowQP;
537 static int hf_opa_TIDRDMA_VerbsPSN_reserved;
538 static int hf_opa_TIDRDMA_VerbsPSN;
539 static int hf_opa_TIDRDMA_VerbsQP_reserved;
540 static int hf_opa_TIDRDMA_VerbsQP;
543 /* Custom Functions */
544 static void cf_opa_dw_to_b(char *buf, uint32_t value)
546 snprintf(buf, ITEM_LABEL_LENGTH, "%u DWORDS (%u Bytes)", value, value * 4);
549 /* Dissector Declarations */
550 static dissector_handle_t opa_9b_handle;
551 static dissector_handle_t opa_mad_handle;
552 static dissector_handle_t infiniband_handle;
553 static dissector_handle_t ipv6_handle;
555 static void parse_opa_9B_Header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, uint8_t *lnh_val)
557 /* 16B - L2 Header */
558 proto_item *L2_9B_header_item;
559 proto_tree *L2_9B_header_tree;
560 void *src_addr, *dst_addr;
562 int local_offset = *offset;
564 col_prepend_fstr(pinfo->cinfo, COL_INFO, "9B: ");
565 L2_9B_header_item = proto_tree_add_item(tree, hf_opa_9B, tvb, local_offset, 8, ENC_NA);
566 L2_9B_header_tree = proto_item_add_subtree(L2_9B_header_item, ett_9b);
568 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_service_channel, tvb, local_offset, 1, ENC_BIG_ENDIAN);
569 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_link_version, tvb, local_offset, 1, ENC_BIG_ENDIAN);
570 local_offset += 1;
571 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_service_level, tvb, local_offset, 1, ENC_BIG_ENDIAN);
572 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_reserved2, tvb, local_offset, 1, ENC_BIG_ENDIAN);
573 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_lnh, tvb, local_offset, 1, ENC_BIG_ENDIAN);
575 /* Save Link Next Header... This tells us what the next header is. */
576 *lnh_val = tvb_get_uint8(tvb, local_offset);
577 *lnh_val &= 0x03;
578 local_offset += 1;
580 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_dlid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
582 /* Set destination in packet view. */
583 dst_addr = wmem_alloc(pinfo->pool, sizeof(uint16_t));
584 *((uint16_t *)dst_addr) = tvb_get_ntohs(tvb, local_offset);
585 set_address(&pinfo->dst, AT_IB, sizeof(uint16_t), dst_addr);
586 local_offset += 2;
588 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_reserved3, tvb, local_offset, 1, ENC_BIG_ENDIAN);
590 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_packet_length, tvb, local_offset, 2, ENC_BIG_ENDIAN);
591 local_offset += 2;
592 proto_tree_add_item(L2_9B_header_tree, hf_opa_9B_slid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
594 /* Set Source in packet view. */
595 src_addr = wmem_alloc(pinfo->pool, sizeof(uint16_t));
596 *((uint16_t *)src_addr) = tvb_get_ntohs(tvb, local_offset);
597 set_address(&pinfo->src, AT_IB, sizeof(uint16_t), src_addr);
598 local_offset += 2;
600 *offset = local_offset;
603 static void parse_opa_grh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, uint8_t *nextHdr)
605 proto_item *global_route_header_item;
606 proto_tree *global_route_header_tree;
608 int local_offset = *offset;
610 col_append_str(pinfo->cinfo, COL_INFO, "GRH: ");
611 global_route_header_item = proto_tree_add_item(tree, hf_opa_grh, tvb, local_offset, 40, ENC_NA);
612 global_route_header_tree = proto_item_add_subtree(global_route_header_item, ett_grh);
614 proto_tree_add_item(global_route_header_tree, hf_opa_grh_ip_version, tvb, local_offset, 1, ENC_BIG_ENDIAN);
615 proto_tree_add_item(global_route_header_tree, hf_opa_grh_traffic_class, tvb, local_offset, 2, ENC_BIG_ENDIAN);
616 proto_tree_add_item(global_route_header_tree, hf_opa_grh_flow_label, tvb, local_offset, 4, ENC_BIG_ENDIAN);
617 local_offset += 4;
619 proto_tree_add_item(global_route_header_tree, hf_opa_grh_payload_length, tvb, local_offset, 2, ENC_BIG_ENDIAN);
620 local_offset += 2;
622 *nextHdr = tvb_get_uint8(tvb, local_offset);
624 proto_tree_add_item(global_route_header_tree, hf_opa_grh_next_header, tvb, local_offset, 1, ENC_BIG_ENDIAN);
625 local_offset += 1;
626 proto_tree_add_item(global_route_header_tree, hf_opa_grh_hop_limit, tvb, local_offset, 1, ENC_BIG_ENDIAN);
627 local_offset += 1;
628 proto_tree_add_item(global_route_header_tree, hf_opa_grh_source_gid, tvb, local_offset, 16, ENC_NA);
630 /* set source GID in packet view*/
631 set_address_tvb(&pinfo->src, AT_IB, 16, tvb, local_offset);
632 local_offset += 16;
634 proto_tree_add_item(global_route_header_tree, hf_opa_grh_destination_gid, tvb, local_offset, 16, ENC_NA);
636 /* set destination GID in packet view*/
637 set_address_tvb(&pinfo->dst, AT_IB, 16, tvb, local_offset);
638 local_offset += 16;
640 *offset = local_offset;
643 static void parse_opa_bth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, uint8_t *opCode)
645 proto_item *base_transport_header_item;
646 proto_tree *base_transport_header_tree;
648 int local_offset = *offset;
650 col_append_str(pinfo->cinfo, COL_INFO, "BTH: ");
651 base_transport_header_item = proto_tree_add_item(tree, hf_opa_bth, tvb, local_offset, 12, ENC_NA);
652 base_transport_header_tree = proto_item_add_subtree(base_transport_header_item, ett_bth);
654 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_opcode, tvb, local_offset, 1, ENC_LITTLE_ENDIAN);
655 *opCode = tvb_get_uint8(tvb, local_offset);
656 col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str((uint32_t)(*opCode), vals_opa_bth_opcode, "Unknown OpCode (0x%0x)"));
657 local_offset += 1;
659 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_solicited_event, tvb, local_offset, 1, ENC_BIG_ENDIAN);
660 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_migreq, tvb, local_offset, 1, ENC_BIG_ENDIAN);
661 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_pad_count, tvb, local_offset, 1, ENC_BIG_ENDIAN);
662 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_transport_header_version, tvb, local_offset, 1, ENC_BIG_ENDIAN);
664 local_offset += 1;
665 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_partition_key, tvb, local_offset, 2, ENC_BIG_ENDIAN);
667 local_offset += 2;
668 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_fcn, tvb, local_offset, 1, ENC_BIG_ENDIAN);
669 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_bcn, tvb, local_offset, 1, ENC_BIG_ENDIAN);
670 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_Reserved8a, tvb, local_offset, 1, ENC_BIG_ENDIAN);
671 local_offset += 1;
672 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_destination_qp, tvb, local_offset, 3, ENC_BIG_ENDIAN);
673 pinfo->destport = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
674 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_acknowledge_request, tvb, local_offset, 1, ENC_BIG_ENDIAN);
675 proto_tree_add_item(base_transport_header_tree, hf_opa_bth_packet_sequence_number, tvb, local_offset, 4, ENC_BIG_ENDIAN);
676 local_offset += 4;
678 *offset = local_offset;
680 static bool contains(uint32_t OpCode, uint32_t *Codes, int32_t length)
682 int32_t i;
683 for (i = 0; i < length; i++) {
684 if ((OpCode ^ Codes[i]) == 0)
685 return true;
687 return false;
689 static int32_t find_next_header_sequence(uint32_t OpCode)
691 if (contains(OpCode, &opCode_PAYLD[0], (int32_t)array_length(opCode_PAYLD)))
692 return PAYLD;
694 if (contains(OpCode, &opCode_IMMDT_PAYLD[0], (int32_t)array_length(opCode_IMMDT_PAYLD)))
695 return IMMDT_PAYLD;
697 if (contains(OpCode, &opCode_RDETH_DETH_PAYLD[0], (int32_t)array_length(opCode_RDETH_DETH_PAYLD)))
698 return RDETH_DETH_PAYLD;
700 if (contains(OpCode, &opCode_RETH_PAYLD[0], (int32_t)array_length(opCode_RETH_PAYLD)))
701 return RETH_PAYLD;
703 if (contains(OpCode, &opCode_RDETH_AETH_PAYLD[0], (int32_t)array_length(opCode_RDETH_AETH_PAYLD)))
704 return RDETH_AETH_PAYLD;
706 if (contains(OpCode, &opCode_AETH_PAYLD[0], (int32_t)array_length(opCode_AETH_PAYLD)))
707 return AETH_PAYLD;
709 if (contains(OpCode, &opCode_RDETH_DETH_IMMDT_PAYLD[0], (int32_t)array_length(opCode_RDETH_DETH_IMMDT_PAYLD)))
710 return RDETH_DETH_IMMDT_PAYLD;
712 if (contains(OpCode, &opCode_RETH_IMMDT_PAYLD[0], (int32_t)array_length(opCode_RETH_IMMDT_PAYLD)))
713 return RETH_IMMDT_PAYLD;
715 if (contains(OpCode, &opCode_RDETH_DETH_RETH_PAYLD[0], (int32_t)array_length(opCode_RDETH_DETH_RETH_PAYLD)))
716 return RDETH_DETH_RETH_PAYLD;
718 if (contains(OpCode, &opCode_ATOMICETH[0], (int32_t)array_length(opCode_ATOMICETH)))
719 return ATOMICETH;
721 if (contains(OpCode, &opCode_IETH_PAYLD[0], (int32_t)array_length(opCode_IETH_PAYLD)))
722 return IETH_PAYLD;
724 if (contains(OpCode, &opCode_RDETH_DETH_ATOMICETH[0], (int32_t)array_length(opCode_RDETH_DETH_ATOMICETH)))
725 return RDETH_DETH_ATOMICETH;
727 if (contains(OpCode, &opCode_PSM[0], (int32_t)array_length(opCode_PSM)))
728 return KDETH_PSM;
730 if (contains(OpCode, &opCode_TIDRDMA[0], (int32_t)array_length(opCode_TIDRDMA)))
731 return KDETH_TIDRDMA;
733 if ((OpCode ^ RC_ACKNOWLEDGE) == 0)
734 return AETH;
736 if ((OpCode ^ RC_RDMA_READ_REQUEST) == 0)
737 return RETH;
739 if ((OpCode ^ RC_ATOMIC_ACKNOWLEDGE) == 0)
740 return AETH_ATOMICACKETH;
742 if ((OpCode ^ RD_RDMA_READ_RESPONSE_MIDDLE) == 0)
743 return RDETH_PAYLD;
745 if ((OpCode ^ RD_ACKNOWLEDGE) == 0)
746 return RDETH_AETH;
748 if ((OpCode ^ RD_ATOMIC_ACKNOWLEDGE) == 0)
749 return RDETH_AETH_ATOMICACKETH;
751 if ((OpCode ^ RD_RDMA_WRITE_ONLY_IMM) == 0)
752 return RDETH_DETH_RETH_IMMDT_PAYLD;
754 if ((OpCode ^ RD_RDMA_READ_REQUEST) == 0)
755 return RDETH_DETH_RETH;
757 if ((OpCode ^ RD_RESYNC) == 0)
758 return RDETH_DETH;
760 if ((OpCode ^ UD_SEND_ONLY) == 0)
761 return DETH_PAYLD;
763 if ((OpCode ^ UD_SEND_ONLY_IMM) == 0)
764 return DETH_IMMDT_PAYLD;
766 return -1;
769 /* Parse RDETH - Reliable Datagram Extended Transport Header */
770 static void parse_RDETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
772 int local_offset = *offset;
773 /* RDETH - Reliable Datagram Extended Transport Header */
774 proto_item *RDETH_header_item;
775 proto_tree *RDETH_header_tree;
777 col_append_str(pinfo->cinfo, COL_INFO, "RDETH: ");
778 RDETH_header_item = proto_tree_add_item(tree, hf_opa_RDETH, tvb, local_offset, 4, ENC_NA);
779 RDETH_header_tree = proto_item_add_subtree(RDETH_header_item, ett_rdeth);
781 proto_tree_add_item(RDETH_header_tree, hf_opa_RDETH_reserved8, tvb, local_offset, 1, ENC_BIG_ENDIAN);
782 local_offset += 1;
783 proto_tree_add_item(RDETH_header_tree, hf_opa_RDETH_ee_context, tvb, local_offset, 3, ENC_BIG_ENDIAN);
784 local_offset += 3;
785 *offset = local_offset;
787 /* Parse DETH - Datagram Extended Transport Header */
788 static void parse_DETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
790 int local_offset = *offset;
791 /* DETH - Datagram Extended Transport Header */
792 proto_item *DETH_header_item;
793 proto_tree *DETH_header_tree;
795 col_append_str(pinfo->cinfo, COL_INFO, "DETH: ");
796 DETH_header_item = proto_tree_add_item(tree, hf_opa_DETH, tvb, local_offset, 8, ENC_NA);
797 DETH_header_tree = proto_item_add_subtree(DETH_header_item, ett_deth);
799 proto_tree_add_item(DETH_header_tree, hf_opa_DETH_queue_key, tvb, local_offset, 4, ENC_BIG_ENDIAN);
800 local_offset += 4;
801 proto_tree_add_item(DETH_header_tree, hf_opa_DETH_reserved8, tvb, local_offset, 1, ENC_BIG_ENDIAN);
802 local_offset += 1;
803 proto_tree_add_item(DETH_header_tree, hf_opa_DETH_source_qp, tvb, local_offset, 3, ENC_BIG_ENDIAN);
804 pinfo->srcport = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
806 *offset = local_offset;
808 /* Parse RETH - RDMA Extended Transport Header */
809 static void parse_RETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
811 int local_offset = *offset;
812 /* RETH - RDMA Extended Transport Header */
813 proto_item *RETH_header_item;
814 proto_tree *RETH_header_tree;
816 col_append_str(pinfo->cinfo, COL_INFO, "RETH: ");
817 RETH_header_item = proto_tree_add_item(tree, hf_opa_RETH, tvb, local_offset, 16, ENC_NA);
818 RETH_header_tree = proto_item_add_subtree(RETH_header_item, ett_reth);
820 proto_tree_add_item(RETH_header_tree, hf_opa_RETH_virtual_address, tvb, local_offset, 8, ENC_BIG_ENDIAN);
821 local_offset += 8;
822 proto_tree_add_item(RETH_header_tree, hf_opa_RETH_remote_key, tvb, local_offset, 4, ENC_BIG_ENDIAN);
823 local_offset += 4;
824 proto_tree_add_item(RETH_header_tree, hf_opa_RETH_dma_length, tvb, local_offset, 4, ENC_BIG_ENDIAN);
825 local_offset += 4;
827 *offset = local_offset;
829 /* Parse AtomicETH - Atomic Extended Transport Header */
830 static void parse_ATOMICETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
832 int local_offset = *offset;
833 /* AtomicETH - Atomic Extended Transport Header */
834 proto_item *ATOMICETH_header_item;
835 proto_tree *ATOMICETH_header_tree;
837 col_append_str(pinfo->cinfo, COL_INFO, "AtomicETH: ");
838 ATOMICETH_header_item = proto_tree_add_item(tree, hf_opa_AtomicETH, tvb, local_offset, 28, ENC_NA);
839 ATOMICETH_header_tree = proto_item_add_subtree(ATOMICETH_header_item, ett_atomiceth);
841 proto_tree_add_item(ATOMICETH_header_tree, hf_opa_AtomicETH_virtual_address, tvb, local_offset, 8, ENC_BIG_ENDIAN);
842 local_offset += 8;
843 proto_tree_add_item(ATOMICETH_header_tree, hf_opa_AtomicETH_remote_key, tvb, local_offset, 4, ENC_BIG_ENDIAN);
844 local_offset += 4;
845 proto_tree_add_item(ATOMICETH_header_tree, hf_opa_AtomicETH_swap_or_add_data, tvb, local_offset, 8, ENC_BIG_ENDIAN);
846 local_offset += 8;
847 proto_tree_add_item(ATOMICETH_header_tree, hf_opa_AtomicETH_compare_data, tvb, local_offset, 8, ENC_BIG_ENDIAN);
848 local_offset += 8;
849 *offset = local_offset;
851 /* Parse AETH - ACK Extended Transport Header */
852 static void parse_AETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
854 int local_offset = *offset;
855 /* AETH - ACK Extended Transport Header */
856 proto_item *AETH_header_item;
857 proto_tree *AETH_header_tree;
859 col_append_str(pinfo->cinfo, COL_INFO, "AETH: ");
860 AETH_header_item = proto_tree_add_item(tree, hf_opa_AETH, tvb, local_offset, 4, ENC_NA);
861 AETH_header_tree = proto_item_add_subtree(AETH_header_item, ett_aeth);
863 proto_tree_add_item(AETH_header_tree, hf_opa_AETH_syndrome, tvb, local_offset, 1, ENC_BIG_ENDIAN);
864 local_offset += 1;
865 proto_tree_add_item(AETH_header_tree, hf_opa_AETH_message_sequence_number, tvb, local_offset, 3, ENC_BIG_ENDIAN);
866 local_offset += 3;
868 *offset = local_offset;
870 /* Parse AtomicAckEth - Atomic ACK Extended Transport Header */
871 static void parse_ATOMICACKETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
873 int local_offset = *offset;
874 /* AtomicAckEth - Atomic ACK Extended Transport Header */
875 proto_item *ATOMICACKETH_header_item;
876 proto_tree *ATOMICACKETH_header_tree;
878 col_append_str(pinfo->cinfo, COL_INFO, "AtomicACKETH: ");
879 ATOMICACKETH_header_item = proto_tree_add_item(tree, hf_opa_AtomicAckETH, tvb, local_offset, 8, ENC_NA);
880 ATOMICACKETH_header_tree = proto_item_add_subtree(ATOMICACKETH_header_item, ett_atomicacketh);
881 proto_tree_add_item(ATOMICACKETH_header_tree, hf_opa_AtomicAckETH_original_remote_data, tvb, local_offset, 8, ENC_BIG_ENDIAN);
882 local_offset += 8;
883 *offset = local_offset;
885 /* Parse IMMDT - Immediate Data Extended Transport Header */
886 static void parse_IMMDT(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
888 int local_offset = *offset;
889 /* IMMDT - Immediate Data Extended Transport Header */
890 proto_item *IMMDT_header_item;
891 proto_tree *IMMDT_header_tree;
893 col_append_str(pinfo->cinfo, COL_INFO, "IMMDT: ");
894 IMMDT_header_item = proto_tree_add_item(tree, hf_opa_IMMDT, tvb, local_offset, 4, ENC_NA);
895 IMMDT_header_tree = proto_item_add_subtree(IMMDT_header_item, ett_immdt);
896 proto_tree_add_item(IMMDT_header_tree, hf_opa_IMMDT_data, tvb, local_offset, 4, ENC_BIG_ENDIAN);
897 local_offset += 4;
898 *offset = local_offset;
900 /* Parse IETH - Invalidate Extended Transport Header */
901 static void parse_IETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
903 int local_offset = *offset;
904 /* IETH - Invalidate Extended Transport Header */
905 proto_item *IETH_header_item;
906 proto_tree *IETH_header_tree;
908 col_append_str(pinfo->cinfo, COL_INFO, "IETH: ");
909 IETH_header_item = proto_tree_add_item(tree, hf_opa_IETH, tvb, local_offset, 4, ENC_NA);
910 IETH_header_tree = proto_item_add_subtree(IETH_header_item, ett_ieth);
912 proto_tree_add_item(IETH_header_tree, hf_opa_IETH_r_key, tvb, local_offset, 4, ENC_BIG_ENDIAN);
913 local_offset += 4;
915 *offset = local_offset;
917 /* Parse KDETH - Key Datagram Extended Transport Header */
918 static void parse_KDETH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
920 int local_offset = *offset;
921 /* KDETH - Key Datagram Extended Transport Header */
922 proto_item *KDETH_header_item;
923 proto_tree *KDETH_header_tree;
925 col_append_str(pinfo->cinfo, COL_INFO, "KDETH: ");
926 KDETH_header_item = proto_tree_add_item(tree, hf_opa_KDETH, tvb, local_offset, 8, ENC_NA);
927 KDETH_header_tree = proto_item_add_subtree(KDETH_header_item, ett_kdeth);
929 proto_tree_add_bitmask_list(KDETH_header_tree, tvb, local_offset, 4, _opa_KDETH_word1, ENC_LITTLE_ENDIAN);
930 local_offset += 4;
931 proto_tree_add_bitmask_list(KDETH_header_tree, tvb, local_offset, 4, _opa_KDETH_word2, ENC_LITTLE_ENDIAN);
932 local_offset += 4;
934 *offset = local_offset;
937 /* Parse PSM header */
938 static void parse_PSM(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, int opCode)
940 int local_offset = *offset;
941 /* PSM Header */
942 proto_item *PSM_header_item;
943 proto_tree *PSM_header_tree;
944 uint32_t payLength;
946 col_append_str(pinfo->cinfo, COL_INFO, "PSM: ");
947 PSM_header_item = proto_tree_add_item(tree, hf_opa_psm, tvb, local_offset, 28, ENC_NA);
948 PSM_header_tree = proto_item_add_subtree(PSM_header_item, ett_psm);
950 proto_tree_add_item(PSM_header_tree, hf_opa_psm_a, tvb, local_offset + 3, 1, ENC_LITTLE_ENDIAN);
951 proto_tree_add_item(PSM_header_tree, hf_opa_psm_ackpsn, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
952 local_offset += 4;
953 proto_tree_add_item(PSM_header_tree, hf_opa_psm_flags, tvb, local_offset + 3, 1, ENC_LITTLE_ENDIAN);
954 proto_tree_add_item(PSM_header_tree, hf_opa_psm_commidx, tvb, local_offset, 3, ENC_LITTLE_ENDIAN);
955 local_offset += 4;
956 proto_tree_add_item(PSM_header_tree, hf_opa_psm_flowid, tvb, local_offset + 3, 1, ENC_LITTLE_ENDIAN);
958 switch (opCode) {
959 case PSM_TINY:
960 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msglen, tvb, local_offset + 2, 1, ENC_LITTLE_ENDIAN);
961 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
962 local_offset += 4;
963 proto_tree_add_item(PSM_header_tree, hf_opa_psm_tag, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
964 local_offset += 8;
965 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgdata, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
966 local_offset += 8;
967 break;
968 case PSM_SHORT:
969 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
970 local_offset += 4;
971 proto_tree_add_item(PSM_header_tree, hf_opa_psm_tag, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
972 local_offset += 8;
973 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msglen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
974 payLength = tvb_get_letohl(tvb, local_offset);
975 local_offset += 8;
976 proto_tree_add_item(PSM_header_tree, hf_opa_psm_payload, tvb, local_offset, payLength, ENC_NA);
977 local_offset += payLength;
978 break;
979 case PSM_MEDIUM:
980 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
981 local_offset += 4;
982 proto_tree_add_item(PSM_header_tree, hf_opa_psm_tag, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
983 local_offset += 8;
984 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msglen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
985 local_offset += 4;
986 proto_tree_add_item(PSM_header_tree, hf_opa_psm_paylen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
987 local_offset += 4;
988 break;
989 case PSM_MEDIUM_DATA:
990 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
991 local_offset += 4;
992 local_offset += 8;
993 proto_tree_add_item(PSM_header_tree, hf_opa_psm_offset, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
994 local_offset += 4;
995 proto_tree_add_item(PSM_header_tree, hf_opa_psm_paylen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
996 local_offset += 4;
997 break;
998 case PSM_LONG_RTS:
999 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
1000 local_offset += 4;
1001 proto_tree_add_item(PSM_header_tree, hf_opa_psm_tag, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1002 local_offset += 8;
1003 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msglen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1004 local_offset += 4;
1005 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sreqidx, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1006 local_offset += 4;
1007 break;
1008 case PSM_LONG_CTS:
1009 local_offset += 4;
1010 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sreqidx, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1011 local_offset += 4;
1012 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rreqidx, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1013 local_offset += 4;
1014 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msglen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1015 local_offset += 8;
1016 break;
1017 case PSM_LONG_DATA:
1018 local_offset += 4;
1019 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rreqidx, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1020 local_offset += 4;
1021 proto_tree_add_item(PSM_header_tree, hf_opa_psm_offset, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1022 local_offset += 4;
1023 proto_tree_add_item(PSM_header_tree, hf_opa_psm_paylen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1024 local_offset += 8;
1025 break;
1026 case PSM_TIDS_GRANT:
1027 local_offset += 4;
1028 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sreqidx, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1029 local_offset += 4;
1030 proto_tree_add_item(PSM_header_tree, hf_opa_psm_short_msglen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1031 local_offset += 4;
1032 proto_tree_add_item(PSM_header_tree, hf_opa_psm_paylen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1033 local_offset += 8;
1034 break;
1035 case PSM_TIDS_GRANT_ACK:
1036 local_offset += 4;
1037 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1038 local_offset += 8;
1039 local_offset += 8;
1040 break;
1041 case PSM_TIDS_RELEASE:
1042 local_offset += 4;
1043 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1044 local_offset += 8;
1045 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1046 local_offset += 8;
1047 break;
1048 case PSM_TIDS_RELEASE_CONFIRM:
1049 local_offset += 4;
1050 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1051 local_offset += 8;
1052 local_offset += 8;
1053 break;
1054 case PSM_EXPTID_UNALIGNED:
1055 local_offset += 4;
1056 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1057 local_offset += 8;
1058 local_offset += 8;
1059 break;
1060 case PSM_EXPTID:
1061 local_offset += 4;
1062 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1063 local_offset += 8;
1064 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1065 local_offset += 8;
1066 break;
1067 case PSM_ACK:
1068 local_offset += 4;
1069 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1070 local_offset += 8;
1071 local_offset += 8;
1072 break;
1073 case PSM_NAK:
1074 local_offset += 4;
1075 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1076 local_offset += 8;
1077 proto_tree_add_item(PSM_header_tree, hf_opa_psm_psn, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1078 local_offset += 8;
1079 break;
1080 case PSM_ERR_CHK:
1081 case PSM_ERR_CHK_BAD:
1082 local_offset += 4;
1083 proto_tree_add_item(PSM_header_tree, hf_opa_psm_hostipv4, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1084 local_offset += 4;
1085 proto_tree_add_item(PSM_header_tree, hf_opa_psm_hostpid, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1086 local_offset += 12;
1087 break;
1088 case PSM_ERR_CHK_GEN:
1089 local_offset += 4;
1090 proto_tree_add_item(PSM_header_tree, hf_opa_psm_rdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1091 local_offset += 8;
1092 proto_tree_add_item(PSM_header_tree, hf_opa_psm_sdescid, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1093 local_offset += 8;
1094 break;
1095 case PSM_FLOW_CCA_BECN:
1096 break;
1097 case PSM_CONNECT_REQUEST:
1098 case PSM_CONNECT_REPLY:
1099 case PSM_DISCONNECT_REQUEST:
1100 case PSM_DISCONNECT_REPLY:
1101 local_offset += 4;
1102 proto_tree_add_item(PSM_header_tree, hf_opa_psm_paylen, tvb, local_offset, 4, ENC_LITTLE_ENDIAN);
1103 local_offset += 16;
1104 break;
1105 case PSM_AM_REQUEST_NOREPLY:
1106 case PSM_AM_REQUEST:
1107 case PSM_AM_REPLY:
1108 proto_tree_add_item(PSM_header_tree, hf_opa_psm_dlen, tvb, local_offset + 3, 1, ENC_LITTLE_ENDIAN);
1109 proto_tree_add_item(PSM_header_tree, hf_opa_psm_nargs, tvb, local_offset + 3, 1, ENC_LITTLE_ENDIAN);
1110 proto_tree_add_item(PSM_header_tree, hf_opa_psm_hidx, tvb, local_offset + 2, 1, ENC_LITTLE_ENDIAN);
1111 proto_tree_add_item(PSM_header_tree, hf_opa_psm_msgseq, tvb, local_offset, 2, ENC_LITTLE_ENDIAN);
1112 local_offset += 4;
1113 proto_tree_add_item(PSM_header_tree, hf_opa_psm_arg, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1114 local_offset += 8;
1115 proto_tree_add_item(PSM_header_tree, hf_opa_psm_arg, tvb, local_offset, 8, ENC_LITTLE_ENDIAN);
1116 local_offset += 8;
1117 break;
1119 *offset = local_offset;
1121 static void parse_TIDRDMA(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, int opCode, bool *parsePayload)
1123 int local_offset = *offset;
1124 proto_item *TIDRDMA_header_item;
1125 proto_tree *TIDRDMA_header_tree;
1127 switch (opCode) {
1128 case TID_RDMA_WRITE_REQUEST:
1129 parse_RETH(tvb, pinfo, tree, &local_offset);
1130 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Write Request: ");
1131 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 12, ENC_NA);
1132 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Write Request Header");
1133 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1135 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 8, ENC_NA);
1136 local_offset += 8;
1138 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1139 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1140 local_offset += 4;
1142 *parsePayload = false;
1143 break;
1144 case TID_RDMA_WRITE_RESPONSE:
1145 parse_AETH(tvb, pinfo, tree, &local_offset);
1146 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Write Response: ");
1147 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 24, ENC_NA);
1148 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Write Response Header");
1149 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1151 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 12, ENC_NA);
1152 local_offset += 12;
1154 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1155 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1156 local_offset += 4;
1157 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1158 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1159 local_offset += 4;
1160 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1161 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1162 local_offset += 4;
1164 *parsePayload = false;
1165 break;
1166 case TID_RDMA_WRITE_DATA:
1167 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Write Data: ");
1168 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 28, ENC_NA);
1169 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Write Data Header");
1170 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1172 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 24, ENC_NA);
1173 local_offset += 24;
1175 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1176 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1177 local_offset += 4;
1179 *parsePayload = true;
1180 break;
1181 case TID_RDMA_WRITE_DATA_LAST:
1182 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Write Data Last: ");
1183 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 28, ENC_NA);
1184 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Write Data Last Header");
1185 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1187 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 24, ENC_NA);
1188 local_offset += 24;
1190 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1191 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1192 local_offset += 4;
1194 *parsePayload = true;
1195 break;
1196 case TID_RDMA_READ_REQUEST:
1197 parse_RETH(tvb, pinfo, tree, &local_offset);
1198 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Read Request: ");
1199 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 12, ENC_NA);
1200 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Read Request Header");
1201 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1203 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1204 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1205 local_offset += 4;
1206 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1207 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1208 local_offset += 4;
1209 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1210 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1211 local_offset += 4;
1213 *parsePayload = false;
1214 break;
1215 case TID_RDMA_READ_RESPONSE:
1216 parse_AETH(tvb, pinfo, tree, &local_offset);
1217 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Read Response: ");
1218 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 24, ENC_NA);
1219 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Read Response Header");
1220 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1222 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 16, ENC_NA);
1223 local_offset += 16;
1225 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsPSN_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1226 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsPSN, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1227 local_offset += 4;
1228 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1229 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1230 local_offset += 4;
1232 *parsePayload = true;
1233 break;
1234 case TID_RDMA_RESYNC:
1235 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA Read ReSync: ");
1236 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 28, ENC_NA);
1237 proto_item_set_text(TIDRDMA_header_item, "TID RDMA Read ReSync Header");
1238 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1240 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 24, ENC_NA);
1241 local_offset += 24;
1243 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1244 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1245 local_offset += 4;
1247 *parsePayload = false;
1248 break;
1249 case TID_RDMA_ACK:
1250 parse_AETH(tvb, pinfo, tree, &local_offset);
1251 col_append_str(pinfo->cinfo, COL_INFO, "TID RDMA ACK: ");
1252 TIDRDMA_header_item = proto_tree_add_item(tree, hf_opa_TIDRDMA, tvb, local_offset, 24, ENC_NA);
1253 proto_item_set_text(TIDRDMA_header_item, "TID RDMA ACK Header");
1254 TIDRDMA_header_tree = proto_item_add_subtree(TIDRDMA_header_item, ett_tidrdma);
1256 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_reserved, tvb, local_offset, 8, ENC_NA);
1257 local_offset += 8;
1259 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1260 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowPSN, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1261 local_offset += 4;
1262 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsPSN_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1263 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsPSN, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1264 local_offset += 4;
1265 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1266 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_TIDFlowQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1267 local_offset += 4;
1268 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP_reserved, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1269 proto_tree_add_item(TIDRDMA_header_tree, hf_opa_TIDRDMA_VerbsQP, tvb, local_offset, 4, ENC_BIG_ENDIAN);
1270 local_offset += 4;
1272 *parsePayload = false;
1273 break;
1274 default:
1275 *parsePayload = false;
1277 *offset = local_offset;
1279 static void parse_IPvSix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
1281 call_dissector(ipv6_handle, tvb_new_subset_remaining(tvb, *offset), pinfo, tree);
1282 *offset = tvb_reported_length(tvb);
1285 static int dissect_opa_9b(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1287 proto_item *opa_packet;
1289 /* TVB to pass to opa header */
1290 tvbuff_t *opa_tvb;
1291 /* TVB to pass to infiniband header */
1292 tvbuff_t *infiniband_tvb;
1294 int offset = 0; /* Current Offset */
1295 int ib_offset = 0; /* Offset to track if IB packet */
1296 int captured_length, reported_length;
1297 uint8_t lnh_val = 0;
1298 bool bthFollows = false;
1299 bool parsePayload = false;
1300 int32_t nextHeaderSequence = -1;
1301 uint8_t nextHdr = 0, opCode = 0;
1302 uint8_t baseVersion = 0;
1304 /* Infiniband Check */
1305 lnh_val = tvb_get_uint8(tvb, ib_offset + 1) & 0x3;
1306 if (lnh_val == 3) {
1307 nextHdr = tvb_get_uint8(tvb, ib_offset + 6);
1308 ib_offset += 40;
1310 if (lnh_val == 2 || nextHdr == 0x1B) {
1311 opCode = tvb_get_uint8(tvb, ib_offset + 8);
1312 if (opCode == 0x64) {
1313 baseVersion = tvb_get_uint8(tvb, ib_offset + 28);
1314 if (baseVersion == 0x01) {
1315 infiniband_tvb = tvb_new_subset_remaining(tvb, offset);
1316 call_dissector(infiniband_handle, infiniband_tvb, pinfo, tree);
1317 return tvb_captured_length(tvb);
1322 tree = proto_tree_get_parent_tree(tree);
1324 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Omni-Path");
1325 col_clear(pinfo->cinfo, COL_INFO);
1327 pinfo->srcport = pinfo->destport = 0xffffffff;
1329 opa_packet = proto_tree_add_item(tree, proto_opa_9b, tvb, offset, -1, ENC_NA);
1331 /* Headers Level Tree */
1332 tree = proto_item_add_subtree(opa_packet, ett_all_headers);
1333 parse_opa_9B_Header(tvb, pinfo, tree, &offset, &lnh_val);
1335 switch (lnh_val) {
1336 case 3: /* GLOBAL - GRH - Global Route Header */
1337 parse_opa_grh(tvb, pinfo, tree, &offset, &nextHdr);
1338 if (nextHdr != 0x1B) { /* no BTH following. */
1339 break;
1341 /* FALL THROUGH */
1342 case 2: /* LOCAL - BTH - Base Transport Header */
1343 parse_opa_bth(tvb, pinfo, tree, &offset, &opCode);
1344 bthFollows = true;
1345 break;
1346 case 1: /* NON OPA - IPv6 Packet */
1347 set_address(&pinfo->dst, AT_STRINGZ, (int)strlen("IPv6 over OPA Packet") + 1,
1348 wmem_strdup(pinfo->pool, "IPv6 over OPA Packet"));
1350 parse_IPvSix(tvb, pinfo, tree, &offset);
1352 break;
1353 case 0: /* RAW */
1355 break;
1356 default:
1357 break;
1360 if (bthFollows) {
1361 /* Save transport type for identifying EoOPA payloads later */
1362 nextHeaderSequence = find_next_header_sequence((uint32_t)opCode);
1363 switch (nextHeaderSequence) {
1364 case RDETH_DETH_PAYLD:
1365 parse_RDETH(tvb, pinfo, tree, &offset);
1366 parse_DETH(tvb, pinfo, tree, &offset);
1368 parsePayload = true;
1369 break;
1370 case RDETH_DETH_RETH_PAYLD:
1371 parse_RDETH(tvb, pinfo, tree, &offset);
1372 parse_DETH(tvb, pinfo, tree, &offset);
1373 parse_RETH(tvb, pinfo, tree, &offset);
1375 parsePayload = true;
1376 break;
1377 case RDETH_DETH_IMMDT_PAYLD:
1378 parse_RDETH(tvb, pinfo, tree, &offset);
1379 parse_DETH(tvb, pinfo, tree, &offset);
1380 parse_IMMDT(tvb, pinfo, tree, &offset);
1382 parsePayload = true;
1383 break;
1384 case RDETH_DETH_RETH_IMMDT_PAYLD:
1385 parse_RDETH(tvb, pinfo, tree, &offset);
1386 parse_DETH(tvb, pinfo, tree, &offset);
1387 parse_RETH(tvb, pinfo, tree, &offset);
1388 parse_IMMDT(tvb, pinfo, tree, &offset);
1390 parsePayload = true;
1391 break;
1392 case RDETH_DETH_RETH:
1393 parse_RDETH(tvb, pinfo, tree, &offset);
1394 parse_DETH(tvb, pinfo, tree, &offset);
1395 parse_RETH(tvb, pinfo, tree, &offset);
1397 break;
1398 case RDETH_AETH_PAYLD:
1399 parse_RDETH(tvb, pinfo, tree, &offset);
1400 parse_AETH(tvb, pinfo, tree, &offset);
1402 parsePayload = true;
1403 break;
1404 case RDETH_PAYLD:
1405 parse_RDETH(tvb, pinfo, tree, &offset);
1407 parsePayload = true;
1408 break;
1409 case RDETH_AETH:
1410 parse_AETH(tvb, pinfo, tree, &offset);
1412 break;
1413 case RDETH_AETH_ATOMICACKETH:
1414 parse_RDETH(tvb, pinfo, tree, &offset);
1415 parse_AETH(tvb, pinfo, tree, &offset);
1416 parse_ATOMICACKETH(tvb, pinfo, tree, &offset);
1418 break;
1419 case RDETH_DETH_ATOMICETH:
1420 parse_RDETH(tvb, pinfo, tree, &offset);
1421 parse_DETH(tvb, pinfo, tree, &offset);
1422 parse_ATOMICETH(tvb, pinfo, tree, &offset);
1424 break;
1425 case RDETH_DETH:
1426 parse_RDETH(tvb, pinfo, tree, &offset);
1427 parse_DETH(tvb, pinfo, tree, &offset);
1429 break;
1430 case DETH_PAYLD:
1431 parse_DETH(tvb, pinfo, tree, &offset);
1433 parsePayload = true;
1434 break;
1435 case PAYLD:
1437 parsePayload = true;
1438 break;
1439 case IMMDT_PAYLD:
1440 parse_IMMDT(tvb, pinfo, tree, &offset);
1442 parsePayload = true;
1443 break;
1444 case RETH_PAYLD:
1445 parse_RETH(tvb, pinfo, tree, &offset);
1447 parsePayload = true;
1448 break;
1449 case RETH:
1450 parse_RETH(tvb, pinfo, tree, &offset);
1452 break;
1453 case AETH_PAYLD:
1454 parse_AETH(tvb, pinfo, tree, &offset);
1456 parsePayload = true;
1457 break;
1458 case AETH:
1459 parse_AETH(tvb, pinfo, tree, &offset);
1461 break;
1462 case AETH_ATOMICACKETH:
1463 parse_AETH(tvb, pinfo, tree, &offset);
1464 parse_ATOMICACKETH(tvb, pinfo, tree, &offset);
1466 break;
1467 case ATOMICETH:
1468 parse_ATOMICETH(tvb, pinfo, tree, &offset);
1470 break;
1471 case IETH_PAYLD:
1472 parse_IETH(tvb, pinfo, tree, &offset);
1474 parsePayload = true;
1475 break;
1476 case DETH_IMMDT_PAYLD:
1477 parse_DETH(tvb, pinfo, tree, &offset);
1478 parse_IMMDT(tvb, pinfo, tree, &offset);
1480 parsePayload = true;
1481 break;
1482 case KDETH_PSM:
1483 parse_KDETH(tvb, pinfo, tree, &offset);
1484 parse_PSM(tvb, pinfo, tree, &offset, opCode);
1486 break;
1487 case KDETH_TIDRDMA:
1488 parse_KDETH(tvb, pinfo, tree, &offset);
1489 parse_TIDRDMA(tvb, pinfo, tree, &offset, opCode, &parsePayload);
1491 break;
1492 default:
1493 break;
1495 } /* END: switch (nextHeaderSequence) */
1497 if (parsePayload) {
1498 /* Pass to OPA MAD dissector */
1499 captured_length = tvb_captured_length_remaining(tvb, offset);
1500 reported_length = tvb_reported_length_remaining(tvb, offset);
1502 if (reported_length >= 4)
1503 reported_length -= 4;
1504 if (captured_length > reported_length)
1505 captured_length = reported_length;
1507 if (captured_length > 0) {
1508 opa_tvb = tvb_new_subset_length_caplen(tvb, offset, captured_length, reported_length);
1509 call_dissector(opa_mad_handle, opa_tvb, pinfo, tree);
1510 offset += captured_length;
1513 } /* END: if(bthFollows) */
1515 /* Display the ICRC */
1516 reported_length = tvb_reported_length_remaining(tvb, offset);
1517 if (reported_length != 4) {
1518 offset += reported_length - 4;
1520 proto_tree_add_item(tree, hf_opa_9b_ICRC, tvb, offset, 4, ENC_BIG_ENDIAN);
1521 offset += 4;
1522 return offset;
1524 void proto_register_opa_9b(void)
1526 static hf_register_info hf[] = {
1527 /* L2Header(9B) */
1528 { &hf_opa_9B, {
1529 "Omni-Path 9B Header", "opa.9b",
1530 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1532 { &hf_opa_9B_service_channel, {
1533 "Service Channel", "opa.9b.sc",
1534 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }
1536 { &hf_opa_9B_link_version, {
1537 "Link Version", "opa.9b.linkversion",
1538 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }
1540 { &hf_opa_9B_service_level, {
1541 "Service Level", "opa.9b.sl",
1542 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }
1544 { &hf_opa_9B_reserved2, {
1545 "Reserved (2 bits)", "opa.9b.reserved2",
1546 FT_UINT8, BASE_HEX, NULL, 0x0C, NULL, HFILL }
1548 { &hf_opa_9B_lnh, {
1549 "Link Next Header", "opa.9b.lnh",
1550 FT_UINT8, BASE_DEC, VALS(vals_opa_9b_lnh), 0x03, NULL, HFILL }
1552 { &hf_opa_9B_dlid, {
1553 "Dest LID", "opa.9b.dlid",
1554 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1556 { &hf_opa_9B_reserved3, {
1557 "Reserved (4 bits)", "opa.9b.reserved3",
1558 FT_UINT16, BASE_HEX, NULL, 0xF000, NULL, HFILL }
1560 { &hf_opa_9B_packet_length, {
1561 "Packet Length", "opa.length",
1562 FT_UINT16, BASE_CUSTOM, CF_FUNC(cf_opa_dw_to_b), 0x0FFF, NULL, HFILL }
1564 { &hf_opa_9B_slid, {
1565 "Source LID", "opa.9b.slid",
1566 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1568 { &hf_opa_9b_ICRC, {
1569 "Invariant CRC", "opa.9b.icrc",
1570 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1573 /* Global Route Header */
1574 { &hf_opa_grh, {
1575 "GRH - Global Route Header", "opa.grh",
1576 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1578 { &hf_opa_grh_ip_version, {
1579 "IP Version", "opa.grh.ipver",
1580 FT_UINT8, BASE_DEC, VALS(vals_opa_9b_grh_ipver), 0xF0, NULL, HFILL }
1582 { &hf_opa_grh_traffic_class, {
1583 "Traffic Class", "opa.grh.tclass",
1584 FT_UINT16, BASE_DEC, NULL, 0x0FF0, NULL, HFILL }
1586 { &hf_opa_grh_flow_label, {
1587 "Flow Label", "opa.grh.flowlabel",
1588 FT_UINT32, BASE_DEC, NULL, 0x000FFFFF, NULL, HFILL }
1590 { &hf_opa_grh_payload_length, {
1591 "Payload Length", "opa.grh.paylen",
1592 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1594 { &hf_opa_grh_next_header, {
1595 "Next Header", "opa.grh.nxthdr",
1596 FT_UINT8, BASE_DEC, VALS(vals_opa_9b_grh_next_hdr), 0x0, NULL, HFILL }
1598 { &hf_opa_grh_hop_limit, {
1599 "Hop Limit", "opa.grh.hoplmt",
1600 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1602 { &hf_opa_grh_source_gid, {
1603 "Source GID", "opa.grh.sgid",
1604 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
1606 { &hf_opa_grh_destination_gid, {
1607 "Destination GID", "opa.grh.dgid",
1608 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
1611 /* Base Transport Header */
1612 { &hf_opa_bth, {
1613 "BTH - Base Transport Header", "opa.bth",
1614 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1616 { &hf_opa_bth_opcode, {
1617 "Opcode", "opa.bth.opcode",
1618 FT_UINT8, BASE_HEX, VALS(vals_opa_bth_opcode), 0x0, NULL, HFILL }
1620 { &hf_opa_bth_solicited_event, {
1621 "Solicited Event", "opa.bth.se",
1622 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }
1624 { &hf_opa_bth_migreq, {
1625 "MigReq", "opa.bth.m",
1626 FT_BOOLEAN, 8, TFS(&tfs_opa_bth_migrated_notmigrated), 0x40, NULL, HFILL }
1628 { &hf_opa_bth_pad_count, {
1629 "Pad Count", "opa.bth.padcnt",
1630 FT_UINT8, BASE_DEC, NULL, 0x30, NULL, HFILL }
1632 { &hf_opa_bth_transport_header_version, {
1633 "Header Version", "opa.bth.tver",
1634 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }
1636 { &hf_opa_bth_partition_key, {
1637 "Partition Key", "opa.bth.p_key",
1638 FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }
1640 { &hf_opa_bth_fcn, {
1641 "FCN", "opa.bth.fcn",
1642 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }
1644 { &hf_opa_bth_bcn, {
1645 "BCN", "opa.bth.bcn",
1646 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40, NULL, HFILL }
1648 { &hf_opa_bth_Reserved8a, {
1649 "Reserved (6 bits)", "opa.bth.reserved8a",
1650 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL }
1652 { &hf_opa_bth_destination_qp, {
1653 "Destination Queue Pair", "opa.bth.destqp",
1654 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
1656 { &hf_opa_bth_acknowledge_request, {
1657 "Acknowledge Request", "opa.bth.a",
1658 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }
1660 { &hf_opa_bth_packet_sequence_number, {
1661 "Packet Sequence Number", "opa.bth.psn",
1662 FT_UINT32, BASE_DEC, NULL, 0x7FFFFFFF, NULL, HFILL }
1665 /* Reliable Datagram Extended Transport Header (RDETH) */
1666 { &hf_opa_RDETH, {
1667 "RDETH - Reliable Datagram Extended Transport Header", "opa.rdeth",
1668 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1670 { &hf_opa_RDETH_reserved8, {
1671 "Reserved (8 bits)", "opa.rdeth.reserved",
1672 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1674 { &hf_opa_RDETH_ee_context, {
1675 "EE Context", "opa.rdeth.eecnxt",
1676 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }
1679 /* Datagram Extended Transport Header (DETH) */
1680 { &hf_opa_DETH, {
1681 "DETH - Datagram Extended Transport Header", "opa.deth",
1682 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1684 { &hf_opa_DETH_queue_key, {
1685 "Queue Key", "opa.deth.q_key",
1686 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1688 { &hf_opa_DETH_reserved8, {
1689 "Reserved (8 bits)", "opa.deth.reserved",
1690 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1692 { &hf_opa_DETH_source_qp, {
1693 "Source Queue Pair", "opa.deth.srcqp",
1694 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
1697 /* RDMA Extended Transport Header (RETH) */
1698 { &hf_opa_RETH, {
1699 "RETH - RDMA Extended Transport Header", "opa.reth",
1700 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1702 { &hf_opa_RETH_virtual_address, {
1703 "Virtual Address", "opa.reth.va",
1704 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1706 { &hf_opa_RETH_remote_key, {
1707 "Remote Key", "opa.reth.r_key",
1708 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1710 { &hf_opa_RETH_dma_length, {
1711 "DMA Length", "opa.reth.dmalen",
1712 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1715 /* Atomic Extended Transport Header (AtomicETH) */
1716 { &hf_opa_AtomicETH, {
1717 "AtomicETH - Atomic Extended Transport Header", "opa.atomiceth",
1718 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1720 { &hf_opa_AtomicETH_virtual_address, {
1721 "Virtual Address", "opa.atomiceth.va",
1722 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
1724 { &hf_opa_AtomicETH_remote_key, {
1725 "Remote Key", "opa.atomiceth.r_key",
1726 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1728 { &hf_opa_AtomicETH_swap_or_add_data, {
1729 "Swap (Or Add) Data", "opa.atomiceth.swapdt",
1730 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
1732 { &hf_opa_AtomicETH_compare_data, {
1733 "Compare Data", "opa.atomiceth.cmpdt",
1734 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
1737 /* ACK Extended Transport Header (AETH) */
1738 { &hf_opa_AETH, {
1739 "AETH - ACK Extended Transport Header", "opa.aeth",
1740 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1742 { &hf_opa_AETH_syndrome, {
1743 "Syndrome", "opa.aeth.syndrome",
1744 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1746 { &hf_opa_AETH_message_sequence_number, {
1747 "Message Sequence Number", "opa.aeth.msn",
1748 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }
1751 /* Atomic ACK Extended Transport Header (AtomicAckETH) */
1752 { &hf_opa_AtomicAckETH, {
1753 "AtomicAckETH - Atomic ACK Extended Transport Header", "opa.atomicacketh",
1754 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1756 { &hf_opa_AtomicAckETH_original_remote_data, {
1757 "Original Remote Data", "opa.atomicacketh.origremdt",
1758 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
1761 /* Immediate Extended Transport Header (ImmDT) */
1762 { &hf_opa_IMMDT, {
1763 "IMMDT - Immediate Extended Transport Header", "opa.immdt",
1764 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1766 { &hf_opa_IMMDT_data, {
1767 "Immediate Data", "opa.immdt.data",
1768 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1771 /* Invalidate Extended Transport Header (IETH) */
1772 { &hf_opa_IETH, {
1773 "IETH - Invalidate Extended Transport Header", "opa.ieth",
1774 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1776 { &hf_opa_IETH_r_key, {
1777 "RKey", "opa.ieth.r_key",
1778 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1781 /* Key Datagram Extended Transport Header (KDETH) */
1782 { &hf_opa_KDETH, {
1783 "KDETH - Key Datagram Extended Transport Header", "opa.kdeth",
1784 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1786 { &hf_opa_KDETH_kver, {
1787 "KDETH Version Field", "opa.kdeth.kver",
1788 FT_UINT32, BASE_HEX, NULL, 0xC0000000, NULL, HFILL }
1790 { &hf_opa_KDETH_sh, {
1791 "SuppressHeader", "opa.kdeth.sh",
1792 FT_BOOLEAN, 32, NULL, 0x20000000, NULL, HFILL }
1794 { &hf_opa_KDETH_intr, {
1795 "InterruptBit", "opa.kdeth.intr",
1796 FT_BOOLEAN, 32, NULL, 0x10000000, NULL, HFILL }
1798 { &hf_opa_KDETH_tidctrl, {
1799 "TokenIDCtrl", "opa.kdeth.tidctrl",
1800 FT_UINT32, BASE_HEX, NULL, 0x0C000000, NULL, HFILL }
1802 { &hf_opa_KDETH_tid, {
1803 "TokenID", "opa.kdeth.tid",
1804 FT_UINT32, BASE_HEX, NULL, 0x03FF0000, NULL, HFILL }
1806 { &hf_opa_KDETH_offset_mode, {
1807 "Offset Mode", "opa.kdeth.offsetmode",
1808 FT_BOOLEAN, 32, TFS(&tfs_opa_kdeth_offset_32_64), 0x00008000, NULL, HFILL }
1810 { &hf_opa_KDETH_offset, {
1811 "Offset", "opa.kdeth.offset",
1812 FT_UINT32, BASE_HEX, NULL, 0x00007FFF, NULL, HFILL }
1814 { &hf_opa_KDETH_hcrc, {
1815 "HCRC", "opa.kdeth.hcrc",
1816 FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL }
1818 { &hf_opa_KDETH_j_key, {
1819 "J_Key", "opa.kdeth.j_key",
1820 FT_UINT32, BASE_HEX, NULL, 0x0000FFFF, NULL, HFILL }
1823 /* PSM */
1824 { &hf_opa_psm, {
1825 "PSM Header", "opa.psm",
1826 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1828 { &hf_opa_psm_a, {
1829 "ACKFlag", "opa.psm.a",
1830 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
1832 { &hf_opa_psm_ackpsn, {
1833 "ACKPSN", "opa.psm.ackpsn",
1834 FT_UINT32, BASE_DEC, NULL, 0x7FFF, NULL, HFILL }
1836 { &hf_opa_psm_flags, {
1837 "Flags", "opa.psm.flags",
1838 FT_UINT8, BASE_DEC, NULL, 0xFC, NULL, HFILL }
1840 { &hf_opa_psm_commidx, {
1841 "CommIdx", "opa.psm.commidx",
1842 FT_UINT32, BASE_HEX, NULL, 0x3FFF, NULL, HFILL }
1844 { &hf_opa_psm_flowid, {
1845 "FlowId", "opa.psm.flowid",
1846 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }
1848 /* PSM opcode specific */
1849 { &hf_opa_psm_msglen, {
1850 "MsgLen", "opa.psm.msglen",
1851 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1853 { &hf_opa_psm_msgseq, {
1854 "MsqSeq", "opa.psm.msgseq",
1855 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1857 { &hf_opa_psm_tag, {
1858 "Tag", "opa.psm.tag",
1859 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1861 { &hf_opa_psm_msgdata, {
1862 "MsqData", "opa.psm.msgdata",
1863 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1865 { &hf_opa_psm_short_msglen, {
1866 "MsgLen", "opa.psm.short.msglen",
1867 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1869 { &hf_opa_psm_paylen, {
1870 "PayLen", "opa.psm.paylen",
1871 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1873 { &hf_opa_psm_offset, {
1874 "Offset", "opa.psm.offset",
1875 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1877 { &hf_opa_psm_sreqidx, {
1878 "SreqIdx", "opa.psm.sreqidx",
1879 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1881 { &hf_opa_psm_rreqidx, {
1882 "RreqIdx", "opa.psm.rreqidx",
1883 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1885 { &hf_opa_psm_rdescid, {
1886 "RdescId", "opa.psm.rdescid",
1887 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1889 { &hf_opa_psm_sdescid, {
1890 "SdescId", "opa.psm.sdescid",
1891 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1893 { &hf_opa_psm_psn, {
1894 "PSN", "opa.psm.psn",
1895 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1897 { &hf_opa_psm_hostipv4, {
1898 "HostIPv4Addr", "opa.psm.hostipv4",
1899 FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1901 { &hf_opa_psm_hostpid, {
1902 "HostPid", "opa.psm.hostpid",
1903 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1905 { &hf_opa_psm_dlen, {
1906 "Datalength", "opa.psm.dlen",
1907 FT_UINT8, BASE_DEC, NULL, 0x38, NULL, HFILL }
1909 { &hf_opa_psm_nargs, {
1910 "NumberArgs", "opa.psm.nargs",
1911 FT_UINT32, BASE_DEC, NULL, 0x07, NULL, HFILL }
1913 { &hf_opa_psm_hidx, {
1914 "HandlerIndex", "opa.psm.hidx",
1915 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1917 { &hf_opa_psm_arg, {
1918 "Argument", "opa.psm.arg",
1919 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
1921 { &hf_opa_psm_payload, {
1922 "Payload", "opa.psm.payload",
1923 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1925 { &hf_opa_TIDRDMA, {
1926 "TID RDMA Header", "opa.tidrdma",
1927 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1929 { &hf_opa_TIDRDMA_reserved, {
1930 "Reserved", "opa.tidrdma.reserved",
1931 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1933 { &hf_opa_TIDRDMA_TIDFlowPSN_reserved, {
1934 "Reserved (1 bit)", "opa.tidrdma.tidflowpsn.reserved",
1935 FT_UINT32, BASE_HEX, NULL, 0x80000000, NULL, HFILL }
1937 { &hf_opa_TIDRDMA_TIDFlowPSN, {
1938 "TID Flow PSN", "opa.tidrdma.tidflowpsn",
1939 FT_UINT32, BASE_HEX, NULL, 0x7FFFFFFF, NULL, HFILL }
1941 { &hf_opa_TIDRDMA_TIDFlowQP_reserved, {
1942 "Reserved (8 bits)", "opa.tidrdma.tidflowqp.reserved",
1943 FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }
1945 { &hf_opa_TIDRDMA_TIDFlowQP, {
1946 "TID Flow QP", "opa.tidrdma.tidflowqp",
1947 FT_UINT32, BASE_HEX, NULL, 0x00FFFFFF, NULL, HFILL }
1949 { &hf_opa_TIDRDMA_VerbsPSN_reserved, {
1950 "Reserved (1 bit)", "opa.tidrdma.verbspsn.reserved",
1951 FT_UINT32, BASE_HEX, NULL, 0x80000000, NULL, HFILL }
1953 { &hf_opa_TIDRDMA_VerbsPSN, {
1954 "Verbs PSN", "opa.tidrdma.verbspsn",
1955 FT_UINT32, BASE_HEX, NULL, 0x7FFFFFFF, NULL, HFILL }
1957 { &hf_opa_TIDRDMA_VerbsQP_reserved, {
1958 "Reserved (8 bits)", "opa.tidrdma.verbsqp.reserved",
1959 FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }
1961 { &hf_opa_TIDRDMA_VerbsQP, {
1962 "Verbs QP", "opa.tidrdma.verbsqp",
1963 FT_UINT32, BASE_HEX, NULL, 0x00FFFFFF, NULL, HFILL }
1967 static int *ett[] = {
1968 &ett_all_headers,
1969 &ett_9b,
1970 &ett_grh,
1971 &ett_bth,
1972 &ett_rdeth,
1973 &ett_deth,
1974 &ett_reth,
1975 &ett_atomiceth,
1976 &ett_aeth,
1977 &ett_atomicacketh,
1978 &ett_immdt,
1979 &ett_ieth,
1980 &ett_kdeth,
1981 &ett_psm,
1982 &ett_tidrdma
1985 proto_opa_9b = proto_register_protocol("Intel Omni-Path", "OPA", "opa");
1986 opa_9b_handle = register_dissector("opa", dissect_opa_9b, proto_opa_9b);
1988 proto_register_field_array(proto_opa_9b, hf, array_length(hf));
1989 proto_register_subtree_array(ett, array_length(ett));
1992 void proto_reg_handoff_opa_9b(void)
1994 ipv6_handle = find_dissector("ipv6");
1995 opa_mad_handle = find_dissector("opa.mad");
1996 infiniband_handle = find_dissector("infiniband");
1998 /* announce an anonymous Omni-Path 9B dissector */
1999 dissector_add_uint("erf.types.type", ERF_TYPE_OPA_9B, opa_9b_handle);
2004 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2006 * Local variables:
2007 * c-basic-offset: 4
2008 * tab-width: 8
2009 * indent-tabs-mode: nil
2010 * End:
2012 * vi: set shiftwidth=4 tabstop=8 expandtab:
2013 * :indentSize=4:tabSize=8:noTabs=true: