From Slava via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5335 :
[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  * Modified 2010 by Mellanox Technologies Ltd.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31 #include <stdlib.h>
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include <epan/proto.h>
35 #include <epan/emem.h>
36 #include <epan/conversation.h>
37 #include <epan/dissectors/packet-frame.h>
38 #include <epan/prefs.h>
39 #include <epan/etypes.h>
40 #include <string.h>
41 #include "packet-infiniband.h"
42
43 #define PROTO_TAG_INFINIBAND    "Infiniband"
44
45 /* Wireshark ID */
46 static int proto_infiniband = -1;
47 static int proto_infiniband_link = -1;
48
49 /* Variables to hold expansion values between packets */
50 /* static gint ett_infiniband = -1;                */
51 static gint ett_all_headers = -1;
52 static gint ett_lrh = -1;
53 static gint ett_grh = -1;
54 static gint ett_bth = -1;
55 static gint ett_rwh = -1;
56 static gint ett_rawdata = -1;
57 static gint ett_rdeth = -1;
58 static gint ett_deth = -1;
59 static gint ett_reth = -1;
60 static gint ett_atomiceth = -1;
61 static gint ett_aeth = -1;
62 static gint ett_atomicacketh = -1;
63 static gint ett_immdt = -1;
64 static gint ett_ieth = -1;
65 static gint ett_payload = -1;
66 static gint ett_vendor = -1;
67 static gint ett_subn_lid_routed = -1;
68 static gint ett_subn_directed_route = -1;
69 static gint ett_subnadmin = -1;
70 static gint ett_mad = -1;
71 static gint ett_cm = -1;
72 static gint ett_rmpp = -1;
73 static gint ett_subm_attribute = -1;
74 static gint ett_suba_attribute = -1;
75 static gint ett_datadetails = -1;
76 static gint ett_noticestraps = -1;
77 /* static gint ett_nodedesc = -1;                  */
78 /* static gint ett_nodeinfo = -1;                  */
79 /* static gint ett_switchinfo = -1;                */
80 /* static gint ett_guidinfo = -1;                  */
81 /* static gint ett_portinfo = -1;                  */
82 static gint ett_portinfo_capmask = -1;
83 static gint ett_pkeytable = -1;
84 static gint ett_sltovlmapping = -1;
85 static gint ett_vlarbitrationtable = -1;
86 static gint ett_linearforwardingtable = -1;
87 static gint ett_randomforwardingtable = -1;
88 static gint ett_multicastforwardingtable = -1;
89 static gint ett_sminfo = -1;
90 static gint ett_vendordiag = -1;
91 static gint ett_ledinfo = -1;
92 static gint ett_linkspeedwidthpairs = -1;
93 static gint ett_informinfo = -1;
94 static gint ett_linkrecord = -1;
95 static gint ett_servicerecord = -1;
96 static gint ett_pathrecord = -1;
97 static gint ett_mcmemberrecord = -1;
98 static gint ett_tracerecord = -1;
99 static gint ett_multipathrecord = -1;
100 static gint ett_serviceassocrecord = -1;
101 static gint ett_perfclass = -1;
102 static gint ett_eoib = -1;
103 static gint ett_link = -1;
104
105 /* Global ref to highest level tree should we find other protocols encapsulated in IB */
106 static proto_tree *top_tree = NULL;
107
108 /* Dissector Declarations */
109 static dissector_handle_t ipv6_handle;
110 static dissector_handle_t data_handle;
111 static dissector_handle_t eth_handle;
112 static dissector_table_t ethertype_dissector_table;
113
114 /* MAD_Data
115 * Structure to hold information from the common MAD header.
116 * This is necessary because the MAD header contains information which significantly changes the dissection algorithm. */
117 typedef struct {
118     guint8 managementClass;
119     guint8 classVersion;
120     guint8 method;
121     guint8 status;
122     guint16 classSpecific;
123     guint64 transactionID;
124     guint16 attributeID;
125     guint32 attributeModifier;
126     char data[232];
127 } MAD_Data;
128
129 /* Forward-declarations */
130
131 static void dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
132 static void dissect_infiniband(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
133 static void dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean starts_with_grh);
134 static void dissect_infiniband_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
135 static gint32 find_next_header_sequence(guint32 OpCode);
136 static gboolean contains(guint32 value, guint32* arr, int length);
137 static void dissect_general_info(tvbuff_t *tvb, gint offset, packet_info *pinfo, gboolean starts_with_grh);
138
139 /* Parsing Methods for specific IB headers. */
140
141 static void parse_VENDOR(proto_tree *, tvbuff_t *, gint *);
142 static void parse_PAYLOAD(proto_tree *, packet_info *, tvbuff_t *, gint *, gint length);
143 static void parse_IETH(proto_tree *, tvbuff_t *, gint *);
144 static void parse_IMMDT(proto_tree *, tvbuff_t *, gint *offset);
145 static void parse_ATOMICACKETH(proto_tree *, tvbuff_t *, gint *offset);
146 static void parse_AETH(proto_tree *, tvbuff_t *, gint *offset);
147 static void parse_ATOMICETH(proto_tree *, tvbuff_t *, gint *offset);
148 static void parse_RETH(proto_tree *, tvbuff_t *, gint *offset);
149 static void parse_DETH(proto_tree *, packet_info *, tvbuff_t *, gint *offset);
150 static void parse_RDETH(proto_tree *, tvbuff_t *, gint *offset);
151 static void parse_IPvSix(proto_tree *, tvbuff_t *, gint *offset, packet_info *);
152 static void parse_RWH(proto_tree *, tvbuff_t *, gint *offset, packet_info *);
153 static gboolean parse_EoIB(proto_tree *, tvbuff_t *, gint offset, packet_info *);
154
155 static void parse_SUBN_LID_ROUTED(proto_tree *, packet_info *, tvbuff_t *, gint *offset);
156 static void parse_SUBN_DIRECTED_ROUTE(proto_tree *, packet_info *, tvbuff_t *, gint *offset);
157 static void parse_SUBNADMN(proto_tree *, packet_info *, tvbuff_t *, gint *offset);
158 static void parse_PERF(proto_tree *, tvbuff_t *, packet_info *, gint *offset);
159 static void parse_BM(proto_tree *, tvbuff_t *, gint *offset);
160 static void parse_DEV_MGT(proto_tree *, tvbuff_t *, gint *offset);
161 static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset);
162 static void parse_SNMP(proto_tree *, tvbuff_t *, gint *offset);
163 static void parse_VENDOR_MANAGEMENT(proto_tree *, tvbuff_t *, gint *offset);
164 static void parse_APPLICATION_MANAGEMENT(proto_tree *, tvbuff_t *, gint *offset);
165 static void parse_RESERVED_MANAGEMENT(proto_tree *, tvbuff_t *, gint *offset);
166
167 static gboolean parse_MAD_Common(proto_tree*, tvbuff_t*, gint *offset, MAD_Data*);
168 static gboolean parse_RMPP(proto_tree* , tvbuff_t* , gint *offset);
169 static void label_SUBM_Method(proto_item*, MAD_Data*, packet_info*);
170 static void label_SUBM_Attribute(proto_item*, MAD_Data*, packet_info*);
171 static void label_SUBA_Method(proto_item*, MAD_Data*, packet_info*);
172 static void label_SUBA_Attribute(proto_item*, MAD_Data*, packet_info*);
173
174 /* Class Attribute Parsing Routines */
175 static gboolean parse_SUBM_Attribute(proto_tree*, tvbuff_t*, gint *offset, MAD_Data*);
176 static gboolean parse_SUBA_Attribute(proto_tree*, tvbuff_t*, gint *offset, MAD_Data*);
177
178 /* These methods parse individual attributes
179 * Naming convention FunctionHandle = "parse_" + [Attribute Name];
180 * Where [Attribute Name] is the attribute identifier from chapter 14 of the IB Specification
181 * Subnet Management */
182 static void parse_NoticesAndTraps(proto_tree*, tvbuff_t*, gint *offset);
183 static void parse_NodeDescription(proto_tree*, tvbuff_t*, gint *offset);
184 static void parse_NodeInfo(proto_tree*, tvbuff_t*, gint *offset);
185 static void parse_SwitchInfo(proto_tree*, tvbuff_t*, gint *offset);
186 static void parse_GUIDInfo(proto_tree*, tvbuff_t*, gint *offset);
187 static void parse_PortInfo(proto_tree*, tvbuff_t*, gint *offset);
188 static void parse_P_KeyTable(proto_tree*, tvbuff_t*, gint *offset);
189 static void parse_SLtoVLMappingTable(proto_tree*, tvbuff_t*, gint *offset);
190 static void parse_VLArbitrationTable(proto_tree*, tvbuff_t*, gint *offset);
191 static void parse_LinearForwardingTable(proto_tree*, tvbuff_t*, gint *offset);
192 static void parse_RandomForwardingTable(proto_tree*, tvbuff_t*, gint *offset);
193 static void parse_MulticastForwardingTable(proto_tree*, tvbuff_t*, gint *offset);
194 static void parse_SMInfo(proto_tree*, tvbuff_t*, gint *offset);
195 static void parse_VendorDiag(proto_tree*, tvbuff_t*, gint *offset);
196 static void parse_LedInfo(proto_tree*, tvbuff_t*, gint *offset);
197 static void parse_LinkSpeedWidthPairsTable(proto_tree*, tvbuff_t*, gint *offset);
198
199 /* These methods parse individual attributes for specific MAD management classes.
200 * Naming convention FunctionHandle = "parse_" + [Management Class] + "_" + [Attribute Name];
201 * Where [Management Class] is the shorthand name for the management class as defined
202 * in the MAD Management Classes section below in this file, and [Attribute Name] is the
203 * attribute identifier from the corresponding chapter of the IB Specification */
204 static void parse_PERF_PortCounters(proto_tree* parentTree, tvbuff_t* tvb, packet_info *pinfo, gint *offset);
205 static void parse_PERF_PortCountersExtended(proto_tree* parentTree, tvbuff_t* tvb, packet_info *pinfo, gint *offset);
206
207 /* Subnet Administration */
208 static void parse_InformInfo(proto_tree*, tvbuff_t*, gint *offset);
209 static void parse_LinkRecord(proto_tree*, tvbuff_t*, gint *offset);
210 static void parse_ServiceRecord(proto_tree*, tvbuff_t*, gint *offset);
211 static void parse_PathRecord(proto_tree*, tvbuff_t*, gint *offset);
212 static void parse_MCMemberRecord(proto_tree*, tvbuff_t*, gint *offset);
213 static void parse_TraceRecord(proto_tree*, tvbuff_t*, gint *offset);
214 static void parse_MultiPathRecord(proto_tree*, tvbuff_t*, gint *offset);
215 static void parse_ServiceAssociationRecord(proto_tree*, tvbuff_t*, gint *offset);
216
217 /* Subnet Administration */
218 static void parse_RID(proto_tree*, tvbuff_t*, gint *offset, MAD_Data*);
219
220 /* SM Methods */
221 static const value_string SUBM_Methods[] = {
222     { 0x01, "SubnGet("},
223     { 0x02, "SubnSet("},
224     { 0x81, "SubnGetResp("},
225     { 0x05, "SubnTrap("},
226     { 0x07, "SubnTrapResp("},
227     { 0, NULL}
228 };
229 /* SM Attributes */
230 static const value_string SUBM_Attributes[] = {
231     { 0x0001, "Attribute (ClassPortInfo)"},
232     { 0x0002, "Attribute (Notice)"},
233     { 0x0003, "Attribute (InformInfo)"},
234     { 0x0010, "Attribute (NodeDescription)"},
235     { 0x0011, "Attribute (NodeInfo)"},
236     { 0x0012, "Attribute (SwitchInfo)"},
237     { 0x0014, "Attribute (GUIDInfo)"},
238     { 0x0015, "Attribute (PortInfo)"},
239     { 0x0016, "Attribute (P_KeyTable)"},
240     { 0x0017, "Attribute (SLtoVLMapptingTable)"},
241     { 0x0018, "Attribute (VLArbitrationTable)"},
242     { 0x0019, "Attribute (LinearForwardingTable)"},
243     { 0x001A, "Attribute (RandomForwardingTable)"},
244     { 0x001B, "Attribute (MulticastForwardingTable)"},
245     { 0x001C, "Attribute (LinkSpeedWidthPairsTable)"},
246     { 0x0020, "Attribute (SMInfo)"},
247     { 0x0030, "Attribute (VendorDiag)"},
248     { 0x0031, "Attribute (LedInfo)"},
249     { 0, NULL}
250 };
251
252 /* SA Methods */
253 static const value_string SUBA_Methods[] = {
254     { 0x01, "SubnAdmGet("},
255     { 0x81, "SubnAdmGetResp("},
256     { 0x02, "SubnAdmSet("},
257     { 0x06, "SubnAdmReport("},
258     { 0x86, "SubnAdmReportResp("},
259     { 0x12, "SubnAdmGetTable("},
260     { 0x92, "SubnAdmGetTableResp("},
261     { 0x13, "SubnAdmGetTraceTable("},
262     { 0x14, "SubnAdmGetMulti("},
263     { 0x94, "SubnAdmGetMultiResp("},
264     { 0x15, "SubnAdmDelete("},
265     { 0x95, "SubnAdmDeleteResp("},
266     { 0, NULL}
267 };
268 /* SA Attributes */
269 static const value_string SUBA_Attributes[] = {
270     { 0x0001, "Attribute (ClassPortInfo)"},
271     { 0x0002, "Attribute (Notice)"},
272     { 0x0003, "Attribute (InformInfo)"},
273     { 0x0011, "Attribute (NodeRecord)"},
274     { 0x0012, "Attribute (PortInfoRecord)"},
275     { 0x0013, "Attribute (SLtoVLMappingTableRecord)"},
276     { 0x0014, "Attribute (SwitchInfoRecord)"},
277     { 0x0015, "Attribute (LinearForwardingTableRecord)"},
278     { 0x0016, "Attribute (RandomForwardingTableRecord)"},
279     { 0x0017, "Attribute (MulticastForwardingTableRecord)"},
280     { 0x0018, "Attribute (SMInfoRecord)"},
281     { 0x0019, "Attribute (LinkSpeedWidthPairsTableRecord)"},
282     { 0x00F3, "Attribute (InformInfoRecord)"},
283     { 0x0020, "Attribute (LinkRecord)"},
284     { 0x0030, "Attribute (GuidInfoRecord)"},
285     { 0x0031, "Attribute (ServiceRecord)"},
286     { 0x0033, "Attribute (P_KeyTableRecord)"},
287     { 0x0035, "Attribute (PathRecord)"},
288     { 0x0036, "Attribute (VLArbitrationTableRecord)"},
289     { 0x0038, "Attribute (MCMembersRecord)"},
290     { 0x0039, "Attribute (TraceRecord)"},
291     { 0x003A, "Attribute (MultiPathRecord)"},
292     { 0x003B, "Attribute (ServiceAssociationRecord)"},
293     { 0, NULL}
294 };
295
296 /* CM Attributes */
297 static const value_string CM_Attributes[] = {
298     { 0x0001, "ClassPortInfo"},
299     { 0x0010, "ConnectRequest"},
300     { 0x0011, "MsgRcptAck"},
301     { 0x0012, "ConnectReject"},
302     { 0x0013, "ConnectReply"},
303     { 0x0014, "ReadyToUse"},
304     { 0x0015, "DisconnectRequest"},
305     { 0x0016, "DisconnectReply"},
306     { 0x0017, "ServiceIDResReq"},
307     { 0x0018, "ServiceIDResReqResp"},
308     { 0x0019, "LoadAlternatePath"},
309     { 0x001A, "AlternatePathResponse"},
310     { 0, NULL}
311 };
312
313
314 /* RMPP Types */
315 #define RMPP_ILLEGAL 0
316 #define RMPP_DATA   1
317 #define RMPP_ACK    2
318 #define RMPP_STOP   3
319 #define RMPP_ABORT  4
320
321 static const value_string RMPP_Packet_Types[] = {
322     { RMPP_ILLEGAL, " Illegal RMPP Type (0)! " },
323     { RMPP_DATA, "RMPP (DATA)" },
324     { RMPP_ACK, "RMPP (ACK)" },
325     { RMPP_STOP, "RMPP (STOP)" },
326     { RMPP_ABORT, "RMPP (ABORT)" },
327     { 0, NULL}
328 };
329
330 static const value_string RMPP_Flags[] = {
331     { 3, " (Transmission Sequence - First Packet)"},
332     { 5, " (Transmission Sequence - Last Packet)"},
333     { 1, " (Transmission Sequence) " },
334     { 0, NULL}
335 };
336
337 static const value_string RMPP_Status[]= {
338     { 0, " (Normal)"},
339     { 1, " (Resources Exhausted)"},
340     { 118, " (Total Time Too Long)"},
341     { 119, " (Inconsistent Last and PayloadLength)"},
342     { 120, " (Inconsistent First and Segment Number)"},
343     { 121, " (Bad RMPPType)"},
344     { 122, " (NewWindowLast Too Small)"},
345     { 123, " (SegmentNumber Too Big)"},
346     { 124, " (Illegal Status)"},
347     { 125, " (Unsupported Version)"},
348     { 126, " (Too Many Retries)"},
349     { 127, " (Unspecified - Unknown Error Code on ABORT)"},
350     { 0, NULL}
351 };
352
353 static const value_string DiagCode[]= {
354     {0x0000, "Function Ready"},
355     {0x0001, "Performing Self Test"},
356     {0x0002, "Initializing"},
357     {0x0003, "Soft Error - Function has non-fatal error"},
358     {0x0004, "Hard Error - Function has fatal error"},
359     { 0, NULL}
360 };
361 static const value_string LinkWidthEnabled[]= {
362     {0x0000, "No State Change"},
363     {0x0001, "1x"},
364     {0x0002, "4x"},
365     {0x0003, "1x or 4x"},
366     {0x0004, "8x"},
367     {0x0005, "1x or 8x"},
368     {0x0006, "4x or 8x"},
369     {0x0007, "1x or 4x or 8x"},
370     {0x0008, "12x"},
371     {0x0009, "1x or 12x"},
372     {0x000A, "4x or 12x"},
373     {0x000B, "1x or 4x or 12x"},
374     {0x000C, "8x or 12x"},
375     {0x000D, "1x or 8x or 12x"},
376     {0x000E, "4x or 8x or 12x"},
377     {0x000E, "1x or 4x or 8x or 12x"},
378     {0x00FF, "Set to LinkWidthSupported Value - Response contains actual LinkWidthSupported"},
379     { 0, NULL}
380 };
381
382 static const value_string LinkWidthSupported[]= {
383     {0x0001, "1x"},
384     {0x0003, "1x or 4x"},
385     {0x0007, "1x or 4x or 8x"},
386     {0x000B, "1x or 4x or 12x"},
387     {0x000F, "1x or 4x or 8x or 12x"},
388     { 0, NULL}
389 };
390 static const value_string LinkWidthActive[]= {
391     {0x0001, "1x"},
392     {0x0002, "4x"},
393     {0x0004, "8x"},
394     {0x0008, "12x"},
395     { 0, NULL}
396 };
397 static const value_string LinkSpeedSupported[]= {
398     {0x0001, "2.5 Gbps"},
399     {0x0003, "2.5 or 5.0 Gbps"},
400     {0x0005, "2.5 or 10.0 Gbps"},
401     {0x0007, "2.5 or 5.0 or 10.0 Gbps"},
402     { 0, NULL}
403 };
404 static const value_string PortState[]= {
405     {0x0000, "No State Change"},
406     {0x0001, "Down (includes failed links)"},
407     {0x0002, "Initialized"},
408     {0x0003, "Armed"},
409     {0x0004, "Active"},
410     { 0, NULL}
411 };
412 static const value_string PortPhysicalState[]= {
413     {0x0000, "No State Change"},
414     {0x0001, "Sleep"},
415     {0x0002, "Polling"},
416     {0x0003, "Disabled"},
417     {0x0004, "PortConfigurationTraining"},
418     {0x0005, "LinkUp"},
419     {0x0006, "LinkErrorRecovery"},
420     {0x0007, "Phy Test"},
421     { 0, NULL}
422 };
423 static const value_string LinkDownDefaultState[]= {
424     {0x0000, "No State Change"},
425     {0x0001, "Sleep"},
426     {0x0002, "Polling"},
427     { 0, NULL}
428 };
429 static const value_string LinkSpeedActive[]= {
430     {0x0001, "2.5 Gbps"},
431     {0x0002, "5.0 Gbps"},
432     {0x0004, "10.0 Gbps"},
433     { 0, NULL}
434 };
435 static const value_string LinkSpeedEnabled[]= {
436     {0x0000, "No State Change"},
437     {0x0001, "2.5 Gbps"},
438     {0x0003, "2.5 or 5.0 Gbps"},
439     {0x0005, "2.5 or 10.0 Gbps"},
440     {0x0007, "2.5 or 5.0 or 10.0 Gbps"},
441     {0x000F, "Set to LinkSpeedSupported value - response contains actual LinkSpeedSupported"},
442     { 0, NULL}
443 };
444 static const value_string NeighborMTU[]= {
445     {0x0001, "256"},
446     {0x0002, "512"},
447     {0x0003, "1024"},
448     {0x0004, "2048"},
449     {0x0005, "4096"},
450     { 0, NULL}
451 };
452 static const value_string VLCap[]= {
453     {0x0001, "VL0"},
454     {0x0002, "VL0, VL1"},
455     {0x0003, "VL0 - VL3"},
456     {0x0004, "VL0 - VL7"},
457     {0x0005, "VL0 - VL14"},
458     { 0, NULL}
459 };
460 static const value_string MTUCap[]= {
461     {0x0001, "256"},
462     {0x0002, "512"},
463     {0x0003, "1024"},
464     {0x0004, "2048"},
465     {0x0005, "4096"},
466     { 0, NULL}
467 };
468 static const value_string OperationalVLs[]= {
469     {0x0000, "No State Change"},
470     {0x0001, "VL0"},
471     {0x0002, "VL0, VL1"},
472     {0x0003, "VL0 - VL3"},
473     {0x0004, "VL0 - VL7"},
474     {0x0005, "VL0 - VL14"},
475     { 0, NULL}
476 };
477
478 /* Local Route Header (LRH) */
479 static int hf_infiniband_LRH = -1;
480 static int hf_infiniband_virtual_lane = -1;
481 static int hf_infiniband_link_version = -1;
482 static int hf_infiniband_service_level = -1;
483 static int hf_infiniband_reserved2 = -1;
484 static int hf_infiniband_link_next_header = -1;
485 static int hf_infiniband_destination_local_id = -1;
486 static int hf_infiniband_reserved5 = -1;
487 static int hf_infiniband_packet_length = -1;
488 static int hf_infiniband_source_local_id = -1;
489 /* Global Route Header (GRH) */
490 static int hf_infiniband_GRH = -1;
491 static int hf_infiniband_ip_version = -1;
492 static int hf_infiniband_traffic_class = -1;
493 static int hf_infiniband_flow_label = -1;
494 static int hf_infiniband_payload_length = -1;
495 static int hf_infiniband_next_header = -1;
496 static int hf_infiniband_hop_limit = -1;
497 static int hf_infiniband_source_gid = -1;
498 static int hf_infiniband_destination_gid = -1;
499 /* Base Transport Header (BTH) */
500 static int hf_infiniband_BTH = -1;
501 static int hf_infiniband_opcode = -1;
502 static int hf_infiniband_solicited_event = -1;
503 static int hf_infiniband_migreq = -1;
504 static int hf_infiniband_pad_count = -1;
505 static int hf_infiniband_transport_header_version = -1;
506 static int hf_infiniband_partition_key = -1;
507 static int hf_infiniband_reserved8 = -1;
508 static int hf_infiniband_destination_qp = -1;
509 static int hf_infiniband_acknowledge_request = -1;
510 static int hf_infiniband_reserved7 = -1;
511 static int hf_infiniband_packet_sequence_number = -1;
512 /* Raw Header (RWH) */
513 static int hf_infiniband_RWH = -1;
514 static int hf_infiniband_reserved16_RWH = -1;
515 static int hf_infiniband_etype = -1;
516 /* Reliable Datagram Extended Transport Header (RDETH) */
517 static int hf_infiniband_RDETH = -1;
518 static int hf_infiniband_reserved8_RDETH = -1;
519 static int hf_infiniband_ee_context = -1;
520 /* Datagram Extended Transport Header (DETH) */
521 static int hf_infiniband_DETH = -1;
522 static int hf_infiniband_queue_key = -1;
523 static int hf_infiniband_reserved8_DETH = -1;
524 static int hf_infiniband_source_qp = -1;
525 /* RDMA Extended Transport Header (RETH) */
526 static int hf_infiniband_RETH = -1;
527 static int hf_infiniband_virtual_address = -1;
528 static int hf_infiniband_remote_key = -1;
529 static int hf_infiniband_dma_length = -1;
530 /* Atomic Extended Transport Header (AtomicETH) */
531 static int hf_infiniband_AtomicETH = -1;
532 /* static int hf_infiniband_virtual_address_AtomicETH = -1;                  */
533 /* static int hf_infiniband_remote_key_AtomicETH = -1;                       */
534 static int hf_infiniband_swap_or_add_data = -1;
535 static int hf_infiniband_compare_data = -1;
536 /* ACK Extended Transport Header (AETH) */
537 static int hf_infiniband_AETH = -1;
538 static int hf_infiniband_syndrome = -1;
539 static int hf_infiniband_message_sequence_number = -1;
540 /* Atomic ACK Extended Transport Header (AtomicAckETH) */
541 static int hf_infiniband_AtomicAckETH = -1;
542 static int hf_infiniband_original_remote_data = -1;
543 /* Immediate Extended Transport Header (ImmDt) */
544 static int hf_infiniband_IMMDT = -1;
545 /* Invalidate Extended Transport Header (IETH) */
546 static int hf_infiniband_IETH = -1;
547 /* Payload */
548 static int hf_infiniband_payload = -1;
549 static int hf_infiniband_invariant_crc = -1;
550 static int hf_infiniband_variant_crc = -1;
551 /* Unknown or Vendor Specific */
552 static int hf_infiniband_raw_data = -1;
553 static int hf_infiniband_vendor = -1;
554 /* CM REQ Header */
555 static int hf_cm_req_local_comm_id = -1;
556 static int hf_cm_req_service_id = -1;
557 static int hf_cm_req_local_ca_guid = -1;
558 static int hf_cm_req_local_qkey = -1;
559 static int hf_cm_req_local_qpn = -1;
560 static int hf_cm_req_respo_res = -1;
561 static int hf_cm_req_local_eecn = -1;
562 static int hf_cm_req_init_depth = -1;
563 static int hf_cm_req_remote_eecn = -1;
564 static int hf_cm_req_remote_cm_resp_to = -1;
565 static int hf_cm_req_transp_serv_type = -1;
566 static int hf_cm_req_e2e_flow_ctrl = -1;
567 static int hf_cm_req_start_psn = -1;
568 static int hf_cm_req_local_cm_resp_to = -1;
569 static int hf_cm_req_retry_count = -1;
570 static int hf_cm_req_pkey = -1;
571 static int hf_cm_req_path_pp_mtu = -1;
572 static int hf_cm_req_rdc_exists = -1;
573 static int hf_cm_req_rnr_retry_count = -1;
574 static int hf_cm_req_max_cm_retries = -1;
575 static int hf_cm_req_srq = -1;
576 static int hf_cm_req_primary_local_lid = -1;
577 static int hf_cm_req_primary_remote_lid = -1;
578 static int hf_cm_req_primary_local_gid = -1;
579 static int hf_cm_req_primary_remote_gid = -1;
580 static int hf_cm_req_primary_flow_label = -1;
581 static int hf_cm_req_primary_packet_rate = -1;
582 static int hf_cm_req_primary_traffic_class = -1;
583 static int hf_cm_req_primary_hop_limit = -1;
584 static int hf_cm_req_primary_sl = -1;
585 static int hf_cm_req_primary_subnet_local = -1;
586 static int hf_cm_req_primary_local_ack_to = -1;
587 static int hf_cm_req_alt_local_lid = -1;
588 static int hf_cm_req_alt_remote_lid = -1;
589 static int hf_cm_req_alt_local_gid = -1;
590 static int hf_cm_req_alt_remote_gid = -1;
591 static int hf_cm_req_flow_label = -1;
592 static int hf_cm_req_packet_rate = -1;
593 static int hf_cm_req_alt_traffic_class = -1;
594 static int hf_cm_req_alt_hop_limit = -1;
595 static int hf_cm_req_SL = -1;
596 static int hf_cm_req_subnet_local = -1;
597 static int hf_cm_req_local_ACK_timeout = -1;
598 static int hf_cm_req_private_data = -1;
599 /* CM REP Header */
600 static int hf_cm_rep_localcommid = -1;
601 static int hf_cm_rep_remotecommid = -1;
602 static int hf_cm_rep_localqkey = -1;
603 static int hf_cm_rep_localqpn = -1;
604 static int hf_cm_rep_localeecontnum = -1;
605 static int hf_cm_rep_startingpsn = -1;
606 static int hf_cm_rep_responderres = -1;
607 static int hf_cm_rep_initiatordepth = -1;
608 static int hf_cm_rep_tgtackdelay = -1;
609 static int hf_cm_rep_failoveracc = -1;
610 static int hf_cm_rep_e2eflowctl = -1;
611 static int hf_cm_rep_rnrretrycount = -1;
612 static int hf_cm_rep_srq = -1;
613 static int hf_cm_rep_localcaguid = -1;
614 static int hf_cm_rep_privatedata = -1;
615 /* CM RTU Header */
616 static int hf_cm_rtu_localcommid = -1;
617 static int hf_cm_rtu_remotecommid = -1;
618 static int hf_cm_rtu_privatedata = -1;
619 /* CM REJ Header */
620 static int hf_cm_rej_local_commid = -1;
621 static int hf_cm_rej_remote_commid = -1;
622 static int hf_cm_rej_msg_rej = -1;
623 static int hf_cm_rej_rej_info_len = -1;
624 static int hf_cm_rej_reason = -1;
625 static int hf_cm_rej_add_rej_info = -1;
626 static int hf_cm_rej_private_data = -1;
627 /* MAD Base Header */
628 static int hf_infiniband_MAD = -1;
629 static int hf_infiniband_base_version = -1;
630 static int hf_infiniband_mgmt_class = -1;
631 static int hf_infiniband_class_version = -1;
632 /* static int hf_infiniband_reserved1 = -1;                                  */
633 static int hf_infiniband_method = -1;
634 static int hf_infiniband_status = -1;
635 static int hf_infiniband_class_specific = -1;
636 static int hf_infiniband_transaction_id = -1;
637 static int hf_infiniband_attribute_id = -1;
638 static int hf_infiniband_reserved16 = -1;
639 static int hf_infiniband_attribute_modifier = -1;
640 static int hf_infiniband_data = -1;
641 /* RMPP Header */
642 static int hf_infiniband_RMPP = -1;
643 static int hf_infiniband_rmpp_version = -1;
644 static int hf_infiniband_rmpp_type = -1;
645 static int hf_infiniband_r_resp_time = -1;
646 static int hf_infiniband_rmpp_flags = -1;
647 static int hf_infiniband_rmpp_status = -1;
648 static int hf_infiniband_rmpp_data1 = -1;
649 static int hf_infiniband_rmpp_data2 = -1;
650 /* RMPP Data */
651 /* static int hf_infiniband_RMPP_DATA = -1;                                  */
652 static int hf_infiniband_segment_number = -1;
653 static int hf_infiniband_payload_length32 = -1;
654 static int hf_infiniband_transferred_data = -1;
655 /* RMPP ACK */
656 static int hf_infiniband_new_window_last = -1;
657 static int hf_infiniband_reserved220 = -1;
658 /* RMPP ABORT and STOP */
659 static int hf_infiniband_reserved32 = -1;
660 static int hf_infiniband_optional_extended_error_data = -1;
661 /* SMP Data LID Routed */
662 static int hf_infiniband_SMP_LID = -1;
663 static int hf_infiniband_m_key = -1;
664 static int hf_infiniband_smp_data = -1;
665 static int hf_infiniband_reserved1024 = -1;
666 static int hf_infiniband_reserved256 = -1;
667 /* SMP Data Directed Route */
668 static int hf_infiniband_SMP_DIRECTED = -1;
669 static int hf_infiniband_smp_status = -1;
670 static int hf_infiniband_hop_pointer = -1;
671 static int hf_infiniband_hop_count = -1;
672 static int hf_infiniband_dr_slid = -1;
673 static int hf_infiniband_dr_dlid = -1;
674 static int hf_infiniband_reserved28 = -1;
675 static int hf_infiniband_d = -1;
676 static int hf_infiniband_initial_path = -1;
677 static int hf_infiniband_return_path = -1;
678 /* SA MAD Header */
679 static int hf_infiniband_SA = -1;
680 static int hf_infiniband_sm_key = -1;
681 static int hf_infiniband_attribute_offset = -1;
682 static int hf_infiniband_component_mask = -1;
683 static int hf_infiniband_subnet_admin_data = -1;
684 /* Mellanox EoIB encapsulation header */
685 static int hf_infiniband_EOIB = -1;
686 static int hf_infiniband_ver = -1;
687 static int hf_infiniband_tcp_chk = -1;
688 static int hf_infiniband_ip_chk = -1;
689 static int hf_infiniband_fcs = -1;
690 static int hf_infiniband_ms = -1;
691 static int hf_infiniband_seg_off = -1;
692 static int hf_infiniband_seg_id = -1;
693
694 /* Attributes
695 * Additional Structures for individuala attribute decoding.
696 * Since they are not headers the naming convention is slightly modified
697 * Convention: hf_infiniband_[attribute name]_[field]
698 * This was not entirely necessary but I felt the previous convention
699 * did not provide adequate readability for the granularity of attribute/attribute fields. */
700
701 /* NodeDescription */
702 static int hf_infiniband_NodeDescription_NodeString = -1;
703 /* NodeInfo */
704 static int hf_infiniband_NodeInfo_BaseVersion = -1;
705 static int hf_infiniband_NodeInfo_ClassVersion = -1;
706 static int hf_infiniband_NodeInfo_NodeType = -1;
707 static int hf_infiniband_NodeInfo_NumPorts = -1;
708 static int hf_infiniband_NodeInfo_SystemImageGUID = -1;
709 static int hf_infiniband_NodeInfo_NodeGUID = -1;
710 static int hf_infiniband_NodeInfo_PortGUID = -1;
711 static int hf_infiniband_NodeInfo_PartitionCap = -1;
712 static int hf_infiniband_NodeInfo_DeviceID = -1;
713 static int hf_infiniband_NodeInfo_Revision = -1;
714 static int hf_infiniband_NodeInfo_LocalPortNum = -1;
715 static int hf_infiniband_NodeInfo_VendorID = -1;
716 /* SwitchInfo */
717 static int hf_infiniband_SwitchInfo_LinearFDBCap = -1;
718 static int hf_infiniband_SwitchInfo_RandomFDBCap = -1;
719 static int hf_infiniband_SwitchInfo_MulticastFDBCap = -1;
720 static int hf_infiniband_SwitchInfo_LinearFDBTop = -1;
721 static int hf_infiniband_SwitchInfo_DefaultPort = -1;
722 static int hf_infiniband_SwitchInfo_DefaultMulticastPrimaryPort = -1;
723 static int hf_infiniband_SwitchInfo_DefaultMulticastNotPrimaryPort = -1;
724 static int hf_infiniband_SwitchInfo_LifeTimeValue = -1;
725 static int hf_infiniband_SwitchInfo_PortStateChange = -1;
726 static int hf_infiniband_SwitchInfo_OptimizedSLtoVLMappingProgramming = -1;
727 static int hf_infiniband_SwitchInfo_LIDsPerPort = -1;
728 static int hf_infiniband_SwitchInfo_PartitionEnforcementCap = -1;
729 static int hf_infiniband_SwitchInfo_InboundEnforcementCap = -1;
730 static int hf_infiniband_SwitchInfo_OutboundEnforcementCap = -1;
731 static int hf_infiniband_SwitchInfo_FilterRawInboundCap = -1;
732 static int hf_infiniband_SwitchInfo_FilterRawOutboundCap = -1;
733 static int hf_infiniband_SwitchInfo_EnhancedPortZero = -1;
734 /* GUIDInfo */
735 /* static int hf_infiniband_GUIDInfo_GUIDBlock = -1;                         */
736 static int hf_infiniband_GUIDInfo_GUID = -1;
737 /* PortInfo */
738 static int hf_infiniband_PortInfo_GidPrefix = -1;
739 static int hf_infiniband_PortInfo_LID = -1;
740 static int hf_infiniband_PortInfo_MasterSMLID = -1;
741 static int hf_infiniband_PortInfo_CapabilityMask = -1;
742
743 /* Capability Mask Flags */
744 static int hf_infiniband_PortInfo_CapabilityMask_SM = -1;
745 static int hf_infiniband_PortInfo_CapabilityMask_NoticeSupported = -1;
746 static int hf_infiniband_PortInfo_CapabilityMask_TrapSupported = -1;
747 static int hf_infiniband_PortInfo_CapabilityMask_OptionalPDSupported = -1;
748 static int hf_infiniband_PortInfo_CapabilityMask_AutomaticMigrationSupported = -1;
749 static int hf_infiniband_PortInfo_CapabilityMask_SLMappingSupported = -1;
750 static int hf_infiniband_PortInfo_CapabilityMask_MKeyNVRAM = -1;
751 static int hf_infiniband_PortInfo_CapabilityMask_PKeyNVRAM = -1;
752 static int hf_infiniband_PortInfo_CapabilityMask_LEDInfoSupported = -1;
753 static int hf_infiniband_PortInfo_CapabilityMask_SMdisabled = -1;
754 static int hf_infiniband_PortInfo_CapabilityMask_SystemImageGUIDSupported = -1;
755 static int hf_infiniband_PortInfo_CapabilityMask_PKeySwitchExternalPortTrapSupported = -1;
756 static int hf_infiniband_PortInfo_CapabilityMask_CommunicationsManagementSupported = -1;
757 static int hf_infiniband_PortInfo_CapabilityMask_SNMPTunnelingSupported = -1;
758 static int hf_infiniband_PortInfo_CapabilityMask_ReinitSupported = -1;
759 static int hf_infiniband_PortInfo_CapabilityMask_DeviceManagementSupported = -1;
760 static int hf_infiniband_PortInfo_CapabilityMask_VendorClassSupported = -1;
761 static int hf_infiniband_PortInfo_CapabilityMask_DRNoticeSupported = -1;
762 static int hf_infiniband_PortInfo_CapabilityMask_CapabilityMaskNoticeSupported = -1;
763 static int hf_infiniband_PortInfo_CapabilityMask_BootManagementSupported = -1;
764 static int hf_infiniband_PortInfo_CapabilityMask_LinkRoundTripLatencySupported = -1;
765 static int hf_infiniband_PortInfo_CapabilityMask_ClientRegistrationSupported = -1;
766 static int hf_infiniband_PortInfo_CapabilityMask_OtherLocalChangesNoticeSupported = -1;
767 static int hf_infiniband_PortInfo_CapabilityMask_LinkSpeedWIdthPairsTableSupported = -1;
768 /* End Capability Mask Flags */
769
770
771 static int hf_infiniband_PortInfo_DiagCode = -1;
772 static int hf_infiniband_PortInfo_M_KeyLeasePeriod = -1;
773 static int hf_infiniband_PortInfo_LocalPortNum = -1;
774 static int hf_infiniband_PortInfo_LinkWidthEnabled = -1;
775 static int hf_infiniband_PortInfo_LinkWidthSupported = -1;
776 static int hf_infiniband_PortInfo_LinkWidthActive = -1;
777 static int hf_infiniband_PortInfo_LinkSpeedSupported = -1;
778 static int hf_infiniband_PortInfo_PortState = -1;
779 static int hf_infiniband_PortInfo_PortPhysicalState = -1;
780 static int hf_infiniband_PortInfo_LinkDownDefaultState = -1;
781 static int hf_infiniband_PortInfo_M_KeyProtectBits = -1;
782 static int hf_infiniband_PortInfo_LMC = -1;
783 static int hf_infiniband_PortInfo_LinkSpeedActive = -1;
784 static int hf_infiniband_PortInfo_LinkSpeedEnabled = -1;
785 static int hf_infiniband_PortInfo_NeighborMTU = -1;
786 static int hf_infiniband_PortInfo_MasterSMSL = -1;
787 static int hf_infiniband_PortInfo_VLCap = -1;
788 static int hf_infiniband_PortInfo_M_Key = -1;
789 static int hf_infiniband_PortInfo_InitType = -1;
790 static int hf_infiniband_PortInfo_VLHighLimit = -1;
791 static int hf_infiniband_PortInfo_VLArbitrationHighCap = -1;
792 static int hf_infiniband_PortInfo_VLArbitrationLowCap = -1;
793 static int hf_infiniband_PortInfo_InitTypeReply = -1;
794 static int hf_infiniband_PortInfo_MTUCap = -1;
795 static int hf_infiniband_PortInfo_VLStallCount = -1;
796 static int hf_infiniband_PortInfo_HOQLife = -1;
797 static int hf_infiniband_PortInfo_OperationalVLs = -1;
798 static int hf_infiniband_PortInfo_PartitionEnforcementInbound = -1;
799 static int hf_infiniband_PortInfo_PartitionEnforcementOutbound = -1;
800 static int hf_infiniband_PortInfo_FilterRawInbound = -1;
801 static int hf_infiniband_PortInfo_FilterRawOutbound = -1;
802 static int hf_infiniband_PortInfo_M_KeyViolations = -1;
803 static int hf_infiniband_PortInfo_P_KeyViolations = -1;
804 static int hf_infiniband_PortInfo_Q_KeyViolations = -1;
805 static int hf_infiniband_PortInfo_GUIDCap = -1;
806 static int hf_infiniband_PortInfo_ClientReregister = -1;
807 static int hf_infiniband_PortInfo_SubnetTimeOut = -1;
808 static int hf_infiniband_PortInfo_RespTimeValue = -1;
809 static int hf_infiniband_PortInfo_LocalPhyErrors = -1;
810 static int hf_infiniband_PortInfo_OverrunErrors = -1;
811 static int hf_infiniband_PortInfo_MaxCreditHint = -1;
812 static int hf_infiniband_PortInfo_LinkRoundTripLatency = -1;
813
814 /* P_KeyTable */
815 static int hf_infiniband_P_KeyTable_P_KeyTableBlock = -1;
816 static int hf_infiniband_P_KeyTable_MembershipType = -1;
817 static int hf_infiniband_P_KeyTable_P_KeyBase = -1;
818
819 /* SLtoVLMappingTable */
820 static int hf_infiniband_SLtoVLMappingTable_SLtoVL_HighBits = -1;
821 static int hf_infiniband_SLtoVLMappingTable_SLtoVL_LowBits = -1;
822
823 /* VLArbitrationTable */
824 /* static int hf_infiniband_VLArbitrationTable_VLWeightPairs = -1;           */
825 static int hf_infiniband_VLArbitrationTable_VL = -1;
826 static int hf_infiniband_VLArbitrationTable_Weight = -1;
827
828 /* LinearForwardingTable */
829 /* static int hf_infiniband_LinearForwardingTable_LinearForwardingTableBlock = -1;  */
830 static int hf_infiniband_LinearForwardingTable_Port = -1;
831
832 /* RandomForwardingTable */
833 /* static int hf_infiniband_RandomForwardingTable_RandomForwardingTableBlock = -1;  */
834 static int hf_infiniband_RandomForwardingTable_LID = -1;
835 static int hf_infiniband_RandomForwardingTable_Valid = -1;
836 static int hf_infiniband_RandomForwardingTable_LMC = -1;
837 static int hf_infiniband_RandomForwardingTable_Port = -1;
838
839 /* MulticastForwardingTable */
840 /* static int hf_infiniband_MulticastForwardingTable_MulticastForwardingTableBlock = -1;    */
841 static int hf_infiniband_MulticastForwardingTable_PortMask = -1;
842
843 /* SMInfo */
844 static int hf_infiniband_SMInfo_GUID = -1;
845 static int hf_infiniband_SMInfo_SM_Key = -1;
846 static int hf_infiniband_SMInfo_ActCount = -1;
847 static int hf_infiniband_SMInfo_Priority = -1;
848 static int hf_infiniband_SMInfo_SMState = -1;
849
850 /* VendorDiag */
851 static int hf_infiniband_VendorDiag_NextIndex = -1;
852 static int hf_infiniband_VendorDiag_DiagData = -1;
853
854 /* LedInfo */
855 static int hf_infiniband_LedInfo_LedMask = -1;
856
857 /* LinkSpeedWidthPairsTable */
858 static int hf_infiniband_LinkSpeedWidthPairsTable_NumTables = -1;
859 static int hf_infiniband_LinkSpeedWidthPairsTable_PortMask = -1;
860 static int hf_infiniband_LinkSpeedWidthPairsTable_SpeedTwoFive = -1;
861 static int hf_infiniband_LinkSpeedWidthPairsTable_SpeedFive = -1;
862 static int hf_infiniband_LinkSpeedWidthPairsTable_SpeedTen = -1;
863
864 /* Attributes for Subnet Administration.
865 * Mostly we have "Records" here which are just structures of SM attributes.
866 * There are some unique attributes though that we will want to have a structure for. */
867
868 /* NodeRecord */
869 /* PortInfoRecord */
870 /* SLtoVLMappingTableRecord */
871 /* SwitchInfoRecord */
872 /* LinearForwardingTableRecord */
873 /* RandomForwardingTableRecord */
874 /* MulticastForwardingTableRecord */
875 /* VLArbitrationTableRecord */
876
877 static int hf_infiniband_SA_LID = -1;
878 static int hf_infiniband_SA_EndportLID = -1;
879 static int hf_infiniband_SA_PortNum = -1;
880 static int hf_infiniband_SA_InputPortNum = -1;
881 static int hf_infiniband_SA_OutputPortNum = -1;
882 static int hf_infiniband_SA_BlockNum_EightBit = -1;
883 static int hf_infiniband_SA_BlockNum_NineBit = -1;
884 static int hf_infiniband_SA_BlockNum_SixteenBit = -1;
885 static int hf_infiniband_SA_Position = -1;
886 /* static int hf_infiniband_SA_Index = -1;                                   */
887
888 /* InformInfoRecord */
889 static int hf_infiniband_InformInfoRecord_SubscriberGID = -1;
890 static int hf_infiniband_InformInfoRecord_Enum = -1;
891
892 /* InformInfo */
893 static int hf_infiniband_InformInfo_GID = -1;
894 static int hf_infiniband_InformInfo_LIDRangeBegin = -1;
895 static int hf_infiniband_InformInfo_LIDRangeEnd = -1;
896 static int hf_infiniband_InformInfo_IsGeneric = -1;
897 static int hf_infiniband_InformInfo_Subscribe = -1;
898 static int hf_infiniband_InformInfo_Type = -1;
899 static int hf_infiniband_InformInfo_TrapNumberDeviceID = -1;
900 static int hf_infiniband_InformInfo_QPN = -1;
901 static int hf_infiniband_InformInfo_RespTimeValue = -1;
902 static int hf_infiniband_InformInfo_ProducerTypeVendorID = -1;
903
904 /* LinkRecord */
905 static int hf_infiniband_LinkRecord_FromLID = -1;
906 static int hf_infiniband_LinkRecord_FromPort = -1;
907 static int hf_infiniband_LinkRecord_ToPort = -1;
908 static int hf_infiniband_LinkRecord_ToLID = -1;
909
910 /* ServiceRecord */
911 static int hf_infiniband_ServiceRecord_ServiceID = -1;
912 static int hf_infiniband_ServiceRecord_ServiceGID = -1;
913 static int hf_infiniband_ServiceRecord_ServiceP_Key = -1;
914 static int hf_infiniband_ServiceRecord_ServiceLease = -1;
915 static int hf_infiniband_ServiceRecord_ServiceKey = -1;
916 static int hf_infiniband_ServiceRecord_ServiceName = -1;
917 static int hf_infiniband_ServiceRecord_ServiceData = -1;
918
919 /* ServiceAssociationRecord */
920 static int hf_infiniband_ServiceAssociationRecord_ServiceKey = -1;
921 static int hf_infiniband_ServiceAssociationRecord_ServiceName = -1;
922
923 /* PathRecord */
924 static int hf_infiniband_PathRecord_DGID = -1;
925 static int hf_infiniband_PathRecord_SGID = -1;
926 static int hf_infiniband_PathRecord_DLID = -1;
927 static int hf_infiniband_PathRecord_SLID = -1;
928 static int hf_infiniband_PathRecord_RawTraffic = -1;
929 static int hf_infiniband_PathRecord_FlowLabel = -1;
930 static int hf_infiniband_PathRecord_HopLimit = -1;
931 static int hf_infiniband_PathRecord_TClass = -1;
932 static int hf_infiniband_PathRecord_Reversible = -1;
933 static int hf_infiniband_PathRecord_NumbPath = -1;
934 static int hf_infiniband_PathRecord_P_Key = -1;
935 static int hf_infiniband_PathRecord_SL = -1;
936 static int hf_infiniband_PathRecord_MTUSelector = -1;
937 static int hf_infiniband_PathRecord_MTU = -1;
938 static int hf_infiniband_PathRecord_RateSelector = -1;
939 static int hf_infiniband_PathRecord_Rate = -1;
940 static int hf_infiniband_PathRecord_PacketLifeTimeSelector = -1;
941 static int hf_infiniband_PathRecord_PacketLifeTime = -1;
942 static int hf_infiniband_PathRecord_Preference = -1;
943
944 /* MCMemberRecord */
945 static int hf_infiniband_MCMemberRecord_MGID = -1;
946 static int hf_infiniband_MCMemberRecord_PortGID = -1;
947 static int hf_infiniband_MCMemberRecord_Q_Key = -1;
948 static int hf_infiniband_MCMemberRecord_MLID = -1;
949 static int hf_infiniband_MCMemberRecord_MTUSelector = -1;
950 static int hf_infiniband_MCMemberRecord_MTU = -1;
951 static int hf_infiniband_MCMemberRecord_TClass = -1;
952 static int hf_infiniband_MCMemberRecord_P_Key = -1;
953 static int hf_infiniband_MCMemberRecord_RateSelector = -1;
954 static int hf_infiniband_MCMemberRecord_Rate = -1;
955 static int hf_infiniband_MCMemberRecord_PacketLifeTimeSelector = -1;
956 static int hf_infiniband_MCMemberRecord_PacketLifeTime = -1;
957 static int hf_infiniband_MCMemberRecord_SL = -1;
958 static int hf_infiniband_MCMemberRecord_FlowLabel = -1;
959 static int hf_infiniband_MCMemberRecord_HopLimit = -1;
960 static int hf_infiniband_MCMemberRecord_Scope = -1;
961 static int hf_infiniband_MCMemberRecord_JoinState = -1;
962 static int hf_infiniband_MCMemberRecord_ProxyJoin = -1;
963
964 /* TraceRecord */
965 static int hf_infiniband_TraceRecord_GIDPrefix = -1;
966 static int hf_infiniband_TraceRecord_IDGeneration = -1;
967 static int hf_infiniband_TraceRecord_NodeType = -1;
968 static int hf_infiniband_TraceRecord_NodeID = -1;
969 static int hf_infiniband_TraceRecord_ChassisID = -1;
970 static int hf_infiniband_TraceRecord_EntryPortID = -1;
971 static int hf_infiniband_TraceRecord_ExitPortID = -1;
972 static int hf_infiniband_TraceRecord_EntryPort = -1;
973 static int hf_infiniband_TraceRecord_ExitPort = -1;
974
975 /* MultiPathRecord */
976 static int hf_infiniband_MultiPathRecord_RawTraffic = -1;
977 static int hf_infiniband_MultiPathRecord_FlowLabel = -1;
978 static int hf_infiniband_MultiPathRecord_HopLimit = -1;
979 static int hf_infiniband_MultiPathRecord_TClass = -1;
980 static int hf_infiniband_MultiPathRecord_Reversible = -1;
981 static int hf_infiniband_MultiPathRecord_NumbPath = -1;
982 static int hf_infiniband_MultiPathRecord_P_Key = -1;
983 static int hf_infiniband_MultiPathRecord_SL = -1;
984 static int hf_infiniband_MultiPathRecord_MTUSelector = -1;
985 static int hf_infiniband_MultiPathRecord_MTU = -1;
986 static int hf_infiniband_MultiPathRecord_RateSelector = -1;
987 static int hf_infiniband_MultiPathRecord_Rate = -1;
988 static int hf_infiniband_MultiPathRecord_PacketLifeTimeSelector = -1;
989 static int hf_infiniband_MultiPathRecord_PacketLifeTime = -1;
990 static int hf_infiniband_MultiPathRecord_IndependenceSelector = -1;
991 static int hf_infiniband_MultiPathRecord_GIDScope = -1;
992 static int hf_infiniband_MultiPathRecord_SGIDCount = -1;
993 static int hf_infiniband_MultiPathRecord_DGIDCount = -1;
994 static int hf_infiniband_MultiPathRecord_SDGID = -1;
995
996 /* Notice */
997 static int hf_infiniband_Notice_IsGeneric = -1;
998 static int hf_infiniband_Notice_Type = -1;
999 static int hf_infiniband_Notice_ProducerTypeVendorID = -1;
1000 static int hf_infiniband_Notice_TrapNumberDeviceID = -1;
1001 static int hf_infiniband_Notice_IssuerLID = -1;
1002 static int hf_infiniband_Notice_NoticeToggle = -1;
1003 static int hf_infiniband_Notice_NoticeCount = -1;
1004 static int hf_infiniband_Notice_DataDetails = -1;
1005 /* static int hf_infiniband_Notice_IssuerGID = -1;             */
1006 /* static int hf_infiniband_Notice_ClassTrapSpecificData = -1; */
1007
1008 /* PortCounters attribute in Performance class */
1009 static int hf_infiniband_PortCounters = -1;
1010 static int hf_infiniband_PortCounters_PortSelect = -1;
1011 static int hf_infiniband_PortCounters_CounterSelect = -1;
1012 static int hf_infiniband_PortCounters_SymbolErrorCounter = -1;
1013 static int hf_infiniband_PortCounters_LinkErrorRecoveryCounter = -1;
1014 static int hf_infiniband_PortCounters_LinkDownedCounter = -1;
1015 static int hf_infiniband_PortCounters_PortRcvErrors = -1;
1016 static int hf_infiniband_PortCounters_PortRcvRemotePhysicalErrors = -1;
1017 static int hf_infiniband_PortCounters_PortRcvSwitchRelayErrors = -1;
1018 static int hf_infiniband_PortCounters_PortXmitDiscards = -1;
1019 static int hf_infiniband_PortCounters_PortXmitConstraintErrors = -1;
1020 static int hf_infiniband_PortCounters_PortRcvConstraintErrors = -1;
1021 static int hf_infiniband_PortCounters_LocalLinkIntegrityErrors = -1;
1022 static int hf_infiniband_PortCounters_ExcessiveBufferOverrunErrors = -1;
1023 static int hf_infiniband_PortCounters_VL15Dropped = -1;
1024 static int hf_infiniband_PortCounters_PortXmitData = -1;
1025 static int hf_infiniband_PortCounters_PortRcvData = -1;
1026 static int hf_infiniband_PortCounters_PortXmitPkts = -1;
1027 static int hf_infiniband_PortCounters_PortRcvPkts = -1;
1028
1029 /* Extended PortCounters attribute in Performance class */
1030 static int hf_infiniband_PortCountersExt = -1;
1031 static int hf_infiniband_PortCountersExt_PortSelect = -1;
1032 static int hf_infiniband_PortCountersExt_CounterSelect = -1;
1033 static int hf_infiniband_PortCountersExt_PortXmitData = -1;
1034 static int hf_infiniband_PortCountersExt_PortRcvData = -1;
1035 static int hf_infiniband_PortCountersExt_PortXmitPkts = -1;
1036 static int hf_infiniband_PortCountersExt_PortRcvPkts = -1;
1037 static int hf_infiniband_PortCountersExt_PortUnicastXmitPkts = -1;
1038 static int hf_infiniband_PortCountersExt_PortUnicastRcvPkts = -1;
1039 static int hf_infiniband_PortCountersExt_PortMulticastXmitPkts = -1;
1040 static int hf_infiniband_PortCountersExt_PortMulticastRcvPkts = -1;
1041
1042 /* Notice DataDetails and ClassTrapSpecific Data for certain traps
1043 * Note that traps reuse many fields, so they are only declared once under the first trap that they appear.
1044 * There is no need to redeclare them for specific Traps (as with other SA Attributes) because they are uniform between Traps. */
1045
1046 /* Parse DataDetails for a given Trap */
1047 static void parse_NoticeDataDetails(proto_tree*, tvbuff_t*, gint *offset, guint16 trapNumber);
1048
1049 /* Traps 64,65,66,67 */
1050 static int hf_infiniband_Trap_GIDADDR = -1;
1051
1052 /* Traps 68,69 */
1053 /* DataDetails */
1054 static int hf_infiniband_Trap_COMP_MASK = -1;
1055 static int hf_infiniband_Trap_WAIT_FOR_REPATH = -1;
1056 /* ClassTrapSpecificData */
1057 /* static int hf_infiniband_Trap_PATH_REC = -1;                              */
1058
1059 /* Trap 128 */
1060 static int hf_infiniband_Trap_LIDADDR = -1;
1061
1062 /* Trap 129, 130, 131 */
1063 static int hf_infiniband_Trap_PORTNO = -1;
1064
1065 /* Trap 144 */
1066 static int hf_infiniband_Trap_OtherLocalChanges = -1;
1067 static int hf_infiniband_Trap_CAPABILITYMASK = -1;
1068 static int hf_infiniband_Trap_LinkSpeecEnabledChange = -1;
1069 static int hf_infiniband_Trap_LinkWidthEnabledChange = -1;
1070 static int hf_infiniband_Trap_NodeDescriptionChange = -1;
1071
1072 /* Trap 145 */
1073 static int hf_infiniband_Trap_SYSTEMIMAGEGUID = -1;
1074
1075 /* Trap 256 */
1076 static int hf_infiniband_Trap_DRSLID = -1;
1077 static int hf_infiniband_Trap_METHOD = -1;
1078 static int hf_infiniband_Trap_ATTRIBUTEID = -1;
1079 static int hf_infiniband_Trap_ATTRIBUTEMODIFIER = -1;
1080 static int hf_infiniband_Trap_MKEY = -1;
1081 static int hf_infiniband_Trap_DRNotice = -1;
1082 static int hf_infiniband_Trap_DRPathTruncated = -1;
1083 static int hf_infiniband_Trap_DRHopCount = -1;
1084 static int hf_infiniband_Trap_DRNoticeReturnPath = -1;
1085
1086 /* Trap 257, 258 */
1087 static int hf_infiniband_Trap_LIDADDR1 = -1;
1088 static int hf_infiniband_Trap_LIDADDR2 = -1;
1089 static int hf_infiniband_Trap_KEY = -1;
1090 static int hf_infiniband_Trap_SL = -1;
1091 static int hf_infiniband_Trap_QP1 = -1;
1092 static int hf_infiniband_Trap_QP2 = -1;
1093 static int hf_infiniband_Trap_GIDADDR1 = -1;
1094 static int hf_infiniband_Trap_GIDADDR2 = -1;
1095
1096 /* Trap 259 */
1097 static int hf_infiniband_Trap_DataValid = -1;
1098 static int hf_infiniband_Trap_PKEY = -1;
1099 static int hf_infiniband_Trap_SWLIDADDR = -1;
1100
1101 /* Infiniband Link */
1102 static int hf_infiniband_link_op = -1;
1103 static int hf_infiniband_link_fctbs = -1;
1104 static int hf_infiniband_link_vl = -1;
1105 static int hf_infiniband_link_fccl = -1;
1106 static int hf_infiniband_link_lpcrc = -1;
1107
1108 /* Trap Type/Descriptions for dissection */
1109 static const value_string Operand_Description[]= {
1110     { 0, " Normal Flow Control"},
1111     { 1, " Flow Control Init"},
1112     { 0, NULL}
1113 };
1114
1115 /* Trap Type/Descriptions for dissection */
1116 static const value_string Trap_Description[]= {
1117     { 64, " (Informational) <GIDADDR> is now in service"},
1118     { 65, " (Informational) <GIDADDR> is out of service"},
1119     { 66, " (Informational) New Multicast Group with multicast address <GIDADDR> is now created"},
1120     { 67, " (Informational) Multicast Group with multicast address <GIDADDR> is now deleted"},
1121     { 68, " (Informational) Paths indicated by <PATH_REC> and <COMP_MASK> are no longer valid"},
1122     { 69, " (Informational) Paths indicated by <PATH_REC> and <COMP_MASK> have been recomputed"},
1123     { 128, " (Urgent) Link State of at least one port of switch at <LIDADDR> has changed"},
1124     { 129, " (Urgent) Local Link Integrity threshold reached at <LIDADDR><PORTNO>"},
1125     { 130, " (Urgent) Excessive Buffer OVerrun threshold reached at <LIDADDR><PORTNO>"},
1126     { 131, " (Urgent) Flow Control Update watchdog timer expired at <LIDADDR><PORTNO>"},
1127     { 144, " (Informational) CapMask, NodeDesc, LinkWidthEnabled or LinkSpeedEnabled at <LIDADDR> has been modified"},
1128     { 145, " (Informational) SystemImageGUID at <LIDADDR> has been modified.  New value is <SYSTEMIMAGEGUID>"},
1129     { 256, " (Security) Bad M_Key, <M_KEY> from <LIDADDR> attempted <METHOD> with <ATTRIBUTEID> and <ATTRIBUTEMODIFIER>"},
1130     { 257, " (Security) Bad P_Key, <KEY> from <LIDADDR1><GIDADDR1><QP1> to <LIDADDR2><GIDADDR2><QP2> on <SL>"},
1131     { 258, " (Security) Bad Q_Key, <KEY> from <LIDADDR1><GIDADDR1><QP1> to <LIDADDR2><GIDADDR2><QP2> on <SL>"},
1132     { 259, " (Security) Bad P_Key, <KEY> from <LIDADDR1><GIDADDR1><QP1> to <LIDADDR2><GIDADDR2><QP2> on <SL> at switch <LIDADDR><PORTNO>"},
1133     { 0, NULL}
1134 };
1135
1136
1137
1138
1139 /* MAD Management Classes
1140 * Classes from the Common MAD Header
1141 *
1142 *      Management Class Name        Class Description
1143 * ------------------------------------------------------------------------------------------------------------ */
1144 #define SUBN_LID_ROUTED 0x01        /* Subnet Management LID Route */
1145 #define SUBN_DIRECTED_ROUTE 0x81    /* Subnet Management Directed Route */
1146 #define SUBNADMN 0x03               /* Subnet Administration */
1147 #define PERF 0x04                   /* Performance Management */
1148 #define BM 0x05                     /* Baseboard Management (Tunneling of IB-ML commands through the IBA subnet) */
1149 #define DEV_MGT 0x06                /* Device Management */
1150 #define COM_MGT 0x07                /* Communications Management */
1151 #define SNMP 0x08                   /* SNMP Tunneling (tunneling of the SNMP protocol through the IBA fabric) */
1152 #define VENDOR_1_START 0x09         /* Start of first Vendor Specific Range */
1153 #define VENDOR_1_END 0x0F           /* End of first Vendor Specific Range */
1154 #define VENDOR_2_START 0x30         /* Start of second Vendor Specific Range */
1155 #define VENDOR_2_END 0x4F           /* End of the second Vendor Specific Range */
1156 #define APPLICATION_START 0x10      /* Start of Application Specific Range */
1157 #define APPLICATION_END 0x2F        /* End of Application Specific Range */
1158
1159 /* Performance class Attributes */
1160 #define ATTR_PORT_COUNTERS      0x0012
1161 #define ATTR_PORT_COUNTERS_EXT  0x001D
1162
1163 /* ComMgt class Attributes*/
1164 #define ATTR_CM_REQ             0x0010
1165 #define ATTR_CM_REP             0x0013
1166 #define ATTR_CM_RTU             0x0014
1167 #define ATTR_CM_REJ             0x0012
1168
1169 /* Link Next Header Values */
1170 #define IBA_GLOBAL 3
1171 #define IBA_LOCAL  2
1172 #define IP_NON_IBA 1
1173 #define RAW        0
1174
1175 /* OpCodeValues
1176 * Code Bits [7-5] Connection Type
1177 *           [4-0] Message Type
1178
1179 * Reliable Connection (RC)
1180 * [7-5] = 000 */
1181 #define RC_SEND_FIRST                   0 /*0x00000000 */
1182 #define RC_SEND_MIDDLE                  1 /*0x00000001 */
1183 #define RC_SEND_LAST                    2 /*0x00000010 */
1184 #define RC_SEND_LAST_IMM                3 /*0x00000011 */
1185 #define RC_SEND_ONLY                    4 /*0x00000100 */
1186 #define RC_SEND_ONLY_IMM                5 /*0x00000101 */
1187 #define RC_RDMA_WRITE_FIRST             6 /*0x00000110 */
1188 #define RC_RDMA_WRITE_MIDDLE            7 /*0x00000111 */
1189 #define RC_RDMA_WRITE_LAST              8 /*0x00001000 */
1190 #define RC_RDMA_WRITE_LAST_IMM          9 /*0x00001001 */
1191 #define RC_RDMA_WRITE_ONLY              10 /*0x00001010 */
1192 #define RC_RDMA_WRITE_ONLY_IMM          11 /*0x00001011 */
1193 #define RC_RDMA_READ_REQUEST            12 /*0x00001100 */
1194 #define RC_RDMA_READ_RESPONSE_FIRST     13 /*0x00001101 */
1195 #define RC_RDMA_READ_RESPONSE_MIDDLE    14 /*0x00001110 */
1196 #define RC_RDMA_READ_RESPONSE_LAST      15 /*0x00001111 */
1197 #define RC_RDMA_READ_RESPONSE_ONLY      16 /*0x00010000 */
1198 #define RC_ACKNOWLEDGE                  17 /*0x00010001 */
1199 #define RC_ATOMIC_ACKNOWLEDGE           18 /*0x00010010 */
1200 #define RC_CMP_SWAP                     19 /*0x00010011 */
1201 #define RC_FETCH_ADD                    20 /*0x00010100 */
1202 #define RC_SEND_LAST_INVAL              22 /*0x00010110 */
1203 #define RC_SEND_ONLY_INVAL              23 /*0x00010111 */
1204
1205 /* Reliable Datagram (RD)
1206 * [7-5] = 010 */
1207 #define RD_SEND_FIRST                   64 /*0x01000000 */
1208 #define RD_SEND_MIDDLE                  65 /*0x01000001 */
1209 #define RD_SEND_LAST                    66 /*0x01000010 */
1210 #define RD_SEND_LAST_IMM                67 /*0x01000011 */
1211 #define RD_SEND_ONLY                    68 /*0x01000100 */
1212 #define RD_SEND_ONLY_IMM                69 /*0x01000101 */
1213 #define RD_RDMA_WRITE_FIRST             70 /*0x01000110 */
1214 #define RD_RDMA_WRITE_MIDDLE            71 /*0x01000111 */
1215 #define RD_RDMA_WRITE_LAST              72 /*0x01001000 */
1216 #define RD_RDMA_WRITE_LAST_IMM          73 /*0x01001001 */
1217 #define RD_RDMA_WRITE_ONLY              74 /*0x01001010 */
1218 #define RD_RDMA_WRITE_ONLY_IMM          75 /*0x01001011 */
1219 #define RD_RDMA_READ_REQUEST            76 /*0x01001100 */
1220 #define RD_RDMA_READ_RESPONSE_FIRST     77 /*0x01001101 */
1221 #define RD_RDMA_READ_RESPONSE_MIDDLE    78 /*0x01001110 */
1222 #define RD_RDMA_READ_RESPONSE_LAST      79 /*0x01001111 */
1223 #define RD_RDMA_READ_RESPONSE_ONLY      80 /*0x01010000 */
1224 #define RD_ACKNOWLEDGE                  81 /*0x01010001 */
1225 #define RD_ATOMIC_ACKNOWLEDGE           82 /*0x01010010 */
1226 #define RD_CMP_SWAP                     83 /*0x01010011 */
1227 #define RD_FETCH_ADD                    84 /*0x01010100 */
1228 #define RD_RESYNC                       85 /*0x01010101 */
1229
1230 /* Unreliable Datagram (UD)
1231 * [7-5] = 011 */
1232 #define UD_SEND_ONLY                    100 /*0x01100100 */
1233 #define UD_SEND_ONLY_IMM                101 /*0x01100101 */
1234
1235 /* Unreliable Connection (UC)
1236 * [7-5] = 001 */
1237 #define UC_SEND_FIRST                   32 /*0x00100000 */
1238 #define UC_SEND_MIDDLE                  33 /*0x00100001 */
1239 #define UC_SEND_LAST                    34 /*0x00100010 */
1240 #define UC_SEND_LAST_IMM                35 /*0x00100011 */
1241 #define UC_SEND_ONLY                    36 /*0x00100100 */
1242 #define UC_SEND_ONLY_IMM                37 /*0x00100101 */
1243 #define UC_RDMA_WRITE_FIRST             38 /*0x00100110 */
1244 #define UC_RDMA_WRITE_MIDDLE            39 /*0x00100111 */
1245 #define UC_RDMA_WRITE_LAST              40 /*0x00101000 */
1246 #define UC_RDMA_WRITE_LAST_IMM          41 /*0x00101001 */
1247 #define UC_RDMA_WRITE_ONLY              42 /*0x00101010 */
1248 #define UC_RDMA_WRITE_ONLY_IMM          43 /*0x00101011 */
1249
1250 static const value_string OpCodeMap[] =
1251 {
1252     { RC_SEND_FIRST, "RC Send First " },
1253     { RC_SEND_MIDDLE, "RC Send Middle "},
1254     { RC_SEND_LAST, "RC Send Last " },
1255     { RC_SEND_LAST_IMM, "RC Send Last Immediate "},
1256     { RC_SEND_ONLY, "RC Send Only "},
1257     { RC_SEND_ONLY_IMM, "RC Send Only Immediate "},
1258     { RC_RDMA_WRITE_FIRST, "RC RDMA Write First " },
1259     { RC_RDMA_WRITE_MIDDLE, "RC RDMA Write Middle "},
1260     { RC_RDMA_WRITE_LAST, "RC RDMA Write Last "},
1261     { RC_RDMA_WRITE_LAST_IMM, "RC RDMA Write Last Immediate " },
1262     { RC_RDMA_WRITE_ONLY, "RC RDMA Write Only " },
1263     { RC_RDMA_WRITE_ONLY_IMM, "RC RDMA Write Only Immediate "},
1264     { RC_RDMA_READ_REQUEST,  "RC RDMA Read Request " },
1265     { RC_RDMA_READ_RESPONSE_FIRST, "RC RDMA Read Response First " },
1266     { RC_RDMA_READ_RESPONSE_MIDDLE, "RC RDMA Read Response Middle "},
1267     { RC_RDMA_READ_RESPONSE_LAST, "RC RDMA Read Response Last " },
1268     { RC_RDMA_READ_RESPONSE_ONLY, "RC RDMA Read Response Only "},
1269     { RC_ACKNOWLEDGE, "RC Acknowledge " },
1270     { RC_ATOMIC_ACKNOWLEDGE, "RC Atomic Acknowledge " },
1271     { RC_CMP_SWAP, "RC Compare Swap " },
1272     { RC_FETCH_ADD, "RC Fetch Add "},
1273     { RC_SEND_LAST_INVAL, "RC Send Last Invalidate "},
1274     { RC_SEND_ONLY_INVAL, "RC Send Only Invalidate " },
1275
1276
1277     { RD_SEND_FIRST, "RD Send First "},
1278     { RD_SEND_MIDDLE,"RD Send Middle " },
1279     { RD_SEND_LAST, "RD Send Last "},
1280     { RD_SEND_LAST_IMM, "RD Last Immediate " },
1281     { RD_SEND_ONLY,"RD Send Only "},
1282     { RD_SEND_ONLY_IMM,"RD Send Only Immediate "},
1283     { RD_RDMA_WRITE_FIRST,"RD RDMA Write First "},
1284     { RD_RDMA_WRITE_MIDDLE, "RD RDMA Write Middle "},
1285     { RD_RDMA_WRITE_LAST,"RD RDMA Write Last "},
1286     { RD_RDMA_WRITE_LAST_IMM,"RD RDMA Write Last Immediate "},
1287     { RD_RDMA_WRITE_ONLY,"RD RDMA Write Only "},
1288     { RD_RDMA_WRITE_ONLY_IMM,"RD RDMA Write Only Immediate "},
1289     { RD_RDMA_READ_REQUEST,"RD RDMA Read Request "},
1290     { RD_RDMA_READ_RESPONSE_FIRST,"RD RDMA Read Response First "},
1291     { RD_RDMA_READ_RESPONSE_MIDDLE,"RD RDMA Read Response Middle "},
1292     { RD_RDMA_READ_RESPONSE_LAST,"RD RDMA Read Response Last "},
1293     { RD_RDMA_READ_RESPONSE_ONLY,"RD RDMA Read Response Only "},
1294     { RD_ACKNOWLEDGE,"RD Acknowledge "},
1295     { RD_ATOMIC_ACKNOWLEDGE,"RD Atomic Acknowledge "},
1296     { RD_CMP_SWAP,"RD Compare Swap "},
1297     { RD_FETCH_ADD, "RD Fetch Add "},
1298     { RD_RESYNC,"RD RESYNC "},
1299
1300
1301     { UD_SEND_ONLY, "UD Send Only "},
1302     { UD_SEND_ONLY_IMM, "UD Send Only Immediate "},
1303
1304
1305     { UC_SEND_FIRST,"UC Send First "},
1306     { UC_SEND_MIDDLE,"UC Send Middle "},
1307     { UC_SEND_LAST,"UC Send Last "},
1308     { UC_SEND_LAST_IMM,"UC Send Last Immediate "},
1309     { UC_SEND_ONLY,"UC Send Only "},
1310     { UC_SEND_ONLY_IMM,"UC Send Only Immediate "},
1311     { UC_RDMA_WRITE_FIRST,"UC RDMA Write First"},
1312     { UC_RDMA_WRITE_MIDDLE,"Unreliable Connection RDMA Write Middle "},
1313     { UC_RDMA_WRITE_LAST,"UC RDMA Write Last "},
1314     { UC_RDMA_WRITE_LAST_IMM,"UC RDMA Write Last Immediate "},
1315     { UC_RDMA_WRITE_ONLY,"UC RDMA Write Only "},
1316     { UC_RDMA_WRITE_ONLY_IMM,"UC RDMA Write Only Immediate "},
1317     { 0, NULL}
1318
1319 };
1320
1321
1322
1323 /* Header Ordering Based on OPCODES
1324 * These are simply an enumeration of the possible header combinations defined by the IB Spec.
1325 * These enumerations
1326 * #DEFINE [HEADER_ORDER]         [ENUM]
1327 * __________________________________ */
1328 #define RDETH_DETH_PAYLD            0
1329 /* __________________________________ */
1330 #define RDETH_DETH_RETH_PAYLD       1
1331 /* __________________________________ */
1332 #define RDETH_DETH_IMMDT_PAYLD      2
1333 /* __________________________________ */
1334 #define RDETH_DETH_RETH_IMMDT_PAYLD 3
1335 /* __________________________________ */
1336 #define RDETH_DETH_RETH             4
1337 /* __________________________________ */
1338 #define RDETH_AETH_PAYLD            5
1339 /* __________________________________ */
1340 #define RDETH_PAYLD                 6
1341 /* __________________________________ */
1342 #define RDETH_AETH                  7
1343 /* __________________________________ */
1344 #define RDETH_AETH_ATOMICACKETH     8
1345 /* __________________________________ */
1346 #define RDETH_DETH_ATOMICETH        9
1347 /* ___________________________________ */
1348 #define RDETH_DETH                  10
1349 /* ___________________________________ */
1350 #define DETH_PAYLD                  11
1351 /* ___________________________________ */
1352 #define DETH_IMMDT_PAYLD            12
1353 /* ___________________________________ */
1354 #define PAYLD                       13
1355 /* ___________________________________ */
1356 #define IMMDT_PAYLD                 14
1357 /* ___________________________________ */
1358 #define RETH_PAYLD                  15
1359 /* ___________________________________ */
1360 #define RETH_IMMDT_PAYLD            16
1361 /* ___________________________________ */
1362 #define RETH                        17
1363 /* ___________________________________ */
1364 #define AETH_PAYLD                  18
1365 /* ___________________________________ */
1366 #define AETH                        19
1367 /* ___________________________________ */
1368 #define AETH_ATOMICACKETH           20
1369 /* ___________________________________ */
1370 #define ATOMICETH                   21
1371 /* ___________________________________ */
1372 #define IETH_PAYLD                  22
1373 /* ___________________________________ */
1374
1375
1376 /* Infiniband transport services
1377    These are an enumeration of the transport services over which an IB packet
1378    might be sent. The values match the corresponding 3 bits of the opCode field
1379    in the BTH  */
1380 #define TRANSPORT_RC    0
1381 #define TRANSPORT_UC    1
1382 #define TRANSPORT_RD    2
1383 #define TRANSPORT_UD    3
1384
1385
1386 /* Array of all availavle OpCodes to make matching a bit easier.
1387 * The OpCodes dictate the header sequence following in the packet.
1388 * These arrays tell the dissector which headers must be decoded for the given OpCode. */
1389 static guint32 opCode_RDETH_DETH_ATOMICETH[] = {
1390  RD_CMP_SWAP,
1391  RD_FETCH_ADD
1392 };
1393 static guint32 opCode_IETH_PAYLD[] = {
1394  RC_SEND_LAST_INVAL,
1395  RC_SEND_ONLY_INVAL
1396 };
1397 static guint32 opCode_ATOMICETH[] = {
1398  RC_CMP_SWAP,
1399  RC_FETCH_ADD
1400 };
1401 static guint32 opCode_RDETH_DETH_RETH_PAYLD[] = {
1402  RD_RDMA_WRITE_FIRST,
1403  RD_RDMA_WRITE_ONLY
1404 };
1405 static guint32 opCode_RETH_IMMDT_PAYLD[] = {
1406  RC_RDMA_WRITE_ONLY_IMM,
1407  UC_RDMA_WRITE_ONLY_IMM
1408 };
1409 static guint32 opCode_RDETH_DETH_IMMDT_PAYLD[] = {
1410  RD_SEND_LAST_IMM,
1411  RD_SEND_ONLY_IMM,
1412  RD_RDMA_WRITE_LAST_IMM
1413 };
1414
1415 static guint32 opCode_RDETH_AETH_PAYLD[] = {
1416  RD_RDMA_READ_RESPONSE_FIRST,
1417  RD_RDMA_READ_RESPONSE_LAST,
1418  RD_RDMA_READ_RESPONSE_ONLY
1419 };
1420 static guint32 opCode_AETH_PAYLD[] = {
1421  RC_RDMA_READ_RESPONSE_FIRST,
1422  RC_RDMA_READ_RESPONSE_LAST,
1423  RC_RDMA_READ_RESPONSE_ONLY
1424 };
1425 static guint32 opCode_RETH_PAYLD[] = {
1426  RC_RDMA_WRITE_FIRST,
1427  RC_RDMA_WRITE_ONLY,
1428  UC_RDMA_WRITE_FIRST,
1429  UC_RDMA_WRITE_ONLY
1430 };
1431
1432 static guint32 opCode_RDETH_DETH_PAYLD[] = {
1433  RD_SEND_FIRST,
1434  RD_SEND_MIDDLE,
1435  RD_SEND_LAST,
1436  RD_SEND_ONLY,
1437  RD_RDMA_WRITE_MIDDLE,
1438  RD_RDMA_WRITE_LAST
1439 };
1440
1441 static guint32 opCode_IMMDT_PAYLD[] = {
1442  RC_SEND_LAST_IMM,
1443  RC_SEND_ONLY_IMM,
1444  RC_RDMA_WRITE_LAST_IMM,
1445  UC_SEND_LAST_IMM,
1446  UC_SEND_ONLY_IMM,
1447  UC_RDMA_WRITE_LAST_IMM
1448 };
1449
1450 static guint32 opCode_PAYLD[] = {
1451  RC_SEND_FIRST,
1452  RC_SEND_MIDDLE,
1453  RC_SEND_LAST,
1454  RC_SEND_ONLY,
1455  RC_RDMA_WRITE_MIDDLE,
1456  RC_RDMA_WRITE_LAST,
1457  RC_RDMA_READ_RESPONSE_MIDDLE,
1458  UC_SEND_FIRST,
1459  UC_SEND_MIDDLE,
1460  UC_SEND_LAST,
1461  UC_SEND_ONLY,
1462  UC_RDMA_WRITE_MIDDLE,
1463  UC_RDMA_WRITE_LAST
1464 };
1465
1466 /* It is not necessary to create arrays for these OpCodes since they indicate only one further header.
1467 *  We can just decode it directly
1468
1469 * static guint32 opCode_DETH_IMMDT_PAYLD[] = {
1470 * UD_SEND_ONLY_IMM
1471 * };
1472 * static guint32 opCode_DETH_PAYLD[] = {
1473 * UD_SEND_ONLY
1474 * };
1475 * static guint32 opCode_RDETH_DETH[] = {
1476 * RD_RESYNC
1477 * };
1478 * static guint32 opCode_RDETH_DETH_RETH[] = {
1479 * RD_RDMA_READ_REQUEST
1480 * };
1481 * static guint32 opCode_RDETH_DETH_RETH_IMMDT_PAYLD[] = {
1482 * RD_RDMA_WRITE_ONLY_IMM
1483 * };
1484 * static guint32 opCode_RDETH_AETH_ATOMICACKETH[] = {
1485 * RD_ATOMIC_ACKNOWLEDGE
1486 * };
1487 * static guint32 opCode_RDETH_AETH[] = {
1488 * RD_ACKNOWLEDGE
1489 * };
1490 * static guint32 opCode_RDETH_PAYLD[] = {
1491 * RD_RDMA_READ_RESPONSE_MIDDLE
1492 * };
1493 * static guint32 opCode_AETH_ATOMICACKETH[] = {
1494 * RC_ATOMIC_ACKNOWLEDGE
1495 * };
1496 * static guint32 opCode_RETH[] = {
1497 * RC_RDMA_READ_REQUEST
1498 * };
1499 * static guint32 opCode_AETH[] = {
1500 * RC_ACKNOWLEDGE
1501 * }; */
1502
1503 static gchar *src_addr = NULL,     /* the address to be displayed in the source/destination columns */
1504              *dst_addr = NULL;     /* (lid/gid number) will be stored here */
1505
1506 #define ADDR_MAX_LEN  sizeof("IPv6 over IB Packet")      /* maximum length of src_addr and dst_addr is for IPoIB
1507                                                             where we print an explanation string */
1508
1509 static gint8 transport_type = -1;      /* reflects the transport type of the packet being parsed.
1510                                           only use one of the TRANSPORT_* values for this field */
1511
1512 /* settings to be set by the user via the preferences dialog */
1513 static gboolean pref_dissect_eoib = TRUE;
1514 static gboolean pref_identify_iba_payload = TRUE;
1515
1516 /* saves information about connections that have been/are in the process of being
1517    negotiated via ConnectionManagement packets */
1518 typedef struct {
1519     guint8 req_gid[GID_SIZE],
1520            resp_gid[GID_SIZE];  /* GID of requester/responder, respectively */
1521     guint16 req_lid,
1522             resp_lid;   /* LID of requester/responder, respectively */
1523     guint32 req_qp,
1524             resp_qp;            /* QP number of requester/responder, respectively */
1525     guint64 service_id;         /* service id for this connection */
1526 } connection_context;
1527
1528 /* holds a table of connection contexts being negotiated by CM. the key is a obtained
1529    using ADD_ADDRESS_TO_HASH(initiator address, TransactionID) [remember that the 1st
1530    argument to ADD_ADDRESS_TO_HASH must be an lvalue. */
1531 GHashTable *CM_context_table = NULL;
1532
1533 /* heuristics sub-dissectors list for dissecting the data payload of IB packets */
1534 static heur_dissector_list_t heur_dissectors_payload;
1535 /* heuristics sub-dissectors list for dissecting the PrivateData of CM packets */
1536 static heur_dissector_list_t heur_dissectors_cm_private;
1537
1538 /* ----- This sections contains various utility functions indirectly related to Infiniband dissection ---- */
1539
1540 /* g_int64_hash, g_int64_equal are defined starting glib 2.22 - otherwise, we'll have to
1541    provide them ourselves! */
1542 #if !GLIB_CHECK_VERSION(2,22,0)
1543 guint
1544 g_int64_hash (gconstpointer v)
1545 {
1546   return (guint) *(const gint64*) v;
1547 }
1548
1549 gboolean
1550 g_int64_equal (gconstpointer v1,
1551                gconstpointer v2)
1552 {
1553   return *((const gint64*) v1) == *((const gint64*) v2);
1554 }
1555 #endif
1556
1557 void table_destroy_notify(gpointer data) {
1558     g_free(data);
1559 }
1560
1561 /* --------------------------------------------------------------------------------------------------------*/
1562
1563 /* Helper dissector for correctly dissecting RoCE packets (encapsulated within an Ethernet */
1564 /* frame). The only difference from regular IB packets is that RoCE packets do not contain */
1565 /* a LRH, and always start with a GRH.                                                      */
1566 static void
1567 dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1568 {
1569     /* this is a RoCE packet, so signal the IB dissector not to look for LRH */
1570     dissect_infiniband_common(tvb, pinfo, tree, TRUE);
1571 }
1572
1573 static void
1574 dissect_infiniband(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1575 {
1576     dissect_infiniband_common(tvb, pinfo, tree, FALSE);
1577 }
1578
1579 /* Common Dissector for both InfiniBand and RoCE packets
1580  * IN:
1581  *       tvb - The tvbbuff of packet data
1582  *       pinfo - The packet info structure with column information
1583  *       tree - The tree structure under which field nodes are to be added
1584  *       starts_with_grh - If true this packets start with a GRH header (RoCE), otherwise with LRH as usual
1585  * Notes:
1586  * 1.) Floating "offset+=" statements should probably be "functionized" but they are inline
1587  * Offset is only passed by reference in specific places, so do not be confused when following code
1588  * In any code path, adding up "offset+=" statements will tell you what byte you are at */
1589 static void
1590 dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean starts_with_grh)
1591 {
1592     /* Top Level Item */
1593     proto_item *infiniband_packet = NULL;
1594
1595     /* The Headers Subtree */
1596     proto_tree *all_headers_tree = NULL;
1597
1598     /* LRH - Local Route Header */
1599     proto_tree *local_route_header_tree = NULL;
1600     proto_item *local_route_header_item = NULL;
1601
1602     /* GRH - Global Route Header */
1603     proto_tree *global_route_header_tree = NULL;
1604     proto_item *global_route_header_item = NULL;
1605
1606     /* BTH - Base Transport header */
1607     proto_tree *base_transport_header_tree = NULL;
1608     proto_item *base_transport_header_item = NULL;
1609
1610     /* Raw Data */
1611     proto_tree *RAWDATA_header_tree;
1612     proto_item *RAWDATA_header_item;
1613     guint8 lnh_val = 0;             /* Link Next Header Value */
1614     gint offset = 0;                /* Current Offset */
1615
1616     /* General Variables */
1617     gboolean bthFollows = 0;        /* Tracks if we are parsing a BTH.  This is a significant decision point */
1618     guint8 virtualLane = 0;         /* IB VirtualLane.  Keyed off of for detecting subnet admin/management */
1619     guint8 opCode = 0;              /* OpCode from BTH header. */
1620     gint32 nextHeaderSequence = -1; /* defined by this dissector. #define which indicates the upcoming header sequence from OpCode */
1621     guint16 payloadLength = 0;      /* Payload Length should it exist */
1622     guint8 nxtHdr = 0;              /* Keyed off for header dissection order */
1623     guint16 packetLength = 0;       /* Packet Length.  We track this as tvb->length - offset.   */
1624                                     /*  It provides the parsing methods a known size            */
1625                                     /*   that must be available for that header.                */
1626     struct e_in6_addr SRCgid;       /* Structures to hold GIDs should we need them */
1627     struct e_in6_addr DSTgid;
1628     gint crc_length = 0;
1629
1630     /* allocate space for source/destination addresses. we will fill them in later */
1631     src_addr = ep_alloc(ADDR_MAX_LEN);
1632     dst_addr = ep_alloc(ADDR_MAX_LEN);
1633
1634     pinfo->srcport = pinfo->destport = 0xffffffff;  /* set the src/dest QPN to something impossible instead of the default 0,
1635                                                        so we don't mistake it for a MAD. (QP is only 24bit, so can't be 0xffffffff)*/
1636
1637     /* add any code that should only run the first time the packet is dissected here: */
1638     if (!pinfo->fd->flags.visited)
1639     {
1640         pinfo->ptype = PT_IBQP;     /* set the port-type for this packet to be Infiniband QP number */
1641     }
1642
1643     /* Mark the Packet type as Infiniband in the wireshark UI */
1644     /* Clear other columns */
1645     col_set_str(pinfo->cinfo, COL_PROTOCOL, "InfiniBand");
1646     col_clear(pinfo->cinfo, COL_INFO);
1647
1648     /* Get the parent tree from the ERF dissector.  We don't want to nest under ERF */
1649     if(tree && tree->parent)
1650     {
1651         /* Set the normal tree outside of ERF */
1652         tree = tree->parent;
1653         /* Set a global reference for nested protocols */
1654         top_tree = tree;
1655     }
1656
1657     /* The "quick-dissection" code in dissect_general_info skips lots of the recently-added code
1658        for saving context etc. It is no longer viable to maintain two code branches, so we have
1659        (temporarily?) disabled the second one. All dissection now goes through the full branch,
1660        using a NULL tree pointer if this is not a full dissection call. Take care not to dereference
1661        the tree pointer or any subtree pointers you create using it and you'll be fine. */
1662     if(0 && !tree)
1663     {
1664         /* If no packet details are being dissected, extract some high level info for the packet view */
1665         /* Assigns column values rather than full tree population */
1666         dissect_general_info(tvb, offset, pinfo, starts_with_grh);
1667         return;
1668     }
1669
1670     /* Top Level Packet */
1671     infiniband_packet = proto_tree_add_item(tree, proto_infiniband, tvb, offset, -1, FALSE);
1672
1673     /* Headers Level Tree */
1674     all_headers_tree = proto_item_add_subtree(infiniband_packet, ett_all_headers);
1675
1676     if (starts_with_grh) {
1677         /* this is a RoCE packet, skip LRH parsing */
1678         lnh_val = IBA_GLOBAL;
1679         packetLength = tvb_get_ntohs(tvb, 4);   /* since we have no LRH to get PktLen from, use that of the GRH */
1680         goto skip_lrh;
1681     }
1682
1683     /* Local Route Header Subtree */
1684     local_route_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_LRH, tvb, offset, 8, FALSE);
1685     proto_item_set_text(local_route_header_item, "%s", "Local Route Header");
1686     local_route_header_tree = proto_item_add_subtree(local_route_header_item, ett_lrh);
1687
1688     proto_tree_add_item(local_route_header_tree, hf_infiniband_virtual_lane,            tvb, offset, 1, FALSE);
1689
1690
1691     /* Get the Virtual Lane.  We'll use this to identify Subnet Management and Subnet Administration Packets. */
1692     virtualLane =  tvb_get_guint8(tvb, offset);
1693     virtualLane = virtualLane & 0xF0;
1694
1695
1696     proto_tree_add_item(local_route_header_tree, hf_infiniband_link_version,            tvb, offset, 1, FALSE); offset+=1;
1697     proto_tree_add_item(local_route_header_tree, hf_infiniband_service_level,           tvb, offset, 1, FALSE);
1698
1699     proto_tree_add_item(local_route_header_tree, hf_infiniband_reserved2,               tvb, offset, 1, FALSE);
1700     proto_tree_add_item(local_route_header_tree, hf_infiniband_link_next_header,        tvb, offset, 1, FALSE);
1701
1702
1703     /* Save Link Next Header... This tells us what the next header is. */
1704     lnh_val =  tvb_get_guint8(tvb, offset);
1705     lnh_val = lnh_val & 0x03;
1706     offset+=1;
1707
1708
1709     proto_tree_add_item(local_route_header_tree, hf_infiniband_destination_local_id,    tvb, offset, 2, FALSE);
1710
1711
1712     /* Set destination in packet view. */
1713     *((guint16*) dst_addr) = tvb_get_ntohs(tvb, offset);
1714     SET_ADDRESS(&pinfo->dst, AT_IB, sizeof(guint16), dst_addr);
1715
1716     offset+=2;
1717
1718     proto_tree_add_item(local_route_header_tree, hf_infiniband_reserved5,               tvb, offset, 2, FALSE);
1719
1720     packetLength = tvb_get_ntohs(tvb, offset); /* Get the Packet Length. This will determine payload size later on. */
1721     packetLength = packetLength & 0x07FF;      /* Mask off top 5 bits, they are reserved */
1722     packetLength = packetLength * 4;           /* Multiply by 4 to get true byte length. This is by specification.  */
1723                                                /*   PktLen is size in 4 byte words (byteSize /4). */
1724
1725     proto_tree_add_item(local_route_header_tree, hf_infiniband_packet_length,           tvb, offset, 2, FALSE); offset+=2;
1726     proto_tree_add_item(local_route_header_tree, hf_infiniband_source_local_id,         tvb, offset, 2, FALSE);
1727
1728     /* Set Source in packet view. */
1729     *((guint16*) src_addr) = tvb_get_ntohs(tvb, offset);
1730     SET_ADDRESS(&pinfo->src, AT_IB, sizeof(guint16), src_addr);
1731
1732     offset+=2;
1733     packetLength -= 8; /* Shave 8 bytes for the LRH. */
1734
1735 skip_lrh:
1736
1737     /* Key off Link Next Header.  This tells us what High Level Data Format we have */
1738     switch(lnh_val)
1739     {
1740         case IBA_GLOBAL:
1741             global_route_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_GRH, tvb, offset, 40, FALSE);
1742             proto_item_set_text(global_route_header_item, "%s", "Global Route Header");
1743             global_route_header_tree = proto_item_add_subtree(global_route_header_item, ett_grh);
1744
1745             proto_tree_add_item(global_route_header_tree, hf_infiniband_ip_version,         tvb, offset, 1, FALSE);
1746             proto_tree_add_item(global_route_header_tree, hf_infiniband_traffic_class,      tvb, offset, 2, FALSE);
1747             proto_tree_add_item(global_route_header_tree, hf_infiniband_flow_label,         tvb, offset, 4, FALSE); offset += 4;
1748
1749             payloadLength = tvb_get_ntohs(tvb, offset);
1750
1751             proto_tree_add_item(global_route_header_tree, hf_infiniband_payload_length,     tvb, offset, 2, FALSE); offset += 2;
1752
1753             nxtHdr = tvb_get_guint8(tvb, offset);
1754
1755             proto_tree_add_item(global_route_header_tree, hf_infiniband_next_header,        tvb, offset, 1, FALSE); offset +=1;
1756             proto_tree_add_item(global_route_header_tree, hf_infiniband_hop_limit,          tvb, offset, 1, FALSE); offset +=1;
1757             proto_tree_add_item(global_route_header_tree, hf_infiniband_source_gid,         tvb, offset, 16, FALSE);
1758
1759             tvb_get_ipv6(tvb, offset, &SRCgid);
1760
1761             /* set source GID in packet view*/
1762             memcpy(src_addr, &SRCgid, GID_SIZE);
1763             SET_ADDRESS(&pinfo->src, AT_IB, GID_SIZE, src_addr);
1764
1765             offset += 16;
1766
1767             proto_tree_add_item(global_route_header_tree, hf_infiniband_destination_gid,    tvb, offset, 16, FALSE);
1768
1769             tvb_get_ipv6(tvb, offset, &DSTgid);
1770
1771             /* set destination GID in packet view*/
1772             memcpy(dst_addr, &DSTgid, GID_SIZE);
1773             SET_ADDRESS(&pinfo->dst, AT_IB, GID_SIZE, dst_addr);
1774
1775             offset += 16;
1776             packetLength -= 40; /* Shave 40 bytes for GRH */
1777
1778             if(nxtHdr != 0x1B)
1779             {
1780                 /* Some kind of packet being transported globally with IBA, but locally it is not IBA - no BTH following. */
1781                 break;
1782             }
1783             /* otherwise fall through and start parsing BTH */
1784         case IBA_LOCAL:
1785             bthFollows = TRUE;
1786             base_transport_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_BTH, tvb, offset, 12, FALSE);
1787             proto_item_set_text(base_transport_header_item, "%s", "Base Transport Header");
1788             base_transport_header_tree = proto_item_add_subtree(base_transport_header_item, ett_bth);
1789             proto_tree_add_item(base_transport_header_tree, hf_infiniband_opcode,                       tvb, offset, 1, FALSE);
1790
1791             /* Get the OpCode - this tells us what headers are following */
1792             opCode = tvb_get_guint8(tvb, offset);
1793             col_append_str(pinfo->cinfo, COL_INFO, val_to_str((guint32)opCode, OpCodeMap, "Unknown OpCode"));
1794             offset +=1;
1795
1796             proto_tree_add_item(base_transport_header_tree, hf_infiniband_solicited_event,              tvb, offset, 1, FALSE);
1797             proto_tree_add_item(base_transport_header_tree, hf_infiniband_migreq,                       tvb, offset, 1, FALSE);
1798             proto_tree_add_item(base_transport_header_tree, hf_infiniband_pad_count,                    tvb, offset, 1, FALSE);
1799             proto_tree_add_item(base_transport_header_tree, hf_infiniband_transport_header_version,     tvb, offset, 1, FALSE); offset +=1;
1800             proto_tree_add_item(base_transport_header_tree, hf_infiniband_partition_key,                tvb, offset, 2, FALSE); offset +=2;
1801             proto_tree_add_item(base_transport_header_tree, hf_infiniband_reserved8,                    tvb, offset, 1, FALSE); offset +=1;
1802             proto_tree_add_item(base_transport_header_tree, hf_infiniband_destination_qp,               tvb, offset, 3, FALSE);
1803             pinfo->destport = tvb_get_ntoh24(tvb, offset); offset +=3;
1804             proto_tree_add_item(base_transport_header_tree, hf_infiniband_acknowledge_request,          tvb, offset, 1, FALSE);
1805             proto_tree_add_item(base_transport_header_tree, hf_infiniband_reserved7,                    tvb, offset, 1, FALSE); offset +=1;
1806             proto_tree_add_item(base_transport_header_tree, hf_infiniband_packet_sequence_number,       tvb, offset, 3, FALSE); offset +=3;
1807
1808
1809             packetLength -= 12; /* Shave 12 for Base Transport Header */
1810
1811         break;
1812         case IP_NON_IBA:
1813             /* Raw IPv6 Packet */
1814             g_snprintf(dst_addr,  ADDR_MAX_LEN, "IPv6 over IB Packet");
1815             SET_ADDRESS(&pinfo->dst,  AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
1816
1817             parse_IPvSix(all_headers_tree, tvb, &offset, pinfo);
1818             break;
1819         case RAW:
1820             parse_RWH(all_headers_tree, tvb, &offset, pinfo);
1821             break;
1822         default:
1823             /* Unknown Packet */
1824             RAWDATA_header_item = proto_tree_add_item(all_headers_tree, hf_infiniband_raw_data, tvb, offset, -1, FALSE);
1825             proto_item_set_text(RAWDATA_header_item, "%s", "Unknown Raw Data - IB Encapsulated");
1826             RAWDATA_header_tree = proto_item_add_subtree(RAWDATA_header_item, ett_rawdata);
1827             break;
1828     }
1829
1830     /* Base Transport header is hit quite often, however it is alone since it is the exception not the rule */
1831     /* Only IBA Local packets use it */
1832     if(bthFollows)
1833     {
1834         /* Find our next header sequence based on the Opcode
1835         * Each case decrements the packetLength by the amount of bytes consumed by each header.
1836         * The find_next_header_sequence method could be used to automate this.
1837         * We need to keep track of this so we know much data to mark as payload/ICRC/VCRC values. */
1838
1839         transport_type = (opCode & 0xE0) >> 5;   /* save transport type for identifying EoIB payloads later... */
1840         nextHeaderSequence = find_next_header_sequence((guint32) opCode);
1841
1842         /* find_next_header_sequence gives us the DEFINE value corresponding to the header order following */
1843         /* Enumerations are named intuitively, e.g. RDETH DETH PAYLOAD means there is an RDETH Header, DETH Header, and a packet payload */
1844         switch(nextHeaderSequence)
1845         {
1846             case RDETH_DETH_PAYLD:
1847                 parse_RDETH(all_headers_tree, tvb, &offset);
1848                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1849
1850                 packetLength -= 4; /* RDETH */
1851                 packetLength -= 8; /* DETH */
1852
1853                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1854                 break;
1855             case RDETH_DETH_RETH_PAYLD:
1856                 parse_RDETH(all_headers_tree, tvb, &offset);
1857                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1858                 parse_RETH(all_headers_tree, tvb, &offset);
1859
1860                 packetLength -= 4; /* RDETH */
1861                 packetLength -= 8; /* DETH */
1862                 packetLength -= 16; /* RETH */
1863
1864                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1865                 break;
1866             case RDETH_DETH_IMMDT_PAYLD:
1867                 parse_RDETH(all_headers_tree, tvb, &offset);
1868                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1869                 parse_IMMDT(all_headers_tree, tvb, &offset);
1870
1871                 packetLength -= 4; /* RDETH */
1872                 packetLength -= 8; /* DETH */
1873                 packetLength -= 4; /* IMMDT */
1874
1875                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1876                 break;
1877             case RDETH_DETH_RETH_IMMDT_PAYLD:
1878                 parse_RDETH(all_headers_tree, tvb, &offset);
1879                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1880                 parse_RETH(all_headers_tree, tvb, &offset);
1881                 parse_IMMDT(all_headers_tree, tvb, &offset);
1882
1883                 packetLength -= 4; /* RDETH */
1884                 packetLength -= 8; /* DETH */
1885                 packetLength -= 16; /* RETH */
1886                 packetLength -= 4; /* IMMDT */
1887
1888                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1889                 break;
1890             case RDETH_DETH_RETH:
1891                 parse_RDETH(all_headers_tree, tvb, &offset);
1892                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1893                 parse_RETH(all_headers_tree, tvb, &offset);
1894
1895                 packetLength -= 4; /* RDETH */
1896                 packetLength -= 8; /* DETH */
1897                 packetLength -= 16; /* RETH */
1898
1899                 break;
1900             case RDETH_AETH_PAYLD:
1901                 parse_RDETH(all_headers_tree, tvb, &offset);
1902                 parse_AETH(all_headers_tree, tvb, &offset);
1903
1904                 packetLength -= 4; /* RDETH */
1905                 packetLength -= 4; /* AETH */
1906
1907                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1908                 break;
1909             case RDETH_PAYLD:
1910                 parse_RDETH(all_headers_tree, tvb, &offset);
1911
1912                 packetLength -= 4; /* RDETH */
1913
1914                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1915                 break;
1916             case RDETH_AETH:
1917                 parse_AETH(all_headers_tree, tvb, &offset);
1918
1919                 packetLength -= 4; /* RDETH */
1920                 packetLength -= 4; /* AETH */
1921
1922
1923                 break;
1924             case RDETH_AETH_ATOMICACKETH:
1925                 parse_RDETH(all_headers_tree, tvb, &offset);
1926                 parse_AETH(all_headers_tree, tvb, &offset);
1927                 parse_ATOMICACKETH(all_headers_tree, tvb, &offset);
1928
1929                 packetLength -= 4; /* RDETH */
1930                 packetLength -= 4; /* AETH */
1931                 packetLength -= 8; /* AtomicAckETH */
1932
1933
1934                 break;
1935             case RDETH_DETH_ATOMICETH:
1936                 parse_RDETH(all_headers_tree, tvb, &offset);
1937                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1938                 parse_ATOMICETH(all_headers_tree, tvb, &offset);
1939
1940                 packetLength -= 4; /* RDETH */
1941                 packetLength -= 8; /* DETH */
1942                 packetLength -= 28; /* AtomicETH */
1943
1944                 break;
1945             case RDETH_DETH:
1946                 parse_RDETH(all_headers_tree, tvb, &offset);
1947                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1948
1949                 packetLength -= 4; /* RDETH */
1950                 packetLength -= 8; /* DETH */
1951
1952                 break;
1953             case DETH_PAYLD:
1954                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
1955
1956                 packetLength -= 8; /* DETH */
1957
1958                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1959                 break;
1960             case PAYLD:
1961
1962                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1963                 break;
1964             case IMMDT_PAYLD:
1965                 parse_IMMDT(all_headers_tree, tvb, &offset);
1966
1967                 packetLength -= 4; /* IMMDT */
1968
1969                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1970                 break;
1971             case RETH_PAYLD:
1972                 parse_RETH(all_headers_tree, tvb, &offset);
1973
1974                 packetLength -= 16; /* RETH */
1975
1976                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1977                 break;
1978             case RETH:
1979                 parse_RETH(all_headers_tree, tvb, &offset);
1980
1981                 packetLength -= 16; /* RETH */
1982
1983                 break;
1984             case AETH_PAYLD:
1985                 parse_AETH(all_headers_tree, tvb, &offset);
1986
1987                 packetLength -= 4; /* AETH */
1988
1989                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
1990                 break;
1991             case AETH:
1992                 parse_AETH(all_headers_tree, tvb, &offset);
1993
1994                 packetLength -= 4; /* AETH */
1995
1996                 break;
1997             case AETH_ATOMICACKETH:
1998                 parse_AETH(all_headers_tree, tvb, &offset);
1999                 parse_ATOMICACKETH(all_headers_tree, tvb, &offset);
2000
2001                 packetLength -= 4; /* AETH */
2002                 packetLength -= 8; /* AtomicAckETH */
2003
2004                 break;
2005             case ATOMICETH:
2006                 parse_ATOMICETH(all_headers_tree, tvb, &offset);
2007
2008                 packetLength -= 28; /* AtomicETH */
2009
2010                 break;
2011             case IETH_PAYLD:
2012                 parse_IETH(all_headers_tree, tvb, &offset);
2013
2014                 packetLength -= 4; /* IETH */
2015
2016                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
2017                 break;
2018             case DETH_IMMDT_PAYLD:
2019                 parse_DETH(all_headers_tree, pinfo, tvb, &offset);
2020                 parse_IMMDT(all_headers_tree, tvb, &offset);
2021
2022                 packetLength -= 8; /* DETH */
2023                 packetLength -= 4; /* IMMDT */
2024
2025                 parse_PAYLOAD(all_headers_tree, pinfo, tvb, &offset, packetLength);
2026                 break;
2027             default:
2028                 parse_VENDOR(all_headers_tree, tvb, &offset);
2029                 break;
2030
2031         }
2032
2033     }
2034     /* Display the ICRC/VCRC */
2035     /* Doing it this way rather than in a variety of places according to the specific packet */
2036     /* If we've already displayed it crc_length comes out 0 */
2037     crc_length = tvb_reported_length_remaining(tvb, offset);
2038     if(crc_length == 6)
2039     {
2040         proto_tree_add_item(all_headers_tree, hf_infiniband_invariant_crc, tvb, offset, 4, FALSE); offset +=4;
2041         proto_tree_add_item(all_headers_tree, hf_infiniband_variant_crc,   tvb, offset, 2, FALSE); offset+=2;
2042     }
2043     else if(crc_length == 4)
2044     {
2045         proto_tree_add_item(all_headers_tree, hf_infiniband_invariant_crc, tvb, offset, 4, FALSE); offset +=4;
2046     }
2047     else if(crc_length == 2)
2048     {
2049         proto_tree_add_item(all_headers_tree, hf_infiniband_variant_crc,   tvb, offset, 2, FALSE); offset+=2;
2050     }
2051
2052 }
2053
2054 static void
2055 dissect_infiniband_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2056 {
2057     /* Top Level Item */
2058     proto_item *infiniband_link_packet = NULL;
2059
2060     /* The Link Subtree */
2061     proto_tree *link_tree = NULL;
2062
2063     proto_item *operand_item = NULL;
2064     gint offset = 0;                /* Current Offset */
2065     guint8 operand;                 /* Link packet Operand */
2066
2067     operand =  tvb_get_guint8(tvb, offset);
2068     operand = (operand & 0xF0) >> 4;
2069
2070     /* Mark the Packet type as Infiniband in the wireshark UI */
2071     /* Clear other columns */
2072     col_set_str(pinfo->cinfo, COL_PROTOCOL, "InfiniBand Link");
2073     col_clear(pinfo->cinfo, COL_INFO);
2074     col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
2075              val_to_str(operand, Operand_Description, "Unknown (0x%1x)"));
2076
2077     /* Get the parent tree from the ERF dissector.  We don't want to nest under ERF */
2078     if(tree && tree->parent)
2079     {
2080         /* Set the normal tree outside of ERF */
2081         tree = tree->parent;
2082         /* Set a global reference for nested protocols */
2083         top_tree = tree;
2084     }
2085
2086     if(!tree)
2087     {
2088         /* If no packet details are being dissected, extract some high level info for the packet view */
2089         /* Assigns column values rather than full tree population */
2090         dissect_general_info(tvb, offset, pinfo, FALSE);
2091         return;
2092     }
2093
2094     /* Top Level Packet */
2095     infiniband_link_packet = proto_tree_add_item(tree, proto_infiniband_link, tvb, offset, -1, FALSE);
2096
2097     /* Headers Level Tree */
2098     link_tree = proto_item_add_subtree(infiniband_link_packet, ett_link);
2099
2100     operand_item = proto_tree_add_item(link_tree, hf_infiniband_link_op, tvb, offset, 2, FALSE);
2101
2102     if (operand > 1) {
2103         proto_item_set_text(operand_item, "%s", "Reserved");
2104         call_dissector(data_handle, tvb, pinfo, link_tree);
2105     } else {
2106         proto_tree_add_item(link_tree, hf_infiniband_link_fctbs, tvb, offset, 2, FALSE);
2107         offset += 2;
2108
2109         proto_tree_add_item(link_tree, hf_infiniband_link_vl, tvb, offset, 2, FALSE);
2110         proto_tree_add_item(link_tree, hf_infiniband_link_fccl, tvb, offset, 2, FALSE);
2111         offset += 2;
2112
2113         proto_tree_add_item(link_tree, hf_infiniband_link_lpcrc, tvb, offset, 2, FALSE);
2114         offset += 2;
2115     }
2116
2117 }
2118
2119
2120 /* Description: Finds the header sequence that follows the Base Transport Header.
2121 * Somwhat inefficient (should be using a single key,value pair data structure)
2122 * But uses pure probablity to take a stab at better efficiency.
2123 * Searches largest header sequence groups first, and then finally resorts to single matches for unique header sequences
2124 * IN: OpCode: The OpCode from the Base Transport Header.
2125 * OUT: The Header Sequence enumeration.  See Declarations for #defines from (0-22) */
2126 static gint32
2127 find_next_header_sequence(guint32 OpCode)
2128 {
2129     if(contains(OpCode, &opCode_PAYLD[0], (gint32)sizeof(opCode_PAYLD)))
2130         return PAYLD;
2131
2132     if(contains(OpCode, &opCode_IMMDT_PAYLD[0], (gint32)sizeof(opCode_IMMDT_PAYLD)))
2133         return IMMDT_PAYLD;
2134
2135     if(contains(OpCode, &opCode_RDETH_DETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_PAYLD)))
2136         return RDETH_DETH_PAYLD;
2137
2138     if(contains(OpCode, &opCode_RETH_PAYLD[0], (gint32)sizeof(opCode_RETH_PAYLD)))
2139         return RETH_PAYLD;
2140
2141     if(contains(OpCode, &opCode_RDETH_AETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_AETH_PAYLD)))
2142         return RDETH_AETH_PAYLD;
2143
2144     if(contains(OpCode, &opCode_AETH_PAYLD[0], (gint32)sizeof(opCode_AETH_PAYLD)))
2145         return AETH_PAYLD;
2146
2147     if(contains(OpCode, &opCode_RDETH_DETH_IMMDT_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_IMMDT_PAYLD)))
2148         return RDETH_DETH_IMMDT_PAYLD;
2149
2150     if(contains(OpCode, &opCode_RETH_IMMDT_PAYLD[0], (gint32)sizeof(opCode_RETH_IMMDT_PAYLD)))
2151         return RETH_IMMDT_PAYLD;
2152
2153     if(contains(OpCode, &opCode_RDETH_DETH_RETH_PAYLD[0], (gint32)sizeof(opCode_RDETH_DETH_RETH_PAYLD)))
2154         return RDETH_DETH_RETH_PAYLD;
2155
2156     if(contains(OpCode, &opCode_ATOMICETH[0], (gint32)sizeof(opCode_ATOMICETH)))
2157         return ATOMICETH;
2158
2159     if(contains(OpCode, &opCode_IETH_PAYLD[0], (gint32)sizeof(opCode_IETH_PAYLD)))
2160         return IETH_PAYLD;
2161
2162     if(contains(OpCode, &opCode_RDETH_DETH_ATOMICETH[0], (gint32)sizeof(opCode_RDETH_DETH_ATOMICETH)))
2163         return RDETH_DETH_ATOMICETH;
2164
2165     if((OpCode ^ RC_ACKNOWLEDGE) == 0)
2166         return AETH;
2167
2168     if((OpCode ^ RC_RDMA_READ_REQUEST) == 0)
2169         return RETH;
2170
2171     if((OpCode ^ RC_ATOMIC_ACKNOWLEDGE) == 0)
2172         return AETH_ATOMICACKETH;
2173
2174     if((OpCode ^ RD_RDMA_READ_RESPONSE_MIDDLE) == 0)
2175         return RDETH_PAYLD;
2176
2177     if((OpCode ^ RD_ACKNOWLEDGE) == 0)
2178         return RDETH_AETH;
2179
2180     if((OpCode ^ RD_ATOMIC_ACKNOWLEDGE) == 0)
2181         return RDETH_AETH_ATOMICACKETH;
2182
2183     if((OpCode ^ RD_RDMA_WRITE_ONLY_IMM) == 0)
2184         return RDETH_DETH_RETH_IMMDT_PAYLD;
2185
2186     if((OpCode ^ RD_RDMA_READ_REQUEST) == 0)
2187         return RDETH_DETH_RETH;
2188
2189     if((OpCode ^ RD_RESYNC) == 0)
2190         return RDETH_DETH;
2191
2192     if((OpCode ^ UD_SEND_ONLY) == 0)
2193         return DETH_PAYLD;
2194
2195     if((OpCode ^ UD_SEND_ONLY_IMM) == 0)
2196         return DETH_IMMDT_PAYLD;
2197
2198     return -1;
2199 }
2200
2201 /* Description: Finds if a given value is present in an array. This is probably in a standard library somewhere,
2202 * But I'd rather define my own.
2203 * IN: OpCode: The OpCode you are looking for
2204 * IN: Codes: The organized array of OpCodes to look through
2205 * IN: Array length, because we're in C++...
2206 * OUT: Boolean indicating if that OpCode was found in OpCodes */
2207 static gboolean
2208 contains(guint32 OpCode, guint32* Codes, gint32 length)
2209 {
2210     gint32 i;
2211     for(i = 0; i < length; i++)
2212     {
2213         if((OpCode ^ Codes[i]) == 0)
2214             return TRUE;
2215     }
2216     return FALSE;
2217 }
2218
2219 /* Parse RDETH - Reliable Datagram Extended Transport Header
2220 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2221 * IN: tvb - the data buffer from wireshark
2222 * IN/OUT: The current and updated offset */
2223 static void
2224 parse_RDETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2225 {
2226     gint local_offset = *offset;
2227     /* RDETH - Reliable Datagram Extended Transport Header */
2228     proto_tree *RDETH_header_tree = NULL;
2229     proto_item *RDETH_header_item = NULL;
2230
2231     RDETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_RDETH, tvb, local_offset, 4, FALSE);
2232     proto_item_set_text(RDETH_header_item, "%s", "RDETH - Reliable Datagram Extended Transport Header");
2233     RDETH_header_tree = proto_item_add_subtree(RDETH_header_item, ett_rdeth);
2234
2235     proto_tree_add_item(RDETH_header_tree, hf_infiniband_reserved8_RDETH,   tvb, local_offset, 1, FALSE); local_offset+=1;
2236     proto_tree_add_item(RDETH_header_tree, hf_infiniband_ee_context,        tvb, local_offset, 3, FALSE); local_offset+=3;
2237     *offset = local_offset;
2238 }
2239
2240 /* Parse DETH - Datagram Extended Transport Header
2241 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2242 * IN: tvb - the data buffer from wireshark
2243 * IN/OUT: The current and updated offset  */
2244 static void
2245 parse_DETH(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
2246 {
2247     gint local_offset = *offset;
2248     /* DETH - Datagram Extended Transport Header */
2249     proto_tree *DETH_header_tree = NULL;
2250     proto_item *DETH_header_item = NULL;
2251
2252     DETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_DETH, tvb, local_offset, 8, FALSE);
2253     proto_item_set_text(DETH_header_item, "%s", "DETH - Datagram Extended Transport Header");
2254     DETH_header_tree = proto_item_add_subtree(DETH_header_item, ett_deth);
2255
2256     proto_tree_add_item(DETH_header_tree, hf_infiniband_queue_key,                  tvb, local_offset, 4, FALSE); local_offset+=4;
2257     proto_tree_add_item(DETH_header_tree, hf_infiniband_reserved8_DETH,             tvb, local_offset, 1, FALSE); local_offset+=1;
2258     proto_tree_add_item(DETH_header_tree, hf_infiniband_source_qp,                  tvb, local_offset, 3, FALSE);
2259     pinfo->srcport = tvb_get_ntoh24(tvb, local_offset); local_offset+=3;
2260
2261     *offset = local_offset;
2262 }
2263
2264 /* Parse RETH - RDMA Extended Transport Header
2265 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2266 * IN: tvb - the data buffer from wireshark
2267 * IN/OUT: The current and updated offset */
2268 static void
2269 parse_RETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2270 {
2271     gint local_offset = *offset;
2272     /* RETH - RDMA Extended Transport Header */
2273     proto_tree *RETH_header_tree = NULL;
2274     proto_item *RETH_header_item = NULL;
2275
2276     RETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_RETH, tvb, local_offset, 16, FALSE);
2277     proto_item_set_text(RETH_header_item, "%s", "RETH - RDMA Extended Transport Header");
2278     RETH_header_tree = proto_item_add_subtree(RETH_header_item, ett_reth);
2279
2280     proto_tree_add_item(RETH_header_tree, hf_infiniband_virtual_address,                tvb, local_offset, 8, FALSE); local_offset+=8;
2281     proto_tree_add_item(RETH_header_tree, hf_infiniband_remote_key,                     tvb, local_offset, 4, FALSE); local_offset+=4;
2282     proto_tree_add_item(RETH_header_tree, hf_infiniband_dma_length,                     tvb, local_offset, 4, FALSE); local_offset+=4;
2283
2284     *offset = local_offset;
2285 }
2286
2287 /* Parse AtomicETH - Atomic Extended Transport Header
2288 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2289 * IN: tvb - the data buffer from wireshark
2290 * IN/OUT: The current and updated offset */
2291 static void
2292 parse_ATOMICETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2293 {
2294     gint local_offset = *offset;
2295     /* AtomicETH - Atomic Extended Transport Header */
2296     proto_tree *ATOMICETH_header_tree = NULL;
2297     proto_item *ATOMICETH_header_item = NULL;
2298
2299     ATOMICETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AtomicETH, tvb, local_offset, 28, FALSE);
2300     proto_item_set_text(ATOMICETH_header_item, "%s", "AtomicETH - Atomic Extended Transport Header");
2301     ATOMICETH_header_tree = proto_item_add_subtree(ATOMICETH_header_item, ett_atomiceth);
2302
2303     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_virtual_address,               tvb, local_offset, 8, FALSE); local_offset+=8;
2304     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_remote_key,                    tvb, local_offset, 4, FALSE); local_offset+=4;
2305     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_swap_or_add_data,              tvb, local_offset, 8, FALSE); local_offset+=8;
2306     proto_tree_add_item(ATOMICETH_header_tree, hf_infiniband_compare_data,                  tvb, local_offset, 8, FALSE); local_offset+=8;
2307     *offset = local_offset;
2308 }
2309
2310 /* Parse AETH - ACK Extended Transport Header
2311 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2312 * IN: tvb - the data buffer from wireshark
2313 * IN/OUT: The current and updated offset */
2314 static void
2315 parse_AETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2316 {
2317     gint local_offset = *offset;
2318     /* AETH - ACK Extended Transport Header */
2319     proto_tree *AETH_header_tree = NULL;
2320     proto_item *AETH_header_item = NULL;
2321
2322     AETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AETH, tvb, local_offset, 4, FALSE);
2323     proto_item_set_text(AETH_header_item, "%s", "AETH - ACK Extended Transport Header");
2324     AETH_header_tree = proto_item_add_subtree(AETH_header_item, ett_aeth);
2325
2326     proto_tree_add_item(AETH_header_tree, hf_infiniband_syndrome,                       tvb, local_offset, 1, FALSE); local_offset+=1;
2327     proto_tree_add_item(AETH_header_tree, hf_infiniband_message_sequence_number,        tvb, local_offset, 3, FALSE); local_offset+=3;
2328
2329     *offset = local_offset;
2330 }
2331
2332 /* Parse AtomicAckEth - Atomic ACK Extended Transport Header
2333 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2334 * IN: tvb - the data buffer from wireshark
2335 * IN/OUT: The current and updated offset */
2336 static void
2337 parse_ATOMICACKETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2338 {
2339     gint local_offset = *offset;
2340     /* AtomicAckEth - Atomic ACK Extended Transport Header */
2341     proto_tree *ATOMICACKETH_header_tree = NULL;
2342     proto_item *ATOMICACKETH_header_item = NULL;
2343
2344     ATOMICACKETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_AtomicAckETH, tvb, local_offset, 8, FALSE);
2345     proto_item_set_text(ATOMICACKETH_header_item, "%s", "ATOMICACKETH - Atomic ACK Extended Transport Header");
2346     ATOMICACKETH_header_tree = proto_item_add_subtree(ATOMICACKETH_header_item, ett_atomicacketh);
2347     proto_tree_add_item(ATOMICACKETH_header_tree, hf_infiniband_original_remote_data,   tvb, local_offset, 8, FALSE); local_offset+=8;
2348     *offset = local_offset;
2349 }
2350
2351 /* Parse IMMDT - Immediate Data Extended Transport Header
2352 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2353 * IN: tvb - the data buffer from wireshark
2354 * IN/OUT: The current and updated offset */
2355 static void
2356 parse_IMMDT(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2357 {
2358     gint local_offset = *offset;
2359     /* IMMDT - Immediate Data Extended Transport Header */
2360     proto_tree *IMMDT_header_tree = NULL;
2361     proto_item *IMMDT_header_item = NULL;
2362
2363     IMMDT_header_item = proto_tree_add_item(parentTree, hf_infiniband_IMMDT, tvb, local_offset, 4, FALSE);
2364     proto_item_set_text(IMMDT_header_item, "%s", "IMMDT - Immediate Data Extended Transport Header");
2365     IMMDT_header_tree = proto_item_add_subtree(IMMDT_header_item, ett_immdt);
2366     proto_tree_add_item(IMMDT_header_tree, hf_infiniband_IMMDT, tvb, local_offset, 4, FALSE); local_offset+=4;
2367     *offset = local_offset;
2368 }
2369
2370 /* Parse IETH - Invalidate Extended Transport Header
2371 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2372 * IN: tvb - the data buffer from wireshark
2373 * IN/OUT: The current and updated offset */
2374 static void
2375 parse_IETH(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2376 {
2377     gint local_offset = *offset;
2378     /* IETH - Invalidate Extended Transport Header */
2379     proto_tree *IETH_header_tree = NULL;
2380     proto_item *IETH_header_item = NULL;
2381
2382     IETH_header_item = proto_tree_add_item(parentTree, hf_infiniband_IETH, tvb, local_offset, 4, FALSE);
2383     proto_item_set_text(IETH_header_item, "%s", "IETH - Invalidate Extended Transport Header");
2384     IETH_header_tree = proto_item_add_subtree(IETH_header_item, ett_ieth);
2385
2386     proto_tree_add_item(IETH_header_tree, hf_infiniband_IETH,   tvb, local_offset, 4, FALSE); local_offset+=4;
2387
2388     *offset = local_offset;
2389 }
2390
2391 /* Parse Payload - Packet Payload / Invariant CRC / Variant CRC
2392 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2393 * IN: pinfo - packet info from wireshark
2394 * IN: tvb - the data buffer from wireshark
2395 * IN/OUT: offset - The current and updated offset
2396 * IN: length - Length of Payload */
2397 static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset, gint length)
2398 {
2399     gint local_offset = *offset;
2400     /* Payload - Packet Payload */
2401     proto_tree *PAYLOAD_header_tree = NULL;
2402     proto_item *PAYLOAD_header_item = NULL;
2403     guint8 management_class;
2404     tvbuff_t *volatile next_tvb;
2405     gint            captured_length, reported_length;
2406     guint16 etype, reserved;
2407     const char      *saved_proto;
2408     volatile gboolean   dissector_found = FALSE;
2409
2410     if(!tvb_bytes_exist(tvb, *offset, length)) /* previously consumed bytes + offset was all the data - none or corrupt payload */
2411     {
2412         col_set_str(pinfo->cinfo, COL_INFO, "Invalid Packet Length from LRH! [Malformed Packet]");
2413         col_set_fence(pinfo->cinfo, COL_INFO);
2414         return;
2415     }
2416
2417     /* management datagrams are determined by the source/destination QPs */
2418     if (pinfo->srcport == 0 || pinfo->srcport == 1 || pinfo->destport == 0 || pinfo->destport == 1)    /* management datagram */
2419     {
2420         management_class =  tvb_get_guint8(tvb, (*offset) + 1);
2421
2422         if(((management_class >= (guint8)VENDOR_1_START) && (management_class <= (guint8)VENDOR_1_END))
2423             || ((management_class >= (guint8)VENDOR_2_START) && (management_class <= (guint8)VENDOR_2_END)))
2424         {
2425             /* parse vendor specific */
2426             parse_VENDOR_MANAGEMENT(parentTree, tvb, offset);
2427         }
2428         else if((management_class >= (guint8)APPLICATION_START) && (management_class <= (guint8)APPLICATION_END))
2429         {
2430             /* parse application specific */
2431             parse_APPLICATION_MANAGEMENT(parentTree, tvb, offset);
2432         }
2433         else if(((management_class == (guint8)0x00) || (management_class == (guint8)0x02))
2434             || ((management_class >= (guint8)0x50) && (management_class <= (guint8)0x80))
2435             || ((management_class >= (guint8)0x82)))
2436         {
2437             /* parse reserved classes */
2438             parse_RESERVED_MANAGEMENT(parentTree, tvb, offset);
2439         }
2440         else /* we have a normal management_class */
2441         {
2442             switch(management_class)
2443             {
2444                 case SUBN_LID_ROUTED:
2445                     /* parse subn man lid routed */
2446                     parse_SUBN_LID_ROUTED(parentTree, pinfo, tvb, &local_offset);
2447                 break;
2448                 case SUBN_DIRECTED_ROUTE:
2449                     /* parse subn directed route */
2450                     parse_SUBN_DIRECTED_ROUTE(parentTree, pinfo, tvb, &local_offset);
2451                 break;
2452                 case SUBNADMN:
2453                     /* parse sub admin */
2454                     parse_SUBNADMN(parentTree, pinfo, tvb, &local_offset);
2455                 break;
2456                 case PERF:
2457                     /* parse performance */
2458                     parse_PERF(parentTree, tvb, pinfo, &local_offset);
2459                 break;
2460                 case BM:
2461                     /* parse baseboard mgmt */
2462                     parse_BM(parentTree, tvb, &local_offset);
2463                 break;
2464                 case DEV_MGT:
2465                     /* parse device management */
2466                     parse_DEV_MGT(parentTree, tvb, &local_offset);
2467                 break;
2468                 case COM_MGT:
2469                     /* parse communication management */
2470                     parse_COM_MGT(parentTree, pinfo, tvb, &local_offset);
2471                 break;
2472                 case SNMP:
2473                     /* parse snmp tunneling */
2474                     parse_SNMP(parentTree, tvb, &local_offset);
2475                 break;
2476                 default:
2477                     break;
2478             }
2479         }
2480     }
2481     else /* Normal Data Packet - Parse as such */
2482     {
2483
2484         /* Calculation for Payload:
2485         * (tvb->length) Length of entire packet - (local_offset) Starting byte of Payload Data
2486         * offset addition is more complex for the payload.
2487         * We need the total length of the packet, - length of previous headers, + offset where payload started.
2488         * We also need  to reserve 6 bytes for the CRCs which are not actually part of the payload.  */
2489
2490         etype = tvb_get_ntohs(tvb, local_offset);
2491         reserved =  tvb_get_ntohs(tvb, local_offset + 2);
2492
2493         /* try to recognize whether or not this is a Mellanox EoIB packet by the
2494            transport type and the 4 first bits of the payload */
2495         if      (pref_dissect_eoib &&
2496                  transport_type == TRANSPORT_UD &&
2497                  tvb_get_bits8(tvb, local_offset*8, 4) == 0xC) {
2498             dissector_found = parse_EoIB(parentTree, tvb, local_offset, pinfo);
2499         }
2500
2501         /* IBA packet data could be anything in principle, however it is common
2502          * practice to carry non-IBA data encapsulated with an EtherType header,
2503          * similar to the RWH header. There is no way to identify these frames
2504          * positively.
2505          *
2506          * If the appropriate option is set in protocol preferences,
2507          * We see if the first few bytes look like an EtherType header, and if so
2508          * call the appropriate dissector. If not we call the "data" dissector.
2509          */
2510         if (!dissector_found && pref_identify_iba_payload && reserved == 0) {
2511             void *pd_save;
2512
2513             /* Get the captured length and reported length of the data
2514                after the Ethernet type. */
2515             captured_length = tvb_length_remaining(tvb, local_offset+4);
2516             reported_length = tvb_reported_length_remaining(tvb,
2517                                     local_offset+4);
2518
2519             next_tvb = tvb_new_subset(tvb, local_offset+4, captured_length,
2520                           reported_length);
2521
2522             pinfo->ethertype = etype;
2523
2524             /* Look for sub-dissector, and call it if found.
2525                Catch exceptions, so that if the reported length of "next_tvb"
2526                was reduced by some dissector before an exception was thrown,
2527                we can still put in an item for the trailer. */
2528             saved_proto = pinfo->current_proto;
2529             pd_save = pinfo->private_data;
2530
2531             TRY {
2532                 dissector_found = dissector_try_port(ethertype_dissector_table,
2533                                      etype, next_tvb, pinfo, top_tree);
2534             }
2535             CATCH(BoundsError) {
2536                 /* Somebody threw BoundsError, which means that:
2537
2538                 1) a dissector was found, so we don't need to
2539                 dissect the payload as data or update the
2540                 protocol or info columns;
2541
2542                 2) dissecting the payload found that the packet was
2543                 cut off by a snapshot length before the end of
2544                 the payload.  The trailer comes after the payload,
2545                 so *all* of the trailer is cut off, and we'll
2546                 just get another BoundsError if we add the trailer.
2547
2548                 Therefore, we just rethrow the exception so it gets
2549                 reported; we don't dissect the trailer or do anything
2550                 else. */
2551                 RETHROW;
2552             }
2553             CATCH(OutOfMemoryError) {
2554                 RETHROW;
2555             }
2556             CATCH_ALL {
2557                 /* Somebody threw an exception other than BoundsError, which
2558                    means that a dissector was found, so we don't need to
2559                    dissect the payload as data or update the protocol or info
2560                    columns.  We just show the exception and then drive on
2561                    to show the trailer, after noting that a dissector was
2562                    found and restoring the protocol value that was in effect
2563                    before we called the subdissector. */
2564
2565                 /*  Restore the private_data structure in case one of the
2566                  *  called dissectors modified it (and, due to the exception,
2567                  *  was unable to restore it).
2568                  */
2569                 pinfo->private_data = pd_save;
2570
2571                 show_exception(next_tvb, pinfo, top_tree, EXCEPT_CODE, GET_MESSAGE);
2572                 dissector_found = TRUE;
2573                 pinfo->current_proto = saved_proto;
2574             }
2575             ENDTRY;
2576
2577             if (dissector_found) {
2578                 /* now create payload entry to show Ethertype */
2579                 PAYLOAD_header_item = proto_tree_add_item(parentTree, hf_infiniband_payload, tvb, local_offset, tvb_reported_length_remaining(tvb, local_offset)-6, FALSE);
2580                 proto_item_set_text(PAYLOAD_header_item, "%s", "IBA Payload - appears to be EtherType encapsulated");
2581                 PAYLOAD_header_tree = proto_item_add_subtree(PAYLOAD_header_item, ett_payload);
2582                 proto_tree_add_uint(PAYLOAD_header_tree, hf_infiniband_etype, tvb,
2583                             local_offset, 2,  tvb_get_ntohs(tvb, local_offset));
2584
2585                 local_offset += 2;
2586
2587                 proto_tree_add_uint(PAYLOAD_header_tree, hf_infiniband_reserved16_RWH, tvb,
2588                             local_offset, 2, tvb_get_ntohs(tvb, local_offset));
2589
2590             }
2591
2592         }
2593
2594         captured_length = tvb_length_remaining(tvb, local_offset);
2595         reported_length = tvb_reported_length_remaining(tvb,
2596                                 local_offset);
2597
2598         if (reported_length >= 6)
2599             reported_length -= 6;
2600         if (captured_length > reported_length)
2601             captured_length = reported_length;
2602
2603         next_tvb = tvb_new_subset(tvb, local_offset,
2604                       captured_length,
2605                       reported_length);
2606
2607         /* Try any heuristic dissectors that requested a chance to try and dissect IB payloads */
2608         if (!dissector_found) {
2609             dissector_found = dissector_try_heuristic(heur_dissectors_payload, next_tvb, pinfo, parentTree);
2610         }
2611
2612         if (!dissector_found) {
2613             /* No sub-dissector found.
2614                Label rest of packet as "Data" */
2615             call_dissector(data_handle, next_tvb, pinfo, top_tree);
2616
2617         }
2618
2619
2620         /*parse_RWH(parentTree, tvb, &local_offset, pinfo);*/
2621
2622         /* Will contain ICRC and VCRC = 4+2 */
2623         local_offset = tvb_reported_length(tvb) - 6;
2624     }
2625
2626     *offset = local_offset;
2627 }
2628
2629 /* Parse VENDOR - Parse a vendor specific or unknown header sequence
2630 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2631 * IN: tvb - the data buffer from wireshark
2632 * IN/OUT: The current and updated offset */
2633 static void parse_VENDOR(proto_tree * parentTree, tvbuff_t *tvb, gint *offset)
2634 {
2635     gint local_offset = *offset;
2636     proto_tree *VENDOR_header_tree = NULL;
2637     proto_item *VENDOR_header_item = NULL;
2638
2639     VENDOR_header_item = proto_tree_add_item(parentTree, hf_infiniband_vendor, tvb, local_offset, 4, FALSE);
2640     proto_item_set_text(VENDOR_header_item, "%s", "Vendor Specific or Unknown Header Sequence");
2641     VENDOR_header_tree = proto_item_add_subtree(VENDOR_header_item, ett_vendor);
2642     proto_tree_add_item(VENDOR_header_tree, hf_infiniband_vendor,   tvb, local_offset, -1, FALSE);
2643     *offset = local_offset;
2644 }
2645
2646 /* Parse IPv6 - Parse an IPv6 Packet
2647 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2648 * IN: tvb - the data buffer from wireshark
2649 * IN/OUT: The current and updated offset
2650 * IN: pinfo - packet info from wireshark */
2651 static void parse_IPvSix(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, packet_info *pinfo)
2652 {
2653     tvbuff_t *ipv6_tvb;
2654
2655     /* (- 2) for VCRC which lives at the end of the packet   */
2656     ipv6_tvb = tvb_new_subset(tvb, *offset,
2657                   tvb_length_remaining(tvb, *offset) - 2,
2658                   tvb_reported_length_remaining(tvb, *offset) - 2);
2659     call_dissector(ipv6_handle, ipv6_tvb, pinfo, parentTree);
2660     *offset = tvb_reported_length(tvb) - 2;
2661
2662     /* Display the VCRC */
2663     proto_tree_add_item(parentTree, hf_infiniband_variant_crc,  tvb, *offset, 2, FALSE);
2664 }
2665
2666 /* Parse EtherType - Parse a generic IP packaet with an EtherType of IP or ARP
2667 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2668 * IN: tvb - the data buffer from wireshark
2669 * IN/OUT: The current and updated offset
2670 * IN: pinfo - packet info from wireshark */
2671 static void parse_RWH(proto_tree *ah_tree, tvbuff_t *tvb, gint *offset, packet_info *pinfo)
2672 {
2673     guint16 ether_type;
2674     tvbuff_t *next_tvb;
2675
2676     /* RWH - Raw Header */
2677     proto_tree *RWH_header_tree = NULL;
2678     proto_item *RWH_header_item = NULL;
2679
2680     gint captured_length, reported_length;
2681
2682     RWH_header_item = proto_tree_add_item(ah_tree, hf_infiniband_RWH, tvb, *offset, 4, FALSE);
2683     proto_item_set_text(RWH_header_item, "%s", "RWH - Raw Header");
2684     RWH_header_tree = proto_item_add_subtree(RWH_header_item, ett_rwh);
2685
2686     ether_type = tvb_get_ntohs(tvb, *offset);
2687 #if 0
2688     ether_type = ether_type & 0x0F; /* mask off reserved bits just in case. */
2689 #endif
2690     proto_tree_add_uint(RWH_header_tree, hf_infiniband_etype, tvb, *offset, 2,
2691                         ether_type);
2692     *offset += 2;
2693
2694     proto_tree_add_item(RWH_header_tree, hf_infiniband_reserved16_RWH, tvb,
2695             *offset, 2, FALSE);
2696
2697     *offset += 2;
2698
2699     /* Get the captured length and reported length of the data
2700      * after the Ethernet type. */
2701     captured_length = tvb_length_remaining(tvb, *offset);
2702     reported_length = tvb_reported_length_remaining(tvb, *offset);
2703
2704     /* Construct a tvbuff for the payload after the Ethernet type,
2705      * not including the FCS. */
2706     if (captured_length >= 0 && reported_length >= 0) {
2707         if (reported_length >= 2)
2708             reported_length -= 2;
2709         if (captured_length > reported_length)
2710             captured_length = reported_length;
2711     }
2712
2713     next_tvb = tvb_new_subset(tvb, *offset, captured_length, reported_length);
2714     if (!dissector_try_port(ethertype_dissector_table, ether_type,
2715             next_tvb, pinfo, top_tree))
2716        call_dissector(data_handle, next_tvb, pinfo, top_tree);
2717
2718     *offset = tvb_reported_length(tvb) - 2;
2719     /* Display the VCRC */
2720     proto_tree_add_item(ah_tree, hf_infiniband_variant_crc, tvb, *offset, 2, FALSE);
2721 }
2722
2723
2724 /* Parse a Mellanox EoIB Encapsulation Header and the associated Ethernet frame
2725 * IN: parentTree to add the dissection to - in this code the all_headers_tree
2726 * IN: tvb - the data buffer from wireshark
2727 * IN: The current offset
2728 * IN: pinfo - packet info from wireshark */
2729 static gboolean parse_EoIB(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo)
2730 {
2731     proto_item *header_item;
2732     proto_tree *header_subtree;
2733     gboolean ms;
2734     gint8 seg_offset;
2735     tvbuff_t *encap_tvb;
2736     /* the encapsulated eoib size (including the header!) is remaining length-6 bytes of CRC */
2737     int encap_size = tvb_reported_length_remaining(tvb, offset) - 6;
2738
2739     if (encap_size < 4) {
2740         /* not even large enough to contain the eoib encap header. error! */
2741         return FALSE;
2742     }
2743
2744     encap_tvb = tvb_new_subset(tvb, offset + 4, tvb_length_remaining(tvb, offset + 4), encap_size - 4);
2745
2746     header_item = proto_tree_add_item(tree, hf_infiniband_EOIB, tvb, offset, 4, FALSE);
2747     header_subtree = proto_item_add_subtree(header_item, ett_eoib);
2748
2749     proto_tree_add_item(header_subtree, hf_infiniband_ver, tvb, offset, 2, FALSE);
2750     proto_tree_add_item(header_subtree, hf_infiniband_tcp_chk, tvb, offset, 2, FALSE);
2751     proto_tree_add_item(header_subtree, hf_infiniband_ip_chk, tvb, offset, 2, FALSE);
2752     proto_tree_add_item(header_subtree, hf_infiniband_fcs, tvb, offset, 2, FALSE);
2753
2754     ms = tvb_get_bits8(tvb, (offset + 1)*8 + 2, 1);
2755     seg_offset = tvb_get_bits8(tvb, (offset + 1)*8 + 3, 5);
2756
2757     proto_tree_add_item(header_subtree, hf_infiniband_ms, tvb, offset, 2, FALSE);
2758     proto_tree_add_item(header_subtree, hf_infiniband_seg_off, tvb, offset, 2, FALSE); offset += 2;
2759     proto_tree_add_item(header_subtree, hf_infiniband_seg_id, tvb, offset, 2, FALSE); offset += 2;
2760
2761     if (seg_offset || ms) {
2762         /* this is a fragment of an encapsulated Ethernet jumbo frame, parse as data */
2763         call_dissector(data_handle, encap_tvb, pinfo, top_tree);
2764     } else {
2765         /* non-fragmented frames can be fully parsed */
2766         call_dissector(eth_handle, encap_tvb, pinfo, top_tree);
2767     }
2768
2769     return TRUE;
2770 }
2771
2772
2773 /* Parse Subnet Management (LID Routed)
2774 * IN: parentTree to add the dissection to
2775 * IN: pinfo - packet info from wireshark
2776 * IN: tvb - the data buffer from wireshark
2777 * IN/OUT: The current and updated offset */
2778 static void parse_SUBN_LID_ROUTED(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
2779 {
2780     /* Parse the Common MAD Header */
2781     MAD_Data MadData;
2782     gint local_offset;
2783     proto_tree *SUBN_LID_ROUTED_header_tree = NULL;
2784     proto_item *SUBN_LID_ROUTED_header_item = NULL;
2785
2786     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2787     {
2788         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2789         return;
2790     }
2791
2792     local_offset = *offset;
2793
2794     /* local_offset - 24 here because when we come out of parse_MAD_Common, the offset it sitting at the data section. */
2795     SUBN_LID_ROUTED_header_item = proto_tree_add_item(parentTree, hf_infiniband_SMP_LID, tvb, local_offset - 24, 256, FALSE);
2796     proto_item_set_text(SUBN_LID_ROUTED_header_item, "%s", "SMP (LID Routed) ");
2797     SUBN_LID_ROUTED_header_tree = proto_item_add_subtree(SUBN_LID_ROUTED_header_item, ett_subn_lid_routed);
2798     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_m_key,           tvb, local_offset, 8, FALSE); local_offset +=8;
2799     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_reserved256,     tvb, local_offset, 32, FALSE); local_offset +=32;
2800
2801     label_SUBM_Method(SUBN_LID_ROUTED_header_item, &MadData, pinfo);
2802     label_SUBM_Attribute(SUBN_LID_ROUTED_header_item, &MadData, pinfo);
2803
2804     /* 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. */
2805     if(!parse_SUBM_Attribute(SUBN_LID_ROUTED_header_tree, tvb, &local_offset, &MadData))
2806     {
2807         proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_smp_data,    tvb, local_offset, 64, FALSE); local_offset +=64;
2808     }
2809
2810     proto_tree_add_item(SUBN_LID_ROUTED_header_tree, hf_infiniband_reserved1024,    tvb, local_offset, 128, FALSE); local_offset +=128;
2811     *offset = local_offset;
2812 }
2813
2814 /* Parse Subnet Management (Directed Route)
2815 * IN: parentTree to add the dissection to
2816 * IN: tvb - the data buffer from wireshark
2817 * IN/OUT: The current and updated offset */
2818 static void parse_SUBN_DIRECTED_ROUTE(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
2819 {
2820     /* Parse the Common MAD Header */
2821     MAD_Data MadData;
2822     gint local_offset;
2823     proto_tree *SUBN_DIRECTED_ROUTE_header_tree = NULL;
2824     proto_item *SUBN_DIRECTED_ROUTE_header_item = NULL;
2825
2826     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2827     {
2828         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2829         return;
2830     }
2831
2832     local_offset = *offset;
2833
2834     /* local_offset - 24 here because when we come out of parse_MAD_Common, the offset it sitting at the data section.
2835     * We need to go backwards because this particular SMP uses the class specific portion of the Common MAD Header */
2836     SUBN_DIRECTED_ROUTE_header_item = proto_tree_add_item(parentTree, hf_infiniband_SMP_DIRECTED, tvb, local_offset - 24, 256, FALSE);
2837     proto_item_set_text(SUBN_DIRECTED_ROUTE_header_item, "%s", "SMP (Directed Route) ");
2838     SUBN_DIRECTED_ROUTE_header_tree = proto_item_add_subtree(SUBN_DIRECTED_ROUTE_header_item, ett_subn_directed_route);
2839
2840     label_SUBM_Method(SUBN_DIRECTED_ROUTE_header_item, &MadData, pinfo);
2841     label_SUBM_Attribute(SUBN_DIRECTED_ROUTE_header_item, &MadData, pinfo);
2842
2843     /* Place us at offset 4, the "D" Bit (Direction bit for Directed Route SMPs) */
2844     local_offset -= 20;
2845     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_d,               tvb, local_offset, 1, FALSE);
2846     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_smp_status,      tvb, local_offset, 2, FALSE); local_offset +=2;
2847     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_hop_pointer,     tvb, local_offset, 1, FALSE); local_offset +=1;
2848     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_hop_count,       tvb, local_offset, 1, FALSE); local_offset +=1;
2849     local_offset += 16; /* Skip over the rest of the Common MAD Header... It's already dissected by parse_MAD_Common */
2850     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_m_key,           tvb, local_offset, 8, FALSE); local_offset +=8;
2851     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_dr_slid,         tvb, local_offset, 2, FALSE); local_offset +=2;
2852     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_dr_dlid,         tvb, local_offset, 2, FALSE); local_offset +=2;
2853     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_reserved28,      tvb, local_offset, 28, FALSE); local_offset +=28;
2854
2855     /* 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. */
2856     if(!parse_SUBM_Attribute(SUBN_DIRECTED_ROUTE_header_tree, tvb, &local_offset, &MadData))
2857     {
2858         proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_smp_data,    tvb, local_offset, 64, FALSE); local_offset +=64;
2859     }
2860
2861     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_initial_path,        tvb, local_offset, 64, FALSE); local_offset +=64;
2862     proto_tree_add_item(SUBN_DIRECTED_ROUTE_header_tree, hf_infiniband_return_path,     tvb, local_offset, 64, FALSE); local_offset +=64;
2863     *offset = local_offset;
2864 }
2865
2866 /* Parse Subnet Administration
2867 * IN: parentTree to add the dissection to
2868 * IN: pinfo - packet info from wireshark
2869 * IN: tvb - the data buffer from wireshark
2870 * IN/OUT: The current and updated offset */
2871 static void parse_SUBNADMN(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
2872 {
2873     /* Parse the Common MAD Header */
2874     MAD_Data MadData;
2875     gint local_offset;
2876     proto_tree *SUBNADMN_header_tree = NULL;
2877     proto_item *SUBNADMN_header_item = NULL;
2878
2879     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2880     {
2881         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2882         return;
2883     }
2884     if(!parse_RMPP(parentTree, tvb, offset))
2885     {
2886         /* TODO: Mark Corrupt Packet */
2887         return;
2888     }
2889     local_offset = *offset;
2890
2891     SUBNADMN_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset - 36, 256, FALSE);
2892     proto_item_set_text(SUBNADMN_header_item, "%s", "SMA");
2893     SUBNADMN_header_tree = proto_item_add_subtree(SUBNADMN_header_item, ett_subnadmin);
2894
2895     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_sm_key,             tvb, local_offset, 8, FALSE); local_offset+=8;
2896     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_attribute_offset,   tvb, local_offset, 2, FALSE); local_offset+=4;
2897     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_reserved16,         tvb, local_offset, 2, FALSE); local_offset+=4;
2898     proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_component_mask,     tvb, local_offset, 8, FALSE); local_offset+=8;
2899
2900     label_SUBA_Method(SUBNADMN_header_item, &MadData, pinfo);
2901     label_SUBA_Attribute(SUBNADMN_header_item, &MadData, pinfo);
2902
2903     if(!parse_SUBA_Attribute(SUBNADMN_header_tree, tvb, &local_offset, &MadData))
2904     {
2905         proto_tree_add_item(SUBNADMN_header_tree, hf_infiniband_subnet_admin_data,  tvb, local_offset, 200, FALSE); local_offset+=200;
2906     }
2907     *offset = local_offset;
2908 }
2909
2910 /* Parse Performance Management
2911 * IN: parentTree to add the dissection to
2912 * IN: tvb - the data buffer from wireshark
2913 * IN: pinfo - the pinfo struct from wireshark
2914 * IN/OUT: The current and updated offset */
2915 static void parse_PERF(proto_tree *parentTree, tvbuff_t *tvb, packet_info *pinfo, gint *offset)
2916 {
2917     /* Parse the Common MAD Header */
2918     MAD_Data MadData;
2919     gint local_offset;
2920     proto_item *PERF_header_item = NULL;
2921
2922     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2923     {
2924         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2925         return;
2926     }
2927
2928     local_offset = *offset; /* offset now points to the start of the MAD data field */
2929
2930     switch (MadData.attributeID) {
2931         case ATTR_PORT_COUNTERS:
2932             parse_PERF_PortCounters(parentTree, tvb, pinfo, &local_offset);
2933             break;
2934         case ATTR_PORT_COUNTERS_EXT:
2935             parse_PERF_PortCountersExtended(parentTree, tvb, pinfo, &local_offset);
2936             break;
2937         default:
2938             PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
2939             proto_item_set_text(PERF_header_item, "%s", "PERF - Performance Management MAD (Dissector Not Implemented)");
2940             break;
2941     }
2942
2943     *offset = local_offset;
2944 }
2945
2946 /* Parse Baseboard Management
2947 * IN: parentTree to add the dissection to
2948 * IN: tvb - the data buffer from wireshark
2949 * IN/OUT: The current and updated offset */
2950 static void parse_BM(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
2951 {
2952     /* Parse the Common MAD Header */
2953     MAD_Data MadData;
2954     gint local_offset;
2955     proto_item *PERF_header_item = NULL;
2956
2957     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2958     {
2959         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2960         return;
2961     }
2962     local_offset = *offset;
2963
2964     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
2965     proto_item_set_text(PERF_header_item, "%s", "BM - Baseboard Management MAD (Dissector Not Implemented)");
2966     *offset = local_offset;
2967 }
2968
2969 /* Parse Device Management
2970 * IN: parentTree to add the dissection to
2971 * IN: tvb - the data buffer from wireshark
2972 * IN/OUT: The current and updated offset */
2973 static void parse_DEV_MGT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
2974 {
2975     /* Parse the Common MAD Header */
2976     MAD_Data MadData;
2977     gint local_offset;
2978     proto_item *PERF_header_item = NULL;
2979
2980     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
2981     {
2982         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
2983         return;
2984     }
2985     local_offset = *offset;
2986     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
2987     proto_item_set_text(PERF_header_item, "%s", "DEV_MGT - Device Management MAD (Dissector Not Implemented)");
2988     *offset = local_offset;
2989 }
2990
2991 /* Parse Communications Management
2992 * IN: parentTree to add the dissection to
2993 * IN: tvb - the data buffer from wireshark
2994 * IN/OUT: The current and updated offset */
2995 static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
2996 {
2997     MAD_Data MadData;
2998     gint local_offset;
2999     guint32 local_qpn = 0, remote_qpn = 0;
3000     guint8 *local_gid, *remote_gid;
3001     guint32 local_lid, remote_lid;
3002     guint64 serviceid;
3003     const char *label = NULL;
3004     proto_item *CM_header_item = NULL;
3005     proto_tree *CM_header_tree = NULL;
3006     connection_context *connection = NULL; /* we'll use this to store new connections this CM packet is establishing*/
3007     tvbuff_t *next_tvb;
3008
3009     local_gid = ep_alloc(GID_SIZE);
3010     remote_gid = ep_alloc(GID_SIZE);
3011
3012     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
3013     {
3014         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
3015         return;
3016     }
3017     local_offset = *offset;
3018
3019     CM_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 140, FALSE);
3020
3021     label = val_to_str(MadData.attributeID, CM_Attributes, "(Unknown CM Attribute)");
3022
3023     proto_item_set_text(CM_header_item, "CM %s", label);
3024     col_clear(pinfo->cinfo, COL_INFO);
3025     col_append_fstr(pinfo->cinfo, COL_INFO, "CM: %s", label);
3026
3027     CM_header_tree = proto_item_add_subtree(CM_header_item, ett_cm);
3028
3029     switch (MadData.attributeID) {
3030         case ATTR_CM_REQ:
3031             proto_tree_add_item(CM_header_tree, hf_cm_req_local_comm_id, tvb, local_offset, 4, FALSE); local_offset += 4;
3032             local_offset += 4;  /* skip reserved */
3033             proto_tree_add_item(CM_header_tree, hf_cm_req_service_id, tvb, local_offset, 8, FALSE);
3034             serviceid = tvb_get_ntoh64(tvb, local_offset); local_offset += 8;
3035             proto_tree_add_item(CM_header_tree, hf_cm_req_local_ca_guid, tvb, local_offset, 8, FALSE); local_offset += 8;
3036             local_offset += 4;  /* skip reserved */
3037             proto_tree_add_item(CM_header_tree, hf_cm_req_local_qkey, tvb, local_offset, 4, FALSE); local_offset += 4;
3038             proto_tree_add_item(CM_header_tree, hf_cm_req_local_qpn, tvb, local_offset, 3, FALSE);
3039             local_qpn = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
3040             proto_tree_add_item(CM_header_tree, hf_cm_req_respo_res, tvb, local_offset, 1, FALSE); local_offset += 1;
3041             proto_tree_add_item(CM_header_tree, hf_cm_req_local_eecn, tvb, local_offset, 3, FALSE); local_offset += 3;
3042             proto_tree_add_item(CM_header_tree, hf_cm_req_init_depth, tvb, local_offset, 1, FALSE); local_offset += 1;
3043             proto_tree_add_item(CM_header_tree, hf_cm_req_remote_eecn, tvb, local_offset, 3, FALSE); local_offset += 3;
3044             proto_tree_add_item(CM_header_tree, hf_cm_req_remote_cm_resp_to, tvb, local_offset, 1, FALSE);
3045             proto_tree_add_item(CM_header_tree, hf_cm_req_transp_serv_type, tvb, local_offset, 1, FALSE);
3046             proto_tree_add_item(CM_header_tree, hf_cm_req_e2e_flow_ctrl, tvb, local_offset, 1, FALSE); local_offset += 1;
3047             proto_tree_add_item(CM_header_tree, hf_cm_req_start_psn, tvb, local_offset, 3, FALSE); local_offset += 3;
3048             proto_tree_add_item(CM_header_tree, hf_cm_req_local_cm_resp_to, tvb, local_offset, 1, FALSE);
3049             proto_tree_add_item(CM_header_tree, hf_cm_req_retry_count, tvb, local_offset, 1, FALSE); local_offset += 1;
3050             proto_tree_add_item(CM_header_tree, hf_cm_req_pkey, tvb, local_offset, 2, FALSE); local_offset += 2;
3051             proto_tree_add_item(CM_header_tree, hf_cm_req_path_pp_mtu, tvb, local_offset, 1, FALSE);
3052             proto_tree_add_item(CM_header_tree, hf_cm_req_rdc_exists, tvb, local_offset, 1, FALSE);
3053             proto_tree_add_item(CM_header_tree, hf_cm_req_rnr_retry_count, tvb, local_offset, 1, FALSE); local_offset += 1;
3054             proto_tree_add_item(CM_header_tree, hf_cm_req_max_cm_retries, tvb, local_offset, 1, FALSE);
3055             proto_tree_add_item(CM_header_tree, hf_cm_req_srq, tvb, local_offset, 1, FALSE);
3056             local_offset += 1;  /* skip reserved */
3057             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_lid, tvb, local_offset, 2, FALSE);
3058             local_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
3059             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_lid, tvb, local_offset, 2, FALSE);
3060             remote_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
3061             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_gid, tvb, local_offset, 16, FALSE);
3062             tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)local_gid); local_offset += 16;
3063             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_gid, tvb, local_offset, 16, FALSE);
3064             tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)remote_gid); local_offset += 16;
3065             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_flow_label, tvb, local_offset, 2, FALSE); local_offset += 2;
3066             local_offset += 1;  /* skip reserved */
3067             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_packet_rate, tvb, local_offset, 1, FALSE); local_offset += 1;
3068             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_traffic_class, tvb, local_offset, 1, FALSE); local_offset += 1;
3069             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_hop_limit, tvb, local_offset, 1, FALSE); local_offset += 1;
3070             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_sl, tvb, local_offset, 1, FALSE);
3071             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_subnet_local, tvb, local_offset, 1, FALSE);
3072             local_offset += 1;  /* skip reserved */
3073             proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_ack_to, tvb, local_offset, 1, FALSE);
3074             local_offset += 1;  /* skip reserved */
3075             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_lid, tvb, local_offset, 2, FALSE); local_offset += 2;
3076             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_lid, tvb, local_offset, 2, FALSE); local_offset += 2;
3077             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_gid, tvb, local_offset, 16, FALSE); local_offset += 16;
3078             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_gid, tvb, local_offset, 16, FALSE); local_offset += 16;
3079             proto_tree_add_item(CM_header_tree, hf_cm_req_flow_label, tvb, local_offset, 2, FALSE); local_offset += 2;
3080             local_offset += 1;  /* skip reserved */
3081             proto_tree_add_item(CM_header_tree, hf_cm_req_packet_rate, tvb, local_offset, 1, FALSE); local_offset += 1;
3082             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_traffic_class, tvb, local_offset, 1, FALSE); local_offset += 1;
3083             proto_tree_add_item(CM_header_tree, hf_cm_req_alt_hop_limit, tvb, local_offset, 1, FALSE); local_offset += 1;
3084             proto_tree_add_item(CM_header_tree, hf_cm_req_SL, tvb, local_offset, 1, FALSE);
3085             proto_tree_add_item(CM_header_tree, hf_cm_req_subnet_local, tvb, local_offset, 1, FALSE);
3086             local_offset += 1;  /* skip reserved */
3087             proto_tree_add_item(CM_header_tree, hf_cm_req_local_ACK_timeout, tvb, local_offset, 1, FALSE);
3088             local_offset += 1;  /* skip reserved */
3089
3090             /* the following saves information about the conversation this packet defines,
3091                so there's no point in doing it more than once per packet */
3092             if(!pinfo->fd->flags.visited)
3093             {
3094                 conversation_t *conv;
3095                 conversation_infiniband_data *proto_data = NULL;
3096                 guint64 *hash_key = g_malloc(sizeof(hash_key));
3097
3098                 /* create a new connection context and store it in the hash table */
3099                 connection = g_malloc(sizeof(connection_context));
3100                 memcpy(&(connection->req_gid), local_gid, GID_SIZE);
3101                 memcpy(&(connection->resp_gid), remote_gid, GID_SIZE);
3102                 connection->req_lid = local_lid;
3103                 connection->resp_lid = remote_lid;
3104                 connection->req_qp = local_qpn;
3105                 connection->resp_qp = 0;   /* not currently known. we'll fill this in later */
3106                 connection->service_id = serviceid;
3107
3108                 /* save the context to the context hash table, for retrieval when the corresponding
3109                    CM REP message arrives*/
3110                 *hash_key = MadData.transactionID;
3111                 ADD_ADDRESS_TO_HASH(*hash_key, &pinfo->src);
3112                 g_hash_table_replace(CM_context_table, hash_key, connection);
3113
3114                 /* Now we create a conversation for the CM exchange. This uses both
3115                    sides of the conversation since CM packets also include the source
3116                    QPN */
3117                 proto_data = se_alloc(sizeof(conversation_infiniband_data));
3118                 proto_data->service_id = connection->service_id;
3119
3120                 conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
3121                                         PT_IBQP, pinfo->srcport, pinfo->destport, 0);
3122                 conversation_add_proto_data(conv, proto_infiniband, proto_data);
3123             }
3124
3125             /* give a chance for subdissectors to analyze the private data */
3126             next_tvb = tvb_new_subset(tvb, local_offset, 92, -1);
3127             if (! dissector_try_heuristic(heur_dissectors_cm_private, next_tvb, pinfo, parentTree) )
3128                 /* if none reported success, add this as raw "data" */
3129                 proto_tree_add_item(CM_header_tree, hf_cm_req_private_data, tvb, local_offset, 92, FALSE);
3130
3131             local_offset += 92;
3132             break;
3133         case ATTR_CM_REP:
3134             proto_tree_add_item(CM_header_tree, hf_cm_rep_localcommid, tvb, local_offset, 4, FALSE); local_offset += 4;
3135             proto_tree_add_item(CM_header_tree, hf_cm_rep_remotecommid, tvb, local_offset, 4, FALSE); local_offset += 4;
3136             proto_tree_add_item(CM_header_tree, hf_cm_rep_localqkey, tvb, local_offset, 4, FALSE); local_offset += 4;
3137             proto_tree_add_item(CM_header_tree, hf_cm_rep_localqpn, tvb, local_offset, 3, FALSE);
3138             remote_qpn = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
3139             local_offset += 1;  /* skip reserved */
3140             proto_tree_add_item(CM_header_tree, hf_cm_rep_localeecontnum, tvb, local_offset, 3, FALSE); local_offset += 3;
3141             local_offset += 1;  /* skip reserved */
3142             proto_tree_add_item(CM_header_tree, hf_cm_rep_startingpsn, tvb, local_offset, 3, FALSE); local_offset += 3;
3143             local_offset += 1;  /* skip reserved */
3144             proto_tree_add_item(CM_header_tree, hf_cm_rep_responderres, tvb, local_offset, 1, FALSE); local_offset += 1;
3145             proto_tree_add_item(CM_header_tree, hf_cm_rep_initiatordepth, tvb, local_offset, 1, FALSE); local_offset += 1;
3146             proto_tree_add_item(CM_header_tree, hf_cm_rep_tgtackdelay, tvb, local_offset, 1, FALSE);
3147             proto_tree_add_item(CM_header_tree, hf_cm_rep_failoveracc, tvb, local_offset, 1, FALSE);
3148             proto_tree_add_item(CM_header_tree, hf_cm_rep_e2eflowctl, tvb, local_offset, 1, FALSE); local_offset += 1;
3149             proto_tree_add_item(CM_header_tree, hf_cm_rep_rnrretrycount, tvb, local_offset, 1, FALSE);
3150             proto_tree_add_item(CM_header_tree, hf_cm_rep_srq, tvb, local_offset, 1, FALSE);
3151             local_offset += 1;  /* skip reserved */
3152             proto_tree_add_item(CM_header_tree, hf_cm_rep_localcaguid, tvb, local_offset, 8, FALSE); local_offset += 8;
3153
3154             /* the following saves information about the conversation this packet defines,
3155                so there's no point in doing it more than once per packet */
3156             if(!pinfo->fd->flags.visited)
3157             {
3158                 /* get the previously saved context for this connection */
3159                 guint64 hash_key;
3160                 hash_key = MadData.transactionID;
3161                 ADD_ADDRESS_TO_HASH(hash_key, &pinfo->dst);
3162                 connection = g_hash_table_lookup(CM_context_table, &hash_key);
3163
3164                 /* if an appropriate connection was not found there's something wrong, but nothing we can
3165                    do about it here - so just skip saving the context */
3166                 if(connection)
3167                 {
3168                     address req_addr,
3169                             resp_addr;  /* we'll fill these in and pass them to conversation_new */
3170                     conversation_t *conv;
3171                     conversation_infiniband_data *proto_data = NULL;
3172
3173                     connection->resp_qp = remote_qpn;
3174
3175                     proto_data = se_alloc(sizeof(conversation_infiniband_data));
3176                     proto_data->service_id = connection->service_id;
3177
3178                     /* RC traffic never(?) includes a field indicating the source QPN, so
3179                        the destination host knows it only from previous context (a single
3180                        QPN on the host that is part of an RC can only receive traffic from
3181                        that RC). For this reason we do not register conversations with both
3182                        sides, but rather we register the same conversation twice - once for
3183                        each side of the Reliable Connection. */
3184
3185                     /* first register the conversation using the GIDs */
3186                     SET_ADDRESS(&req_addr, AT_IB, GID_SIZE, connection->req_gid);
3187                     SET_ADDRESS(&resp_addr, AT_IB, GID_SIZE, connection->resp_gid);
3188
3189                     conv = conversation_new(pinfo->fd->num, &req_addr, &req_addr,
3190                                             PT_IBQP, connection->req_qp, connection->req_qp, NO_ADDR2|NO_PORT2);
3191                     conversation_add_proto_data(conv, proto_infiniband, proto_data);
3192                     conv = conversation_new(pinfo->fd->num, &resp_addr, &resp_addr,
3193                                             PT_IBQP, connection->resp_qp, connection->resp_qp, NO_ADDR2|NO_PORT2);
3194                     conversation_add_proto_data(conv, proto_infiniband, proto_data);
3195
3196                     /* next, register the conversation using the LIDs */
3197                     SET_ADDRESS(&req_addr, AT_IB, sizeof(guint16), &(connection->req_lid));
3198                     SET_ADDRESS(&resp_addr, AT_IB, sizeof(guint16), &(connection->resp_lid));
3199
3200                     conv = conversation_new(pinfo->fd->num, &req_addr, &req_addr,
3201                                             PT_IBQP, connection->req_qp, connection->req_qp, NO_ADDR2|NO_PORT2);
3202                     conversation_add_proto_data(conv, proto_infiniband, proto_data);
3203                     conv = conversation_new(pinfo->fd->num, &resp_addr, &resp_addr,
3204                                             PT_IBQP, connection->resp_qp, connection->resp_qp, NO_ADDR2|NO_PORT2);
3205                     conversation_add_proto_data(conv, proto_infiniband, proto_data);
3206
3207                     g_hash_table_remove(CM_context_table, &hash_key);
3208                 }
3209             }
3210
3211             /* give a chance for subdissectors to get the private data */
3212             next_tvb = tvb_new_subset(tvb, local_offset, 196, -1);
3213             if (! dissector_try_heuristic(heur_dissectors_cm_private, next_tvb, pinfo, parentTree) )
3214                 /* if none reported success, add this as raw "data" */
3215                 proto_tree_add_item(CM_header_tree, hf_cm_rep_privatedata, tvb, local_offset, 196, FALSE);
3216
3217             local_offset += 196;
3218             break;
3219         case ATTR_CM_RTU:
3220             proto_tree_add_item(CM_header_tree, hf_cm_rtu_localcommid, tvb, local_offset, 4, FALSE); local_offset += 4;
3221             proto_tree_add_item(CM_header_tree, hf_cm_rtu_remotecommid, tvb, local_offset, 4, FALSE); local_offset += 4;
3222             /* currently only REQ/REP call subdissectors for the private data */
3223             proto_tree_add_item(CM_header_tree, hf_cm_rtu_privatedata, tvb, local_offset, 224, FALSE); local_offset += 224;
3224             break;
3225         case ATTR_CM_REJ:
3226             proto_tree_add_item(CM_header_tree, hf_cm_rej_local_commid, tvb, local_offset, 4, FALSE); local_offset += 4;
3227             proto_tree_add_item(CM_header_tree, hf_cm_rej_remote_commid, tvb, local_offset, 4, FALSE); local_offset += 4;
3228             proto_tree_add_item(CM_header_tree, hf_cm_rej_msg_rej, tvb, local_offset, 1, FALSE);
3229             local_offset += 1;  /* skip reserved */
3230             proto_tree_add_item(CM_header_tree, hf_cm_rej_rej_info_len, tvb, local_offset, 1, FALSE);
3231             local_offset += 1;  /* skip reserved */
3232             proto_tree_add_item(CM_header_tree, hf_cm_rej_reason, tvb, local_offset, 2, FALSE); local_offset += 2;
3233             proto_tree_add_item(CM_header_tree, hf_cm_rej_add_rej_info, tvb, local_offset, 72, FALSE); local_offset += 72;
3234             /* currently only REQ/REP call subdissectors for the private data */
3235             proto_tree_add_item(CM_header_tree, hf_cm_rej_private_data, tvb, local_offset, 148, FALSE); local_offset += 148;
3236             break;
3237         default:
3238             proto_item_append_text(CM_header_item, " (Dissector Not Implemented)"); local_offset += MAD_DATA_SIZE;
3239             break;
3240     }
3241
3242     *offset = local_offset;
3243 }
3244
3245 /* Parse SNMP Tunneling
3246 * IN: parentTree to add the dissection to
3247 * IN: tvb - the data buffer from wireshark
3248 * IN/OUT: The current and updated offset */
3249 static void parse_SNMP(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
3250 {
3251     /* Parse the Common MAD Header */
3252     MAD_Data MadData;
3253     gint local_offset;
3254     proto_item *PERF_header_item = NULL;
3255
3256     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
3257     {
3258         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
3259         return;
3260     }
3261     local_offset = *offset;
3262
3263     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
3264     proto_item_set_text(PERF_header_item, "%s", "SNMP - SNMP Tunneling MAD (Dissector Not Implemented)");
3265     *offset = local_offset;
3266 }
3267
3268 /* Parse Vendor Specific Management Packets
3269 * IN: parentTree to add the dissection to
3270 * IN: tvb - the data buffer from wireshark
3271 * IN/OUT: The current and updated offset */
3272 static void parse_VENDOR_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
3273 {
3274     /* Parse the Common MAD Header */
3275     MAD_Data MadData;
3276     gint local_offset;
3277     proto_item *PERF_header_item = NULL;
3278
3279     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
3280     {
3281         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
3282         return;
3283     }
3284     local_offset = *offset;
3285
3286     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
3287     proto_item_set_text(PERF_header_item, "%s", "VENDOR - Vendor Specific Management MAD (Dissector Not Implemented)");
3288     *offset = local_offset;
3289 }
3290
3291 /* Parse Application Specific Management Packets
3292 * IN: parentTree to add the dissection to
3293 * IN: tvb - the data buffer from wireshark
3294 * IN/OUT: The current and updated offset */
3295 static void parse_APPLICATION_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
3296 {
3297     /* Parse the Common MAD Header */
3298     MAD_Data MadData;
3299     gint local_offset;
3300     proto_item *PERF_header_item = NULL;
3301
3302     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
3303     {
3304         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
3305         return;
3306     }
3307     local_offset = *offset;
3308     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, MAD_DATA_SIZE, FALSE); local_offset += MAD_DATA_SIZE;
3309     proto_item_set_text(PERF_header_item, "%s", "APP - Application Specific MAD (Dissector Not Implemented)");
3310     *offset = local_offset;
3311 }
3312
3313 /* Parse Reserved Management Packets.
3314
3315 * This is an !ERROR CONDITION!
3316 * It means that the Management Class value used was defined as a reserved value for furture use.
3317 * This method is here since we will want to report this information directly to the UI without blowing up Wireshark.
3318
3319 * IN: parentTree to add the dissection to
3320 * IN: tvb - the data buffer from wireshark
3321 * IN/OUT: The current and updated offset */
3322 static void parse_RESERVED_MANAGEMENT(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
3323 {
3324     /* Parse the Common MAD Header */
3325     MAD_Data MadData;
3326     gint local_offset;
3327     proto_item *PERF_header_item = NULL;
3328
3329     if(!parse_MAD_Common(parentTree, tvb, offset, &MadData))
3330     {
3331         /* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
3332         return;
3333     }
3334     local_offset = *offset;
3335     PERF_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 256, FALSE); local_offset += 256;
3336     proto_item_set_text(PERF_header_item, "%s", "RESERVED - Reserved MAD Type (Possible Device Error)");
3337     *offset = local_offset;
3338 }
3339
3340 /* Parse the common MAD Header
3341 * IN: parentTree to add the dissection to
3342 * IN: tvb - the data buffer from wireshark
3343 * IN/OUT: The current and updated offset
3344 * IN/OUT: MadData - the data from the MAD header */
3345 static gboolean parse_MAD_Common(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data* MadData)
3346 {
3347     gint local_offset = *offset;
3348     proto_tree *MAD_header_tree = NULL;
3349     proto_item *MAD_header_item = NULL;
3350
3351     if(MadData == NULL)
3352         return FALSE;
3353     if(!tvb_bytes_exist(tvb, *offset, 256))
3354         return FALSE;
3355
3356     /* Get the Management Class to decide between LID Routed and Direct Route */
3357     MadData->managementClass =      tvb_get_guint8(tvb, local_offset + 1);
3358     MadData->classVersion =         tvb_get_guint8(tvb, local_offset + 2);
3359     MadData->method =               tvb_get_guint8(tvb, local_offset + 3);
3360     MadData->status =               tvb_get_guint8(tvb, local_offset + 4);
3361     MadData->classSpecific =        tvb_get_ntohs(tvb, local_offset + 6);
3362     MadData->transactionID =        tvb_get_ntoh64(tvb, local_offset + 8);
3363     MadData->attributeID =          tvb_get_ntohs(tvb, local_offset + 16);
3364     MadData->attributeModifier =    tvb_get_ntohl(tvb, local_offset + 20);
3365     tvb_memcpy(tvb, MadData->data, local_offset + 24, MAD_DATA_SIZE);
3366
3367     /* Populate the Dissector Tree */
3368
3369     MAD_header_item = proto_tree_add_item(parentTree, hf_infiniband_MAD, tvb, local_offset, 256, FALSE);
3370     proto_item_set_text(MAD_header_item, "%s", "MAD Header - Common Management Datagram");
3371     MAD_header_tree = proto_item_add_subtree(MAD_header_item, ett_mad);
3372
3373     proto_tree_add_item(MAD_header_tree, hf_infiniband_base_version,        tvb, local_offset, 1, FALSE); local_offset+=1;
3374     proto_tree_add_item(MAD_header_tree, hf_infiniband_mgmt_class,          tvb, local_offset, 1, FALSE); local_offset+=1;
3375     proto_tree_add_item(MAD_header_tree, hf_infiniband_class_version,       tvb, local_offset, 1, FALSE); local_offset+=1;
3376     proto_tree_add_item(MAD_header_tree, hf_infiniband_method,              tvb, local_offset, 1, FALSE); local_offset+=1;
3377     proto_tree_add_item(MAD_header_tree, hf_infiniband_status,              tvb, local_offset, 2, FALSE); local_offset+=2;
3378     proto_tree_add_item(MAD_header_tree, hf_infiniband_class_specific,      tvb, local_offset, 2, FALSE); local_offset+=2;
3379     proto_tree_add_item(MAD_header_tree, hf_infiniband_transaction_id,      tvb, local_offset, 8, FALSE); local_offset+=8;
3380     proto_tree_add_item(MAD_header_tree, hf_infiniband_attribute_id,        tvb, local_offset, 2, FALSE); local_offset+=2;
3381     proto_tree_add_item(MAD_header_tree, hf_infiniband_reserved16,          tvb, local_offset, 2, FALSE); local_offset+=2;
3382     proto_tree_add_item(MAD_header_tree, hf_infiniband_attribute_modifier,  tvb, local_offset, 4, FALSE); local_offset+=4;
3383     proto_tree_add_item(MAD_header_tree, hf_infiniband_data,                tvb, local_offset, MAD_DATA_SIZE, FALSE);
3384     *offset = local_offset; /* Move the offset to the start of the Data field - this will be where the other parsers start. */
3385
3386     return TRUE;
3387 }
3388
3389 /* Parse the RMPP (Reliable Multi-Packet Transaction Protocol
3390 * IN: parentTree to add the dissection to
3391 * IN: tvb - the data buffer from wireshark
3392 * IN/OUT: The current and updated offset */
3393 static gboolean parse_RMPP(proto_tree *parentTree, tvbuff_t *tvb, gint *offset)
3394 {
3395     gint local_offset = *offset;
3396     guint8 RMPP_Type = tvb_get_guint8(tvb, local_offset + 1);
3397     proto_tree *RMPP_header_tree = NULL;
3398     proto_item *RMPP_header_item = NULL;
3399
3400     RMPP_header_item = proto_tree_add_item(parentTree, hf_infiniband_RMPP, tvb, local_offset, 12, FALSE);
3401     proto_item_set_text(RMPP_header_item, "%s", val_to_str(RMPP_Type, RMPP_Packet_Types, "Reserved RMPP Type! (0x%02x)"));
3402     RMPP_header_tree = proto_item_add_subtree(RMPP_header_item, ett_rmpp);
3403
3404     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_version,   tvb, local_offset, 1, FALSE); local_offset+=1;
3405     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_type,      tvb, local_offset, 1, FALSE); local_offset+=1;
3406     proto_tree_add_item(RMPP_header_tree, hf_infiniband_r_resp_time,    tvb, local_offset, 1, FALSE);
3407     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_flags,     tvb, local_offset, 1, FALSE); local_offset+=1;
3408     proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_status,    tvb, local_offset, 1, FALSE); local_offset+=1;
3409     switch(RMPP_Type)
3410     {
3411         case RMPP_ILLEGAL:
3412             proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_data1,     tvb, local_offset, 4, FALSE); local_offset+=4;
3413             proto_tree_add_item(RMPP_header_tree, hf_infiniband_rmpp_data2,     tvb, local_offset, 4, FALSE); local_offset+=4;
3414             break;
3415         case RMPP_DATA:
3416             proto_tree_add_item(RMPP_header_tree, hf_infiniband_segment_number,     tvb, local_offset, 4, FALSE); local_offset+=4;
3417             proto_tree_add_item(RMPP_header_tree, hf_infiniband_payload_length32,   tvb, local_offset, 4, FALSE); local_offset+=4;
3418             proto_tree_add_item(RMPP_header_tree, hf_infiniband_transferred_data,   tvb, local_offset, 220, FALSE);
3419             break;
3420         case RMPP_ACK:
3421             proto_tree_add_item(RMPP_header_tree, hf_infiniband_segment_number,     tvb, local_offset, 4, FALSE); local_offset+=4;
3422             proto_tree_add_item(RMPP_header_tree, hf_infiniband_new_window_last,    tvb, local_offset, 4, FALSE); local_offset+=4;
3423             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved220,        tvb, local_offset, 220, FALSE);
3424             break;
3425         case RMPP_STOP:
3426         case RMPP_ABORT:
3427             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved32,                     tvb, local_offset, 4, FALSE); local_offset+=4;
3428             proto_tree_add_item(RMPP_header_tree, hf_infiniband_reserved32,                     tvb, local_offset, 4, FALSE); local_offset+=4;
3429             proto_tree_add_item(RMPP_header_tree, hf_infiniband_optional_extended_error_data,   tvb, local_offset, 220, FALSE);
3430             break;
3431         default:
3432             break;
3433     }
3434     *offset = local_offset;
3435     return TRUE;
3436 }
3437
3438 /* Parse the Method from the MAD Common Header.
3439 * Simply used to generate the identifier.
3440 * IN: SubMItem - the item to append the method label to.
3441 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
3442 * IN: pinfo - packet info from wireshark. */
3443 static void label_SUBM_Method(proto_item *SubMItem, MAD_Data *MadHeader, packet_info *pinfo)
3444 {
3445     const char *label = val_to_str(MadHeader->method, SUBM_Methods, "(Unknown SubManagement Method!)");
3446
3447     proto_item_append_text(SubMItem, "%s", label);
3448     col_append_str(pinfo->cinfo, COL_INFO, label);
3449 }
3450
3451 /* Parse the SA Method from the MAD Common Header.
3452 * Simply used to generate the identifier.
3453 * IN: SubAItem - the item to append the method label to.
3454 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
3455 * IN: pinfo - packet info from wireshark. */
3456 static void label_SUBA_Method(proto_item *SubAItem, MAD_Data *MadHeader, packet_info *pinfo)
3457 {
3458     const char *label = val_to_str(MadHeader->method, SUBA_Methods, "(Unknown SubAdministration Method!)");
3459
3460     proto_item_append_text(SubAItem, "%s", label);
3461     col_append_str(pinfo->cinfo, COL_INFO, label);
3462 }
3463
3464 /* Parse the Attribute from the MAD Common Header
3465 * Simply used to generate the identifier.
3466 * IN: SubMItem - the item to append the Attribute label to.
3467 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
3468 * IN: pinfo - packet info from wireshark. */
3469 static void label_SUBM_Attribute(proto_item *SubMItem, MAD_Data *MadHeader, packet_info *pinfo)
3470 {
3471     const char *label = val_to_str(MadHeader->attributeID, SUBM_Attributes, "(Unknown SubManagement Attribute!)");
3472
3473     proto_item_append_text(SubMItem, "%s", &label[11]);
3474     col_append_str(pinfo->cinfo, COL_INFO, &label[11]);
3475 }
3476
3477 /* Parse the SA Attribute from the MAD Common Header
3478 * Simply used to generate the identifier.
3479 * IN: SubAItem - the item to append the Attribute label to.
3480 * IN: MadHeader - the MadData structure that contains the information from the Common MAD header.
3481 * IN: pinfo - packet info from wireshark. */
3482 static void label_SUBA_Attribute(proto_item *SubAItem, MAD_Data *MadHeader, packet_info *pinfo)
3483 {
3484     const char *label = val_to_str(MadHeader->attributeID, SUBA_Attributes, "(Unknown SubAdministration Attribute!)");
3485
3486     proto_item_append_text(SubAItem, "%s", &label[11]);
3487     col_append_str(pinfo->cinfo, COL_INFO, &label[11]);
3488 }
3489
3490 /* Parse the attribute from a Subnet Management Packet.
3491 * IN: Parent Tree to add the item to in the dissection tree
3492 * IN: tvbuff, offset - the data and where it is.
3493 * IN: MAD_Data the data from the Common MAD Header that provides the information we need */
3494 static gboolean parse_SUBM_Attribute(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data *MadHeader)
3495 {
3496     guint16 attributeID = MadHeader->attributeID;
3497     proto_tree *SUBM_Attribute_header_tree = NULL;
3498     proto_item *SUBM_Attribute_header_item = NULL;
3499
3500     SUBM_Attribute_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, *offset, 64, FALSE);
3501     proto_item_set_text(SUBM_Attribute_header_item, "%s", val_to_str(attributeID, SUBM_Attributes, "Unknown Attribute Type! (0x%02x)"));
3502     SUBM_Attribute_header_tree = proto_item_add_subtree(SUBM_Attribute_header_item, ett_subm_attribute);
3503
3504
3505     switch(attributeID)
3506     {
3507         case 0x0002:
3508             parse_NoticesAndTraps(SUBM_Attribute_header_tree , tvb, offset);
3509             break;
3510         case 0x0010:
3511              parse_NodeDescription(SUBM_Attribute_header_tree , tvb, offset);
3512             break;
3513         case 0x0011:
3514             parse_NodeInfo(SUBM_Attribute_header_tree , tvb, offset);
3515             break;
3516         case 0x0012:
3517             parse_SwitchInfo(SUBM_Attribute_header_tree , tvb, offset);
3518             break;
3519         case 0x0014:
3520             parse_GUIDInfo(SUBM_Attribute_header_tree , tvb, offset);
3521             break;
3522         case 0x0015:
3523             parse_PortInfo(SUBM_Attribute_header_tree , tvb, offset);
3524             break;
3525         case 0x0016:
3526             parse_P_KeyTable(SUBM_Attribute_header_tree , tvb, offset);
3527             break;
3528         case 0x0017:
3529             parse_SLtoVLMappingTable(SUBM_Attribute_header_tree , tvb, offset);
3530             break;
3531         case 0x0018:
3532             parse_VLArbitrationTable(SUBM_Attribute_header_tree , tvb, offset);
3533             break;
3534         case 0x0019:
3535             parse_LinearForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
3536             break;
3537         case 0x001A:
3538             parse_RandomForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
3539             break;
3540         case 0x001B:
3541             parse_MulticastForwardingTable(SUBM_Attribute_header_tree , tvb, offset);
3542             break;
3543         case 0x001C:
3544             parse_SMInfo(SUBM_Attribute_header_tree , tvb, offset);
3545             break;
3546         case 0x0020:
3547             parse_VendorDiag(SUBM_Attribute_header_tree , tvb, offset);
3548             break;
3549         case 0x0030:
3550             parse_LedInfo(SUBM_Attribute_header_tree , tvb, offset);
3551             break;
3552         case 0x0031:
3553             parse_LinkSpeedWidthPairsTable(SUBM_Attribute_header_tree , tvb, offset);
3554             break;
3555         default:
3556             break;
3557     }
3558
3559
3560     *offset += 64;
3561     return TRUE;
3562
3563 }
3564 /* Parse the attribute from a Subnet Administration Packet.
3565 * IN: Parent Tree to add the item to in the dissection tree
3566 * IN: tvbuff, offset - the data and where it is.
3567 * IN: MAD_Data the data from the Common MAD Header that provides the information we need */
3568 static gboolean parse_SUBA_Attribute(proto_tree *parentTree, tvbuff_t *tvb, gint *offset, MAD_Data *MadHeader)
3569 {
3570     guint16 attributeID = MadHeader->attributeID;
3571     proto_tree *SUBA_Attribute_header_tree = NULL;
3572     proto_item *SUBA_Attribute_header_item = NULL;
3573
3574     SUBA_Attribute_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, *offset, 200, FALSE);
3575     proto_item_set_text(SUBA_Attribute_header_item, "%s", val_to_str(attributeID, SUBA_Attributes, "Unknown Attribute Type! (0x%02x)"));
3576     SUBA_Attribute_header_tree = proto_item_add_subtree(SUBA_Attribute_header_item, ett_suba_attribute);
3577
3578     /* Skim off the RID fields should they be present */
3579     parse_RID(SUBA_Attribute_header_tree, tvb, offset, MadHeader);
3580
3581     /* Parse the rest of the attributes */
3582     switch(MadHeader->attributeID)
3583     {
3584         case 0x0001: /* (ClassPortInfo) */
3585             parse_PortInfo(SUBA_Attribute_header_tree, tvb, offset);
3586             break;
3587         case 0x0002: /* (Notice) */
3588             parse_NoticesAndTraps(SUBA_Attribute_header_tree, tvb, offset);
3589             break;
3590         case 0x0003: /* (InformInfo) */
3591             parse_InformInfo(SUBA_Attribute_header_tree, tvb, offset);
3592             break;
3593         case 0x0011: /* (NodeRecord) */
3594             parse_NodeInfo(SUBA_Attribute_header_tree, tvb, offset);
3595             *offset += 40;
3596             parse_NodeDescription(SUBA_Attribute_header_tree, tvb, offset);
3597             break;
3598         case 0x0012: /* (PortInfoRecord) */
3599             parse_PortInfo(SUBA_Attribute_header_tree, tvb, offset);
3600             break;
3601         case 0x0013: /* (SLtoVLMappingTableRecord) */
3602             parse_SLtoVLMappingTable(SUBA_Attribute_header_tree, tvb, offset);
3603             break;
3604         case 0x0014: /* (SwitchInfoRecord) */
3605             parse_SwitchInfo(SUBA_Attribute_header_tree, tvb, offset);
3606             break;
3607         case 0x0015: /*(LinearForwardingTableRecord) */
3608             parse_LinearForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
3609             break;
3610         case 0x0016: /* (RandomForwardingTableRecord) */
3611             parse_RandomForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
3612             break;
3613         case 0x0017: /* (MulticastForwardingTableRecord) */
3614             parse_MulticastForwardingTable(SUBA_Attribute_header_tree, tvb, offset);
3615             break;
3616         case 0x0018: /* (SMInfoRecord) */
3617             parse_SMInfo(SUBA_Attribute_header_tree, tvb, offset);
3618             break;
3619         case 0x0019: /* (LinkSpeedWidthPairsTableRecord) */
3620             parse_LinkSpeedWidthPairsTable(SUBA_Attribute_header_tree, tvb, offset);
3621             break;
3622         case 0x00F3: /*(InformInfoRecord) */
3623             parse_InformInfo(SUBA_Attribute_header_tree, tvb, offset);
3624             break;
3625         case 0x0020: /* (LinkRecord) */
3626             parse_LinkRecord(SUBA_Attribute_header_tree, tvb, offset);
3627             break;
3628         case 0x0030: /* (GuidInforecord) */
3629             parse_GUIDInfo(SUBA_Attribute_header_tree, tvb, offset);
3630             break;
3631         case 0x0031: /*(ServiceRecord) */
3632             parse_ServiceRecord(SUBA_Attribute_header_tree, tvb, offset);
3633             break;
3634         case 0x0033: /* (P_KeyTableRecord) */
3635             parse_P_KeyTable(SUBA_Attribute_header_tree, tvb, offset);
3636             break;
3637         case 0x0035: /* (PathRecord) */
3638             parse_PathRecord(SUBA_Attribute_header_tree, tvb, offset);
3639             break;
3640         case 0x0036: /* (VLArbitrationTableRecord) */
3641             parse_VLArbitrationTable(SUBA_Attribute_header_tree, tvb, offset);
3642             break;
3643         case 0x0038: /* (MCMemberRecord) */
3644             parse_MCMemberRecord(SUBA_Attribute_header_tree, tvb, offset);
3645             break;
3646         case 0x0039: /* (TraceRecord) */
3647             parse_TraceRecord(SUBA_Attribute_header_tree, tvb, offset);
3648             break;
3649         case 0x003A: /* (MultiPathRecord) */
3650             parse_MultiPathRecord(SUBA_Attribute_header_tree, tvb, offset);
3651             break;
3652         case 0x003B: /* (ServiceAssociationRecord) */
3653             parse_ServiceAssociationRecord(SUBA_Attribute_header_tree, tvb, offset);
3654             break;
3655         default: /* (Unknown SubAdministration Attribute!) */
3656             /* We've already labeled as unknown in item construction */
3657             break;
3658     }
3659
3660     *offset += 200;
3661     return TRUE;
3662 }
3663
3664 /* Subnet Management Attribute Parsing Methods.
3665 *  Also Parsing for Attributes common to both SM/SA.
3666 * The Subnet Admin Parsing methods will call some of these methods when an attribute is present within an SA MAD
3667 */
3668
3669
3670 /* Parse NoticeDataDetails Attribute Field
3671 * IN:   parentTree - The tree to add the dissection to
3672 *       tvb - The tvbbuff of packet data
3673 *       offset - The offset in TVB where the attribute begins
3674 *       trapNumber - The Trap ID of the Trap Data being Dissected  */
3675
3676 static void parse_NoticeDataDetails(proto_tree* parentTree, tvbuff_t* tvb, gint *offset, guint16 trapNumber)
3677 {
3678     gint local_offset = *offset;
3679     proto_tree *DataDetails_header_tree = NULL;
3680     proto_item *DataDetails_header_item = NULL;
3681
3682     if(!parentTree)
3683         return;
3684
3685     DataDetails_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 54, FALSE);
3686     DataDetails_header_tree = proto_item_add_subtree(DataDetails_header_item, ett_datadetails);
3687
3688
3689     switch(trapNumber)
3690     {
3691         case 64:
3692             proto_item_set_text(DataDetails_header_item, "%s", "Trap 64 DataDetails");
3693             local_offset +=6;
3694             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
3695         break;
3696         case 65:
3697             proto_item_set_text(DataDetails_header_item, "%s", "Trap 65 DataDetails");
3698             local_offset +=6;
3699             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
3700         break;
3701         case 66:
3702             proto_item_set_text(DataDetails_header_item, "%s", "Trap 66 DataDetails");
3703             local_offset +=6;
3704             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
3705         break;
3706         case 67:
3707             proto_item_set_text(DataDetails_header_item, "%s", "Trap 67 DataDetails");
3708             local_offset +=6;
3709             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR,    tvb, local_offset, 16, FALSE);  local_offset+=16;
3710         break;
3711         case 68:
3712             proto_item_set_text(DataDetails_header_item, "%s", "Trap 68 DataDetails");
3713             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_COMP_MASK,          tvb, local_offset, 8, FALSE);  local_offset+=8;
3714             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_WAIT_FOR_REPATH,    tvb, local_offset, 1, FALSE);
3715         break;
3716         case 69:
3717             proto_item_set_text(DataDetails_header_item, "%s", "Trap 69 DataDetails");
3718             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_COMP_MASK,          tvb, local_offset, 8, FALSE);  local_offset+=8;
3719             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_WAIT_FOR_REPATH,    tvb, local_offset, 1, FALSE);
3720         break;
3721         case 128:
3722             proto_item_set_text(DataDetails_header_item, "%s", "Trap 128 DataDetails");
3723             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3724         break;
3725         case 129:
3726             proto_item_set_text(DataDetails_header_item, "%s", "Trap 129 DataDetails");
3727             local_offset += 2;
3728             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3729             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3730         break;
3731         case 130:
3732             proto_item_set_text(DataDetails_header_item, "%s", "Trap 130 DataDetails");
3733             local_offset += 2;
3734             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3735             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3736         break;
3737         case 131:
3738             proto_item_set_text(DataDetails_header_item, "%s", "Trap 131 DataDetails");
3739             local_offset += 2;
3740             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3741             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3742         break;
3743         case 144:
3744             proto_item_set_text(DataDetails_header_item, "%s", "Trap 144 DataDetails");
3745             local_offset +=2;
3746             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3747             local_offset +=1;
3748             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_OtherLocalChanges,      tvb, local_offset, 1, FALSE);  local_offset+=1;
3749             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_CAPABILITYMASK,     tvb, local_offset, 4, FALSE);  local_offset+=4;
3750             local_offset +=1;
3751             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LinkSpeecEnabledChange,     tvb, local_offset, 1, FALSE);
3752             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LinkWidthEnabledChange,     tvb, local_offset, 1, FALSE);
3753             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_NodeDescriptionChange,      tvb, local_offset, 1, FALSE);
3754         break;
3755         case 145:
3756             proto_item_set_text(DataDetails_header_item, "%s", "Trap 145 DataDetails");
3757             local_offset +=2;
3758             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3759             local_offset +=2;
3760             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SYSTEMIMAGEGUID,        tvb, local_offset, 8, FALSE);  local_offset+=8;
3761         break;
3762         case 256:
3763             proto_item_set_text(DataDetails_header_item, "%s", "Trap 256 DataDetails");
3764             local_offset +=2;
3765             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR,            tvb, local_offset, 2, FALSE);  local_offset+=2;
3766             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRSLID,             tvb, local_offset, 2, FALSE);  local_offset+=2;
3767             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_METHOD,             tvb, local_offset, 1, FALSE);  local_offset+=1;
3768             local_offset +=1;
3769             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_ATTRIBUTEID,        tvb, local_offset, 2, FALSE);  local_offset+=2;
3770             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_ATTRIBUTEMODIFIER,  tvb, local_offset, 4, FALSE);  local_offset+=4;
3771             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_MKEY,               tvb, local_offset, 8, FALSE);  local_offset+=8;
3772             local_offset +=1;
3773             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRNotice,           tvb, local_offset, 1, FALSE);
3774             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRPathTruncated,    tvb, local_offset, 1, FALSE);
3775             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRHopCount,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3776             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DRNoticeReturnPath, tvb, local_offset, 30, FALSE);  local_offset+=30;
3777         break;
3778         case 257:
3779             proto_item_set_text(DataDetails_header_item, "%s", "Trap 257 DataDetails");
3780             local_offset+=2;
3781             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3782             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3783             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_KEY,        tvb, local_offset, 4, FALSE);  local_offset+=4;
3784             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3785             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3786             local_offset +=1;
3787             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3788             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3789             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3790         break;
3791         case 258:
3792             proto_item_set_text(DataDetails_header_item, "%s", "Trap 258 DataDetails");
3793             local_offset+=2;
3794             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3795             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3796             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_KEY,        tvb, local_offset, 4, FALSE);  local_offset+=4;
3797             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset +=1;
3798             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3799             local_offset +=1;
3800             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3801             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3802             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3803         break;
3804         case 259:
3805             proto_item_set_text(DataDetails_header_item, "%s", "Trap 259 DataDetails");
3806             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_DataValid,  tvb, local_offset, 2, FALSE);  local_offset+=2;
3807             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR1,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3808             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_LIDADDR2,   tvb, local_offset, 2, FALSE);  local_offset+=2;
3809             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PKEY,       tvb, local_offset, 2, FALSE);  local_offset+=2;
3810             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SL,         tvb, local_offset, 1, FALSE);  local_offset+=1;
3811             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP1,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3812             local_offset +=1;
3813             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_QP2,        tvb, local_offset, 3, FALSE);  local_offset+=3;
3814             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR1,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3815             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_GIDADDR2,   tvb, local_offset, 16, FALSE);  local_offset+=16;
3816             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_SWLIDADDR,  tvb, local_offset, 2, FALSE);  local_offset+=2;
3817             proto_tree_add_item(DataDetails_header_tree, hf_infiniband_Trap_PORTNO,     tvb, local_offset, 1, FALSE);  local_offset+=1;
3818         break;
3819         default:
3820             proto_item_set_text(DataDetails_header_item, "%s", "Vendor Specific Subnet Management Trap"); local_offset +=54;
3821             break;
3822     }
3823
3824 }
3825
3826 /* Parse NoticesAndTraps Attribute
3827 * IN:   parentTree - The tree to add the dissection to
3828 *       tvb - The tvbbuff of packet data
3829 *       offset - The offset in TVB where the attribute begins
3830 *       MadHeader - The common MAD header of the current SMP/SMA  */
3831 static void parse_NoticesAndTraps(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3832 {
3833     gint local_offset = *offset;
3834     proto_tree *NoticesAndTraps_header_tree = NULL;
3835     proto_item *NoticesAndTraps_header_item = NULL;
3836     guint16 trapNumber = tvb_get_ntohs(tvb, local_offset + 4);
3837
3838     if(!parentTree)
3839         return;
3840
3841     NoticesAndTraps_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
3842     proto_item_set_text(NoticesAndTraps_header_item, "%s", val_to_str(trapNumber, Trap_Description, "Unknown or Vendor Specific Trap Number! (0x%02x)"));
3843     NoticesAndTraps_header_tree = proto_item_add_subtree(NoticesAndTraps_header_item, ett_noticestraps);
3844
3845     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IsGeneric,                tvb, local_offset, 1, FALSE);
3846     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_Type,                     tvb, local_offset, 1, FALSE); local_offset+=1;
3847     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_ProducerTypeVendorID,     tvb, local_offset, 3, FALSE); local_offset+=3;
3848     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_TrapNumberDeviceID,       tvb, local_offset, 2, FALSE); local_offset+=2;
3849     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IssuerLID,                tvb, local_offset, 2, FALSE); local_offset+=2;
3850     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_NoticeToggle,             tvb, local_offset, 1, FALSE);
3851     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_NoticeCount,              tvb, local_offset, 2, FALSE); local_offset+=2;
3852
3853     parse_NoticeDataDetails(NoticesAndTraps_header_tree, tvb, &local_offset, trapNumber);
3854     proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_DataDetails,              tvb, local_offset, 54, FALSE); local_offset+=54;
3855
3856     /* Only Defined For GMPs not SMPs which is not part of this dissector phase
3857     *proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_IssuerGID,               tvb, local_offset, 16, FALSE); local_offset+=16;
3858     *proto_tree_add_item(NoticesAndTraps_header_tree, hf_infiniband_Notice_ClassTrapSpecificData,   tvb, local_offset, 1, FALSE); local_offset+=1; */
3859
3860 }
3861
3862 /* Parse NodeDescription Attribute
3863 * IN:   parentTree - The tree to add the dissection to
3864 *       tvb - The tvbbuff of packet data
3865 *       offset - The offset in TVB where the attribute begins
3866 *       MadHeader - The common MAD header of the current SMP/SMA  */
3867 static void parse_NodeDescription(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3868 {
3869     gint local_offset = *offset;
3870     proto_tree *NodeDescription_header_tree = NULL;
3871
3872     if(!parentTree)
3873         return;
3874
3875     NodeDescription_header_tree = parentTree;
3876     proto_tree_add_item(NodeDescription_header_tree, hf_infiniband_NodeDescription_NodeString,  tvb, local_offset, 64, FALSE);
3877 }
3878
3879 /* Parse NodeInfo Attribute
3880 * IN:   parentTree - The tree to add the dissection to
3881 *       tvb - The tvbbuff of packet data
3882 *       offset - The offset in TVB where the attribute begins
3883 *       MadHeader - The common MAD header of the current SMP/SMA  */
3884 static void parse_NodeInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3885 {
3886     gint local_offset = *offset;
3887     proto_tree *NodeInfo_header_tree = NULL;
3888
3889     if(!parentTree)
3890         return;
3891
3892     NodeInfo_header_tree = parentTree;
3893
3894     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_BaseVersion,       tvb, local_offset, 1, FALSE); local_offset +=1;
3895     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_ClassVersion,      tvb, local_offset, 1, FALSE); local_offset +=1;
3896     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NodeType,          tvb, local_offset, 1, FALSE); local_offset +=1;
3897     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NumPorts,          tvb, local_offset, 1, FALSE); local_offset +=1;
3898     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_SystemImageGUID,   tvb, local_offset, 8, FALSE); local_offset +=8;
3899     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_NodeGUID,          tvb, local_offset, 8, FALSE); local_offset +=8;
3900     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_PortGUID,          tvb, local_offset, 8, FALSE); local_offset +=8;
3901     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_PartitionCap,      tvb, local_offset, 2, FALSE); local_offset +=2;
3902     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_DeviceID,          tvb, local_offset, 2, FALSE); local_offset +=2;
3903     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_Revision,          tvb, local_offset, 4, FALSE); local_offset +=4;
3904     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_LocalPortNum,      tvb, local_offset, 1, FALSE); local_offset +=1;
3905     proto_tree_add_item(NodeInfo_header_tree, hf_infiniband_NodeInfo_VendorID,          tvb, local_offset, 3, FALSE); local_offset +=3;
3906
3907 }
3908
3909 /* Parse SwitchInfo Attribute
3910 * IN:   parentTree - The tree to add the dissection to
3911 *       tvb - The tvbbuff of packet data
3912 *       offset - The offset in TVB where the attribute begins
3913 *       MadHeader - The common MAD header of the current SMP/SMA  */
3914 static void parse_SwitchInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3915 {
3916     gint local_offset = *offset;
3917     proto_tree *SwitchInfo_header_tree = NULL;
3918
3919     if(!parentTree)
3920         return;
3921
3922     SwitchInfo_header_tree = parentTree;
3923
3924     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LinearFDBCap,                      tvb, local_offset, 2, FALSE); local_offset +=2;
3925     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_RandomFDBCap,                      tvb, local_offset, 2, FALSE); local_offset +=2;
3926     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_MulticastFDBCap,                   tvb, local_offset, 2, FALSE); local_offset +=2;
3927     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LinearFDBTop,                      tvb, local_offset, 2, FALSE); local_offset +=2;
3928     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultPort,                       tvb, local_offset, 1, FALSE); local_offset +=1;
3929     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultMulticastPrimaryPort,       tvb, local_offset, 1, FALSE); local_offset +=1;
3930     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_DefaultMulticastNotPrimaryPort,    tvb, local_offset, 1, FALSE); local_offset +=1;
3931     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LifeTimeValue,                     tvb, local_offset, 1, FALSE);
3932     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_PortStateChange,                   tvb, local_offset, 1, FALSE);
3933     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_OptimizedSLtoVLMappingProgramming, tvb, local_offset, 1, FALSE); local_offset +=1;
3934     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_LIDsPerPort,                       tvb, local_offset, 2, FALSE); local_offset +=2;
3935     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_PartitionEnforcementCap,           tvb, local_offset, 2, FALSE); local_offset +=2;
3936     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_InboundEnforcementCap,             tvb, local_offset, 1, FALSE);
3937     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_OutboundEnforcementCap,            tvb, local_offset, 1, FALSE);
3938     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_FilterRawInboundCap,               tvb, local_offset, 1, FALSE);
3939     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_FilterRawOutboundCap,              tvb, local_offset, 1, FALSE);
3940     proto_tree_add_item(SwitchInfo_header_tree, hf_infiniband_SwitchInfo_EnhancedPortZero,                  tvb, local_offset, 1, FALSE); local_offset +=1;
3941 }
3942
3943 /* Parse GUIDInfo Attribute
3944 * IN:   parentTree - The tree to add the dissection to
3945 *       tvb - The tvbbuff of packet data
3946 *       offset - The offset in TVB where the attribute begins
3947 *       MadHeader - The common MAD header of the current SMP/SMA  */
3948 static void parse_GUIDInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3949 {
3950     gint local_offset = *offset;
3951     proto_tree *GUIDInfo_header_tree = NULL;
3952     proto_item *tempItemLow = NULL;
3953     gint i = 0;
3954
3955     if(!parentTree)
3956         return;
3957
3958     GUIDInfo_header_tree = parentTree;
3959
3960     for(i = 0; i < 8; i++)
3961     {
3962         proto_tree_add_item(GUIDInfo_header_tree, hf_infiniband_GUIDInfo_GUID, tvb, local_offset, 8, FALSE); local_offset +=8;
3963         proto_item_append_text(tempItemLow, "(%u)", i);
3964     }
3965
3966 }
3967
3968 /* Parse PortInfo Attribute
3969 * IN:   parentTree - The tree to add the dissection to
3970 *       tvb - The tvbbuff of packet data
3971 *       offset - The offset in TVB where the attribute begins
3972 *       MadHeader - The common MAD header of the current SMP/SMA  */
3973 static void parse_PortInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
3974 {
3975     gint local_offset = *offset;
3976     proto_tree *PortInfo_header_tree = NULL;
3977     proto_tree *PortInfo_CapabilityMask_tree = NULL;
3978     proto_item *PortInfo_CapabilityMask_item = NULL;
3979     proto_item *temp_item = NULL;
3980     guint16 temp_val = 0;
3981
3982     if(!parentTree)
3983         return;
3984
3985     PortInfo_header_tree = parentTree;
3986
3987     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_Key,                 tvb, local_offset, 8, FALSE); local_offset +=8;
3988     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_GidPrefix,             tvb, local_offset, 8, FALSE); local_offset +=8;
3989     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LID,                   tvb, local_offset, 2, FALSE); local_offset +=2;
3990     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MasterSMLID,           tvb, local_offset, 2, FALSE); local_offset +=2;
3991
3992     /* Capability Mask Flags */
3993     PortInfo_CapabilityMask_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_CapabilityMask,     tvb, local_offset, 4, FALSE);
3994     PortInfo_CapabilityMask_tree = proto_item_add_subtree(PortInfo_CapabilityMask_item, ett_portinfo_capmask);
3995
3996     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SM,                             tvb, local_offset, 4, FALSE);
3997     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_NoticeSupported,                tvb, local_offset, 4, FALSE);
3998     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_TrapSupported,                  tvb, local_offset, 4, FALSE);
3999     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_OptionalPDSupported,            tvb, local_offset, 4, FALSE);
4000     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_AutomaticMigrationSupported,    tvb, local_offset, 4, FALSE);
4001     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SLMappingSupported,             tvb, local_offset, 4, FALSE);
4002     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_MKeyNVRAM,                      tvb, local_offset, 4, FALSE);
4003     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_PKeyNVRAM,                      tvb, local_offset, 4, FALSE);
4004     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LEDInfoSupported,               tvb, local_offset, 4, FALSE);
4005     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SMdisabled,                     tvb, local_offset, 4, FALSE);
4006     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SystemImageGUIDSupported,       tvb, local_offset, 4, FALSE);
4007     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_PKeySwitchExternalPortTrapSupported,    tvb, local_offset, 4, FALSE);
4008     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_CommunicationsManagementSupported,      tvb, local_offset, 4, FALSE);
4009     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_SNMPTunnelingSupported,                 tvb, local_offset, 4, FALSE);
4010     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_ReinitSupported,                tvb, local_offset, 4, FALSE);
4011     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_DeviceManagementSupported,      tvb, local_offset, 4, FALSE);
4012     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_VendorClassSupported,           tvb, local_offset, 4, FALSE);
4013     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_DRNoticeSupported,              tvb, local_offset, 4, FALSE);
4014     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_CapabilityMaskNoticeSupported,  tvb, local_offset, 4, FALSE);
4015     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_BootManagementSupported,        tvb, local_offset, 4, FALSE);
4016     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LinkRoundTripLatencySupported,  tvb, local_offset, 4, FALSE);
4017     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_ClientRegistrationSupported,    tvb, local_offset, 4, FALSE);
4018     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_OtherLocalChangesNoticeSupported,   tvb, local_offset, 4, FALSE);
4019     proto_tree_add_item(PortInfo_CapabilityMask_tree, hf_infiniband_PortInfo_CapabilityMask_LinkSpeedWIdthPairsTableSupported,  tvb, local_offset, 4, FALSE);
4020     local_offset+=4;
4021     /* End Capability Mask Flags */
4022
4023     /* Diag Code */
4024     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_DiagCode,              tvb, local_offset, 2, FALSE);
4025     temp_val = tvb_get_ntohs(tvb, local_offset);
4026
4027     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, DiagCode, "Reserved DiagCode! Possible Error"));
4028     local_offset +=2;
4029     /* End Diag Code */
4030
4031     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyLeasePeriod,      tvb, local_offset, 2, FALSE); local_offset +=2;
4032     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LocalPortNum,          tvb, local_offset, 1, FALSE); local_offset +=1;
4033
4034     /* LinkWidthEnabled */
4035     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthEnabled,      tvb, local_offset, 1, FALSE);
4036     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4037
4038     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthEnabled, "Reserved LinkWidthEnabled Value! Possible Error"));
4039     local_offset +=1;
4040     /* End LinkWidthEnabled */
4041
4042     /* LinkWidthSupported */
4043     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthSupported,    tvb, local_offset, 1, FALSE);
4044     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4045
4046     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthSupported, "Reserved LinkWidthSupported Value! Possible Error"));
4047     local_offset +=1;
4048     /* End LinkWidthSupported */
4049
4050     /* LinkWidthActive */
4051     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkWidthActive,       tvb, local_offset, 1, FALSE);
4052     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4053
4054     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkWidthActive, "Reserved LinkWidthActive Value! Possible Error"));
4055     local_offset +=1;
4056     /* End LinkWidthActive */
4057
4058     /* LinkSpeedSupported */
4059     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedSupported,    tvb, local_offset, 1, FALSE);
4060     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4061
4062     /* 4 bit values = mask and shift */
4063     temp_val = temp_val & 0x00F0;
4064     temp_val = temp_val >> 4;
4065
4066     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedSupported, "Reserved LinkWidthSupported Value! Possible Error"));
4067     /* End LinkSpeedSupported */
4068
4069     /* PortState */
4070     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PortState,             tvb, local_offset, 1, FALSE);
4071     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4072
4073     /* 4 bit values = mask and shift */
4074     temp_val = temp_val & 0x000F;
4075     /*temp_val = temp_val >> 4 */
4076
4077     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, PortState, "Reserved PortState Value! Possible Error"));
4078     local_offset +=1;
4079     /* End PortState */
4080
4081     /* PortPhysicalState */
4082     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PortPhysicalState,     tvb, local_offset, 1, FALSE);
4083     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4084
4085     /* 4 bit values = mask and shift */
4086     temp_val = temp_val & 0x00F0;
4087     temp_val = temp_val >> 4;
4088
4089     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, PortPhysicalState, "Reserved PortPhysicalState Value! Possible Error"));
4090     /* End PortPhysicalState */
4091
4092     /* LinkDownDefaultState */
4093     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkDownDefaultState,  tvb, local_offset, 1, FALSE);
4094     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4095
4096     /* 4 bit values = mask and shift */
4097     temp_val = temp_val & 0x000F;
4098     /*temp_val = temp_val >> 4 */
4099
4100     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkDownDefaultState, "Reserved LinkDownDefaultState Value! Possible Error"));
4101     local_offset +=1;
4102     /* End LinkDownDefaultState */
4103
4104     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyProtectBits,      tvb, local_offset, 1, FALSE);
4105     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LMC,                   tvb, local_offset, 1, FALSE); local_offset +=1;
4106
4107     /* LinkSpeedActive */
4108     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedActive,       tvb, local_offset, 1, FALSE);
4109     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4110
4111     /* 4 bit values = mask and shift */
4112     temp_val = temp_val & 0x00F0;
4113     temp_val = temp_val >> 4;
4114
4115     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedActive, "Reserved LinkSpeedActive Value! Possible Error"));
4116     /* End LinkSpeedActive */
4117
4118     /* LinkSpeedEnabled */
4119     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkSpeedEnabled,      tvb, local_offset, 1, FALSE);
4120     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4121
4122     /* 4 bit values = mask and shift */
4123     temp_val = temp_val & 0x000F;
4124     /*temp_val = temp_val >> 4 */
4125
4126     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, LinkSpeedEnabled, "Reserved LinkSpeedEnabled Value! Possible Error"));
4127     local_offset +=1;
4128     /* End LinkSpeedEnabled */
4129
4130     /* NeighborMTU */
4131     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_NeighborMTU,           tvb, local_offset, 1, FALSE);
4132     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4133
4134     /* 4 bit values = mask and shift */
4135     temp_val = temp_val & 0x00F0;
4136     temp_val = temp_val >> 4;
4137
4138     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, NeighborMTU, "Reserved NeighborMTU Value! Possible Error"));
4139
4140     /* End NeighborMTU */
4141
4142     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MasterSMSL,            tvb, local_offset, 1, FALSE); local_offset +=1;
4143
4144     /* VLCap */
4145     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLCap,                 tvb, local_offset, 1, FALSE);
4146     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4147
4148     /* 4 bit values = mask and shift */
4149     temp_val = temp_val & 0x00F0;
4150     temp_val = temp_val >> 4;
4151
4152     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, VLCap, "Reserved VLCap Value! Possible Error"));
4153
4154     /* End VLCap */
4155
4156     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_InitType,              tvb, local_offset, 1, FALSE); local_offset +=1;
4157     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLHighLimit,           tvb, local_offset, 1, FALSE); local_offset +=1;
4158     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLArbitrationHighCap,  tvb, local_offset, 1, FALSE); local_offset +=1;
4159     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLArbitrationLowCap,   tvb, local_offset, 1, FALSE); local_offset +=1;
4160     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_InitTypeReply,         tvb, local_offset, 1, FALSE);
4161
4162     /* MTUCap */
4163     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MTUCap,                tvb, local_offset, 1, FALSE);
4164     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4165
4166     /* 4 bit values = mask and shift */
4167     temp_val = temp_val & 0x000F;
4168     /*temp_val = temp_val >> 4 */
4169
4170     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, MTUCap, "Reserved MTUCap Value! Possible Error"));
4171     local_offset +=1;
4172     /* End MTUCap */
4173
4174     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_VLStallCount,          tvb, local_offset, 1, FALSE);
4175     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_HOQLife,               tvb, local_offset, 1, FALSE); local_offset +=1;
4176
4177     /* OperationalVLs */
4178     temp_item = proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_OperationalVLs,        tvb, local_offset, 1, FALSE);
4179     temp_val = (guint16)tvb_get_guint8(tvb, local_offset);
4180
4181     /* 4 bit values = mask and shift */
4182     temp_val = temp_val & 0x00F0;
4183     temp_val = temp_val >> 4;
4184
4185     proto_item_append_text(temp_item, ", %s", val_to_str(temp_val, OperationalVLs, "Reserved OperationalVLs Value! Possible Error"));
4186     /* End OperationalVLs */
4187
4188     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PartitionEnforcementInbound,       tvb, local_offset, 1, FALSE);
4189     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_PartitionEnforcementOutbound,      tvb, local_offset, 1, FALSE);
4190     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_FilterRawInbound,      tvb, local_offset, 1, FALSE);
4191     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_FilterRawOutbound,     tvb, local_offset, 1, FALSE); local_offset +=1;
4192     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_M_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
4193     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_P_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
4194     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_Q_KeyViolations,       tvb, local_offset, 2, FALSE); local_offset +=2;
4195     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_GUIDCap,               tvb, local_offset, 1, FALSE); local_offset +=1;
4196     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_ClientReregister,      tvb, local_offset, 1, FALSE);
4197     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_SubnetTimeOut,         tvb, local_offset, 1, FALSE); local_offset +=1;
4198     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_RespTimeValue,         tvb, local_offset, 1, FALSE); local_offset +=1;
4199     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LocalPhyErrors,        tvb, local_offset, 1, FALSE);
4200     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_OverrunErrors,         tvb, local_offset, 1, FALSE); local_offset +=1;
4201     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_MaxCreditHint,         tvb, local_offset, 2, FALSE); local_offset +=3; /* 2 + 1 Reserved */
4202     proto_tree_add_item(PortInfo_header_tree, hf_infiniband_PortInfo_LinkRoundTripLatency,  tvb, local_offset, 3, FALSE); local_offset +=3;
4203 }
4204
4205 /* Parse P_KeyTable Attribute
4206 * IN:   parentTree - The tree to add the dissection to
4207 *       tvb - The tvbbuff of packet data
4208 *       offset - The offset in TVB where the attribute begins
4209 *       MadHeader - The common MAD header of the current SMP/SMA  */
4210 static void parse_P_KeyTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4211 {
4212     gint local_offset = *offset;
4213     gint i = 0;
4214     proto_tree *P_KeyTable_header_tree = NULL;
4215     proto_item *P_KeyTable_header_item = NULL;
4216     proto_item *tempItemLow = NULL;
4217     proto_item *tempItemHigh = NULL;
4218
4219     if(!parentTree)
4220         return;
4221
4222     P_KeyTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_P_KeyTable_P_KeyTableBlock, tvb, local_offset, 64, FALSE);
4223     proto_item_set_text(P_KeyTable_header_item, "%s", "P_KeyTable");
4224     P_KeyTable_header_tree = proto_item_add_subtree(P_KeyTable_header_item, ett_pkeytable);
4225
4226     for(i = 0; i < 32; i++)
4227     {
4228         tempItemLow = proto_tree_add_item(P_KeyTable_header_tree, hf_infiniband_P_KeyTable_MembershipType,  tvb, local_offset, 1, FALSE);
4229         tempItemHigh = proto_tree_add_item(P_KeyTable_header_tree, hf_infiniband_P_KeyTable_P_KeyBase,          tvb, local_offset, 2, FALSE); local_offset +=2;
4230         proto_item_append_text(tempItemLow, "(%u)", i);
4231         proto_item_append_text(tempItemHigh,"(%u)", i+1);
4232     }
4233 }
4234
4235 /* Parse SLtoVLMappingTable Attribute
4236 * IN:   parentTree - The tree to add the dissection to
4237 *       tvb - The tvbbuff of packet data
4238 *       offset - The offset in TVB where the attribute begins
4239 *       MadHeader - The common MAD header of the current SMP/SMA  */
4240 static void parse_SLtoVLMappingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4241 {
4242     gint local_offset = *offset;
4243     proto_tree *SLtoVLMappingTable_header_tree = NULL;
4244     proto_item *SLtoVLMappingTable_header_item = NULL;
4245     proto_item *tempItemLow = NULL;
4246     proto_item *tempItemHigh = NULL;
4247     gint i = 0;
4248
4249     if(!parentTree)
4250         return;
4251
4252     SLtoVLMappingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4253     proto_item_set_text(SLtoVLMappingTable_header_item, "%s", "SLtoVLMappingTable");
4254     SLtoVLMappingTable_header_tree = proto_item_add_subtree(SLtoVLMappingTable_header_item, ett_sltovlmapping);
4255
4256     for(i = 0; i < 8; i++)
4257     {
4258         tempItemLow = proto_tree_add_item(SLtoVLMappingTable_header_tree, hf_infiniband_SLtoVLMappingTable_SLtoVL_HighBits,  tvb, local_offset, 1, FALSE);
4259         tempItemHigh = proto_tree_add_item(SLtoVLMappingTable_header_tree, hf_infiniband_SLtoVLMappingTable_SLtoVL_LowBits,  tvb, local_offset, 1, FALSE); local_offset +=1;
4260         proto_item_append_text(tempItemLow, "(%u)", i);
4261         proto_item_append_text(tempItemHigh,"(%u)", i+1);
4262     }
4263 }
4264
4265 /* Parse VLArbitrationTable Attribute
4266 * IN:   parentTree - The tree to add the dissection to
4267 *       tvb - The tvbbuff of packet data
4268 *       offset - The offset in TVB where the attribute begins
4269 *       MadHeader - The common MAD header of the current SMP/SMA  */
4270 static void parse_VLArbitrationTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4271 {
4272     gint local_offset = *offset;
4273     gint i = 0;
4274     proto_tree *VLArbitrationTable_header_tree = NULL;
4275     proto_item *VLArbitrationTable_header_item = NULL;
4276     proto_item *tempItemLow = NULL;
4277     proto_item *tempItemHigh = NULL;
4278
4279     if(!parentTree)
4280         return;
4281
4282     VLArbitrationTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4283     proto_item_set_text(VLArbitrationTable_header_item, "%s", "VLArbitrationTable");
4284     VLArbitrationTable_header_tree = proto_item_add_subtree(VLArbitrationTable_header_item, ett_vlarbitrationtable);
4285
4286     for(i = 0; i < 32; i++)
4287     {
4288         tempItemLow = proto_tree_add_item(VLArbitrationTable_header_tree, hf_infiniband_VLArbitrationTable_VL,      tvb, local_offset, 1, FALSE); local_offset +=1;
4289         tempItemHigh = proto_tree_add_item(VLArbitrationTable_header_tree, hf_infiniband_VLArbitrationTable_Weight, tvb, local_offset, 1, FALSE); local_offset +=1;
4290         proto_item_append_text(tempItemLow, "(%u)", i);
4291         proto_item_append_text(tempItemHigh,"(%u)", i);
4292     }
4293 }
4294
4295 /* Parse LinearForwardingTable Attribute
4296 * IN:   parentTree - The tree to add the dissection to
4297 *       tvb - The tvbbuff of packet data
4298 *       offset - The offset in TVB where the attribute begins
4299 *       MadHeader - The common MAD header of the current SMP/SMA  */
4300 static void parse_LinearForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4301 {
4302     gint i = 0;
4303     gint local_offset = *offset;
4304     proto_tree *LinearForwardingTable_header_tree = NULL;
4305     proto_item *LinearForwardingTable_header_item = NULL;
4306     proto_item *tempItemLow = NULL;
4307
4308     if(!parentTree)
4309         return;
4310
4311     LinearForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4312     proto_item_set_text(LinearForwardingTable_header_item, "%s", "LinearForwardingTable");
4313     LinearForwardingTable_header_tree = proto_item_add_subtree(LinearForwardingTable_header_item, ett_linearforwardingtable);
4314
4315     for(i = 0; i < 64; i++)
4316     {
4317         tempItemLow = proto_tree_add_item(LinearForwardingTable_header_tree, hf_infiniband_LinearForwardingTable_Port, tvb, local_offset, 1, FALSE); local_offset +=1;
4318         proto_item_append_text(tempItemLow, "(%u)", i);
4319     }
4320 }
4321
4322 /* Parse RandomForwardingTable Attribute
4323 * IN:   parentTree - The tree to add the dissection to
4324 *       tvb - The tvbbuff of packet data
4325 *       offset - The offset in TVB where the attribute begins
4326 *       MadHeader - The common MAD header of the current SMP/SMA  */
4327 static void parse_RandomForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4328 {
4329     gint i = 0;
4330     gint local_offset = *offset;
4331     proto_tree *RandomForwardingTable_header_tree = NULL;
4332     proto_item *RandomForwardingTable_header_item = NULL;
4333     proto_item *tempItemLow = NULL;
4334
4335     if(!parentTree)
4336         return;
4337
4338     RandomForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4339     proto_item_set_text(RandomForwardingTable_header_item, "%s", "RandomForwardingTable");
4340     RandomForwardingTable_header_tree = proto_item_add_subtree(RandomForwardingTable_header_item, ett_randomforwardingtable);
4341
4342     for(i = 0; i < 16; i++)
4343     {
4344         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_LID,   tvb, local_offset, 2, FALSE); local_offset +=2;
4345         proto_item_append_text(tempItemLow, "(%u)", i);
4346         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_Valid, tvb, local_offset, 1, FALSE);
4347         proto_item_append_text(tempItemLow, "(%u)", i);
4348         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_LMC,   tvb, local_offset, 1, FALSE); local_offset +=1;
4349         proto_item_append_text(tempItemLow, "(%u)", i);
4350         tempItemLow = proto_tree_add_item(RandomForwardingTable_header_tree, hf_infiniband_RandomForwardingTable_Port,  tvb, local_offset, 1, FALSE); local_offset +=1;
4351         proto_item_append_text(tempItemLow, "(%u)", i);
4352     }
4353 }
4354
4355 /* Parse NoticesAndTraps Attribute
4356 * IN:   parentTree - The tree to add the dissection to
4357 *       tvb - The tvbbuff of packet data
4358 *       offset - The offset in TVB where the attribute begins
4359 *       MadHeader - The common MAD header of the current SMP/SMA  */
4360 static void parse_MulticastForwardingTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4361 {
4362     gint i = 0;
4363     gint local_offset = *offset;
4364     proto_tree *MulticastForwardingTable_header_tree = NULL;
4365     proto_item *MulticastForwardingTable_header_item = NULL;
4366     proto_item *tempItemLow = NULL;
4367
4368     if(!parentTree)
4369         return;
4370
4371     MulticastForwardingTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4372     proto_item_set_text(MulticastForwardingTable_header_item, "%s", "MulticastForwardingTable");
4373     MulticastForwardingTable_header_tree = proto_item_add_subtree(MulticastForwardingTable_header_item, ett_multicastforwardingtable);
4374
4375     for(i = 0; i < 16; i++)
4376     {
4377         tempItemLow = proto_tree_add_item(MulticastForwardingTable_header_tree, hf_infiniband_MulticastForwardingTable_PortMask, tvb, local_offset, 2, FALSE); local_offset +=2;
4378         proto_item_append_text(tempItemLow, "(%u)", i);
4379     }
4380
4381 }
4382
4383 /* Parse SMInfo Attribute
4384 * IN:   parentTree - The tree to add the dissection to
4385 *       tvb - The tvbbuff of packet data
4386 *       offset - The offset in TVB where the attribute begins
4387 *       MadHeader - The common MAD header of the current SMP/SMA  */
4388 static void parse_SMInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4389 {
4390     gint local_offset = *offset;
4391     proto_tree *SMInfo_header_tree = NULL;
4392     proto_item *SMInfo_header_item = NULL;
4393
4394     if(!parentTree)
4395         return;
4396
4397     SMInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4398     proto_item_set_text(SMInfo_header_item, "%s", "SMInfo");
4399     SMInfo_header_tree = proto_item_add_subtree(SMInfo_header_item, ett_sminfo);
4400
4401     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_GUID,      tvb, local_offset, 8, FALSE); local_offset +=8;
4402     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_SM_Key,    tvb, local_offset, 8, FALSE); local_offset +=8;
4403     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_ActCount,  tvb, local_offset, 4, FALSE); local_offset +=4;
4404     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_Priority,  tvb, local_offset, 1, FALSE);
4405     proto_tree_add_item(SMInfo_header_tree, hf_infiniband_SMInfo_SMState,   tvb, local_offset, 1, FALSE); local_offset +=1;
4406 }
4407
4408 /* Parse VendorDiag Attribute
4409 * IN:   parentTree - The tree to add the dissection to
4410 *       tvb - The tvbbuff of packet data
4411 *       offset - The offset in TVB where the attribute begins
4412 *       MadHeader - The common MAD header of the current SMP/SMA  */
4413 static void parse_VendorDiag(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4414 {
4415     gint local_offset = *offset;
4416     proto_tree *VendorDiag_header_tree = NULL;
4417     proto_item *VendorDiag_header_item = NULL;
4418
4419     if(!parentTree)
4420         return;
4421
4422     VendorDiag_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4423     proto_item_set_text(VendorDiag_header_item, "%s", "VendorDiag");
4424     VendorDiag_header_tree = proto_item_add_subtree(VendorDiag_header_item, ett_vendordiag);
4425
4426     proto_tree_add_item(VendorDiag_header_tree, hf_infiniband_VendorDiag_NextIndex,     tvb, local_offset, 2, FALSE); local_offset +=2;
4427     proto_tree_add_item(VendorDiag_header_tree, hf_infiniband_VendorDiag_DiagData,      tvb, local_offset, 62, FALSE); local_offset +=62;
4428 }
4429
4430 /* Parse LedInfo Attribute
4431 * IN:   parentTree - The tree to add the dissection to
4432 *       tvb - The tvbbuff of packet data
4433 *       offset - The offset in TVB where the attribute begins
4434 *       MadHeader - The common MAD header of the current SMP/SMA  */
4435 static void parse_LedInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4436 {
4437     gint local_offset = *offset;
4438     proto_tree *LedInfo_header_tree = NULL;
4439     proto_item *LedInfo_header_item = NULL;
4440
4441     if(!parentTree)
4442         return;
4443
4444     LedInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4445     proto_item_set_text(LedInfo_header_item, "%s", "LedInfo");
4446     LedInfo_header_tree = proto_item_add_subtree(LedInfo_header_item, ett_ledinfo);
4447
4448     proto_tree_add_item(LedInfo_header_tree, hf_infiniband_LedInfo_LedMask,     tvb, local_offset, 1, FALSE);
4449 }
4450
4451 /* Parse LinkSpeedWidthPairsTable Attribute
4452 * IN:   parentTree - The tree to add the dissection to
4453 *       tvb - The tvbbuff of packet data
4454 *       offset - The offset in TVB where the attribute begins
4455 *       MadHeader - The common MAD header of the current SMP/SMA  */
4456 static void parse_LinkSpeedWidthPairsTable(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4457 {
4458     gint local_offset = *offset;
4459     proto_tree *LinkSpeedWidthPairsTable_header_tree = NULL;
4460     proto_item *LinkSpeedWidthPairsTable_header_item = NULL;
4461
4462     if(!parentTree)
4463         return;
4464
4465     LinkSpeedWidthPairsTable_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 64, FALSE);
4466     proto_item_set_text(LinkSpeedWidthPairsTable_header_item, "%s", "LinkSpeedWidthPairsTable");
4467     LinkSpeedWidthPairsTable_header_tree = proto_item_add_subtree(LinkSpeedWidthPairsTable_header_item, ett_linkspeedwidthpairs);
4468
4469     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_NumTables,     tvb, local_offset, 1, FALSE); local_offset +=1;
4470     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_PortMask,      tvb, local_offset, 32, FALSE); local_offset +=32;
4471     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedTwoFive,  tvb, local_offset, 1, FALSE); local_offset +=1;
4472     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedFive,     tvb, local_offset, 1, FALSE); local_offset +=1;
4473     proto_tree_add_item(LinkSpeedWidthPairsTable_header_tree, hf_infiniband_LinkSpeedWidthPairsTable_SpeedTen,      tvb, local_offset, 1, FALSE); local_offset +=1;
4474 }
4475
4476 /* Parse RID Field from Subnet Administraiton Packets.
4477 * IN: SA_header_tree - the dissection tree of the subnet admin attribute.
4478 *     tvb - the packet buffer
4479 *      MadHeader - the Common MAD header from this packet.
4480 * IN/OUT:  offset - the current and updated offset in the packet buffer */
4481 static void parse_RID(proto_tree* SA_header_tree, tvbuff_t* tvb, gint *offset, MAD_Data* MadHeader)
4482 {
4483     gint local_offset = *offset;
4484     if(!SA_header_tree)
4485     {
4486         return;
4487     }
4488         switch(MadHeader->attributeID)
4489         {
4490             case 0x0011:
4491                 /* NodeRecord */
4492                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,   tvb, local_offset, 2, FALSE); local_offset+=2;
4493                 local_offset+=2; /* Reserved bits */
4494                 break;
4495             case 0x0012:
4496                 /* PortInfoRecord */
4497                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_EndportLID,    tvb, local_offset, 2, FALSE); local_offset+=2;
4498                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_PortNum,       tvb, local_offset, 1, FALSE); local_offset+=1;
4499                 local_offset+=1; /* Reserved bits */
4500                 break;
4501             case 0x0013:
4502                 /* SLtoVLMappingTableRecord */
4503                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
4504                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_InputPortNum,  tvb, local_offset, 1, FALSE); local_offset+=1;
4505                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_OutputPortNum, tvb, local_offset, 1, FALSE); local_offset+=1;
4506                 local_offset+=4; /* Reserved bits */
4507                 break;
4508             case 0x0014:
4509                 /* SwitchInfoRecord */
4510                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
4511                 local_offset+=2; /* Reserved bits */
4512                 break;
4513             case 0x0015:
4514                 /* LinearForwardingTableRecord */
4515                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
4516                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
4517                 local_offset+=4; /* Reserved bits */
4518                 break;
4519             case 0x0016:
4520                 /* RandomForwardingTableRecord */
4521                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
4522                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
4523                 local_offset+=4; /* Reserved bits */
4524                 break;
4525             case 0x0017:
4526                 /* MulticastForwardingTableRecord */
4527                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
4528                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_Position,          tvb, local_offset, 1, FALSE);
4529                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_NineBit,  tvb, local_offset, 2, FALSE); local_offset+=2;
4530                 local_offset+=4; /* Reserved bits */
4531                 break;
4532             case 0x0036:
4533                 /*VLArbitrationTableRecord */
4534                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,           tvb, local_offset, 2, FALSE); local_offset+=2;
4535                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_OutputPortNum, tvb, local_offset, 1, FALSE); local_offset+=1;
4536                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_EightBit,     tvb, local_offset, 1, FALSE); local_offset+=1;
4537                 local_offset+=4; /* Reserved bits */
4538                 break;
4539             case 0x0018:
4540                 /* SMInfoRecord */
4541                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
4542                 local_offset+=2; /* Reserved bits */
4543                 break;
4544             case 0x0033:
4545                 /* P_KeyTableRecord */
4546                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,                   tvb, local_offset, 2, FALSE); local_offset+=2;
4547                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_SixteenBit,   tvb, local_offset, 2, FALSE); local_offset+=2;
4548                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_PortNum,               tvb, local_offset, 1, FALSE); local_offset+=1;
4549                 local_offset+=3; /* Reserved bits */
4550                 break;
4551             case 0x00F3:
4552                 /* InformInfoRecord */
4553                 proto_tree_add_item(SA_header_tree, hf_infiniband_InformInfoRecord_SubscriberGID,   tvb, local_offset, 16, FALSE); local_offset+=16;
4554                 proto_tree_add_item(SA_header_tree, hf_infiniband_InformInfoRecord_Enum,            tvb, local_offset, 2, FALSE); local_offset+=2;
4555                 local_offset+=6; /* Reserved bits */
4556                 break;
4557             case 0x0020:
4558                 /* LinkRecord */
4559                 proto_tree_add_item(SA_header_tree, hf_infiniband_LinkRecord_FromLID,   tvb, local_offset, 2, FALSE); local_offset+=2;
4560                 proto_tree_add_item(SA_header_tree, hf_infiniband_LinkRecord_FromPort,  tvb, local_offset, 1, FALSE); local_offset+=1;
4561                 break;
4562             case 0x0031:
4563                 /* ServiceRecord */
4564                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceID,      tvb, local_offset, 8, FALSE); local_offset+=8;
4565                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceGID,     tvb, local_offset, 16, FALSE); local_offset+=16;
4566                 proto_tree_add_item(SA_header_tree, hf_infiniband_ServiceRecord_ServiceP_Key,   tvb, local_offset, 2, FALSE); local_offset+=2;
4567                 local_offset+=2;
4568                 break;
4569             case 0x0038:
4570                 /* MCMemberRecord */
4571                 proto_tree_add_item(SA_header_tree, hf_infiniband_MCMemberRecord_MGID,      tvb, local_offset, 16, FALSE); local_offset+=16;
4572                 proto_tree_add_item(SA_header_tree, hf_infiniband_MCMemberRecord_PortGID,   tvb, local_offset, 16, FALSE); local_offset+=16;
4573                 break;
4574             case 0x0030:
4575                 /* GuidInfoRecord */
4576                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_LID,               tvb, local_offset, 2, FALSE); local_offset+=2;
4577                 proto_tree_add_item(SA_header_tree, hf_infiniband_SA_BlockNum_EightBit, tvb, local_offset, 1, FALSE); local_offset+=2;
4578                 local_offset+=4;
4579                 break;
4580             default:
4581                 break;
4582         }
4583
4584     *offset = local_offset;
4585 }
4586
4587 /* Parse InformInfo Attribute
4588 * IN:   parentTree - The tree to add the dissection to
4589 *       tvb - The tvbbuff of packet data
4590 *       offset - The offset in TVB where the attribute begins
4591 *       MadHeader - The common MAD header of the current SMP/SMA  */
4592 static void parse_InformInfo(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4593 {
4594     gint local_offset = *offset;
4595     proto_tree *InformInfo_header_tree = NULL;
4596     proto_item *InformInfo_header_item = NULL;
4597     if(!parentTree)
4598     {
4599         return;
4600     }
4601     InformInfo_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 36, FALSE);
4602     proto_item_set_text(InformInfo_header_item, "%s", "InformInfo");
4603     InformInfo_header_tree = proto_item_add_subtree(InformInfo_header_item, ett_informinfo);
4604
4605     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_GID,                   tvb, local_offset, 16, FALSE); local_offset+=16;
4606     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_LIDRangeBegin,         tvb, local_offset, 2, FALSE); local_offset+=2;
4607     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_LIDRangeEnd,           tvb, local_offset, 2, FALSE); local_offset+=2;
4608     local_offset+=2; /* Reserved Bits */
4609     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_IsGeneric,             tvb, local_offset, 1, FALSE); local_offset+=1;
4610     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_Subscribe,             tvb, local_offset, 1, FALSE); local_offset+=1;
4611     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_Type,                  tvb, local_offset, 2, FALSE); local_offset+=2;
4612     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_TrapNumberDeviceID,    tvb, local_offset, 2, FALSE); local_offset+=2;
4613     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_QPN,                   tvb, local_offset, 3, FALSE); local_offset+=3;
4614     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_RespTimeValue,         tvb, local_offset, 1, FALSE); local_offset+=1;
4615     local_offset+=1;
4616     proto_tree_add_item(InformInfo_header_tree, hf_infiniband_InformInfo_ProducerTypeVendorID,  tvb, local_offset, 3, FALSE); local_offset+=3;
4617
4618 }
4619 /* Parse LinkRecord Attribute
4620 * IN:   parentTree - The tree to add the dissection to
4621 *       tvb - The tvbbuff of packet data
4622 *       offset - The offset in TVB where the attribute begins
4623 *       MadHeader - The common MAD header of the current SMP/SMA  */
4624 static void parse_LinkRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4625 {
4626     gint local_offset = *offset;
4627     proto_tree *LinkRecord_header_tree = NULL;
4628     proto_item *LinkRecord_header_item = NULL;
4629
4630     if(!parentTree)
4631     {
4632         return;
4633     }
4634
4635     LinkRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 3, FALSE);
4636     proto_item_set_text(LinkRecord_header_item, "%s", "LinkRecord");
4637     LinkRecord_header_tree = proto_item_add_subtree(LinkRecord_header_item, ett_linkrecord);
4638
4639     proto_tree_add_item(LinkRecord_header_tree, hf_infiniband_LinkRecord_ToPort,    tvb, local_offset, 1, FALSE); local_offset+=1;
4640     proto_tree_add_item(LinkRecord_header_tree, hf_infiniband_LinkRecord_ToLID,     tvb, local_offset, 2, FALSE); local_offset +=2;
4641
4642 }
4643 /* Parse ServiceRecord Attribute
4644 * IN:   parentTree - The tree to add the dissection to
4645 *       tvb - The tvbbuff of packet data
4646 *       offset - The offset in TVB where the attribute begins
4647 *       MadHeader - The common MAD header of the current SMP/SMA  */
4648 static void parse_ServiceRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4649 {
4650     gint local_offset = *offset;
4651     proto_tree *ServiceRecord_header_tree = NULL;
4652     proto_item *ServiceRecord_header_item = NULL;
4653     proto_item *tempData = NULL;
4654
4655     if(!parentTree)
4656     {
4657         return;
4658     }
4659
4660     ServiceRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 176, FALSE);
4661     proto_item_set_text(ServiceRecord_header_item, "%s", "ServiceRecord");
4662     ServiceRecord_header_tree = proto_item_add_subtree(ServiceRecord_header_item, ett_servicerecord);
4663
4664     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceLease,    tvb, local_offset, 4, FALSE); local_offset+=4;
4665     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceKey,      tvb, local_offset, 16, FALSE); local_offset+=16;
4666     proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceName,     tvb, local_offset, 64, FALSE); local_offset+=64;
4667
4668     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
4669     proto_item_append_text(tempData, "%s", "(ServiceData 8.1, 8.16)");
4670     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
4671     proto_item_append_text(tempData, "%s", "(ServiceData 16.1, 16.8)");
4672     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
4673     proto_item_append_text(tempData, "%s", "(ServiceData 32.1, 32.4)");
4674     tempData = proto_tree_add_item(ServiceRecord_header_tree, hf_infiniband_ServiceRecord_ServiceData,      tvb, local_offset, 16, FALSE); local_offset+=16;
4675     proto_item_append_text(tempData, "%s", "(ServiceData 64.1, 64.2)");
4676
4677 }
4678 /* Parse PathRecord Attribute
4679 * IN:   parentTree - The tree to add the dissection to
4680 *       tvb - The tvbbuff of packet data
4681 *       offset - The offset in TVB where the attribute begins
4682 *       MadHeader - The common MAD header of the current SMP/SMA  */
4683 static void parse_PathRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4684 {
4685     gint local_offset = *offset;
4686     proto_tree *PathRecord_header_tree = NULL;
4687     proto_item *PathRecord_header_item = NULL;
4688
4689     if(!parentTree)
4690     {
4691         return;
4692     }
4693
4694     PathRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 64, FALSE);
4695     proto_item_set_text(PathRecord_header_item, "%s", "PathRecord");
4696     PathRecord_header_tree = proto_item_add_subtree(PathRecord_header_item, ett_pathrecord);
4697     local_offset += 8; /* Reserved Bits */
4698
4699     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_DGID,          tvb, local_offset, 16, FALSE); local_offset+=16;
4700     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SGID,          tvb, local_offset, 16, FALSE); local_offset+=16;
4701     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_DLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
4702     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
4703     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_RawTraffic,    tvb, local_offset, 1, FALSE);
4704     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_FlowLabel,     tvb, local_offset, 3, FALSE); local_offset+=3;
4705     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_HopLimit,      tvb, local_offset, 1, FALSE); local_offset+=1;
4706     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_TClass,        tvb, local_offset, 1, FALSE); local_offset+=1;
4707     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Reversible,    tvb, local_offset, 1, FALSE);
4708     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_NumbPath,      tvb, local_offset, 1, FALSE); local_offset+=1;
4709     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_P_Key,         tvb, local_offset, 2, FALSE); local_offset+=2;
4710     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_SL,            tvb, local_offset, 2, FALSE); local_offset+=2;
4711     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_MTUSelector,   tvb, local_offset, 1, FALSE);
4712     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_MTU,           tvb, local_offset, 1, FALSE); local_offset+=1;
4713     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_RateSelector,  tvb, local_offset, 1, FALSE);
4714     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Rate,          tvb, local_offset, 1, FALSE); local_offset+=1;
4715     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_PacketLifeTimeSelector,    tvb, local_offset, 1, FALSE);
4716     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_PacketLifeTime,            tvb, local_offset, 1, FALSE); local_offset+=1;
4717     proto_tree_add_item(PathRecord_header_tree, hf_infiniband_PathRecord_Preference,                tvb, local_offset, 1, FALSE); local_offset+=1;
4718 }
4719 /* Parse MCMemberRecord Attribute
4720 * IN:   parentTree - The tree to add the dissection to
4721 *       tvb - The tvbbuff of packet data
4722 *       offset - The offset in TVB where the attribute begins
4723 *       MadHeader - The common MAD header of the current SMP/SMA  */
4724 static void parse_MCMemberRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4725 {
4726     gint local_offset = *offset;
4727     proto_tree *MCMemberRecord_header_tree = NULL;
4728     proto_item *MCMemberRecord_header_item = NULL;
4729
4730     if(!parentTree)
4731     {
4732         return;
4733     }
4734
4735     MCMemberRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 64, FALSE);
4736     proto_item_set_text(MCMemberRecord_header_item, "%s", "MCMemberRecord");
4737     MCMemberRecord_header_tree = proto_item_add_subtree(MCMemberRecord_header_item, ett_mcmemberrecord);
4738
4739     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Q_Key,         tvb, local_offset, 4, FALSE); local_offset+=4;
4740     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MLID,          tvb, local_offset, 2, FALSE); local_offset+=2;
4741     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MTUSelector,   tvb, local_offset, 1, FALSE);
4742     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_MTU,           tvb, local_offset, 1, FALSE); local_offset+=1;
4743     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_TClass,        tvb, local_offset, 1, FALSE); local_offset+=1;
4744     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_P_Key,         tvb, local_offset, 2, FALSE); local_offset+=2;
4745     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_RateSelector,  tvb, local_offset, 1, FALSE);
4746     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Rate,          tvb, local_offset, 1, FALSE); local_offset+=1;
4747     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_PacketLifeTimeSelector,    tvb, local_offset, 1, FALSE);
4748     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_PacketLifeTime,            tvb, local_offset, 1, FALSE); local_offset+=1;
4749     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_SL,            tvb, local_offset, 1, FALSE);
4750     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_FlowLabel,     tvb, local_offset, 3, FALSE); local_offset+=3;
4751     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_HopLimit,      tvb, local_offset, 1, FALSE); local_offset+=1;
4752     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_Scope,         tvb, local_offset, 1, FALSE);
4753     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_JoinState,     tvb, local_offset, 1, FALSE); local_offset+=1;
4754     proto_tree_add_item(MCMemberRecord_header_tree, hf_infiniband_MCMemberRecord_ProxyJoin,     tvb, local_offset, 1, FALSE); local_offset+=3;
4755
4756 }
4757 /* Parse TraceRecord Attribute
4758 * IN:   parentTree - The tree to add the dissection to
4759 *       tvb - The tvbbuff of packet data
4760 *       offset - The offset in TVB where the attribute begins
4761 *       MadHeader - The common MAD header of the current SMP/SMA  */
4762 static void parse_TraceRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4763 {
4764     gint local_offset = *offset;
4765     proto_tree *TraceRecord_header_tree = NULL;
4766     proto_item *TraceRecord_header_item = NULL;
4767
4768     if(!parentTree)
4769     {
4770         return;
4771     }
4772
4773     TraceRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 46, FALSE);
4774     proto_item_set_text(TraceRecord_header_item, "%s", "TraceRecord");
4775     TraceRecord_header_tree = proto_item_add_subtree(TraceRecord_header_item, ett_tracerecord);
4776
4777     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_GIDPrefix,       tvb, local_offset, 8, FALSE); local_offset+=8;
4778     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_IDGeneration,    tvb, local_offset, 2, FALSE); local_offset+=2;
4779     local_offset+=1; /* Reserved Bits */
4780     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_NodeType,        tvb, local_offset, 1, FALSE); local_offset+=1;
4781     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_NodeID,          tvb, local_offset, 8, FALSE); local_offset+=8;
4782     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ChassisID,       tvb, local_offset, 8, FALSE); local_offset+=8;
4783     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_EntryPortID,     tvb, local_offset, 8, FALSE); local_offset+=8;
4784     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ExitPortID,      tvb, local_offset, 8, FALSE); local_offset+=8;
4785     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_EntryPort,       tvb, local_offset, 1, FALSE); local_offset+=1;
4786     proto_tree_add_item(TraceRecord_header_tree, hf_infiniband_TraceRecord_ExitPort,        tvb, local_offset, 1, FALSE); local_offset+=1;
4787 }
4788 /* Parse MultiPathRecord Attribute
4789 * IN:   parentTree - The tree to add the dissection to
4790 *       tvb - The tvbbuff of packet data
4791 *       offset - The offset in TVB where the attribute begins
4792 *       MadHeader - The common MAD header of the current SMP/SMA  */
4793 static void parse_MultiPathRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4794 {
4795     gint local_offset = *offset;
4796     proto_tree *MultiPathRecord_header_tree = NULL;
4797     proto_item *MultiPathRecord_header_item = NULL;
4798     proto_item *SDGID = NULL;
4799     guint8 SDGIDCount = 0;
4800     guint8 DGIDCount = 0;
4801     guint32 i = 0;
4802
4803     if(!parentTree)
4804     {
4805         return;
4806     }
4807
4808     MultiPathRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 200, FALSE);
4809     proto_item_set_text(MultiPathRecord_header_item, "%s", "MultiPathRecord");
4810     MultiPathRecord_header_tree = proto_item_add_subtree(MultiPathRecord_header_item, ett_multipathrecord);
4811
4812     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_RawTraffic,      tvb, local_offset, 1, FALSE);
4813     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_FlowLabel,       tvb, local_offset, 3, FALSE); local_offset+=3;
4814     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_HopLimit,        tvb, local_offset, 1, FALSE); local_offset+=1;
4815     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_TClass,          tvb, local_offset, 1, FALSE); local_offset+=1;
4816     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_Reversible,      tvb, local_offset, 1, FALSE);
4817     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_NumbPath,        tvb, local_offset, 1, FALSE); local_offset+=1;
4818     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_P_Key,           tvb, local_offset, 2, FALSE); local_offset+=2;
4819     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SL,              tvb, local_offset, 2, FALSE); local_offset+=2;
4820     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_MTUSelector,     tvb, local_offset, 1, FALSE);
4821     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_MTU,             tvb, local_offset, 1, FALSE); local_offset+=1;
4822     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_RateSelector,    tvb, local_offset, 1, FALSE);
4823     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_Rate,            tvb, local_offset, 1, FALSE); local_offset+=1;
4824     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_PacketLifeTimeSelector,  tvb, local_offset, 1, FALSE);
4825     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_PacketLifeTime,          tvb, local_offset, 1, FALSE); local_offset+=1;
4826     local_offset+=1; /* Reserved Bits */
4827     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_IndependenceSelector,    tvb, local_offset, 1, FALSE);
4828     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_GIDScope,                tvb, local_offset, 1, FALSE); local_offset+=1;
4829
4830     SDGIDCount = tvb_get_guint8(tvb, local_offset);
4831     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SGIDCount,       tvb, local_offset, 1, FALSE); local_offset+=1;
4832     DGIDCount = tvb_get_guint8(tvb, local_offset);
4833     proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_DGIDCount,       tvb, local_offset, 1, FALSE); local_offset+=1;
4834     local_offset+=7; /*Reserved Bits */
4835
4836     for(i = 0; i < SDGIDCount; i++)
4837     {
4838         SDGID = proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SDGID,       tvb, local_offset, 16, FALSE); local_offset+=16;
4839         proto_item_set_text(SDGID, "(%s%u)","SGID", i);
4840     }
4841     for(i = 0; i < DGIDCount; i++)
4842     {
4843         SDGID = proto_tree_add_item(MultiPathRecord_header_tree, hf_infiniband_MultiPathRecord_SDGID,       tvb, local_offset, 16, FALSE); local_offset+=16;
4844         proto_item_set_text(SDGID, "(%s%u)","DGID", i);
4845     }
4846 }
4847 /* Parse ServiceAssociationRecord Attribute
4848 * IN:   parentTree - The tree to add the dissection to
4849 *       tvb - The tvbbuff of packet data
4850 *       offset - The offset in TVB where the attribute begins
4851 *       MadHeader - The common MAD header of the current SMP/SMA  */
4852 static void parse_ServiceAssociationRecord(proto_tree* parentTree, tvbuff_t* tvb, gint *offset)
4853 {
4854     gint local_offset = *offset;
4855     proto_tree *ServiceAssociationRecord_header_tree = NULL;
4856     proto_item *ServiceAssociationRecord_header_item = NULL;
4857
4858     if(!parentTree)
4859     {
4860         return;
4861     }
4862
4863     ServiceAssociationRecord_header_item = proto_tree_add_item(parentTree, hf_infiniband_SA, tvb, local_offset, 80, FALSE);
4864     proto_item_set_text(ServiceAssociationRecord_header_item, "%s", "ServiceAssociationRecord");
4865     ServiceAssociationRecord_header_tree = proto_item_add_subtree(ServiceAssociationRecord_header_item, ett_serviceassocrecord);
4866
4867     proto_tree_add_item(ServiceAssociationRecord_header_tree, hf_infiniband_ServiceAssociationRecord_ServiceKey,        tvb, local_offset, 16, FALSE); local_offset +=16;
4868     proto_tree_add_item(ServiceAssociationRecord_header_tree, hf_infiniband_ServiceAssociationRecord_ServiceName,       tvb, local_offset, 64, FALSE); local_offset +=64;
4869 }
4870
4871 /* Parse PortCounters MAD from the Performance management class.
4872 * IN:   parentTree - The tree to add the dissection to
4873 *       tvb - The tvbbuff of packet data
4874 *       offset - The offset in TVB where the attribute begins
4875 *       pinfo - The packet info structure with column information  */
4876 static void parse_PERF_PortCounters(proto_tree* parentTree, tvbuff_t* tvb, packet_info *pinfo, gint *offset)
4877 {
4878     proto_item *perf_item = NULL;
4879     proto_tree *perf_tree = NULL;
4880     gint local_offset = *offset;
4881
4882     col_set_str(pinfo->cinfo, COL_INFO, "PERF (PortCounters)");
4883
4884     perf_item = proto_tree_add_item(parentTree, hf_infiniband_PortCounters, tvb, local_offset, 40, FALSE);
4885     perf_tree = proto_item_add_subtree(perf_item, ett_perfclass);
4886
4887     local_offset += 40; /* skip reserved field */
4888     local_offset += 1;  /* skip reserved field */
4889     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortSelect,  tvb, local_offset, 1, FALSE); local_offset += 1;
4890     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_CounterSelect, tvb, local_offset, 2, FALSE); local_offset += 2;
4891     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_SymbolErrorCounter, tvb, local_offset, 2, FALSE); local_offset += 2;
4892     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_LinkErrorRecoveryCounter, tvb, local_offset, 1, FALSE); local_offset += 1;
4893     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_LinkDownedCounter, tvb, local_offset, 1, FALSE); local_offset += 1;
4894     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvErrors, tvb, local_offset, 2, FALSE); local_offset += 2;
4895     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvRemotePhysicalErrors, tvb, local_offset, 2, FALSE); local_offset += 2;
4896     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvSwitchRelayErrors, tvb, local_offset, 2, FALSE); local_offset += 2;
4897     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortXmitDiscards, tvb, local_offset, 2, FALSE); local_offset += 2;
4898     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortXmitConstraintErrors, tvb, local_offset, 1, FALSE); local_offset += 1;
4899     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvConstraintErrors, tvb, local_offset, 1, FALSE); local_offset += 1;
4900     local_offset += 1;  /* skip reserved field */
4901     proto_tree_add_bits_item(perf_tree, hf_infiniband_PortCounters_LocalLinkIntegrityErrors, tvb, local_offset*8, 4, FALSE);
4902     proto_tree_add_bits_item(perf_tree, hf_infiniband_PortCounters_ExcessiveBufferOverrunErrors, tvb, local_offset*8 + 4, 4, FALSE); local_offset += 1;
4903     local_offset += 2;  /* skip reserved field */
4904     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_VL15Dropped, tvb, local_offset, 2, FALSE); local_offset += 2;
4905     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortXmitData, tvb, local_offset, 4, FALSE); local_offset += 4;
4906     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvData, tvb, local_offset, 4, FALSE); local_offset += 4;
4907     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortXmitPkts, tvb, local_offset, 4, FALSE); local_offset += 4;
4908     proto_tree_add_item(perf_tree, hf_infiniband_PortCounters_PortRcvPkts, tvb, local_offset, 4, FALSE); local_offset += 4;
4909
4910     *offset = local_offset; /* update caller's offset to point to end of the PortCounters payload */
4911     return;
4912 }
4913
4914 /* Parse PortCountersExtended MAD from the Performance management class.
4915 * IN:   parentTree - The tree to add the dissection to
4916 *       tvb - The tvbbuff of packet data
4917 *       offset - The offset in TVB where the attribute begins
4918 *       pinfo - The packet info structure with column information  */
4919 static void parse_PERF_PortCountersExtended(proto_tree* parentTree, tvbuff_t* tvb, packet_info *pinfo, gint *offset)
4920 {
4921     proto_item *perf_item = NULL;
4922     proto_tree *perf_tree = NULL;
4923     gint local_offset = *offset;
4924
4925     col_set_str(pinfo->cinfo, COL_INFO, "PERF (PortCountersExtended)");
4926
4927     perf_item = proto_tree_add_item(parentTree, hf_infiniband_PortCountersExt, tvb, local_offset, 72, FALSE);
4928     perf_tree = proto_item_add_subtree(perf_item, ett_perfclass);
4929
4930     local_offset += 40; /* skip reserved field */
4931     local_offset += 1;  /* skip reserved field */
4932     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortSelect,  tvb, local_offset, 1, FALSE); local_offset += 1;
4933     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_CounterSelect, tvb, local_offset, 2, FALSE); local_offset += 2;
4934     local_offset += 4;  /* skip reserved field */
4935     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortXmitData, tvb, local_offset, 8, FALSE); local_offset += 8;
4936     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortRcvData, tvb, local_offset, 8, FALSE); local_offset += 8;
4937     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortXmitPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4938     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortRcvPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4939     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortUnicastXmitPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4940     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortUnicastRcvPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4941     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortMulticastXmitPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4942     proto_tree_add_item(perf_tree, hf_infiniband_PortCountersExt_PortMulticastRcvPkts, tvb, local_offset, 8, FALSE); local_offset += 8;
4943
4944     *offset = local_offset; /* update caller's offset to point to end of the PortCountersExt payload */
4945     return;
4946 }
4947
4948 /* dissect_general_info
4949 * Used to extract very few values from the packet in the case that full dissection is disabled by the user.
4950 * IN:
4951 *       tvb - The tvbbuff of packet data
4952 *       offset - The offset in TVB where the attribute begins
4953 *       pinfo - The packet info structure with column information
4954 *       starts_with_grh - If true this packets start with a GRH header, otherwise with LRH  */
4955 static void dissect_general_info(tvbuff_t *tvb, gint offset, packet_info *pinfo, gboolean starts_with_grh)
4956 {
4957     guint8 lnh_val = 0;             /* The Link Next Header Value.  Tells us which headers are coming */
4958     gboolean bthFollows = 0;        /* Tracks if we are parsing a BTH.  This is a significant decision point */
4959     guint8 virtualLane = 0;         /* The Virtual Lane of the current Packet */
4960     guint8 opCode = 0;              /* OpCode from BTH header. */
4961     gint32 nextHeaderSequence = -1; /* defined by this dissector. #define which indicates the upcoming header sequence from OpCode */
4962     guint8 nxtHdr = 0;              /* that must be available for that header. */
4963     struct e_in6_addr SRCgid;       /* Struct to display ipv6 Address */
4964     struct e_in6_addr DSTgid;       /* Struct to display ipv6 Address */
4965     guint8 management_class = 0;
4966     MAD_Data MadData;
4967
4968     if (starts_with_grh) {
4969         /* this is a RoCE packet, skip LRH parsing */
4970         lnh_val = IBA_GLOBAL;
4971         goto skip_lrh;
4972     }
4973
4974     virtualLane =  tvb_get_guint8(tvb, offset);
4975     virtualLane = virtualLane & 0xF0;
4976     offset+=1;
4977
4978     /* Save Link Next Header... This tells us what the next header is. */
4979     lnh_val =  tvb_get_guint8(tvb, offset);
4980     lnh_val = lnh_val & 0x03;
4981     offset+=1;
4982
4983     /* Set destination in packet view. */
4984     *((guint16*) dst_addr) = tvb_get_ntohs(tvb, offset);
4985     SET_ADDRESS(&pinfo->dst, AT_IB, sizeof(guint16), dst_addr);
4986
4987     offset+=4;
4988
4989     /* Set Source in packet view. */
4990     *((guint16*) src_addr) = tvb_get_ntohs(tvb, offset);
4991     SET_ADDRESS(&pinfo->src, AT_IB, sizeof(guint16), src_addr);
4992
4993     offset+=2;
4994
4995 skip_lrh:
4996
4997     switch(lnh_val)
4998     {
4999         case IBA_GLOBAL:
5000             offset +=6;
5001             nxtHdr = tvb_get_guint8(tvb, offset);
5002             offset += 2;
5003
5004             tvb_get_ipv6(tvb, offset, &SRCgid);
5005
5006             /* Set source GID in packet view. */
5007             memcpy(src_addr, &SRCgid, GID_SIZE);
5008             SET_ADDRESS(&pinfo->src, AT_IB, GID_SIZE, src_addr);
5009
5010             offset += 16;
5011
5012             tvb_get_ipv6(tvb, offset, &DSTgid);
5013
5014             /* Set destination GID in packet view. */
5015             memcpy(dst_addr, &DSTgid, GID_SIZE);
5016             SET_ADDRESS(&pinfo->dst, AT_IB, GID_SIZE, dst_addr);
5017
5018             offset += 16;
5019
5020             if(nxtHdr != 0x1B)
5021             {
5022                 /* Some kind of packet being transported globally with IBA, but locally it is not IBA - no BTH following. */
5023                 break;
5024             }
5025             /* else
5026              * {
5027              *      Fall through switch and start parsing Local Headers and BTH
5028              * }
5029              */
5030         case IBA_LOCAL:
5031             bthFollows = TRUE;
5032
5033             /* Get the OpCode - this tells us what headers are following */
5034             opCode = tvb_get_guint8(tvb, offset);
5035             col_append_str(pinfo->cinfo, COL_INFO, val_to_str((guint32)opCode, OpCodeMap, "Unknown OpCode"));
5036             offset +=12;
5037             break;
5038         case IP_NON_IBA:
5039             /* Raw IPv6 Packet */
5040             g_snprintf(dst_addr,  ADDR_MAX_LEN, "IPv6 over IB Packet");
5041             SET_ADDRESS(&pinfo->dst,  AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
5042             break;
5043         case RAW:
5044             break;
5045         default:
5046             break;
5047     }
5048
5049     if(bthFollows)
5050     {
5051         /* Find our next header sequence based on the Opcode
5052          * Since we're not doing dissection here, we just need the proper offsets to get our labels in packet view */
5053
5054         nextHeaderSequence = find_next_header_sequence((guint32) opCode);
5055         switch(nextHeaderSequence)
5056         {
5057             case RDETH_DETH_PAYLD:
5058                 offset += 4; /* RDETH */
5059                 offset += 8; /* DETH */
5060                 break;
5061             case RDETH_DETH_RETH_PAYLD:
5062                 offset += 4; /* RDETH */
5063                 offset += 8; /* DETH */
5064                 offset += 16; /* RETH */
5065                 break;
5066             case RDETH_DETH_IMMDT_PAYLD:
5067                 offset += 4; /* RDETH */
5068                 offset += 8; /* DETH */
5069                 offset += 4; /* IMMDT */
5070                 break;
5071             case RDETH_DETH_RETH_IMMDT_PAYLD:
5072                 offset += 4; /* RDETH */
5073                 offset += 8; /* DETH */
5074                 offset += 16; /* RETH */
5075                 offset += 4; /* IMMDT */
5076                 break;
5077             case RDETH_DETH_RETH:
5078                 offset += 4; /* RDETH */
5079                 offset += 8; /* DETH */
5080                 offset += 16; /* RETH */
5081                 break;
5082             case RDETH_AETH_PAYLD:
5083                 offset += 4; /* RDETH */
5084                 offset += 4; /* AETH */
5085                 break;
5086             case RDETH_PAYLD:
5087                 offset += 4; /* RDETH */
5088                 break;
5089             case RDETH_AETH:
5090                 offset += 4; /* RDETH */
5091                 offset += 4; /* AETH */
5092                 break;
5093             case RDETH_AETH_ATOMICACKETH:
5094                 offset += 4; /* RDETH */
5095                 offset += 4; /* AETH */
5096                 offset += 8; /* AtomicAckETH */
5097                 break;
5098             case RDETH_DETH_ATOMICETH:
5099                 offset += 4; /* RDETH */
5100                 offset += 8; /* DETH */
5101                 offset += 28; /* AtomicETH */
5102                 break;
5103             case RDETH_DETH:
5104                 offset += 4; /* RDETH */
5105                 offset += 8; /* DETH */
5106                 break;
5107             case DETH_PAYLD:
5108                 offset += 8; /* DETH */
5109                 break;
5110             case PAYLD:
5111                 break;
5112             case IMMDT_PAYLD:
5113                 offset += 4; /* IMMDT */
5114                 break;
5115             case RETH_PAYLD:
5116                 offset += 16; /* RETH */
5117                 break;
5118             case RETH:
5119                 offset += 16; /* RETH */
5120                 break;
5121             case AETH_PAYLD:
5122                 offset += 4; /* AETH */
5123                 break;
5124             case AETH:
5125                 offset += 4; /* AETH */
5126                 break;
5127             case AETH_ATOMICACKETH:
5128                 offset += 4; /* AETH */
5129                 offset += 8; /* AtomicAckETH */
5130                 break;
5131             case ATOMICETH:
5132                 offset += 28; /* AtomicETH */
5133                 break;
5134             case IETH_PAYLD:
5135                 offset += 4; /* IETH */
5136                 break;
5137             case DETH_IMMDT_PAYLD:
5138                 offset += 8; /* DETH */
5139                 offset += 4; /* IMMDT */
5140                 break;
5141             default:
5142                 break;
5143         }
5144     }
5145     if(virtualLane == 0xF0)
5146     {
5147         management_class =  tvb_get_guint8(tvb, offset + 1);
5148         if(((management_class >= (guint8)VENDOR_1_START) && (management_class <= (guint8)VENDOR_1_END))
5149         || ((management_class >= (guint8)VENDOR_2_START) && (management_class <= (guint8)VENDOR_2_END)))
5150         {
5151             return;
5152         }
5153         else if((management_class >= (guint8)APPLICATION_START) && (management_class <= (guint8)APPLICATION_END))
5154         {
5155             return;
5156         }
5157         else if(((management_class == (guint8)0x00) || (management_class == (guint8)0x02))
5158             || ((management_class >= (guint8)0x50) && (management_class <= (guint8)0x80))
5159             || ((management_class >= (guint8)0x82)))
5160         {
5161             return;
5162         }
5163         else /* we have a normal management_class */
5164         {
5165             parse_MAD_Common(NULL, tvb, &offset, &MadData);
5166             label_SUBM_Method(NULL, &MadData, pinfo);
5167             label_SUBM_Attribute(NULL, &MadData, pinfo);
5168         }
5169     }
5170
5171     return;
5172 }
5173
5174 /* Protocol Registration */
5175 void proto_register_infiniband(void)
5176 {
5177     module_t *infiniband_module;
5178
5179     /* Field dissector structures.
5180     * For reserved fields, reservedX denotes the reserved field is X bits in length.
5181     * e.g. reserved2 is a reserved field 2 bits in length.
5182     * The third parameter is a filter string associated for this field.
5183     * So for instance, to filter packets for a given virtual lane,
5184     * The filter (infiniband.LRH.vl == 3) or something similar would be used. */
5185
5186     /* XXX: ToDo: Verify against Infiniband 1.2.1 Specification                           */
5187     /*            Fields verified/corrected: Those after comment "XX: All following ..."  */
5188
5189     /* meanings for MAD method field */
5190     static const value_string mad_method_str[] = {
5191         { 0x01, "Get()" },
5192         { 0x02, "Set()" },
5193         { 0x81, "GetResp()" },
5194         { 0x03, "Send()" },
5195         { 0x05, "Trap()" },
5196         { 0x06, "Report()" },
5197         { 0x86, "ReportResp()" },
5198         { 0x07, "TrapRepress()" },
5199         { 0,    NULL }
5200     };
5201
5202     static hf_register_info hf[] = {
5203         /* Local Route Header (LRH) */
5204         { &hf_infiniband_LRH, {
5205                 "Local Route Header", "infiniband.lrh",
5206                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5207         },
5208         { &hf_infiniband_virtual_lane, {
5209                 "Virtual Lane", "infiniband.lrh.vl",
5210                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
5211         },
5212         { &hf_infiniband_link_version, {
5213                 "Link Version", "infiniband.lrh.lver",
5214                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}
5215         },
5216         { &hf_infiniband_service_level, {
5217                 "Service Level", "infiniband.lrh.sl",
5218                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}
5219         },
5220         { &hf_infiniband_reserved2, {
5221                 "Reserved (2 bits)", "infiniband.lrh.reserved2",
5222                 FT_UINT8, BASE_DEC, NULL, 0x0C, NULL, HFILL}
5223         },
5224         { &hf_infiniband_link_next_header, {
5225                 "Link Next Header", "infiniband.lrh.lnh",
5226                 FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL}
5227         },
5228         { &hf_infiniband_destination_local_id, {
5229                 "Destination Local ID", "infiniband.lrh.dlid",
5230                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5231         },
5232         { &hf_infiniband_reserved5, {
5233                 "Reserved (5 bits)", "infiniband.lrh.reserved5",
5234                 FT_UINT16, BASE_DEC, NULL, 0xF800, NULL, HFILL}
5235         },
5236         { &hf_infiniband_packet_length, {
5237                 "Packet Length", "infiniband.lrh.pktlen",
5238                 FT_UINT16, BASE_DEC, NULL, 0x07FF, NULL, HFILL}
5239         },
5240         { &hf_infiniband_source_local_id, {
5241                 "Source Local ID", "infiniband.lrh.slid",
5242                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5243         },
5244
5245         /* Global Route Header (GRH) */
5246         { &hf_infiniband_GRH, {
5247                 "Global Route Header", "infiniband.grh",
5248                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5249         },
5250         { &hf_infiniband_ip_version, {
5251                 "IP Version", "infiniband.grh.ipver",
5252                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}
5253         },
5254         { &hf_infiniband_traffic_class, {
5255                 "Traffic Class", "infiniband.grh.tclass",
5256                 FT_UINT16, BASE_DEC, NULL, 0x0FF0, NULL, HFILL}
5257         },
5258         { &hf_infiniband_flow_label, {
5259                 "Flow Label", "infiniband.grh.flowlabel",
5260                 FT_UINT32, BASE_DEC, NULL, 0x000FFFFF, NULL, HFILL}
5261         },
5262         { &hf_infiniband_payload_length, {
5263                 "Payload Length", "infiniband.grh.paylen",
5264                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5265         },
5266         { &hf_infiniband_next_header, {
5267                 "Next Header", "infiniband.grh.nxthdr",
5268                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5269         },
5270         { &hf_infiniband_hop_limit, {
5271                 "Hop Limit", "infiniband.grh.hoplmt",
5272                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5273         },
5274         { &hf_infiniband_source_gid, {
5275                 "Source GID", "infiniband.grh.sgid",
5276                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
5277         },
5278         { &hf_infiniband_destination_gid, {
5279                 "Destination GID", "infiniband.grh.dgid",
5280                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
5281         },
5282
5283         /* Base Transport Header (BTH) */
5284         { &hf_infiniband_BTH, {
5285                 "Base Transport Header", "infiniband.bth",
5286                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5287         },
5288         { &hf_infiniband_opcode, {
5289                 "Opcode", "infiniband.bth.opcode",
5290                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5291         },
5292         { &hf_infiniband_solicited_event, {
5293                 "Solicited Event", "infiniband.bth.se",
5294                 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
5295         },
5296         { &hf_infiniband_migreq, {
5297                 "MigReq", "infiniband.bth.m",
5298                 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
5299         },
5300         { &hf_infiniband_pad_count, {
5301                 "Pad Count", "infiniband.bth.padcnt",
5302                 FT_UINT8, BASE_DEC, NULL, 0x30, NULL, HFILL}
5303         },
5304         { &hf_infiniband_transport_header_version, {
5305                 "Header Version", "infiniband.bth.tver",
5306                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}
5307         },
5308         { &hf_infiniband_partition_key, {
5309                 "Partition Key", "infiniband.bth.p_key",
5310                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5311         },
5312         { &hf_infiniband_reserved8, {
5313                 "Reserved (8 bits)", "infiniband.bth.reserved8",
5314                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5315         },
5316         { &hf_infiniband_destination_qp, {
5317                 "Destination Queue Pair", "infiniband.bth.destqp",
5318                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5319         },
5320         { &hf_infiniband_acknowledge_request, {
5321                 "Acknowledge Request", "infiniband.bth.a",
5322                 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
5323         },
5324         { &hf_infiniband_reserved7, {
5325                 "Reserved (7 bits)", "infiniband.bth.reserved7",
5326                 FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL}
5327         },
5328         { &hf_infiniband_packet_sequence_number, {
5329                 "Packet Sequence Number", "infiniband.bth.psn",
5330                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
5331         },
5332
5333         /* Raw Header (RWH) */
5334         { &hf_infiniband_RWH, {
5335                 "Raw Header", "infiniband.rwh",
5336                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5337         },
5338         { &hf_infiniband_reserved16_RWH, {
5339                 "Reserved (16 bits)", "infiniband.rwh.reserved",
5340                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5341         },
5342         { &hf_infiniband_etype, {
5343                 "Ethertype", "infiniband.rwh.etype",
5344                 FT_UINT16, BASE_HEX, NULL /*VALS(etype_vals)*/, 0x0, "Type", HFILL }
5345         },
5346
5347         /* Reliable Datagram Extended Transport Header (RDETH) */
5348         { &hf_infiniband_RDETH, {
5349                 "Reliable Datagram Extended Transport Header", "infiniband.rdeth",
5350                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5351         },
5352         { &hf_infiniband_reserved8_RDETH, {
5353                 "Reserved (8 bits)", "infiniband.rdeth.reserved8",
5354                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5355         },
5356         { &hf_infiniband_ee_context, {
5357                 "E2E Context", "infiniband.rdeth.eecnxt",
5358                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
5359         },
5360
5361         /* Datagram Extended Transport Header (DETH) */
5362         { &hf_infiniband_DETH, {
5363                 "Datagram Extended Transport Header", "infiniband.deth",
5364                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5365         },
5366         { &hf_infiniband_queue_key, {
5367                 "Queue Key", "infiniband.deth.q_key",
5368                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5369         },
5370         { &hf_infiniband_reserved8_DETH, {
5371                 "Reserved (8 bits)", "infiniband.deth.reserved8",
5372                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
5373         },
5374         { &hf_infiniband_source_qp, {
5375                 "Source Queue Pair", "infiniband.deth.srcqp",
5376                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5377         },
5378
5379         /* RDMA Extended Transport Header (RETH) */
5380         { &hf_infiniband_RETH, {
5381                 "RDMA Extended Transport Header", "infiniband.reth",
5382                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5383         },
5384         { &hf_infiniband_virtual_address, {
5385                 "Virtual Address", "infiniband.reth.va",
5386                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5387         },
5388         { &hf_infiniband_remote_key, {
5389                 "Remote Key", "infiniband.reth.r_key",
5390                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
5391         },
5392         { &hf_infiniband_dma_length, {
5393                 "DMA Length", "infiniband.reth.dmalen",
5394                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
5395         },
5396
5397         /* Atomic Extended Transport Header (AtomicETH) */
5398         { &hf_infiniband_AtomicETH, {
5399                 "Atomic Extended Transport Header", "infiniband.atomiceth",
5400                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5401         },
5402 #if 0
5403         { &hf_infiniband_virtual_address_AtomicETH, {
5404                 "Virtual Address", "infiniband.atomiceth.va",
5405                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5406         },
5407         { &hf_infiniband_remote_key_AtomicETH, {
5408                 "Remote Key", "infiniband.atomiceth.r_key",
5409                 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
5410         },
5411 #endif
5412         { &hf_infiniband_swap_or_add_data, {
5413                 "Swap (Or Add) Data", "infiniband.atomiceth.swapdt",
5414                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5415         },
5416         { &hf_infiniband_compare_data, {
5417                 "Compare Data", "infiniband.atomiceth.cmpdt",
5418                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5419         },
5420
5421         /* ACK Extended Transport Header (AETH) */
5422         { &hf_infiniband_AETH, {
5423                 "ACK Extended Transport Header", "infiniband.aeth",
5424                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5425         },
5426         { &hf_infiniband_syndrome, {
5427                 "Syndrome", "infiniband.aeth.syndrome",
5428                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
5429         },
5430         { &hf_infiniband_message_sequence_number, {
5431                 "Message Sequence Number", "infiniband.aeth.msn",
5432                 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
5433         },
5434
5435         /* Atomic ACK Extended Transport Header (AtomicAckETH) */
5436         { &hf_infiniband_AtomicAckETH, {
5437                 "Atomic ACK Extended Transport Header", "infiniband.atomicacketh",
5438                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5439         },
5440         { &hf_infiniband_original_remote_data, {
5441                 "Original Remote Data", "infiniband.atomicacketh.origremdt",
5442                 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL}
5443         },
5444
5445         /* Immediate Extended Transport Header (ImmDT) */
5446         { &hf_infiniband_IMMDT, {
5447                 "Immediate Data", "infiniband.immdt",
5448                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5449         },
5450
5451         /* Invalidate Extended Transport Header (IETH) */
5452         { &hf_infiniband_IETH, {
5453                 "RKey", "infiniband.ieth",
5454                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5455         },
5456
5457         /* Payload */
5458         { &hf_infiniband_payload, {
5459                 "Payload", "infiniband.payload",
5460                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5461         },
5462         { &hf_infiniband_invariant_crc, {
5463                 "Invariant CRC", "infiniband.invariant.crc",
5464                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5465         },
5466         { &hf_infiniband_variant_crc, {
5467                 "Variant CRC", "infiniband.variant.crc",
5468                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5469         },
5470         { &hf_infiniband_raw_data, {
5471                 "Raw Data", "infiniband.rawdata",
5472                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5473         },
5474         /* Unknown or Vendor Specific */
5475         { &hf_infiniband_vendor, {
5476                 "Unknown/Vendor Specific Data", "infiniband.vendor",
5477                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5478         },
5479         /* CM REQ Header */
5480         {&hf_cm_req_local_comm_id, {
5481                 "Local Communication ID", "infiniband.cm.req",
5482                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5483         },
5484         {&hf_cm_req_service_id, {
5485                 "ServiceID", "infiniband.cm.req.serviceid",
5486                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5487         },
5488         {&hf_cm_req_local_ca_guid, {
5489                 "Local CA GUID", "infiniband.cm.req.localcaguid",
5490                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5491         },
5492         {&hf_cm_req_local_qkey, {
5493                 "Local Q_Key", "infiniband.cm.req.localqkey",
5494                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5495         },
5496         {&hf_cm_req_local_qpn, {
5497                 "Local QPN", "infiniband.cm.req.localqpn",
5498                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5499         },
5500         {&hf_cm_req_respo_res, {
5501                 "Responder Resources", "infiniband.cm.req.responderres",
5502                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5503         },
5504         {&hf_cm_req_local_eecn, {
5505                 "Local EECN", "infiniband.cm.req.localeecn",
5506                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5507         },
5508         {&hf_cm_req_init_depth, {
5509                 "Initiator Depth", "infiniband.cm.req.initdepth",
5510                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5511         },
5512         {&hf_cm_req_remote_eecn, {
5513                 "Remote EECN", "infiniband.cm.req.remoteeecn",
5514                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5515         },
5516         {&hf_cm_req_remote_cm_resp_to, {
5517                 "Remote CM Response Timeout", "infiniband.cm.req.remoteresptout",
5518                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL}
5519         },
5520         {&hf_cm_req_transp_serv_type, {
5521                 "Transport Service Type", "infiniband.cm.req.transpsvctype",
5522                 FT_UINT8, BASE_HEX, NULL, 0x60, NULL, HFILL}
5523         },
5524         {&hf_cm_req_e2e_flow_ctrl, {
5525                 "End-to-End Flow Control", "infiniband.cm.req.e2eflowctrl",
5526                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
5527         },
5528         {&hf_cm_req_start_psn, {
5529                 "Starting PSN", "infiniband.cm.req.startpsn",
5530                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5531         },
5532         {&hf_cm_req_local_cm_resp_to, {
5533                 "Local CM Response Timeout", "infiniband.cm.req.localresptout",
5534                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL}
5535         },
5536         {&hf_cm_req_retry_count, {
5537                 "Retry Count", "infiniband.cm.req.retrcount",
5538                 FT_UINT8, BASE_HEX, NULL, 0xe0, NULL, HFILL}
5539         },
5540         {&hf_cm_req_pkey, {
5541                 "Partition Key", "infiniband.cm.req.pkey",
5542                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5543         },
5544         {&hf_cm_req_path_pp_mtu, {
5545                 "Path Packet Payload MTU", "infiniband.cm.req.pppmtu",
5546                 FT_UINT8, BASE_HEX, NULL, 0xf, NULL, HFILL}
5547         },
5548         {&hf_cm_req_rdc_exists, {
5549                 "RDC Exists", "infiniband.cm.req.rdcexist",
5550                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
5551         },
5552         {&hf_cm_req_rnr_retry_count, {
5553                 "RNR Retry Count", "infiniband.cm.req.rnrretrcount",
5554                 FT_UINT8, BASE_HEX, NULL, 0xe0, NULL, HFILL}
5555         },
5556         {&hf_cm_req_max_cm_retries, {
5557                 "Max CM Retries", "infiniband.cm.req.maxcmretr",
5558                 FT_UINT8, BASE_HEX, NULL, 0xf, NULL, HFILL}
5559         },
5560         {&hf_cm_req_srq, {
5561                 "SRQ", "infiniband.cm.req.srq",
5562                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
5563         },
5564         {&hf_cm_req_primary_local_lid, {
5565                 "Primary Local Port LID", "infiniband.cm.req.prim_locallid",
5566                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5567         },
5568         {&hf_cm_req_primary_remote_lid, {
5569                 "Primary Remote Port LID", "infiniband.cm.req.prim_remotelid",
5570                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5571         },
5572         {&hf_cm_req_primary_local_gid, {
5573                 "Primary Local Port GID", "infiniband.cm.req.prim_localgid",
5574                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
5575         },
5576         {&hf_cm_req_primary_remote_gid, {
5577                 "Primary Remote Port GID", "infiniband.cm.req.prim_remotegid",
5578                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
5579         },
5580         {&hf_cm_req_primary_flow_label, {
5581                 "Primary Flow Label", "infiniband.cm.req.prim_flowlabel",
5582                 FT_UINT24, BASE_HEX, NULL, 0xfffff, NULL, HFILL}
5583         },
5584         {&hf_cm_req_primary_packet_rate, {
5585                 "Primary Packet Rate", "infiniband.cm.req.prim_pktrate",
5586                 FT_UINT8, BASE_HEX, NULL, 0xfc, NULL, HFILL}
5587         },
5588         {&hf_cm_req_primary_traffic_class, {
5589                 "Primary Traffic Class", "infiniband.cm.req.prim_tfcclass",
5590                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5591         },
5592         {&hf_cm_req_primary_hop_limit, {
5593                 "Primary Hop Limit", "infiniband.cm.req.prim_hoplim",
5594                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5595         },
5596         {&hf_cm_req_primary_sl, {
5597                 "Primary SL", "infiniband.cm.req.prim_sl",
5598                 FT_UINT8, BASE_HEX, NULL, 0xf, NULL, HFILL}
5599         },
5600         {&hf_cm_req_primary_subnet_local, {
5601                 "Primary Subnet Local", "infiniband.cm.req.prim_subnetlocal",
5602                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
5603         },
5604         {&hf_cm_req_primary_local_ack_to, {
5605                 "Primary Local ACK Timeout", "infiniband.cm.req.prim_localacktout",
5606                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL}
5607         },
5608         {&hf_cm_req_alt_local_lid, {
5609                 "Alternate Local Port LID", "infiniband.cm.req.alt_locallid",
5610                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5611         },
5612         {&hf_cm_req_alt_remote_lid, {
5613                 "Alternate Remote Port LID", "infiniband.cm.req.alt_remotelid",
5614                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
5615         },
5616         {&hf_cm_req_alt_local_gid, {
5617                 "Alternate Local Port GID", "infiniband.cm.req.alt_localgid",
5618                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5619         },
5620         {&hf_cm_req_alt_remote_gid, {
5621                 "Alternate Remote Port GID", "infiniband.cm.req.alt_remotegid",
5622                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5623         },
5624         {&hf_cm_req_flow_label, {
5625                 "Alternate Flow Label", "infiniband.cm.req.alt_flowlabel",
5626                 FT_UINT24, BASE_HEX, NULL, 0xfffff, NULL, HFILL}
5627         },
5628         {&hf_cm_req_packet_rate, {
5629                 "Alternate Packet Rate", "infiniband.cm.req.alt_pktrate",
5630                 FT_UINT8, BASE_HEX, NULL, 0xfc, NULL, HFILL}
5631         },
5632         {&hf_cm_req_alt_traffic_class, {
5633                 "Alternate Traffic Class", "infiniband.cm.req.alt_tfcclass",
5634                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5635         },
5636         {&hf_cm_req_alt_hop_limit, {
5637                 "Alternate Hop Limit", "infiniband.cm.req.alt_hoplim",
5638                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5639         },
5640         {&hf_cm_req_SL, {
5641                 "Alternate SL", "infiniband.cm.req.alt_sl",
5642                 FT_UINT8, BASE_HEX, NULL, 0xf, NULL, HFILL}
5643         },
5644         {&hf_cm_req_subnet_local, {
5645                 "Alternate Subnet Local", "infiniband.cm.req.alt_subnetlocal",
5646                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
5647         },
5648         {&hf_cm_req_local_ACK_timeout, {
5649                 "Alternate Local ACK Timeout", "infiniband.cm.req.alt_localacktout",
5650                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL}
5651         },
5652         {&hf_cm_req_private_data, {
5653                 "PrivateData", "infiniband.cm.req.private",
5654                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5655         },
5656         /* CM REP Header */
5657         {&hf_cm_rep_localcommid, {
5658                 "Local Communication ID", "infiniband.cm.rep",
5659                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5660         },
5661         {&hf_cm_rep_remotecommid, {
5662                 "Remote Communication ID", "infiniband.cm.rep.remotecommid",
5663                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5664         },
5665         {&hf_cm_rep_localqkey, {
5666                 "Local Q_Key", "infiniband.cm.rep.localqkey",
5667                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5668         },
5669         {&hf_cm_rep_localqpn, {
5670                 "Local QPN", "infiniband.cm.rep.localqpn",
5671                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5672         },
5673         {&hf_cm_rep_localeecontnum, {
5674                 "Local EE Context Number", "infiniband.cm.rep.localeecn",
5675                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5676         },
5677         {&hf_cm_rep_startingpsn, {
5678                 "Starting PSN", "infiniband.cm.rep.startpsn",
5679                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5680         },
5681         {&hf_cm_rep_responderres, {
5682                 "Responder Resources", "infiniband.cm.rep.respres",
5683                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5684         },
5685         {&hf_cm_rep_initiatordepth, {
5686                 "Initiator Depth", "infiniband.cm.rep.initdepth",
5687                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5688         },
5689         {&hf_cm_rep_tgtackdelay, {
5690                 "Target ACK Delay", "infiniband.cm.rep.tgtackdelay",
5691                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL}
5692         },
5693         {&hf_cm_rep_failoveracc, {
5694                 "Failover Accepted", "infiniband.cm.rep.failoveracc",
5695                 FT_UINT8, BASE_HEX, NULL, 0x60, NULL, HFILL}
5696         },
5697         {&hf_cm_rep_e2eflowctl, {
5698                 "End-To-End Flow Control", "infiniband.cm.rep.e2eflowctrl",
5699                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
5700         },
5701         {&hf_cm_rep_rnrretrycount, {
5702                 "RNR Retry Count", "infiniband.cm.rep.rnrretrcount",
5703                 FT_UINT8, BASE_HEX, NULL, 0x7, NULL, HFILL}
5704         },
5705         {&hf_cm_rep_srq, {
5706                 "SRQ", "infiniband.cm.rep.srq",
5707                 FT_UINT8, BASE_HEX, NULL, 0x8, NULL, HFILL}
5708         },
5709         {&hf_cm_rep_localcaguid, {
5710                 "Local CA GUID", "infiniband.cm.rep.localcaguid",
5711                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5712         },
5713         {&hf_cm_rep_privatedata, {
5714                 "PrivateData", "infiniband.cm.rep.private",
5715                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5716         },
5717         /* IB CM RTU Header */
5718         {&hf_cm_rtu_localcommid, {
5719                 "Local Communication ID", "infiniband.cm.rtu.localcommid",
5720                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5721         },
5722         {&hf_cm_rtu_remotecommid, {
5723                 "Remote Communication ID", "infiniband.cm.rtu.remotecommid",
5724                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5725         },
5726         {&hf_cm_rtu_privatedata, {
5727                 "PrivateData", "infiniband.cm.rtu.private",
5728                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5729         },
5730         /* CM REJ Header */
5731         {&hf_cm_rej_local_commid, {
5732                 "Local Communication ID", "infiniband.cm.rej.localcommid",
5733                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5734         },
5735         {&hf_cm_rej_remote_commid, {
5736                 "Remote Communication ID", "infiniband.cm.rej.remotecommid",
5737                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5738         },
5739         {&hf_cm_rej_msg_rej, {
5740                 "Message REJected", "infiniband.cm.rej.msgrej",
5741                 FT_UINT8, BASE_HEX, NULL, 0x3, NULL, HFILL}
5742         },
5743         {&hf_cm_rej_rej_info_len, {
5744                 "Reject Info Length", "infiniband.cm.rej.rejinfolen",
5745                 FT_UINT8, BASE_HEX, NULL, 0x7f, NULL, HFILL}
5746         },
5747         {&hf_cm_rej_reason, {
5748                 "Reason", "infiniband.cm.rej.reason",
5749                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5750         },
5751         {&hf_cm_rej_add_rej_info, {
5752                 "Additional Reject Information (ARI)", "infiniband.cm.rej.ari",
5753                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5754         },
5755         {&hf_cm_rej_private_data, {
5756                 "PrivateData", "infiniband.cm.rej.private",
5757                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5758         },
5759         /* MAD Base Header */
5760         { &hf_infiniband_MAD, {
5761                 "MAD (Management Datagram) Common Header", "infiniband.mad",
5762                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5763         },
5764         { &hf_infiniband_base_version, {
5765                 "Base Version", "infiniband.mad.baseversion",
5766                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5767         },
5768         { &hf_infiniband_mgmt_class, {
5769                 "Management Class", "infiniband.mad.mgmtclass",
5770                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5771         },
5772         { &hf_infiniband_class_version, {
5773                 "Class Version", "infiniband.mad.classversion",
5774                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5775         },
5776 #if 0
5777         { &hf_infiniband_reserved1, {
5778                 "Reserved", "infiniband.mad.reserved1",
5779                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
5780         },
5781 #endif
5782         { &hf_infiniband_method, {
5783                 "Method", "infiniband.mad.method",
5784                 FT_UINT8, BASE_HEX, VALS(mad_method_str), 0x0, NULL, HFILL}
5785         },
5786         { &hf_infiniband_status, {
5787                 "Status", "infiniband.mad.status",
5788                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5789         },
5790         { &hf_infiniband_class_specific, {
5791                 "Class Specific", "infiniband.mad.classspecific",
5792                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5793         },
5794         { &hf_infiniband_transaction_id, {
5795                 "Transaction ID", "infiniband.mad.transactionid",
5796                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5797         },
5798         { &hf_infiniband_attribute_id, {
5799                 "Attribute ID", "infiniband.mad.attributeid",
5800                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5801         },
5802         { &hf_infiniband_reserved16, {
5803                 "Reserved", "infiniband.mad.reserved16",
5804                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5805         },
5806         { &hf_infiniband_attribute_modifier, {
5807                 "Attribute Modifier", "infiniband.mad.attributemodifier",
5808                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5809         },
5810         { &hf_infiniband_data, {
5811                 "MAD Data Payload", "infiniband.mad.data",
5812                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5813         },
5814
5815         /* RMPP Header */
5816         { &hf_infiniband_RMPP, {
5817                 "RMPP (Reliable Multi-Packet Transaction Protocol)", "infiniband.rmpp",
5818                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5819         },
5820         { &hf_infiniband_rmpp_version, {
5821                 "RMPP Type", "infiniband.rmpp.rmppversion",
5822                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5823         },
5824         { &hf_infiniband_rmpp_type, {
5825                 "RMPP Type", "infiniband.rmpp.rmpptype",
5826                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5827         },
5828         { &hf_infiniband_r_resp_time, {
5829                 "R Resp Time", "infiniband.rmpp.rresptime",
5830                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
5831         },
5832         { &hf_infiniband_rmpp_flags, {
5833                 "RMPP Flags", "infiniband.rmpp.rmppflags",
5834                 FT_UINT8, BASE_HEX, VALS(RMPP_Flags), 0x0F, NULL, HFILL}
5835         },
5836         { &hf_infiniband_rmpp_status, {
5837                 "RMPP Status", "infiniband.rmpp.rmppstatus",
5838                 FT_UINT8, BASE_HEX, VALS(RMPP_Status), 0x0, NULL, HFILL}
5839         },
5840         { &hf_infiniband_rmpp_data1, {
5841                 "RMPP Data 1", "infiniband.rmpp.data1",
5842                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5843         },
5844         { &hf_infiniband_rmpp_data2, {
5845                 "RMPP Data 2", "infiniband.rmpp.data2",
5846                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5847         },
5848
5849     /* RMPP Data */
5850 #if 0
5851         { &hf_infiniband_RMPP_DATA, {
5852                 "RMPP Data (Reliable Multi-Packet Transaction Protocol)", "infiniband.rmpp.data",
5853                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5854         },
5855 #endif
5856         { &hf_infiniband_segment_number, {
5857                 "Segment Number", "infiniband.rmpp.segmentnumber",
5858                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5859         },
5860         { &hf_infiniband_payload_length32, {
5861                 "Payload Length", "infiniband.rmpp.payloadlength",
5862                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5863         },
5864         { &hf_infiniband_transferred_data, {
5865                 "Transferred Data", "infiniband.rmpp.transferreddata",
5866                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5867         },
5868
5869         /* RMPP ACK */
5870         { &hf_infiniband_new_window_last, {
5871                 "New Window Last", "infiniband.rmpp.newwindowlast",
5872                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5873         },
5874         { &hf_infiniband_reserved220, {
5875                 "Segment Number", "infiniband.rmpp.reserved220",
5876                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5877         },
5878
5879         /* RMPP ABORT/STOP */
5880         { &hf_infiniband_optional_extended_error_data, {
5881                 "Optional Extended Error Data", "infiniband.rmpp.extendederrordata",
5882                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5883         },
5884
5885         /* SMP Data (LID Routed) */
5886         { &hf_infiniband_SMP_LID, {
5887                 "Subnet Management Packet (LID Routed)", "infiniband.smplid",
5888                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5889         },
5890         { &hf_infiniband_m_key, {
5891                 "M_Key", "infiniband.smplid.mkey",
5892                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5893         },
5894         { &hf_infiniband_smp_data, {
5895                 "SMP Data", "infiniband.smplid.smpdata",
5896                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5897         },
5898         { &hf_infiniband_reserved1024, {
5899                 "Reserved (1024 bits)", "infiniband.smplid.reserved1024",
5900                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5901         },
5902         { &hf_infiniband_reserved256, {
5903                 "Reserved (256 bits)", "infiniband.smplid.reserved256",
5904                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5905         },
5906
5907     /* XX: All following verified/corrected against Infiniband 1.2.1 Specification */
5908         /* SMP Data Directed Route */
5909         { &hf_infiniband_SMP_DIRECTED, {
5910                 "Subnet Management Packet (Directed Route)", "infiniband.smpdirected",
5911                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5912         },
5913         { &hf_infiniband_smp_status, {
5914                 "Status", "infiniband.smpdirected.smpstatus",
5915                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5916         },
5917         { &hf_infiniband_hop_pointer, {
5918                 "Hop Pointer", "infiniband.smpdirected.hoppointer",
5919                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5920         },
5921         { &hf_infiniband_hop_count, {
5922                 "Hop Count", "infiniband.smpdirected.hopcount",
5923                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
5924         },
5925         { &hf_infiniband_dr_slid, {
5926                 "DrSLID", "infiniband.smpdirected.drslid",
5927                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5928         },
5929         { &hf_infiniband_dr_dlid, {
5930                 "DrDLID", "infiniband.smpdirected.drdlid",
5931                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5932         },
5933         { &hf_infiniband_reserved28, {
5934                 "Reserved (224 bits)", "infiniband.smpdirected.reserved28",
5935                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5936         },
5937         { &hf_infiniband_d, {
5938                 "D (Direction Bit)", "infiniband.smpdirected.d",
5939                 FT_UINT64, BASE_HEX, NULL, 0x8000, NULL, HFILL}
5940         },
5941         { &hf_infiniband_initial_path, {
5942                 "Initial Path", "infiniband.smpdirected.initialpath",
5943                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5944         },
5945         { &hf_infiniband_return_path, {
5946                 "Return Path", "infiniband.smpdirected.returnpath",
5947                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5948         },
5949
5950         /* SA MAD Header */
5951         { &hf_infiniband_SA, {
5952                 "SA Packet (Subnet Administration)", "infiniband.sa.drdlid",
5953                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5954         },
5955         { &hf_infiniband_sm_key, {
5956                 "SM_Key (Verification Key)", "infiniband.sa.smkey",
5957                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5958         },
5959         { &hf_infiniband_attribute_offset, {
5960                 "Attribute Offset", "infiniband.sa.attributeoffset",
5961                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
5962         },
5963         { &hf_infiniband_component_mask, {
5964                 "Component Mask", "infiniband.sa.componentmask",
5965                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
5966         },
5967         { &hf_infiniband_subnet_admin_data, {
5968                 "Subnet Admin Data", "infiniband.sa.subnetadmindata",
5969                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
5970         },
5971
5972         /* Mellanox EoIB encapsulation header */
5973         { &hf_infiniband_EOIB, {
5974                 "Mellanox EoIB Encapsulation Header", "infiniband.eoib",
5975                 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
5976         },
5977         { &hf_infiniband_ver, {
5978                 "Version", "infiniband.eoib.version",
5979                 FT_UINT16, BASE_HEX, NULL, 0x3000, NULL, HFILL}
5980         },
5981         { &hf_infiniband_tcp_chk, {
5982                 "TCP Checksum", "infiniband.eoib.tcp_chk",
5983                 FT_UINT16, BASE_HEX, NULL, 0x0c00, NULL, HFILL}
5984         },
5985         { &hf_infiniband_ip_chk, {
5986                 "IP Checksum", "infiniband.eoib.ip_chk",
5987                 FT_UINT16, BASE_HEX, NULL, 0x0300, NULL, HFILL}
5988         },
5989         { &hf_infiniband_fcs, {
5990                 "FCS Field Present", "infiniband.eoib.fcs",
5991                 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL}
5992         },
5993         { &hf_infiniband_ms, {
5994                 "More Segments to Follow", "infiniband.eoib.ms",
5995                 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL}
5996         },
5997         { &hf_infiniband_seg_off, {
5998                 "Segment Offset", "infiniband.eoib.ip_seg_offset",
5999                 FT_UINT16, BASE_DEC, NULL, 0x001f, NULL, HFILL}
6000         },
6001         { &hf_infiniband_seg_id, {
6002                 "Segment ID", "infiniband.eoib.ip_seg_id",
6003                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
6004         },
6005
6006         /* NodeDescription */
6007         { &hf_infiniband_NodeDescription_NodeString, {
6008                 "NodeString", "infiniband.nodedescription.nodestring",
6009                 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}
6010         },
6011
6012         /* NodeInfo */
6013         { &hf_infiniband_NodeInfo_BaseVersion, {
6014                 "BaseVersion", "infiniband.nodeinfo.baseversion",
6015                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6016         },
6017         { &hf_infiniband_NodeInfo_ClassVersion, {
6018                 "ClassVersion", "infiniband.nodeinfo.classversion",
6019                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6020         },
6021         { &hf_infiniband_NodeInfo_NodeType, {
6022                 "NodeType", "infiniband.nodeinfo.nodetype",
6023                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6024         },
6025         { &hf_infiniband_NodeInfo_NumPorts, {
6026                 "NumPorts", "infiniband.nodeinfo.numports",
6027                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6028         },
6029         { &hf_infiniband_NodeInfo_SystemImageGUID, {
6030                 "SystemImageGUID", "infiniband.nodeinfo.systemimageguid",
6031                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6032         },
6033         { &hf_infiniband_NodeInfo_NodeGUID, {
6034                 "NodeGUID", "infiniband.nodeinfo.nodeguid",
6035                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6036         },
6037         { &hf_infiniband_NodeInfo_PortGUID, {
6038                 "PortGUID", "infiniband.nodeinfo.portguid",
6039                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6040         },
6041         { &hf_infiniband_NodeInfo_PartitionCap, {
6042                 "PartitionCap", "infiniband.nodeinfo.partitioncap",
6043                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6044         },
6045         { &hf_infiniband_NodeInfo_DeviceID, {
6046                 "DeviceID", "infiniband.nodeinfo.deviceid",
6047                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6048         },
6049         { &hf_infiniband_NodeInfo_Revision, {
6050                 "Revision", "infiniband.nodeinfo.revision",
6051                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
6052         },
6053         { &hf_infiniband_NodeInfo_LocalPortNum, {
6054                 "LocalPortNum", "infiniband.nodeinfo.localportnum",
6055                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6056         },
6057         { &hf_infiniband_NodeInfo_VendorID, {
6058                 "VendorID", "infiniband.nodeinfo.vendorid",
6059                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
6060         },
6061
6062         /* SwitchInfo */
6063         { &hf_infiniband_SwitchInfo_LinearFDBCap, {
6064                 "LinearFDBCap", "infiniband.switchinfo.linearfdbcap",
6065                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6066         },
6067         { &hf_infiniband_SwitchInfo_RandomFDBCap, {
6068                 "RandomFDBCap", "infiniband.switchinfo.randomfdbcap",
6069                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6070         },
6071         { &hf_infiniband_SwitchInfo_MulticastFDBCap, {
6072                 "MulticastFDBCap", "infiniband.switchinfo.multicastfdbcap",
6073                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6074         },
6075         { &hf_infiniband_SwitchInfo_LinearFDBTop, {
6076                 "LinearFDBTop", "infiniband.switchinfo.linearfdbtop",
6077                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6078         },
6079         { &hf_infiniband_SwitchInfo_DefaultPort, {
6080                 "DefaultPort", "infiniband.switchinfo.defaultport",
6081                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6082         },
6083         { &hf_infiniband_SwitchInfo_DefaultMulticastPrimaryPort, {
6084                 "DefaultMulticastPrimaryPort", "infiniband.switchinfo.defaultmulticastprimaryport",
6085                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6086         },
6087         { &hf_infiniband_SwitchInfo_DefaultMulticastNotPrimaryPort, {
6088                 "DefaultMulticastNotPrimaryPort", "infiniband.switchinfo.defaultmulticastnotprimaryport",
6089                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6090         },
6091         { &hf_infiniband_SwitchInfo_LifeTimeValue, {
6092                 "LifeTimeValue", "infiniband.switchinfo.lifetimevalue",
6093                 FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL}
6094         },
6095         { &hf_infiniband_SwitchInfo_PortStateChange, {
6096                 "PortStateChange", "infiniband.switchinfo.portstatechange",
6097                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
6098         },
6099         { &hf_infiniband_SwitchInfo_OptimizedSLtoVLMappingProgramming, {
6100                 "OptimizedSLtoVLMappingProgramming", "infiniband.switchinfo.optimizedsltovlmappingprogramming",
6101                 FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL}
6102         },
6103         { &hf_infiniband_SwitchInfo_LIDsPerPort, {
6104                 "LIDsPerPort", "infiniband.switchinfo.lidsperport",
6105                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6106         },
6107         { &hf_infiniband_SwitchInfo_PartitionEnforcementCap, {
6108                 "PartitionEnforcementCap", "infiniband.switchinfo.partitionenforcementcap",
6109                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6110         },
6111         { &hf_infiniband_SwitchInfo_InboundEnforcementCap, {
6112                 "InboundEnforcementCap", "infiniband.switchinfo.inboundenforcementcap",
6113                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6114         },
6115         { &hf_infiniband_SwitchInfo_OutboundEnforcementCap, {
6116                 "OutboundEnforcementCap", "infiniband.switchinfo.outboundenforcementcap",
6117                 FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL}
6118         },
6119         { &hf_infiniband_SwitchInfo_FilterRawInboundCap, {
6120                 "FilterRawInboundCap", "infiniband.switchinfo.filterrawinboundcap",
6121                 FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL}
6122         },
6123         { &hf_infiniband_SwitchInfo_FilterRawOutboundCap, {
6124                 "FilterRawOutboundCap", "infiniband.switchinfo.filterrawoutboundcap",
6125                 FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
6126         },
6127         { &hf_infiniband_SwitchInfo_EnhancedPortZero, {
6128                 "EnhancedPortZero", "infiniband.switchinfo.enhancedportzero",
6129                 FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL}
6130         },
6131
6132         /* GUIDInfo */
6133 #if 0
6134         { &hf_infiniband_GUIDInfo_GUIDBlock, {
6135                 "GUIDBlock", "infiniband.switchinfo.guidblock",
6136                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6137         },
6138 #endif
6139         { &hf_infiniband_GUIDInfo_GUID, {
6140                 "GUID", "infiniband.switchinfo.guid",
6141                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6142         },
6143
6144         /* PortInfo */
6145         { &hf_infiniband_PortInfo_M_Key, {
6146                 "M_Key", "infiniband.portinfo.m_key",
6147                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6148         },
6149         { &hf_infiniband_PortInfo_GidPrefix, {
6150                 "GidPrefix", "infiniband.portinfo.guid",
6151                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6152         },
6153         { &hf_infiniband_PortInfo_LID, {
6154                 "LID", "infiniband.portinfo.lid",
6155                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6156         },
6157         { &hf_infiniband_PortInfo_MasterSMLID, {
6158                 "MasterSMLID", "infiniband.portinfo.mastersmlid",
6159                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6160         },
6161         { &hf_infiniband_PortInfo_CapabilityMask, {
6162                 "CapabilityMask", "infiniband.portinfo.capabilitymask",
6163                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
6164         },
6165
6166         /* Capability Mask Flags */
6167         { &hf_infiniband_PortInfo_CapabilityMask_SM, {
6168                 "SM", "infiniband.portinfo.capabilitymask.issm",
6169                 FT_UINT32, BASE_HEX, NULL, 0x00000002, NULL, HFILL}
6170         },
6171         { &hf_infiniband_PortInfo_CapabilityMask_NoticeSupported, {
6172                 "NoticeSupported", "infiniband.portinfo.capabilitymask.noticesupported",
6173                 FT_UINT32, BASE_HEX, NULL, 0x00000004, NULL, HFILL}
6174         },
6175         { &hf_infiniband_PortInfo_CapabilityMask_TrapSupported, {
6176                 "TrapSupported", "infiniband.portinfo.capabilitymask.trapsupported",
6177                 FT_UINT32, BASE_HEX, NULL, 0x00000008, NULL, HFILL}
6178         },
6179         { &hf_infiniband_PortInfo_CapabilityMask_OptionalPDSupported, {
6180                 "OptionalPDSupported", "infiniband.portinfo.capabilitymask.optionalpdsupported",
6181                 FT_UINT32, BASE_HEX, NULL, 0x00000010, NULL, HFILL}
6182         },
6183         { &hf_infiniband_PortInfo_CapabilityMask_AutomaticMigrationSupported, {
6184                 "AutomaticMigrationSupported", "infiniband.portinfo.capabilitymask.automaticmigrationsupported",
6185                 FT_UINT32, BASE_HEX, NULL, 0x00000020, NULL, HFILL}
6186         },
6187         { &hf_infiniband_PortInfo_CapabilityMask_SLMappingSupported, {
6188                 "SLMappingSupported", "infiniband.portinfo.capabilitymask.slmappingsupported",
6189                 FT_UINT32, BASE_HEX, NULL, 0x00000040, NULL, HFILL}
6190         },
6191         { &hf_infiniband_PortInfo_CapabilityMask_MKeyNVRAM, {
6192                 "MKeyNVRAM", "infiniband.portinfo.capabilitymask.mkeynvram",
6193                 FT_UINT32, BASE_HEX, NULL, 0x00000080, NULL, HFILL}
6194         },
6195         { &hf_infiniband_PortInfo_CapabilityMask_PKeyNVRAM, {
6196                 "PKeyNVRAM", "infiniband.portinfo.capabilitymask.pkeynvram",
6197                 FT_UINT32, BASE_HEX, NULL, 0x00000100, NULL, HFILL}
6198         },
6199         { &hf_infiniband_PortInfo_CapabilityMask_LEDInfoSupported, {
6200                 "LEDInfoSupported", "infiniband.portinfo.capabilitymask.ledinfosupported",
6201                 FT_UINT32, BASE_HEX, NULL, 0x00000200, NULL, HFILL}
6202         },
6203         { &hf_infiniband_PortInfo_CapabilityMask_SMdisabled, {
6204                 "SMdisabled", "infiniband.portinfo.capabilitymask.smdisabled",
6205                 FT_UINT32, BASE_HEX, NULL, 0x00000400, NULL, HFILL}
6206         },
6207         { &hf_infiniband_PortInfo_CapabilityMask_SystemImageGUIDSupported, {
6208                 "SystemImageGUIDSupported", "infiniband.portinfo.capabilitymask.systemimageguidsupported",
6209                 FT_UINT32, BASE_HEX, NULL, 0x00000800, NULL, HFILL}
6210         },
6211         { &hf_infiniband_PortInfo_CapabilityMask_PKeySwitchExternalPortTrapSupported, {
6212                 "PKeySwitchExternalPortTrapSupported", "infiniband.portinfo.capabilitymask.pkeyswitchexternalporttrapsupported",
6213                 FT_UINT32, BASE_HEX, NULL, 0x00001000, NULL, HFILL}
6214         },
6215         { &hf_infiniband_PortInfo_CapabilityMask_CommunicationsManagementSupported, {
6216                 "CommunicationsManagementSupported", "infiniband.portinfo.capabilitymask.communicationsmanagementsupported",
6217                 FT_UINT32, BASE_HEX, NULL, 0x00010000, NULL, HFILL}
6218         },
6219         { &hf_infiniband_PortInfo_CapabilityMask_SNMPTunnelingSupported, {
6220                 "SNMPTunnelingSupported", "infiniband.portinfo.capabilitymask.snmptunnelingsupported",
6221                 FT_UINT32, BASE_HEX, NULL, 0x00020000, NULL, HFILL}
6222         },
6223         { &hf_infiniband_PortInfo_CapabilityMask_ReinitSupported, {
6224                 "ReinitSupported", "infiniband.portinfo.capabilitymask.reinitsupported",
6225                 FT_UINT32, BASE_HEX, NULL, 0x00040000, NULL, HFILL}
6226         },
6227         { &hf_infiniband_PortInfo_CapabilityMask_DeviceManagementSupported, {
6228                 "DeviceManagementSupported", "infiniband.portinfo.capabilitymask.devicemanagementsupported",
6229                 FT_UINT32, BASE_HEX, NULL, 0x00080000, NULL, HFILL}
6230         },
6231         { &hf_infiniband_PortInfo_CapabilityMask_VendorClassSupported, {
6232                 "VendorClassSupported", "infiniband.portinfo.capabilitymask.vendorclasssupported",
6233                 FT_UINT32, BASE_HEX, NULL, 0x00100000, NULL, HFILL}
6234         },
6235         { &hf_infiniband_PortInfo_CapabilityMask_DRNoticeSupported, {
6236                 "DRNoticeSupported", "infiniband.portinfo.capabilitymask.drnoticesupported",
6237                 FT_UINT32, BASE_HEX, NULL, 0x00200000, NULL, HFILL}
6238         },
6239         { &hf_infiniband_PortInfo_CapabilityMask_CapabilityMaskNoticeSupported, {
6240                 "CapabilityMaskNoticeSupported", "infiniband.portinfo.capabilitymask.capabilitymasknoticesupported",
6241                 FT_UINT32, BASE_HEX, NULL, 0x00400000, NULL, HFILL}
6242         },
6243         { &hf_infiniband_PortInfo_CapabilityMask_BootManagementSupported, {
6244                 "BootManagementSupported", "infiniband.portinfo.capabilitymask.bootmanagementsupported",
6245                 FT_UINT32, BASE_HEX, NULL, 0x00800000, NULL, HFILL}
6246         },
6247         { &hf_infiniband_PortInfo_CapabilityMask_LinkRoundTripLatencySupported, {
6248                 "LinkRoundTripLatencySupported", "infiniband.portinfo.capabilitymask.linkroundtriplatencysupported",
6249                 FT_UINT32, BASE_HEX, NULL, 0x01000000, NULL, HFILL}
6250         },
6251         { &hf_infiniband_PortInfo_CapabilityMask_ClientRegistrationSupported, {
6252                 "ClientRegistrationSupported", "infiniband.portinfo.capabilitymask.clientregistrationsupported",
6253                 FT_UINT32, BASE_HEX, NULL, 0x02000000, NULL, HFILL}
6254         },
6255         { &hf_infiniband_PortInfo_CapabilityMask_OtherLocalChangesNoticeSupported, {
6256                 "OtherLocalChangesNoticeSupported", "infiniband.portinfo.capabilitymask.otherlocalchangesnoticesupported",
6257                 FT_UINT32, BASE_HEX, NULL, 0x04000000, NULL, HFILL}
6258         },
6259         { &hf_infiniband_PortInfo_CapabilityMask_LinkSpeedWIdthPairsTableSupported, {
6260                 "LinkSpeedWIdthPairsTableSupported", "infiniband.portinfo.capabilitymask.linkspeedwidthpairstablesupported",
6261                 FT_UINT32, BASE_HEX, NULL, 0x08000000, NULL, HFILL}
6262         },
6263         /* End Capability Mask Flags */
6264
6265         /* PortInfo */
6266         { &hf_infiniband_PortInfo_DiagCode, {
6267                 "DiagCode", "infiniband.portinfo.diagcode",
6268                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6269         },
6270         { &hf_infiniband_PortInfo_M_KeyLeasePeriod, {
6271                 "M_KeyLeasePeriod", "infiniband.portinfo.m_keyleaseperiod",
6272                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6273         },
6274         { &hf_infiniband_PortInfo_LocalPortNum, {
6275                 "LocalPortNum", "infiniband.portinfo.localportnum",
6276                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6277         },
6278         { &hf_infiniband_PortInfo_LinkWidthEnabled, {
6279                 "LinkWidthEnabled", "infiniband.portinfo.linkwidthenabled",
6280                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6281         },
6282         { &hf_infiniband_PortInfo_LinkWidthSupported, {
6283                 "LinkWidthSupported", "infiniband.portinfo.linkwidthsupported",
6284                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6285         },
6286         { &hf_infiniband_PortInfo_LinkWidthActive, {
6287                 "LinkWidthActive", "infiniband.portinfo.linkwidthactive",
6288                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6289         },
6290         { &hf_infiniband_PortInfo_LinkSpeedSupported, {
6291                 "LinkSpeedSupported", "infiniband.portinfo.linkspeedsupported",
6292                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6293         },
6294         { &hf_infiniband_PortInfo_PortState, {
6295                 "PortState", "infiniband.portinfo.portstate",
6296                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6297         },
6298         { &hf_infiniband_PortInfo_PortPhysicalState, {
6299                 "PortPhysicalState", "infiniband.portinfo.portphysicalstate",
6300                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6301         },
6302         { &hf_infiniband_PortInfo_LinkDownDefaultState, {
6303                 "LinkDownDefaultState", "infiniband.portinfo.linkdowndefaultstate",
6304                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6305         },
6306         { &hf_infiniband_PortInfo_M_KeyProtectBits, {
6307                 "M_KeyProtectBits", "infiniband.portinfo.m_keyprotectbits",
6308                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6309         },
6310         { &hf_infiniband_PortInfo_LMC, {
6311                 "LMC", "infiniband.portinfo.lmc",
6312                 FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL}
6313         },
6314         { &hf_infiniband_PortInfo_LinkSpeedActive, {
6315                 "LinkSpeedActive", "infiniband.portinfo.linkspeedactive",
6316                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6317         },
6318         { &hf_infiniband_PortInfo_LinkSpeedEnabled, {
6319                 "LinkSpeedEnabled", "infiniband.portinfo.linkspeedenabled",
6320                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6321         },
6322         { &hf_infiniband_PortInfo_NeighborMTU, {
6323                 "NeighborMTU", "infiniband.portinfo.neighbormtu",
6324                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6325         },
6326         { &hf_infiniband_PortInfo_MasterSMSL, {
6327                 "MasterSMSL", "infiniband.portinfo.mastersmsl",
6328                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6329         },
6330         { &hf_infiniband_PortInfo_VLCap, {
6331                 "VLCap", "infiniband.portinfo.vlcap",
6332                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6333         },
6334         { &hf_infiniband_PortInfo_InitType, {
6335                 "InitType", "infiniband.portinfo.inittype",
6336                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6337         },
6338         { &hf_infiniband_PortInfo_VLHighLimit, {
6339                 "VLHighLimit", "infiniband.portinfo.vlhighlimit",
6340                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6341         },
6342         { &hf_infiniband_PortInfo_VLArbitrationHighCap, {
6343                 "VLArbitrationHighCap", "infiniband.portinfo.vlarbitrationhighcap",
6344                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6345         },
6346         { &hf_infiniband_PortInfo_VLArbitrationLowCap, {
6347                 "VLArbitrationLowCap", "infiniband.portinfo.vlarbitrationlowcap",
6348                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6349         },
6350         { &hf_infiniband_PortInfo_InitTypeReply, {
6351                 "InitTypeReply", "infiniband.portinfo.inittypereply",
6352                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6353         },
6354         { &hf_infiniband_PortInfo_MTUCap, {
6355                 "MTUCap", "infiniband.portinfo.mtucap",
6356                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6357         },
6358         { &hf_infiniband_PortInfo_VLStallCount, {
6359                 "VLStallCount", "infiniband.portinfo.vlstallcount",
6360                 FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL}
6361         },
6362         { &hf_infiniband_PortInfo_HOQLife, {
6363                 "HOQLife", "infiniband.portinfo.hoqlife",
6364                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
6365         },
6366         { &hf_infiniband_PortInfo_OperationalVLs, {
6367                 "OperationalVLs", "infiniband.portinfo.operationalvls",
6368                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6369         },
6370         { &hf_infiniband_PortInfo_PartitionEnforcementInbound, {
6371                 "PartitionEnforcementInbound", "infiniband.portinfo.partitionenforcementinbound",
6372                 FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL}
6373         },
6374         { &hf_infiniband_PortInfo_PartitionEnforcementOutbound, {
6375                 "PartitionEnforcementOutbound", "infiniband.portinfo.partitionenforcementoutbound",
6376                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
6377         },
6378         { &hf_infiniband_PortInfo_FilterRawInbound, {
6379                 "FilterRawInbound", "infiniband.portinfo.filterrawinbound",
6380                 FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL}
6381         },
6382         { &hf_infiniband_PortInfo_FilterRawOutbound, {
6383                 "FilterRawOutbound", "infiniband.portinfo.filterrawoutbound",
6384                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
6385         },
6386         { &hf_infiniband_PortInfo_M_KeyViolations, {
6387                 "M_KeyViolations", "infiniband.portinfo.m_keyviolations",
6388                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6389         },
6390         { &hf_infiniband_PortInfo_P_KeyViolations, {
6391                 "P_KeyViolations", "infiniband.portinfo.p_keyviolations",
6392                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6393         },
6394         { &hf_infiniband_PortInfo_Q_KeyViolations, {
6395                 "Q_KeyViolations", "infiniband.portinfo.q_keyviolations",
6396                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6397         },
6398         { &hf_infiniband_PortInfo_GUIDCap, {
6399                 "GUIDCap", "infiniband.portinfo.guidcap",
6400                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6401         },
6402         { &hf_infiniband_PortInfo_ClientReregister, {
6403                 "ClientReregister", "infiniband.portinfo.clientreregister",
6404                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6405         },
6406         { &hf_infiniband_PortInfo_SubnetTimeOut, {
6407                 "SubnetTimeOut", "infiniband.portinfo.subnettimeout",
6408                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
6409         },
6410         { &hf_infiniband_PortInfo_RespTimeValue, {
6411                 "RespTimeValue", "infiniband.portinfo.resptimevalue",
6412                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
6413         },
6414         { &hf_infiniband_PortInfo_LocalPhyErrors, {
6415                 "LocalPhyErrors", "infiniband.portinfo.localphyerrors",
6416                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6417         },
6418         { &hf_infiniband_PortInfo_OverrunErrors, {
6419                 "OverrunErrors", "infiniband.portinfo.overrunerrors",
6420                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6421         },
6422         { &hf_infiniband_PortInfo_MaxCreditHint, {
6423                 "MaxCreditHint", "infiniband.portinfo.maxcredithint",
6424                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6425         },
6426         { &hf_infiniband_PortInfo_LinkRoundTripLatency, {
6427                 "LinkRoundTripLatency", "infiniband.portinfo.linkroundtriplatency",
6428                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
6429         },
6430
6431         /* P_KeyTable */
6432         { &hf_infiniband_P_KeyTable_P_KeyTableBlock, {
6433                 "P_KeyTableBlock", "infiniband.p_keytable.p_keytableblock",
6434                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6435         },
6436         { &hf_infiniband_P_KeyTable_MembershipType, {
6437                 "MembershipType", "infiniband.p_keytable.membershiptype",
6438                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6439         },
6440         { &hf_infiniband_P_KeyTable_P_KeyBase, {
6441                 "P_KeyBase", "infiniband.p_keytable.p_keybase",
6442                 FT_UINT16, BASE_HEX, NULL, 0x7FFF, NULL, HFILL}
6443         },
6444
6445         /* SLtoVLMappingTable */
6446         { &hf_infiniband_SLtoVLMappingTable_SLtoVL_HighBits, {
6447                 "SL(x)toVL", "infiniband.sltovlmappingtable.sltovlhighbits",
6448                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6449         },
6450         { &hf_infiniband_SLtoVLMappingTable_SLtoVL_LowBits, {
6451                 "SL(x)toVL", "infiniband.sltovlmappingtable.sltovllowbits",
6452                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6453         },
6454
6455         /* VLArbitrationTable */
6456 #if 0
6457         { &hf_infiniband_VLArbitrationTable_VLWeightPairs, {
6458                 "VLWeightPairs", "infiniband.vlarbitrationtable.vlweightpairs",
6459                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6460         },
6461 #endif
6462         { &hf_infiniband_VLArbitrationTable_VL, {
6463                 "VL", "infiniband.vlarbitrationtable.vl",
6464                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6465         },
6466         { &hf_infiniband_VLArbitrationTable_Weight, {
6467                 "Weight", "infiniband.vlarbitrationtable.weight",
6468                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6469         },
6470
6471         /* LinearForwardingTable */
6472 #if 0
6473         { &hf_infiniband_LinearForwardingTable_LinearForwardingTableBlock, {
6474                 "LinearForwardingTableBlock", "infiniband.linearforwardingtable.linearforwardingtableblock",
6475                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6476         },
6477 #endif
6478         { &hf_infiniband_LinearForwardingTable_Port, {
6479                 "Port", "infiniband.linearforwardingtable.port",
6480                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6481         },
6482
6483         /* RandomForwardingTable */
6484 #if 0
6485         { &hf_infiniband_RandomForwardingTable_RandomForwardingTableBlock, {
6486                 "RandomForwardingTableBlock", "infiniband.randomforwardingtable.randomforwardingtableblock",
6487                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6488         },
6489 #endif
6490         { &hf_infiniband_RandomForwardingTable_LID, {
6491                 "LID", "infiniband.randomforwardingtable.lid",
6492                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6493         },
6494         { &hf_infiniband_RandomForwardingTable_Valid, {
6495                 "Valid", "infiniband.randomforwardingtable.valid",
6496                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6497         },
6498         { &hf_infiniband_RandomForwardingTable_LMC, {
6499                 "LMC", "infiniband.randomforwardingtable.lmc",
6500                 FT_UINT8, BASE_HEX, NULL, 0x70, NULL, HFILL}
6501         },
6502         { &hf_infiniband_RandomForwardingTable_Port, {
6503                 "Port", "infiniband.randomforwardingtable.port",
6504                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6505         },
6506
6507         /* MulticastForwardingTable */
6508 #if 0
6509         { &hf_infiniband_MulticastForwardingTable_MulticastForwardingTableBlock , {
6510                 "MulticastForwardingTableBlock", "infiniband.multicastforwardingtable.multicastforwardingtableblock",
6511                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6512         },
6513 #endif
6514         { &hf_infiniband_MulticastForwardingTable_PortMask, {
6515                 "PortMask", "infiniband.multicastforwardingtable.portmask",
6516                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6517         },
6518
6519         /* SMInfo */
6520         { &hf_infiniband_SMInfo_GUID, {
6521                 "GUID", "infiniband.sminfo.guid",
6522                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6523         },
6524         { &hf_infiniband_SMInfo_SM_Key, {
6525                 "SM_Key", "infiniband.sminfo.sm_key",
6526                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6527         },
6528         { &hf_infiniband_SMInfo_ActCount, {
6529                 "ActCount", "infiniband.sminfo.actcount",
6530                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
6531         },
6532         { &hf_infiniband_SMInfo_Priority, {
6533                 "Priority", "infiniband.sminfo.priority",
6534                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6535         },
6536         { &hf_infiniband_SMInfo_SMState, {
6537                 "SMState", "infiniband.sminfo.smstate",
6538                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6539         },
6540
6541         /* VendorDiag */
6542         { &hf_infiniband_VendorDiag_NextIndex, {
6543                 "NextIndex", "infiniband.vendordiag.nextindex",
6544                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6545         },
6546         { &hf_infiniband_VendorDiag_DiagData, {
6547                 "DiagData", "infiniband.vendordiag.diagdata",
6548                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6549         },
6550
6551         /* LedInfo */
6552         { &hf_infiniband_LedInfo_LedMask, {
6553                 "LedMask", "infiniband.ledinfo.ledmask",
6554                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6555         },
6556
6557         /* LinkSpeedWidthPairsTable */
6558         { &hf_infiniband_LinkSpeedWidthPairsTable_NumTables, {
6559                 "NumTables", "infiniband.linkspeedwidthpairstable.numtables",
6560                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6561         },
6562         { &hf_infiniband_LinkSpeedWidthPairsTable_PortMask, {
6563                 "PortMask", "infiniband.linkspeedwidthpairstable.portmask",
6564                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6565         },
6566         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedTwoFive, {
6567                 "Speed 2.5 Gbps", "infiniband.linkspeedwidthpairstable.speedtwofive",
6568                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6569         },
6570         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedFive, {
6571                 "Speed 5 Gbps", "infiniband.linkspeedwidthpairstable.speedfive",
6572                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6573         },
6574         { &hf_infiniband_LinkSpeedWidthPairsTable_SpeedTen, {
6575                 "Speed 10 Gbps", "infiniband.linkspeedwidthpairstable.speedten",
6576                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6577         },
6578
6579         /* NodeRecord */
6580         /* PortInfoRecord */
6581         /* SLtoVLMappingTableRecord */
6582         /* SwitchInfoRecord */
6583         /* LinearForwardingTableRecord */
6584         /* RandomForwardingTableRecord */
6585         /* MulticastForwardingTableRecord */
6586         /* VLArbitrationTableRecord */
6587         { &hf_infiniband_SA_LID, {
6588                 "LID", "infiniband.sa.lid",
6589                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6590         },
6591         { &hf_infiniband_SA_EndportLID, {
6592                 "EndportLID", "infiniband.sa.endportlid",
6593                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6594         },
6595         { &hf_infiniband_SA_PortNum, {
6596                 "PortNum", "infiniband.sa.portnum",
6597                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6598         },
6599         { &hf_infiniband_SA_InputPortNum , {
6600                 "InputPortNum", "infiniband.sa.inputportnum",
6601                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6602         },
6603         { &hf_infiniband_SA_OutputPortNum, {
6604                 "OutputPortNum", "infiniband.sa.outputportnum",
6605                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6606         },
6607         { &hf_infiniband_SA_BlockNum_EightBit, {
6608                 "BlockNum_EightBit", "infiniband.sa.blocknum_eightbit",
6609                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6610         },
6611         { &hf_infiniband_SA_BlockNum_NineBit, {
6612                 "BlockNum_NineBit", "infiniband.sa.blocknum_ninebit",
6613                 FT_UINT16, BASE_HEX, NULL, 0x01FF, NULL, HFILL}
6614         },
6615         { &hf_infiniband_SA_BlockNum_SixteenBit, {
6616                 "BlockNum_SixteenBit", "infiniband.sa.blocknum_sixteenbit",
6617                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6618         },
6619         { &hf_infiniband_SA_Position, {
6620                 "Position", "infiniband.sa.position",
6621                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6622         },
6623 #if 0
6624         { &hf_infiniband_SA_Index, {
6625                 "Index", "infiniband.sa.index",
6626                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6627         },
6628 #endif
6629
6630         /* InformInfoRecord */
6631         { &hf_infiniband_InformInfoRecord_SubscriberGID, {
6632                 "SubscriberGID", "infiniband.informinforecord.subscribergid",
6633                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6634         },
6635         { &hf_infiniband_InformInfoRecord_Enum, {
6636                 "Enum", "infiniband.informinforecord.enum",
6637                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6638         },
6639
6640         /* InformInfo */
6641         { &hf_infiniband_InformInfo_GID, {
6642                 "GID", "infiniband.informinfo.gid",
6643                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6644         },
6645         { &hf_infiniband_InformInfo_LIDRangeBegin, {
6646                 "LIDRangeBegin", "infiniband.informinfo.lidrangebegin",
6647                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6648         },
6649         { &hf_infiniband_InformInfo_LIDRangeEnd, {
6650                 "LIDRangeEnd", "infiniband.informinfo.lidrangeend",
6651                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6652         },
6653         { &hf_infiniband_InformInfo_IsGeneric, {
6654                 "IsGeneric", "infiniband.informinfo.isgeneric",
6655                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6656         },
6657         { &hf_infiniband_InformInfo_Subscribe, {
6658                 "Subscribe", "infiniband.informinfo.subscribe",
6659                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6660         },
6661         { &hf_infiniband_InformInfo_Type, {
6662                 "Type", "infiniband.informinfo.type",
6663                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6664         },
6665         { &hf_infiniband_InformInfo_TrapNumberDeviceID, {
6666                 "TrapNumberDeviceID", "infiniband.informinfo.trapnumberdeviceid",
6667                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6668         },
6669         { &hf_infiniband_InformInfo_QPN, {
6670                 "QPN", "infiniband.informinfo.qpn",
6671                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
6672         },
6673         { &hf_infiniband_InformInfo_RespTimeValue, {
6674                 "RespTimeValue", "infiniband.informinfo.resptimevalue",
6675                 FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}
6676         },
6677         { &hf_infiniband_InformInfo_ProducerTypeVendorID, {
6678                 "ProducerTypeVendorID", "infiniband.informinfo.producertypevendorid",
6679                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
6680         },
6681
6682         /* LinkRecord */
6683         { &hf_infiniband_LinkRecord_FromLID, {
6684                 "FromLID", "infiniband.linkrecord.fromlid",
6685                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6686         },
6687         { &hf_infiniband_LinkRecord_FromPort, {
6688                 "FromPort", "infiniband.linkrecord.fromport",
6689                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6690         },
6691         { &hf_infiniband_LinkRecord_ToPort, {
6692                 "ToPort", "infiniband.linkrecord.toport",
6693                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6694         },
6695         { &hf_infiniband_LinkRecord_ToLID, {
6696                 "ToLID", "infiniband.linkrecord.tolid",
6697                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6698         },
6699
6700         /* ServiceRecord */
6701         { &hf_infiniband_ServiceRecord_ServiceID, {
6702                 "ServiceID", "infiniband.linkrecord.serviceid",
6703                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
6704         },
6705         { &hf_infiniband_ServiceRecord_ServiceGID, {
6706                 "ServiceGID", "infiniband.linkrecord.servicegid",
6707                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6708         },
6709         { &hf_infiniband_ServiceRecord_ServiceP_Key, {
6710                 "ServiceP_Key", "infiniband.linkrecord.servicep_key",
6711                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6712         },
6713         { &hf_infiniband_ServiceRecord_ServiceLease, {
6714                 "ServiceLease", "infiniband.linkrecord.servicelease",
6715                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
6716         },
6717         { &hf_infiniband_ServiceRecord_ServiceKey, {
6718                 "ServiceKey", "infiniband.linkrecord.servicekey",
6719                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6720         },
6721         { &hf_infiniband_ServiceRecord_ServiceName, {
6722                 "ServiceName", "infiniband.linkrecord.servicename",
6723                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6724         },
6725         { &hf_infiniband_ServiceRecord_ServiceData, {
6726                 "ServiceData", "infiniband.linkrecord.servicedata",
6727                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6728         },
6729
6730         /* ServiceAssociationRecord */
6731         { &hf_infiniband_ServiceAssociationRecord_ServiceKey, {
6732                 "ServiceKey", "infiniband.serviceassociationrecord.servicekey",
6733                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
6734         },
6735         { &hf_infiniband_ServiceAssociationRecord_ServiceName, {
6736                 "ServiceName", "infiniband.serviceassociationrecord.servicename",
6737                 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}
6738         },
6739
6740         /* PathRecord */
6741         { &hf_infiniband_PathRecord_DGID, {
6742                 "DGID", "infiniband.pathrecord.dgid",
6743                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6744         },
6745         { &hf_infiniband_PathRecord_SGID, {
6746                 "SGID", "infiniband.pathrecord.sgid",
6747                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6748         },
6749         { &hf_infiniband_PathRecord_DLID, {
6750                 "DLID", "infiniband.pathrecord.dlid",
6751                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6752         },
6753         { &hf_infiniband_PathRecord_SLID, {
6754                 "SLID", "infiniband.pathrecord.slid",
6755                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6756         },
6757         { &hf_infiniband_PathRecord_RawTraffic, {
6758                 "RawTraffic", "infiniband.pathrecord.rawtraffic",
6759                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6760         },
6761         { &hf_infiniband_PathRecord_FlowLabel, {
6762                 "FlowLabel", "infiniband.pathrecord.flowlabel",
6763                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
6764         },
6765         { &hf_infiniband_PathRecord_HopLimit, {
6766                 "HopLimit", "infiniband.pathrecord.hoplimit",
6767                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6768         },
6769         { &hf_infiniband_PathRecord_TClass, {
6770                 "TClass", "infiniband.pathrecord.tclass",
6771                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6772         },
6773         { &hf_infiniband_PathRecord_Reversible, {
6774                 "Reversible", "infiniband.pathrecord.reversible",
6775                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6776         },
6777         { &hf_infiniband_PathRecord_NumbPath, {
6778                 "NumbPath", "infiniband.pathrecord.numbpath",
6779                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
6780         },
6781         { &hf_infiniband_PathRecord_P_Key, {
6782                 "P_Key", "infiniband.pathrecord.p_key",
6783                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6784         },
6785         { &hf_infiniband_PathRecord_SL, {
6786                 "SL", "infiniband.pathrecord.sl",
6787                 FT_UINT16, BASE_HEX, NULL, 0x000F, NULL, HFILL}
6788         },
6789         { &hf_infiniband_PathRecord_MTUSelector, {
6790                 "MTUSelector", "infiniband.pathrecord.mtuselector",
6791                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6792         },
6793         { &hf_infiniband_PathRecord_MTU, {
6794                 "MTU", "infiniband.pathrecord.mtu",
6795                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6796         },
6797         { &hf_infiniband_PathRecord_RateSelector, {
6798                 "RateSelector", "infiniband.pathrecord.rateselector",
6799                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6800         },
6801         { &hf_infiniband_PathRecord_Rate, {
6802                 "Rate", "infiniband.pathrecord.rate",
6803                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6804         },
6805         { &hf_infiniband_PathRecord_PacketLifeTimeSelector, {
6806                 "PacketLifeTimeSelector", "infiniband.pathrecord.packetlifetimeselector",
6807                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6808         },
6809         { &hf_infiniband_PathRecord_PacketLifeTime, {
6810                 "PacketLifeTime", "infiniband.pathrecord.packetlifetime",
6811                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6812         },
6813         { &hf_infiniband_PathRecord_Preference, {
6814                 "Preference", "infiniband.pathrecord.preference",
6815                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6816         },
6817
6818         /* MCMemberRecord */
6819         { &hf_infiniband_MCMemberRecord_MGID, {
6820                 "MGID", "infiniband.mcmemberrecord.mgid",
6821                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6822         },
6823         { &hf_infiniband_MCMemberRecord_PortGID, {
6824                 "PortGID", "infiniband.mcmemberrecord.portgid",
6825                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6826         },
6827         { &hf_infiniband_MCMemberRecord_Q_Key, {
6828                 "Q_Key", "infiniband.mcmemberrecord.q_key",
6829                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
6830         },
6831         { &hf_infiniband_MCMemberRecord_MLID, {
6832                 "MLID", "infiniband.mcmemberrecord.mlid",
6833                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6834         },
6835         { &hf_infiniband_MCMemberRecord_MTUSelector, {
6836                 "MTUSelector", "infiniband.mcmemberrecord.mtuselector",
6837                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6838         },
6839         { &hf_infiniband_MCMemberRecord_MTU, {
6840                 "MTU", "infiniband.mcmemberrecord.mtu",
6841                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6842         },
6843         { &hf_infiniband_MCMemberRecord_TClass, {
6844                 "TClass", "infiniband.mcmemberrecord.tclass",
6845                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6846         },
6847         { &hf_infiniband_MCMemberRecord_P_Key, {
6848                 "P_Key", "infiniband.mcmemberrecord.p_key",
6849                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6850         },
6851         { &hf_infiniband_MCMemberRecord_RateSelector, {
6852                 "RateSelector", "infiniband.mcmemberrecord.rateselector",
6853                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6854         },
6855         { &hf_infiniband_MCMemberRecord_Rate, {
6856                 "Rate", "infiniband.mcmemberrecord.rate",
6857                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6858         },
6859         { &hf_infiniband_MCMemberRecord_PacketLifeTimeSelector, {
6860                 "PacketLifeTimeSelector", "infiniband.mcmemberrecord.packetlifetimeselector",
6861                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6862         },
6863         { &hf_infiniband_MCMemberRecord_PacketLifeTime, {
6864                 "PacketLifeTime", "infiniband.mcmemberrecord.packetlifetime",
6865                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6866         },
6867         { &hf_infiniband_MCMemberRecord_SL, {
6868                 "SL", "infiniband.mcmemberrecord.sl",
6869                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6870         },
6871         { &hf_infiniband_MCMemberRecord_FlowLabel, {
6872                 "FlowLabel", "infiniband.mcmemberrecord.flowlabel",
6873                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
6874         },
6875         { &hf_infiniband_MCMemberRecord_HopLimit, {
6876                 "HopLimit", "infiniband.mcmemberrecord.hoplimit",
6877                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6878         },
6879         { &hf_infiniband_MCMemberRecord_Scope, {
6880                 "Scope", "infiniband.mcmemberrecord.scope",
6881                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6882         },
6883         { &hf_infiniband_MCMemberRecord_JoinState, {
6884                 "JoinState", "infiniband.mcmemberrecord.joinstate",
6885                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
6886         },
6887         { &hf_infiniband_MCMemberRecord_ProxyJoin, {
6888                 "ProxyJoin", "infiniband.mcmemberrecord.proxyjoin",
6889                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6890         },
6891
6892         /* MultiPathRecord */
6893         { &hf_infiniband_MultiPathRecord_RawTraffic, {
6894                 "RawTraffic", "infiniband.multipathrecord.rawtraffic",
6895                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6896         },
6897         { &hf_infiniband_MultiPathRecord_FlowLabel, {
6898                 "FlowLabel", "infiniband.multipathrecord.flowlabel",
6899                 FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, NULL, HFILL}
6900         },
6901         { &hf_infiniband_MultiPathRecord_HopLimit, {
6902                 "HopLimit", "infiniband.multipathrecord.hoplimit",
6903                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6904         },
6905         { &hf_infiniband_MultiPathRecord_TClass, {
6906                 "TClass", "infiniband.multipathrecord.tclass",
6907                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6908         },
6909         { &hf_infiniband_MultiPathRecord_Reversible, {
6910                 "Reversible", "infiniband.multipathrecord.reversible",
6911                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6912         },
6913         { &hf_infiniband_MultiPathRecord_NumbPath, {
6914                 "NumbPath", "infiniband.multipathrecord.numbpath",
6915                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
6916         },
6917         { &hf_infiniband_MultiPathRecord_P_Key, {
6918                 "P_Key", "infiniband.multipathrecord.p_key",
6919                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6920         },
6921         { &hf_infiniband_MultiPathRecord_SL, {
6922                 "SL", "infiniband.multipathrecord.sl",
6923                 FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}
6924         },
6925         { &hf_infiniband_MultiPathRecord_MTUSelector, {
6926                 "MTUSelector", "infiniband.multipathrecord.mtuselector",
6927                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6928         },
6929         { &hf_infiniband_MultiPathRecord_MTU, {
6930                 "MTU", "infiniband.multipathrecord.mtu",
6931                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6932         },
6933         { &hf_infiniband_MultiPathRecord_RateSelector, {
6934                 "RateSelector", "infiniband.multipathrecord.rateselector",
6935                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6936         },
6937         { &hf_infiniband_MultiPathRecord_Rate, {
6938                 "Rate", "infiniband.multipathrecord.rate",
6939                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6940         },
6941         { &hf_infiniband_MultiPathRecord_PacketLifeTimeSelector, {
6942                 "PacketLifeTimeSelector", "infiniband.multipathrecord.packetlifetimeselector",
6943                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6944         },
6945         { &hf_infiniband_MultiPathRecord_PacketLifeTime, {
6946                 "PacketLifeTime", "infiniband.multipathrecord.packetlifetime",
6947                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6948         },
6949         { &hf_infiniband_MultiPathRecord_IndependenceSelector, {
6950                 "IndependenceSelector", "infiniband.multipathrecord.independenceselector",
6951                 FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL}
6952         },
6953         { &hf_infiniband_MultiPathRecord_GIDScope, {
6954                 "GIDScope", "infiniband.multipathrecord.gidscope",
6955                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
6956         },
6957         { &hf_infiniband_MultiPathRecord_SGIDCount, {
6958                 "SGIDCount", "infiniband.multipathrecord.sgidcount",
6959                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6960         },
6961         { &hf_infiniband_MultiPathRecord_DGIDCount, {
6962                 "DGIDCount", "infiniband.multipathrecord.dgidcount",
6963                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
6964         },
6965         { &hf_infiniband_MultiPathRecord_SDGID, {
6966                 "SDGID", "infiniband.multipathrecord.sdgid",
6967                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
6968         },
6969
6970         /* Notice */
6971         { &hf_infiniband_Notice_IsGeneric, {
6972                 "IsGeneric", "infiniband.notice.isgeneric",
6973                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6974         },
6975         { &hf_infiniband_Notice_Type, {
6976                 "Type", "infiniband.notice.type",
6977                 FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL}
6978         },
6979         { &hf_infiniband_Notice_ProducerTypeVendorID, {
6980                 "ProducerTypeVendorID", "infiniband.notice.producertypevendorid",
6981                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
6982         },
6983         { &hf_infiniband_Notice_TrapNumberDeviceID, {
6984                 "TrapNumberDeviceID", "infiniband.notice.trapnumberdeviceid",
6985                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6986         },
6987         { &hf_infiniband_Notice_IssuerLID, {
6988                 "IssuerLID", "infiniband.notice.issuerlid",
6989                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
6990         },
6991         { &hf_infiniband_Notice_NoticeToggle, {
6992                 "NoticeToggle", "infiniband.notice.noticetoggle",
6993                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
6994         },
6995         { &hf_infiniband_Notice_NoticeCount, {
6996                 "NoticeCount", "infiniband.notice.noticecount",
6997                 FT_UINT16, BASE_HEX, NULL, 0x7FFF, NULL, HFILL}
6998         },
6999         { &hf_infiniband_Notice_DataDetails, {
7000                 "DataDetails", "infiniband.notice.datadetails",
7001                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
7002         },
7003 #if 0
7004         { &hf_infiniband_Notice_IssuerGID, {
7005                 "IssuerGID", "infiniband.notice.issuergid",
7006                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7007         },
7008         { &hf_infiniband_Notice_ClassTrapSpecificData, {
7009                 "ClassTrapSpecificData", "infiniband.notice.classtrapspecificdata",
7010                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
7011         },
7012 #endif
7013
7014         /* Traps 64,65,66,67 */
7015         { &hf_infiniband_Trap_GIDADDR, {
7016                 "GIDADDR", "infiniband.trap.gidaddr",
7017                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7018         },
7019         /* Traps 68,69 */
7020         { &hf_infiniband_Trap_COMP_MASK, {
7021                 "COMP_MASK", "infiniband.trap.comp_mask",
7022                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
7023         },
7024         { &hf_infiniband_Trap_WAIT_FOR_REPATH, {
7025                 "WAIT_FOR_REPATH", "infiniband.trap.wait_for_repath",
7026                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
7027         },
7028 #if 0
7029         { &hf_infiniband_Trap_PATH_REC, {
7030                 "PATH_REC", "infiniband.trap.path_rec",
7031                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
7032         },
7033 #endif
7034
7035         /* Trap 128 */
7036         { &hf_infiniband_Trap_LIDADDR, {
7037                 "LIDADDR", "infiniband.trap.lidaddr",
7038                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7039         },
7040
7041         /* Trap 129, 130, 131 */
7042         { &hf_infiniband_Trap_PORTNO, {
7043                 "PORTNO", "infiniband.trap.portno",
7044                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
7045         },
7046
7047         /* Trap 144 */
7048         { &hf_infiniband_Trap_OtherLocalChanges, {
7049                 "OtherLocalChanges", "infiniband.trap.otherlocalchanges",
7050                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
7051         },
7052         { &hf_infiniband_Trap_CAPABILITYMASK, {
7053                 "CAPABILITYMASK", "infiniband.trap.capabilitymask",
7054                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
7055         },
7056         { &hf_infiniband_Trap_LinkSpeecEnabledChange, {
7057                 "LinkSpeecEnabledChange", "infiniband.trap.linkspeecenabledchange",
7058                 FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL}
7059         },
7060         { &hf_infiniband_Trap_LinkWidthEnabledChange, {
7061                 "LinkWidthEnabledChange", "infiniband.trap.linkwidthenabledchange",
7062                 FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL}
7063         },
7064         { &hf_infiniband_Trap_NodeDescriptionChange, {
7065                 "NodeDescriptionChange", "infiniband.trap.nodedescriptionchange",
7066                 FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
7067         },
7068
7069         /* Trap 145 */
7070         { &hf_infiniband_Trap_SYSTEMIMAGEGUID, {
7071                 "SYSTEMIMAGEGUID", "infiniband.trap.systemimageguid",
7072                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
7073         },
7074
7075         /* Trap 256 */
7076         { &hf_infiniband_Trap_DRSLID, {
7077                 "DRSLID", "infiniband.trap.drslid",
7078                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7079         },
7080         { &hf_infiniband_Trap_METHOD, {
7081                 "METHOD", "infiniband.trap.method",
7082                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
7083         },
7084         { &hf_infiniband_Trap_ATTRIBUTEID, {
7085                 "ATTRIBUTEID", "infiniband.trap.attributeid",
7086                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7087         },
7088         { &hf_infiniband_Trap_ATTRIBUTEMODIFIER, {
7089                 "ATTRIBUTEMODIFIER", "infiniband.trap.attributemodifier",
7090                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
7091         },
7092         { &hf_infiniband_Trap_MKEY, {
7093                 "MKEY", "infiniband.trap.mkey",
7094                 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
7095         },
7096         { &hf_infiniband_Trap_DRNotice, {
7097                 "DRNotice", "infiniband.trap.drnotice",
7098                 FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
7099         },
7100         { &hf_infiniband_Trap_DRPathTruncated, {
7101                 "DRPathTruncated", "infiniband.trap.drpathtruncated",
7102                 FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL}
7103         },
7104         { &hf_infiniband_Trap_DRHopCount, {
7105                 "DRHopCount", "infiniband.trap.drhopcount",
7106                 FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL}
7107         },
7108         { &hf_infiniband_Trap_DRNoticeReturnPath, {
7109                 "DRNoticeReturnPath", "infiniband.trap.drnoticereturnpath",
7110                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
7111         },
7112
7113         /* Trap 257, 258 */
7114         { &hf_infiniband_Trap_LIDADDR1, {
7115                 "LIDADDR1", "infiniband.trap.lidaddr1",
7116                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7117         },
7118         { &hf_infiniband_Trap_LIDADDR2, {
7119                 "LIDADDR2", "infiniband.trap.lidaddr2",
7120                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7121         },
7122         { &hf_infiniband_Trap_KEY, {
7123                 "KEY", "infiniband.trap.key",
7124                 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
7125         },
7126         { &hf_infiniband_Trap_SL, {
7127                 "SL", "infiniband.trap.sl",
7128                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL}
7129         },
7130         { &hf_infiniband_Trap_QP1, {
7131                 "QP1", "infiniband.trap.qp1",
7132                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
7133         },
7134         { &hf_infiniband_Trap_QP2, {
7135                 "QP2", "infiniband.trap.qp2",
7136                 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
7137         },
7138         { &hf_infiniband_Trap_GIDADDR1, {
7139                 "GIDADDR1", "infiniband.trap.gidaddr1",
7140                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7141         },
7142         { &hf_infiniband_Trap_GIDADDR2, {
7143                 "GIDADDR2", "infiniband.trap.gidaddr2",
7144                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7145         },
7146
7147         /* Trap 259 */
7148         { &hf_infiniband_Trap_DataValid, {
7149                 "DataValid", "infiniband.trap.datavalid",
7150                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7151         },
7152         { &hf_infiniband_Trap_PKEY, {
7153                 "PKEY", "infiniband.trap.pkey",
7154                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
7155         },
7156         { &hf_infiniband_Trap_SWLIDADDR, {
7157                 "SWLIDADDR", "infiniband.trap.swlidaddr",
7158                 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}
7159         },
7160         /* PortCounters in Performance class */
7161         { &hf_infiniband_PortCounters, {
7162                 "Port Counters (Performance Management MAD)", "infiniband.portcounters",
7163                 FT_NONE, BASE_NONE, NULL, 0x0,
7164                 "Performance class PortCounters packet", HFILL}
7165         },
7166         { &hf_infiniband_PortCounters_PortSelect, {
7167                 "PortSelect", "infiniband.portcounters.portselect",
7168                 FT_UINT8, BASE_HEX, NULL, 0x0,
7169                 "Selects the port that will be accessed", HFILL}
7170         },
7171         { &hf_infiniband_PortCounters_CounterSelect, {
7172                 "CounterSelect", "infiniband.portcounters.counterselect",
7173                 FT_UINT16, BASE_HEX, NULL, 0x0,
7174                 "When writing, selects which counters are affected by the operation", HFILL}
7175         },
7176         { &hf_infiniband_PortCounters_SymbolErrorCounter, {
7177                 "SymbolErrorCounter", "infiniband.portcounters.symbolerrorcounter",
7178                 FT_UINT16, BASE_DEC, NULL, 0x0,
7179                 "Total number of minor link errors", HFILL}
7180         },
7181         { &hf_infiniband_PortCounters_LinkErrorRecoveryCounter, {
7182                 "LinkErrorRecoveryCounter", "infiniband.portcounters.linkerrorrecoverycounter",
7183                 FT_UINT8, BASE_DEC, NULL, 0x0,
7184                 "Total number of times successfully completed link error recovery process", HFILL}
7185         },
7186         { &hf_infiniband_PortCounters_LinkDownedCounter, {
7187                 "LinkDownedCounter", "infiniband.portcounters.linkdownedcounter",
7188                 FT_UINT8, BASE_DEC, NULL, 0x0,
7189                 "Total number of times failed link error recovery process", HFILL}
7190         },
7191         { &hf_infiniband_PortCounters_PortRcvErrors, {
7192                 "PortRcvErrors", "infiniband.portcounters.portrcverrors",
7193                 FT_UINT16, BASE_DEC, NULL, 0x0,
7194                 "Total number of packets containing an error received", HFILL}
7195         },
7196         { &hf_infiniband_PortCounters_PortRcvRemotePhysicalErrors, {
7197                 "PortRcvRemotePhysicalErrors", "infiniband.portcounters.portrcvremotephysicalerrors",
7198                 FT_UINT16, BASE_DEC, NULL, 0x0,
7199                 "Total number of packets marked with EBP delimiter received", HFILL}
7200         },
7201         { &hf_infiniband_PortCounters_PortRcvSwitchRelayErrors, {
7202                 "PortRcvSwitchRelayErrors", "infiniband.portcounters.portrcvswitchrelayerrors",
7203                 FT_UINT16, BASE_DEC, NULL, 0x0,
7204                 "Total number of packets discarded because they could not be forwarded by switch relay",
7205                 HFILL}
7206         },
7207         { &hf_infiniband_PortCounters_PortXmitDiscards, {
7208                 "PortXmitDiscards", "infiniband.portcounters.portxmitdiscards",
7209                 FT_UINT16, BASE_DEC, NULL, 0x0,
7210                 "Total number of outbound packets discarded", HFILL}
7211         },
7212         { &hf_infiniband_PortCounters_PortXmitConstraintErrors, {
7213                 "PortXmitConstraintErrors", "infiniband.portcounters.portxmitconstrainterrors",
7214                 FT_UINT8, BASE_DEC, NULL, 0x0,
7215                 "Total number of packets not transmitted from the switch physical port", HFILL}
7216         },
7217         { &hf_infiniband_PortCounters_PortRcvConstraintErrors, {
7218                 "PortRcvConstraintErrors", "infiniband.portcounters.portrcvconstrainterrors",
7219                 FT_UINT8, BASE_DEC, NULL, 0x0,
7220                 "Total number of packets received on the switch physical port that are discarded", HFILL}
7221         },
7222         { &hf_infiniband_PortCounters_LocalLinkIntegrityErrors, {
7223                 "LocalLinkIntegrityErrors", "infiniband.portcounters.locallinkintegrityerrors",
7224                 FT_UINT8, BASE_DEC, NULL, 0x0,
7225                 "The number of times the count of local physical errors exceeded the threshold specified by LocalPhyErrors",
7226                 HFILL}
7227         },
7228         { &hf_infiniband_PortCounters_ExcessiveBufferOverrunErrors, {
7229                 "ExcessiveBufferOverrunErrors", "infiniband.portcounters.excessivebufferoverrunerrors",
7230                 FT_UINT8, BASE_DEC, NULL, 0x0,
7231                 "The number of times that OverrunErrors consecutive flow control update periods occured",
7232                 HFILL}
7233         },
7234         { &hf_infiniband_PortCounters_VL15Dropped, {
7235                 "VL15Dropped", "infiniband.portcounters.vl15dropped",
7236                 FT_UINT16, BASE_DEC, NULL, 0x0,
7237                 "Number of incoming VL15 packets dropped", HFILL}
7238         },
7239         { &hf_infiniband_PortCounters_PortXmitData, {
7240                 "PortXmitData", "infiniband.portcounters.portxmitdata",
7241                 FT_UINT32, BASE_DEC, NULL, 0x0,
7242                 "Total number of data octets, divided by 4, transmitted on all VLs from the port", HFILL}
7243         },
7244         { &hf_infiniband_PortCounters_PortRcvData, {
7245                 "PortRcvData", "infiniband.portcounters.portrcvdata",
7246                 FT_UINT32, BASE_DEC, NULL, 0x0,
7247                 "Total number of data octets, divided by 4, received on all VLs at the port", HFILL}
7248         },
7249         { &hf_infiniband_PortCounters_PortXmitPkts, {
7250                 "PortXmitPkts", "infiniband.portcounters.portxmitpkts",
7251                 FT_UINT32, BASE_DEC, NULL, 0x0,
7252                 "Total number of packets transmitted on all VLs from the port", HFILL}
7253         },
7254         { &hf_infiniband_PortCounters_PortRcvPkts, {
7255                 "PortRcvPkts", "infiniband.portcounters.portrcvpkts",
7256                 FT_UINT32, BASE_DEC, NULL, 0x0,
7257                 "Total number of packets received from all VLs on the port", HFILL}
7258         },
7259         /* PortCountersExtended in Performance class */
7260         { &hf_infiniband_PortCountersExt, {
7261                 "Port Counters Extended (Performance Management MAD)", "infiniband.portcounters_ext",
7262                 FT_NONE, BASE_NONE, NULL, 0x0,
7263                 "Performance class PortCountersExtended packet", HFILL}
7264         },
7265         { &hf_infiniband_PortCountersExt_PortSelect, {
7266                 "PortSelect", "infiniband.portcounters_ext.portselect",
7267                 FT_UINT8, BASE_HEX, NULL, 0x0,
7268                 "Selects the port that will be accessed", HFILL}
7269         },
7270         { &hf_infiniband_PortCountersExt_CounterSelect, {
7271                 "CounterSelect", "infiniband.portcounters_ext.counterselect",
7272                 FT_UINT16, BASE_HEX, NULL, 0x0,
7273                 "When writing, selects which counters are affected by the operation", HFILL}
7274         },
7275         { &hf_infiniband_PortCountersExt_PortXmitData, {
7276                 "PortXmitData", "infiniband.portcounters_ext.portxmitdata",
7277                 FT_UINT64, BASE_DEC, NULL, 0x0,
7278                 "Total number of data octets, divided by 4, transmitted on all VLs from the port", HFILL}
7279         },
7280         { &hf_infiniband_PortCountersExt_PortRcvData, {
7281                 "PortRcvData", "infiniband.portcounters_ext.portrcvdata",
7282                 FT_UINT64, BASE_DEC, NULL, 0x0,
7283                 "Total number of data octets, divided by 4, received on all VLs at the port", HFILL}
7284         },
7285         { &hf_infiniband_PortCountersExt_PortXmitPkts, {
7286                 "PortXmitPkts", "infiniband.portcounters_ext.portxmitpkts",
7287                 FT_UINT64, BASE_DEC, NULL, 0x0,
7288                 "Total number of packets transmitted on all VLs from the port", HFILL}
7289         },
7290         { &hf_infiniband_PortCountersExt_PortRcvPkts, {
7291                 "PortRcvPkts", "infiniband.portcounters_ext.portrcvpkts",
7292                 FT_UINT64, BASE_DEC, NULL, 0x0,
7293                 "Total number of packets received from all VLs on the port", HFILL}
7294         },
7295         { &hf_infiniband_PortCountersExt_PortUnicastXmitPkts, {
7296                 "PortUnicastXmitPkts", "infiniband.portcounters_ext.portunicastxmitpkts",
7297                 FT_UINT64, BASE_DEC, NULL, 0x0,
7298                 "Total number of unicast packets transmitted on all VLs from the port", HFILL}
7299         },
7300         { &hf_infiniband_PortCountersExt_PortUnicastRcvPkts, {
7301                 "PortUnicastRcvPkts", "infiniband.portcounters_ext.portunicastrcvpkts",
7302                 FT_UINT64, BASE_DEC, NULL, 0x0,
7303                 "Total number of unicast packets received from all VLs on the port", HFILL}
7304         },
7305         { &hf_infiniband_PortCountersExt_PortMulticastXmitPkts, {
7306                 "PortMulticastXmitPkts", "infiniband.portcounters_ext.portmulticastxmitpkts",
7307                 FT_UINT64, BASE_DEC, NULL, 0x0,
7308                 "Total number of multicast packets transmitted on all VLs from the port", HFILL}
7309         },
7310         { &hf_infiniband_PortCountersExt_PortMulticastRcvPkts, {
7311                 "PortMulticastRcvPkts", "infiniband.portcounters_ext.portmulticastrcvpkts",
7312                 FT_UINT64, BASE_DEC, NULL, 0x0,
7313                 "Total number of multicast packets received from all VLs on the port", HFILL}
7314         }
7315     };
7316
7317     /* Array to hold expansion options between dissections */
7318     static gint *ett[] = {
7319     /*  &ett_infiniband,       */
7320         &ett_all_headers,
7321         &ett_lrh,
7322         &ett_grh,
7323         &ett_bth,
7324         &ett_rwh,
7325         &ett_rawdata,
7326         &ett_rdeth,
7327         &ett_deth,
7328         &ett_reth,
7329         &ett_atomiceth,
7330         &ett_aeth,
7331         &ett_atomicacketh,
7332         &ett_immdt,
7333         &ett_ieth,
7334         &ett_payload,
7335         &ett_vendor,
7336         &ett_subn_lid_routed,
7337         &ett_subn_directed_route,
7338         &ett_subnadmin,
7339         &ett_cm,
7340         &ett_mad,
7341         &ett_rmpp,
7342         &ett_subm_attribute,
7343         &ett_suba_attribute,
7344         &ett_datadetails,
7345         &ett_noticestraps,
7346     /*  &ett_nodedesc,         */
7347     /*  &ett_nodeinfo,         */
7348     /*  &ett_switchinfo,       */
7349     /*  &ett_guidinfo,         */
7350     /*  &ett_portinfo,         */
7351         &ett_portinfo_capmask,
7352         &ett_pkeytable,
7353         &ett_sltovlmapping,
7354         &ett_vlarbitrationtable,
7355         &ett_linearforwardingtable,
7356         &ett_randomforwardingtable,
7357         &ett_multicastforwardingtable,
7358         &ett_sminfo,
7359         &ett_vendordiag,
7360         &ett_ledinfo,
7361         &ett_linkspeedwidthpairs,
7362         &ett_informinfo,
7363         &ett_linkrecord,
7364         &ett_servicerecord,
7365         &ett_pathrecord,
7366         &ett_mcmemberrecord,
7367         &ett_tracerecord,
7368         &ett_multipathrecord,
7369         &ett_serviceassocrecord,
7370         &ett_perfclass,
7371         &ett_eoib
7372     };
7373
7374     static hf_register_info hf_link[] = {
7375         { &hf_infiniband_link_op, {
7376                 "Operand", "infiniband_link.op",
7377                 FT_UINT16, BASE_DEC, VALS(Operand_Description), 0xF000, NULL, HFILL}
7378         },
7379         { &hf_infiniband_link_fctbs, {
7380                 "Flow Control Total Blocks Sent", "infiniband_link.fctbs",
7381                 FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL}
7382         },
7383         { &hf_infiniband_link_vl, {
7384                 "Virtual Lane", "infiniband_link.vl",
7385                 FT_UINT16, BASE_DEC, NULL, 0xF000, NULL, HFILL}
7386         },
7387         { &hf_infiniband_link_fccl, {
7388                 "Flow Control Credit Limit", "infiniband_link.fccl",
7389                 FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL}
7390         },
7391         { &hf_infiniband_link_lpcrc, {
7392                 "Link Packet CRC", "infiniband_link.lpcrc",
7393                 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}
7394         }
7395     };
7396
7397
7398     static gint *ett_link_array[] = {
7399         &ett_link
7400     };
7401
7402     proto_infiniband = proto_register_protocol("InfiniBand", "InfiniBand", "infiniband");
7403     register_dissector("infiniband", dissect_infiniband, proto_infiniband);
7404
7405     proto_register_field_array(proto_infiniband, hf, array_length(hf));
7406     proto_register_subtree_array(ett, array_length(ett));
7407
7408     /* register the subdissector tables */
7409     register_heur_dissector_list("infiniband.payload", &heur_dissectors_payload);
7410     register_heur_dissector_list("infiniband.mad.cm.private", &heur_dissectors_cm_private);
7411
7412     /* register dissection preferences */
7413     infiniband_module = prefs_register_protocol(proto_infiniband, NULL);
7414
7415     prefs_register_bool_preference(infiniband_module, "identify_payload",
7416                                    "Attempt to identify and parse encapsulated IBA payloads",
7417                                    "When set, dissector will attempt to identify unknown IBA payloads "
7418                                    "as containing an encapsulated ethertype, and parse them accordingly",
7419                                    &pref_identify_iba_payload);
7420     prefs_register_bool_preference(infiniband_module, "dissect_eoib",
7421                                    "Attempt to identify and parse Mellanox EoIB packets",
7422                                    "When set, dissector will attempt to identify and parse "
7423                                    "Mellanox Ethernet-over-InfiniBand packets",
7424                                    &pref_dissect_eoib);
7425
7426     proto_infiniband_link = proto_register_protocol("InfiniBand Link", "InfiniBand Link", "infiniband_link");
7427     register_dissector("infiniband_link", dissect_infiniband_link, proto_infiniband_link);
7428
7429     proto_register_field_array(proto_infiniband_link, hf_link, array_length(hf_link));
7430     proto_register_subtree_array(ett_link_array, array_length(ett_link_array));
7431
7432     /* initialize the hash table */
7433     CM_context_table = g_hash_table_new_full(g_int64_hash, g_int64_equal,
7434                                              table_destroy_notify, table_destroy_notify);
7435 }
7436
7437 /* Reg Handoff.  Register dissectors we'll need for IPoIB and RoCE */
7438 void proto_reg_handoff_infiniband(void)
7439 {
7440     dissector_handle_t roce_handle;
7441
7442     ipv6_handle = find_dissector("ipv6");
7443     data_handle = find_dissector("data");
7444     eth_handle = find_dissector("eth");
7445     ethertype_dissector_table = find_dissector_table("ethertype");
7446
7447     /* create and announce an anonymous RoCE dissector */
7448     roce_handle = create_dissector_handle(dissect_roce, proto_infiniband);
7449     dissector_add("ethertype", ETHERTYPE_ROCE, roce_handle);
7450 }