From Didier Gautheron:
[obnox/wireshark/wip.git] / epan / dissectors / packet-infiniband.c
1 /* packet-infiniband.c
2  * Routines for Infiniband/ERF Dissection
3  * Copyright 2008 Endace Technology Limited
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include <epan/proto.h>
35 #include <epan/dissectors/packet-frame.h>
36 #include "packet-infiniband.h"
37
38 /* Main Dissector */
39 /* Notes: */
40 /* 1.) Floating "offset+=" statements should probably be "functionized" but they are inline */
41 /* Offset is only passed by reference in specific places, so do not be confused when following code */
42 /* In any code path, adding up "offset+=" statements will tell you what byte you are at */
43 static void
44 dissect_infiniband(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
45 {
46     /* Top Level Item */
47     proto_item *infiniband_packet = NULL;
48
49     /* The Headers Subtree */
50     proto_tree *all_headers_tree = NULL;
51
52     /* LRH - Local Route Header */
53     proto_tree *local_route_header_tree = NULL;
54     proto_item *local_route_header_item = NULL;
55
56     /* GRH - Global Route Header */
57     proto_tree *global_route_header_tree = NULL;
58     proto_item *global_route_header_item = NULL;
59
60     /* BTH - Base Transport header */
61     proto_tree *base_transport_header_tree = NULL;
62     proto_item *base_transport_header_item = NULL;
63
64     /* Raw Data */
65     proto_tree *RAWDATA_header_tree;
66     proto_item *RAWDATA_header_item;
67     guint8 lnh_val = 0;             /* Link Next Header Value */
68     gint offset = 0;                /* Current Offset */
69
70     /* General Variables */
71     gboolean bthFollows = 0;        /* Tracks if we are parsing a BTH.  This is a significant decision point */
72     guint8 virtualLane = 0;         /* IB VirtualLane.  Keyed off of for detecting subnet admin/management */
73     guint8 opCode = 0;              /* OpCode from BTH header. */
74     gint32 nextHeaderSequence = -1; /* defined by this dissector. #define which indicates the upcoming header sequence from OpCode */
75     guint16 payloadLength = 0;      /* Payload Length should it exist */
76     guint8 nxtHdr = 0;              /* Keyed off for header dissection order */
77     guint16 packetLength = 0;       /* Packet Length.  We track this as tvb->length - offset.   */
78                                     /*  It provides the parsing methods a known size            */
79                                     /*   that must be available for that header.                */
80     struct e_in6_addr SRCgid;       /* Structures to hold GIDs should we need them */
81     struct e_in6_addr DSTgid;
82     gint crc_length = 0;
83
84     /* Mark the Packet type as Infiniband in the wireshark UI */
85     /* Clear other columns */
86     if(pinfo->cinfo)
87     {
88         col_set_str(pinfo->cinfo, COL_PROTOCOL, "InfiniBand");
89         col_clear(pinfo->cinfo, COL_INFO);
90     }
91
92     /* Get the parent tree from the ERF dissector.  We don't want to nest under ERF */
93     if(tree && tree->parent)
94     {
95         /* Set the normal tree outside of ERF */
96         tree = tree->parent;
97         /* Set a global reference for nested protocols */
98         top_tree = tree;
99     }
100
101     if(!tree)
102     {
103         /* If no packet details are being dissected, extract some high level info for the packet view */
104         /* Assigns column values rather than full tree population */
105         dissect_general_info(tvb, offset, pinfo);
106         return;
107     }
108
109     /* Top Level Packet */
110     infiniband_packet = proto_tree_add_item(tree, proto_infiniband, tvb, offset, -1, FALSE);
111
112     /* Headers Level Tree */
113     all_headers_tree = proto_item_add_subtree(infiniband_packet, ett_all_headers);
114
115     /* Local Route Header Subtree */
116     local_route_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_LRH, tvb, offset, 8, FALSE);
117     proto_item_set_text(local_route_header_item, "%s", "Local Route Header");
118     local_route_header_tree = proto_item_add_subtree(local_route_header_item, ett_lrh);
119
120     proto_tree_add_item(local_route_header_tree, hf_infiniband_virtual_lane,            tvb, offset, 1, FALSE);
121
122
123     /* Get the Virtual Lane.  We'll use this to identify Subnet Management and Subnet Administration Packets. */
124     virtualLane =  tvb_get_guint8(tvb, offset);
125     virtualLane = virtualLane & 0xF0;
126
127
128     proto_tree_add_item(local_route_header_tree, hf_infiniband_link_version,            tvb, offset, 1, FALSE); offset+=1;
129     proto_tree_add_item(local_route_header_tree, hf_infiniband_service_level,           tvb, offset, 1, FALSE);
130
131     proto_tree_add_item(local_route_header_tree, hf_infiniband_reserved2,               tvb, offset, 1, FALSE);
132     proto_tree_add_item(local_route_header_tree, hf_infiniband_link_next_header,        tvb, offset, 1, FALSE);
133
134
135     /* Save Link Next Header... This tells us what the next header is. */
136     lnh_val =  tvb_get_guint8(tvb, offset);
137     lnh_val = lnh_val & 0x03;
138     offset+=1;
139
140
141     proto_tree_add_item(local_route_header_tree, hf_infiniband_destination_local_id,    tvb, offset, 2, FALSE);
142
143
144     /* Set destination in packet view. */
145     if (check_col(pinfo->cinfo, COL_DEF_DST))
146     {
147         col_add_fstr(pinfo->cinfo, COL_DEF_DST, "DLID: %s", tvb_bytes_to_str(tvb, offset, 2));
148     }
149     offset+=2;
150
151
152     proto_tree_add_item(local_route_header_tree, hf_infiniband_reserved5,               tvb, offset, 2, FALSE);
153
154     packetLength = tvb_get_ntohs(tvb, offset); /* Get the Packet Length. This will determine payload size later on. */
155     packetLength = packetLength & 0x07FF;      /* Mask off top 5 bits, they are reserved */
156     packetLength = packetLength * 4;           /* Multiply by 4 to get true byte length. This is by specification.  */
157                                                /*   PktLen is size in 4 byte words (byteSize /4). */
158
159     proto_tree_add_item(local_route_header_tree, hf_infiniband_packet_length,           tvb, offset, 2, FALSE); offset+=2;
160     proto_tree_add_item(local_route_header_tree, hf_infiniband_source_local_id,         tvb, offset, 2, FALSE);
161
162     /* Set Source in packet view. */
163     if (check_col(pinfo->cinfo, COL_DEF_SRC))
164     {
165         col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "SLID: %s", tvb_bytes_to_str(tvb, offset, 2));
166     }
167
168     offset+=2;
169     packetLength -= 8; /* Shave 8 bytes for the LRH. */
170
171     /* Key off Link Next Header.  This tells us what High Level Data Format we have */
172     switch(lnh_val)
173     {
174         case IBA_GLOBAL:
175             global_route_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_GRH, tvb, offset, 40, FALSE);
176             proto_item_set_text(global_route_header_item, "%s", "Global Route Header");
177             global_route_header_tree = proto_item_add_subtree(global_route_header_item, ett_grh);
178
179             proto_tree_add_item(global_route_header_tree, hf_infiniband_ip_version,         tvb, offset, 1, FALSE);
180             proto_tree_add_item(global_route_header_tree, hf_infiniband_traffic_class,      tvb, offset, 2, FALSE);
181             proto_tree_add_item(global_route_header_tree, hf_infiniband_flow_label,         tvb, offset, 4, FALSE); offset += 4;
182
183             payloadLength = tvb_get_ntohs(tvb, offset);
184
185             proto_tree_add_item(global_route_header_tree, hf_infiniband_payload_length,     tvb, offset, 2, FALSE); offset += 2;
186
187             nxtHdr = tvb_get_guint8(tvb, offset);
188
189             proto_tree_add_item(global_route_header_tree, hf_infiniband_next_header,        tvb, offset, 1, FALSE); offset +=1;
190             proto_tree_add_item(global_route_header_tree, hf_infiniband_hop_limit,          tvb, offset, 1, FALSE); offset +=1;
191             proto_tree_add_item(global_route_header_tree, hf_infiniband_source_gid,         tvb, offset, 16, FALSE);
192
193             tvb_get_ipv6(tvb, offset, &SRCgid);
194             if (check_col(pinfo->cinfo, COL_DEF_SRC))
195             {
196                 col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "SGID: %s", ip6_to_str(&SRCgid));
197             }
198             offset += 16;
199
200             proto_tree_add_item(global_route_header_tree, hf_infiniband_destination_gid,    tvb, offset, 16, FALSE);
201
202             tvb_get_ipv6(tvb, offset, &DSTgid);
203             if (check_col(pinfo->cinfo, COL_DEF_DST))
204             {
205                 col_add_fstr(pinfo->cinfo, COL_DEF_DST, "DGID: %s", ip6_to_str(&DSTgid));
206             }
207             offset += 16;
208             packetLength -= 40; /* Shave 40 bytes for GRH */
209
210             if(nxtHdr != 0x1B)
211             {
212                 /* Some kind of packet being transported globally with IBA, but locally it is not IBA - no BTH following. */
213                 break;
214             }
215             /* otherwise fall through and start parsing BTH */
216         case IBA_LOCAL:
217             bthFollows = TRUE;
218             base_transport_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_BTH, tvb, offset, 12, FALSE);
219             proto_item_set_text(base_transport_header_item, "%s", "Base Transport Header");
220             base_transport_header_tree = proto_item_add_subtree(base_transport_header_item, ett_bth);
221             proto_tree_add_item(base_transport_header_tree, hf_infiniband_opcode,                       tvb, offset, 1, FALSE);
222
223             /* Get the OpCode - this tells us what headers are following */
224             opCode = tvb_get_guint8(tvb, offset);
225             if (check_col(pinfo->cinfo, COL_INFO))
226             {
227                 col_append_str(pinfo->cinfo, COL_INFO, val_to_str((guint32)opCode, OpCodeMap, "Unknown OpCode"));
228             }
229             offset +=1;
230
231             proto_tree_add_item(base_transport_header_tree, hf_infiniband_solicited_event,              tvb, offset, 1, FALSE);
232             proto_tree_add_item(base_transport_header_tree, hf_infiniband_migreq,                       tvb, offset, 1, FALSE);
233             proto_tree_add_item(base_transport_header_tree, hf_infiniband_pad_count,                    tvb, offset, 1, FALSE);
234             proto_tree_add_item(base_transport_header_tree, hf_infiniband_transport_header_version,     tvb, offset, 1, FALSE); offset +=1;
235             proto_tree_add_item(base_transport_header_tree, hf_infiniband_partition_key,                tvb, offset, 2, FALSE); offset +=2;
236             proto_tree_add_item(base_transport_header_tree, hf_infiniband_reserved8,                    tvb, offset, 1, FALSE); offset +=1;
237             proto_tree_add_item(base_transport_header_tree, hf_infiniband_destination_qp,               tvb, offset, 3, FALSE); offset +=3;
238             proto_tree_add_item(base_transport_header_tree, hf_infiniband_acknowledge_request,          tvb, offset, 1, FALSE);
239             proto_tree_add_item(base_transport_header_tree, hf_infiniband_reserved7,                    tvb, offset, 1, FALSE); offset +=1;
240             proto_tree_add_item(base_transport_header_tree, hf_infiniband_packet_sequence_number,       tvb, offset, 3, FALSE); offset +=3;
241
242
243             packetLength -= 12; /* Shave 12 for Base Transport Header */
244
245         break;
246         case IP_NON_IBA:
247             /* Raw IPv6 Packet */
248             if (check_col(pinfo->cinfo, COL_DEF_DST))
249             {
250                 col_set_str(pinfo->cinfo, COL_DEF_DST, "IPv6 over IB Packet");
251                 col_set_fence(pinfo->cinfo, COL_DEF_DST);
252             }
253             parse_IPvSix(all_headers_tree, tvb, &offset, pinfo);
254             break;
255         case RAW:
256             parse_RWH(all_headers_tree, tvb, &offset, pinfo);
257             break;
258         default:
259             /* Unknown Packet */
260             RAWDATA_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_raw_data, tvb, offset, -1, FALSE);
261             proto_item_set_text(RAWDATA_header_item, "%s", "Unknown Raw Data - IB Encapsulated");
262             RAWDATA_header_tree = proto_item_add_subtree(RAWDATA_header_item, ett_rawdata);
263             break;
264     }
265
266     /* Base Transport header is hit quite often, however it is alone since it is the exception not the rule */
267     /* Only IBA Local packets use it */
268     if(bthFollows)
269     {
270         /* Find our next header sequence based on the Opcode
271         * Each case decrements the packetLength by the amount of bytes consumed by each header.
272         * The find_next_header_sequence method could be used to automate this.
273         * We need to keep track of this so we know much data to mark as payload/ICRC/VCRC values. */
274
275         nextHeaderSequence = find_next_header_sequence((guint32) opCode);
276
277         /* find_next_header_sequence gives us the DEFINE value corresponding to the header order following */
278         /* Enumerations are named intuitively, e.g. RDETH DETH PAYLOAD means there is an RDETH Header, DETH Header, and a packet payload */
279         switch(nextHeaderSequence)
280         {
281             case RDETH_DETH_PAYLD:
282                 parse_RDETH(all_headers_tree, tvb, &offset);
283                 parse_DETH(all_headers_tree, tvb, &offset);
284
285                 packetLength -= 4; /* RDETH */
286                 packetLength -= 8; /* DETH */
287
288                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
289                 break;
290             case RDETH_DETH_RETH_PAYLD:
291                 parse_RDETH(all_headers_tree, tvb, &offset);
292                 parse_DETH(all_headers_tree, tvb, &offset);
293                 parse_RETH(all_headers_tree, tvb, &offset);
294
295                 packetLength -= 4; /* RDETH */
296                 packetLength -= 8; /* DETH */
297                 packetLength -= 16; /* RETH */
298
299                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
300                 break;
301             case RDETH_DETH_IMMDT_PAYLD:
302                 parse_RDETH(all_headers_tree, tvb, &offset);
303                 parse_DETH(all_headers_tree, tvb, &offset);
304                 parse_IMMDT(all_headers_tree, tvb, &offset);
305
306                 packetLength -= 4; /* RDETH */
307                 packetLength -= 8; /* DETH */
308                 packetLength -= 4; /* IMMDT */
309
310                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
311                 break;
312             case RDETH_DETH_RETH_IMMDT_PAYLD:
313                 parse_RDETH(all_headers_tree, tvb, &offset);
314                 parse_DETH(all_headers_tree, tvb, &offset);
315                 parse_RETH(all_headers_tree, tvb, &offset);
316                 parse_IMMDT(all_headers_tree, tvb, &offset);
317
318                 packetLength -= 4; /* RDETH */
319                 packetLength -= 8; /* DETH */
320                 packetLength -= 16; /* RETH */
321                 packetLength -= 4; /* IMMDT */
322
323                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
324                 break;
325             case RDETH_DETH_RETH:
326                 parse_RDETH(all_headers_tree, tvb, &offset);
327                 parse_DETH(all_headers_tree, tvb, &offset);
328                 parse_RETH(all_headers_tree, tvb, &offset);
329
330                 packetLength -= 4; /* RDETH */
331                 packetLength -= 8; /* DETH */
332                 packetLength -= 16; /* RETH */
333
334                 break;
335             case RDETH_AETH_PAYLD:
336                 parse_RDETH(all_headers_tree, tvb, &offset);
337                 parse_AETH(all_headers_tree, tvb, &offset);
338
339                 packetLength -= 4; /* RDETH */
340                 packetLength -= 4; /* AETH */
341
342                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
343                 break;
344             case RDETH_PAYLD:
345                 parse_RDETH(all_headers_tree, tvb, &offset);
346
347                 packetLength -= 4; /* RDETH */
348
349                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
350                 break;
351             case RDETH_AETH:
352                 parse_AETH(all_headers_tree, tvb, &offset);
353
354                 packetLength -= 4; /* RDETH */
355                 packetLength -= 4; /* AETH */
356
357
358                 break;
359             case RDETH_AETH_ATOMICACKETH:
360                 parse_RDETH(all_headers_tree, tvb, &offset);
361                 parse_AETH(all_headers_tree, tvb, &offset);
362                 parse_ATOMICACKETH(all_headers_tree, tvb, &offset);
363
364                 packetLength -= 4; /* RDETH */
365                 packetLength -= 4; /* AETH */
366                 packetLength -= 8; /* AtomicAckETH */
367
368
369                 break;
370             case RDETH_DETH_ATOMICETH:
371                 parse_RDETH(all_headers_tree, tvb, &offset);
372                 parse_DETH(all_headers_tree, tvb, &offset);
373                 parse_ATOMICETH(all_headers_tree, tvb, &offset);
374
375                 packetLength -= 4; /* RDETH */
376                 packetLength -= 8; /* DETH */
377                 packetLength -= 28; /* AtomicETH */
378
379                 break;
380             case RDETH_DETH:
381                 parse_RDETH(all_headers_tree, tvb, &offset);
382                 parse_DETH(all_headers_tree, tvb, &offset);
383
384                 packetLength -= 4; /* RDETH */
385                 packetLength -= 8; /* DETH */
386
387                 break;
388             case DETH_PAYLD:
389                 parse_DETH(all_headers_tree, tvb, &offset);
390
391                 packetLength -= 8; /* DETH */
392
393                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
394                 break;
395             case PAYLD:
396
397                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
398                 break;
399             case IMMDT_PAYLD:
400                 parse_IMMDT(all_headers_tree, tvb, &offset);
401
402                 packetLength -= 4; /* IMMDT */
403
404                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
405                 break;
406             case RETH_PAYLD:
407                 parse_RETH(all_headers_tree, tvb, &offset);
408
409                 packetLength -= 16; /* RETH */
410
411                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
412                 break;
413             case RETH:
414                 parse_RETH(all_headers_tree, tvb, &offset);
415
416                 packetLength -= 16; /* RETH */
417
418                 break;
419             case AETH_PAYLD:
420                 parse_AETH(all_headers_tree, tvb, &offset);
421
422                 packetLength -= 4; /* AETH */
423
424                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
425                 break;
426             case AETH:
427                 parse_AETH(all_headers_tree, tvb, &offset);
428
429                 packetLength -= 4; /* AETH */
430
431                 break;
432             case AETH_ATOMICACKETH:
433                 parse_AETH(all_headers_tree, tvb, &offset);
434                 parse_ATOMICACKETH(all_headers_tree, tvb, &offset);
435
436                 packetLength -= 4; /* AETH */
437                 packetLength -= 8; /* AtomicAckETH */
438
439                 break;
440             case ATOMICETH:
441                 parse_ATOMICETH(all_headers_tree, tvb, &offset);
442
443                 packetLength -= 28; /* AtomicETH */
444
445                 break;
446             case IETH_PAYLD:
447                 parse_IETH(all_headers_tree, tvb, &offset);
448
449                 packetLength -= 4; /* IETH */
450
451                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
452                 break;
453             case DETH_IMMDT_PAYLD:
454                 parse_DETH(all_headers_tree, tvb, &offset);
455                 parse_IMMDT(all_headers_tree, tvb, &offset);
456
457                 packetLength -= 8; /* DETH */
458                 packetLength -= 4; /* IMMDT */
459
460                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength, virtualLane);
461                 break;
462             default:
463                 parse_VENDOR(all_headers_tree, tvb, &offset);
464                 break;
465
466         }
467
468     }
469     /* Display the ICRC/VCRC */
470     /* Doing it this way rather than in a variety of places according to the specific packet */
471     /* If we've already displayed it crc_length comes out 0 */
472     crc_length = tvb_reported_length_remaining(tvb, offset);
473     if(crc_length == 6)
474     {
475         proto_tree_add_item(all_headers_tree, hf_infiniband_invariant_crc, tvb, offset, 4, FALSE); offset +=4;
476         proto_tree_add_item(all_headers_tree, hf_infiniband_variant_crc,   tvb, offset, 2, FALSE); offset+=2;
477     }
478     else if(crc_length == 4)
479     {
480         proto_tree_add_item(all_headers_tree, hf_infiniband_invariant_crc, tvb, offset, 4, FALSE); offset +=4;
481     }
482     else if(crc_length == 2)
483     {
484         proto_tree_add_item(all_headers_tree, hf_infiniband_variant_crc,   tvb, offset, 2, FALSE); offset+=2;
485     }
486     
487 }
488
489 /* Description: Finds the header sequence that follows the Base Transport Header.
490 * Somwhat inefficient (should be using a single key,value pair data structure)
491 * But uses pure probablity to take a stab at better efficiency.
492 * Searches largest header sequence groups first, and then finally resorts to single matches for unique header sequences
493 * IN: OpCode: The OpCode from the Base Transport Header.
494 * OUT: The Header Sequence enumeration.  See Declarations for #defines from (0-22) */
495 static gint32
496 find_next_header_sequence(guint32 OpCode)
497 {
498     if(contains(OpCode, &opCode_PAYLD[0], (gint32)sizeof(opCode_PAYLD)))
499         return PAYLD;
500
501     if(contains(OpCode, &opCode_IMMDT_PAYLD[0], (gint32)sizeof(opCode_IMMDT_PAYLD)))
502         return IMMDT_PAYLD;
503
504     if(contains(OpCode, &opCode_RDETH_DETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_PAYLD)))
505         return RDETH_DETH_PAYLD;
506
507     if(contains(OpCode, &opCode_RETH_PAYLD[0], (gint32)sizeof(opCode_RETH_PAYLD)))
508         return RETH_PAYLD;
509
510     if(contains(OpCode, &opCode_RDETH_AETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_AETH_PAYLD)))
511         return RDETH_AETH_PAYLD;
512
513     if(contains(OpCode, &opCode_AETH_PAYLD[0], (gint32)sizeof(opCode_AETH_PAYLD)))
514         return AETH_PAYLD;
515
516     if(contains(OpCode, &opCode_RDETH_DETH_IMMDT_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_IMMDT_PAYLD)))
517         return RDETH_DETH_IMMDT_PAYLD;
518
519     if(contains(OpCode, &opCode_RETH_IMMDT_PAYLD[0], (gint32)sizeof(opCode_RETH_IMMDT_PAYLD)))
520         return RETH_IMMDT_PAYLD;
521
522     if(contains(OpCode, &opCode_RDETH_DETH_RETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_RETH_PAYLD)))
523         return RDETH_DETH_RETH_PAYLD;
524
525     if(contains(OpCode, &opCode_ATOMICETH[0], (gint32)sizeof(opCode_ATOMICETH)))
526         return ATOMICETH;
527
528     if(contains(OpCode, &opCode_IETH_PAYLD[0], (gint32)sizeof(opCode_IETH_PAYLD)))
529         return IETH_PAYLD;
530
531     if(contains(OpCode, &opCode_RDETH_DETH_ATOMICETH[0], (gint32)sizeof(opCode_RDETH_DETH_ATOMICETH)))
532         return RDETH_DETH_ATOMICETH;
533
534     if((OpCode ^ RC_ACKNOWLEDGE) == 0)
535         return AETH;
536
537     if((OpCode ^ RC_RDMA_READ_REQUEST) == 0)
538         return RETH;
539
540     if((OpCode ^ RC_ATOMIC_ACKNOWLEDGE) == 0)
541         return AETH_ATOMICACKETH;
542
543     if((OpCode ^ RD_RDMA_READ_RESPONSE_MIDDLE) == 0)
544         return RDETH_PAYLD;
545
546     if((OpCode ^ RD_ACKNOWLEDGE) == 0)
547         return RDETH_AETH;
548
549     if((OpCode ^ RD_ATOMIC_ACKNOWLEDGE) == 0)
550         return RDETH_AETH_ATOMICACKETH;
551
552     if((OpCode ^ RD_RDMA_WRITE_ONLY_IMM) == 0)
553         return RDETH_DETH_RETH_IMMDT_PAYLD;
554
555     if((OpCode ^ RD_RDMA_READ_REQUEST) == 0)
556         return RDETH_DETH_RETH;
557
558     if((OpCode ^ RD_RESYNC) == 0)
559         return RDETH_DETH;
560
561     if((OpCode ^ UD_SEND_ONLY) == 0)
562         return DETH_PAYLD;
563
564     if((OpCode ^ UD_SEND_ONLY_IMM) == 0)
565         return DETH_IMMDT_PAYLD;
566
567     return -1;
568 }
569
570 /* Description: Finds if a given value is present in an array. This is probably in a standard library somewhere,
571 * But I'd rather define my own.
572 * IN: OpCode: The OpCode you are looking for
573 * IN: Codes: The organized array of OpCodes to look through
574 * IN: Array length, because we're in C++...
575 * OUT: Boolean indicating if that OpCode was found in OpCodes */
576 static gboolean
577 contains(guint32 OpCode, guint32* Codes, gint32 length)
578 {
579     gint32 i;
580     for(i = 0; i < length; i++)
581     {
582         if((OpCode ^ Codes[i]) == 0)
583             return TRUE;
584     }
585     return FALSE;
586 }
587
588 /* Parse RDETH - Reliable Datagram Extended Transport Header
589 * IN: parentTree to add the dissection to - in this code the all_headers_tree
590 * IN: tvb - the data buffer from wireshark
591 * IN/OUT: The current and updated offset */
592 static void
593 parse_RDETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
594 {
595     gint local_offset = *offset;
596     /* RDETH - Reliable Datagram Extended Transport Header */
597     proto_tree *RDETH_header_tree = NULL;
598     proto_item *RDETH_header_item = NULL;
599
600     RDETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_RDETH, tvb, local_offset, 4, FALSE);
601     proto_item_set_text(RDETH_header_item, "%s", "RDETH - Reliable Datagram Extended Transport Header");
602     RDETH_header_tree = proto_item_add_subtree(RDETH_header_item, ett_rdeth);
603
604     proto_tree_add_item(RDETH_header_tree, hf_infiniband_reserved8_RDETH,   tvb, local_offset, 1, FALSE); local_offset+=1;
605     proto_tree_add_item(RDETH_header_tree, hf_infiniband_ee_context,        tvb, local_offset, 3, FALSE); local_offset+=3;
606     *offset = local_offset;
607 }
608
609 /* Parse DETH - Datagram Extended Transport Header
610 * IN: parentTree to add the dissection to - in this code the all_headers_tree
611 * IN: tvb - the data buffer from wireshark
612 * IN/OUT: The current and updated offset */
613 static void
614 parse_DETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
615 {
616     gint local_offset = *offset;
617     /* DETH - Datagram Extended Transport Header */
618     proto_tree *DETH_header_tree = NULL;
619     proto_item *DETH_header_item = NULL;
620
621     DETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_DETH, tvb, local_offset, 8, FALSE);
622     proto_item_set_text(DETH_header_item, "%s", "DETH - Datagram Extended Transport Header");
623     DETH_header_tree = proto_item_add_subtree(DETH_header_item, ett_deth);
624
625     proto_tree_add_item(DETH_header_tree, hf_infiniband_queue_key,                  tvb, local_offset, 4, FALSE); local_offset+=4;
626     proto_tree_add_item(DETH_header_tree, hf_infiniband_reserved8_DETH,             tvb, local_offset, 1, FALSE); local_offset+=1;
627     proto_tree_add_item(DETH_header_tree, hf_infiniband_source_qp,                  tvb, local_offset, 3, FALSE); local_offset+=3;
628
629     *offset = local_offset;
630 }
631
632 /* Parse RETH - RDMA Extended Transport Header
633 * IN: parentTree to add the dissection to - in this code the all_headers_tree
634 * IN: tvb - the data buffer from wireshark
635 * IN/OUT: The current and updated offset */
636 static void
637 parse_RETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
638 {
639     gint local_offset = *offset;
640     /* RETH - RDMA Extended Transport Header */
641     proto_tree *RETH_header_tree = NULL;
642     proto_item *RETH_header_item = NULL;
643
644     RETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_RETH, tvb, local_offset, 16, FALSE);
645     proto_item_set_text(RETH_header_item, "%s", "RETH - RDMA Extended Transport Header");
646     RETH_header_tree = proto_item_add_subtree(RETH_header_item, ett_reth);
647
648     proto_tree_add_item(RETH_header_tree, hf_infiniband_virtual_address,                tvb, local_offset, 8, FALSE); local_offset+=8;
649     proto_tree_add_item(RETH_header_tree, hf_infiniband_remote_key,                     tvb, local_offset, 4, FALSE); local_offset+=4;
650     proto_tree_add_item(RETH_header_tree, hf_infiniband_dma_length,                     tvb, local_offset, 4, FALSE); local_offset+=4;
651
652     *offset = local_offset;
653 }
654
655 /* Parse AtomicETH - Atomic Extended Transport Header
656 * IN: parentTree to add the dissection to - in this code the all_headers_tree
657 * IN: tvb - the data buffer from wireshark
658 * IN/OUT: The current and updated offset */
659 static void
660 parse_ATOMICETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
661 {
662     gint local_offset = *offset;
663     /* AtomicETH - Atomic Extended Transport Header */
664     proto_tree *ATOMICETH_header_tree = NULL;
665     proto_item *ATOMICETH_header_item = NULL;
666
667     ATOMICETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AtomicETH, tvb, local_offset, 28, FALSE);
668     proto_item_set_text(ATOMICETH_header_item, "%s", "AtomicETH - Atomic Extended Transport Header");
669     ATOMICETH_header_tree = proto_item_add_subtree(ATOMICETH_header_item, ett_atomiceth);
670
671     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_virtual_address,               tvb, local_offset, 8, FALSE); local_offset+=8;
672     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_remote_key,                    tvb, local_offset, 4, FALSE); local_offset+=4;
673     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_swap_or_add_data,              tvb, local_offset, 8, FALSE); local_offset+=8;
674     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_compare_data,                  tvb, local_offset, 8, FALSE); local_offset+=8;
675     *offset = local_offset;
676 }
677
678 /* Parse AETH - ACK Extended Transport Header
679 * IN: parentTree to add the dissection to - in this code the all_headers_tree
680 * IN: tvb - the data buffer from wireshark
681 * IN/OUT: The current and updated offset */
682 static void
683 parse_AETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
684 {
685     gint local_offset = *offset;
686     /* AETH - ACK Extended Transport Header */
687     proto_tree *AETH_header_tree = NULL;
688     proto_item *AETH_header_item = NULL;
689
690     AETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AETH, tvb, local_offset, 4, FALSE);
691     proto_item_set_text(AETH_header_item, "%s", "AETH - ACK Extended Transport Header");
692     AETH_header_tree = proto_item_add_subtree(AETH_header_item, ett_aeth);
693
694     proto_tree_add_item(AETH_header_tree, hf_infiniband_syndrome,                       tvb, local_offset, 1, FALSE); local_offset+=1;
695     proto_tree_add_item(AETH_header_tree, hf_infiniband_message_sequence_number,        tvb, local_offset, 3, FALSE); local_offset+=3;
696
697     *offset = local_offset;
698 }
699
700 /* Parse AtomicAckEth - Atomic ACK Extended Transport Header
701 * IN: parentTree to add the dissection to - in this code the all_headers_tree
702 * IN: tvb - the data buffer from wireshark
703 * IN/OUT: The current and updated offset */
704 static void
705 parse_ATOMICACKETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
706 {
707     gint local_offset = *offset;
708     /* AtomicAckEth - Atomic ACK Extended Transport Header */
709     proto_tree *ATOMICACKETH_header_tree = NULL;
710     proto_item *ATOMICACKETH_header_item = NULL;
711
712     ATOMICACKETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AtomicAckETH, tvb, local_offset, 8, FALSE);
713     proto_item_set_text(ATOMICACKETH_header_item, "%s", "ATOMICACKETH - Atomic ACK Extended Transport Header");
714     ATOMICACKETH_header_tree = proto_item_add_subtree(ATOMICACKETH_header_item, ett_atomicacketh);
715     proto_tree_add_item(ATOMICACKETH_header_tree, hf_infiniband_original_remote_data,   tvb, local_offset, 8, FALSE); local_offset+=8;
716     *offset = local_offset;
717 }
718
719 /* Parse IMMDT - Immediate Data Extended Transport Header
720 * IN: parentTree to add the dissection to - in this code the all_headers_tree
721 * IN: tvb - the data buffer from wireshark
722 * IN/OUT: The current and updated offset */
723 static void
724 parse_IMMDT(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
725 {
726     gint local_offset = *offset;
727     /* IMMDT - Immediate Data Extended Transport Header */
728     proto_tree *IMMDT_header_tree = NULL;
729     proto_item *IMMDT_header_item = NULL;
730
731     IMMDT_header_item = proto_tree_add_item(parentTree, hf_infiniband_IMMDT, tvb, local_offset, 4, FALSE);
732     proto_item_set_text(IMMDT_header_item, "%s", "IMMDT - Immediate Data Extended Transport Header");
733     IMMDT_header_tree = proto_item_add_subtree(IMMDT_header_item, ett_immdt);
734     proto_tree_add_item(IMMDT_header_tree, hf_infiniband_IMMDT, tvb, local_offset, 4, FALSE); local_offset+=4;
735     *offset = local_offset;
736 }
737
738 /* Parse IETH - Invalidate Extended Transport Header
739 * IN: parentTree to add the dissection to - in this code the all_headers_tree
740 * IN: tvb - the data buffer from wireshark
741 * IN/OUT: The current and updated offset */
742 static void
743 parse_IETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
744 {
745     gint local_offset = *offset;
746     /* IETH - Invalidate Extended Transport Header */
747     proto_tree *IETH_header_tree = NULL;
748     proto_item *IETH_header_item = NULL;
749
750     IETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_IETH, tvb, local_offset, 4, FALSE);
751     proto_item_set_text(IETH_header_item, "%s", "IETH - Invalidate Extended Transport Header");
752     IETH_header_tree = proto_item_add_subtree(IETH_header_item, ett_ieth);
753
754     proto_tree_add_item(IETH_header_tree, hf_infiniband_IETH,   tvb, local_offset, 4, FALSE); local_offset+=4;
755
756     *offset = local_offset;
757 }
758
759 /* Parse Payload - Packet Payload / Invariant CRC / Variant CRC
760 * IN: parentTree to add the dissection to - in this code the all_headers_tree
761 * IN: pinfo - packet info from wireshark
762 * IN: tvb - the data buffer from wireshark
763 * IN/OUT: The current and updated offset
764 * IN: Length of Payload */
765 static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset, gint length, guint8 virtualLane)
766 {
767     gint local_offset = *offset;
768     /* Payload - Packet Payload */
769     proto_tree *PAYLOAD_header_tree = NULL;
770     proto_item *PAYLOAD_header_item = NULL;
771     guint8 management_class;
772     tvbuff_t *volatile next_tvb;
773     gint            captured_length, reported_length;
774     guint16 etype, reserved;
775     const char      *saved_proto;
776     volatile gboolean   dissector_found = FALSE;
777  
778     if(!tvb_bytes_exist(tvb, *offset, length)) /* previously consumed bytes + offset was all the data - none or corrupt payload */
779     {
780         if (check_col(pinfo->cinfo, COL_INFO))
781         {
782             col_set_str(pinfo->cinfo, COL_INFO, "Invalid Packet Length from LRH! [Malformed Packet]");
783             col_set_fence(pinfo->cinfo, COL_INFO);
784         }
785         return;
786     }
787     if(virtualLane == 0xF0)
788     {
789         management_class =  tvb_get_guint8(tvb, (*offset) + 1);
790
791         if(((management_class >= (guint8)VENDOR_1_START) && (management_class <= (guint8)VENDOR_1_END))
792             || ((management_class >= (guint8)VENDOR_2_START) && (management_class <= (guint8)VENDOR_2_END)))
793         {
794             /* parse vendor specific */
795             parse_VENDOR_MANAGEMENT(parentTree, tvb, offset);
796         }
797         else if((management_class >= (guint8)APPLICATION_START) && (management_class <= (guint8)APPLICATION_END))
798         {
799             /* parse application specific */
800             parse_APPLICATION_MANAGEMENT(parentTree, tvb, offset);
801         }
802         else if(((management_class == (guint8)0x00) || (management_class == (guint8)0x02))
803             || ((management_class >= (guint8)0x50) && (management_class <= (guint8)0x80))
804             || ((management_class >= (guint8)0x82)))
805         {
806             /* parse reserved classes */
807             parse_RESERVED_MANAGEMENT(parentTree, tvb, offset);
808         }
809         else /* we have a normal management_class */
810         {
811             switch(management_class)
812             {
813                 case SUBN_LID_ROUTED:
814                     /* parse subn man lid routed */
815                     parse_SUBN_LID_ROUTED(parentTree, pinfo, tvb, &local_offset);
816                 break;
817                 case SUBN_DIRECTED_ROUTE:
818                     /* parse subn directed route */
819                     parse_SUBN_DIRECTED_ROUTE(parentTree, pinfo, tvb, &local_offset);
820                 break;
821                 case SUBNADMN:
822                     /* parse sub admin */
823                     parse_SUBNADMN(parentTree, pinfo, tvb, &local_offset);
824                 break;
825                 case PERF:
826                     /* parse performance */
827                     parse_PERF(parentTree, tvb, &local_offset);
828                 break;
829                 case BM:
830                     /* parse baseboard mgmt */
831                     parse_BM(parentTree, tvb, &local_offset);
832                 break;
833                 case DEV_MGT:
834                     /* parse device management */
835                     parse_DEV_MGT(parentTree, tvb, &local_offset);
836                 break;
837                 case COM_MGT:
838                     /* parse communication management */
839                     parse_COM_MGT(parentTree, tvb, &local_offset);
840                 break;
841                 case SNMP:
842                     /* parse snmp tunneling */
843                     parse_SNMP(parentTree, tvb, &local_offset);
844                 break;
845                 default:
846                     break;
847             }
848         }
849     }
850     else /* Normal Data Packet - Parse as such */
851     {
852
853         /* Calculation for Payload:
854         * (tvb->length) Length of entire packet - (local_offset) Starting byte of Payload Data
855         * offset addition is more complex for the payload.
856         * We need the total length of the packet, - length of previous headers, + offset where payload started.
857         * We also need  to reserve 6 bytes for the CRCs which are not actually part of the payload.  */
858
859         /* IBA packet data could be anything in principle, however it is common
860          * practice to carry non-IBA data encapsulated with an EtherType header,
861          * similar to the RWH header. There is no way to identify these frames
862          * positively.
863          *
864          * We see if the first few bytes look like an EtherType header, and if so
865          * call the appropriate dissector. If not we call the "data" dissector.
866          */
867
868         etype = tvb_get_ntohs(tvb, local_offset);
869         reserved =  tvb_get_ntohs(tvb, local_offset + 2);
870
871         if (reserved == 0) {
872             
873             /* Get the captured length and reported length of the data
874                after the Ethernet type. */
875             captured_length = tvb_length_remaining(tvb, local_offset+4);
876             reported_length = tvb_reported_length_remaining(tvb,
877                                     local_offset+4);
878             
879             next_tvb = tvb_new_subset(tvb, local_offset+4, captured_length,
880                           reported_length);
881             
882             pinfo->ethertype = etype;
883             
884             /* Look for sub-dissector, and call it if found.
885                Catch exceptions, so that if the reported length of "next_tvb"
886                was reduced by some dissector before an exception was thrown,
887                we can still put in an item for the trailer. */
888             saved_proto = pinfo->current_proto;
889             TRY {
890                 dissector_found = dissector_try_port(ethertype_dissector_table,
891                                      etype, next_tvb, pinfo, top_tree);
892             }
893             CATCH(BoundsError) {
894                 /* Somebody threw BoundsError, which means that:
895                    
896                 1) a dissector was found, so we don't need to
897                 dissect the payload as data or update the
898                 protocol or info columns;
899                 
900                 2) dissecting the payload found that the packet was
901                 cut off by a snapshot length before the end of
902                 the payload.  The trailer comes after the payload,
903                 so *all* of the trailer is cut off, and we'll
904                 just get another BoundsError if we add the trailer.
905                 
906                 Therefore, we just rethrow the exception so it gets
907                 reported; we don't dissect the trailer or do anything
908                 else. */
909                 RETHROW;
910             }
911             CATCH(OutOfMemoryError) {
912                 RETHROW;
913             }
914             CATCH_ALL {
915                 /* Somebody threw an exception other than BoundsError, which
916                    means that a dissector was found, so we don't need to
917                    dissect the payload as data or update the protocol or info
918                    columns.  We just show the exception and then drive on
919                    to show the trailer, after noting that a dissector was
920                    found and restoring the protocol value that was in effect
921                    before we called the subdissector. */
922                 show_exception(next_tvb, pinfo, top_tree, EXCEPT_CODE, GET_MESSAGE);
923                 dissector_found = TRUE;
924                 pinfo->current_proto = saved_proto;
925             }
926             ENDTRY;
927             
928             if (dissector_found) {
929                 /* now create payload entry to show Ethertype */
930                 PAYLOAD_header_item = proto_tree_add_item(parentTree, hf_infiniband_payload, tvb, local_offset, tvb_reported_length_remaining(tvb, local_offset)-6, FALSE);
931                 proto_item_set_text(PAYLOAD_header_item, "%s", "IBA Payload - appears to be EtherType encapsulated"); 
932                 PAYLOAD_header_tree = proto_item_add_subtree(PAYLOAD_header_item, ett_payload);
933                 proto_tree_add_uint(PAYLOAD_header_tree, hf_infiniband_etype, tvb,
934                             local_offset, 2,  tvb_get_ntohs(tvb, local_offset));
935
936                 local_offset += 2;
937
938                 proto_tree_add_uint(PAYLOAD_header_tree, hf_infiniband_reserved16_RWH, tvb,
939                             local_offset, 2, tvb_get_ntohs(tvb, local_offset));
940
941             }
942                 
943         }
944         
945         if (!dissector_found) {
946             /* No sub-dissector found.
947                Label rest of packet as "Data" */
948             
949             captured_length = tvb_length_remaining(tvb, local_offset);
950             reported_length = tvb_reported_length_remaining(tvb,
951                                     local_offset);
952             
953             if (reported_length >= 6)
954                 reported_length -= 6;
955             if (captured_length > reported_length)
956                 captured_length = reported_length;
957
958             next_tvb = tvb_new_subset(tvb, local_offset,
959                           captured_length,
960                           reported_length);
961             
962             call_dissector(data_handle, next_tvb, pinfo, top_tree);
963             
964         }
965         
966
967         /*parse_RWH(parentTree, tvb, &local_offset, pinfo);*/
968         
969         /* Will contain ICRC and VCRC = 4+2 */
970         local_offset = tvb_reported_length(tvb) - 6;
971     }
972
973     *offset = local_offset;
974 }
975
976 /* Parse VENDOR - Parse a vendor specific or unknown header sequence
977 * IN: parentTree to add the dissection to - in this code the all_headers_tree
978 * IN: tvb - the data buffer from wireshark
979 * IN/OUT: The current and updated offset */
980 static void parse_VENDOR(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
981 {
982     gint local_offset = *offset;
983     proto_tree *VENDOR_header_tree = NULL;
984     proto_item *VENDOR_header_item = NULL;
985
986     VENDOR_header_item = proto_tree_add_item(parentTree, hf_infiniband_vendor, tvb, local_offset, 4, FALSE);
987     proto_item_set_text(VENDOR_header_item, "%s", "Vendor Specific or Unknown Header Sequence");
988     VENDOR_header_tree = proto_item_add_subtree(VENDOR_header_item, ett_vendor);
989     proto_tree_add_item(VENDOR_header_tree, hf_infiniband_vendor,   tvb, local_offset, -1, FALSE);
990     *offset = local_offset;
991 }
992
993 /* Parse IPv6 - Parse an IPv6 Packet
994 * IN: parentTree to add the dissection to - in this code the all_headers_tree
995 * IN: tvb - the data buffer from wireshark
996 * IN/OUT: The current and updated offset
997 * IN: pinfo - packet info from wireshark */
998 static void parse_IPvSix(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, packet_info *pinfo)
999 {
1000     tvbuff_t *ipv6_tvb;
1001
1002     /* (- 2) for VCRC which lives at the end of the packet   */
1003     ipv6_tvb = tvb_new_subset(tvb, *offset,
1004                   tvb_length_remaining(tvb, *offset) - 2,
1005                   tvb_reported_length_remaining(tvb, *offset) - 2);
1006     call_dissector(ipv6_handle, ipv6_tvb, pinfo, parentTree);
1007     *offset = tvb_reported_length(tvb) - 2;
1008
1009     /* Display the VCRC */
1010     proto_tree_add_item(parentTree, hf_infiniband_variant_crc,  tvb, *offset, 2, FALSE);
1011 }
1012
1013 /* Parse EtherType - Parse a generic IP packaet with an EtherType of IP or ARP
1014 * IN: parentTree to add the dissection to - in this code the all_headers_tree
1015 * IN: tvb - the data buffer from wireshark
1016 * IN/OUT: The current and updated offset
1017 * IN: pinfo - packet info from wireshark */
1018 static void parse_RWH(proto_tree *ah_tree, tvbuff_t *tvb, gint *offset, packet_info *pinfo)
1019 {
1020     guint16 ether_type;
1021     tvbuff_t *next_tvb;
1022
1023     /* RWH - Raw Header */
1024     proto_tree *RWH_header_tree = NULL;
1025     proto_item *RWH_header_item = NULL;
1026
1027     gint captured_length, reported_length;
1028     
1029     RWH_header_item = proto_tree_add_item(ah_tree, hf_infiniband_RWH, tvb, *offset, 4, FALSE);
1030     proto_item_set_text(RWH_header_item, "%s", "RWH - Raw Header");
1031     RWH_header_tree = proto_item_add_subtree(RWH_header_item, ett_rwh);
1032
1033     ether_type = tvb_get_ntohs(tvb, *offset);
1034 #if 0
1035     ether_type = ether_type & 0x0F; /* mask off reserved bits just in case. */
1036 #endif
1037     proto_tree_add_uint(RWH_header_tree, hf_infiniband_etype, tvb, *offset, 2,
1038                         ether_type);
1039     *offset += 2;
1040
1041     proto_tree_add_item(RWH_header_tree, hf_infiniband_reserved16_RWH, tvb,
1042             *offset, 2, FALSE);
1043
1044     *offset += 2;
1045
1046     /* Get the captured length and reported length of the data
1047      * after the Ethernet type. */
1048     captured_length = tvb_length_remaining(tvb, *offset);
1049     reported_length = tvb_reported_length_remaining(tvb, *offset);
1050
1051     /* Construct a tvbuff for the payload after the Ethernet type,
1052      * not including the FCS. */
1053     if (captured_length >= 0 && reported_length >= 0) {
1054         if (reported_length >= 2)
1055             reported_length -= 2;
1056         if (captured_length > reported_length)
1057             captured_length = reported_length;
1058     }
1059
1060     next_tvb = tvb_new_subset(tvb, *offset, captured_length, reported_length);
1061     if (!dissector_try_port(ethertype_dissector_table, ether_type,
1062             next_tvb, pinfo, top_tree))
1063        call_dissector(data_handle, next_tvb, pinfo, top_tree);
1064
1065     *offset = tvb_reported_length(tvb) - 2;
1066     /* Display the VCRC */
1067     proto_tree_add_item(ah_tree, hf_infiniband_variant_crc, tvb, *offset, 2, FALSE);
1068 }
1069
1070 /* Parse Subnet Management (LID Routed)
1071 * IN: parentTree to add the dissection to
1072 * IN: pinfo - packet info from wireshark
1073 * IN: tvb - the data buffer from wireshark
1074 * IN/OUT: The current and updated offset */
1075 static void parse_SUBN_LID_ROUTED(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
1076 {
1077     /* Parse the Common MAD Header */
1078     MAD_Data MadData;
1079     gint local_offset;
1080     proto_tree *SUBN_LID_ROUTED_header_tree = NULL;
1081     proto_item *SUBN_LID_ROUTED_header_item = NULL;
1082
1083     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1084     {
1085         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1086         return;
1087     }
1088
1089     local_offset = *offset;
1090
1091     /* local_offset - 24 here because when we come out of parse_MAD_Common, the offset it sitting at the data section. */
1092     SUBN_LID_ROUTED_header_item = proto_tree_add_item(parentTree, hf_infiniband_SMP_LID, tvb, local_offset - 24, 256, FALSE);
1093     proto_item_set_text(SUBN_LID_ROUTED_header_item, "%s", "SMP (LID Routed) ");
1094     SUBN_LID_ROUTED_header_tree = proto_item_add_subtree(SUBN_LID_ROUTED_header_item, ett_subn_lid_routed);
1095     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_m_key,           tvb, local_offset, 8, FALSE); local_offset +=8;
1096     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_reserved256,     tvb, local_offset, 32, FALSE); local_offset +=32;
1097
1098     label_SUBM_Method(SUBN_LID_ROUTED_header_item, &MadData, pinfo);
1099     label_SUBM_Attribute(SUBN_LID_ROUTED_header_item, &MadData, pinfo);
1100
1101     /* Try to do the detail parse of the attribute.  If there is an error, or the attribute is unknown, we'll just highlight the generic data. */
1102     if(!parse_SUBM_Attribute(SUBN_LID_ROUTED_header_tree, tvb, &local_offset, &MadData))
1103     {
1104         proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_smp_data,    tvb, local_offset, 64, FALSE); local_offset +=64;
1105     }
1106
1107     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_reserved1024,    tvb, local_offset, 128, FALSE); local_offset +=128;
1108     *offset = local_offset;
1109 }
1110
1111 /* Parse Subnet Management (Directed Route)
1112 * IN: parentTree to add the dissection to
1113 * IN: tvb - the data buffer from wireshark
1114 * IN/OUT: The current and updated offset */
1115 static void parse_SUBN_DIRECTED_ROUTE(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
1116 {
1117     /* Parse the Common MAD Header */
1118     MAD_Data MadData;
1119     gint local_offset;
1120     proto_tree *SUBN_DIRECTED_ROUTE_header_tree = NULL;
1121     proto_item *SUBN_DIRECTED_ROUTE_header_item = NULL;
1122
1123     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1124     {
1125         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1126         return;
1127     }
1128
1129     local_offset = *offset;
1130
1131     /* local_offset - 24 here because when we come out of parse_MAD_Common, the offset it sitting at the data section.
1132     * We need to go backwards because this particular SMP uses the class specific portion of the Common MAD Header */
1133     SUBN_DIRECTED_ROUTE_header_item = proto_tree_add_item(parentTree, hf_infiniband_SMP_DIRECTED, tvb, local_offset - 24, 256, FALSE);
1134     proto_item_set_text(SUBN_DIRECTED_ROUTE_header_item, "%s", "SMP (Directed Route) ");
1135     SUBN_DIRECTED_ROUTE_header_tree = proto_item_add_subtree(SUBN_DIRECTED_ROUTE_header_item, ett_subn_directed_route);
1136
1137     label_SUBM_Method(SUBN_DIRECTED_ROUTE_header_item, &MadData, pinfo);
1138     label_SUBM_Attribute(SUBN_DIRECTED_ROUTE_header_item, &MadData, pinfo);
1139
1140     /* Place us at offset 4, the "D" Bit (Direction bit for Directed Route SMPs) */
1141     local_offset -= 20;
1142     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_d,               tvb, local_offset, 1, FALSE);
1143     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_smp_status,      tvb, local_offset, 2, FALSE); local_offset +=2;
1144     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_hop_pointer,     tvb, local_offset, 1, FALSE); local_offset +=1;
1145     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_hop_count,       tvb, local_offset, 1, FALSE); local_offset +=1;
1146     local_offset += 16; /* Skip over the rest of the Common MAD Header... It's already dissected by parse_MAD_Common */
1147     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_m_key,           tvb, local_offset, 8, FALSE); local_offset +=8;
1148     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_dr_slid,         tvb, local_offset, 2, FALSE); local_offset +=2;
1149     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_dr_dlid,         tvb, local_offset, 2, FALSE); local_offset +=2;
1150     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_reserved28,      tvb, local_offset, 28, FALSE); local_offset +=28;
1151
1152     /* Try to do the detail parse of the attribute.  If there is an error, or the attribute is unknown, we'll just highlight the generic data. */
1153     if(!parse_SUBM_Attribute(SUBN_DIRECTED_ROUTE_header_tree, tvb, &local_offset, &MadData))
1154     {
1155         proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_smp_data,    tvb, local_offset, 64, FALSE); local_offset +=64;
1156     }
1157
1158     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_initial_path,        tvb, local_offset, 64, FALSE); local_offset +=64;
1159     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_return_path,     tvb, local_offset, 64, FALSE); local_offset +=64;
1160     *offset = local_offset;
1161 }
1162
1163 /* Parse Subnet Administration
1164 * IN: parentTree to add the dissection to
1165 * IN: pinfo - packet info from wireshark
1166 * IN: tvb - the data buffer from wireshark
1167 * IN/OUT: The current and updated offset */
1168 static void parse_SUBNADMN(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
1169 {
1170     /* Parse the Common MAD Header */
1171     MAD_Data MadData;
1172     gint local_offset;
1173     proto_tree *SUBNADMN_header_tree = NULL;
1174     proto_item *SUBNADMN_header_item = NULL;
1175
1176     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1177     {
1178         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1179         return;
1180     }
1181     if(!parse_RMPP(parentTree, tvb, offset))
1182     {
1183         /* TODO: Mark Corrupt Packet */
1184         return;
1185     }
1186     local_offset = *offset;
1187
1188     SUBNADMN_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset - 36, 256, FALSE);
1189     proto_item_set_text(SUBNADMN_header_item, "%s", "SMA");
1190     SUBNADMN_header_tree = proto_item_add_subtree(SUBNADMN_header_item, ett_subnadmin);
1191
1192     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_sm_key,             tvb, local_offset, 8, FALSE); local_offset+=8;
1193     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_attribute_offset,   tvb, local_offset, 2, FALSE); local_offset+=4;
1194     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_reserved16,         tvb, local_offset, 2, FALSE); local_offset+=4;
1195     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_component_mask,     tvb, local_offset, 8, FALSE); local_offset+=8;
1196
1197     label_SUBA_Method(SUBNADMN_header_item, &MadData, pinfo);
1198     label_SUBA_Attribute(SUBNADMN_header_item, &MadData, pinfo);
1199
1200     if(!parse_SUBA_Attribute(SUBNADMN_header_tree, tvb, &local_offset, &MadData))
1201     {
1202         proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_subnet_admin_data,  tvb, local_offset, 200, FALSE); local_offset+=200;
1203     }
1204     *offset = local_offset;
1205 }
1206
1207 /* Parse Performance Management
1208 * IN: parentTree to add the dissection to
1209 * IN: tvb - the data buffer from wireshark
1210 * IN/OUT: The current and updated offset */
1211 static void parse_PERF(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1212 {
1213     /* Parse the Common MAD Header */
1214     MAD_Data MadData;
1215     gint local_offset;
1216     proto_item *PERF_header_item = NULL;
1217
1218     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1219     {
1220         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1221         return;
1222     }
1223     local_offset = *offset;
1224     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1225     proto_item_set_text(PERF_header_item, "%s", "PERF - Performance Management MAD (Dissector Not Implemented)");
1226     *offset = local_offset;
1227 }
1228
1229 /* Parse Baseboard Management
1230 * IN: parentTree to add the dissection to
1231 * IN: tvb - the data buffer from wireshark
1232 * IN/OUT: The current and updated offset */
1233 static void parse_BM(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1234 {
1235     /* Parse the Common MAD Header */
1236     MAD_Data MadData;
1237     gint local_offset;
1238     proto_item *PERF_header_item = NULL;
1239
1240     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1241     {
1242         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1243         return;
1244     }
1245     local_offset = *offset;
1246
1247     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1248     proto_item_set_text(PERF_header_item, "%s", "BM - Baseboard Management MAD (Dissector Not Implemented)");
1249     *offset = local_offset;
1250 }
1251
1252 /* Parse Device Management
1253 * IN: parentTree to add the dissection to
1254 * IN: tvb - the data buffer from wireshark
1255 * IN/OUT: The current and updated offset */
1256 static void parse_DEV_MGT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1257 {
1258     /* Parse the Common MAD Header */
1259     MAD_Data MadData;
1260     gint local_offset;
1261     proto_item *PERF_header_item = NULL;
1262
1263     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1264     {
1265         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1266         return;
1267     }
1268     local_offset = *offset;
1269     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1270     proto_item_set_text(PERF_header_item, "%s", "DEV_MGT - Device Management MAD (Dissector Not Implemented)");
1271     *offset = local_offset;
1272 }
1273
1274 /* Parse Communications Management
1275 * IN: parentTree to add the dissection to
1276 * IN: tvb - the data buffer from wireshark
1277 * IN/OUT: The current and updated offset */
1278 static void parse_COM_MGT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1279 {
1280     /* Parse the Common MAD Header */
1281     MAD_Data MadData;
1282     gint local_offset;
1283     proto_item *PERF_header_item = NULL;
1284
1285     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1286     {
1287         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1288         return;
1289     }
1290     local_offset = *offset;
1291     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1292     proto_item_set_text(PERF_header_item, "%s", "COMM - Communication Management MAD (Dissector Not Implemented)");
1293     *offset = local_offset;
1294 }
1295
1296 /* Parse SNMP Tunneling
1297 * IN: parentTree to add the dissection to
1298 * IN: tvb - the data buffer from wireshark
1299 * IN/OUT: The current and updated offset */
1300 static void parse_SNMP(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1301 {
1302         /* Parse the Common MAD Header */
1303     MAD_Data MadData;
1304     gint local_offset;
1305     proto_item *PERF_header_item = NULL;
1306
1307     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1308     {
1309         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1310         return;
1311     }
1312     local_offset = *offset;
1313
1314     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1315     proto_item_set_text(PERF_header_item, "%s", "SNMP - SNMP Tunneling MAD (Dissector Not Implemented)");
1316     *offset = local_offset;
1317 }
1318
1319 /* Parse Vendor Specific Management Packets
1320 * IN: parentTree to add the dissection to
1321 * IN: tvb - the data buffer from wireshark
1322 * IN/OUT: The current and updated offset */
1323 static void parse_VENDOR_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1324 {
1325     /* Parse the Common MAD Header */
1326     MAD_Data MadData;
1327     gint local_offset;
1328     proto_item *PERF_header_item = NULL;
1329
1330     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1331     {
1332         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1333         return;
1334     }
1335     local_offset = *offset;
1336
1337     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1338     proto_item_set_text(PERF_header_item, "%s", "VENDOR - Vendor Specific Management MAD (Dissector Not Implemented)");
1339     *offset = local_offset;
1340 }
1341
1342 /* Parse Application Specific Management Packets
1343 * IN: parentTree to add the dissection to
1344 * IN: tvb - the data buffer from wireshark
1345 * IN/OUT: The current and updated offset */
1346 static void parse_APPLICATION_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1347 {
1348     /* Parse the Common MAD Header */
1349     MAD_Data MadData;
1350     gint local_offset;
1351     proto_item *PERF_header_item = NULL;
1352
1353     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1354     {
1355         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1356         return;
1357     }
1358     local_offset = *offset;
1359     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1360     proto_item_set_text(PERF_header_item, "%s", "APP - Application Specific MAD (Dissector Not Implemented)");
1361     *offset = local_offset;
1362 }
1363
1364 /* Parse Reserved Management Packets.
1365
1366 * This is an !ERROR CONDITION!
1367 * It means that the Management Class value used was defined as a reserved value for furture use.
1368 * This method is here since we will want to report this information directly to the UI without blowing up Wireshark.
1369
1370 * IN: parentTree to add the dissection to
1371 * IN: tvb - the data buffer from wireshark
1372 * IN/OUT: The current and updated offset */
1373 static void parse_RESERVED_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1374 {
1375     /* Parse the Common MAD Header */
1376     MAD_Data MadData;
1377     gint local_offset;
1378     proto_item *PERF_header_item = NULL;
1379
1380     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
1381     {
1382         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
1383         return;
1384     }
1385     local_offset = *offset;
1386     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
1387     proto_item_set_text(PERF_header_item, "%s", "RESERVED - Reserved MAD Type (Possible Device Error)");
1388     *offset = local_offset;
1389 }
1390
1391 /* Parse the common MAD Header
1392 * IN: parentTree to add the dissection to
1393 * IN: tvb - the data buffer from wireshark
1394 * IN/OUT: The current and updated offset
1395 * IN/OUT: MadData - the data from the MAD header */
1396 static gboolean parse_MAD_Common(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data* MadData)
1397 {
1398     gint local_offset = *offset;
1399     proto_tree *MAD_header_tree = NULL;
1400     proto_item *MAD_header_item = NULL;
1401
1402     if(MadData == NULL)
1403         return FALSE;
1404     if(!tvb_bytes_exist(tvb, *offset, 256))
1405         return FALSE;
1406
1407     /* Get the Management Class to decide between LID Routed and Direct Route */
1408     MadData->managementClass =      tvb_get_guint8(tvb, local_offset + 1);
1409     MadData->classVersion =         tvb_get_guint8(tvb, local_offset + 2);
1410     MadData->method =               tvb_get_guint8(tvb, local_offset + 3);
1411     MadData->status =               tvb_get_guint8(tvb, local_offset + 4);
1412     MadData->classSpecific =        tvb_get_ntohs(tvb, local_offset + 6);
1413     MadData->transactionID =        tvb_get_ntoh64(tvb, local_offset + 8);
1414     MadData->attributeID =          tvb_get_ntohs(tvb, local_offset + 16);
1415     MadData->attributeModifier =    tvb_get_ntohl(tvb, local_offset + 20);
1416     tvb_memcpy(tvb, MadData->data, local_offset + 24, 232);
1417
1418     /* Populate the Dissector Tree */
1419
1420     MAD_header_item = proto_tree_add_item(parentTree, hf_infiniband_MAD, tvb, local_offset, 256, FALSE);
1421     proto_item_set_text(MAD_header_item, "%s", "MAD Header - Common Management Datagram");
1422     MAD_header_tree = proto_item_add_subtree(MAD_header_item, ett_mad);
1423
1424     proto_tree_add_item(MAD_header_tree, hf_infiniband_base_version,        tvb, local_offset, 1, FALSE); local_offset+=1;
1425     proto_tree_add_item(MAD_header_tree, hf_infiniband_mgmt_class,          tvb, local_offset, 1, FALSE); local_offset+=1;
1426     proto_tree_add_item(MAD_header_tree, hf_infiniband_class_version,       tvb, local_offset, 1, FALSE); local_offset+=1;
1427     proto_tree_add_item(MAD_header_tree, hf_infiniband_method,              tvb, local_offset, 1, FALSE); local_offset+=1;
1428     proto_tree_add_item(MAD_header_tree, hf_infiniband_status,              tvb, local_offset, 2, FALSE); local_offset+=2;
1429     proto_tree_add_item(MAD_header_tree, hf_infiniband_class_specific,      tvb, local_offset, 2, FALSE); local_offset+=2;
1430     proto_tree_add_item(MAD_header_tree, hf_infiniband_transaction_id,      tvb, local_offset, 8, FALSE); local_offset+=8;
1431     proto_tree_add_item(MAD_header_tree, hf_infiniband_attribute_id,        tvb, local_offset, 2, FALSE); local_offset+=2;
1432     proto_tree_add_item(MAD_header_tree, hf_infiniband_reserved16,          tvb, local_offset, 2, FALSE); local_offset+=2;
1433     proto_tree_add_item(MAD_header_tree, hf_infiniband_attribute_modifier,  tvb, local_offset, 4, FALSE); local_offset+=4;
1434     proto_tree_add_item(MAD_header_tree, hf_infiniband_data,                tvb, local_offset, 232, FALSE); local_offset+=232;
1435     *offset = (local_offset - 232); /* Move the offset back to the start of the Data field - this will be where the other parsers start. */
1436
1437     return TRUE;
1438 }
1439
1440 /* Parse the RMPP (Reliable Multi-Packet Transaction Protocol
1441 * IN: parentTree to add the dissection to
1442 * IN: tvb - the data buffer from wireshark
1443 * IN/OUT: The current and updated offset */
1444 static gboolean parse_RMPP(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
1445 {
1446     gint local_offset = *offset;
1447     guint8 RMPP_Type = tvb_get_guint8(tvb, local_offset + 1);
1448     proto_tree *RMPP_header_tree = NULL;
1449     proto_item *RMPP_header_item = NULL;
1450
1451     RMPP_header_item = proto_tree_add_item(parentTree, hf_infiniband_RMPP, tvb, local_offset, 12, FALSE);
1452     proto_item_set_text(RMPP_header_item, "%s", val_to_str(RMPP_Type, RMPP_Packet_Types, "Reserved RMPP Type! (0x%02x)"));
1453     RMPP_header_tree = proto_item_add_subtree(RMPP_header_item, ett_rmpp);
1454
1455     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_version,   tvb, local_offset, 1, FALSE); local_offset+=1;
1456     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_type,      tvb, local_offset, 1, FALSE); local_offset+=1;
1457     proto_tree_add_item(RMPP_header_tree, hf_infiniband_r_resp_time,    tvb, local_offset, 1, FALSE);
1458     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_flags,     tvb, local_offset, 1, FALSE); local_offset+=1;
1459     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_status,    tvb, local_offset, 1, FALSE); local_offset+=1;
1460     switch(RMPP_Type)
1461     {
1462         case RMPP_ILLEGAL:
1463             proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_data1,     tvb, local_offset, 32, FALSE); local_offset+=32;
1464             proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_data2,     tvb, local_offset, 32, FALSE); local_offset+=32;
1465             break;
1466         case RMPP_DATA:
1467             proto_tree_add_item(RMPP_header_tree, hf_infiniband_segment_number,     tvb, local_offset, 4, FALSE); local_offset+=4;
1468             proto_tree_add_item(RMPP_header_tree, hf_infiniband_payload_length32,   tvb, local_offset, 4, FALSE); local_offset+=4;
1469             proto_tree_add_item(RMPP_header_tree, hf_infiniband_transferred_data,   tvb, local_offset, 220, FALSE);
1470             break;
1471         case RMPP_ACK:
1472             proto_tree_add_item(RMPP_header_tree, hf_infiniband_segment_number,     tvb, local_offset, 4, FALSE); local_offset+=4;
1473             proto_tree_add_item(RMPP_header_tree, hf_infiniband_new_window_last,    tvb, local_offset, 4, FALSE); local_offset+=4;
1474             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved220,        tvb, local_offset, 220, FALSE);
1475             break;
1476         case RMPP_STOP:
1477         case RMPP_ABORT:
1478             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved32,                     tvb, local_offset, 4, FALSE); local_offset+=4;
1479             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved32,                     tvb, local_offset, 4, FALSE); local_offset+=4;
1480             proto_tree_add_item(RMPP_header_tree, hf_infiniband_optional_extended_error_data,   tvb, local_offset, 220, FALSE);
1481             break;
1482         default:
1483             break;
1484     }
1485     *offset = local_offset;
1486     return TRUE;
1487 }
1488
1489 /* Parse the Method from the MAD Common Header.
1490 * Simply used to generate the identifier.
1491 * IN: SubMItem - the item to append the method label to.
1492 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
1493 * IN: pinfo - packet info from wireshark. */
1494 static void label_SUBM_Method(proto_item *SubMItem, MAD_Data *MadHeader, packet_info *pinfo)
1495 {
1496     const char *label = val_to_str(MadHeader->method, SUBM_Methods, "(Unknown SubManagement Method!)");
1497
1498     proto_item_append_text(SubMItem, "%s", label);
1499     col_append_str(pinfo->cinfo, COL_INFO, label);
1500 }
1501
1502 /* Parse the SA Method from the MAD Common Header.
1503 * Simply used to generate the identifier.
1504 * IN: SubAItem - the item to append the method label to.
1505 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
1506 * IN: pinfo - packet info from wireshark. */
1507 static void label_SUBA_Method(proto_item *SubAItem, MAD_Data *MadHeader, packet_info *pinfo)
1508 {
1509     const char *label = val_to_str(MadHeader->method, SUBA_Methods, "(Unknown SubAdministration Method!)");
1510
1511     proto_item_append_text(SubAItem, "%s", label);
1512     col_append_str(pinfo->cinfo, COL_INFO, label);
1513 }
1514
1515 /* Parse the Attribute from the MAD Common Header
1516 * Simply used to generate the identifier.
1517 * IN: SubMItem - the item to append the Attribute label to.
1518 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
1519 * IN: pinfo - packet info from wireshark. */
1520 static void label_SUBM_Attribute(proto_item *SubMItem, MAD_Data *MadHeader, packet_info *pinfo)
1521 {
1522     const char *label = val_to_str(MadHeader->attributeID, SUBM_Attributes, "(Unknown SubManagement Attribute!)");
1523
1524     proto_item_append_text(SubMItem, "%s", &label[11]);
1525     col_append_str(pinfo->cinfo, COL_INFO, &label[11]);
1526 }
1527
1528 /* Parse the SA Attribute from the MAD Common Header
1529 * Simply used to generate the identifier.
1530 * IN: SubAItem - the item to append the Attribute label to.
1531 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
1532 * IN: pinfo - packet info from wireshark. */
1533 static void label_SUBA_Attribute(proto_item *SubAItem, MAD_Data *MadHeader, packet_info *pinfo)
1534 {
1535     const char *label = val_to_str(MadHeader->attributeID, SUBA_Attributes, "(Unknown SubAdministration Attribute!)");
1536
1537     proto_item_append_text(SubAItem, "%s", &label[11]);
1538     col_append_str(pinfo->cinfo, COL_INFO, &label[11]);
1539 }
1540
1541 /* Parse the attribute from a Subnet Management Packet.
1542 * IN: Parent Tree to add the item to in the dissection tree
1543 * IN: tvbuff, offset - the data and where it is.
1544 * IN: MAD_Data the data from the Common MAD Header that provides the information we need */
1545 static gboolean parse_SUBM_Attribute(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data *MadHeader)
1546 {
1547     guint16 attributeID = MadHeader->attributeID;
1548     proto_tree *SUBM_Attribute_header_tree = NULL;
1549     proto_item *SUBM_Attribute_header_item = NULL;
1550
1551     SUBM_Attribute_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, *offset, 64, FALSE);
1552     proto_item_set_text(SUBM_Attribute_header_item, "%s", val_to_str(attributeID, SUBM_Attributes, "Unknown Attribute Type! (0x%02x)"));
1553     SUBM_Attribute_header_tree = proto_item_add_subtree(SUBM_Attribute_header_item, ett_subm_attribute);
1554
1555
1556     switch(attributeID)
1557     {
1558         case 0x0002:
1559             parse_NoticesAndTraps(SUBM_Attribute_header_tree , tvb, offset);
1560             break;
1561         case 0x0010:
1562              parse_NodeDescription(SUBM_Attribute_header_tree , tvb, offset);
1563             break;
1564         case 0x0011:
1565             parse_NodeInfo(SUBM_Attribute_header_tree , tvb, offset);
1566             break;
1567         case 0x0012:
1568             parse_SwitchInfo(SUBM_Attribute_header_tree , tvb, offset);
1569             break;
1570         case 0x0014:
1571             parse_GUIDInfo(SUBM_Attribute_header_tree , tvb, offset);
1572             break;
1573         case 0x0015:
1574             parse_PortInfo(SUBM_Attribute_header_tree , tvb, offset);
1575             break;
1576         case 0x0016:
1577             parse_P_KeyTable(SUBM_Attribute_header_tree , tvb, offset);
1578             break;
1579         case 0x0017:
1580             parse_SLtoVLMappingTable(SUBM_Attribute_header_tree , tvb, offset);
1581             break;
1582         case 0x0018:
1583             parse_VLArbitrationTable(SUBM_Attribute_header_tree , tvb, offset);
1584             break;
1585         case 0x0019:
1586             parse_LinearForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
1587             break;
1588         case 0x001A:
1589             parse_RandomForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
1590             break;
1591         case 0x001B:
1592             parse_MulticastForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
1593             break;
1594         case 0x001C:
1595             parse_SMInfo(SUBM_Attribute_header_tree , tvb, offset);
1596             break;
1597         case 0x0020:
1598             parse_VendorDiag(SUBM_Attribute_header_tree , tvb, offset);
1599             break;
1600         case 0x0030:
1601             parse_LedInfo(SUBM_Attribute_header_tree , tvb, offset);
1602             break;
1603         case 0x0031:
1604             parse_LinkSpeedWidthPairsTable(SUBM_Attribute_header_tree , tvb, offset);
1605             break;
1606         default:
1607             break;
1608     }
1609
1610
1611     *offset += 64;
1612     return TRUE;
1613
1614 }
1615 /* Parse the attribute from a Subnet Administration Packet.
1616 * IN: Parent Tree to add the item to in the dissection tree
1617 * IN: tvbuff, offset - the data and where it is.
1618 * IN: MAD_Data the data from the Common MAD Header that provides the information we need */
1619 static gboolean parse_SUBA_Attribute(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data *MadHeader)
1620 {
1621     guint16 attributeID = MadHeader->attributeID;
1622     proto_tree *SUBA_Attribute_header_tree = NULL;
1623     proto_item *SUBA_Attribute_header_item = NULL;
1624
1625     SUBA_Attribute_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, *offset, 200, FALSE);
1626     proto_item_set_text(SUBA_Attribute_header_item, "%s", val_to_str(attributeID, SUBA_Attributes, "Unknown Attribute Type! (0x%02x)"));
1627     SUBA_Attribute_header_tree = proto_item_add_subtree(SUBA_Attribute_header_item, ett_suba_attribute);
1628
1629     /* Skim off the RID fields should they be present */
1630     parse_RID(SUBA_Attribute_header_tree, tvb, offset, MadHeader);
1631
1632     /* Parse the rest of the attributes */
1633     switch(MadHeader->attributeID)
1634     {
1635         case 0x0001: /* (ClassPortInfo) */
1636             parse_PortInfo(SUBA_Attribute_header_tree, tvb, offset);
1637             break;
1638         case 0x0002: /* (Notice) */
1639             parse_NoticesAndTraps(SUBA_Attribute_header_tree, tvb, offset);
1640             break;
1641         case 0x0003: /* (InformInfo) */
1642             parse_InformInfo(SUBA_Attribute_header_tree, tvb, offset);
1643             break;
1644         case 0x0011: /* (NodeRecord) */
1645             parse_NodeInfo(SUBA_Attribute_header_tree, tvb, offset);
1646             *offset += 40;
1647             parse_NodeDescription(SUBA_Attribute_header_tree, tvb, offset);
1648             break;
1649         case 0x0012: /* (PortInfoRecord) */
1650             parse_PortInfo(SUBA_Attribute_header_tree, tvb, offset);
1651             break;
1652         case 0x0013: /* (SLtoVLMappingTableRecord) */
1653             parse_SLtoVLMappingTable(SUBA_Attribute_header_tree, tvb, offset);
1654             break;
1655         case 0x0014: /* (SwitchInfoRecord) */
1656             parse_SwitchInfo(SUBA_Attribute_header_tree, tvb, offset);
1657             break;
1658         case 0x0015: /*(LinearForwardingTableRecord) */
1659             parse_LinearForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
1660             break;
1661         case 0x0016: /* (RandomForwardingTableRecord) */
1662             parse_RandomForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
1663             break;
1664         case 0x0017: /* (MulticastForwardingTableRecord) */
1665             parse_MulticastForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
1666             break;
1667         case 0x0018: /* (SMInfoRecord) */
1668             parse_SMInfo(SUBA_Attribute_header_tree, tvb, offset);
1669             break;
1670         case 0x0019: /* (LinkSpeedWidthPairsTableRecord) */
1671             parse_LinkSpeedWidthPairsTable(SUBA_Attribute_header_tree, tvb, offset);
1672             break;
1673         case 0x00F3: /*(InformInfoRecord) */
1674             parse_InformInfo(SUBA_Attribute_header_tree, tvb, offset);
1675             break;
1676         case 0x0020: /* (LinkRecord) */
1677             parse_LinkRecord(SUBA_Attribute_header_tree, tvb, offset);
1678             break;
1679         case 0x0030: /* (GuidInforecord) */
1680             parse_GUIDInfo(SUBA_Attribute_header_tree, tvb, offset);
1681             break;
1682         case 0x0031: /*(ServiceRecord) */
1683             parse_ServiceRecord(SUBA_Attribute_header_tree, tvb, offset);
1684             break;
1685         case 0x0033: /* (P_KeyTableRecord) */
1686             parse_P_KeyTable(SUBA_Attribute_header_tree, tvb, offset);
1687             break;
1688         case 0x0035: /* (PathRecord) */
1689             parse_PathRecord(SUBA_Attribute_header_tree, tvb, offset);
1690             break;
1691         case 0x0036: /* (VLArbitrationTableRecord) */
1692             parse_VLArbitrationTable(SUBA_Attribute_header_tree, tvb, offset);
1693             break;
1694         case 0x0038: /* (MCMemberRecord) */
1695             parse_MCMemberRecord(SUBA_Attribute_header_tree, tvb, offset);
1696             break;
1697         case 0x0039: /* (TraceRecord) */
1698             parse_TraceRecord(SUBA_Attribute_header_tree, tvb, offset);
1699             break;
1700         case 0x003A: /* (MultiPathRecord) */
1701             parse_MultiPathRecord(SUBA_Attribute_header_tree, tvb, offset);
1702             break;
1703         case 0x003B: /* (ServiceAssociationRecord) */
1704             parse_ServiceAssociationRecord(SUBA_Attribute_header_tree, tvb, offset);
1705             break;
1706         default: /* (Unknown SubAdministration Attribute!) */
1707             /* We've already labeled as unknown in item construction */
1708             break;
1709     }
1710
1711     *offset += 200;
1712     return TRUE;
1713 }
1714
1715 /* Subnet Management Attribute Parsing Methods.
1716 *  Also Parsing for Attributes common to both SM/SA.
1717 * The Subnet Admin Parsing methods will call some of these methods when an attribute is present within an SA MAD
1718 */
1719
1720
1721 /* Parse NoticeDataDetails Attribute Field
1722 * IN:   parentTree - The tree to add the dissection to
1723 *       tvb - The tvbbuff of packet data
1724 *       offset - The offset in TVB where the attribute begins
1725 *       trapNumber - The Trap ID of the Trap Data being Dissected  */
1726
1727 static void parse_NoticeDataDetails(proto_tree* parentTree, tvbuff_t* tvb, gint *offset, guint16 trapNumber)
1728 {
1729     gint local_offset = *offset;
1730     proto_tree *DataDetails_header_tree = NULL;
1731     proto_item *DataDetails_header_item = NULL;
1732
1733     if(!parentTree)
1734         return;
1735
1736     DataDetails_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 54, FALSE);
1737     DataDetails_header_tree = proto_item_add_subtree(DataDetails_header_item, ett_datadetails);
1738
1739
1740     switch(trapNumber)
1741     {
1742         case 64:
1743             proto_item_set_text(DataDetails_header_item, "%s", "Trap 64 DataDetails");
1744             local_offset +=6;
1745             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
1746         break;
1747         case 65:
1748             proto_item_set_text(DataDetails_header_item, "%s", "Trap 65 DataDetails");
1749             local_offset +=6;
1750             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
1751         break;
1752         case 66:
1753             proto_item_set_text(DataDetails_header_item, "%s", "Trap 66 DataDetails");
1754             local_offset +=6;
1755             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
1756         break;
1757         case 67:
1758             proto_item_set_text(DataDetails_header_item, "%s", "Trap 67 DataDetails");
1759             local_offset +=6;
1760             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
1761         break;
1762         case 68:
1763             proto_item_set_text(DataDetails_header_item, "%s", "Trap 68 DataDetails");
1764             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_COMP_MASK,          tvb, local_offset, 8, FALSE);  local_offset+=8;
1765             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_WAIT_FOR_REPATH,    tvb, local_offset, 1, FALSE);
1766         break;
1767         case 69:
1768             proto_item_set_text(DataDetails_header_item, "%s", "Trap 69 DataDetails");
1769             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_COMP_MASK,          tvb, local_offset, 8, FALSE);  local_offset+=8;
1770             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_WAIT_FOR_REPATH,    tvb, local_offset, 1, FALSE);
1771         break;
1772         case 128:
1773             proto_item_set_text(DataDetails_header_item, "%s", "Trap 128 DataDetails");
1774             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1775         break;
1776         case 129:
1777             proto_item_set_text(DataDetails_header_item, "%s", "Trap 129 DataDetails");
1778             local_offset += 2;
1779             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1780             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1781         break;
1782         case 130:
1783             proto_item_set_text(DataDetails_header_item, "%s", "Trap 130 DataDetails");
1784             local_offset += 2;
1785             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1786             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1787         break;
1788         case 131:
1789             proto_item_set_text(DataDetails_header_item, "%s", "Trap 131 DataDetails");
1790             local_offset += 2;
1791             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1792             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1793         break;
1794         case 144:
1795             proto_item_set_text(DataDetails_header_item, "%s", "Trap 144 DataDetails");
1796             local_offset +=2;
1797             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1798             local_offset +=1;
1799             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_OtherLocalChanges,      tvb, local_offset, 1, FALSE);  local_offset+=1;
1800             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_CAPABILITYMASK,     tvb, local_offset, 4, FALSE);  local_offset+=4;
1801             local_offset +=1;
1802             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LinkSpeecEnabledChange,     tvb, local_offset, 1, FALSE);
1803             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LinkWidthEnabledChange,     tvb, local_offset, 1, FALSE);
1804             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_NodeDescriptionChange,      tvb, local_offset, 1, FALSE);
1805         break;
1806         case 145:
1807             proto_item_set_text(DataDetails_header_item, "%s", "Trap 145 DataDetails");
1808             local_offset +=2;
1809             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1810             local_offset +=2;
1811             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SYSTEMIMAGEGUID,        tvb, local_offset, 8, FALSE);  local_offset+=8;
1812         break;
1813         case 256:
1814             proto_item_set_text(DataDetails_header_item, "%s", "Trap 256 DataDetails");
1815             local_offset +=2;
1816             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,            tvb, local_offset, 2, FALSE);  local_offset+=2;
1817             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRSLID,             tvb, local_offset, 2, FALSE);  local_offset+=2;
1818             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_METHOD,             tvb, local_offset, 1, FALSE);  local_offset+=1;
1819             local_offset +=1;
1820             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_ATTRIBUTEID,        tvb, local_offset, 2, FALSE);  local_offset+=2;
1821             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_ATTRIBUTEMODIFIER,  tvb, local_offset, 4, FALSE);  local_offset+=4;
1822             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_MKEY,               tvb, local_offset, 8, FALSE);  local_offset+=8;
1823             local_offset +=1;
1824             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRNotice,           tvb, local_offset, 1, FALSE);
1825             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRPathTruncated,    tvb, local_offset, 1, FALSE);
1826             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRHopCount,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1827             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRNoticeReturnPath, tvb, local_offset, 30, FALSE);  local_offset+=30;
1828         break;
1829         case 257:
1830             proto_item_set_text(DataDetails_header_item, "%s", "Trap 257 DataDetails");
1831             local_offset+=2;
1832             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1833             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1834             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_KEY,        tvb, local_offset, 4, FALSE);  local_offset+=4;
1835             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1836             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1837             local_offset +=1;
1838             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1839             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1840             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1841         break;
1842         case 258:
1843             proto_item_set_text(DataDetails_header_item, "%s", "Trap 258 DataDetails");
1844             local_offset+=2;
1845             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1846             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1847             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_KEY,        tvb, local_offset, 4, FALSE);  local_offset+=4;
1848             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset +=1;
1849             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1850             local_offset +=1;
1851             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1852             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1853             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1854         break;
1855         case 259:
1856             proto_item_set_text(DataDetails_header_item, "%s", "Trap 259 DataDetails");
1857             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DataValid,  tvb, local_offset, 2, FALSE);  local_offset+=2;
1858             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1859             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
1860             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PKEY,       tvb, local_offset, 2, FALSE);  local_offset+=2;
1861             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset+=1;
1862             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1863             local_offset +=1;
1864             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
1865             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1866             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
1867             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SWLIDADDR,  tvb, local_offset, 2, FALSE);  local_offset+=2;
1868             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,     tvb, local_offset, 1, FALSE);  local_offset+=1;
1869         break;
1870         default:
1871             proto_item_set_text(DataDetails_header_item, "%s", "Vendor Specific Subnet Management Trap"); local_offset +=54;
1872             break;
1873     }
1874
1875 }
1876
1877 /* Parse NoticesAndTraps Attribute
1878 * IN:   parentTree - The tree to add the dissection to
1879 *       tvb - The tvbbuff of packet data
1880 *       offset - The offset in TVB where the attribute begins
1881 *       MadHeader - The common MAD header of the current SMP/SMA  */
1882 static void parse_NoticesAndTraps(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
1883 {
1884     gint local_offset = *offset;
1885     proto_tree *NoticesAndTraps_header_tree = NULL;
1886     proto_item *NoticesAndTraps_header_item = NULL;
1887     guint16 trapNumber = tvb_get_ntohs(tvb, local_offset + 4);
1888
1889     if(!parentTree)
1890         return;
1891
1892     NoticesAndTraps_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
1893     proto_item_set_text(NoticesAndTraps_header_item, "%s", val_to_str(trapNumber, Trap_Description, "Unknown or Vendor Specific Trap Number! (0x%02x)"));
1894     NoticesAndTraps_header_tree = proto_item_add_subtree(NoticesAndTraps_header_item, ett_noticestraps);
1895
1896     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IsGeneric,                tvb, local_offset, 1, FALSE);
1897     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_Type,                     tvb, local_offset, 1, FALSE); local_offset+=1;
1898     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_ProducerTypeVendorID,     tvb, local_offset, 3, FALSE); local_offset+=3;
1899     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_TrapNumberDeviceID,       tvb, local_offset, 2, FALSE); local_offset+=2;
1900     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IssuerLID,                tvb, local_offset, 2, FALSE); local_offset+=2;
1901     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_NoticeToggle,             tvb, local_offset, 1, FALSE);
1902     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_NoticeCount,              tvb, local_offset, 2, FALSE); local_offset+=2;
1903
1904     parse_NoticeDataDetails(NoticesAndTraps_header_tree, tvb, &local_offset, trapNumber);
1905     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_DataDetails,              tvb, local_offset, 54, FALSE); local_offset+=54;
1906
1907     /* Only Defined For GMPs not SMPs which is not part of this dissector phase
1908     *proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IssuerGID,               tvb, local_offset, 16, FALSE); local_offset+=16;
1909     *proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_ClassTrapSpecificData,   tvb, local_offset, 1, FALSE); local_offset+=1; */
1910
1911 }
1912
1913 /* Parse NodeDescription Attribute
1914 * IN:   parentTree - The tree to add the dissection to
1915 *       tvb - The tvbbuff of packet data
1916 *       offset - The offset in TVB where the attribute begins
1917 *       MadHeader - The common MAD header of the current SMP/SMA  */
1918 static void parse_NodeDescription(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
1919 {
1920     gint local_offset = *offset;
1921     proto_tree *NodeDescription_header_tree = NULL;
1922
1923     if(!parentTree)
1924         return;
1925
1926     NodeDescription_header_tree = parentTree;
1927     proto_tree_add_item(NodeDescription_header_tree, hf_infiniband_NodeDescription_NodeString,  tvb, local_offset, 64, FALSE);
1928 }
1929
1930 /* Parse NodeInfo Attribute
1931 * IN:   parentTree - The tree to add the dissection to
1932 *       tvb - The tvbbuff of packet data
1933 *       offset - The offset in TVB where the attribute begins
1934 *       MadHeader - The common MAD header of the current SMP/SMA  */
1935 static void parse_NodeInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
1936 {
1937     gint local_offset = *offset;
1938     proto_tree *NodeInfo_header_tree = NULL;
1939
1940     if(!parentTree)
1941         return;
1942
1943     NodeInfo_header_tree = parentTree;
1944
1945     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_BaseVersion,       tvb, local_offset, 1, FALSE); local_offset +=1;
1946     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_ClassVersion,      tvb, local_offset, 1, FALSE); local_offset +=1;
1947     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NodeType,          tvb, local_offset, 1, FALSE); local_offset +=1;
1948     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NumPorts,          tvb, local_offset, 1, FALSE); local_offset +=1;
1949     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_SystemImageGUID,   tvb, local_offset, 8, FALSE); local_offset +=8;
1950     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NodeGUID,          tvb, local_offset, 8, FALSE); local_offset +=8;
1951     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_PortGUID,          tvb, local_offset, 8, FALSE); local_offset +=8;
1952     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_PartitionCap,      tvb, local_offset, 2, FALSE); local_offset +=2;
1953     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_DeviceID,          tvb, local_offset, 2, FALSE); local_offset +=2;
1954     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_Revision,          tvb, local_offset, 4, FALSE); local_offset +=4;
1955     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_LocalPortNum,      tvb, local_offset, 1, FALSE); local_offset +=1;
1956     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_VendorID,          tvb, local_offset, 3, FALSE); local_offset +=3;
1957
1958 }
1959
1960 /* Parse SwitchInfo Attribute
1961 * IN:   parentTree - The tree to add the dissection to
1962 *       tvb - The tvbbuff of packet data
1963 *       offset - The offset in TVB where the attribute begins
1964 *       MadHeader - The common MAD header of the current SMP/SMA  */
1965 static void parse_SwitchInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
1966 {
1967     gint local_offset = *offset;
1968     proto_tree *SwitchInfo_header_tree = NULL;
1969
1970     if(!parentTree)
1971         return;
1972
1973     SwitchInfo_header_tree = parentTree;
1974
1975     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LinearFDBCap,                      tvb, local_offset, 2, FALSE); local_offset +=2;
1976     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_RandomFDBCap,                      tvb, local_offset, 2, FALSE); local_offset +=2;
1977     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_MulticastFDBCap,                   tvb, local_offset, 2, FALSE); local_offset +=2;
1978     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LinearFDBTop,                      tvb, local_offset, 2, FALSE); local_offset +=2;
1979     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultPort,                       tvb, local_offset, 1, FALSE); local_offset +=1;
1980     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultMulticastPrimaryPort,       tvb, local_offset, 1, FALSE); local_offset +=1;
1981     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultMulticastNotPrimaryPort,    tvb, local_offset, 1, FALSE); local_offset +=1;
1982     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LifeTimeValue,                     tvb, local_offset, 1, FALSE);
1983     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_PortStateChange,                   tvb, local_offset, 1, FALSE);
1984     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_OptimizedSLtoVLMappingProgramming, tvb, local_offset, 1, FALSE); local_offset +=1;
1985     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LIDsPerPort,                       tvb, local_offset, 2, FALSE); local_offset +=2;
1986     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_PartitionEnforcementCap,           tvb, local_offset, 2, FALSE); local_offset +=2;
1987     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_InboundEnforcementCap,             tvb, local_offset, 1, FALSE);
1988     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_OutboundEnforcementCap,            tvb, local_offset, 1, FALSE);
1989     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_FilterRawInboundCap,               tvb, local_offset, 1, FALSE);
1990     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_FilterRawOutboundCap,              tvb, local_offset, 1, FALSE);
1991     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_EnhancedPortZero,                  tvb, local_offset, 1, FALSE); local_offset +=1;
1992 }
1993
1994 /* Parse GUIDInfo Attribute
1995 * IN:   parentTree - The tree to add the dissection to
1996 *       tvb - The tvbbuff of packet data
1997 *       offset - The offset in TVB where the attribute begins
1998 *       MadHeader - The common MAD header of the current SMP/SMA  */
1999 static void parse_GUIDInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2000 {
2001     gint local_offset = *offset;
2002     proto_tree *GUIDInfo_header_tree = NULL;
2003     proto_item *tempItemLow = NULL;
2004     gint i = 0;
2005
2006     if(!parentTree)
2007         return;
2008
2009     GUIDInfo_header_tree = parentTree;
2010
2011     for(i = 0; i < 8; i++)
2012     {
2013         proto_tree_add_item(GUIDInfo_header_tree, hf_infiniband_GUIDInfo_GUID, tvb, local_offset, 8, FALSE); local_offset +=8;
2014         proto_item_append_text(tempItemLow, "(%u)", i);
2015     }
2016
2017 }
2018
2019 /* Parse PortInfo Attribute
2020 * IN:   parentTree - The tree to add the dissection to
2021 *       tvb - The tvbbuff of packet data
2022 *       offset - The offset in TVB where the attribute begins
2023 *       MadHeader - The common MAD header of the current SMP/SMA  */
2024 static void parse_PortInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2025 {
2026     gint local_offset = *offset;
2027     proto_tree *PortInfo_header_tree = NULL;
2028     proto_tree *PortInfo_CapabilityMask_tree = NULL;
2029     proto_item *PortInfo_CapabilityMask_item = NULL;
2030     proto_item *temp_item = NULL;
2031     guint16 temp_val = 0;
2032
2033     if(!parentTree)
2034         return;
2035
2036     PortInfo_header_tree = parentTree;
2037
2038     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_Key,                 tvb, local_offset, 8, FALSE); local_offset +=8;
2039     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_GidPrefix,             tvb, local_offset, 8, FALSE); local_offset +=8;
2040     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LID,                   tvb, local_offset, 2, FALSE); local_offset +=2;
2041     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MasterSMLID,           tvb, local_offset, 2, FALSE); local_offset +=2;
2042
2043     /* Capability Mask Flags */
2044     PortInfo_CapabilityMask_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_CapabilityMask,     tvb, local_offset, 4, FALSE);
2045     PortInfo_CapabilityMask_tree = proto_item_add_subtree(PortInfo_CapabilityMask_item, ett_portinfo_capmask);
2046
2047     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SM,                             tvb, local_offset, 4, FALSE);
2048     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_NoticeSupported,                tvb, local_offset, 4, FALSE);
2049     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_TrapSupported,                  tvb, local_offset, 4, FALSE);
2050     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_OptionalPDSupported,            tvb, local_offset, 4, FALSE);
2051     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_AutomaticMigrationSupported,    tvb, local_offset, 4, FALSE);
2052     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SLMappingSupported,             tvb, local_offset, 4, FALSE);
2053     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_MKeyNVRAM,                      tvb, local_offset, 4, FALSE);
2054     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_PKeyNVRAM,                      tvb, local_offset, 4, FALSE);
2055     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LEDInfoSupported,               tvb, local_offset, 4, FALSE);
2056     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SMdisabled,                     tvb, local_offset, 4, FALSE);
2057     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SystemImageGUIDSupported,       tvb, local_offset, 4, FALSE);
2058     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_PKeySwitchExternalPortTrapSupported,    tvb, local_offset, 4, FALSE);
2059     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_CommunicationsManagementSupported,      tvb, local_offset, 4, FALSE);
2060     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SNMPTunnelingSupported,                 tvb, local_offset, 4, FALSE);
2061     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_ReinitSupported,                tvb, local_offset, 4, FALSE);
2062     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_DeviceManagementSupported,      tvb, local_offset, 4, FALSE);
2063     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_VendorClassSupported,           tvb, local_offset, 4, FALSE);
2064     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_DRNoticeSupported,              tvb, local_offset, 4, FALSE);
2065     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_CapabilityMaskNoticeSupported,  tvb, local_offset, 4, FALSE);
2066     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_BootManagementSupported,        tvb, local_offset, 4, FALSE);
2067     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LinkRoundTripLatencySupported,  tvb, local_offset, 4, FALSE);
2068     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_ClientRegistrationSupported,    tvb, local_offset, 4, FALSE);
2069     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_OtherLocalChangesNoticeSupported,   tvb, local_offset, 4, FALSE);
2070     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LinkSpeedWIdthPairsTableSupported,  tvb, local_offset, 4, FALSE);
2071     local_offset+=4;
2072     /* End Capability Mask Flags */
2073
2074     /* Diag Code */
2075     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_DiagCode,              tvb, local_offset, 2, FALSE);
2076     temp_val = tvb_get_ntohs(tvb, local_offset);
2077
2078     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, DiagCode, "Reserved DiagCode! Possible Error"));
2079     local_offset +=2;
2080     /* End Diag Code */
2081
2082     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyLeasePeriod,      tvb, local_offset, 2, FALSE); local_offset +=2;
2083     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LocalPortNum,          tvb, local_offset, 1, FALSE); local_offset +=1;
2084
2085     /* LinkWidthEnabled */
2086     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthEnabled,      tvb, local_offset, 1, FALSE);
2087     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2088
2089     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthEnabled, "Reserved LinkWidthEnabled Value! Possible Error"));
2090     local_offset +=1;
2091     /* End LinkWidthEnabled */
2092
2093     /* LinkWidthSupported */
2094     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthSupported,    tvb, local_offset, 1, FALSE);
2095     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2096
2097     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthSupported, "Reserved LinkWidthSupported Value! Possible Error"));
2098     local_offset +=1;
2099     /* End LinkWidthSupported */
2100
2101     /* LinkWidthActive */
2102     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthActive,       tvb, local_offset, 1, FALSE);
2103     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2104
2105     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthActive, "Reserved LinkWidthActive Value! Possible Error"));
2106     local_offset +=1;
2107     /* End LinkWidthActive */
2108
2109     /* LinkSpeedSupported */
2110     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedSupported,    tvb, local_offset, 1, FALSE);
2111     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2112
2113     /* 4 bit values = mask and shift */
2114     temp_val = temp_val & 0x00F0;
2115     temp_val = temp_val >> 4;
2116
2117     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedSupported, "Reserved LinkWidthSupported Value! Possible Error"));
2118     /* End LinkSpeedSupported */
2119
2120     /* PortState */
2121     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PortState,             tvb, local_offset, 1, FALSE);
2122     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2123
2124     /* 4 bit values = mask and shift */
2125     temp_val = temp_val & 0x000F;
2126     /*temp_val = temp_val >> 4 */
2127
2128     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, PortState, "Reserved PortState Value! Possible Error"));
2129     local_offset +=1;
2130     /* End PortState */
2131
2132     /* PortPhysicalState */
2133     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PortPhysicalState,     tvb, local_offset, 1, FALSE);
2134     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2135
2136     /* 4 bit values = mask and shift */
2137     temp_val = temp_val & 0x00F0;
2138     temp_val = temp_val >> 4;
2139
2140     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, PortPhysicalState, "Reserved PortPhysicalState Value! Possible Error"));
2141     /* End PortPhysicalState */
2142
2143     /* LinkDownDefaultState */
2144     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkDownDefaultState,  tvb, local_offset, 1, FALSE);
2145     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2146
2147     /* 4 bit values = mask and shift */
2148     temp_val = temp_val & 0x000F;
2149     /*temp_val = temp_val >> 4 */
2150
2151     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkDownDefaultState, "Reserved LinkDownDefaultState Value! Possible Error"));
2152     local_offset +=1;
2153     /* End LinkDownDefaultState */
2154
2155     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyProtectBits,      tvb, local_offset, 1, FALSE);
2156     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LMC,                   tvb, local_offset, 1, FALSE); local_offset +=1;
2157
2158     /* LinkSpeedActive */
2159     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedActive,       tvb, local_offset, 1, FALSE);
2160     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2161
2162     /* 4 bit values = mask and shift */
2163     temp_val = temp_val & 0x00F0;
2164     temp_val = temp_val >> 4;
2165
2166     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedActive, "Reserved LinkSpeedActive Value! Possible Error"));
2167     /* End LinkSpeedActive */
2168
2169     /* LinkSpeedEnabled */
2170     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedEnabled,      tvb, local_offset, 1, FALSE);
2171     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2172
2173     /* 4 bit values = mask and shift */
2174     temp_val = temp_val & 0x000F;
2175     /*temp_val = temp_val >> 4 */
2176
2177     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedEnabled, "Reserved LinkSpeedEnabled Value! Possible Error"));
2178     local_offset +=1;
2179     /* End LinkSpeedEnabled */
2180
2181     /* NeighborMTU */
2182     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_NeighborMTU,           tvb, local_offset, 1, FALSE);
2183     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2184
2185     /* 4 bit values = mask and shift */
2186     temp_val = temp_val & 0x00F0;
2187     temp_val = temp_val >> 4;
2188
2189     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, NeighborMTU, "Reserved NeighborMTU Value! Possible Error"));
2190
2191     /* End NeighborMTU */
2192
2193     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MasterSMSL,            tvb, local_offset, 1, FALSE); local_offset +=1;
2194
2195     /* VLCap */
2196     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLCap,                 tvb, local_offset, 1, FALSE);
2197     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2198
2199     /* 4 bit values = mask and shift */
2200     temp_val = temp_val & 0x00F0;
2201     temp_val = temp_val >> 4;
2202
2203     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, VLCap, "Reserved VLCap Value! Possible Error"));
2204
2205     /* End VLCap */
2206
2207     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_InitType,              tvb, local_offset, 1, FALSE); local_offset +=1;
2208     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLHighLimit,           tvb, local_offset, 1, FALSE); local_offset +=1;
2209     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLArbitrationHighCap,  tvb, local_offset, 1, FALSE); local_offset +=1;
2210     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLArbitrationLowCap,   tvb, local_offset, 1, FALSE); local_offset +=1;
2211     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_InitTypeReply,         tvb, local_offset, 1, FALSE);
2212
2213     /* MTUCap */
2214     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MTUCap,                tvb, local_offset, 1, FALSE);
2215     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2216
2217     /* 4 bit values = mask and shift */
2218     temp_val = temp_val & 0x000F;
2219     /*temp_val = temp_val >> 4 */
2220
2221     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, MTUCap, "Reserved MTUCap Value! Possible Error"));
2222     local_offset +=1;
2223     /* End MTUCap */
2224
2225     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLStallCount,          tvb, local_offset, 1, FALSE);
2226     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_HOQLife,               tvb, local_offset, 1, FALSE); local_offset +=1;
2227
2228     /* OperationalVLs */
2229     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_OperationalVLs,        tvb, local_offset, 1, FALSE);
2230     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
2231
2232     /* 4 bit values = mask and shift */
2233     temp_val = temp_val & 0x00F0;
2234     temp_val = temp_val >> 4;
2235
2236     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, OperationalVLs, "Reserved OperationalVLs Value! Possible Error"));
2237     /* End OperationalVLs */
2238
2239     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PartitionEnforcementInbound,       tvb, local_offset, 1, FALSE);
2240     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PartitionEnforcementOutbound,      tvb, local_offset, 1, FALSE);
2241     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_FilterRawInbound,      tvb, local_offset, 1, FALSE);
2242     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_FilterRawOutbound,     tvb, local_offset, 1, FALSE); local_offset +=1;
2243     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
2244     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_P_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
2245     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_Q_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
2246     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_GUIDCap,               tvb, local_offset, 1, FALSE); local_offset +=1;
2247     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_ClientReregister,      tvb, local_offset, 1, FALSE);
2248     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_SubnetTimeOut,         tvb, local_offset, 1, FALSE); local_offset +=1;
2249     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_RespTimeValue,         tvb, local_offset, 1, FALSE); local_offset +=1;
2250     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LocalPhyErrors,        tvb, local_offset, 1, FALSE);
2251     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_OverrunErrors,         tvb, local_offset, 1, FALSE); local_offset +=1;
2252     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MaxCreditHint,         tvb, local_offset, 2, FALSE); local_offset +=3; /* 2 + 1 Reserved */
2253     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkRoundTripLatency,  tvb, local_offset, 3, FALSE); local_offset +=3;
2254 }
2255
2256 /* Parse P_KeyTable Attribute
2257 * IN:   parentTree - The tree to add the dissection to
2258 *       tvb - The tvbbuff of packet data
2259 *       offset - The offset in TVB where the attribute begins
2260 *       MadHeader - The common MAD header of the current SMP/SMA  */
2261 static void parse_P_KeyTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2262 {
2263     gint local_offset = *offset;
2264     gint i = 0;
2265     proto_tree *P_KeyTable_header_tree = NULL;
2266     proto_item *P_KeyTable_header_item = NULL;
2267     proto_item *tempItemLow = NULL;
2268     proto_item *tempItemHigh = NULL;
2269
2270     if(!parentTree)
2271         return;
2272
2273     P_KeyTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_P_KeyTable_P_KeyTableBlock, tvb, local_offset, 64, FALSE);
2274     proto_item_set_text(P_KeyTable_header_item, "%s", "P_KeyTable");
2275     P_KeyTable_header_tree = proto_item_add_subtree(P_KeyTable_header_item, ett_pkeytable);
2276
2277     for(i = 0; i < 32; i++)
2278     {
2279         tempItemLow = proto_tree_add_item(P_KeyTable_header_tree, hf_infiniband_P_KeyTable_MembershipType,  tvb, local_offset, 1, FALSE);
2280         tempItemHigh = proto_tree_add_item(P_KeyTable_header_tree, hf_infiniband_P_KeyTable_P_KeyBase,          tvb, local_offset, 2, FALSE); local_offset +=2;
2281         proto_item_append_text(tempItemLow, "(%u)", i);
2282         proto_item_append_text(tempItemHigh,"(%u)", i+1);
2283     }
2284 }
2285
2286 /* Parse SLtoVLMappingTable Attribute
2287 * IN:   parentTree - The tree to add the dissection to
2288 *       tvb - The tvbbuff of packet data
2289 *       offset - The offset in TVB where the attribute begins
2290 *       MadHeader - The common MAD header of the current SMP/SMA  */
2291 static void parse_SLtoVLMappingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2292 {
2293     gint local_offset = *offset;
2294     proto_tree *SLtoVLMappingTable_header_tree = NULL;
2295     proto_item *SLtoVLMappingTable_header_item = NULL;
2296     proto_item *tempItemLow = NULL;
2297     proto_item *tempItemHigh = NULL;
2298     gint i = 0;
2299
2300     if(!parentTree)
2301         return;
2302
2303     SLtoVLMappingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2304     proto_item_set_text(SLtoVLMappingTable_header_item, "%s", "SLtoVLMappingTable");
2305     SLtoVLMappingTable_header_tree = proto_item_add_subtree(SLtoVLMappingTable_header_item, ett_sltovlmapping);
2306
2307     for(i = 0; i < 8; i++)
2308     {
2309         tempItemLow = proto_tree_add_item(SLtoVLMappingTable_header_tree, hf_infiniband_SLtoVLMappingTable_SLtoVL_HighBits,  tvb, local_offset, 1, FALSE);
2310         tempItemHigh = proto_tree_add_item(SLtoVLMappingTable_header_tree, hf_infiniband_SLtoVLMappingTable_SLtoVL_LowBits,  tvb, local_offset, 1, FALSE); local_offset +=1;
2311         proto_item_append_text(tempItemLow, "(%u)", i);
2312         proto_item_append_text(tempItemHigh,"(%u)", i+1);
2313     }
2314 }
2315
2316 /* Parse VLArbitrationTable Attribute
2317 * IN:   parentTree - The tree to add the dissection to
2318 *       tvb - The tvbbuff of packet data
2319 *       offset - The offset in TVB where the attribute begins
2320 *       MadHeader - The common MAD header of the current SMP/SMA  */
2321 static void parse_VLArbitrationTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2322 {
2323     gint local_offset = *offset;
2324     gint i = 0;
2325     proto_tree *VLArbitrationTable_header_tree = NULL;
2326     proto_item *VLArbitrationTable_header_item = NULL;
2327     proto_item *tempItemLow = NULL;
2328     proto_item *tempItemHigh = NULL;
2329
2330     if(!parentTree)
2331         return;
2332
2333     VLArbitrationTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2334     proto_item_set_text(VLArbitrationTable_header_item, "%s", "VLArbitrationTable");
2335     VLArbitrationTable_header_tree = proto_item_add_subtree(VLArbitrationTable_header_item, ett_vlarbitrationtable);
2336
2337     for(i = 0; i < 32; i++)
2338     {
2339         tempItemLow = proto_tree_add_item(VLArbitrationTable_header_tree, hf_infiniband_VLArbitrationTable_VL,      tvb, local_offset, 1, FALSE); local_offset +=1;
2340         tempItemHigh = proto_tree_add_item(VLArbitrationTable_header_tree, hf_infiniband_VLArbitrationTable_Weight, tvb, local_offset, 1, FALSE); local_offset +=1;
2341         proto_item_append_text(tempItemLow, "(%u)", i);
2342         proto_item_append_text(tempItemHigh,"(%u)", i);
2343     }
2344 }
2345
2346 /* Parse LinearForwardingTable Attribute
2347 * IN:   parentTree - The tree to add the dissection to
2348 *       tvb - The tvbbuff of packet data
2349 *       offset - The offset in TVB where the attribute begins
2350 *       MadHeader - The common MAD header of the current SMP/SMA  */
2351 static void parse_LinearForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2352 {
2353     gint i = 0;
2354     gint local_offset = *offset;
2355     proto_tree *LinearForwardingTable_header_tree = NULL;
2356     proto_item *LinearForwardingTable_header_item = NULL;
2357     proto_item *tempItemLow = NULL;
2358
2359     if(!parentTree)
2360         return;
2361
2362     LinearForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2363     proto_item_set_text(LinearForwardingTable_header_item, "%s", "LinearForwardingTable");
2364     LinearForwardingTable_header_tree = proto_item_add_subtree(LinearForwardingTable_header_item, ett_linearforwardingtable);
2365
2366     for(i = 0; i < 64; i++)
2367     {
2368         tempItemLow = proto_tree_add_item(LinearForwardingTable_header_tree, hf_infiniband_LinearForwardingTable_Port, tvb, local_offset, 1, FALSE); local_offset +=1;
2369         proto_item_append_text(tempItemLow, "(%u)", i);
2370     }
2371 }
2372
2373 /* Parse RandomForwardingTable Attribute
2374 * IN:   parentTree - The tree to add the dissection to
2375 *       tvb - The tvbbuff of packet data
2376 *       offset - The offset in TVB where the attribute begins
2377 *       MadHeader - The common MAD header of the current SMP/SMA  */
2378 static void parse_RandomForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2379 {
2380     gint i = 0;
2381     gint local_offset = *offset;
2382     proto_tree *RandomForwardingTable_header_tree = NULL;
2383     proto_item *RandomForwardingTable_header_item = NULL;
2384     proto_item *tempItemLow = NULL;
2385
2386     if(!parentTree)
2387         return;
2388
2389     RandomForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2390     proto_item_set_text(RandomForwardingTable_header_item, "%s", "RandomForwardingTable");
2391     RandomForwardingTable_header_tree = proto_item_add_subtree(RandomForwardingTable_header_item, ett_randomforwardingtable);
2392
2393     for(i = 0; i < 16; i++)
2394     {
2395         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_LID,   tvb, local_offset, 2, FALSE); local_offset +=2;
2396         proto_item_append_text(tempItemLow, "(%u)", i);
2397         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_Valid, tvb, local_offset, 1, FALSE);
2398         proto_item_append_text(tempItemLow, "(%u)", i);
2399         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_LMC,   tvb, local_offset, 1, FALSE); local_offset +=1;
2400         proto_item_append_text(tempItemLow, "(%u)", i);
2401         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_Port,  tvb, local_offset, 1, FALSE); local_offset +=1;
2402         proto_item_append_text(tempItemLow, "(%u)", i);
2403     }
2404 }
2405
2406 /* Parse NoticesAndTraps Attribute
2407 * IN:   parentTree - The tree to add the dissection to
2408 *       tvb - The tvbbuff of packet data
2409 *       offset - The offset in TVB where the attribute begins
2410 *       MadHeader - The common MAD header of the current SMP/SMA  */
2411 static void parse_MulticastForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2412 {
2413     gint i = 0;
2414     gint local_offset = *offset;
2415     proto_tree *MulticastForwardingTable_header_tree = NULL;
2416     proto_item *MulticastForwardingTable_header_item = NULL;
2417     proto_item *tempItemLow = NULL;
2418
2419     if(!parentTree)
2420         return;
2421
2422     MulticastForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2423     proto_item_set_text(MulticastForwardingTable_header_item, "%s", "MulticastForwardingTable");
2424     MulticastForwardingTable_header_tree = proto_item_add_subtree(MulticastForwardingTable_header_item, ett_multicastforwardingtable);
2425
2426     for(i = 0; i < 16; i++)
2427     {
2428         tempItemLow = proto_tree_add_item(MulticastForwardingTable_header_tree, hf_infiniband_MulticastForwardingTable_PortMask, tvb, local_offset, 2, FALSE); local_offset +=2;
2429         proto_item_append_text(tempItemLow, "(%u)", i);
2430     }
2431
2432 }
2433
2434 /* Parse SMInfo Attribute
2435 * IN:   parentTree - The tree to add the dissection to
2436 *       tvb - The tvbbuff of packet data
2437 *       offset - The offset in TVB where the attribute begins
2438 *       MadHeader - The common MAD header of the current SMP/SMA  */
2439 static void parse_SMInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2440 {
2441     gint local_offset = *offset;
2442     proto_tree *SMInfo_header_tree = NULL;
2443     proto_item *SMInfo_header_item = NULL;
2444
2445     if(!parentTree)
2446         return;
2447
2448     SMInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2449     proto_item_set_text(SMInfo_header_item, "%s", "SMInfo");
2450     SMInfo_header_tree = proto_item_add_subtree(SMInfo_header_item, ett_sminfo);
2451
2452     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_GUID,      tvb, local_offset, 8, FALSE); local_offset +=8;
2453     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_SM_Key,    tvb, local_offset, 8, FALSE); local_offset +=8;
2454     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_ActCount,  tvb, local_offset, 4, FALSE); local_offset +=4;
2455     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_Priority,  tvb, local_offset, 1, FALSE);
2456     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_SMState,   tvb, local_offset, 1, FALSE); local_offset +=1;
2457 }
2458
2459 /* Parse VendorDiag Attribute
2460 * IN:   parentTree - The tree to add the dissection to
2461 *       tvb - The tvbbuff of packet data
2462 *       offset - The offset in TVB where the attribute begins
2463 *       MadHeader - The common MAD header of the current SMP/SMA  */
2464 static void parse_VendorDiag(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2465 {
2466     gint local_offset = *offset;
2467     proto_tree *VendorDiag_header_tree = NULL;
2468     proto_item *VendorDiag_header_item = NULL;
2469
2470     if(!parentTree)
2471         return;
2472
2473     VendorDiag_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2474     proto_item_set_text(VendorDiag_header_item, "%s", "VendorDiag");
2475     VendorDiag_header_tree = proto_item_add_subtree(VendorDiag_header_item, ett_vendordiag);
2476
2477     proto_tree_add_item(VendorDiag_header_tree, hf_infiniband_VendorDiag_NextIndex,     tvb, local_offset, 2, FALSE); local_offset +=2;
2478     proto_tree_add_item(VendorDiag_header_tree, hf_infiniband_VendorDiag_DiagData,      tvb, local_offset, 62, FALSE); local_offset +=62;
2479 }
2480
2481 /* Parse LedInfo Attribute
2482 * IN:   parentTree - The tree to add the dissection to
2483 *       tvb - The tvbbuff of packet data
2484 *       offset - The offset in TVB where the attribute begins
2485 *       MadHeader - The common MAD header of the current SMP/SMA  */
2486 static void parse_LedInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2487 {
2488     gint local_offset = *offset;
2489     proto_tree *LedInfo_header_tree = NULL;
2490     proto_item *LedInfo_header_item = NULL;
2491
2492     if(!parentTree)
2493         return;
2494
2495     LedInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2496     proto_item_set_text(LedInfo_header_item, "%s", "LedInfo");
2497     LedInfo_header_tree = proto_item_add_subtree(LedInfo_header_item, ett_ledinfo);
2498
2499     proto_tree_add_item(LedInfo_header_tree, hf_infiniband_LedInfo_LedMask,     tvb, local_offset, 1, FALSE);
2500 }
2501
2502 /* Parse LinkSpeedWidthPairsTable Attribute
2503 * IN:   parentTree - The tree to add the dissection to
2504 *       tvb - The tvbbuff of packet data
2505 *       offset - The offset in TVB where the attribute begins
2506 *       MadHeader - The common MAD header of the current SMP/SMA  */
2507 static void parse_LinkSpeedWidthPairsTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2508 {
2509     gint local_offset = *offset;
2510     proto_tree *LinkSpeedWidthPairsTable_header_tree = NULL;
2511     proto_item *LinkSpeedWidthPairsTable_header_item = NULL;
2512
2513     if(!parentTree)
2514         return;
2515
2516     LinkSpeedWidthPairsTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
2517     proto_item_set_text(LinkSpeedWidthPairsTable_header_item, "%s", "LinkSpeedWidthPairsTable");
2518     LinkSpeedWidthPairsTable_header_tree = proto_item_add_subtree(LinkSpeedWidthPairsTable_header_item, ett_linkspeedwidthpairs);
2519
2520     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_NumTables,     tvb, local_offset, 1, FALSE); local_offset +=1;
2521     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_PortMask,      tvb, local_offset, 32, FALSE); local_offset +=32;
2522     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedTwoFive,  tvb, local_offset, 1, FALSE); local_offset +=1;
2523     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedFive,     tvb, local_offset, 1, FALSE); local_offset +=1;
2524     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedTen,      tvb, local_offset, 1, FALSE); local_offset +=1;
2525 }
2526
2527 /* Parse RID Field from Subnet Administraiton Packets.
2528 * IN: SA_header_tree - the dissection tree of the subnet admin attribute.
2529 *     tvb - the packet buffer
2530 *      MadHeader - the Common MAD header from this packet.
2531 * IN/OUT:  offset - the current and updated offset in the packet buffer */
2532 static void parse_RID(proto_tree* SA_header_tree, tvbuff_t* tvb, gint *offset, MAD_Data* MadHeader)
2533 {
2534     gint local_offset = *offset;
2535     if(!SA_header_tree)
2536     {
2537         return;
2538     }
2539         switch(MadHeader->attributeID)
2540         {
2541             case 0x0011:
2542                 /* NodeRecord */
2543                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,   tvb, local_offset, 2, FALSE); local_offset+=2;
2544                 local_offset+=2; /* Reserved bits */
2545                 break;
2546             case 0x0012:
2547                 /* PortInfoRecord */
2548                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_EndportLID,    tvb, local_offset, 2, FALSE); local_offset+=2;
2549                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_PortNum,       tvb, local_offset, 1, FALSE); local_offset+=1;
2550                 local_offset+=1; /* Reserved bits */
2551                 break;
2552             case 0x0013:
2553                 /* SLtoVLMappingTableRecord */
2554                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
2555                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_InputPortNum,  tvb, local_offset, 1, FALSE); local_offset+=1;
2556                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_OutputPortNum, tvb, local_offset, 1, FALSE); local_offset+=1;
2557                 local_offset+=4; /* Reserved bits */
2558                 break;
2559             case 0x0014:
2560                 /* SwitchInfoRecord */
2561                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
2562                 local_offset+=2; /* Reserved bits */
2563                 break;
2564             case 0x0015:
2565                 /* LinearForwardingTableRecord */
2566                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
2567                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
2568                 local_offset+=4; /* Reserved bits */
2569                 break;
2570             case 0x0016:
2571                 /* RandomForwardingTableRecord */
2572                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
2573                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
2574                 local_offset+=4; /* Reserved bits */
2575                 break;
2576             case 0x0017:
2577                 /* MulticastForwardingTableRecord */
2578                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
2579                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_Position,          tvb, local_offset, 1, FALSE);
2580                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_NineBit,  tvb, local_offset, 2, FALSE); local_offset+=2;
2581                 local_offset+=4; /* Reserved bits */
2582                 break;
2583             case 0x0036:
2584                 /*VLArbitrationTableRecord */
2585                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
2586                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_OutputPortNum, tvb, local_offset, 1, FALSE); local_offset+=1;
2587                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_EightBit,     tvb, local_offset, 1, FALSE); local_offset+=1;
2588                 local_offset+=4; /* Reserved bits */
2589                 break;
2590             case 0x0018:
2591                 /* SMInfoRecord */
2592                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
2593                 local_offset+=2; /* Reserved bits */
2594                 break;
2595             case 0x0033:
2596                 /* P_KeyTableRecord */
2597                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
2598                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
2599                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_PortNum,               tvb, local_offset, 1, FALSE); local_offset+=1;
2600                 local_offset+=3; /* Reserved bits */
2601                 break;
2602             case 0x00F3:
2603                 /* InformInfoRecord */
2604                 proto_tree_add_item(SA_header_tree, hf_infiniband_InformInfoRecord_SubscriberGID,   tvb, local_offset, 16, FALSE); local_offset+=16;
2605                 proto_tree_add_item(SA_header_tree, hf_infiniband_InformInfoRecord_Enum,            tvb, local_offset, 2, FALSE); local_offset+=2;
2606                 local_offset+=6; /* Reserved bits */
2607                 break;
2608             case 0x0020:
2609                 /* LinkRecord */
2610                 proto_tree_add_item(SA_header_tree, hf_infiniband_LinkRecord_FromLID,   tvb, local_offset, 2, FALSE); local_offset+=2;
2611                 proto_tree_add_item(SA_header_tree, hf_infiniband_LinkRecord_FromPort,  tvb, local_offset, 1, FALSE); local_offset+=1;
2612                 break;
2613             case 0x0031:
2614                 /* ServiceRecord */
2615                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceID,      tvb, local_offset, 8, FALSE); local_offset+=8;
2616                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceGID,     tvb, local_offset, 16, FALSE); local_offset+=16;
2617                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceP_Key,   tvb, local_offset, 2, FALSE); local_offset+=2;
2618                 local_offset+=2;
2619                 break;
2620             case 0x0038:
2621                 /* MCMemberRecord */
2622                 proto_tree_add_item(SA_header_tree, hf_infiniband_MCMemberRecord_MGID,      tvb, local_offset, 16, FALSE); local_offset+=16;
2623                 proto_tree_add_item(SA_header_tree, hf_infiniband_MCMemberRecord_PortGID,   tvb, local_offset, 16, FALSE); local_offset+=16;
2624                 break;
2625             case 0x0030:
2626                 /* GuidInfoRecord */
2627                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
2628                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_EightBit, tvb, local_offset, 1, FALSE); local_offset+=2;
2629                 local_offset+=4;
2630                 break;
2631             default:
2632                 break;
2633         }
2634
2635     *offset = local_offset;
2636 }
2637
2638 /* Parse InformInfo Attribute
2639 * IN:   parentTree - The tree to add the dissection to
2640 *       tvb - The tvbbuff of packet data
2641 *       offset - The offset in TVB where the attribute begins
2642 *       MadHeader - The common MAD header of the current SMP/SMA  */
2643 static void parse_InformInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2644 {
2645     gint local_offset = *offset;
2646     proto_tree *InformInfo_header_tree = NULL;
2647     proto_item *InformInfo_header_item = NULL;
2648     if(!parentTree)
2649     {
2650         return;
2651     }
2652     InformInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 36, FALSE);
2653     proto_item_set_text(InformInfo_header_item, "%s", "InformInfo");
2654     InformInfo_header_tree = proto_item_add_subtree(InformInfo_header_item, ett_informinfo);
2655
2656     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_GID,                   tvb, local_offset, 16, FALSE); local_offset+=16;
2657     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_LIDRangeBegin,         tvb, local_offset, 2, FALSE); local_offset+=2;
2658     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_LIDRangeEnd,           tvb, local_offset, 2, FALSE); local_offset+=2;
2659     local_offset+=2; /* Reserved Bits */
2660     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_IsGeneric,             tvb, local_offset, 1, FALSE); local_offset+=1;
2661     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_Subscribe,             tvb, local_offset, 1, FALSE); local_offset+=1;
2662     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_Type,                  tvb, local_offset, 2, FALSE); local_offset+=2;
2663     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_TrapNumberDeviceID,    tvb, local_offset, 2, FALSE); local_offset+=2;
2664     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_QPN,                   tvb, local_offset, 3, FALSE); local_offset+=3;
2665     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_RespTimeValue,         tvb, local_offset, 1, FALSE); local_offset+=1;
2666     local_offset+=1;
2667     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_ProducerTypeVendorID,  tvb, local_offset, 3, FALSE); local_offset+=3;
2668
2669 }
2670 /* Parse LinkRecord Attribute
2671 * IN:   parentTree - The tree to add the dissection to
2672 *       tvb - The tvbbuff of packet data
2673 *       offset - The offset in TVB where the attribute begins
2674 *       MadHeader - The common MAD header of the current SMP/SMA  */
2675 static void parse_LinkRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2676 {
2677     gint local_offset = *offset;
2678     proto_tree *LinkRecord_header_tree = NULL;
2679     proto_item *LinkRecord_header_item = NULL;
2680
2681     if(!parentTree)
2682     {
2683         return;
2684     }
2685
2686     LinkRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 3, FALSE);
2687     proto_item_set_text(LinkRecord_header_item, "%s", "LinkRecord");
2688     LinkRecord_header_tree = proto_item_add_subtree(LinkRecord_header_item, ett_linkrecord);
2689
2690     proto_tree_add_item(LinkRecord_header_tree, hf_infiniband_LinkRecord_ToPort,    tvb, local_offset, 1, FALSE); local_offset+=1;
2691     proto_tree_add_item(LinkRecord_header_tree, hf_infiniband_LinkRecord_ToLID,     tvb, local_offset, 2, FALSE); local_offset +=2;
2692
2693 }
2694 /* Parse ServiceRecord Attribute
2695 * IN:   parentTree - The tree to add the dissection to
2696 *       tvb - The tvbbuff of packet data
2697 *       offset - The offset in TVB where the attribute begins
2698 *       MadHeader - The common MAD header of the current SMP/SMA  */
2699 static void parse_ServiceRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2700 {
2701     gint local_offset = *offset;
2702     proto_tree *ServiceRecord_header_tree = NULL;
2703     proto_item *ServiceRecord_header_item = NULL;
2704     proto_item *tempData = NULL;
2705
2706     if(!parentTree)
2707     {
2708         return;
2709     }
2710
2711     ServiceRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 176, FALSE);
2712     proto_item_set_text(ServiceRecord_header_item, "%s", "ServiceRecord");
2713     ServiceRecord_header_tree = proto_item_add_subtree(ServiceRecord_header_item, ett_servicerecord);
2714
2715     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceLease,    tvb, local_offset, 4, FALSE); local_offset+=4;
2716     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceKey,      tvb, local_offset, 16, FALSE); local_offset+=16;
2717     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceName,     tvb, local_offset, 64, FALSE); local_offset+=64;
2718
2719     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
2720     proto_item_append_text(tempData, "%s", "(ServiceData 8.1, 8.16)");
2721     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
2722     proto_item_append_text(tempData, "%s", "(ServiceData 16.1, 16.8)");
2723     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
2724     proto_item_append_text(tempData, "%s", "(ServiceData 32.1, 32.4)");
2725     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
2726     proto_item_append_text(tempData, "%s", "(ServiceData 64.1, 64.2)");
2727
2728 }
2729 /* Parse PathRecord Attribute
2730 * IN:   parentTree - The tree to add the dissection to
2731 *       tvb - The tvbbuff of packet data
2732 *       offset - The offset in TVB where the attribute begins
2733 *       MadHeader - The common MAD header of the current SMP/SMA  */
2734 static void parse_PathRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2735 {
2736     gint local_offset = *offset;
2737     proto_tree *PathRecord_header_tree = NULL;
2738     proto_item *PathRecord_header_item = NULL;
2739
2740     if(!parentTree)
2741     {
2742         return;
2743     }
2744
2745     PathRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 64, FALSE);
2746     proto_item_set_text(PathRecord_header_item, "%s", "PathRecord");
2747     PathRecord_header_tree = proto_item_add_subtree(PathRecord_header_item, ett_pathrecord);
2748     local_offset += 8; /* Reserved Bits */
2749
2750     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_DGID,          tvb, local_offset, 16, FALSE); local_offset+=16;
2751     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SGID,          tvb, local_offset, 16, FALSE); local_offset+=16;
2752     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_DLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
2753     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
2754     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_RawTraffic,    tvb, local_offset, 1, FALSE);
2755     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_FlowLabel,     tvb, local_offset, 3, FALSE); local_offset+=3;
2756     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_HopLimit,      tvb, local_offset, 1, FALSE); local_offset+=1;
2757     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_TClass,        tvb, local_offset, 1, FALSE); local_offset+=1;
2758     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Reversible,    tvb, local_offset, 1, FALSE);
2759     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_NumbPath,      tvb, local_offset, 1, FALSE); local_offset+=1;
2760     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_P_Key,         tvb, local_offset, 2, FALSE); local_offset+=2;
2761     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SL,            tvb, local_offset, 2, FALSE); local_offset+=2;
2762     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_MTUSelector,   tvb, local_offset, 1, FALSE);
2763     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_MTU,           tvb, local_offset, 1, FALSE); local_offset+=1;
2764     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_RateSelector,  tvb, local_offset, 1, FALSE);
2765     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Rate,          tvb, local_offset, 1, FALSE); local_offset+=1;
2766     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_PacketLifeTimeSelector,    tvb, local_offset, 1, FALSE);
2767     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_PacketLifeTime,            tvb, local_offset, 1, FALSE); local_offset+=1;
2768     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Preference,                tvb, local_offset, 1, FALSE); local_offset+=1;
2769 }
2770 /* Parse MCMemberRecord Attribute
2771 * IN:   parentTree - The tree to add the dissection to
2772 *       tvb - The tvbbuff of packet data
2773 *       offset - The offset in TVB where the attribute begins
2774 *       MadHeader - The common MAD header of the current SMP/SMA  */
2775 static void parse_MCMemberRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2776 {
2777     gint local_offset = *offset;
2778     proto_tree *MCMemberRecord_header_tree = NULL;
2779     proto_item *MCMemberRecord_header_item = NULL;
2780
2781     if(!parentTree)
2782     {
2783         return;
2784     }
2785
2786     MCMemberRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 64, FALSE);
2787     proto_item_set_text(MCMemberRecord_header_item, "%s", "MCMemberRecord");
2788     MCMemberRecord_header_tree = proto_item_add_subtree(MCMemberRecord_header_item, ett_mcmemberrecord);
2789
2790     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Q_Key,         tvb, local_offset, 4, FALSE); local_offset+=4;
2791     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
2792     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MTUSelector,   tvb, local_offset, 1, FALSE);
2793     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MTU,           tvb, local_offset, 1, FALSE); local_offset+=1;
2794     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_TClass,        tvb, local_offset, 1, FALSE); local_offset+=1;
2795     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_P_Key,         tvb, local_offset, 2, FALSE); local_offset+=2;
2796     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_RateSelector,  tvb, local_offset, 1, FALSE);
2797     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Rate,          tvb, local_offset, 1, FALSE); local_offset+=1;
2798     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_PacketLifeTimeSelector,    tvb, local_offset, 1, FALSE);
2799     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_PacketLifeTime,            tvb, local_offset, 1, FALSE); local_offset+=1;
2800     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_SL,            tvb, local_offset, 1, FALSE);
2801     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_FlowLabel,     tvb, local_offset, 3, FALSE); local_offset+=3;
2802     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_HopLimit,      tvb, local_offset, 1, FALSE); local_offset+=1;
2803     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Scope,         tvb, local_offset, 1, FALSE);
2804     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_JoinState,     tvb, local_offset, 1, FALSE); local_offset+=1;
2805     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_ProxyJoin,     tvb, local_offset, 1, FALSE); local_offset+=3;
2806
2807 }
2808 /* Parse TraceRecord Attribute
2809 * IN:   parentTree - The tree to add the dissection to
2810 *       tvb - The tvbbuff of packet data
2811 *       offset - The offset in TVB where the attribute begins
2812 *       MadHeader - The common MAD header of the current SMP/SMA  */
2813 static void parse_TraceRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2814 {
2815     gint local_offset = *offset;
2816     proto_tree *TraceRecord_header_tree = NULL;
2817     proto_item *TraceRecord_header_item = NULL;
2818
2819     if(!parentTree)
2820     {
2821         return;
2822     }
2823
2824     TraceRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 46, FALSE);
2825     proto_item_set_text(TraceRecord_header_item, "%s", "TraceRecord");
2826     TraceRecord_header_tree = proto_item_add_subtree(TraceRecord_header_item, ett_tracerecord);
2827
2828     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_GIDPrefix,       tvb, local_offset, 8, FALSE); local_offset+=8;
2829     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_IDGeneration,    tvb, local_offset, 2, FALSE); local_offset+=2;
2830     local_offset+=1; /* Reserved Bits */
2831     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_NodeType,        tvb, local_offset, 1, FALSE); local_offset+=1;
2832     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_NodeID,          tvb, local_offset, 8, FALSE); local_offset+=8;
2833     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ChassisID,       tvb, local_offset, 8, FALSE); local_offset+=8;
2834     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_EntryPortID,     tvb, local_offset, 8, FALSE); local_offset+=8;
2835     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ExitPortID,      tvb, local_offset, 8, FALSE); local_offset+=8;
2836     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_EntryPort,       tvb, local_offset, 1, FALSE); local_offset+=1;
2837     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ExitPort,        tvb, local_offset, 1, FALSE); local_offset+=1;
2838 }
2839 /* Parse MultiPathRecord Attribute
2840 * IN:   parentTree - The tree to add the dissection to
2841 *       tvb - The tvbbuff of packet data
2842 *       offset - The offset in TVB where the attribute begins
2843 *       MadHeader - The common MAD header of the current SMP/SMA  */
2844 static void parse_MultiPathRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2845 {
2846     gint local_offset = *offset;
2847     proto_tree *MultiPathRecord_header_tree = NULL;
2848     proto_item *MultiPathRecord_header_item = NULL;
2849     proto_item *SDGID = NULL;
2850     guint8 SDGIDCount = 0;
2851     guint8 DGIDCount = 0;
2852     guint32 i = 0;
2853
2854     if(!parentTree)
2855     {
2856         return;
2857     }
2858
2859     MultiPathRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 200, FALSE);
2860     proto_item_set_text(MultiPathRecord_header_item, "%s", "MultiPathRecord");
2861     MultiPathRecord_header_tree = proto_item_add_subtree(MultiPathRecord_header_item, ett_multipathrecord);
2862
2863     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_RawTraffic,      tvb, local_offset, 1, FALSE);
2864     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_FlowLabel,       tvb, local_offset, 3, FALSE); local_offset+=3;
2865     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_HopLimit,        tvb, local_offset, 1, FALSE); local_offset+=1;
2866     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_TClass,          tvb, local_offset, 1, FALSE); local_offset+=1;
2867     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_Reversible,      tvb, local_offset, 1, FALSE);
2868     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_NumbPath,        tvb, local_offset, 1, FALSE); local_offset+=1;
2869     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_P_Key,           tvb, local_offset, 2, FALSE); local_offset+=2;
2870     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SL,              tvb, local_offset, 2, FALSE); local_offset+=2;
2871     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_MTUSelector,     tvb, local_offset, 1, FALSE);
2872     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_MTU,             tvb, local_offset, 1, FALSE); local_offset+=1;
2873     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_RateSelector,    tvb, local_offset, 1, FALSE);
2874     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_Rate,            tvb, local_offset, 1, FALSE); local_offset+=1;
2875     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_PacketLifeTimeSelector,  tvb, local_offset, 1, FALSE);
2876     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_PacketLifeTime,          tvb, local_offset, 1, FALSE); local_offset+=1;
2877     local_offset+=1; /* Reserved Bits */
2878     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_IndependenceSelector,    tvb, local_offset, 1, FALSE);
2879     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_GIDScope,                tvb, local_offset, 1, FALSE); local_offset+=1;
2880
2881     SDGIDCount = tvb_get_guint8(tvb, local_offset);
2882     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SGIDCount,       tvb, local_offset, 1, FALSE); local_offset+=1;
2883     DGIDCount = tvb_get_guint8(tvb, local_offset);
2884     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_DGIDCount,       tvb, local_offset, 1, FALSE); local_offset+=1;
2885     local_offset+=7; /*Reserved Bits */
2886
2887     for(i = 0; i < SDGIDCount; i++)
2888     {
2889         SDGID = proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SDGID,       tvb, local_offset, 16, FALSE); local_offset+=16;
2890         proto_item_set_text(SDGID, "(%s%u)","SGID", i);
2891     }
2892     for(i = 0; i < DGIDCount; i++)
2893     {
2894         SDGID = proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SDGID,       tvb, local_offset, 16, FALSE); local_offset+=16;
2895         proto_item_set_text(SDGID, "(%s%u)","DGID", i);
2896     }
2897 }
2898 /* Parse ServiceAssociationRecord Attribute
2899 * IN:   parentTree - The tree to add the dissection to
2900 *       tvb - The tvbbuff of packet data
2901 *       offset - The offset in TVB where the attribute begins
2902 *       MadHeader - The common MAD header of the current SMP/SMA  */
2903 static void parse_ServiceAssociationRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
2904 {
2905     gint local_offset = *offset;
2906     proto_tree *ServiceAssociationRecord_header_tree = NULL;
2907     proto_item *ServiceAssociationRecord_header_item = NULL;
2908
2909     if(!parentTree)
2910     {
2911         return;
2912     }
2913
2914     ServiceAssociationRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 80, FALSE);
2915     proto_item_set_text(ServiceAssociationRecord_header_item, "%s", "ServiceAssociationRecord");
2916     ServiceAssociationRecord_header_tree = proto_item_add_subtree(ServiceAssociationRecord_header_item, ett_serviceassocrecord);
2917
2918     proto_tree_add_item(ServiceAssociationRecord_header_tree, hf_infiniband_ServiceAssociationRecord_ServiceKey,        tvb, local_offset, 16, FALSE); local_offset +=16;
2919     proto_tree_add_item(ServiceAssociationRecord_header_tree, hf_infiniband_ServiceAssociationRecord_ServiceName,       tvb, local_offset, 64, FALSE); local_offset +=64;
2920 }
2921
2922 /* dissect_general_info
2923 * Used to extract very few values from the packet in the case that full dissection is disabled by the user.
2924 * IN:
2925 *       tvb - The tvbbuff of packet data
2926 *       offset - The offset in TVB where the attribute begins
2927 *       pinfo - The packet info structure with column information */
2928 static void dissect_general_info(tvbuff_t *tvb, gint offset, packet_info *pinfo)
2929 {
2930     guint8 lnh_val = 0;             /* The Link Next Header Value.  Tells us which headers are coming */
2931     gboolean bthFollows = 0;        /* Tracks if we are parsing a BTH.  This is a significant decision point */
2932     guint8 virtualLane = 0;         /* The Virtual Lane of the current Packet */
2933     guint8 opCode = 0;              /* OpCode from BTH header. */
2934     gint32 nextHeaderSequence = -1; /* defined by this dissector. #define which indicates the upcoming header sequence from OpCode */
2935     guint8 nxtHdr = 0;              /* that must be available for that header. */
2936     struct e_in6_addr SRCgid;       /* Struct to display ipv6 Address */
2937     struct e_in6_addr DSTgid;       /* Struct to display ipv6 Address */
2938     guint8 management_class = 0;
2939     MAD_Data MadData;
2940
2941
2942     virtualLane =  tvb_get_guint8(tvb, offset);
2943     virtualLane = virtualLane & 0xF0;
2944     offset+=1;
2945
2946     /* Save Link Next Header... This tells us what the next header is. */
2947     lnh_val =  tvb_get_guint8(tvb, offset);
2948     lnh_val = lnh_val & 0x03;
2949     offset+=1;
2950
2951     /* Set destination in packet view. */
2952     if (check_col(pinfo->cinfo, COL_DEF_DST))
2953     {
2954         col_add_fstr(pinfo->cinfo, COL_DEF_DST, "DLID: %s", tvb_bytes_to_str(tvb, offset, 2));
2955     }
2956     offset+=4;
2957
2958     /* Set Source in packet view. */
2959     if (check_col(pinfo->cinfo, COL_DEF_SRC))
2960     {
2961         col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "SLID: %s", tvb_bytes_to_str(tvb, offset, 2));
2962     }
2963     offset+=2;
2964
2965     switch(lnh_val)
2966     {
2967         case IBA_GLOBAL:
2968             offset +=6;
2969             nxtHdr = tvb_get_guint8(tvb, offset);
2970             offset += 2;
2971
2972             tvb_get_ipv6(tvb, offset, &SRCgid);
2973             if (check_col(pinfo->cinfo, COL_DEF_SRC))
2974             {
2975                 col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "SGID: %s", ip6_to_str(&SRCgid));
2976             }
2977             offset += 16;
2978
2979             tvb_get_ipv6(tvb, offset, &DSTgid);
2980             if (check_col(pinfo->cinfo, COL_DEF_DST))
2981             {
2982                 col_add_fstr(pinfo->cinfo, COL_DEF_DST, "DGID: %s", ip6_to_str(&DSTgid));
2983             }
2984             offset += 16;
2985
2986             if(nxtHdr != 0x1B)
2987             {
2988                 /* Some kind of packet being transported globally with IBA, but locally it is not IBA - no BTH following. */
2989                 break;
2990             }
2991             /* else
2992              * {
2993              *      Fall through switch and start parsing Local Headers and BTH
2994              * }
2995              */
2996         case IBA_LOCAL:
2997             bthFollows = TRUE;
2998
2999             /* Get the OpCode - this tells us what headers are following */
3000             opCode = tvb_get_guint8(tvb, offset);
3001             if (check_col(pinfo->cinfo, COL_INFO))
3002             {
3003                 col_append_str(pinfo->cinfo, COL_INFO, val_to_str((guint32)opCode, OpCodeMap, "Unknown OpCode"));
3004             }
3005             offset +=12;
3006             break;
3007         case IP_NON_IBA:
3008             /* Raw IPv6 Packet */
3009             if (check_col(pinfo->cinfo, COL_DEF_DST))
3010             {
3011                 col_set_str(pinfo->cinfo, COL_DEF_DST, "IPv6 over IB Packet");
3012                 col_set_fence(pinfo->cinfo, COL_DEF_DST);
3013             }
3014             break;
3015         case RAW:
3016             break;
3017         default:
3018             break;
3019     }
3020
3021     if(bthFollows)
3022     {
3023         /* Find our next header sequence based on the Opcode
3024          * Since we're not doing dissection here, we just need the proper offsets to get our labels in packet view */
3025
3026         nextHeaderSequence = find_next_header_sequence((guint32) opCode);
3027         switch(nextHeaderSequence)
3028         {
3029             case RDETH_DETH_PAYLD:
3030                 offset += 4; /* RDETH */
3031                 offset += 8; /* DETH */
3032                 break;
3033             case RDETH_DETH_RETH_PAYLD:
3034                 offset += 4; /* RDETH */
3035                 offset += 8; /* DETH */
3036                 offset += 16; /* RETH */
3037                 break;
3038             case RDETH_DETH_IMMDT_PAYLD:
3039                 offset += 4; /* RDETH */
3040                 offset += 8; /* DETH */
3041                 offset += 4; /* IMMDT */
3042                 break;
3043             case RDETH_DETH_RETH_IMMDT_PAYLD:
3044                 offset += 4; /* RDETH */
3045                 offset += 8; /* DETH */
3046                 offset += 16; /* RETH */
3047                 offset += 4; /* IMMDT */
3048                 break;
3049             case RDETH_DETH_RETH:
3050                 offset += 4; /* RDETH */
3051                 offset += 8; /* DETH */
3052                 offset += 16; /* RETH */
3053                 break;
3054             case RDETH_AETH_PAYLD:
3055                 offset += 4; /* RDETH */
3056                 offset += 4; /* AETH */
3057                 break;
3058             case RDETH_PAYLD:
3059                 offset += 4; /* RDETH */
3060                 break;
3061             case RDETH_AETH:
3062                 offset += 4; /* RDETH */
3063                 offset += 4; /* AETH */
3064                 break;
3065             case RDETH_AETH_ATOMICACKETH:
3066                 offset += 4; /* RDETH */
3067                 offset += 4; /* AETH */
3068                 offset += 8; /* AtomicAckETH */
3069                 break;
3070             case RDETH_DETH_ATOMICETH:
3071                 offset += 4; /* RDETH */
3072                 offset += 8; /* DETH */
3073                 offset += 28; /* AtomicETH */
3074                 break;
3075             case RDETH_DETH:
3076                 offset += 4; /* RDETH */
3077                 offset += 8; /* DETH */
3078                 break;
3079             case DETH_PAYLD:
3080                 offset += 8; /* DETH */
3081                 break;
3082             case PAYLD:
3083                 break;
3084             case IMMDT_PAYLD:
3085                 offset += 4; /* IMMDT */
3086                 break;
3087             case RETH_PAYLD:
3088                 offset += 16; /* RETH */
3089                 break;
3090             case RETH:
3091                 offset += 16; /* RETH */
3092                 break;
3093             case AETH_PAYLD:
3094                 offset += 4; /* AETH */
3095                 break;
3096             case AETH:
3097                 offset += 4; /* AETH */
3098                 break;
3099             case AETH_ATOMICACKETH:
3100                 offset += 4; /* AETH */
3101                 offset += 8; /* AtomicAckETH */
3102                 break;
3103             case ATOMICETH:
3104                 offset += 28; /* AtomicETH */
3105                 break;
3106             case IETH_PAYLD:
3107                 offset += 4; /* IETH */
3108                 break;
3109             case DETH_IMMDT_PAYLD:
3110                 offset += 8; /* DETH */
3111                 offset += 4; /* IMMDT */
3112                 break;
3113             default:
3114                 break;
3115         }
3116     }
3117     if(virtualLane == 0xF0)
3118     {
3119         management_class =  tvb_get_guint8(tvb, offset + 1);
3120         if(((management_class >= (guint8)VENDOR_1_START) && (management_class <= (guint8)VENDOR_1_END))
3121         || ((management_class >= (guint8)VENDOR_2_START) && (management_class <= (guint8)VENDOR_2_END)))
3122         {
3123             return;
3124         }
3125         else if((management_class >= (guint8)APPLICATION_START) && (management_class <= (guint8)APPLICATION_END))
3126         {
3127             return;
3128         }
3129         else if(((management_class == (guint8)0x00) || (management_class == (guint8)0x02))
3130             || ((management_class >= (guint8)0x50) && (management_class <= (guint8)0x80))
3131             || ((management_class >= (guint8)0x82)))
3132         {
3133             return;
3134         }
3135         else /* we have a normal management_class */
3136         {
3137             parse_MAD_Common(NULL, tvb, &offset, &MadData);
3138             label_SUBM_Method(NULL, &MadData, pinfo);
3139             label_SUBM_Attribute(NULL, &MadData, pinfo);
3140         }
3141     }
3142
3143     return;
3144 }
3145
3146 /* Protocol Registration */
3147 void proto_register_infiniband(void)
3148 {
3149     /* Field dissector structures.
3150     * For reserved fields, reservedX denotes the reserved field is X bits in length.
3151     * e.g. reserved2 is a reserved field 2 bits in length.
3152     * The third parameter is a filter string associated for this field.
3153     * So for instance, to filter packets for a given virtual lane,
3154     * The filter (infiniband.LRH.vl == 3) or something similar would be used. */
3155
3156     /* XXX: ToDo: Verify against Infiniband 1.2.1 Specification                           */
3157     /*            Fields verified/corrected: Those after comment "XX: All following ..."  */
3158
3159     static hf_register_info hf[] = {    
3160         /* Local Route Header (LRH) */
3161         { &hf_infiniband_LRH, {
3162                 "Local Route Header", "infiniband.lrh",
3163                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3164         },
3165         { &hf_infiniband_virtual_lane, {
3166                 "Virtual Lane", "infiniband.lrh.vl",
3167                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3168         },
3169         { &hf_infiniband_link_version, {
3170                 "Link Version", "infiniband.lrh.lver",
3171                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}
3172         },
3173         { &hf_infiniband_service_level, {
3174                 "Service Level", "infiniband.lrh.sl",
3175                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}
3176         },
3177         { &hf_infiniband_reserved2, {
3178                 "Reserved (2 bits)", "infiniband.lrh.reserved2",
3179                 FT_UINT8, BASE_DEC, NULL, 0x0C, NULL, HFILL}
3180         },
3181         { &hf_infiniband_link_next_header, {
3182                 "Link Next Header", "infiniband.lrh.lnh",
3183                 FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL}
3184         },
3185         { &hf_infiniband_destination_local_id, {
3186                 "Destination Local ID", "infiniband.lrh.dlid",
3187                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
3188         },
3189         { &hf_infiniband_reserved5, {
3190                 "Reserved (5 bits)", "infiniband.lrh.reserved5",
3191                 FT_UINT16, BASE_DEC, NULL, 0xF800, NULL, HFILL}
3192         },
3193         { &hf_infiniband_packet_length, {
3194                 "Packet Length", "infiniband.lrh.pktlen",
3195                 FT_UINT16, BASE_DEC, NULL, 0x07FF, NULL, HFILL}
3196         },
3197         { &hf_infiniband_source_local_id, {
3198                 "Source Local ID", "infiniband.lrh.slid",
3199                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
3200         },
3201         
3202         /* Global Route Header (GRH) */
3203         { &hf_infiniband_GRH, {
3204                 "Global Route Header", "infiniband.grh",
3205                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3206         },
3207         { &hf_infiniband_ip_version, {
3208                 "IP Version", "infiniband.grh.ipver",
3209                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}
3210         },
3211         { &hf_infiniband_traffic_class, {
3212                 "Traffic Class", "infiniband.grh.tclass",
3213                 FT_UINT16, BASE_DEC, NULL, 0x0FF0, NULL, HFILL}
3214         },
3215         { &hf_infiniband_flow_label, {
3216                 "Flow Label", "infiniband.grh.flowlabel",
3217                 FT_UINT32, BASE_DEC, NULL, 0x000FFFFF, NULL, HFILL}
3218         },
3219         { &hf_infiniband_payload_length, {
3220                 "Payload Length", "infiniband.grh.paylen",
3221                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
3222         },
3223         { &hf_infiniband_next_header, {
3224                 "Next Header", "infiniband.grh.nxthdr",
3225                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3226         },
3227         { &hf_infiniband_hop_limit, {
3228                 "Hop Limit", "infiniband.grh.hoplmt",
3229                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3230         },
3231         { &hf_infiniband_source_gid, {
3232                 "Source GID", "infiniband.grh.sgid",
3233                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
3234         },
3235         { &hf_infiniband_destination_gid, {
3236                 "Destination GID", "infiniband.grh.dgid",
3237                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
3238         },
3239         
3240         /* Base Transport Header (BTH) */
3241         { &hf_infiniband_BTH, {
3242                 "Base Transport Header", "infiniband.bth",
3243                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3244         },
3245         { &hf_infiniband_opcode, {
3246                 "Opcode", "infiniband.bth.opcode",
3247                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3248         },
3249         { &hf_infiniband_solicited_event, {
3250                 "Solicited Event", "infiniband.bth.se",
3251                 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
3252         },
3253         { &hf_infiniband_migreq, {
3254                 "MigReq", "infiniband.bth.m",
3255                 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
3256         },
3257         { &hf_infiniband_pad_count, {
3258                 "Pad Count", "infiniband.bth.padcnt",
3259                 FT_UINT8, BASE_DEC, NULL, 0x30, NULL, HFILL}
3260         },
3261         { &hf_infiniband_transport_header_version, {
3262                 "Header Version", "infiniband.bth.tver",
3263                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}
3264         },
3265         { &hf_infiniband_partition_key, {
3266                 "Partition Key", "infiniband.bth.p_key",
3267                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
3268         },
3269         { &hf_infiniband_reserved8, {
3270                 "Reserved (8 bits)", "infiniband.bth.reserved8",
3271                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3272         },
3273         { &hf_infiniband_destination_qp, {
3274                 "Destination Queue Pair", "infiniband.bth.destqp",
3275                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
3276         },
3277         { &hf_infiniband_acknowledge_request, {
3278                 "Acknowledge Request", "infiniband.bth.a",
3279                 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
3280         },
3281         { &hf_infiniband_reserved7, {
3282                 "Reserved (7 bits)", "infiniband.bth.reserved7",
3283                 FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL}
3284         },
3285         { &hf_infiniband_packet_sequence_number, {
3286                 "Packet Sequence Number", "infiniband.bth.psn",
3287                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
3288         },
3289         
3290         /* Raw Header (RWH) */
3291         { &hf_infiniband_RWH, {
3292                 "Raw Header", "infiniband.rwh",
3293                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3294         },
3295         { &hf_infiniband_reserved16_RWH, {
3296                 "Reserved (16 bits)", "infiniband.rwh.reserved",
3297                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
3298         },
3299         { &hf_infiniband_etype, {
3300                 "Ethertype", "infiniband.rwh.etype",
3301                 FT_UINT16, BASE_HEX, NULL /*VALS(etype_vals)*/, 0x0, "Type", HFILL }
3302         },
3303
3304         /* Reliable Datagram Extended Transport Header (RDETH) */
3305         { &hf_infiniband_RDETH, {
3306                 "Reliable Datagram Extended Transport Header", "infiniband.rdeth",
3307                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3308         },
3309         { &hf_infiniband_reserved8_RDETH, {
3310                 "Reserved (8 bits)", "infiniband.rdeth.reserved8",
3311                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3312         },
3313         { &hf_infiniband_ee_context, {
3314                 "E2E Context", "infiniband.rdeth.eecnxt",
3315                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
3316         },
3317         
3318         /* Datagram Extended Transport Header (DETH) */
3319         { &hf_infiniband_DETH, {
3320                 "Datagram Extended Transport Header", "infiniband.deth",
3321                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3322         },
3323         { &hf_infiniband_queue_key, {
3324                 "Queue Key", "infiniband.deth.q_key",
3325                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3326         },
3327         { &hf_infiniband_reserved8_DETH, {
3328                 "Reserved (8 bits)", "infiniband.deth.reserved8",
3329                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
3330         },
3331         { &hf_infiniband_source_qp, {
3332                 "Source Queue Pair", "infiniband.deth.srcqp",
3333                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
3334         },
3335         
3336         /* RDMA Extended Transport Header (RETH) */
3337         { &hf_infiniband_RETH, {
3338                 "RDMA Extended Transport Header", "infiniband.reth",
3339                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3340         },
3341         { &hf_infiniband_virtual_address, {
3342                 "Virtual Address", "infiniband.reth.va",
3343                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3344         },
3345         { &hf_infiniband_remote_key, {
3346                 "Remote Key", "infiniband.reth.r_key",
3347                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
3348         },
3349         { &hf_infiniband_dma_length, {
3350                 "DMA Length", "infiniband.reth.dmalen",
3351                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
3352         },
3353         
3354         /* Atomic Extended Transport Header (AtomicETH) */
3355         { &hf_infiniband_AtomicETH, {
3356                 "Atomic Extended Transport Header", "infiniband.atomiceth",
3357                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3358         },
3359 #if 0
3360         { &hf_infiniband_virtual_address_AtomicETH, {
3361                 "Virtual Address", "infiniband.atomiceth.va",
3362                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3363         },
3364         { &hf_infiniband_remote_key_AtomicETH, {
3365                 "Remote Key", "infiniband.atomiceth.r_key",
3366                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
3367         },
3368 #endif
3369         { &hf_infiniband_swap_or_add_data, {
3370                 "Swap (Or Add) Data", "infiniband.atomiceth.swapdt",
3371                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3372         },
3373         { &hf_infiniband_compare_data, {
3374                 "Compare Data", "infiniband.atomiceth.cmpdt",
3375                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3376         },
3377         
3378         /* ACK Extended Transport Header (AETH) */
3379         { &hf_infiniband_AETH, {
3380                 "ACK Extended Transport Header", "infiniband.aeth",
3381                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3382         },
3383         { &hf_infiniband_syndrome, {
3384                 "Syndrome", "infiniband.aeth.syndrome",
3385                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
3386         },
3387         { &hf_infiniband_message_sequence_number, {
3388                 "Message Sequence Number", "infiniband.aeth.msn",
3389                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
3390         },
3391         
3392         /* Atomic ACK Extended Transport Header (AtomicAckETH) */
3393         { &hf_infiniband_AtomicAckETH, {
3394                 "Atomic ACK Extended Transport Header", "infiniband.atomicacketh",
3395                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3396         },
3397         { &hf_infiniband_original_remote_data, {
3398                 "Original Remote Data", "infiniband.atomicacketh.origremdt",
3399                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
3400         },
3401
3402         /* Immediate Extended Transport Header (ImmDT) */
3403         { &hf_infiniband_IMMDT, {
3404                 "Immediate Data", "infiniband.immdt",
3405                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3406         },
3407
3408         /* Invalidate Extended Transport Header (IETH) */
3409         { &hf_infiniband_IETH, {
3410                 "RKey", "infiniband.ieth",
3411                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3412         },
3413
3414         /* Payload */
3415         { &hf_infiniband_payload, {
3416                 "Payload", "infiniband.payload",
3417                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3418         },
3419         { &hf_infiniband_invariant_crc, {
3420                 "Invariant CRC", "infiniband.invariant.crc",
3421                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3422         },
3423         { &hf_infiniband_variant_crc, {
3424                 "Variant CRC", "infiniband.variant.crc",
3425                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3426         },
3427         { &hf_infiniband_raw_data, {
3428                 "Raw Data", "infiniband.rawdata",
3429                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3430         },
3431         /* Unknown or Vendor Specific */
3432         { &hf_infiniband_vendor, {
3433                 "Unknown/Vendor Specific Data", "infiniband.vendor",
3434                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3435         },
3436
3437         /* MAD Base Header */
3438         { &hf_infiniband_MAD, {
3439                 "MAD (Management Datagram) Common Header", "infiniband.mad",
3440                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3441         },
3442         { &hf_infiniband_base_version, {
3443                 "Base Version", "infiniband.mad.baseversion",
3444                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3445         },
3446         { &hf_infiniband_mgmt_class, {
3447                 "Management Class", "infiniband.mad.mgmtclass",
3448                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3449         },
3450         { &hf_infiniband_class_version, {
3451                 "Class Version", "infiniband.mad.classversion",
3452                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3453         },
3454 #if 0
3455         { &hf_infiniband_reserved1, {
3456                 "Reserved", "infiniband.mad.reserved1",
3457                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
3458         },
3459 #endif
3460         { &hf_infiniband_method, {
3461                 "Method", "infiniband.mad.method",
3462                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
3463         },
3464         { &hf_infiniband_status, {
3465                 "Status", "infiniband.mad.status",
3466                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3467         },
3468         { &hf_infiniband_class_specific, {
3469                 "Class Specific", "infiniband.mad.classspecific",
3470                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3471         },
3472         { &hf_infiniband_transaction_id, {
3473                 "Transaction ID", "infiniband.mad.transactionid",
3474                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3475         },
3476         { &hf_infiniband_attribute_id, {
3477                 "Attribute ID", "infiniband.mad.attributeid",
3478                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3479         },
3480         { &hf_infiniband_reserved16, {
3481                 "Reserved", "infiniband.mad.reserved16",
3482                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3483         },
3484         { &hf_infiniband_attribute_modifier, {
3485                 "Attribute Modifier", "infiniband.mad.attributemodifier",
3486                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3487         },
3488         { &hf_infiniband_data, {
3489                 "MAD Data Payload", "infiniband.mad.data",
3490                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3491         },
3492
3493         /* RMPP Header */
3494         { &hf_infiniband_RMPP, {
3495                 "RMPP (Reliable Multi-Packet Transaction Protocol)", "infiniband.rmpp",
3496                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3497         },
3498         { &hf_infiniband_rmpp_version, {
3499                 "RMPP Type", "infiniband.rmpp.rmppversion",
3500                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3501         },
3502         { &hf_infiniband_rmpp_type, {
3503                 "RMPP Type", "infiniband.rmpp.rmpptype",
3504                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3505         },
3506         { &hf_infiniband_r_resp_time, {
3507                 "R Resp Time", "infiniband.rmpp.rresptime",
3508                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3509         },
3510         { &hf_infiniband_rmpp_flags, {
3511                 "RMPP Flags", "infiniband.rmpp.rmppflags",
3512                 FT_UINT8, BASE_HEX, VALS(RMPP_Flags), 0x0F, NULL, HFILL}
3513         },
3514         { &hf_infiniband_rmpp_status, {
3515                 "RMPP Status", "infiniband.rmpp.rmppstatus",
3516                 FT_UINT8, BASE_HEX, VALS(RMPP_Status), 0x0, NULL, HFILL}
3517         },
3518         { &hf_infiniband_rmpp_data1, {
3519                 "RMPP Data 1", "infiniband.rmpp.data1",
3520                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3521         },
3522         { &hf_infiniband_rmpp_data2, {
3523                 "RMPP Data 2", "infiniband.rmpp.data2",
3524                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3525         },
3526
3527     /* RMPP Data */
3528 #if 0
3529         { &hf_infiniband_RMPP_DATA, {
3530                 "RMPP Data (Reliable Multi-Packet Transaction Protocol)", "infiniband.rmpp.data",
3531                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3532         },
3533 #endif
3534         { &hf_infiniband_segment_number, {
3535                 "Segment Number", "infiniband.rmpp.segmentnumber",
3536                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3537         },
3538         { &hf_infiniband_payload_length32, {
3539                 "Payload Length", "infiniband.rmpp.payloadlength",
3540                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3541         },
3542         { &hf_infiniband_transferred_data, {
3543                 "Transferred Data", "infiniband.rmpp.transferreddata",
3544                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3545         },
3546
3547         /* RMPP ACK */
3548         { &hf_infiniband_new_window_last, {
3549                 "New Window Last", "infiniband.rmpp.newwindowlast",
3550                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3551         },
3552         { &hf_infiniband_reserved220, {
3553                 "Segment Number", "infiniband.rmpp.reserved220",
3554                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3555         },
3556
3557         /* RMPP ABORT/STOP */
3558         { &hf_infiniband_optional_extended_error_data, {
3559                 "Optional Extended Error Data", "infiniband.rmpp.extendederrordata",
3560                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3561         },
3562
3563         /* SMP Data (LID Routed) */
3564         { &hf_infiniband_SMP_LID, {
3565                 "Subnet Management Packet (LID Routed)", "infiniband.smplid",
3566                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3567         },
3568         { &hf_infiniband_m_key, {
3569                 "M_Key", "infiniband.smplid.mkey",
3570                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3571         },
3572         { &hf_infiniband_smp_data, {
3573                 "SMP Data", "infiniband.smplid.smpdata",
3574                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3575         },
3576         { &hf_infiniband_reserved1024, {
3577                 "Reserved (1024 bits)", "infiniband.smplid.reserved1024",
3578                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3579         },
3580         { &hf_infiniband_reserved256, {
3581                 "Reserved (256 bits)", "infiniband.smplid.reserved256",
3582                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3583         },
3584
3585     /* XX: All following verified/corrected against Infiniband 1.2.1 Specification */
3586         /* SMP Data Directed Route */
3587         { &hf_infiniband_SMP_DIRECTED, {
3588                 "Subnet Management Packet (Directed Route)", "infiniband.smpdirected",
3589                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3590         },
3591         { &hf_infiniband_smp_status, {
3592                 "Status", "infiniband.smpdirected.smpstatus",
3593                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3594         },
3595         { &hf_infiniband_hop_pointer, {
3596                 "Hop Pointer", "infiniband.smpdirected.hoppointer",
3597                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3598         },
3599         { &hf_infiniband_hop_count, {
3600                 "Hop Count", "infiniband.smpdirected.hopcount",
3601                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3602         },
3603         { &hf_infiniband_dr_slid, {
3604                 "DrSLID", "infiniband.smpdirected.drslid",
3605                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3606         },
3607         { &hf_infiniband_dr_dlid, {
3608                 "DrDLID", "infiniband.smpdirected.drdlid",
3609                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3610         },
3611         { &hf_infiniband_reserved28, {
3612                 "Reserved (224 bits)", "infiniband.smpdirected.reserved28",
3613                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3614         },
3615         { &hf_infiniband_d, {
3616                 "D (Direction Bit)", "infiniband.smpdirected.d",
3617                 FT_UINT64, BASE_HEX, NULL, 0x8000, NULL, HFILL}
3618         },
3619         { &hf_infiniband_initial_path, {
3620                 "Initial Path", "infiniband.smpdirected.initialpath",
3621                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3622         },
3623         { &hf_infiniband_return_path, {
3624                 "Return Path", "infiniband.smpdirected.returnpath",
3625                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3626         },
3627
3628         /* SA MAD Header */
3629         { &hf_infiniband_SA, {
3630                 "SA Packet (Subnet Administration)", "infiniband.sa.drdlid",
3631                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3632         },
3633         { &hf_infiniband_sm_key, {
3634                 "SM_Key (Verification Key)", "infiniband.sa.smkey",
3635                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3636         },
3637         { &hf_infiniband_attribute_offset, {
3638                 "Attribute Offset", "infiniband.sa.attributeoffset",
3639                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3640         },
3641         { &hf_infiniband_component_mask, {
3642                 "Component Mask", "infiniband.sa.componentmask",
3643                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3644         },
3645         { &hf_infiniband_subnet_admin_data, {
3646                 "Subnet Admin Data", "infiniband.sa.subnetadmindata",
3647                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3648         },
3649
3650         /* NodeDescription */
3651         { &hf_infiniband_NodeDescription_NodeString, {
3652                 "NodeString", "infiniband.nodedescription.nodestring",
3653                 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}
3654         },
3655
3656         /* NodeInfo */
3657         { &hf_infiniband_NodeInfo_BaseVersion, {
3658                 "BaseVersion", "infiniband.nodeinfo.baseversion",
3659                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3660         },
3661         { &hf_infiniband_NodeInfo_ClassVersion, {
3662                 "ClassVersion", "infiniband.nodeinfo.classversion",
3663                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3664         },
3665         { &hf_infiniband_NodeInfo_NodeType, {
3666                 "NodeType", "infiniband.nodeinfo.nodetype",
3667                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3668         },
3669         { &hf_infiniband_NodeInfo_NumPorts, {
3670                 "NumPorts", "infiniband.nodeinfo.numports",
3671                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3672         },
3673         { &hf_infiniband_NodeInfo_SystemImageGUID, {
3674                 "SystemImageGUID", "infiniband.nodeinfo.systemimageguid",
3675                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3676         },
3677         { &hf_infiniband_NodeInfo_NodeGUID, {
3678                 "NodeGUID", "infiniband.nodeinfo.nodeguid",
3679                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3680         },
3681         { &hf_infiniband_NodeInfo_PortGUID, {
3682                 "PortGUID", "infiniband.nodeinfo.portguid",
3683                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3684         },
3685         { &hf_infiniband_NodeInfo_PartitionCap, {
3686                 "PartitionCap", "infiniband.nodeinfo.partitioncap",
3687                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3688         },
3689         { &hf_infiniband_NodeInfo_DeviceID, {
3690                 "DeviceID", "infiniband.nodeinfo.deviceid",
3691                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3692         },
3693         { &hf_infiniband_NodeInfo_Revision, {
3694                 "Revision", "infiniband.nodeinfo.revision",
3695                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3696         },
3697         { &hf_infiniband_NodeInfo_LocalPortNum, {
3698                 "LocalPortNum", "infiniband.nodeinfo.localportnum",
3699                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3700         },
3701         { &hf_infiniband_NodeInfo_VendorID, {
3702                 "VendorID", "infiniband.nodeinfo.vendorid",
3703                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
3704         },
3705
3706         /* SwitchInfo */
3707         { &hf_infiniband_SwitchInfo_LinearFDBCap, {
3708                 "LinearFDBCap", "infiniband.switchinfo.linearfdbcap",
3709                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3710         },
3711         { &hf_infiniband_SwitchInfo_RandomFDBCap, {
3712                 "RandomFDBCap", "infiniband.switchinfo.randomfdbcap",
3713                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3714         },
3715         { &hf_infiniband_SwitchInfo_MulticastFDBCap, {
3716                 "MulticastFDBCap", "infiniband.switchinfo.multicastfdbcap",
3717                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3718         },
3719         { &hf_infiniband_SwitchInfo_LinearFDBTop, {
3720                 "LinearFDBTop", "infiniband.switchinfo.linearfdbtop",
3721                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3722         },
3723         { &hf_infiniband_SwitchInfo_DefaultPort, {
3724                 "DefaultPort", "infiniband.switchinfo.defaultport",
3725                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3726         },
3727         { &hf_infiniband_SwitchInfo_DefaultMulticastPrimaryPort, {
3728                 "DefaultMulticastPrimaryPort", "infiniband.switchinfo.defaultmulticastprimaryport",
3729                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3730         },
3731         { &hf_infiniband_SwitchInfo_DefaultMulticastNotPrimaryPort, {
3732                 "DefaultMulticastNotPrimaryPort", "infiniband.switchinfo.defaultmulticastnotprimaryport",
3733                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3734         },
3735         { &hf_infiniband_SwitchInfo_LifeTimeValue, {
3736                 "LifeTimeValue", "infiniband.switchinfo.lifetimevalue",
3737                 FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL}
3738         },
3739         { &hf_infiniband_SwitchInfo_PortStateChange, {
3740                 "PortStateChange", "infiniband.switchinfo.portstatechange",
3741                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
3742         },
3743         { &hf_infiniband_SwitchInfo_OptimizedSLtoVLMappingProgramming, {
3744                 "OptimizedSLtoVLMappingProgramming", "infiniband.switchinfo.optimizedsltovlmappingprogramming",
3745                 FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL}
3746         },
3747         { &hf_infiniband_SwitchInfo_LIDsPerPort, {
3748                 "LIDsPerPort", "infiniband.switchinfo.lidsperport",
3749                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3750         },
3751         { &hf_infiniband_SwitchInfo_PartitionEnforcementCap, {
3752                 "PartitionEnforcementCap", "infiniband.switchinfo.partitionenforcementcap",
3753                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3754         },
3755         { &hf_infiniband_SwitchInfo_InboundEnforcementCap, {
3756                 "InboundEnforcementCap", "infiniband.switchinfo.inboundenforcementcap",
3757                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
3758         },
3759         { &hf_infiniband_SwitchInfo_OutboundEnforcementCap, {
3760                 "OutboundEnforcementCap", "infiniband.switchinfo.outboundenforcementcap",
3761                 FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL}
3762         },
3763         { &hf_infiniband_SwitchInfo_FilterRawInboundCap, {
3764                 "FilterRawInboundCap", "infiniband.switchinfo.filterrawinboundcap",
3765                 FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL}
3766         },
3767         { &hf_infiniband_SwitchInfo_FilterRawOutboundCap, {
3768                 "FilterRawOutboundCap", "infiniband.switchinfo.filterrawoutboundcap",
3769                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
3770         },
3771         { &hf_infiniband_SwitchInfo_EnhancedPortZero, {
3772                 "EnhancedPortZero", "infiniband.switchinfo.enhancedportzero",
3773                 FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL}
3774         },
3775
3776         /* GUIDInfo */
3777 #if 0
3778         { &hf_infiniband_GUIDInfo_GUIDBlock, {
3779                 "GUIDBlock", "infiniband.switchinfo.guidblock",
3780                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
3781         },
3782 #endif
3783         { &hf_infiniband_GUIDInfo_GUID, {
3784                 "GUID", "infiniband.switchinfo.guid",
3785                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3786         },
3787
3788         /* PortInfo */
3789         { &hf_infiniband_PortInfo_M_Key, {
3790                 "M_Key", "infiniband.portinfo.m_key",
3791                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3792         },
3793         { &hf_infiniband_PortInfo_GidPrefix, {
3794                 "GidPrefix", "infiniband.portinfo.guid",
3795                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
3796         },
3797         { &hf_infiniband_PortInfo_LID, {
3798                 "LID", "infiniband.portinfo.lid",
3799                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3800         },
3801         { &hf_infiniband_PortInfo_MasterSMLID, {
3802                 "MasterSMLID", "infiniband.portinfo.mastersmlid",
3803                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3804         },
3805         { &hf_infiniband_PortInfo_CapabilityMask, {
3806                 "CapabilityMask", "infiniband.portinfo.capabilitymask",
3807                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
3808         },
3809         
3810         /* Capability Mask Flags */
3811         { &hf_infiniband_PortInfo_CapabilityMask_SM, {
3812                 "SM", "infiniband.portinfo.capabilitymask.issm",
3813                 FT_UINT32, BASE_HEX, NULL, 0x00000002, NULL, HFILL}
3814         },
3815         { &hf_infiniband_PortInfo_CapabilityMask_NoticeSupported, {
3816                 "NoticeSupported", "infiniband.portinfo.capabilitymask.noticesupported",
3817                 FT_UINT32, BASE_HEX, NULL, 0x00000004, NULL, HFILL}
3818         },
3819         { &hf_infiniband_PortInfo_CapabilityMask_TrapSupported, {
3820                 "TrapSupported", "infiniband.portinfo.capabilitymask.trapsupported",
3821                 FT_UINT32, BASE_HEX, NULL, 0x00000008, NULL, HFILL}
3822         },
3823         { &hf_infiniband_PortInfo_CapabilityMask_OptionalPDSupported, {
3824                 "OptionalPDSupported", "infiniband.portinfo.capabilitymask.optionalpdsupported",
3825                 FT_UINT32, BASE_HEX, NULL, 0x00000010, NULL, HFILL}
3826         },
3827         { &hf_infiniband_PortInfo_CapabilityMask_AutomaticMigrationSupported, {
3828                 "AutomaticMigrationSupported", "infiniband.portinfo.capabilitymask.automaticmigrationsupported",
3829                 FT_UINT32, BASE_HEX, NULL, 0x00000020, NULL, HFILL}
3830         },
3831         { &hf_infiniband_PortInfo_CapabilityMask_SLMappingSupported, {
3832                 "SLMappingSupported", "infiniband.portinfo.capabilitymask.slmappingsupported",
3833                 FT_UINT32, BASE_HEX, NULL, 0x00000040, NULL, HFILL}
3834         },
3835         { &hf_infiniband_PortInfo_CapabilityMask_MKeyNVRAM, {
3836                 "MKeyNVRAM", "infiniband.portinfo.capabilitymask.mkeynvram",
3837                 FT_UINT32, BASE_HEX, NULL, 0x00000080, NULL, HFILL}
3838         },
3839         { &hf_infiniband_PortInfo_CapabilityMask_PKeyNVRAM, {
3840                 "PKeyNVRAM", "infiniband.portinfo.capabilitymask.pkeynvram",
3841                 FT_UINT32, BASE_HEX, NULL, 0x00000100, NULL, HFILL}
3842         },
3843         { &hf_infiniband_PortInfo_CapabilityMask_LEDInfoSupported, {
3844                 "LEDInfoSupported", "infiniband.portinfo.capabilitymask.ledinfosupported",
3845                 FT_UINT32, BASE_HEX, NULL, 0x00000200, NULL, HFILL}
3846         },
3847         { &hf_infiniband_PortInfo_CapabilityMask_SMdisabled, {
3848                 "SMdisabled", "infiniband.portinfo.capabilitymask.smdisabled",
3849                 FT_UINT32, BASE_HEX, NULL, 0x00000400, NULL, HFILL}
3850         },
3851         { &hf_infiniband_PortInfo_CapabilityMask_SystemImageGUIDSupported, {
3852                 "SystemImageGUIDSupported", "infiniband.portinfo.capabilitymask.systemimageguidsupported",
3853                 FT_UINT32, BASE_HEX, NULL, 0x00000800, NULL, HFILL}
3854         },
3855         { &hf_infiniband_PortInfo_CapabilityMask_PKeySwitchExternalPortTrapSupported, {
3856                 "PKeySwitchExternalPortTrapSupported", "infiniband.portinfo.capabilitymask.pkeyswitchexternalporttrapsupported",
3857                 FT_UINT32, BASE_HEX, NULL, 0x00001000, NULL, HFILL}
3858         },
3859         { &hf_infiniband_PortInfo_CapabilityMask_CommunicationsManagementSupported, {
3860                 "CommunicationsManagementSupported", "infiniband.portinfo.capabilitymask.communicationsmanagementsupported",
3861                 FT_UINT32, BASE_HEX, NULL, 0x00010000, NULL, HFILL}
3862         },
3863         { &hf_infiniband_PortInfo_CapabilityMask_SNMPTunnelingSupported, {
3864                 "SNMPTunnelingSupported", "infiniband.portinfo.capabilitymask.snmptunnelingsupported",
3865                 FT_UINT32, BASE_HEX, NULL, 0x00020000, NULL, HFILL}
3866         },
3867         { &hf_infiniband_PortInfo_CapabilityMask_ReinitSupported, {
3868                 "ReinitSupported", "infiniband.portinfo.capabilitymask.reinitsupported",
3869                 FT_UINT32, BASE_HEX, NULL, 0x00040000, NULL, HFILL}
3870         },
3871         { &hf_infiniband_PortInfo_CapabilityMask_DeviceManagementSupported, {
3872                 "DeviceManagementSupported", "infiniband.portinfo.capabilitymask.devicemanagementsupported",
3873                 FT_UINT32, BASE_HEX, NULL, 0x00080000, NULL, HFILL}
3874         },
3875         { &hf_infiniband_PortInfo_CapabilityMask_VendorClassSupported, {
3876                 "VendorClassSupported", "infiniband.portinfo.capabilitymask.vendorclasssupported",
3877                 FT_UINT32, BASE_HEX, NULL, 0x00100000, NULL, HFILL}
3878         },
3879         { &hf_infiniband_PortInfo_CapabilityMask_DRNoticeSupported, {
3880                 "DRNoticeSupported", "infiniband.portinfo.capabilitymask.drnoticesupported",
3881                 FT_UINT32, BASE_HEX, NULL, 0x00200000, NULL, HFILL}
3882         },
3883         { &hf_infiniband_PortInfo_CapabilityMask_CapabilityMaskNoticeSupported, {
3884                 "CapabilityMaskNoticeSupported", "infiniband.portinfo.capabilitymask.capabilitymasknoticesupported",
3885                 FT_UINT32, BASE_HEX, NULL, 0x00400000, NULL, HFILL}
3886         },
3887         { &hf_infiniband_PortInfo_CapabilityMask_BootManagementSupported, {
3888                 "BootManagementSupported", "infiniband.portinfo.capabilitymask.bootmanagementsupported",
3889                 FT_UINT32, BASE_HEX, NULL, 0x00800000, NULL, HFILL}
3890         },
3891         { &hf_infiniband_PortInfo_CapabilityMask_LinkRoundTripLatencySupported, {
3892                 "LinkRoundTripLatencySupported", "infiniband.portinfo.capabilitymask.linkroundtriplatencysupported",
3893                 FT_UINT32, BASE_HEX, NULL, 0x01000000, NULL, HFILL}
3894         },
3895         { &hf_infiniband_PortInfo_CapabilityMask_ClientRegistrationSupported, {
3896                 "ClientRegistrationSupported", "infiniband.portinfo.capabilitymask.clientregistrationsupported",
3897                 FT_UINT32, BASE_HEX, NULL, 0x02000000, NULL, HFILL}
3898         },
3899         { &hf_infiniband_PortInfo_CapabilityMask_OtherLocalChangesNoticeSupported, {
3900                 "OtherLocalChangesNoticeSupported", "infiniband.portinfo.capabilitymask.otherlocalchangesnoticesupported",
3901                 FT_UINT32, BASE_HEX, NULL, 0x04000000, NULL, HFILL}
3902         },
3903         { &hf_infiniband_PortInfo_CapabilityMask_LinkSpeedWIdthPairsTableSupported, {
3904                 "LinkSpeedWIdthPairsTableSupported", "infiniband.portinfo.capabilitymask.linkspeedwidthpairstablesupported",
3905                 FT_UINT32, BASE_HEX, NULL, 0x08000000, NULL, HFILL}
3906         },
3907         /* End Capability Mask Flags */
3908
3909         /* PortInfo */
3910         { &hf_infiniband_PortInfo_DiagCode, {
3911                 "DiagCode", "infiniband.portinfo.diagcode",
3912                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3913         },
3914         { &hf_infiniband_PortInfo_M_KeyLeasePeriod, {
3915                 "M_KeyLeasePeriod", "infiniband.portinfo.m_keyleaseperiod",
3916                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
3917         },
3918         { &hf_infiniband_PortInfo_LocalPortNum, {
3919                 "LocalPortNum", "infiniband.portinfo.localportnum",
3920                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3921         },
3922         { &hf_infiniband_PortInfo_LinkWidthEnabled, {
3923                 "LinkWidthEnabled", "infiniband.portinfo.linkwidthenabled",
3924                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3925         },
3926         { &hf_infiniband_PortInfo_LinkWidthSupported, {
3927                 "LinkWidthSupported", "infiniband.portinfo.linkwidthsupported",
3928                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3929         },
3930         { &hf_infiniband_PortInfo_LinkWidthActive, {
3931                 "LinkWidthActive", "infiniband.portinfo.linkwidthactive",
3932                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3933         },
3934         { &hf_infiniband_PortInfo_LinkSpeedSupported, {
3935                 "LinkSpeedSupported", "infiniband.portinfo.linkspeedsupported",
3936                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3937         },
3938         { &hf_infiniband_PortInfo_PortState, {
3939                 "PortState", "infiniband.portinfo.portstate",
3940                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
3941         },
3942         { &hf_infiniband_PortInfo_PortPhysicalState, {
3943                 "PortPhysicalState", "infiniband.portinfo.portphysicalstate",
3944                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3945         },
3946         { &hf_infiniband_PortInfo_LinkDownDefaultState, {
3947                 "LinkDownDefaultState", "infiniband.portinfo.linkdowndefaultstate",
3948                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
3949         },
3950         { &hf_infiniband_PortInfo_M_KeyProtectBits, {
3951                 "M_KeyProtectBits", "infiniband.portinfo.m_keyprotectbits",
3952                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
3953         },
3954         { &hf_infiniband_PortInfo_LMC, {
3955                 "LMC", "infiniband.portinfo.lmc",
3956                 FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL}
3957         },
3958         { &hf_infiniband_PortInfo_LinkSpeedActive, {
3959                 "LinkSpeedActive", "infiniband.portinfo.linkspeedactive",
3960                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3961         },
3962         { &hf_infiniband_PortInfo_LinkSpeedEnabled, {
3963                 "LinkSpeedEnabled", "infiniband.portinfo.linkspeedenabled",
3964                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
3965         },
3966         { &hf_infiniband_PortInfo_NeighborMTU, {
3967                 "NeighborMTU", "infiniband.portinfo.neighbormtu",
3968                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3969         },
3970         { &hf_infiniband_PortInfo_MasterSMSL, {
3971                 "MasterSMSL", "infiniband.portinfo.mastersmsl",
3972                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
3973         },
3974         { &hf_infiniband_PortInfo_VLCap, {
3975                 "VLCap", "infiniband.portinfo.vlcap",
3976                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3977         },
3978         { &hf_infiniband_PortInfo_InitType, {
3979                 "InitType", "infiniband.portinfo.inittype",
3980                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
3981         },
3982         { &hf_infiniband_PortInfo_VLHighLimit, {
3983                 "VLHighLimit", "infiniband.portinfo.vlhighlimit",
3984                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3985         },
3986         { &hf_infiniband_PortInfo_VLArbitrationHighCap, {
3987                 "VLArbitrationHighCap", "infiniband.portinfo.vlarbitrationhighcap",
3988                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3989         },
3990         { &hf_infiniband_PortInfo_VLArbitrationLowCap, {
3991                 "VLArbitrationLowCap", "infiniband.portinfo.vlarbitrationlowcap",
3992                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
3993         },
3994         { &hf_infiniband_PortInfo_InitTypeReply, {
3995                 "InitTypeReply", "infiniband.portinfo.inittypereply",
3996                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
3997         },
3998         { &hf_infiniband_PortInfo_MTUCap, {
3999                 "MTUCap", "infiniband.portinfo.mtucap",
4000                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4001         },
4002         { &hf_infiniband_PortInfo_VLStallCount, {
4003                 "VLStallCount", "infiniband.portinfo.vlstallcount",
4004                 FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL}
4005         },
4006         { &hf_infiniband_PortInfo_HOQLife, {
4007                 "HOQLife", "infiniband.portinfo.hoqlife",
4008                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
4009         },
4010         { &hf_infiniband_PortInfo_OperationalVLs, {
4011                 "OperationalVLs", "infiniband.portinfo.operationalvls",
4012                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4013         },
4014         { &hf_infiniband_PortInfo_PartitionEnforcementInbound, {
4015                 "PartitionEnforcementInbound", "infiniband.portinfo.partitionenforcementinbound",
4016                 FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL}
4017         },
4018         { &hf_infiniband_PortInfo_PartitionEnforcementOutbound, {
4019                 "PartitionEnforcementOutbound", "infiniband.portinfo.partitionenforcementoutbound",
4020                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
4021         },
4022         { &hf_infiniband_PortInfo_FilterRawInbound, {
4023                 "FilterRawInbound", "infiniband.portinfo.filterrawinbound",
4024                 FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL}
4025         },
4026         { &hf_infiniband_PortInfo_FilterRawOutbound, {
4027                 "FilterRawOutbound", "infiniband.portinfo.filterrawoutbound",
4028                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
4029         },
4030         { &hf_infiniband_PortInfo_M_KeyViolations, {
4031                 "M_KeyViolations", "infiniband.portinfo.m_keyviolations",
4032                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4033         },
4034         { &hf_infiniband_PortInfo_P_KeyViolations, {
4035                 "P_KeyViolations", "infiniband.portinfo.p_keyviolations",
4036                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4037         },
4038         { &hf_infiniband_PortInfo_Q_KeyViolations, {
4039                 "Q_KeyViolations", "infiniband.portinfo.q_keyviolations",
4040                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4041         },
4042         { &hf_infiniband_PortInfo_GUIDCap, {
4043                 "GUIDCap", "infiniband.portinfo.guidcap",
4044                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4045         },
4046         { &hf_infiniband_PortInfo_ClientReregister, {
4047                 "ClientReregister", "infiniband.portinfo.clientreregister",
4048                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4049         },
4050         { &hf_infiniband_PortInfo_SubnetTimeOut, {
4051                 "SubnetTimeOut", "infiniband.portinfo.subnettimeout",
4052                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
4053         },
4054         { &hf_infiniband_PortInfo_RespTimeValue, {
4055                 "RespTimeValue", "infiniband.portinfo.resptimevalue",
4056                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
4057         },
4058         { &hf_infiniband_PortInfo_LocalPhyErrors, {
4059                 "LocalPhyErrors", "infiniband.portinfo.localphyerrors",
4060                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4061         },
4062         { &hf_infiniband_PortInfo_OverrunErrors, {
4063                 "OverrunErrors", "infiniband.portinfo.overrunerrors",
4064                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4065         },
4066         { &hf_infiniband_PortInfo_MaxCreditHint, {
4067                 "MaxCreditHint", "infiniband.portinfo.maxcredithint",
4068                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4069         },
4070         { &hf_infiniband_PortInfo_LinkRoundTripLatency, {
4071                 "LinkRoundTripLatency", "infiniband.portinfo.linkroundtriplatency",
4072                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4073         },
4074
4075         /* P_KeyTable */
4076         { &hf_infiniband_P_KeyTable_P_KeyTableBlock, {
4077                 "P_KeyTableBlock", "infiniband.p_keytable.p_keytableblock",
4078                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4079         },
4080         { &hf_infiniband_P_KeyTable_MembershipType, {
4081                 "MembershipType", "infiniband.p_keytable.membershiptype",
4082                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4083         },
4084         { &hf_infiniband_P_KeyTable_P_KeyBase, {
4085                 "P_KeyBase", "infiniband.p_keytable.p_keybase",
4086                 FT_UINT16, BASE_HEX, NULL, 0x7FFF, NULL, HFILL}
4087         },
4088
4089         /* SLtoVLMappingTable */
4090         { &hf_infiniband_SLtoVLMappingTable_SLtoVL_HighBits, {
4091                 "SL(x)toVL", "infiniband.sltovlmappingtable.sltovlhighbits",
4092                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4093         },
4094         { &hf_infiniband_SLtoVLMappingTable_SLtoVL_LowBits, {
4095                 "SL(x)toVL", "infiniband.sltovlmappingtable.sltovllowbits",
4096                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4097         },
4098
4099         /* VLArbitrationTable */
4100 #if 0
4101         { &hf_infiniband_VLArbitrationTable_VLWeightPairs, {
4102                 "VLWeightPairs", "infiniband.vlarbitrationtable.vlweightpairs",
4103                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4104         },
4105 #endif
4106         { &hf_infiniband_VLArbitrationTable_VL, {
4107                 "VL", "infiniband.vlarbitrationtable.vl",
4108                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4109         },
4110         { &hf_infiniband_VLArbitrationTable_Weight, {
4111                 "Weight", "infiniband.vlarbitrationtable.weight",
4112                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4113         },
4114
4115         /* LinearForwardingTable */
4116 #if 0
4117         { &hf_infiniband_LinearForwardingTable_LinearForwardingTableBlock, {
4118                 "LinearForwardingTableBlock", "infiniband.linearforwardingtable.linearforwardingtableblock",
4119                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4120         },
4121 #endif
4122         { &hf_infiniband_LinearForwardingTable_Port, {
4123                 "Port", "infiniband.linearforwardingtable.port",
4124                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4125         },
4126
4127         /* RandomForwardingTable */
4128 #if 0
4129         { &hf_infiniband_RandomForwardingTable_RandomForwardingTableBlock, {
4130                 "RandomForwardingTableBlock", "infiniband.randomforwardingtable.randomforwardingtableblock",
4131                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4132         },
4133 #endif
4134         { &hf_infiniband_RandomForwardingTable_LID, {
4135                 "LID", "infiniband.randomforwardingtable.lid",
4136                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4137         },
4138         { &hf_infiniband_RandomForwardingTable_Valid, {
4139                 "Valid", "infiniband.randomforwardingtable.valid",
4140                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4141         },
4142         { &hf_infiniband_RandomForwardingTable_LMC, {
4143                 "LMC", "infiniband.randomforwardingtable.lmc",
4144                 FT_UINT8, BASE_HEX, NULL, 0x70, NULL, HFILL}
4145         },
4146         { &hf_infiniband_RandomForwardingTable_Port, {
4147                 "Port", "infiniband.randomforwardingtable.port",
4148                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4149         },
4150
4151         /* MulticastForwardingTable */
4152 #if 0
4153         { &hf_infiniband_MulticastForwardingTable_MulticastForwardingTableBlock , {
4154                 "MulticastForwardingTableBlock", "infiniband.multicastforwardingtable.multicastforwardingtableblock",
4155                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4156         },
4157 #endif
4158         { &hf_infiniband_MulticastForwardingTable_PortMask, {
4159                 "PortMask", "infiniband.multicastforwardingtable.portmask",
4160                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4161         },
4162
4163         /* SMInfo */
4164         { &hf_infiniband_SMInfo_GUID, {
4165                 "GUID", "infiniband.sminfo.guid",
4166                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4167         },
4168         { &hf_infiniband_SMInfo_SM_Key, {
4169                 "SM_Key", "infiniband.sminfo.sm_key",
4170                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4171         },
4172         { &hf_infiniband_SMInfo_ActCount, {
4173                 "ActCount", "infiniband.sminfo.actcount",
4174                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4175         },
4176         { &hf_infiniband_SMInfo_Priority, {
4177                 "Priority", "infiniband.sminfo.priority",
4178                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4179         },
4180         { &hf_infiniband_SMInfo_SMState, {
4181                 "SMState", "infiniband.sminfo.smstate",
4182                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4183         },
4184
4185         /* VendorDiag */
4186         { &hf_infiniband_VendorDiag_NextIndex, {
4187                 "NextIndex", "infiniband.vendordiag.nextindex",
4188                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4189         },
4190         { &hf_infiniband_VendorDiag_DiagData, {
4191                 "DiagData", "infiniband.vendordiag.diagdata",
4192                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4193         },
4194
4195         /* LedInfo */
4196         { &hf_infiniband_LedInfo_LedMask, {
4197                 "LedMask", "infiniband.ledinfo.ledmask",
4198                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4199         },  
4200
4201         /* LinkSpeedWidthPairsTable */
4202         { &hf_infiniband_LinkSpeedWidthPairsTable_NumTables, {
4203                 "NumTables", "infiniband.linkspeedwidthpairstable.numtables",
4204                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4205         },
4206         { &hf_infiniband_LinkSpeedWidthPairsTable_PortMask, {
4207                 "PortMask", "infiniband.linkspeedwidthpairstable.portmask",
4208                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4209         },  
4210         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedTwoFive, {
4211                 "Speed 2.5 Gbps", "infiniband.linkspeedwidthpairstable.speedtwofive",
4212                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4213         },  
4214         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedFive, {
4215                 "Speed 5 Gbps", "infiniband.linkspeedwidthpairstable.speedfive",
4216                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4217         },  
4218         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedTen, {
4219                 "Speed 10 Gbps", "infiniband.linkspeedwidthpairstable.speedten",
4220                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4221         },  
4222
4223         /* NodeRecord */
4224         /* PortInfoRecord */
4225         /* SLtoVLMappingTableRecord */
4226         /* SwitchInfoRecord */
4227         /* LinearForwardingTableRecord */
4228         /* RandomForwardingTableRecord */
4229         /* MulticastForwardingTableRecord */
4230         /* VLArbitrationTableRecord */
4231         { &hf_infiniband_SA_LID, {
4232                 "LID", "infiniband.sa.lid",
4233                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4234         },
4235         { &hf_infiniband_SA_EndportLID, {
4236                 "EndportLID", "infiniband.sa.endportlid",
4237                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4238         },
4239         { &hf_infiniband_SA_PortNum, {
4240                 "PortNum", "infiniband.sa.portnum",
4241                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4242         },
4243         { &hf_infiniband_SA_InputPortNum , {
4244                 "InputPortNum", "infiniband.sa.inputportnum",
4245                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4246         },
4247         { &hf_infiniband_SA_OutputPortNum, {
4248                 "OutputPortNum", "infiniband.sa.outputportnum",
4249                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4250         },
4251         { &hf_infiniband_SA_BlockNum_EightBit, {
4252                 "BlockNum_EightBit", "infiniband.sa.blocknum_eightbit",
4253                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4254         },
4255         { &hf_infiniband_SA_BlockNum_NineBit, {
4256                 "BlockNum_NineBit", "infiniband.sa.blocknum_ninebit",
4257                 FT_UINT16, BASE_HEX, NULL, 0x01FF, NULL, HFILL}
4258         },
4259         { &hf_infiniband_SA_BlockNum_SixteenBit, {
4260                 "BlockNum_SixteenBit", "infiniband.sa.blocknum_sixteenbit",
4261                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4262         },
4263         { &hf_infiniband_SA_Position, {
4264                 "Position", "infiniband.sa.position",
4265                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4266         },
4267 #if 0
4268         { &hf_infiniband_SA_Index, {
4269                 "Index", "infiniband.sa.index",
4270                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4271         },
4272 #endif
4273
4274         /* InformInfoRecord */
4275         { &hf_infiniband_InformInfoRecord_SubscriberGID, {
4276                 "SubscriberGID", "infiniband.informinforecord.subscribergid",
4277                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4278         },
4279         { &hf_infiniband_InformInfoRecord_Enum, {
4280                 "Enum", "infiniband.informinforecord.enum",
4281                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4282         },
4283
4284         /* InformInfo */
4285         { &hf_infiniband_InformInfo_GID, {
4286                 "GID", "infiniband.informinfo.gid",
4287                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4288         },
4289         { &hf_infiniband_InformInfo_LIDRangeBegin, {
4290                 "LIDRangeBegin", "infiniband.informinfo.lidrangebegin",
4291                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4292         },
4293         { &hf_infiniband_InformInfo_LIDRangeEnd, {
4294                 "LIDRangeEnd", "infiniband.informinfo.lidrangeend",
4295                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4296         },
4297         { &hf_infiniband_InformInfo_IsGeneric, {
4298                 "IsGeneric", "infiniband.informinfo.isgeneric",
4299                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4300         },
4301         { &hf_infiniband_InformInfo_Subscribe, {
4302                 "Subscribe", "infiniband.informinfo.subscribe",
4303                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4304         },
4305         { &hf_infiniband_InformInfo_Type, {
4306                 "Type", "infiniband.informinfo.type",
4307                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4308         },
4309         { &hf_infiniband_InformInfo_TrapNumberDeviceID, {
4310                 "TrapNumberDeviceID", "infiniband.informinfo.trapnumberdeviceid",
4311                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4312         },
4313         { &hf_infiniband_InformInfo_QPN, {
4314                 "QPN", "infiniband.informinfo.qpn",
4315                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4316         },
4317         { &hf_infiniband_InformInfo_RespTimeValue, {
4318                 "RespTimeValue", "infiniband.informinfo.resptimevalue",
4319                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
4320         },
4321         { &hf_infiniband_InformInfo_ProducerTypeVendorID, {
4322                 "ProducerTypeVendorID", "infiniband.informinfo.producertypevendorid",
4323                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4324         },
4325
4326         /* LinkRecord */
4327         { &hf_infiniband_LinkRecord_FromLID, {
4328                 "FromLID", "infiniband.linkrecord.fromlid",
4329                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4330         },
4331         { &hf_infiniband_LinkRecord_FromPort, {
4332                 "FromPort", "infiniband.linkrecord.fromport",
4333                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4334         },
4335         { &hf_infiniband_LinkRecord_ToPort, {
4336                 "ToPort", "infiniband.linkrecord.toport",
4337                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4338         },
4339         { &hf_infiniband_LinkRecord_ToLID, {
4340                 "ToLID", "infiniband.linkrecord.tolid",
4341                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4342         },
4343
4344         /* ServiceRecord */
4345         { &hf_infiniband_ServiceRecord_ServiceID, {
4346                 "ServiceID", "infiniband.linkrecord.serviceid",
4347                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4348         },
4349         { &hf_infiniband_ServiceRecord_ServiceGID, {
4350                 "ServiceGID", "infiniband.linkrecord.servicegid",
4351                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4352         },
4353         { &hf_infiniband_ServiceRecord_ServiceP_Key, {
4354                 "ServiceP_Key", "infiniband.linkrecord.servicep_key",
4355                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4356         },
4357         { &hf_infiniband_ServiceRecord_ServiceLease, {
4358                 "ServiceLease", "infiniband.linkrecord.servicelease",
4359                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4360         },
4361         { &hf_infiniband_ServiceRecord_ServiceKey, {
4362                 "ServiceKey", "infiniband.linkrecord.servicekey",
4363                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4364         },
4365         { &hf_infiniband_ServiceRecord_ServiceName, {
4366                 "ServiceName", "infiniband.linkrecord.servicename",
4367                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4368         },
4369         { &hf_infiniband_ServiceRecord_ServiceData, {
4370                 "ServiceData", "infiniband.linkrecord.servicedata",
4371                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4372         },
4373
4374         /* ServiceAssociationRecord */
4375         { &hf_infiniband_ServiceAssociationRecord_ServiceKey, {
4376                 "ServiceKey", "infiniband.serviceassociationrecord.servicekey",
4377                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4378         },
4379         { &hf_infiniband_ServiceAssociationRecord_ServiceName, {
4380                 "ServiceName", "infiniband.serviceassociationrecord.servicename",
4381                 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}
4382         },
4383
4384         /* PathRecord */
4385         { &hf_infiniband_PathRecord_DGID, {
4386                 "DGID", "infiniband.pathrecord.dgid",
4387                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4388         },
4389         { &hf_infiniband_PathRecord_SGID, {
4390                 "SGID", "infiniband.pathrecord.sgid",
4391                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4392         },
4393         { &hf_infiniband_PathRecord_DLID, {
4394                 "DLID", "infiniband.pathrecord.dlid",
4395                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4396         },
4397         { &hf_infiniband_PathRecord_SLID, {
4398                 "SLID", "infiniband.pathrecord.slid",
4399                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4400         },
4401         { &hf_infiniband_PathRecord_RawTraffic, {
4402                 "RawTraffic", "infiniband.pathrecord.rawtraffic",
4403                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4404         },
4405         { &hf_infiniband_PathRecord_FlowLabel, {
4406                 "FlowLabel", "infiniband.pathrecord.flowlabel",
4407                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
4408         },
4409         { &hf_infiniband_PathRecord_HopLimit, {
4410                 "HopLimit", "infiniband.pathrecord.hoplimit",
4411                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4412         },
4413         { &hf_infiniband_PathRecord_TClass, {
4414                 "TClass", "infiniband.pathrecord.tclass",
4415                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4416         },
4417         { &hf_infiniband_PathRecord_Reversible, {
4418                 "Reversible", "infiniband.pathrecord.reversible",
4419                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4420         },
4421         { &hf_infiniband_PathRecord_NumbPath, {
4422                 "NumbPath", "infiniband.pathrecord.numbpath",
4423                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
4424         },
4425         { &hf_infiniband_PathRecord_P_Key, {
4426                 "P_Key", "infiniband.pathrecord.p_key",
4427                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4428         },
4429         { &hf_infiniband_PathRecord_SL, {
4430                 "SL", "infiniband.pathrecord.sl",
4431                 FT_UINT16, BASE_HEX, NULL, 0x000F, NULL, HFILL}
4432         },
4433         { &hf_infiniband_PathRecord_MTUSelector, {
4434                 "MTUSelector", "infiniband.pathrecord.mtuselector",
4435                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4436         },
4437         { &hf_infiniband_PathRecord_MTU, {
4438                 "MTU", "infiniband.pathrecord.mtu",
4439                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4440         },
4441         { &hf_infiniband_PathRecord_RateSelector, {
4442                 "RateSelector", "infiniband.pathrecord.rateselector",
4443                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4444         },
4445         { &hf_infiniband_PathRecord_Rate, {
4446                 "Rate", "infiniband.pathrecord.rate",
4447                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4448         },
4449         { &hf_infiniband_PathRecord_PacketLifeTimeSelector, {
4450                 "PacketLifeTimeSelector", "infiniband.pathrecord.packetlifetimeselector",
4451                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4452         },
4453         { &hf_infiniband_PathRecord_PacketLifeTime, {
4454                 "PacketLifeTime", "infiniband.pathrecord.packetlifetime",
4455                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4456         },
4457         { &hf_infiniband_PathRecord_Preference, {
4458                 "Preference", "infiniband.pathrecord.preference",
4459                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4460         },
4461
4462         /* MCMemberRecord */
4463         { &hf_infiniband_MCMemberRecord_MGID, {
4464                 "MGID", "infiniband.mcmemberrecord.mgid",
4465                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4466         },
4467         { &hf_infiniband_MCMemberRecord_PortGID, {
4468                 "PortGID", "infiniband.mcmemberrecord.portgid",
4469                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4470         },
4471         { &hf_infiniband_MCMemberRecord_Q_Key, {
4472                 "Q_Key", "infiniband.mcmemberrecord.q_key",
4473                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4474         },
4475         { &hf_infiniband_MCMemberRecord_MLID, {
4476                 "MLID", "infiniband.mcmemberrecord.mlid",
4477                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4478         },
4479         { &hf_infiniband_MCMemberRecord_MTUSelector, {
4480                 "MTUSelector", "infiniband.mcmemberrecord.mtuselector",
4481                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4482         },
4483         { &hf_infiniband_MCMemberRecord_MTU, {
4484                 "MTU", "infiniband.mcmemberrecord.mtu",
4485                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4486         },
4487         { &hf_infiniband_MCMemberRecord_TClass, {
4488                 "TClass", "infiniband.mcmemberrecord.tclass",
4489                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4490         },
4491         { &hf_infiniband_MCMemberRecord_P_Key, {
4492                 "P_Key", "infiniband.mcmemberrecord.p_key",
4493                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4494         },
4495         { &hf_infiniband_MCMemberRecord_RateSelector, {
4496                 "RateSelector", "infiniband.mcmemberrecord.rateselector",
4497                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4498         },
4499         { &hf_infiniband_MCMemberRecord_Rate, {
4500                 "Rate", "infiniband.mcmemberrecord.rate",
4501                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4502         },
4503         { &hf_infiniband_MCMemberRecord_PacketLifeTimeSelector, {
4504                 "PacketLifeTimeSelector", "infiniband.mcmemberrecord.packetlifetimeselector",
4505                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4506         },
4507         { &hf_infiniband_MCMemberRecord_PacketLifeTime, {
4508                 "PacketLifeTime", "infiniband.mcmemberrecord.packetlifetime",
4509                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4510         },
4511         { &hf_infiniband_MCMemberRecord_SL, {
4512                 "SL", "infiniband.mcmemberrecord.sl",
4513                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4514         },
4515         { &hf_infiniband_MCMemberRecord_FlowLabel, {
4516                 "FlowLabel", "infiniband.mcmemberrecord.flowlabel",
4517                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
4518         },
4519         { &hf_infiniband_MCMemberRecord_HopLimit, {
4520                 "HopLimit", "infiniband.mcmemberrecord.hoplimit",
4521                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4522         },
4523         { &hf_infiniband_MCMemberRecord_Scope, {
4524                 "Scope", "infiniband.mcmemberrecord.scope",
4525                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4526         },
4527         { &hf_infiniband_MCMemberRecord_JoinState, {
4528                 "JoinState", "infiniband.mcmemberrecord.joinstate",
4529                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4530         },
4531         { &hf_infiniband_MCMemberRecord_ProxyJoin, {
4532                 "ProxyJoin", "infiniband.mcmemberrecord.proxyjoin",
4533                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4534         },
4535
4536         /* MultiPathRecord */
4537         { &hf_infiniband_MultiPathRecord_RawTraffic, {
4538                 "RawTraffic", "infiniband.multipathrecord.rawtraffic",
4539                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4540         },
4541         { &hf_infiniband_MultiPathRecord_FlowLabel, {
4542                 "FlowLabel", "infiniband.multipathrecord.flowlabel",
4543                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
4544         },
4545         { &hf_infiniband_MultiPathRecord_HopLimit, {
4546                 "HopLimit", "infiniband.multipathrecord.hoplimit",
4547                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4548         },
4549         { &hf_infiniband_MultiPathRecord_TClass, {
4550                 "TClass", "infiniband.multipathrecord.tclass",
4551                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4552         },
4553         { &hf_infiniband_MultiPathRecord_Reversible, {
4554                 "Reversible", "infiniband.multipathrecord.reversible",
4555                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4556         },
4557         { &hf_infiniband_MultiPathRecord_NumbPath, {
4558                 "NumbPath", "infiniband.multipathrecord.numbpath",
4559                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
4560         },
4561         { &hf_infiniband_MultiPathRecord_P_Key, {
4562                 "P_Key", "infiniband.multipathrecord.p_key",
4563                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4564         },
4565         { &hf_infiniband_MultiPathRecord_SL, {
4566                 "SL", "infiniband.multipathrecord.sl",
4567                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
4568         },
4569         { &hf_infiniband_MultiPathRecord_MTUSelector, {
4570                 "MTUSelector", "infiniband.multipathrecord.mtuselector",
4571                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4572         },
4573         { &hf_infiniband_MultiPathRecord_MTU, {
4574                 "MTU", "infiniband.multipathrecord.mtu",
4575                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4576         },
4577         { &hf_infiniband_MultiPathRecord_RateSelector, {
4578                 "RateSelector", "infiniband.multipathrecord.rateselector",
4579                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4580         },
4581         { &hf_infiniband_MultiPathRecord_Rate, {
4582                 "Rate", "infiniband.multipathrecord.rate",
4583                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4584         },
4585         { &hf_infiniband_MultiPathRecord_PacketLifeTimeSelector, {
4586                 "PacketLifeTimeSelector", "infiniband.multipathrecord.packetlifetimeselector",
4587                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4588         },
4589         { &hf_infiniband_MultiPathRecord_PacketLifeTime, {
4590                 "PacketLifeTime", "infiniband.multipathrecord.packetlifetime",
4591                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4592         },
4593         { &hf_infiniband_MultiPathRecord_IndependenceSelector, {
4594                 "IndependenceSelector", "infiniband.multipathrecord.independenceselector",
4595                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
4596         },
4597         { &hf_infiniband_MultiPathRecord_GIDScope, {
4598                 "GIDScope", "infiniband.multipathrecord.gidscope",
4599                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4600         },
4601         { &hf_infiniband_MultiPathRecord_SGIDCount, {
4602                 "SGIDCount", "infiniband.multipathrecord.sgidcount",
4603                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4604         },
4605         { &hf_infiniband_MultiPathRecord_DGIDCount, {
4606                 "DGIDCount", "infiniband.multipathrecord.dgidcount",
4607                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4608         },
4609         { &hf_infiniband_MultiPathRecord_SDGID, {
4610                 "SDGID", "infiniband.multipathrecord.sdgid",
4611                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4612         },
4613
4614         /* Notice */
4615         { &hf_infiniband_Notice_IsGeneric, {
4616                 "IsGeneric", "infiniband.notice.isgeneric",
4617                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4618         },
4619         { &hf_infiniband_Notice_Type, {
4620                 "Type", "infiniband.notice.type",
4621                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
4622         },
4623         { &hf_infiniband_Notice_ProducerTypeVendorID, {
4624                 "ProducerTypeVendorID", "infiniband.notice.producertypevendorid",
4625                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4626         },
4627         { &hf_infiniband_Notice_TrapNumberDeviceID, {
4628                 "TrapNumberDeviceID", "infiniband.notice.trapnumberdeviceid",
4629                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4630         },
4631         { &hf_infiniband_Notice_IssuerLID, {
4632                 "IssuerLID", "infiniband.notice.issuerlid",
4633                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4634         },
4635         { &hf_infiniband_Notice_NoticeToggle, {
4636                 "NoticeToggle", "infiniband.notice.noticetoggle",
4637                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4638         },
4639         { &hf_infiniband_Notice_NoticeCount, {
4640                 "NoticeCount", "infiniband.notice.noticecount",
4641                 FT_UINT16, BASE_HEX, NULL, 0x7FFF, NULL, HFILL}
4642         },
4643         { &hf_infiniband_Notice_DataDetails, {
4644                 "DataDetails", "infiniband.notice.datadetails",
4645                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4646         },
4647 #if 0
4648         { &hf_infiniband_Notice_IssuerGID, {
4649                 "IssuerGID", "infiniband.notice.issuergid",
4650                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4651         },
4652         { &hf_infiniband_Notice_ClassTrapSpecificData, {
4653                 "ClassTrapSpecificData", "infiniband.notice.classtrapspecificdata",
4654                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4655         },
4656 #endif
4657
4658         /* Traps 64,65,66,67 */
4659         { &hf_infiniband_Trap_GIDADDR, {
4660                 "GIDADDR", "infiniband.trap.gidaddr",
4661                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4662         },
4663         /* Traps 68,69 */
4664         { &hf_infiniband_Trap_COMP_MASK, {
4665                 "COMP_MASK", "infiniband.trap.comp_mask",
4666                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4667         },
4668         { &hf_infiniband_Trap_WAIT_FOR_REPATH, {
4669                 "WAIT_FOR_REPATH", "infiniband.trap.wait_for_repath",
4670                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4671         },
4672 #if 0
4673         { &hf_infiniband_Trap_PATH_REC, {
4674                 "PATH_REC", "infiniband.trap.path_rec",
4675                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4676         },
4677 #endif
4678
4679         /* Trap 128 */
4680         { &hf_infiniband_Trap_LIDADDR, {
4681                 "LIDADDR", "infiniband.trap.lidaddr",
4682                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4683         },
4684
4685         /* Trap 129, 130, 131 */
4686         { &hf_infiniband_Trap_PORTNO, {
4687                 "PORTNO", "infiniband.trap.portno",
4688                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4689         },
4690
4691         /* Trap 144 */
4692         { &hf_infiniband_Trap_OtherLocalChanges, {
4693                 "OtherLocalChanges", "infiniband.trap.otherlocalchanges",
4694                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
4695         },
4696         { &hf_infiniband_Trap_CAPABILITYMASK, {
4697                 "CAPABILITYMASK", "infiniband.trap.capabilitymask",
4698                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4699         },
4700         { &hf_infiniband_Trap_LinkSpeecEnabledChange, {
4701                 "LinkSpeecEnabledChange", "infiniband.trap.linkspeecenabledchange",
4702                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
4703         },
4704         { &hf_infiniband_Trap_LinkWidthEnabledChange, {
4705                 "LinkWidthEnabledChange", "infiniband.trap.linkwidthenabledchange",
4706                 FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL}
4707         },
4708         { &hf_infiniband_Trap_NodeDescriptionChange, {
4709                 "NodeDescriptionChange", "infiniband.trap.nodedescriptionchange",
4710                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
4711         },
4712
4713         /* Trap 145 */
4714         { &hf_infiniband_Trap_SYSTEMIMAGEGUID, {
4715                 "SYSTEMIMAGEGUID", "infiniband.trap.systemimageguid",
4716                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4717         },
4718
4719         /* Trap 256 */
4720         { &hf_infiniband_Trap_DRSLID, {
4721                 "DRSLID", "infiniband.trap.drslid",
4722                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4723         },
4724         { &hf_infiniband_Trap_METHOD, {
4725                 "METHOD", "infiniband.trap.method",
4726                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
4727         },
4728         { &hf_infiniband_Trap_ATTRIBUTEID, {
4729                 "ATTRIBUTEID", "infiniband.trap.attributeid",
4730                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4731         },
4732         { &hf_infiniband_Trap_ATTRIBUTEMODIFIER, {
4733                 "ATTRIBUTEMODIFIER", "infiniband.trap.attributemodifier",
4734                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4735         },
4736         { &hf_infiniband_Trap_MKEY, {
4737                 "MKEY", "infiniband.trap.mkey",
4738                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
4739         },
4740         { &hf_infiniband_Trap_DRNotice, {
4741                 "DRNotice", "infiniband.trap.drnotice",
4742                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
4743         },
4744         { &hf_infiniband_Trap_DRPathTruncated, {
4745                 "DRPathTruncated", "infiniband.trap.drpathtruncated",
4746                 FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL}
4747         },
4748         { &hf_infiniband_Trap_DRHopCount, {
4749                 "DRHopCount", "infiniband.trap.drhopcount",
4750                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
4751         },
4752         { &hf_infiniband_Trap_DRNoticeReturnPath, {
4753                 "DRNoticeReturnPath", "infiniband.trap.drnoticereturnpath",
4754                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
4755         },
4756
4757         /* Trap 257, 258 */
4758         { &hf_infiniband_Trap_LIDADDR1, {
4759                 "LIDADDR1", "infiniband.trap.lidaddr1",
4760                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4761         },
4762         { &hf_infiniband_Trap_LIDADDR2, {
4763                 "LIDADDR2", "infiniband.trap.lidaddr2",
4764                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4765         },
4766         { &hf_infiniband_Trap_KEY, {
4767                 "KEY", "infiniband.trap.key",
4768                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
4769         },
4770         { &hf_infiniband_Trap_SL, {
4771                 "SL", "infiniband.trap.sl",
4772                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
4773         },
4774         { &hf_infiniband_Trap_QP1, {
4775                 "QP1", "infiniband.trap.qp1",
4776                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4777         },
4778         { &hf_infiniband_Trap_QP2, {
4779                 "QP2", "infiniband.trap.qp2",
4780                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
4781         },
4782         { &hf_infiniband_Trap_GIDADDR1, {
4783                 "GIDADDR1", "infiniband.trap.gidaddr1",
4784                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4785         },
4786         { &hf_infiniband_Trap_GIDADDR2, {
4787                 "GIDADDR2", "infiniband.trap.gidaddr2",
4788                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4789         },
4790
4791         /* Trap 259 */
4792         { &hf_infiniband_Trap_DataValid, {
4793                 "DataValid", "infiniband.trap.datavalid",
4794                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4795         },
4796         { &hf_infiniband_Trap_PKEY, {
4797                 "PKEY", "infiniband.trap.pkey",
4798                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
4799         },
4800         { &hf_infiniband_Trap_SWLIDADDR, {
4801                 "SWLIDADDR", "infiniband.trap.swlidaddr",
4802                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
4803         }
4804     };
4805
4806     /* Array to hold expansion options between dissections */
4807     static gint *ett[] = {
4808     /*  &ett_infiniband,       */
4809         &ett_all_headers,
4810         &ett_lrh,
4811         &ett_grh,
4812         &ett_bth,
4813         &ett_rwh,
4814         &ett_rawdata,
4815         &ett_rdeth,
4816         &ett_deth,
4817         &ett_reth,
4818         &ett_atomiceth,
4819         &ett_aeth,
4820         &ett_atomicacketh,
4821         &ett_immdt,
4822         &ett_ieth,
4823         &ett_payload,
4824         &ett_vendor,
4825         &ett_subn_lid_routed,
4826         &ett_subn_directed_route,
4827         &ett_subnadmin,
4828         &ett_mad,
4829         &ett_rmpp,
4830         &ett_subm_attribute,
4831         &ett_suba_attribute,
4832         &ett_datadetails,
4833         &ett_noticestraps,
4834     /*  &ett_nodedesc,         */
4835     /*  &ett_nodeinfo,         */
4836     /*  &ett_switchinfo,       */
4837     /*  &ett_guidinfo,         */
4838     /*  &ett_portinfo,         */
4839         &ett_portinfo_capmask,
4840         &ett_pkeytable,
4841         &ett_sltovlmapping,
4842         &ett_vlarbitrationtable,
4843         &ett_linearforwardingtable,
4844         &ett_randomforwardingtable,
4845         &ett_multicastforwardingtable,
4846         &ett_sminfo,
4847         &ett_vendordiag,
4848         &ett_ledinfo,
4849         &ett_linkspeedwidthpairs,
4850         &ett_informinfo,
4851         &ett_linkrecord,
4852         &ett_servicerecord,
4853         &ett_pathrecord,
4854         &ett_mcmemberrecord,
4855         &ett_tracerecord,
4856         &ett_multipathrecord,
4857         &ett_serviceassocrecord
4858     };
4859
4860     proto_infiniband = proto_register_protocol("InfiniBand", "InfiniBand", "infiniband");
4861     register_dissector("infiniband", dissect_infiniband, proto_infiniband);
4862
4863     proto_register_field_array(proto_infiniband, hf, array_length(hf));
4864     proto_register_subtree_array(ett, array_length(ett));
4865
4866 }
4867
4868 /* Reg Handoff.  Register dissectors we'll need for IPoIB */
4869 void proto_reg_handoff_infiniband(void)
4870 {
4871     ipv6_handle = find_dissector("ipv6");
4872     data_handle = find_dissector("data");
4873     ethertype_dissector_table = find_dissector_table("ethertype");
4874 }