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