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