1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5219820Sjeff *
6219820Sjeff * This software is available to you under a choice of one of two
7219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
8219820Sjeff * General Public License (GPL) Version 2, available from the file
9219820Sjeff * COPYING in the main directory of this source tree, or the
10219820Sjeff * OpenIB.org BSD license below:
11219820Sjeff *
12219820Sjeff *     Redistribution and use in source and binary forms, with or
13219820Sjeff *     without modification, are permitted provided that the following
14219820Sjeff *     conditions are met:
15219820Sjeff *
16219820Sjeff *      - Redistributions of source code must retain the above
17219820Sjeff *        copyright notice, this list of conditions and the following
18219820Sjeff *        disclaimer.
19219820Sjeff *
20219820Sjeff *      - Redistributions in binary form must reproduce the above
21219820Sjeff *        copyright notice, this list of conditions and the following
22219820Sjeff *        disclaimer in the documentation and/or other materials
23219820Sjeff *        provided with the distribution.
24219820Sjeff *
25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32219820Sjeff * SOFTWARE.
33219820Sjeff *
34219820Sjeff */
35219820Sjeff
36219820Sjeff/*
37219820Sjeff * Abstract:
38219820Sjeff *    Implementation of opensm helper functions.
39219820Sjeff */
40219820Sjeff
41219820Sjeff#if HAVE_CONFIG_H
42219820Sjeff#  include <config.h>
43219820Sjeff#endif				/* HAVE_CONFIG_H */
44219820Sjeff
45219820Sjeff#include <stdlib.h>
46219820Sjeff#include <stdio.h>
47219820Sjeff#include <string.h>
48219820Sjeff#include <arpa/inet.h>
49219820Sjeff#include <sys/socket.h>
50219820Sjeff#include <complib/cl_debug.h>
51219820Sjeff#include <iba/ib_types.h>
52219820Sjeff#include <opensm/osm_helper.h>
53219820Sjeff#include <opensm/osm_log.h>
54219820Sjeff
55219820Sjeff#define LINE_LENGTH 256
56219820Sjeff
57219820Sjeff#define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))
58219820Sjeff
59219820Sjeff/* we use two tables - one for queries and one for responses */
60219820Sjeffstatic const char *const __ib_sa_method_str[] = {
61219820Sjeff	"RESERVED",		/* 0 */
62219820Sjeff	"SubnAdmGet",		/* 1 */
63219820Sjeff	"SubnAdmSet",		/* 2 */
64219820Sjeff	"RESERVED",		/* 3 */
65219820Sjeff	"RESERVED",		/* 4 */
66219820Sjeff	"RESERVED",		/* 5 */
67219820Sjeff	"SubnAdmReport",	/* 6 */
68219820Sjeff	"RESERVED",		/* 7 */
69219820Sjeff	"RESERVED",		/* 8 */
70219820Sjeff	"RESERVED",		/* 9 */
71219820Sjeff	"RESERVED",		/* A */
72219820Sjeff	"RESERVED",		/* B */
73219820Sjeff	"RESERVED",		/* C */
74219820Sjeff	"RESERVED",		/* D */
75219820Sjeff	"RESERVED",		/* E */
76219820Sjeff	"RESERVED",		/* F */
77219820Sjeff	"RESERVED",		/* 10 */
78219820Sjeff	"RESERVED",		/* 11 */
79219820Sjeff	"SubnAdmGetTable",	/* 12 */
80219820Sjeff	"SubnAdmGetTraceTable",	/* 13 */
81219820Sjeff	"SubnAdmGetMulti",	/* 14 */
82219820Sjeff	"SubnAdmDelete",	/* 15 */
83219820Sjeff	"UNKNOWN"		/* 16 */
84219820Sjeff};
85219820Sjeff
86219820Sjeffstatic const char *const __ib_sa_resp_method_str[] = {
87219820Sjeff	"RESERVED",		/* 80 */
88219820Sjeff	"SubnAdmGetResp",	/* 81 */
89219820Sjeff	"RESERVED (SetResp?)",	/* 82 */
90219820Sjeff	"RESERVED",		/* 83 */
91219820Sjeff	"RESERVED",		/* 84 */
92219820Sjeff	"RESERVED",		/* 85 */
93219820Sjeff	"SubnAdmReportResp",	/* 86 */
94219820Sjeff	"RESERVED",		/* 87 */
95219820Sjeff	"RESERVED",		/* 88 */
96219820Sjeff	"RESERVED",		/* 89 */
97219820Sjeff	"RESERVED",		/* 8A */
98219820Sjeff	"RESERVED",		/* 8B */
99219820Sjeff	"RESERVED",		/* 8C */
100219820Sjeff	"RESERVED",		/* 8D */
101219820Sjeff	"RESERVED",		/* 8E */
102219820Sjeff	"RESERVED",		/* 8F */
103219820Sjeff	"RESERVED",		/* 90 */
104219820Sjeff	"RESERVED",		/* 91 */
105219820Sjeff	"SubnAdmGetTableResp",	/* 92 */
106219820Sjeff	"RESERVED",		/* 93 */
107219820Sjeff	"SubnAdmGetMultiResp",	/* 94 */
108219820Sjeff	"SubnAdmDeleteResp",	/* 95 */
109219820Sjeff	"UNKNOWN"
110219820Sjeff};
111219820Sjeff
112219820Sjeff#define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16
113219820Sjeff
114219820Sjeffstatic const char *const __ib_sm_method_str[] = {
115219820Sjeff	"RESERVED0",		/* 0 */
116219820Sjeff	"SubnGet",		/* 1 */
117219820Sjeff	"SubnSet",		/* 2 */
118219820Sjeff	"RESERVED3",		/* 3 */
119219820Sjeff	"RESERVED4",		/* 4 */
120219820Sjeff	"SubnTrap",		/* 5 */
121219820Sjeff	"RESERVED6",		/* 6 */
122219820Sjeff	"SubnTrapRepress",	/* 7 */
123219820Sjeff	"RESERVED8",		/* 8 */
124219820Sjeff	"RESERVED9",		/* 9 */
125219820Sjeff	"RESERVEDA",		/* A */
126219820Sjeff	"RESERVEDB",		/* B */
127219820Sjeff	"RESERVEDC",		/* C */
128219820Sjeff	"RESERVEDD",		/* D */
129219820Sjeff	"RESERVEDE",		/* E */
130219820Sjeff	"RESERVEDF",		/* F */
131219820Sjeff	"RESERVED10",		/* 10 */
132219820Sjeff	"SubnGetResp",		/* 11 */
133219820Sjeff	"RESERVED12",		/* 12 */
134219820Sjeff	"RESERVED13",		/* 13 */
135219820Sjeff	"RESERVED14",		/* 14 */
136219820Sjeff	"RESERVED15",		/* 15 */
137219820Sjeff	"RESERVED16",		/* 16 */
138219820Sjeff	"RESERVED17",		/* 17 */
139219820Sjeff	"RESERVED18",		/* 18 */
140219820Sjeff	"RESERVED19",		/* 19 */
141219820Sjeff	"RESERVED1A",		/* 1A */
142219820Sjeff	"RESERVED1B",		/* 1B */
143219820Sjeff	"RESERVED1C",		/* 1C */
144219820Sjeff	"RESERVED1D",		/* 1D */
145219820Sjeff	"RESERVED1E",		/* 1E */
146219820Sjeff	"RESERVED1F",		/* 1F */
147219820Sjeff	"UNKNOWN"		/* 20 */
148219820Sjeff};
149219820Sjeff
150219820Sjeff#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21
151219820Sjeff
152219820Sjeffstatic const char *const __ib_sm_attr_str[] = {
153219820Sjeff	"RESERVED",		/* 0 */
154219820Sjeff	"ClassPortInfo",	/* 1 */
155219820Sjeff	"Notice",		/* 2 */
156219820Sjeff	"InformInfo",		/* 3 */
157219820Sjeff	"RESERVED",		/* 4 */
158219820Sjeff	"RESERVED",		/* 5 */
159219820Sjeff	"RESERVED",		/* 6 */
160219820Sjeff	"RESERVED",		/* 7 */
161219820Sjeff	"RESERVED",		/* 8 */
162219820Sjeff	"RESERVED",		/* 9 */
163219820Sjeff	"RESERVED",		/* A */
164219820Sjeff	"RESERVED",		/* B */
165219820Sjeff	"RESERVED",		/* C */
166219820Sjeff	"RESERVED",		/* D */
167219820Sjeff	"RESERVED",		/* E */
168219820Sjeff	"RESERVED",		/* F */
169219820Sjeff	"NodeDescription",	/* 10 */
170219820Sjeff	"NodeInfo",		/* 11 */
171219820Sjeff	"SwitchInfo",		/* 12 */
172219820Sjeff	"UNKNOWN",		/* 13 */
173219820Sjeff	"GUIDInfo",		/* 14 */
174219820Sjeff	"PortInfo",		/* 15 */
175219820Sjeff	"P_KeyTable",		/* 16 */
176219820Sjeff	"SLtoVLMappingTable",	/* 17 */
177219820Sjeff	"VLArbitrationTable",	/* 18 */
178219820Sjeff	"LinearForwardingTable",	/* 19 */
179219820Sjeff	"RandomForwardingTable",	/* 1A */
180219820Sjeff	"MulticastForwardingTable",	/* 1B */
181219820Sjeff	"UNKNOWN",		/* 1C */
182219820Sjeff	"UNKNOWN",		/* 1D */
183219820Sjeff	"UNKNOWN",		/* 1E */
184219820Sjeff	"UNKNOWN",		/* 1F */
185219820Sjeff	"SMInfo",		/* 20 */
186219820Sjeff	"UNKNOWN"		/* 21 - always highest value */
187219820Sjeff};
188219820Sjeff
189219820Sjeff#define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21
190219820Sjeff
191219820Sjeffstatic const char *const __ib_sa_attr_str[] = {
192219820Sjeff	"RESERVED",		/* 0 */
193219820Sjeff	"ClassPortInfo",	/* 1 */
194219820Sjeff	"Notice",		/* 2 */
195219820Sjeff	"InformInfo",		/* 3 */
196219820Sjeff	"RESERVED",		/* 4 */
197219820Sjeff	"RESERVED",		/* 5 */
198219820Sjeff	"RESERVED",		/* 6 */
199219820Sjeff	"RESERVED",		/* 7 */
200219820Sjeff	"RESERVED",		/* 8 */
201219820Sjeff	"RESERVED",		/* 9 */
202219820Sjeff	"RESERVED",		/* A */
203219820Sjeff	"RESERVED",		/* B */
204219820Sjeff	"RESERVED",		/* C */
205219820Sjeff	"RESERVED",		/* D */
206219820Sjeff	"RESERVED",		/* E */
207219820Sjeff	"RESERVED",		/* F */
208219820Sjeff	"RESERVED",		/* 10 */
209219820Sjeff	"NodeRecord",		/* 11 */
210219820Sjeff	"PortInfoRecord",	/* 12 */
211219820Sjeff	"SLtoVLMappingTableRecord",	/* 13 */
212219820Sjeff	"SwitchInfoRecord",	/* 14 */
213219820Sjeff	"LinearForwardingTableRecord",	/* 15 */
214219820Sjeff	"RandomForwardingTableRecord",	/* 16 */
215219820Sjeff	"MulticastForwardingTableRecord",	/* 17 */
216219820Sjeff	"SMInfoRecord",		/* 18 */
217219820Sjeff	"RESERVED",		/* 19 */
218219820Sjeff	"RandomForwardingTable",	/* 1A */
219219820Sjeff	"MulticastForwardingTable",	/* 1B */
220219820Sjeff	"UNKNOWN",		/* 1C */
221219820Sjeff	"UNKNOWN",		/* 1D */
222219820Sjeff	"UNKNOWN",		/* 1E */
223219820Sjeff	"UNKNOWN",		/* 1F */
224219820Sjeff	"LinkRecord",		/* 20 */
225219820Sjeff	"UNKNOWN",		/* 21 */
226219820Sjeff	"UNKNOWN",		/* 22 */
227219820Sjeff	"UNKNOWN",		/* 23 */
228219820Sjeff	"UNKNOWN",		/* 24 */
229219820Sjeff	"UNKNOWN",		/* 25 */
230219820Sjeff	"UNKNOWN",		/* 26 */
231219820Sjeff	"UNKNOWN",		/* 27 */
232219820Sjeff	"UNKNOWN",		/* 28 */
233219820Sjeff	"UNKNOWN",		/* 29 */
234219820Sjeff	"UNKNOWN",		/* 2A */
235219820Sjeff	"UNKNOWN",		/* 2B */
236219820Sjeff	"UNKNOWN",		/* 2C */
237219820Sjeff	"UNKNOWN",		/* 2D */
238219820Sjeff	"UNKNOWN",		/* 2E */
239219820Sjeff	"UNKNOWN",		/* 2F */
240219820Sjeff	"GuidInfoRecord",	/* 30 */
241219820Sjeff	"ServiceRecord",	/* 31 */
242219820Sjeff	"UNKNOWN",		/* 32 */
243219820Sjeff	"P_KeyTableRecord",	/* 33 */
244219820Sjeff	"UNKNOWN",		/* 34 */
245219820Sjeff	"PathRecord",		/* 35 */
246219820Sjeff	"VLArbitrationTableRecord",	/* 36 */
247219820Sjeff	"UNKNOWN",		/* 37 */
248219820Sjeff	"MCMemberRecord",	/* 38 */
249219820Sjeff	"TraceRecord",		/* 39 */
250219820Sjeff	"MultiPathRecord",	/* 3A */
251219820Sjeff	"ServiceAssociationRecord",	/* 3B */
252219820Sjeff	"UNKNOWN",		/* 3C */
253219820Sjeff	"UNKNOWN",		/* 3D */
254219820Sjeff	"UNKNOWN",		/* 3E */
255219820Sjeff	"UNKNOWN",		/* 3F */
256219820Sjeff	"UNKNOWN",		/* 40 */
257219820Sjeff	"UNKNOWN",		/* 41 */
258219820Sjeff	"UNKNOWN",		/* 42 */
259219820Sjeff	"UNKNOWN",		/* 43 */
260219820Sjeff	"UNKNOWN",		/* 44 */
261219820Sjeff	"UNKNOWN",		/* 45 */
262219820Sjeff	"UNKNOWN",		/* 46 */
263219820Sjeff	"UNKNOWN",		/* 47 */
264219820Sjeff	"UNKNOWN",		/* 48 */
265219820Sjeff	"UNKNOWN",		/* 49 */
266219820Sjeff	"UNKNOWN",		/* 4A */
267219820Sjeff	"UNKNOWN",		/* 4B */
268219820Sjeff	"UNKNOWN",		/* 4C */
269219820Sjeff	"UNKNOWN",		/* 4D */
270219820Sjeff	"UNKNOWN",		/* 4E */
271219820Sjeff	"UNKNOWN",		/* 4F */
272219820Sjeff	"UNKNOWN",		/* 50 */
273219820Sjeff	"UNKNOWN",		/* 51 */
274219820Sjeff	"UNKNOWN",		/* 52 */
275219820Sjeff	"UNKNOWN",		/* 53 */
276219820Sjeff	"UNKNOWN",		/* 54 */
277219820Sjeff	"UNKNOWN",		/* 55 */
278219820Sjeff	"UNKNOWN",		/* 56 */
279219820Sjeff	"UNKNOWN",		/* 57 */
280219820Sjeff	"UNKNOWN",		/* 58 */
281219820Sjeff	"UNKNOWN",		/* 59 */
282219820Sjeff	"UNKNOWN",		/* 5A */
283219820Sjeff	"UNKNOWN",		/* 5B */
284219820Sjeff	"UNKNOWN",		/* 5C */
285219820Sjeff	"UNKNOWN",		/* 5D */
286219820Sjeff	"UNKNOWN",		/* 5E */
287219820Sjeff	"UNKNOWN",		/* 5F */
288219820Sjeff	"UNKNOWN",		/* 60 */
289219820Sjeff	"UNKNOWN",		/* 61 */
290219820Sjeff	"UNKNOWN",		/* 62 */
291219820Sjeff	"UNKNOWN",		/* 63 */
292219820Sjeff	"UNKNOWN",		/* 64 */
293219820Sjeff	"UNKNOWN",		/* 65 */
294219820Sjeff	"UNKNOWN",		/* 66 */
295219820Sjeff	"UNKNOWN",		/* 67 */
296219820Sjeff	"UNKNOWN",		/* 68 */
297219820Sjeff	"UNKNOWN",		/* 69 */
298219820Sjeff	"UNKNOWN",		/* 6A */
299219820Sjeff	"UNKNOWN",		/* 6B */
300219820Sjeff	"UNKNOWN",		/* 6C */
301219820Sjeff	"UNKNOWN",		/* 6D */
302219820Sjeff	"UNKNOWN",		/* 6E */
303219820Sjeff	"UNKNOWN",		/* 6F */
304219820Sjeff	"UNKNOWN",		/* 70 */
305219820Sjeff	"UNKNOWN",		/* 71 */
306219820Sjeff	"UNKNOWN",		/* 72 */
307219820Sjeff	"UNKNOWN",		/* 73 */
308219820Sjeff	"UNKNOWN",		/* 74 */
309219820Sjeff	"UNKNOWN",		/* 75 */
310219820Sjeff	"UNKNOWN",		/* 76 */
311219820Sjeff	"UNKNOWN",		/* 77 */
312219820Sjeff	"UNKNOWN",		/* 78 */
313219820Sjeff	"UNKNOWN",		/* 79 */
314219820Sjeff	"UNKNOWN",		/* 7A */
315219820Sjeff	"UNKNOWN",		/* 7B */
316219820Sjeff	"UNKNOWN",		/* 7C */
317219820Sjeff	"UNKNOWN",		/* 7D */
318219820Sjeff	"UNKNOWN",		/* 7E */
319219820Sjeff	"UNKNOWN",		/* 7F */
320219820Sjeff	"UNKNOWN",		/* 80 */
321219820Sjeff	"UNKNOWN",		/* 81 */
322219820Sjeff	"UNKNOWN",		/* 82 */
323219820Sjeff	"UNKNOWN",		/* 83 */
324219820Sjeff	"UNKNOWN",		/* 84 */
325219820Sjeff	"UNKNOWN",		/* 85 */
326219820Sjeff	"UNKNOWN",		/* 86 */
327219820Sjeff	"UNKNOWN",		/* 87 */
328219820Sjeff	"UNKNOWN",		/* 88 */
329219820Sjeff	"UNKNOWN",		/* 89 */
330219820Sjeff	"UNKNOWN",		/* 8A */
331219820Sjeff	"UNKNOWN",		/* 8B */
332219820Sjeff	"UNKNOWN",		/* 8C */
333219820Sjeff	"UNKNOWN",		/* 8D */
334219820Sjeff	"UNKNOWN",		/* 8E */
335219820Sjeff	"UNKNOWN",		/* 8F */
336219820Sjeff	"UNKNOWN",		/* 90 */
337219820Sjeff	"UNKNOWN",		/* 91 */
338219820Sjeff	"UNKNOWN",		/* 92 */
339219820Sjeff	"UNKNOWN",		/* 93 */
340219820Sjeff	"UNKNOWN",		/* 94 */
341219820Sjeff	"UNKNOWN",		/* 95 */
342219820Sjeff	"UNKNOWN",		/* 96 */
343219820Sjeff	"UNKNOWN",		/* 97 */
344219820Sjeff	"UNKNOWN",		/* 98 */
345219820Sjeff	"UNKNOWN",		/* 99 */
346219820Sjeff	"UNKNOWN",		/* 9A */
347219820Sjeff	"UNKNOWN",		/* 9B */
348219820Sjeff	"UNKNOWN",		/* 9C */
349219820Sjeff	"UNKNOWN",		/* 9D */
350219820Sjeff	"UNKNOWN",		/* 9E */
351219820Sjeff	"UNKNOWN",		/* 9F */
352219820Sjeff	"UNKNOWN",		/* A0 */
353219820Sjeff	"UNKNOWN",		/* A1 */
354219820Sjeff	"UNKNOWN",		/* A2 */
355219820Sjeff	"UNKNOWN",		/* A3 */
356219820Sjeff	"UNKNOWN",		/* A4 */
357219820Sjeff	"UNKNOWN",		/* A5 */
358219820Sjeff	"UNKNOWN",		/* A6 */
359219820Sjeff	"UNKNOWN",		/* A7 */
360219820Sjeff	"UNKNOWN",		/* A8 */
361219820Sjeff	"UNKNOWN",		/* A9 */
362219820Sjeff	"UNKNOWN",		/* AA */
363219820Sjeff	"UNKNOWN",		/* AB */
364219820Sjeff	"UNKNOWN",		/* AC */
365219820Sjeff	"UNKNOWN",		/* AD */
366219820Sjeff	"UNKNOWN",		/* AE */
367219820Sjeff	"UNKNOWN",		/* AF */
368219820Sjeff	"UNKNOWN",		/* B0 */
369219820Sjeff	"UNKNOWN",		/* B1 */
370219820Sjeff	"UNKNOWN",		/* B2 */
371219820Sjeff	"UNKNOWN",		/* B3 */
372219820Sjeff	"UNKNOWN",		/* B4 */
373219820Sjeff	"UNKNOWN",		/* B5 */
374219820Sjeff	"UNKNOWN",		/* B6 */
375219820Sjeff	"UNKNOWN",		/* B7 */
376219820Sjeff	"UNKNOWN",		/* B8 */
377219820Sjeff	"UNKNOWN",		/* B9 */
378219820Sjeff	"UNKNOWN",		/* BA */
379219820Sjeff	"UNKNOWN",		/* BB */
380219820Sjeff	"UNKNOWN",		/* BC */
381219820Sjeff	"UNKNOWN",		/* BD */
382219820Sjeff	"UNKNOWN",		/* BE */
383219820Sjeff	"UNKNOWN",		/* BF */
384219820Sjeff	"UNKNOWN",		/* C0 */
385219820Sjeff	"UNKNOWN",		/* C1 */
386219820Sjeff	"UNKNOWN",		/* C2 */
387219820Sjeff	"UNKNOWN",		/* C3 */
388219820Sjeff	"UNKNOWN",		/* C4 */
389219820Sjeff	"UNKNOWN",		/* C5 */
390219820Sjeff	"UNKNOWN",		/* C6 */
391219820Sjeff	"UNKNOWN",		/* C7 */
392219820Sjeff	"UNKNOWN",		/* C8 */
393219820Sjeff	"UNKNOWN",		/* C9 */
394219820Sjeff	"UNKNOWN",		/* CA */
395219820Sjeff	"UNKNOWN",		/* CB */
396219820Sjeff	"UNKNOWN",		/* CC */
397219820Sjeff	"UNKNOWN",		/* CD */
398219820Sjeff	"UNKNOWN",		/* CE */
399219820Sjeff	"UNKNOWN",		/* CF */
400219820Sjeff	"UNKNOWN",		/* D0 */
401219820Sjeff	"UNKNOWN",		/* D1 */
402219820Sjeff	"UNKNOWN",		/* D2 */
403219820Sjeff	"UNKNOWN",		/* D3 */
404219820Sjeff	"UNKNOWN",		/* D4 */
405219820Sjeff	"UNKNOWN",		/* D5 */
406219820Sjeff	"UNKNOWN",		/* D6 */
407219820Sjeff	"UNKNOWN",		/* D7 */
408219820Sjeff	"UNKNOWN",		/* D8 */
409219820Sjeff	"UNKNOWN",		/* D9 */
410219820Sjeff	"UNKNOWN",		/* DA */
411219820Sjeff	"UNKNOWN",		/* DB */
412219820Sjeff	"UNKNOWN",		/* DC */
413219820Sjeff	"UNKNOWN",		/* DD */
414219820Sjeff	"UNKNOWN",		/* DE */
415219820Sjeff	"UNKNOWN",		/* DF */
416219820Sjeff	"UNKNOWN",		/* E0 */
417219820Sjeff	"UNKNOWN",		/* E1 */
418219820Sjeff	"UNKNOWN",		/* E2 */
419219820Sjeff	"UNKNOWN",		/* E3 */
420219820Sjeff	"UNKNOWN",		/* E4 */
421219820Sjeff	"UNKNOWN",		/* E5 */
422219820Sjeff	"UNKNOWN",		/* E6 */
423219820Sjeff	"UNKNOWN",		/* E7 */
424219820Sjeff	"UNKNOWN",		/* E8 */
425219820Sjeff	"UNKNOWN",		/* E9 */
426219820Sjeff	"UNKNOWN",		/* EA */
427219820Sjeff	"UNKNOWN",		/* EB */
428219820Sjeff	"UNKNOWN",		/* EC */
429219820Sjeff	"UNKNOWN",		/* ED */
430219820Sjeff	"UNKNOWN",		/* EE */
431219820Sjeff	"UNKNOWN",		/* EF */
432219820Sjeff	"UNKNOWN",		/* F0 */
433219820Sjeff	"UNKNOWN",		/* F1 */
434219820Sjeff	"UNKNOWN",		/* F2 */
435219820Sjeff	"InformInfoRecord",	/* F3 */
436219820Sjeff	"UNKNOWN"		/* F4 - always highest value */
437219820Sjeff};
438219820Sjeff
439219820Sjeff#define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4
440219820Sjeff
441219820Sjeff/**********************************************************************
442219820Sjeff **********************************************************************/
443219820Sjeffconst char *ib_get_sa_method_str(IN uint8_t method)
444219820Sjeff{
445219820Sjeff	if (method & 0x80) {
446219820Sjeff		method = method & 0x7f;
447219820Sjeff		if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
448219820Sjeff			method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
449219820Sjeff		/* it is a response - use the response table */
450219820Sjeff		return (__ib_sa_resp_method_str[method]);
451219820Sjeff	} else {
452219820Sjeff		if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
453219820Sjeff			method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
454219820Sjeff		return (__ib_sa_method_str[method]);
455219820Sjeff	}
456219820Sjeff}
457219820Sjeff
458219820Sjeff/**********************************************************************
459219820Sjeff **********************************************************************/
460219820Sjeffconst char *ib_get_sm_method_str(IN uint8_t method)
461219820Sjeff{
462219820Sjeff	if (method & 0x80)
463219820Sjeff		method = (method & 0x0F) | 0x10;
464219820Sjeff	if (method >= OSM_SM_METHOD_STR_UNKNOWN_VAL)
465219820Sjeff		method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
466219820Sjeff	return (__ib_sm_method_str[method]);
467219820Sjeff}
468219820Sjeff
469219820Sjeff/**********************************************************************
470219820Sjeff **********************************************************************/
471219820Sjeffconst char *ib_get_sm_attr_str(IN ib_net16_t attr)
472219820Sjeff{
473219820Sjeff	uint16_t host_attr;
474219820Sjeff	host_attr = cl_ntoh16(attr);
475219820Sjeff
476219820Sjeff	if (host_attr >= OSM_SM_ATTR_STR_UNKNOWN_VAL)
477219820Sjeff		host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;
478219820Sjeff
479219820Sjeff	return (__ib_sm_attr_str[host_attr]);
480219820Sjeff}
481219820Sjeff
482219820Sjeff/**********************************************************************
483219820Sjeff **********************************************************************/
484219820Sjeffconst char *ib_get_sa_attr_str(IN ib_net16_t attr)
485219820Sjeff{
486219820Sjeff	uint16_t host_attr;
487219820Sjeff	host_attr = cl_ntoh16(attr);
488219820Sjeff
489219820Sjeff	if (host_attr >= OSM_SA_ATTR_STR_UNKNOWN_VAL)
490219820Sjeff		host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL;
491219820Sjeff
492219820Sjeff	return (__ib_sa_attr_str[host_attr]);
493219820Sjeff}
494219820Sjeff
495219820Sjeff/**********************************************************************
496219820Sjeff **********************************************************************/
497219820Sjeffconst char *ib_get_trap_str(ib_net16_t trap_num)
498219820Sjeff{
499219820Sjeff	switch(cl_ntoh16(trap_num))
500219820Sjeff	{
501219820Sjeff		case 64:
502219820Sjeff			return "GID in service";
503219820Sjeff		case 65:
504219820Sjeff			return "GID out of service";
505219820Sjeff		case 66:
506219820Sjeff			return "New mcast group created";
507219820Sjeff		case 67:
508219820Sjeff			return "Mcast group deleted";
509219820Sjeff		case 68:
510219820Sjeff			return "UnPath, Path no longer valid";
511219820Sjeff		case 69:
512219820Sjeff			return "RePath, Path recomputed";
513219820Sjeff		case 128:
514219820Sjeff			return "Link state change";
515219820Sjeff		case 129:
516219820Sjeff			return "Local Link integrity threshold reached";
517219820Sjeff		case 130:
518219820Sjeff			return "Excessive Buffer Overrun Threshold reached";
519219820Sjeff		case 131:
520219820Sjeff			return "Flow Control Update watchdog timer expired";
521219820Sjeff		case 144:
522219820Sjeff			return "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled changed";
523219820Sjeff		case 145:
524219820Sjeff			return "System Image GUID changed";
525219820Sjeff		case 256:
526219820Sjeff			return "Bad M_Key";
527219820Sjeff		case 257:
528219820Sjeff			return "Bad P_Key";
529219820Sjeff		case 258:
530219820Sjeff			return "Bad Q_Key";
531219820Sjeff		case 259:
532219820Sjeff			return "Bad P_Key (switch external port)";
533219820Sjeff		default:
534219820Sjeff			break;
535219820Sjeff	}
536219820Sjeff	return "Unknown";
537219820Sjeff}
538219820Sjeff
539219820Sjeff/**********************************************************************
540219820Sjeff **********************************************************************/
541219820Sjeffstatic ib_api_status_t
542219820Sjeffdbg_do_line(IN char **pp_local,
543219820Sjeff	    IN const uint32_t buf_size,
544219820Sjeff	    IN const char *const p_prefix_str,
545219820Sjeff	    IN const char *const p_new_str, IN uint32_t * const p_total_len)
546219820Sjeff{
547219820Sjeff	char line[LINE_LENGTH];
548219820Sjeff	uint32_t len;
549219820Sjeff
550219820Sjeff	sprintf(line, "%s%s", p_prefix_str, p_new_str);
551219820Sjeff	len = (uint32_t) strlen(line);
552219820Sjeff	*p_total_len += len;
553219820Sjeff	if (*p_total_len + sizeof('\0') > buf_size)
554219820Sjeff		return (IB_INSUFFICIENT_MEMORY);
555219820Sjeff
556219820Sjeff	strcpy(*pp_local, line);
557219820Sjeff	*pp_local += len;
558219820Sjeff	return (IB_SUCCESS);
559219820Sjeff}
560219820Sjeff
561219820Sjeff/**********************************************************************
562219820Sjeff **********************************************************************/
563219820Sjeffstatic void
564219820Sjeffdbg_get_capabilities_str(IN char *p_buf,
565219820Sjeff			 IN const uint32_t buf_size,
566219820Sjeff			 IN const char *const p_prefix_str,
567219820Sjeff			 IN const ib_port_info_t * const p_pi)
568219820Sjeff{
569219820Sjeff	uint32_t total_len = 0;
570219820Sjeff	char *p_local = p_buf;
571219820Sjeff
572219820Sjeff	strcpy(p_local, "Capability Mask:\n");
573219820Sjeff	p_local += strlen(p_local);
574219820Sjeff
575219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV0) {
576219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
577219820Sjeff				"IB_PORT_CAP_RESV0\n",
578219820Sjeff				&total_len) != IB_SUCCESS)
579219820Sjeff			return;
580219820Sjeff	}
581219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
582219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
583219820Sjeff				"IB_PORT_CAP_IS_SM\n",
584219820Sjeff				&total_len) != IB_SUCCESS)
585219820Sjeff			return;
586219820Sjeff	}
587219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE) {
588219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
589219820Sjeff				"IB_PORT_CAP_HAS_NOTICE\n",
590219820Sjeff				&total_len) != IB_SUCCESS)
591219820Sjeff			return;
592219820Sjeff	}
593219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP) {
594219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
595219820Sjeff				"IB_PORT_CAP_HAS_TRAP\n",
596219820Sjeff				&total_len) != IB_SUCCESS)
597219820Sjeff			return;
598219820Sjeff	}
599219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_IPD) {
600219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
601219820Sjeff				"IB_PORT_CAP_HAS_IPD\n",
602219820Sjeff				&total_len) != IB_SUCCESS)
603219820Sjeff			return;
604219820Sjeff	}
605219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG) {
606219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
607219820Sjeff				"IB_PORT_CAP_HAS_AUTO_MIG\n",
608219820Sjeff				&total_len) != IB_SUCCESS)
609219820Sjeff			return;
610219820Sjeff	}
611219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP) {
612219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
613219820Sjeff				"IB_PORT_CAP_HAS_SL_MAP\n",
614219820Sjeff				&total_len) != IB_SUCCESS)
615219820Sjeff			return;
616219820Sjeff	}
617219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY) {
618219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
619219820Sjeff				"IB_PORT_CAP_HAS_NV_MKEY\n",
620219820Sjeff				&total_len) != IB_SUCCESS)
621219820Sjeff			return;
622219820Sjeff	}
623219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY) {
624219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
625219820Sjeff				"IB_PORT_CAP_HAS_NV_PKEY\n",
626219820Sjeff				&total_len) != IB_SUCCESS)
627219820Sjeff			return;
628219820Sjeff	}
629219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO) {
630219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
631219820Sjeff				"IB_PORT_CAP_HAS_LED_INFO\n",
632219820Sjeff				&total_len) != IB_SUCCESS)
633219820Sjeff			return;
634219820Sjeff	}
635219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_SM_DISAB) {
636219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
637219820Sjeff				"IB_PORT_CAP_SM_DISAB\n",
638219820Sjeff				&total_len) != IB_SUCCESS)
639219820Sjeff			return;
640219820Sjeff	}
641219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID) {
642219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
643219820Sjeff				"IB_PORT_CAP_HAS_SYS_IMG_GUID\n",
644219820Sjeff				&total_len) != IB_SUCCESS)
645219820Sjeff			return;
646219820Sjeff	}
647219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP) {
648219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
649219820Sjeff				"IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n",
650219820Sjeff				&total_len) != IB_SUCCESS)
651219820Sjeff			return;
652219820Sjeff	}
653219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV13) {
654219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
655219820Sjeff				"IB_PORT_CAP_RESV13\n",
656219820Sjeff				&total_len) != IB_SUCCESS)
657219820Sjeff			return;
658219820Sjeff	}
659219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {
660219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
661219820Sjeff				"IB_PORT_CAP_RESV14\n",
662219820Sjeff				&total_len) != IB_SUCCESS)
663219820Sjeff			return;
664219820Sjeff	}
665219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV15) {
666219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
667219820Sjeff				"IB_PORT_CAP_RESV15\n",
668219820Sjeff				&total_len) != IB_SUCCESS)
669219820Sjeff			return;
670219820Sjeff	}
671219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT) {
672219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
673219820Sjeff				"IB_PORT_CAP_HAS_COM_MGT\n",
674219820Sjeff				&total_len) != IB_SUCCESS)
675219820Sjeff			return;
676219820Sjeff	}
677219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP) {
678219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
679219820Sjeff				"IB_PORT_CAP_HAS_SNMP\n",
680219820Sjeff				&total_len) != IB_SUCCESS)
681219820Sjeff			return;
682219820Sjeff	}
683219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_REINIT) {
684219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
685219820Sjeff				"IB_PORT_CAP_REINIT\n",
686219820Sjeff				&total_len) != IB_SUCCESS)
687219820Sjeff			return;
688219820Sjeff	}
689219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT) {
690219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
691219820Sjeff				"IB_PORT_CAP_HAS_DEV_MGT\n",
692219820Sjeff				&total_len) != IB_SUCCESS)
693219820Sjeff			return;
694219820Sjeff	}
695219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS) {
696219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
697219820Sjeff				"IB_PORT_CAP_HAS_VEND_CLS\n",
698219820Sjeff				&total_len) != IB_SUCCESS)
699219820Sjeff			return;
700219820Sjeff	}
701219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC) {
702219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
703219820Sjeff				"IB_PORT_CAP_HAS_DR_NTC\n",
704219820Sjeff				&total_len) != IB_SUCCESS)
705219820Sjeff			return;
706219820Sjeff	}
707219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC) {
708219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
709219820Sjeff				"IB_PORT_CAP_HAS_CAP_NTC\n",
710219820Sjeff				&total_len) != IB_SUCCESS)
711219820Sjeff			return;
712219820Sjeff	}
713219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_BM) {
714219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
715219820Sjeff				"IB_PORT_CAP_HAS_BM\n",
716219820Sjeff				&total_len) != IB_SUCCESS)
717219820Sjeff			return;
718219820Sjeff	}
719219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY) {
720219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
721219820Sjeff				"IB_PORT_CAP_HAS_LINK_RT_LATENCY\n",
722219820Sjeff				&total_len) != IB_SUCCESS)
723219820Sjeff			return;
724219820Sjeff	}
725219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG) {
726219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
727219820Sjeff				"IB_PORT_CAP_HAS_CLIENT_REREG\n",
728219820Sjeff				&total_len) != IB_SUCCESS)
729219820Sjeff			return;
730219820Sjeff	}
731219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC) {
732219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
733219820Sjeff				"IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC\n",
734219820Sjeff				&total_len) != IB_SUCCESS)
735219820Sjeff			return;
736219820Sjeff	}
737219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL) {
738219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
739219820Sjeff				"IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL\n",
740219820Sjeff				&total_len) != IB_SUCCESS)
741219820Sjeff			return;
742219820Sjeff	}
743219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV28) {
744219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
745219820Sjeff				"IB_PORT_CAP_RESV28\n",
746219820Sjeff				&total_len) != IB_SUCCESS)
747219820Sjeff			return;
748219820Sjeff	}
749219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV29) {
750219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
751219820Sjeff				"IB_PORT_CAP_RESV29\n",
752219820Sjeff				&total_len) != IB_SUCCESS)
753219820Sjeff			return;
754219820Sjeff	}
755219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV30) {
756219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
757219820Sjeff				"IB_PORT_CAP_RESV30\n",
758219820Sjeff				&total_len) != IB_SUCCESS)
759219820Sjeff			return;
760219820Sjeff	}
761219820Sjeff	if (p_pi->capability_mask & IB_PORT_CAP_RESV31) {
762219820Sjeff		if (dbg_do_line(&p_local, buf_size, p_prefix_str,
763219820Sjeff				"IB_PORT_CAP_RESV31\n",
764219820Sjeff				&total_len) != IB_SUCCESS)
765219820Sjeff			return;
766219820Sjeff	}
767219820Sjeff}
768219820Sjeff
769219820Sjeff/**********************************************************************
770219820Sjeff **********************************************************************/
771219820Sjeffvoid
772219820Sjeffosm_dump_port_info(IN osm_log_t * const p_log,
773219820Sjeff		   IN const ib_net64_t node_guid,
774219820Sjeff		   IN const ib_net64_t port_guid,
775219820Sjeff		   IN const uint8_t port_num,
776219820Sjeff		   IN const ib_port_info_t * const p_pi,
777219820Sjeff		   IN const osm_log_level_t log_level)
778219820Sjeff{
779219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
780219820Sjeff		char buf[BUF_SIZE];
781219820Sjeff
782219820Sjeff		osm_log(p_log, log_level,
783219820Sjeff			"PortInfo dump:\n"
784219820Sjeff			"\t\t\t\tport number.............%u\n"
785219820Sjeff			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
786219820Sjeff			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
787219820Sjeff			"\t\t\t\tm_key...................0x%016" PRIx64 "\n"
788219820Sjeff			"\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
789219820Sjeff			"\t\t\t\tbase_lid................%u\n"
790219820Sjeff			"\t\t\t\tmaster_sm_base_lid......%u\n"
791219820Sjeff			"\t\t\t\tcapability_mask.........0x%X\n"
792219820Sjeff			"\t\t\t\tdiag_code...............0x%X\n"
793219820Sjeff			"\t\t\t\tm_key_lease_period......0x%X\n"
794219820Sjeff			"\t\t\t\tlocal_port_num..........%u\n"
795219820Sjeff			"\t\t\t\tlink_width_enabled......0x%X\n"
796219820Sjeff			"\t\t\t\tlink_width_supported....0x%X\n"
797219820Sjeff			"\t\t\t\tlink_width_active.......0x%X\n"
798219820Sjeff			"\t\t\t\tlink_speed_supported....0x%X\n"
799219820Sjeff			"\t\t\t\tport_state..............%s\n"
800219820Sjeff			"\t\t\t\tstate_info2.............0x%X\n"
801219820Sjeff			"\t\t\t\tm_key_protect_bits......0x%X\n"
802219820Sjeff			"\t\t\t\tlmc.....................0x%X\n"
803219820Sjeff			"\t\t\t\tlink_speed..............0x%X\n"
804219820Sjeff			"\t\t\t\tmtu_smsl................0x%X\n"
805219820Sjeff			"\t\t\t\tvl_cap_init_type........0x%X\n"
806219820Sjeff			"\t\t\t\tvl_high_limit...........0x%X\n"
807219820Sjeff			"\t\t\t\tvl_arb_high_cap.........0x%X\n"
808219820Sjeff			"\t\t\t\tvl_arb_low_cap..........0x%X\n"
809219820Sjeff			"\t\t\t\tinit_rep_mtu_cap........0x%X\n"
810219820Sjeff			"\t\t\t\tvl_stall_life...........0x%X\n"
811219820Sjeff			"\t\t\t\tvl_enforce..............0x%X\n"
812219820Sjeff			"\t\t\t\tm_key_violations........0x%X\n"
813219820Sjeff			"\t\t\t\tp_key_violations........0x%X\n"
814219820Sjeff			"\t\t\t\tq_key_violations........0x%X\n"
815219820Sjeff			"\t\t\t\tguid_cap................0x%X\n"
816219820Sjeff			"\t\t\t\tclient_reregister.......0x%X\n"
817219820Sjeff			"\t\t\t\tsubnet_timeout..........0x%X\n"
818219820Sjeff			"\t\t\t\tresp_time_value.........0x%X\n"
819219820Sjeff			"\t\t\t\terror_threshold.........0x%X\n",
820219820Sjeff			port_num,
821219820Sjeff			cl_ntoh64(node_guid),
822219820Sjeff			cl_ntoh64(port_guid),
823219820Sjeff			cl_ntoh64(p_pi->m_key),
824219820Sjeff			cl_ntoh64(p_pi->subnet_prefix),
825219820Sjeff			cl_ntoh16(p_pi->base_lid),
826219820Sjeff			cl_ntoh16(p_pi->master_sm_base_lid),
827219820Sjeff			cl_ntoh32(p_pi->capability_mask),
828219820Sjeff			cl_ntoh16(p_pi->diag_code),
829219820Sjeff			cl_ntoh16(p_pi->m_key_lease_period),
830219820Sjeff			p_pi->local_port_num,
831219820Sjeff			p_pi->link_width_enabled,
832219820Sjeff			p_pi->link_width_supported,
833219820Sjeff			p_pi->link_width_active,
834219820Sjeff			ib_port_info_get_link_speed_sup(p_pi),
835219820Sjeff			ib_get_port_state_str(ib_port_info_get_port_state
836219820Sjeff					      (p_pi)), p_pi->state_info2,
837219820Sjeff			ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
838219820Sjeff			p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
839219820Sjeff			p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
840219820Sjeff			p_pi->vl_arb_low_cap, p_pi->mtu_cap,
841219820Sjeff			p_pi->vl_stall_life, p_pi->vl_enforce,
842219820Sjeff			cl_ntoh16(p_pi->m_key_violations),
843219820Sjeff			cl_ntoh16(p_pi->p_key_violations),
844219820Sjeff			cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
845219820Sjeff			ib_port_info_get_client_rereg(p_pi),
846219820Sjeff			ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
847219820Sjeff			p_pi->error_threshold);
848219820Sjeff
849219820Sjeff		/*  show the capabilities mask */
850219820Sjeff		if (p_pi->capability_mask) {
851219820Sjeff			dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
852219820Sjeff						 p_pi);
853219820Sjeff			osm_log(p_log, log_level, "%s", buf);
854219820Sjeff		}
855219820Sjeff	}
856219820Sjeff}
857219820Sjeff
858219820Sjeff/**********************************************************************
859219820Sjeff **********************************************************************/
860219820Sjeffvoid
861219820Sjeffosm_dump_portinfo_record(IN osm_log_t * const p_log,
862219820Sjeff			 IN const ib_portinfo_record_t * const p_pir,
863219820Sjeff			 IN const osm_log_level_t log_level)
864219820Sjeff{
865219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
866219820Sjeff		char buf[BUF_SIZE];
867219820Sjeff		const ib_port_info_t *const p_pi = &p_pir->port_info;
868219820Sjeff
869219820Sjeff		osm_log(p_log, log_level,
870219820Sjeff			"PortInfo Record dump:\n"
871219820Sjeff			"\t\t\t\tRID\n"
872219820Sjeff			"\t\t\t\tEndPortLid..............%u\n"
873219820Sjeff			"\t\t\t\tPortNum.................0x%X\n"
874219820Sjeff			"\t\t\t\tReserved................0x%X\n"
875219820Sjeff			"\t\t\t\tPortInfo dump:\n"
876219820Sjeff			"\t\t\t\tm_key...................0x%016" PRIx64 "\n"
877219820Sjeff			"\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
878219820Sjeff			"\t\t\t\tbase_lid................%u\n"
879219820Sjeff			"\t\t\t\tmaster_sm_base_lid......%u\n"
880219820Sjeff			"\t\t\t\tcapability_mask.........0x%X\n"
881219820Sjeff			"\t\t\t\tdiag_code...............0x%X\n"
882219820Sjeff			"\t\t\t\tm_key_lease_period......0x%X\n"
883219820Sjeff			"\t\t\t\tlocal_port_num..........%u\n"
884219820Sjeff			"\t\t\t\tlink_width_enabled......0x%X\n"
885219820Sjeff			"\t\t\t\tlink_width_supported....0x%X\n"
886219820Sjeff			"\t\t\t\tlink_width_active.......0x%X\n"
887219820Sjeff			"\t\t\t\tlink_speed_supported....0x%X\n"
888219820Sjeff			"\t\t\t\tport_state..............%s\n"
889219820Sjeff			"\t\t\t\tstate_info2.............0x%X\n"
890219820Sjeff			"\t\t\t\tm_key_protect_bits......0x%X\n"
891219820Sjeff			"\t\t\t\tlmc.....................0x%X\n"
892219820Sjeff			"\t\t\t\tlink_speed..............0x%X\n"
893219820Sjeff			"\t\t\t\tmtu_smsl................0x%X\n"
894219820Sjeff			"\t\t\t\tvl_cap_init_type........0x%X\n"
895219820Sjeff			"\t\t\t\tvl_high_limit...........0x%X\n"
896219820Sjeff			"\t\t\t\tvl_arb_high_cap.........0x%X\n"
897219820Sjeff			"\t\t\t\tvl_arb_low_cap..........0x%X\n"
898219820Sjeff			"\t\t\t\tinit_rep_mtu_cap........0x%X\n"
899219820Sjeff			"\t\t\t\tvl_stall_life...........0x%X\n"
900219820Sjeff			"\t\t\t\tvl_enforce..............0x%X\n"
901219820Sjeff			"\t\t\t\tm_key_violations........0x%X\n"
902219820Sjeff			"\t\t\t\tp_key_violations........0x%X\n"
903219820Sjeff			"\t\t\t\tq_key_violations........0x%X\n"
904219820Sjeff			"\t\t\t\tguid_cap................0x%X\n"
905219820Sjeff			"\t\t\t\tsubnet_timeout..........0x%X\n"
906219820Sjeff			"\t\t\t\tresp_time_value.........0x%X\n"
907219820Sjeff			"\t\t\t\terror_threshold.........0x%X\n",
908219820Sjeff			cl_ntoh16(p_pir->lid),
909219820Sjeff			p_pir->port_num,
910219820Sjeff			p_pir->resv,
911219820Sjeff			cl_ntoh64(p_pi->m_key),
912219820Sjeff			cl_ntoh64(p_pi->subnet_prefix),
913219820Sjeff			cl_ntoh16(p_pi->base_lid),
914219820Sjeff			cl_ntoh16(p_pi->master_sm_base_lid),
915219820Sjeff			cl_ntoh32(p_pi->capability_mask),
916219820Sjeff			cl_ntoh16(p_pi->diag_code),
917219820Sjeff			cl_ntoh16(p_pi->m_key_lease_period),
918219820Sjeff			p_pi->local_port_num,
919219820Sjeff			p_pi->link_width_enabled,
920219820Sjeff			p_pi->link_width_supported,
921219820Sjeff			p_pi->link_width_active,
922219820Sjeff			ib_port_info_get_link_speed_sup(p_pi),
923219820Sjeff			ib_get_port_state_str(ib_port_info_get_port_state
924219820Sjeff					      (p_pi)), p_pi->state_info2,
925219820Sjeff			ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
926219820Sjeff			p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
927219820Sjeff			p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
928219820Sjeff			p_pi->vl_arb_low_cap, p_pi->mtu_cap,
929219820Sjeff			p_pi->vl_stall_life, p_pi->vl_enforce,
930219820Sjeff			cl_ntoh16(p_pi->m_key_violations),
931219820Sjeff			cl_ntoh16(p_pi->p_key_violations),
932219820Sjeff			cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
933219820Sjeff			ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
934219820Sjeff			p_pi->error_threshold);
935219820Sjeff
936219820Sjeff		/*  show the capabilities mask */
937219820Sjeff		if (p_pi->capability_mask) {
938219820Sjeff			dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
939219820Sjeff						 p_pi);
940219820Sjeff			osm_log(p_log, log_level, "%s", buf);
941219820Sjeff		}
942219820Sjeff	}
943219820Sjeff}
944219820Sjeff
945219820Sjeff/**********************************************************************
946219820Sjeff **********************************************************************/
947219820Sjeffvoid
948219820Sjeffosm_dump_guidinfo_record(IN osm_log_t * const p_log,
949219820Sjeff			 IN const ib_guidinfo_record_t * const p_gir,
950219820Sjeff			 IN const osm_log_level_t log_level)
951219820Sjeff{
952219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
953219820Sjeff		const ib_guid_info_t *const p_gi = &p_gir->guid_info;
954219820Sjeff
955219820Sjeff		osm_log(p_log, log_level,
956219820Sjeff			"GUIDInfo Record dump:\n"
957219820Sjeff			"\t\t\t\tRID\n"
958219820Sjeff			"\t\t\t\tLid.....................%u\n"
959219820Sjeff			"\t\t\t\tBlockNum................0x%X\n"
960219820Sjeff			"\t\t\t\tReserved................0x%X\n"
961219820Sjeff			"\t\t\t\tGUIDInfo dump:\n"
962219820Sjeff			"\t\t\t\tReserved................0x%X\n"
963219820Sjeff			"\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"
964219820Sjeff			"\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"
965219820Sjeff			"\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"
966219820Sjeff			"\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"
967219820Sjeff			"\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"
968219820Sjeff			"\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
969219820Sjeff			"\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
970219820Sjeff			"\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
971219820Sjeff			cl_ntoh16(p_gir->lid),
972219820Sjeff			p_gir->block_num,
973219820Sjeff			p_gir->resv,
974219820Sjeff			cl_ntoh32(p_gir->reserved),
975219820Sjeff			cl_ntoh64(p_gi->guid[0]),
976219820Sjeff			cl_ntoh64(p_gi->guid[1]),
977219820Sjeff			cl_ntoh64(p_gi->guid[2]),
978219820Sjeff			cl_ntoh64(p_gi->guid[3]),
979219820Sjeff			cl_ntoh64(p_gi->guid[4]),
980219820Sjeff			cl_ntoh64(p_gi->guid[5]),
981219820Sjeff			cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
982219820Sjeff	}
983219820Sjeff}
984219820Sjeff
985219820Sjeff/**********************************************************************
986219820Sjeff **********************************************************************/
987219820Sjeffvoid
988219820Sjeffosm_dump_node_info(IN osm_log_t * const p_log,
989219820Sjeff		   IN const ib_node_info_t * const p_ni,
990219820Sjeff		   IN const osm_log_level_t log_level)
991219820Sjeff{
992219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
993219820Sjeff		osm_log(p_log, log_level,
994219820Sjeff			"NodeInfo dump:\n"
995219820Sjeff			"\t\t\t\tbase_version............0x%X\n"
996219820Sjeff			"\t\t\t\tclass_version...........0x%X\n"
997219820Sjeff			"\t\t\t\tnode_type...............%s\n"
998219820Sjeff			"\t\t\t\tnum_ports...............%u\n"
999219820Sjeff			"\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1000219820Sjeff			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1001219820Sjeff			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1002219820Sjeff			"\t\t\t\tpartition_cap...........0x%X\n"
1003219820Sjeff			"\t\t\t\tdevice_id...............0x%X\n"
1004219820Sjeff			"\t\t\t\trevision................0x%X\n"
1005219820Sjeff			"\t\t\t\tport_num................%u\n"
1006219820Sjeff			"\t\t\t\tvendor_id...............0x%X\n",
1007219820Sjeff			p_ni->base_version,
1008219820Sjeff			p_ni->class_version,
1009219820Sjeff			ib_get_node_type_str(p_ni->node_type),
1010219820Sjeff			p_ni->num_ports,
1011219820Sjeff			cl_ntoh64(p_ni->sys_guid),
1012219820Sjeff			cl_ntoh64(p_ni->node_guid),
1013219820Sjeff			cl_ntoh64(p_ni->port_guid),
1014219820Sjeff			cl_ntoh16(p_ni->partition_cap),
1015219820Sjeff			cl_ntoh16(p_ni->device_id),
1016219820Sjeff			cl_ntoh32(p_ni->revision),
1017219820Sjeff			ib_node_info_get_local_port_num(p_ni),
1018219820Sjeff			cl_ntoh32(ib_node_info_get_vendor_id(p_ni)));
1019219820Sjeff	}
1020219820Sjeff}
1021219820Sjeff
1022219820Sjeff/**********************************************************************
1023219820Sjeff **********************************************************************/
1024219820Sjeffvoid
1025219820Sjeffosm_dump_node_record(IN osm_log_t * const p_log,
1026219820Sjeff		     IN const ib_node_record_t * const p_nr,
1027219820Sjeff		     IN const osm_log_level_t log_level)
1028219820Sjeff{
1029219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1030219820Sjeff		char desc[sizeof(p_nr->node_desc.description) + 1];
1031219820Sjeff		const ib_node_info_t *const p_ni = &p_nr->node_info;
1032219820Sjeff
1033219820Sjeff		memcpy(desc, p_nr->node_desc.description,
1034219820Sjeff		       sizeof(p_nr->node_desc.description));
1035219820Sjeff		desc[sizeof(desc) - 1] = '\0';
1036219820Sjeff		osm_log(p_log, log_level,
1037219820Sjeff			"Node Record dump:\n"
1038219820Sjeff			"\t\t\t\tRID\n"
1039219820Sjeff			"\t\t\t\tLid.....................%u\n"
1040219820Sjeff			"\t\t\t\tReserved................0x%X\n"
1041219820Sjeff			"\t\t\t\tNodeInfo dump:\n"
1042219820Sjeff			"\t\t\t\tbase_version............0x%X\n"
1043219820Sjeff			"\t\t\t\tclass_version...........0x%X\n"
1044219820Sjeff			"\t\t\t\tnode_type...............%s\n"
1045219820Sjeff			"\t\t\t\tnum_ports...............%u\n"
1046219820Sjeff			"\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1047219820Sjeff			"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1048219820Sjeff			"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1049219820Sjeff			"\t\t\t\tpartition_cap...........0x%X\n"
1050219820Sjeff			"\t\t\t\tdevice_id...............0x%X\n"
1051219820Sjeff			"\t\t\t\trevision................0x%X\n"
1052219820Sjeff			"\t\t\t\tport_num................%u\n"
1053219820Sjeff			"\t\t\t\tvendor_id...............0x%X\n"
1054219820Sjeff			"\t\t\t\tNodeDescription\n"
1055219820Sjeff			"\t\t\t\t%s\n",
1056219820Sjeff			cl_ntoh16(p_nr->lid),
1057219820Sjeff			cl_ntoh16(p_nr->resv),
1058219820Sjeff			p_ni->base_version,
1059219820Sjeff			p_ni->class_version,
1060219820Sjeff			ib_get_node_type_str(p_ni->node_type),
1061219820Sjeff			p_ni->num_ports,
1062219820Sjeff			cl_ntoh64(p_ni->sys_guid),
1063219820Sjeff			cl_ntoh64(p_ni->node_guid),
1064219820Sjeff			cl_ntoh64(p_ni->port_guid),
1065219820Sjeff			cl_ntoh16(p_ni->partition_cap),
1066219820Sjeff			cl_ntoh16(p_ni->device_id),
1067219820Sjeff			cl_ntoh32(p_ni->revision),
1068219820Sjeff			ib_node_info_get_local_port_num(p_ni),
1069219820Sjeff			cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), desc);
1070219820Sjeff	}
1071219820Sjeff}
1072219820Sjeff
1073219820Sjeff/**********************************************************************
1074219820Sjeff **********************************************************************/
1075219820Sjeffvoid
1076219820Sjeffosm_dump_path_record(IN osm_log_t * const p_log,
1077219820Sjeff		     IN const ib_path_rec_t * const p_pr,
1078219820Sjeff		     IN const osm_log_level_t log_level)
1079219820Sjeff{
1080219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1081219820Sjeff		osm_log(p_log, log_level,
1082219820Sjeff			"PathRecord dump:\n"
1083219820Sjeff			"\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1084219820Sjeff			"\t\t\t\tdgid....................0x%016" PRIx64 " : "
1085219820Sjeff			"0x%016" PRIx64 "\n"
1086219820Sjeff			"\t\t\t\tsgid....................0x%016" PRIx64 " : "
1087219820Sjeff			"0x%016" PRIx64 "\n"
1088219820Sjeff			"\t\t\t\tdlid....................%u\n"
1089219820Sjeff			"\t\t\t\tslid....................%u\n"
1090219820Sjeff			"\t\t\t\thop_flow_raw............0x%X\n"
1091219820Sjeff			"\t\t\t\ttclass..................0x%X\n"
1092219820Sjeff			"\t\t\t\tnum_path_revers.........0x%X\n"
1093219820Sjeff			"\t\t\t\tpkey....................0x%X\n"
1094219820Sjeff			"\t\t\t\tqos_class...............0x%X\n"
1095219820Sjeff			"\t\t\t\tsl......................0x%X\n"
1096219820Sjeff			"\t\t\t\tmtu.....................0x%X\n"
1097219820Sjeff			"\t\t\t\trate....................0x%X\n"
1098219820Sjeff			"\t\t\t\tpkt_life................0x%X\n"
1099219820Sjeff			"\t\t\t\tpreference..............0x%X\n"
1100219820Sjeff			"\t\t\t\tresv2...................0x%X\n"
1101219820Sjeff			"\t\t\t\tresv3...................0x%X\n",
1102219820Sjeff			cl_ntoh64(p_pr->service_id),
1103219820Sjeff			cl_ntoh64(p_pr->dgid.unicast.prefix),
1104219820Sjeff			cl_ntoh64(p_pr->dgid.unicast.interface_id),
1105219820Sjeff			cl_ntoh64(p_pr->sgid.unicast.prefix),
1106219820Sjeff			cl_ntoh64(p_pr->sgid.unicast.interface_id),
1107219820Sjeff			cl_ntoh16(p_pr->dlid),
1108219820Sjeff			cl_ntoh16(p_pr->slid),
1109219820Sjeff			cl_ntoh32(p_pr->hop_flow_raw),
1110219820Sjeff			p_pr->tclass,
1111219820Sjeff			p_pr->num_path,
1112219820Sjeff			cl_ntoh16(p_pr->pkey),
1113219820Sjeff			ib_path_rec_qos_class(p_pr),
1114219820Sjeff			ib_path_rec_sl(p_pr),
1115219820Sjeff			p_pr->mtu,
1116219820Sjeff			p_pr->rate,
1117219820Sjeff			p_pr->pkt_life,
1118219820Sjeff			p_pr->preference,
1119219820Sjeff			*(uint32_t *) & p_pr->resv2,
1120219820Sjeff			*((uint16_t *) & p_pr->resv2 + 2));
1121219820Sjeff	}
1122219820Sjeff}
1123219820Sjeff
1124219820Sjeff/**********************************************************************
1125219820Sjeff **********************************************************************/
1126219820Sjeffvoid
1127219820Sjeffosm_dump_multipath_record(IN osm_log_t * const p_log,
1128219820Sjeff			  IN const ib_multipath_rec_t * const p_mpr,
1129219820Sjeff			  IN const osm_log_level_t log_level)
1130219820Sjeff{
1131219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1132219820Sjeff		char buf_line[1024];
1133219820Sjeff		ib_gid_t const *p_gid = p_mpr->gids;
1134219820Sjeff		int i, n = 0;
1135219820Sjeff
1136219820Sjeff		if (p_mpr->sgid_count) {
1137219820Sjeff			for (i = 0; i < p_mpr->sgid_count; i++) {
1138219820Sjeff				n += sprintf(buf_line + n,
1139219820Sjeff					     "\t\t\t\tsgid%02d.................."
1140219820Sjeff					     "0x%016" PRIx64 " : 0x%016" PRIx64
1141219820Sjeff					     "\n", i + 1,
1142219820Sjeff					     cl_ntoh64(p_gid->unicast.prefix),
1143219820Sjeff					     cl_ntoh64(p_gid->unicast.
1144219820Sjeff						       interface_id));
1145219820Sjeff				p_gid++;
1146219820Sjeff			}
1147219820Sjeff		}
1148219820Sjeff		if (p_mpr->dgid_count) {
1149219820Sjeff			for (i = 0; i < p_mpr->dgid_count; i++) {
1150219820Sjeff				n += sprintf(buf_line + n,
1151219820Sjeff					     "\t\t\t\tdgid%02d.................."
1152219820Sjeff					     "0x%016" PRIx64 " : 0x%016" PRIx64
1153219820Sjeff					     "\n", i + 1,
1154219820Sjeff					     cl_ntoh64(p_gid->unicast.prefix),
1155219820Sjeff					     cl_ntoh64(p_gid->unicast.
1156219820Sjeff						       interface_id));
1157219820Sjeff				p_gid++;
1158219820Sjeff			}
1159219820Sjeff		}
1160219820Sjeff		osm_log(p_log, log_level,
1161219820Sjeff			"MultiPath Record dump:\n"
1162219820Sjeff			"\t\t\t\thop_flow_raw............0x%X\n"
1163219820Sjeff			"\t\t\t\ttclass..................0x%X\n"
1164219820Sjeff			"\t\t\t\tnum_path_revers.........0x%X\n"
1165219820Sjeff			"\t\t\t\tpkey....................0x%X\n"
1166219820Sjeff			"\t\t\t\tqos_class...............0x%X\n"
1167219820Sjeff			"\t\t\t\tsl......................0x%X\n"
1168219820Sjeff			"\t\t\t\tmtu.....................0x%X\n"
1169219820Sjeff			"\t\t\t\trate....................0x%X\n"
1170219820Sjeff			"\t\t\t\tpkt_life................0x%X\n"
1171219820Sjeff			"\t\t\t\tindependence............0x%X\n"
1172219820Sjeff			"\t\t\t\tsgid_count..............0x%X\n"
1173219820Sjeff			"\t\t\t\tdgid_count..............0x%X\n"
1174219820Sjeff			"\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1175219820Sjeff			"%s\n",
1176219820Sjeff			cl_ntoh32(p_mpr->hop_flow_raw),
1177219820Sjeff			p_mpr->tclass,
1178219820Sjeff			p_mpr->num_path,
1179219820Sjeff			cl_ntoh16(p_mpr->pkey),
1180219820Sjeff			ib_multipath_rec_qos_class(p_mpr),
1181219820Sjeff			ib_multipath_rec_sl(p_mpr),
1182219820Sjeff			p_mpr->mtu,
1183219820Sjeff			p_mpr->rate,
1184219820Sjeff			p_mpr->pkt_life,
1185219820Sjeff			p_mpr->independence,
1186219820Sjeff			p_mpr->sgid_count, p_mpr->dgid_count,
1187219820Sjeff			cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),
1188219820Sjeff			buf_line);
1189219820Sjeff	}
1190219820Sjeff}
1191219820Sjeff
1192219820Sjeff/**********************************************************************
1193219820Sjeff **********************************************************************/
1194219820Sjeffvoid
1195219820Sjeffosm_dump_mc_record(IN osm_log_t * const p_log,
1196219820Sjeff		   IN const ib_member_rec_t * const p_mcmr,
1197219820Sjeff		   IN const osm_log_level_t log_level)
1198219820Sjeff{
1199219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1200219820Sjeff		char gid_str[INET6_ADDRSTRLEN];
1201219820Sjeff		char gid_str2[INET6_ADDRSTRLEN];
1202219820Sjeff		osm_log(p_log, log_level,
1203219820Sjeff			"MCMember Record dump:\n"
1204219820Sjeff			"\t\t\t\tMGID....................%s\n"
1205219820Sjeff			"\t\t\t\tPortGid.................%s\n"
1206219820Sjeff			"\t\t\t\tqkey....................0x%X\n"
1207219820Sjeff			"\t\t\t\tmlid....................0x%X\n"
1208219820Sjeff			"\t\t\t\tmtu.....................0x%X\n"
1209219820Sjeff			"\t\t\t\tTClass..................0x%X\n"
1210219820Sjeff			"\t\t\t\tpkey....................0x%X\n"
1211219820Sjeff			"\t\t\t\trate....................0x%X\n"
1212219820Sjeff			"\t\t\t\tpkt_life................0x%X\n"
1213219820Sjeff			"\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"
1214219820Sjeff			"\t\t\t\tScopeState..............0x%X\n"
1215219820Sjeff			"\t\t\t\tProxyJoin...............0x%X\n",
1216219820Sjeff			inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str,
1217219820Sjeff				sizeof gid_str),
1218219820Sjeff			inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2,
1219219820Sjeff				sizeof gid_str2),
1220219820Sjeff			cl_ntoh32(p_mcmr->qkey),
1221219820Sjeff			cl_ntoh16(p_mcmr->mlid),
1222219820Sjeff			p_mcmr->mtu,
1223219820Sjeff			p_mcmr->tclass,
1224219820Sjeff			cl_ntoh16(p_mcmr->pkey),
1225219820Sjeff			p_mcmr->rate,
1226219820Sjeff			p_mcmr->pkt_life,
1227219820Sjeff			cl_ntoh32(p_mcmr->sl_flow_hop),
1228219820Sjeff			p_mcmr->scope_state, p_mcmr->proxy_join);
1229219820Sjeff	}
1230219820Sjeff}
1231219820Sjeff
1232219820Sjeff/**********************************************************************
1233219820Sjeff **********************************************************************/
1234219820Sjeffvoid
1235219820Sjeffosm_dump_service_record(IN osm_log_t * const p_log,
1236219820Sjeff			IN const ib_service_record_t * const p_sr,
1237219820Sjeff			IN const osm_log_level_t log_level)
1238219820Sjeff{
1239219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1240219820Sjeff		char gid_str[INET6_ADDRSTRLEN];
1241219820Sjeff		char buf_service_key[35];
1242219820Sjeff		char buf_service_name[65];
1243219820Sjeff
1244219820Sjeff		sprintf(buf_service_key,
1245219820Sjeff			"0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
1246219820Sjeff			p_sr->service_key[0],
1247219820Sjeff			p_sr->service_key[1],
1248219820Sjeff			p_sr->service_key[2],
1249219820Sjeff			p_sr->service_key[3],
1250219820Sjeff			p_sr->service_key[4],
1251219820Sjeff			p_sr->service_key[5],
1252219820Sjeff			p_sr->service_key[6],
1253219820Sjeff			p_sr->service_key[7],
1254219820Sjeff			p_sr->service_key[8],
1255219820Sjeff			p_sr->service_key[9],
1256219820Sjeff			p_sr->service_key[10],
1257219820Sjeff			p_sr->service_key[11],
1258219820Sjeff			p_sr->service_key[12],
1259219820Sjeff			p_sr->service_key[13],
1260219820Sjeff			p_sr->service_key[14], p_sr->service_key[15]);
1261219820Sjeff		strncpy(buf_service_name, (char *)p_sr->service_name, 64);
1262219820Sjeff		buf_service_name[64] = '\0';
1263219820Sjeff
1264219820Sjeff		osm_log(p_log, log_level,
1265219820Sjeff			"Service Record dump:\n"
1266219820Sjeff			"\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
1267219820Sjeff			"\t\t\t\tServiceGID..............%s\n"
1268219820Sjeff			"\t\t\t\tServiceP_Key............0x%X\n"
1269219820Sjeff			"\t\t\t\tServiceLease............0x%X\n"
1270219820Sjeff			"\t\t\t\tServiceKey..............%s\n"
1271219820Sjeff			"\t\t\t\tServiceName.............%s\n"
1272219820Sjeff			"\t\t\t\tServiceData8.1..........0x%X\n"
1273219820Sjeff			"\t\t\t\tServiceData8.2..........0x%X\n"
1274219820Sjeff			"\t\t\t\tServiceData8.3..........0x%X\n"
1275219820Sjeff			"\t\t\t\tServiceData8.4..........0x%X\n"
1276219820Sjeff			"\t\t\t\tServiceData8.5..........0x%X\n"
1277219820Sjeff			"\t\t\t\tServiceData8.6..........0x%X\n"
1278219820Sjeff			"\t\t\t\tServiceData8.7..........0x%X\n"
1279219820Sjeff			"\t\t\t\tServiceData8.8..........0x%X\n"
1280219820Sjeff			"\t\t\t\tServiceData8.9..........0x%X\n"
1281219820Sjeff			"\t\t\t\tServiceData8.10.........0x%X\n"
1282219820Sjeff			"\t\t\t\tServiceData8.11.........0x%X\n"
1283219820Sjeff			"\t\t\t\tServiceData8.12.........0x%X\n"
1284219820Sjeff			"\t\t\t\tServiceData8.13.........0x%X\n"
1285219820Sjeff			"\t\t\t\tServiceData8.14.........0x%X\n"
1286219820Sjeff			"\t\t\t\tServiceData8.15.........0x%X\n"
1287219820Sjeff			"\t\t\t\tServiceData8.16.........0x%X\n"
1288219820Sjeff			"\t\t\t\tServiceData16.1.........0x%X\n"
1289219820Sjeff			"\t\t\t\tServiceData16.2.........0x%X\n"
1290219820Sjeff			"\t\t\t\tServiceData16.3.........0x%X\n"
1291219820Sjeff			"\t\t\t\tServiceData16.4.........0x%X\n"
1292219820Sjeff			"\t\t\t\tServiceData16.5.........0x%X\n"
1293219820Sjeff			"\t\t\t\tServiceData16.6.........0x%X\n"
1294219820Sjeff			"\t\t\t\tServiceData16.7.........0x%X\n"
1295219820Sjeff			"\t\t\t\tServiceData16.8.........0x%X\n"
1296219820Sjeff			"\t\t\t\tServiceData32.1.........0x%X\n"
1297219820Sjeff			"\t\t\t\tServiceData32.2.........0x%X\n"
1298219820Sjeff			"\t\t\t\tServiceData32.3.........0x%X\n"
1299219820Sjeff			"\t\t\t\tServiceData32.4.........0x%X\n"
1300219820Sjeff			"\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"
1301219820Sjeff			"\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n",
1302219820Sjeff			cl_ntoh64(p_sr->service_id),
1303219820Sjeff			inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str,
1304219820Sjeff				sizeof gid_str),
1305219820Sjeff			cl_ntoh16(p_sr->service_pkey),
1306219820Sjeff			cl_ntoh32(p_sr->service_lease),
1307219820Sjeff			buf_service_key,
1308219820Sjeff			buf_service_name,
1309219820Sjeff			p_sr->service_data8[0], p_sr->service_data8[1],
1310219820Sjeff			p_sr->service_data8[2], p_sr->service_data8[3],
1311219820Sjeff			p_sr->service_data8[4], p_sr->service_data8[5],
1312219820Sjeff			p_sr->service_data8[6], p_sr->service_data8[7],
1313219820Sjeff			p_sr->service_data8[8], p_sr->service_data8[9],
1314219820Sjeff			p_sr->service_data8[10], p_sr->service_data8[11],
1315219820Sjeff			p_sr->service_data8[12], p_sr->service_data8[13],
1316219820Sjeff			p_sr->service_data8[14], p_sr->service_data8[15],
1317219820Sjeff			cl_ntoh16(p_sr->service_data16[0]),
1318219820Sjeff			cl_ntoh16(p_sr->service_data16[1]),
1319219820Sjeff			cl_ntoh16(p_sr->service_data16[2]),
1320219820Sjeff			cl_ntoh16(p_sr->service_data16[3]),
1321219820Sjeff			cl_ntoh16(p_sr->service_data16[4]),
1322219820Sjeff			cl_ntoh16(p_sr->service_data16[5]),
1323219820Sjeff			cl_ntoh16(p_sr->service_data16[6]),
1324219820Sjeff			cl_ntoh16(p_sr->service_data16[7]),
1325219820Sjeff			cl_ntoh32(p_sr->service_data32[0]),
1326219820Sjeff			cl_ntoh32(p_sr->service_data32[1]),
1327219820Sjeff			cl_ntoh32(p_sr->service_data32[2]),
1328219820Sjeff			cl_ntoh32(p_sr->service_data32[3]),
1329219820Sjeff			cl_ntoh64(p_sr->service_data64[0]),
1330219820Sjeff			cl_ntoh64(p_sr->service_data64[1]));
1331219820Sjeff	}
1332219820Sjeff}
1333219820Sjeff
1334219820Sjeff/**********************************************************************
1335219820Sjeff **********************************************************************/
1336219820Sjeffvoid
1337219820Sjeffosm_dump_inform_info(IN osm_log_t * const p_log,
1338219820Sjeff		     IN const ib_inform_info_t * const p_ii,
1339219820Sjeff		     IN const osm_log_level_t log_level)
1340219820Sjeff{
1341219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1342219820Sjeff		uint32_t qpn;
1343219820Sjeff		uint8_t resp_time_val;
1344219820Sjeff
1345219820Sjeff		ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
1346219820Sjeff						 qpn_resp_time_val, &qpn,
1347219820Sjeff						 &resp_time_val);
1348219820Sjeff		if (p_ii->is_generic) {
1349219820Sjeff			osm_log(p_log, log_level,
1350219820Sjeff				"InformInfo dump:\n"
1351219820Sjeff				"\t\t\t\tgid.....................0x%016" PRIx64
1352219820Sjeff				" : 0x%016" PRIx64 "\n"
1353219820Sjeff				"\t\t\t\tlid_range_begin.........%u\n"
1354219820Sjeff				"\t\t\t\tlid_range_end...........%u\n"
1355219820Sjeff				"\t\t\t\tis_generic..............0x%X\n"
1356219820Sjeff				"\t\t\t\tsubscribe...............0x%X\n"
1357219820Sjeff				"\t\t\t\ttrap_type...............0x%X\n"
1358219820Sjeff				"\t\t\t\ttrap_num................%u\n"
1359219820Sjeff				"\t\t\t\tqpn.....................0x%06X\n"
1360219820Sjeff				"\t\t\t\tresp_time_val...........0x%X\n"
1361219820Sjeff				"\t\t\t\tnode_type...............0x%06X\n" "",
1362219820Sjeff				cl_ntoh64(p_ii->gid.unicast.prefix),
1363219820Sjeff				cl_ntoh64(p_ii->gid.unicast.interface_id),
1364219820Sjeff				cl_ntoh16(p_ii->lid_range_begin),
1365219820Sjeff				cl_ntoh16(p_ii->lid_range_end),
1366219820Sjeff				p_ii->is_generic, p_ii->subscribe,
1367219820Sjeff				cl_ntoh16(p_ii->trap_type),
1368219820Sjeff				cl_ntoh16(p_ii->g_or_v.generic.trap_num),
1369219820Sjeff				cl_ntoh32(qpn), resp_time_val,
1370219820Sjeff				cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1371219820Sjeff		} else {
1372219820Sjeff			osm_log(p_log, log_level,
1373219820Sjeff				"InformInfo dump:\n"
1374219820Sjeff				"\t\t\t\tgid.....................0x%016" PRIx64
1375219820Sjeff				" : 0x%016" PRIx64 "\n"
1376219820Sjeff				"\t\t\t\tlid_range_begin.........%u\n"
1377219820Sjeff				"\t\t\t\tlid_range_end...........%u\n"
1378219820Sjeff				"\t\t\t\tis_generic..............0x%X\n"
1379219820Sjeff				"\t\t\t\tsubscribe...............0x%X\n"
1380219820Sjeff				"\t\t\t\ttrap_type...............0x%X\n"
1381219820Sjeff				"\t\t\t\tdev_id..................0x%X\n"
1382219820Sjeff				"\t\t\t\tqpn.....................0x%06X\n"
1383219820Sjeff				"\t\t\t\tresp_time_val...........0x%X\n"
1384219820Sjeff				"\t\t\t\tvendor_id...............0x%06X\n" "",
1385219820Sjeff				cl_ntoh64(p_ii->gid.unicast.prefix),
1386219820Sjeff				cl_ntoh64(p_ii->gid.unicast.interface_id),
1387219820Sjeff				cl_ntoh16(p_ii->lid_range_begin),
1388219820Sjeff				cl_ntoh16(p_ii->lid_range_end),
1389219820Sjeff				p_ii->is_generic, p_ii->subscribe,
1390219820Sjeff				cl_ntoh16(p_ii->trap_type),
1391219820Sjeff				cl_ntoh16(p_ii->g_or_v.vend.dev_id),
1392219820Sjeff				cl_ntoh32(qpn), resp_time_val,
1393219820Sjeff				cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1394219820Sjeff		}
1395219820Sjeff	}
1396219820Sjeff}
1397219820Sjeff
1398219820Sjeff/**********************************************************************
1399219820Sjeff **********************************************************************/
1400219820Sjeffvoid
1401219820Sjeffosm_dump_inform_info_record(IN osm_log_t * const p_log,
1402219820Sjeff			    IN const ib_inform_info_record_t * const p_iir,
1403219820Sjeff			    IN const osm_log_level_t log_level)
1404219820Sjeff{
1405219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1406219820Sjeff		char gid_str[INET6_ADDRSTRLEN];
1407219820Sjeff		char gid_str2[INET6_ADDRSTRLEN];
1408219820Sjeff		uint32_t qpn;
1409219820Sjeff		uint8_t resp_time_val;
1410219820Sjeff
1411219820Sjeff		ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
1412219820Sjeff						 generic.qpn_resp_time_val,
1413219820Sjeff						 &qpn, &resp_time_val);
1414219820Sjeff		if (p_iir->inform_info.is_generic) {
1415219820Sjeff			osm_log(p_log, log_level,
1416219820Sjeff				"InformInfo Record dump:\n"
1417219820Sjeff				"\t\t\t\tRID\n"
1418219820Sjeff				"\t\t\t\tSubscriberGID...........%s\n"
1419219820Sjeff				"\t\t\t\tSubscriberEnum..........0x%X\n"
1420219820Sjeff				"\t\t\t\tInformInfo dump:\n"
1421219820Sjeff				"\t\t\t\tgid.....................%s\n"
1422219820Sjeff				"\t\t\t\tlid_range_begin.........%u\n"
1423219820Sjeff				"\t\t\t\tlid_range_end...........%u\n"
1424219820Sjeff				"\t\t\t\tis_generic..............0x%X\n"
1425219820Sjeff				"\t\t\t\tsubscribe...............0x%X\n"
1426219820Sjeff				"\t\t\t\ttrap_type...............0x%X\n"
1427219820Sjeff				"\t\t\t\ttrap_num................%u\n"
1428219820Sjeff				"\t\t\t\tqpn.....................0x%06X\n"
1429219820Sjeff				"\t\t\t\tresp_time_val...........0x%X\n"
1430219820Sjeff				"\t\t\t\tnode_type...............0x%06X\n" "",
1431219820Sjeff				inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1432219820Sjeff					gid_str, sizeof gid_str),
1433219820Sjeff				cl_ntoh16(p_iir->subscriber_enum),
1434219820Sjeff				inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1435219820Sjeff					gid_str2, sizeof gid_str2),
1436219820Sjeff				cl_ntoh16(p_iir->inform_info.lid_range_begin),
1437219820Sjeff				cl_ntoh16(p_iir->inform_info.lid_range_end),
1438219820Sjeff				p_iir->inform_info.is_generic,
1439219820Sjeff				p_iir->inform_info.subscribe,
1440219820Sjeff				cl_ntoh16(p_iir->inform_info.trap_type),
1441219820Sjeff				cl_ntoh16(p_iir->inform_info.g_or_v.generic.
1442219820Sjeff					  trap_num), cl_ntoh32(qpn),
1443219820Sjeff				resp_time_val,
1444219820Sjeff				cl_ntoh32(ib_inform_info_get_prod_type
1445219820Sjeff					  (&p_iir->inform_info)));
1446219820Sjeff		} else {
1447219820Sjeff			osm_log(p_log, log_level,
1448219820Sjeff				"InformInfo Record dump:\n"
1449219820Sjeff				"\t\t\t\tRID\n"
1450219820Sjeff				"\t\t\t\tSubscriberGID...........%s\n"
1451219820Sjeff				"\t\t\t\tSubscriberEnum..........0x%X\n"
1452219820Sjeff				"\t\t\t\tInformInfo dump:\n"
1453219820Sjeff				"\t\t\t\tgid.....................%s\n"
1454219820Sjeff				"\t\t\t\tlid_range_begin.........%u\n"
1455219820Sjeff				"\t\t\t\tlid_range_end...........%u\n"
1456219820Sjeff				"\t\t\t\tis_generic..............0x%X\n"
1457219820Sjeff				"\t\t\t\tsubscribe...............0x%X\n"
1458219820Sjeff				"\t\t\t\ttrap_type...............0x%X\n"
1459219820Sjeff				"\t\t\t\tdev_id..................0x%X\n"
1460219820Sjeff				"\t\t\t\tqpn.....................0x%06X\n"
1461219820Sjeff				"\t\t\t\tresp_time_val...........0x%X\n"
1462219820Sjeff				"\t\t\t\tvendor_id...............0x%06X\n" "",
1463219820Sjeff				inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1464219820Sjeff					gid_str, sizeof gid_str),
1465219820Sjeff				cl_ntoh16(p_iir->subscriber_enum),
1466219820Sjeff				inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1467219820Sjeff					gid_str2, sizeof gid_str2),
1468219820Sjeff				cl_ntoh16(p_iir->inform_info.lid_range_begin),
1469219820Sjeff				cl_ntoh16(p_iir->inform_info.lid_range_end),
1470219820Sjeff				p_iir->inform_info.is_generic,
1471219820Sjeff				p_iir->inform_info.subscribe,
1472219820Sjeff				cl_ntoh16(p_iir->inform_info.trap_type),
1473219820Sjeff				cl_ntoh16(p_iir->inform_info.g_or_v.vend.
1474219820Sjeff					  dev_id), cl_ntoh32(qpn),
1475219820Sjeff				resp_time_val,
1476219820Sjeff				cl_ntoh32(ib_inform_info_get_prod_type
1477219820Sjeff					  (&p_iir->inform_info)));
1478219820Sjeff		}
1479219820Sjeff	}
1480219820Sjeff}
1481219820Sjeff
1482219820Sjeff/**********************************************************************
1483219820Sjeff **********************************************************************/
1484219820Sjeffvoid
1485219820Sjeffosm_dump_link_record(IN osm_log_t * const p_log,
1486219820Sjeff		     IN const ib_link_record_t * const p_lr,
1487219820Sjeff		     IN const osm_log_level_t log_level)
1488219820Sjeff{
1489219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1490219820Sjeff		osm_log(p_log, log_level,
1491219820Sjeff			"Link Record dump:\n"
1492219820Sjeff			"\t\t\t\tfrom_lid................%u\n"
1493219820Sjeff			"\t\t\t\tfrom_port_num...........%u\n"
1494219820Sjeff			"\t\t\t\tto_port_num.............%u\n"
1495219820Sjeff			"\t\t\t\tto_lid..................%u\n",
1496219820Sjeff			cl_ntoh16(p_lr->from_lid),
1497219820Sjeff			p_lr->from_port_num,
1498219820Sjeff			p_lr->to_port_num, cl_ntoh16(p_lr->to_lid));
1499219820Sjeff	}
1500219820Sjeff}
1501219820Sjeff
1502219820Sjeff/**********************************************************************
1503219820Sjeff **********************************************************************/
1504219820Sjeffvoid
1505219820Sjeffosm_dump_switch_info(IN osm_log_t * const p_log,
1506219820Sjeff		     IN const ib_switch_info_t * const p_si,
1507219820Sjeff		     IN const osm_log_level_t log_level)
1508219820Sjeff{
1509219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1510219820Sjeff		osm_log(p_log, OSM_LOG_VERBOSE,
1511219820Sjeff			"SwitchInfo dump:\n"
1512219820Sjeff			"\t\t\t\tlin_cap.................0x%X\n"
1513219820Sjeff			"\t\t\t\trand_cap................0x%X\n"
1514219820Sjeff			"\t\t\t\tmcast_cap...............0x%X\n"
1515219820Sjeff			"\t\t\t\tlin_top.................0x%X\n"
1516219820Sjeff			"\t\t\t\tdef_port................%u\n"
1517219820Sjeff			"\t\t\t\tdef_mcast_pri_port......%u\n"
1518219820Sjeff			"\t\t\t\tdef_mcast_not_port......%u\n"
1519219820Sjeff			"\t\t\t\tlife_state..............0x%X\n"
1520219820Sjeff			"\t\t\t\tlids_per_port...........%u\n"
1521219820Sjeff			"\t\t\t\tpartition_enf_cap.......0x%X\n"
1522219820Sjeff			"\t\t\t\tflags...................0x%X\n",
1523219820Sjeff			cl_ntoh16(p_si->lin_cap),
1524219820Sjeff			cl_ntoh16(p_si->rand_cap),
1525219820Sjeff			cl_ntoh16(p_si->mcast_cap),
1526219820Sjeff			cl_ntoh16(p_si->lin_top),
1527219820Sjeff			p_si->def_port,
1528219820Sjeff			p_si->def_mcast_pri_port,
1529219820Sjeff			p_si->def_mcast_not_port,
1530219820Sjeff			p_si->life_state,
1531219820Sjeff			cl_ntoh16(p_si->lids_per_port),
1532219820Sjeff			cl_ntoh16(p_si->enforce_cap), p_si->flags);
1533219820Sjeff	}
1534219820Sjeff}
1535219820Sjeff
1536219820Sjeff/**********************************************************************
1537219820Sjeff **********************************************************************/
1538219820Sjeffvoid
1539219820Sjeffosm_dump_switch_info_record(IN osm_log_t * const p_log,
1540219820Sjeff			    IN const ib_switch_info_record_t * const p_sir,
1541219820Sjeff			    IN const osm_log_level_t log_level)
1542219820Sjeff{
1543219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1544219820Sjeff		osm_log(p_log, log_level,
1545219820Sjeff			"SwitchInfo Record dump:\n"
1546219820Sjeff			"\t\t\t\tRID\n"
1547219820Sjeff			"\t\t\t\tlid.....................%u\n"
1548219820Sjeff			"\t\t\t\tSwitchInfo dump:\n"
1549219820Sjeff			"\t\t\t\tlin_cap.................0x%X\n"
1550219820Sjeff			"\t\t\t\trand_cap................0x%X\n"
1551219820Sjeff			"\t\t\t\tmcast_cap...............0x%X\n"
1552219820Sjeff			"\t\t\t\tlin_top.................0x%X\n"
1553219820Sjeff			"\t\t\t\tdef_port................%u\n"
1554219820Sjeff			"\t\t\t\tdef_mcast_pri_port......%u\n"
1555219820Sjeff			"\t\t\t\tdef_mcast_not_port......%u\n"
1556219820Sjeff			"\t\t\t\tlife_state..............0x%X\n"
1557219820Sjeff			"\t\t\t\tlids_per_port...........%u\n"
1558219820Sjeff			"\t\t\t\tpartition_enf_cap.......0x%X\n"
1559219820Sjeff			"\t\t\t\tflags...................0x%X\n",
1560219820Sjeff			cl_ntoh16(p_sir->lid),
1561219820Sjeff			cl_ntoh16(p_sir->switch_info.lin_cap),
1562219820Sjeff			cl_ntoh16(p_sir->switch_info.rand_cap),
1563219820Sjeff			cl_ntoh16(p_sir->switch_info.mcast_cap),
1564219820Sjeff			cl_ntoh16(p_sir->switch_info.lin_top),
1565219820Sjeff			p_sir->switch_info.def_port,
1566219820Sjeff			p_sir->switch_info.def_mcast_pri_port,
1567219820Sjeff			p_sir->switch_info.def_mcast_not_port,
1568219820Sjeff			p_sir->switch_info.life_state,
1569219820Sjeff			cl_ntoh16(p_sir->switch_info.lids_per_port),
1570219820Sjeff			cl_ntoh16(p_sir->switch_info.enforce_cap),
1571219820Sjeff			p_sir->switch_info.flags);
1572219820Sjeff	}
1573219820Sjeff}
1574219820Sjeff
1575219820Sjeff/**********************************************************************
1576219820Sjeff **********************************************************************/
1577219820Sjeffvoid
1578219820Sjeffosm_dump_pkey_block(IN osm_log_t * const p_log,
1579219820Sjeff		    IN uint64_t port_guid,
1580219820Sjeff		    IN uint16_t block_num,
1581219820Sjeff		    IN uint8_t port_num,
1582219820Sjeff		    IN const ib_pkey_table_t * const p_pkey_tbl,
1583219820Sjeff		    IN const osm_log_level_t log_level)
1584219820Sjeff{
1585219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1586219820Sjeff		char buf_line[1024];
1587219820Sjeff		int i, n;
1588219820Sjeff
1589219820Sjeff		for (i = 0, n = 0; i < 32; i++)
1590219820Sjeff			n += sprintf(buf_line + n, " 0x%04x |",
1591219820Sjeff				     cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
1592219820Sjeff
1593219820Sjeff		osm_log(p_log, log_level,
1594219820Sjeff			"P_Key table dump:\n"
1595219820Sjeff			"\t\t\tport_guid...........0x%016" PRIx64 "\n"
1596219820Sjeff			"\t\t\tblock_num...........0x%X\n"
1597219820Sjeff			"\t\t\tport_num............%u\n\tP_Key Table: %s\n",
1598219820Sjeff			cl_ntoh64(port_guid), block_num, port_num, buf_line);
1599219820Sjeff	}
1600219820Sjeff}
1601219820Sjeff
1602219820Sjeff/**********************************************************************
1603219820Sjeff **********************************************************************/
1604219820Sjeffvoid
1605219820Sjeffosm_dump_slvl_map_table(IN osm_log_t * const p_log,
1606219820Sjeff			IN uint64_t port_guid,
1607219820Sjeff			IN uint8_t in_port_num,
1608219820Sjeff			IN uint8_t out_port_num,
1609219820Sjeff			IN const ib_slvl_table_t * const p_slvl_tbl,
1610219820Sjeff			IN const osm_log_level_t log_level)
1611219820Sjeff{
1612219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1613219820Sjeff		char buf_line1[1024], buf_line2[1024];
1614219820Sjeff		int n;
1615219820Sjeff		uint8_t i;
1616219820Sjeff
1617219820Sjeff		for (i = 0, n = 0; i < 16; i++)
1618219820Sjeff			n += sprintf(buf_line1 + n, " %-2u |", i);
1619219820Sjeff		for (i = 0, n = 0; i < 16; i++)
1620219820Sjeff			n += sprintf(buf_line2 + n, "0x%01X |",
1621219820Sjeff				     ib_slvl_table_get(p_slvl_tbl, i));
1622219820Sjeff		osm_log(p_log, log_level,
1623219820Sjeff			"SLtoVL dump:\n"
1624219820Sjeff			"\t\t\tport_guid............0x%016" PRIx64 "\n"
1625219820Sjeff			"\t\t\tin_port_num..........%u\n"
1626219820Sjeff			"\t\t\tout_port_num.........%u\n\tSL: | %s\n\tVL: | %s\n",
1627219820Sjeff			cl_ntoh64(port_guid),
1628219820Sjeff			in_port_num, out_port_num, buf_line1, buf_line2);
1629219820Sjeff	}
1630219820Sjeff}
1631219820Sjeff
1632219820Sjeff/**********************************************************************
1633219820Sjeff **********************************************************************/
1634219820Sjeffvoid
1635219820Sjeffosm_dump_vl_arb_table(IN osm_log_t * const p_log,
1636219820Sjeff		      IN uint64_t port_guid,
1637219820Sjeff		      IN uint8_t block_num,
1638219820Sjeff		      IN uint8_t port_num,
1639219820Sjeff		      IN const ib_vl_arb_table_t * const p_vla_tbl,
1640219820Sjeff		      IN const osm_log_level_t log_level)
1641219820Sjeff{
1642219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1643219820Sjeff		char buf_line1[1024], buf_line2[1024];
1644219820Sjeff		int i, n;
1645219820Sjeff
1646219820Sjeff		for (i = 0, n = 0; i < 32; i++)
1647219820Sjeff			n += sprintf(buf_line1 + n, " 0x%01X |",
1648219820Sjeff				     p_vla_tbl->vl_entry[i].vl);
1649219820Sjeff		for (i = 0, n = 0; i < 32; i++)
1650219820Sjeff			n += sprintf(buf_line2 + n, " 0x%01X |",
1651219820Sjeff				     p_vla_tbl->vl_entry[i].weight);
1652219820Sjeff		osm_log(p_log, log_level,
1653219820Sjeff			"VLArb dump:\n" "\t\t\tport_guid...........0x%016"
1654219820Sjeff			PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"
1655219820Sjeff			"\t\t\tport_num............%u\n\tVL    : | %s\n\tWEIGHT:| %s\n",
1656219820Sjeff			cl_ntoh64(port_guid), block_num, port_num, buf_line1,
1657219820Sjeff			buf_line2);
1658219820Sjeff	}
1659219820Sjeff}
1660219820Sjeff
1661219820Sjeff/**********************************************************************
1662219820Sjeff **********************************************************************/
1663219820Sjeffvoid
1664219820Sjeffosm_dump_sm_info(IN osm_log_t * const p_log,
1665219820Sjeff		 IN const ib_sm_info_t * const p_smi,
1666219820Sjeff		 IN const osm_log_level_t log_level)
1667219820Sjeff{
1668219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1669219820Sjeff		osm_log(p_log, OSM_LOG_DEBUG,
1670219820Sjeff			"SMInfo dump:\n"
1671219820Sjeff			"\t\t\t\tguid....................0x%016" PRIx64 "\n"
1672219820Sjeff			"\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1673219820Sjeff			"\t\t\t\tact_count...............%u\n"
1674219820Sjeff			"\t\t\t\tpriority................%u\n"
1675219820Sjeff			"\t\t\t\tsm_state................%u\n",
1676219820Sjeff			cl_ntoh64(p_smi->guid),
1677219820Sjeff			cl_ntoh64(p_smi->sm_key),
1678219820Sjeff			cl_ntoh32(p_smi->act_count),
1679219820Sjeff			ib_sminfo_get_priority(p_smi),
1680219820Sjeff			ib_sminfo_get_state(p_smi));
1681219820Sjeff	}
1682219820Sjeff}
1683219820Sjeff
1684219820Sjeff/**********************************************************************
1685219820Sjeff **********************************************************************/
1686219820Sjeffvoid
1687219820Sjeffosm_dump_sm_info_record(IN osm_log_t * const p_log,
1688219820Sjeff			IN const ib_sminfo_record_t * const p_smir,
1689219820Sjeff			IN const osm_log_level_t log_level)
1690219820Sjeff{
1691219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1692219820Sjeff		osm_log(p_log, OSM_LOG_DEBUG,
1693219820Sjeff			"SMInfo Record dump:\n"
1694219820Sjeff			"\t\t\t\tRID\n"
1695219820Sjeff			"\t\t\t\tLid.....................%u\n"
1696219820Sjeff			"\t\t\t\tReserved................0x%X\n"
1697219820Sjeff			"\t\t\t\tSMInfo dump:\n"
1698219820Sjeff			"\t\t\t\tguid....................0x%016" PRIx64 "\n"
1699219820Sjeff			"\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1700219820Sjeff			"\t\t\t\tact_count...............%u\n"
1701219820Sjeff			"\t\t\t\tpriority................%u\n"
1702219820Sjeff			"\t\t\t\tsm_state................%u\n",
1703219820Sjeff			cl_ntoh16(p_smir->lid),
1704219820Sjeff			cl_ntoh16(p_smir->resv0),
1705219820Sjeff			cl_ntoh64(p_smir->sm_info.guid),
1706219820Sjeff			cl_ntoh64(p_smir->sm_info.sm_key),
1707219820Sjeff			cl_ntoh32(p_smir->sm_info.act_count),
1708219820Sjeff			ib_sminfo_get_priority(&p_smir->sm_info),
1709219820Sjeff			ib_sminfo_get_state(&p_smir->sm_info));
1710219820Sjeff	}
1711219820Sjeff}
1712219820Sjeff
1713219820Sjeff/**********************************************************************
1714219820Sjeff **********************************************************************/
1715219820Sjeffvoid
1716219820Sjeffosm_dump_notice(IN osm_log_t * const p_log,
1717219820Sjeff		IN const ib_mad_notice_attr_t * p_ntci,
1718219820Sjeff		IN const osm_log_level_t log_level)
1719219820Sjeff{
1720219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1721219820Sjeff		if (ib_notice_is_generic(p_ntci)) {
1722219820Sjeff			char buff[1024];
1723219820Sjeff			buff[0] = '\0';
1724219820Sjeff
1725219820Sjeff			/* immediate data based on the trap */
1726219820Sjeff			switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {
1727219820Sjeff			case 64:
1728219820Sjeff			case 65:
1729219820Sjeff			case 66:
1730219820Sjeff			case 67:
1731219820Sjeff				sprintf(buff,
1732219820Sjeff					"\t\t\t\tsrc_gid..................0x%016"
1733219820Sjeff					PRIx64 ":0x%016" PRIx64 "\n",
1734219820Sjeff					cl_ntoh64(p_ntci->data_details.
1735219820Sjeff						  ntc_64_67.gid.unicast.prefix),
1736219820Sjeff					cl_ntoh64(p_ntci->data_details.
1737219820Sjeff						  ntc_64_67.gid.unicast.
1738219820Sjeff						  interface_id));
1739219820Sjeff				break;
1740219820Sjeff			case 128:
1741219820Sjeff				sprintf(buff,
1742219820Sjeff					"\t\t\t\tsw_lid...................%u\n",
1743219820Sjeff					cl_ntoh16(p_ntci->data_details.ntc_128.
1744219820Sjeff						  sw_lid));
1745219820Sjeff				break;
1746219820Sjeff			case 129:
1747219820Sjeff			case 130:
1748219820Sjeff			case 131:
1749219820Sjeff				sprintf(buff,
1750219820Sjeff					"\t\t\t\tlid......................%u\n"
1751219820Sjeff					"\t\t\t\tport_num.................%u\n",
1752219820Sjeff					cl_ntoh16(p_ntci->data_details.
1753219820Sjeff						  ntc_129_131.lid),
1754219820Sjeff					p_ntci->data_details.ntc_129_131.
1755219820Sjeff					port_num);
1756219820Sjeff				break;
1757219820Sjeff			case 144:
1758219820Sjeff				sprintf(buff,
1759219820Sjeff					"\t\t\t\tlid......................%u\n"
1760219820Sjeff					"\t\t\t\tnew_cap_mask.............0x%08x\n",
1761219820Sjeff					cl_ntoh16(p_ntci->data_details.ntc_144.
1762219820Sjeff						  lid),
1763219820Sjeff					cl_ntoh32(p_ntci->data_details.ntc_144.
1764219820Sjeff						  new_cap_mask));
1765219820Sjeff				break;
1766219820Sjeff			case 145:
1767219820Sjeff				sprintf(buff,
1768219820Sjeff					"\t\t\t\tlid......................%u\n"
1769219820Sjeff					"\t\t\t\tnew_sys_guid.............0x%016"
1770219820Sjeff					PRIx64 "\n",
1771219820Sjeff					cl_ntoh16(p_ntci->data_details.ntc_145.
1772219820Sjeff						  lid),
1773219820Sjeff					cl_ntoh64(p_ntci->data_details.ntc_145.
1774219820Sjeff						  new_sys_guid));
1775219820Sjeff				break;
1776219820Sjeff			}
1777219820Sjeff
1778219820Sjeff			osm_log(p_log, log_level,
1779219820Sjeff				"Generic Notice dump:\n"
1780219820Sjeff				"\t\t\t\ttype.....................%u\n"
1781219820Sjeff				"\t\t\t\tprod_type................%u (%s)\n"
1782219820Sjeff				"\t\t\t\ttrap_num.................%u\n%s",
1783219820Sjeff				ib_notice_get_type(p_ntci),
1784219820Sjeff				cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
1785219820Sjeff				ib_get_producer_type_str(ib_notice_get_prod_type
1786219820Sjeff							 (p_ntci)),
1787219820Sjeff				cl_ntoh16(p_ntci->g_or_v.generic.trap_num),
1788219820Sjeff				buff);
1789219820Sjeff		} else {
1790219820Sjeff			osm_log(p_log, log_level,
1791219820Sjeff				"Vendor Notice dump:\n"
1792219820Sjeff				"\t\t\t\ttype.....................%u\n"
1793219820Sjeff				"\t\t\t\tvendor...................%u\n"
1794219820Sjeff				"\t\t\t\tdevice_id................%u\n",
1795219820Sjeff				cl_ntoh16(ib_notice_get_type(p_ntci)),
1796219820Sjeff				cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
1797219820Sjeff				cl_ntoh16(p_ntci->g_or_v.vend.dev_id));
1798219820Sjeff		}
1799219820Sjeff	}
1800219820Sjeff}
1801219820Sjeff
1802219820Sjeff/**********************************************************************
1803219820Sjeff **********************************************************************/
1804219820Sjeffvoid
1805219820Sjeffosm_dump_dr_smp(IN osm_log_t * const p_log,
1806219820Sjeff		IN const ib_smp_t * const p_smp,
1807219820Sjeff		IN const osm_log_level_t log_level)
1808219820Sjeff{
1809219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1810219820Sjeff		char buf[BUF_SIZE], line[BUF_SIZE];
1811219820Sjeff		uint32_t i;
1812219820Sjeff
1813219820Sjeff		sprintf(buf,
1814219820Sjeff			"SMP dump:\n"
1815219820Sjeff			"\t\t\t\tbase_ver................0x%X\n"
1816219820Sjeff			"\t\t\t\tmgmt_class..............0x%X\n"
1817219820Sjeff			"\t\t\t\tclass_ver...............0x%X\n"
1818219820Sjeff			"\t\t\t\tmethod..................0x%X (%s)\n",
1819219820Sjeff			p_smp->base_ver,
1820219820Sjeff			p_smp->mgmt_class,
1821219820Sjeff			p_smp->class_ver,
1822219820Sjeff			p_smp->method, ib_get_sm_method_str(p_smp->method));
1823219820Sjeff
1824219820Sjeff		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
1825219820Sjeff			sprintf(line,
1826219820Sjeff				"\t\t\t\tD bit...................0x%X\n"
1827219820Sjeff				"\t\t\t\tstatus..................0x%X\n",
1828219820Sjeff				ib_smp_is_d(p_smp), ib_smp_get_status(p_smp));
1829219820Sjeff		} else {
1830219820Sjeff			sprintf(line,
1831219820Sjeff				"\t\t\t\tstatus..................0x%X\n",
1832219820Sjeff				cl_ntoh16(p_smp->status));
1833219820Sjeff		}
1834219820Sjeff		strcat(buf, line);
1835219820Sjeff
1836219820Sjeff		sprintf(line,
1837219820Sjeff			"\t\t\t\thop_ptr.................0x%X\n"
1838219820Sjeff			"\t\t\t\thop_count...............0x%X\n"
1839219820Sjeff			"\t\t\t\ttrans_id................0x%" PRIx64 "\n"
1840219820Sjeff			"\t\t\t\tattr_id.................0x%X (%s)\n"
1841219820Sjeff			"\t\t\t\tresv....................0x%X\n"
1842219820Sjeff			"\t\t\t\tattr_mod................0x%X\n"
1843219820Sjeff			"\t\t\t\tm_key...................0x%016" PRIx64 "\n",
1844219820Sjeff			p_smp->hop_ptr,
1845219820Sjeff			p_smp->hop_count,
1846219820Sjeff			cl_ntoh64(p_smp->trans_id),
1847219820Sjeff			cl_ntoh16(p_smp->attr_id),
1848219820Sjeff			ib_get_sm_attr_str(p_smp->attr_id),
1849219820Sjeff			cl_ntoh16(p_smp->resv),
1850219820Sjeff			cl_ntoh32(p_smp->attr_mod), cl_ntoh64(p_smp->m_key));
1851219820Sjeff		strcat(buf, line);
1852219820Sjeff
1853219820Sjeff		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
1854219820Sjeff			sprintf(line,
1855219820Sjeff				"\t\t\t\tdr_slid.................%u\n"
1856219820Sjeff				"\t\t\t\tdr_dlid.................%u\n",
1857219820Sjeff				cl_ntoh16(p_smp->dr_slid),
1858219820Sjeff				cl_ntoh16(p_smp->dr_dlid));
1859219820Sjeff			strcat(buf, line);
1860219820Sjeff
1861219820Sjeff			strcat(buf, "\n\t\t\t\tInitial path: ");
1862219820Sjeff
1863219820Sjeff			for (i = 0; i <= p_smp->hop_count; i++) {
1864219820Sjeff				if (i == 0)
1865219820Sjeff					sprintf(line, "%d",
1866219820Sjeff						p_smp->initial_path[i]);
1867219820Sjeff				else
1868219820Sjeff					sprintf(line, ",%d",
1869219820Sjeff						p_smp->initial_path[i]);
1870219820Sjeff				strcat(buf, line);
1871219820Sjeff			}
1872219820Sjeff
1873219820Sjeff			strcat(buf, "\n\t\t\t\tReturn path:  ");
1874219820Sjeff
1875219820Sjeff			for (i = 0; i <= p_smp->hop_count; i++) {
1876219820Sjeff				if (i == 0)
1877219820Sjeff					sprintf(line, "%d",
1878219820Sjeff						p_smp->return_path[i]);
1879219820Sjeff				else
1880219820Sjeff					sprintf(line, ",%d",
1881219820Sjeff						p_smp->return_path[i]);
1882219820Sjeff				strcat(buf, line);
1883219820Sjeff			}
1884219820Sjeff
1885219820Sjeff			strcat(buf, "\n\t\t\t\tReserved:     ");
1886219820Sjeff
1887219820Sjeff			for (i = 0; i < 7; i++) {
1888219820Sjeff				sprintf(line, "[%0X]", p_smp->resv1[i]);
1889219820Sjeff				strcat(buf, line);
1890219820Sjeff			}
1891219820Sjeff
1892219820Sjeff			strcat(buf, "\n");
1893219820Sjeff
1894219820Sjeff			for (i = 0; i < 64; i += 16) {
1895219820Sjeff				sprintf(line, "\n\t\t\t\t%02X %02X %02X %02X "
1896219820Sjeff					"%02X %02X %02X %02X"
1897219820Sjeff					"   %02X %02X %02X %02X %02X %02X %02X %02X\n",
1898219820Sjeff					p_smp->data[i],
1899219820Sjeff					p_smp->data[i + 1],
1900219820Sjeff					p_smp->data[i + 2],
1901219820Sjeff					p_smp->data[i + 3],
1902219820Sjeff					p_smp->data[i + 4],
1903219820Sjeff					p_smp->data[i + 5],
1904219820Sjeff					p_smp->data[i + 6],
1905219820Sjeff					p_smp->data[i + 7],
1906219820Sjeff					p_smp->data[i + 8],
1907219820Sjeff					p_smp->data[i + 9],
1908219820Sjeff					p_smp->data[i + 10],
1909219820Sjeff					p_smp->data[i + 11],
1910219820Sjeff					p_smp->data[i + 12],
1911219820Sjeff					p_smp->data[i + 13],
1912219820Sjeff					p_smp->data[i + 14],
1913219820Sjeff					p_smp->data[i + 15]);
1914219820Sjeff
1915219820Sjeff				strcat(buf, line);
1916219820Sjeff			}
1917219820Sjeff		} else {
1918219820Sjeff			/* not a Direct Route so provide source and destination lids */
1919219820Sjeff			strcat(buf, "\t\t\t\tMAD IS LID ROUTED\n");
1920219820Sjeff		}
1921219820Sjeff
1922219820Sjeff		osm_log(p_log, log_level, "%s\n", buf);
1923219820Sjeff	}
1924219820Sjeff}
1925219820Sjeff
1926219820Sjeff/**********************************************************************
1927219820Sjeff **********************************************************************/
1928219820Sjeffvoid
1929219820Sjeffosm_dump_sa_mad(IN osm_log_t * const p_log,
1930219820Sjeff		IN const ib_sa_mad_t * const p_mad,
1931219820Sjeff		IN const osm_log_level_t log_level)
1932219820Sjeff{
1933219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1934219820Sjeff		char buf[BUF_SIZE];
1935219820Sjeff
1936219820Sjeff		/* make sure the mad is valid */
1937219820Sjeff		if (p_mad == NULL) {
1938219820Sjeff			OSM_LOG(p_log, log_level, "NULL MAD POINTER\n");
1939219820Sjeff			return;
1940219820Sjeff		}
1941219820Sjeff
1942219820Sjeff		sprintf(buf,
1943219820Sjeff			"SA MAD dump:\n"
1944219820Sjeff			"\t\t\t\tbase_ver................0x%X\n"
1945219820Sjeff			"\t\t\t\tmgmt_class..............0x%X\n"
1946219820Sjeff			"\t\t\t\tclass_ver...............0x%X\n"
1947219820Sjeff			"\t\t\t\tmethod..................0x%X (%s)\n"
1948219820Sjeff			"\t\t\t\tstatus..................0x%X\n"
1949219820Sjeff			"\t\t\t\tresv....................0x%X\n"
1950219820Sjeff			"\t\t\t\ttrans_id................0x%" PRIx64 "\n"
1951219820Sjeff			"\t\t\t\tattr_id.................0x%X (%s)\n"
1952219820Sjeff			"\t\t\t\tresv1...................0x%X\n"
1953219820Sjeff			"\t\t\t\tattr_mod................0x%X\n"
1954219820Sjeff			"\t\t\t\trmpp_version............0x%X\n"
1955219820Sjeff			"\t\t\t\trmpp_type...............0x%X\n"
1956219820Sjeff			"\t\t\t\trmpp_flags..............0x%X\n"
1957219820Sjeff			"\t\t\t\trmpp_status.............0x%X\n"
1958219820Sjeff			"\t\t\t\tseg_num.................0x%X\n"
1959219820Sjeff			"\t\t\t\tpayload_len/new_win.....0x%X\n"
1960219820Sjeff			"\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1961219820Sjeff			"\t\t\t\tattr_offset.............0x%X\n"
1962219820Sjeff			"\t\t\t\tresv2...................0x%X\n"
1963219820Sjeff			"\t\t\t\tcomp_mask...............0x%016" PRIx64 "\n",
1964219820Sjeff			p_mad->base_ver,
1965219820Sjeff			p_mad->mgmt_class,
1966219820Sjeff			p_mad->class_ver,
1967219820Sjeff			p_mad->method, ib_get_sa_method_str(p_mad->method),
1968219820Sjeff			cl_ntoh16(p_mad->status),
1969219820Sjeff			cl_ntoh16(p_mad->resv),
1970219820Sjeff			cl_ntoh64(p_mad->trans_id),
1971219820Sjeff			cl_ntoh16(p_mad->attr_id),
1972219820Sjeff			ib_get_sa_attr_str(p_mad->attr_id),
1973219820Sjeff			cl_ntoh16(p_mad->resv1),
1974219820Sjeff			cl_ntoh32(p_mad->attr_mod),
1975219820Sjeff			p_mad->rmpp_version,
1976219820Sjeff			p_mad->rmpp_type,
1977219820Sjeff			p_mad->rmpp_flags,
1978219820Sjeff			p_mad->rmpp_status,
1979219820Sjeff			cl_ntoh32(p_mad->seg_num),
1980219820Sjeff			cl_ntoh32(p_mad->paylen_newwin),
1981219820Sjeff			cl_ntoh64(p_mad->sm_key),
1982219820Sjeff			cl_ntoh16(p_mad->attr_offset),
1983219820Sjeff			cl_ntoh16(p_mad->resv3), cl_ntoh64(p_mad->comp_mask));
1984219820Sjeff
1985219820Sjeff		strcat(buf, "\n");
1986219820Sjeff
1987219820Sjeff		osm_log(p_log, log_level, "%s\n", buf);
1988219820Sjeff	}
1989219820Sjeff}
1990219820Sjeff
1991219820Sjeff/**********************************************************************
1992219820Sjeff **********************************************************************/
1993219820Sjeffvoid
1994219820Sjeffosm_dump_dr_path(IN osm_log_t * const p_log,
1995219820Sjeff		 IN const osm_dr_path_t * const p_path,
1996219820Sjeff		 IN const osm_log_level_t log_level)
1997219820Sjeff{
1998219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
1999219820Sjeff		char buf[BUF_SIZE], line[BUF_SIZE];
2000219820Sjeff		uint32_t i;
2001219820Sjeff
2002219820Sjeff		sprintf(buf, "Directed Path Dump of %u hop path:"
2003219820Sjeff			"\n\t\t\t\tPath = ", p_path->hop_count);
2004219820Sjeff
2005219820Sjeff		for (i = 0; i <= p_path->hop_count; i++) {
2006219820Sjeff			if (i == 0)
2007219820Sjeff				sprintf(line, "%d", p_path->path[i]);
2008219820Sjeff			else
2009219820Sjeff				sprintf(line, ",%d", p_path->path[i]);
2010219820Sjeff			strcat(buf, line);
2011219820Sjeff		}
2012219820Sjeff		osm_log(p_log, log_level, "%s\n", buf);
2013219820Sjeff	}
2014219820Sjeff}
2015219820Sjeff
2016219820Sjeff/**********************************************************************
2017219820Sjeff **********************************************************************/
2018219820Sjeffvoid
2019219820Sjeffosm_dump_smp_dr_path(IN osm_log_t * const p_log,
2020219820Sjeff		     IN const ib_smp_t * const p_smp,
2021219820Sjeff		     IN const osm_log_level_t log_level)
2022219820Sjeff{
2023219820Sjeff	if (osm_log_is_active(p_log, log_level)) {
2024219820Sjeff		char buf[BUF_SIZE], line[BUF_SIZE];
2025219820Sjeff		uint32_t i;
2026219820Sjeff
2027219820Sjeff		sprintf(buf, "Received SMP on a %u hop path:"
2028219820Sjeff			"\n\t\t\t\tInitial path = ", p_smp->hop_count);
2029219820Sjeff
2030219820Sjeff		for (i = 0; i <= p_smp->hop_count; i++) {
2031219820Sjeff			if (i == 0)
2032219820Sjeff				sprintf(line, "%d", p_smp->initial_path[i]);
2033219820Sjeff			else
2034219820Sjeff				sprintf(line, ",%d", p_smp->initial_path[i]);
2035219820Sjeff			strcat(buf, line);
2036219820Sjeff		}
2037219820Sjeff
2038219820Sjeff		strcat(buf, "\n\t\t\t\tReturn path  = ");
2039219820Sjeff
2040219820Sjeff		for (i = 0; i <= p_smp->hop_count; i++) {
2041219820Sjeff			if (i == 0)
2042219820Sjeff				sprintf(line, "%d", p_smp->return_path[i]);
2043219820Sjeff			else
2044219820Sjeff				sprintf(line, ",%d", p_smp->return_path[i]);
2045219820Sjeff			strcat(buf, line);
2046219820Sjeff		}
2047219820Sjeff
2048219820Sjeff		osm_log(p_log, log_level, "%s\n", buf);
2049219820Sjeff	}
2050219820Sjeff}
2051219820Sjeff
2052219820Sjeffstatic const char *const __osm_sm_signal_str[] = {
2053219820Sjeff	"OSM_SIGNAL_NONE",	/* 0 */
2054219820Sjeff	"OSM_SIGNAL_SWEEP",	/* 1 */
2055219820Sjeff	"OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST",	/* 2 */
2056219820Sjeff	"OSM_SIGNAL_EXIT_STBY",	/* 3 */
2057219820Sjeff	"OSM_SIGNAL_PERFMGR_SWEEP",	/* 4 */
2058219820Sjeff	"UNKNOWN SIGNAL!!"	/* 5 */
2059219820Sjeff};
2060219820Sjeff
2061219820Sjeff/**********************************************************************
2062219820Sjeff **********************************************************************/
2063219820Sjeffconst char *osm_get_sm_signal_str(IN osm_signal_t signal)
2064219820Sjeff{
2065219820Sjeff	if (signal > OSM_SIGNAL_MAX)
2066219820Sjeff		signal = OSM_SIGNAL_MAX;
2067219820Sjeff	return (__osm_sm_signal_str[signal]);
2068219820Sjeff}
2069219820Sjeff
2070219820Sjeff/**********************************************************************
2071219820Sjeff **********************************************************************/
2072219820Sjeff
2073219820Sjeffstatic const char *const __osm_disp_msg_str[] = {
2074219820Sjeff	"OSM_MSG_NONE",
2075219820Sjeff	"OSM_MSG_MAD_NODE_INFO",
2076219820Sjeff	"OSM_MSG_MAD_PORT_INFO",
2077219820Sjeff	"OSM_MSG_MAD_SWITCH_INFO",
2078219820Sjeff	"OSM_MSG_MAD_NODE_DESC",
2079219820Sjeff	"OSM_MSG_MAD_NODE_RECORD",
2080219820Sjeff	"OSM_MSG_MAD_PORTINFO_RECORD",
2081219820Sjeff	"OSM_MSG_MAD_SERVICE_RECORD",
2082219820Sjeff	"OSM_MSG_MAD_PATH_RECORD",
2083219820Sjeff	"OSM_MSG_MAD_MCMEMBER_RECORD",
2084219820Sjeff	"OSM_MSG_MAD_LINK_RECORD",
2085219820Sjeff	"OSM_MSG_MAD_SMINFO_RECORD",
2086219820Sjeff	"OSM_MSG_MAD_CLASS_PORT_INFO",
2087219820Sjeff	"OSM_MSG_MAD_INFORM_INFO",
2088219820Sjeff	"OSM_MSG_MAD_LFT_RECORD",
2089219820Sjeff	"OSM_MSG_MAD_LFT",
2090219820Sjeff	"OSM_MSG_MAD_SM_INFO",
2091219820Sjeff	"OSM_MSG_MAD_NOTICE",
2092219820Sjeff	"OSM_MSG_LIGHT_SWEEP_FAIL",
2093219820Sjeff	"OSM_MSG_MAD_MFT",
2094219820Sjeff	"OSM_MSG_MAD_PKEY_TBL_RECORD",
2095219820Sjeff	"OSM_MSG_MAD_VL_ARB_RECORD",
2096219820Sjeff	"OSM_MSG_MAD_SLVL_TBL_RECORD",
2097219820Sjeff	"OSM_MSG_MAD_PKEY",
2098219820Sjeff	"OSM_MSG_MAD_VL_ARB",
2099219820Sjeff	"OSM_MSG_MAD_SLVL",
2100219820Sjeff	"OSM_MSG_MAD_GUIDINFO_RECORD",
2101219820Sjeff	"OSM_MSG_MAD_INFORM_INFO_RECORD",
2102219820Sjeff#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
2103219820Sjeff	"OSM_MSG_MAD_MULTIPATH_RECORD",
2104219820Sjeff#endif
2105219820Sjeff	"UNKNOWN!!"
2106219820Sjeff};
2107219820Sjeff
2108219820Sjeff/**********************************************************************
2109219820Sjeff **********************************************************************/
2110219820Sjeffconst char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
2111219820Sjeff{
2112219820Sjeff	if (msg > OSM_MSG_MAX)
2113219820Sjeff		msg = OSM_MSG_MAX;
2114219820Sjeff	return (__osm_disp_msg_str[msg]);
2115219820Sjeff}
2116219820Sjeff
2117219820Sjeffstatic const char *const __osm_port_state_str_fixed_width[] = {
2118219820Sjeff	"NOC",
2119219820Sjeff	"DWN",
2120219820Sjeff	"INI",
2121219820Sjeff	"ARM",
2122219820Sjeff	"ACT",
2123219820Sjeff	"???"
2124219820Sjeff};
2125219820Sjeff
2126219820Sjeff/**********************************************************************
2127219820Sjeff **********************************************************************/
2128219820Sjeffconst char *osm_get_port_state_str_fixed_width(IN uint8_t port_state)
2129219820Sjeff{
2130219820Sjeff	if (port_state > IB_LINK_ACTIVE)
2131219820Sjeff		port_state = IB_LINK_ACTIVE + 1;
2132219820Sjeff	return (__osm_port_state_str_fixed_width[port_state]);
2133219820Sjeff}
2134219820Sjeff
2135219820Sjeffstatic const char *const __osm_node_type_str_fixed_width[] = {
2136219820Sjeff	"??",
2137219820Sjeff	"CA",
2138219820Sjeff	"SW",
2139219820Sjeff	"RT",
2140219820Sjeff};
2141219820Sjeff
2142219820Sjeff/**********************************************************************
2143219820Sjeff **********************************************************************/
2144219820Sjeffconst char *osm_get_node_type_str_fixed_width(IN uint8_t node_type)
2145219820Sjeff{
2146219820Sjeff	if (node_type > IB_NODE_TYPE_ROUTER)
2147219820Sjeff		node_type = 0;
2148219820Sjeff	return (__osm_node_type_str_fixed_width[node_type]);
2149219820Sjeff}
2150219820Sjeff
2151219820Sjeff/**********************************************************************
2152219820Sjeff **********************************************************************/
2153219820Sjeffconst char *osm_get_manufacturer_str(IN uint64_t const guid_ho)
2154219820Sjeff{
2155219820Sjeff	/* note that the max vendor string length is 11 */
2156219820Sjeff	static const char *intel_str = "Intel";
2157219820Sjeff	static const char *mellanox_str = "Mellanox";
2158219820Sjeff	static const char *redswitch_str = "Redswitch";
2159219820Sjeff	static const char *silverstorm_str = "SilverStorm";
2160219820Sjeff	static const char *topspin_str = "Topspin";
2161219820Sjeff	static const char *fujitsu_str = "Fujitsu";
2162219820Sjeff	static const char *voltaire_str = "Voltaire";
2163219820Sjeff	static const char *yotta_str = "YottaYotta";
2164219820Sjeff	static const char *pathscale_str = "PathScale";
2165219820Sjeff	static const char *ibm_str = "IBM";
2166219820Sjeff	static const char *divergenet_str = "DivergeNet";
2167219820Sjeff	static const char *flextronics_str = "Flextronics";
2168219820Sjeff	static const char *agilent_str = "Agilent";
2169219820Sjeff	static const char *obsidian_str = "Obsidian";
2170219820Sjeff	static const char *baymicro_str = "BayMicro";
2171219820Sjeff	static const char *lsilogic_str = "LSILogic";
2172219820Sjeff	static const char *ddn_str = "DataDirect";
2173219820Sjeff	static const char *panta_str = "Panta";
2174219820Sjeff	static const char *hp_str = "HP";
2175219820Sjeff	static const char *rioworks_str = "Rioworks";
2176219820Sjeff	static const char *sun_str = "Sun";
2177219820Sjeff	static const char *leafntwks_str = "3LeafNtwks";
2178219820Sjeff	static const char *xsigo_str = "Xsigo";
2179219820Sjeff	static const char *unknown_str = "Unknown";
2180219820Sjeff
2181219820Sjeff	switch ((uint32_t) (guid_ho >> (5 * 8))) {
2182219820Sjeff	case OSM_VENDOR_ID_INTEL:
2183219820Sjeff		return (intel_str);
2184219820Sjeff	case OSM_VENDOR_ID_MELLANOX:
2185219820Sjeff		return (mellanox_str);
2186219820Sjeff	case OSM_VENDOR_ID_REDSWITCH:
2187219820Sjeff		return (redswitch_str);
2188219820Sjeff	case OSM_VENDOR_ID_SILVERSTORM:
2189219820Sjeff		return (silverstorm_str);
2190219820Sjeff	case OSM_VENDOR_ID_TOPSPIN:
2191219820Sjeff		return (topspin_str);
2192219820Sjeff	case OSM_VENDOR_ID_FUJITSU:
2193219820Sjeff	case OSM_VENDOR_ID_FUJITSU2:
2194219820Sjeff		return (fujitsu_str);
2195219820Sjeff	case OSM_VENDOR_ID_VOLTAIRE:
2196219820Sjeff		return (voltaire_str);
2197219820Sjeff	case OSM_VENDOR_ID_YOTTAYOTTA:
2198219820Sjeff		return (yotta_str);
2199219820Sjeff	case OSM_VENDOR_ID_PATHSCALE:
2200219820Sjeff		return (pathscale_str);
2201219820Sjeff	case OSM_VENDOR_ID_IBM:
2202219820Sjeff		return (ibm_str);
2203219820Sjeff	case OSM_VENDOR_ID_DIVERGENET:
2204219820Sjeff		return (divergenet_str);
2205219820Sjeff	case OSM_VENDOR_ID_FLEXTRONICS:
2206219820Sjeff		return (flextronics_str);
2207219820Sjeff	case OSM_VENDOR_ID_AGILENT:
2208219820Sjeff		return (agilent_str);
2209219820Sjeff	case OSM_VENDOR_ID_OBSIDIAN:
2210219820Sjeff		return (obsidian_str);
2211219820Sjeff	case OSM_VENDOR_ID_BAYMICRO:
2212219820Sjeff		return (baymicro_str);
2213219820Sjeff	case OSM_VENDOR_ID_LSILOGIC:
2214219820Sjeff		return (lsilogic_str);
2215219820Sjeff	case OSM_VENDOR_ID_DDN:
2216219820Sjeff		return (ddn_str);
2217219820Sjeff	case OSM_VENDOR_ID_PANTA:
2218219820Sjeff		return (panta_str);
2219219820Sjeff	case OSM_VENDOR_ID_HP:
2220219820Sjeff	case OSM_VENDOR_ID_HP2:
2221219820Sjeff		return (hp_str);
2222219820Sjeff	case OSM_VENDOR_ID_RIOWORKS:
2223219820Sjeff		return (rioworks_str);
2224219820Sjeff	case OSM_VENDOR_ID_SUN:
2225219820Sjeff		return (sun_str);
2226219820Sjeff	case OSM_VENDOR_ID_3LEAFNTWKS:
2227219820Sjeff		return (leafntwks_str);
2228219820Sjeff	case OSM_VENDOR_ID_XSIGO:
2229219820Sjeff		return (xsigo_str);
2230219820Sjeff	default:
2231219820Sjeff		return (unknown_str);
2232219820Sjeff	}
2233219820Sjeff}
2234219820Sjeff
2235219820Sjeffstatic const char *const __osm_mtu_str_fixed_width[] = {
2236219820Sjeff	"??? ",
2237219820Sjeff	"256 ",
2238219820Sjeff	"512 ",
2239219820Sjeff	"1024",
2240219820Sjeff	"2048",
2241219820Sjeff	"4096"
2242219820Sjeff};
2243219820Sjeff
2244219820Sjeff/**********************************************************************
2245219820Sjeff **********************************************************************/
2246219820Sjeffconst char *osm_get_mtu_str(IN uint8_t const mtu)
2247219820Sjeff{
2248219820Sjeff	if (mtu > IB_MTU_LEN_4096)
2249219820Sjeff		return (__osm_mtu_str_fixed_width[0]);
2250219820Sjeff	else
2251219820Sjeff		return (__osm_mtu_str_fixed_width[mtu]);
2252219820Sjeff}
2253219820Sjeff
2254219820Sjeffstatic const char *const __osm_lwa_str_fixed_width[] = {
2255219820Sjeff	"???",
2256219820Sjeff	"1x ",
2257219820Sjeff	"4x ",
2258219820Sjeff	"???",
2259219820Sjeff	"8x ",
2260219820Sjeff	"???",
2261219820Sjeff	"???",
2262219820Sjeff	"???",
2263219820Sjeff	"12x"
2264219820Sjeff};
2265219820Sjeff
2266219820Sjeff/**********************************************************************
2267219820Sjeff **********************************************************************/
2268219820Sjeffconst char *osm_get_lwa_str(IN uint8_t const lwa)
2269219820Sjeff{
2270219820Sjeff	if (lwa > 8)
2271219820Sjeff		return (__osm_lwa_str_fixed_width[0]);
2272219820Sjeff	else
2273219820Sjeff		return (__osm_lwa_str_fixed_width[lwa]);
2274219820Sjeff}
2275219820Sjeff
2276219820Sjeff/**********************************************************************
2277219820Sjeff **********************************************************************/
2278219820Sjeffstatic const char *const __osm_lsa_str_fixed_width[] = {
2279219820Sjeff	"???",
2280219820Sjeff	"2.5",
2281219820Sjeff	"5  ",
2282219820Sjeff	"???",
2283219820Sjeff	"10 "
2284219820Sjeff};
2285219820Sjeff
2286219820Sjeffconst char *osm_get_lsa_str(IN uint8_t const lsa)
2287219820Sjeff{
2288219820Sjeff	if (lsa > 4)
2289219820Sjeff		return (__osm_lsa_str_fixed_width[0]);
2290219820Sjeff	else
2291219820Sjeff		return (__osm_lsa_str_fixed_width[lsa]);
2292219820Sjeff}
2293219820Sjeff
2294219820Sjeff/**********************************************************************
2295219820Sjeff **********************************************************************/
2296219820Sjeff
2297219820Sjeffstatic const char *const __osm_sm_mgr_signal_str[] = {
2298219820Sjeff	"OSM_SM_SIGNAL_NONE",	/* 0 */
2299219820Sjeff	"OSM_SM_SIGNAL_DISCOVERY_COMPLETED",	/* 2 */
2300219820Sjeff	"OSM_SM_SIGNAL_POLLING_TIMEOUT",	/* 3 */
2301219820Sjeff	"OSM_SM_SIGNAL_DISCOVER",	/* 4 */
2302219820Sjeff	"OSM_SM_SIGNAL_DISABLE",	/* 5 */
2303219820Sjeff	"OSM_SM_SIGNAL_HANDOVER",	/* 6 */
2304219820Sjeff	"OSM_SM_SIGNAL_HANDOVER_SENT",	/* 7 */
2305219820Sjeff	"OSM_SM_SIGNAL_ACKNOWLEDGE",	/* 8 */
2306219820Sjeff	"OSM_SM_SIGNAL_STANDBY",	/* 9 */
2307219820Sjeff	"OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",	/* 10 */
2308219820Sjeff	"OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",	/* 11 */
2309219820Sjeff	"UNKNOWN STATE!!"	/* 12 */
2310219820Sjeff};
2311219820Sjeff
2312219820Sjeff/**********************************************************************
2313219820Sjeff **********************************************************************/
2314219820Sjeffconst char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal)
2315219820Sjeff{
2316219820Sjeff	if (signal > OSM_SM_SIGNAL_MAX)
2317219820Sjeff		signal = OSM_SM_SIGNAL_MAX;
2318219820Sjeff	return (__osm_sm_mgr_signal_str[signal]);
2319219820Sjeff}
2320219820Sjeff
2321219820Sjeffstatic const char *const __osm_sm_mgr_state_str[] = {
2322219820Sjeff	"NOTACTIVE",	/* 0 */
2323219820Sjeff	"DISCOVERING",	/* 1 */
2324219820Sjeff	"STANDBY",	/* 2 */
2325219820Sjeff	"MASTER",	/* 3 */
2326219820Sjeff	"UNKNOWN STATE!!"	/* 4 */
2327219820Sjeff};
2328219820Sjeff
2329219820Sjeffconst char *osm_get_sm_mgr_state_str(IN uint16_t state)
2330219820Sjeff{
2331219820Sjeff	return state < ARR_SIZE(__osm_sm_mgr_state_str) ?
2332219820Sjeff		__osm_sm_mgr_state_str[state] :
2333219820Sjeff		__osm_sm_mgr_state_str[ARR_SIZE(__osm_sm_mgr_state_str) - 1];
2334219820Sjeff}
2335