1*d6b92ffaSHans Petter Selasky /*
2*d6b92ffaSHans Petter Selasky * Copyright (c) 2004, 2005, 2010 Intel Corporation. All rights reserved.
3*d6b92ffaSHans Petter Selasky * Copyright (c) 2013 Lawrence Livermore National Security. All rights reserved.
4*d6b92ffaSHans Petter Selasky * Copyright (c) 2014 Mellanox Technologies LTD. All rights reserved.
5*d6b92ffaSHans Petter Selasky *
6*d6b92ffaSHans Petter Selasky * This software is available to you under a choice of one of two
7*d6b92ffaSHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU
8*d6b92ffaSHans Petter Selasky * General Public License (GPL) Version 2, available from the file
9*d6b92ffaSHans Petter Selasky * COPYING in the main directory of this source tree, or the
10*d6b92ffaSHans Petter Selasky * OpenIB.org BSD license below:
11*d6b92ffaSHans Petter Selasky *
12*d6b92ffaSHans Petter Selasky * Redistribution and use in source and binary forms, with or
13*d6b92ffaSHans Petter Selasky * without modification, are permitted provided that the following
14*d6b92ffaSHans Petter Selasky * conditions are met:
15*d6b92ffaSHans Petter Selasky *
16*d6b92ffaSHans Petter Selasky * - Redistributions of source code must retain the above
17*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
18*d6b92ffaSHans Petter Selasky * disclaimer.
19*d6b92ffaSHans Petter Selasky *
20*d6b92ffaSHans Petter Selasky * - Redistributions in binary form must reproduce the above
21*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
22*d6b92ffaSHans Petter Selasky * disclaimer in the documentation and/or other materials
23*d6b92ffaSHans Petter Selasky * provided with the distribution.
24*d6b92ffaSHans Petter Selasky *
25*d6b92ffaSHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26*d6b92ffaSHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27*d6b92ffaSHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28*d6b92ffaSHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29*d6b92ffaSHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30*d6b92ffaSHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31*d6b92ffaSHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32*d6b92ffaSHans Petter Selasky * SOFTWARE.
33*d6b92ffaSHans Petter Selasky *
34*d6b92ffaSHans Petter Selasky */
35*d6b92ffaSHans Petter Selasky
36*d6b92ffaSHans Petter Selasky #include <stdio.h>
37*d6b92ffaSHans Petter Selasky #include <infiniband/endian.h>
38*d6b92ffaSHans Petter Selasky #include <infiniband/umad.h>
39*d6b92ffaSHans Petter Selasky #include <infiniband/umad_types.h>
40*d6b92ffaSHans Petter Selasky #include <infiniband/umad_sm.h>
41*d6b92ffaSHans Petter Selasky #include <infiniband/umad_sa.h>
42*d6b92ffaSHans Petter Selasky #include <infiniband/umad_cm.h>
43*d6b92ffaSHans Petter Selasky #include "umad_str.h"
44*d6b92ffaSHans Petter Selasky
umad_class_str(uint8_t mgmt_class)45*d6b92ffaSHans Petter Selasky const char * umad_class_str(uint8_t mgmt_class)
46*d6b92ffaSHans Petter Selasky {
47*d6b92ffaSHans Petter Selasky switch (mgmt_class) {
48*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_LID_ROUTED:
49*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_DIRECTED_ROUTE:
50*d6b92ffaSHans Petter Selasky return("Subn");
51*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_ADM:
52*d6b92ffaSHans Petter Selasky return("SubnAdm");
53*d6b92ffaSHans Petter Selasky case UMAD_CLASS_PERF_MGMT:
54*d6b92ffaSHans Petter Selasky return("Perf");
55*d6b92ffaSHans Petter Selasky case UMAD_CLASS_BM:
56*d6b92ffaSHans Petter Selasky return("BM");
57*d6b92ffaSHans Petter Selasky case UMAD_CLASS_DEVICE_MGMT:
58*d6b92ffaSHans Petter Selasky return("DevMgt");
59*d6b92ffaSHans Petter Selasky case UMAD_CLASS_CM:
60*d6b92ffaSHans Petter Selasky return("ComMgt");
61*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SNMP:
62*d6b92ffaSHans Petter Selasky return("SNMP");
63*d6b92ffaSHans Petter Selasky case UMAD_CLASS_DEVICE_ADM:
64*d6b92ffaSHans Petter Selasky return("DevAdm");
65*d6b92ffaSHans Petter Selasky case UMAD_CLASS_BOOT_MGMT:
66*d6b92ffaSHans Petter Selasky return("BootMgt");
67*d6b92ffaSHans Petter Selasky case UMAD_CLASS_BIS:
68*d6b92ffaSHans Petter Selasky return("BIS");
69*d6b92ffaSHans Petter Selasky case UMAD_CLASS_CONG_MGMT:
70*d6b92ffaSHans Petter Selasky return("CongestionManagment");
71*d6b92ffaSHans Petter Selasky default:
72*d6b92ffaSHans Petter Selasky break;
73*d6b92ffaSHans Petter Selasky }
74*d6b92ffaSHans Petter Selasky
75*d6b92ffaSHans Petter Selasky if ((UMAD_CLASS_VENDOR_RANGE1_START <= mgmt_class
76*d6b92ffaSHans Petter Selasky && mgmt_class <= UMAD_CLASS_VENDOR_RANGE1_END)
77*d6b92ffaSHans Petter Selasky || (UMAD_CLASS_VENDOR_RANGE2_START <= mgmt_class
78*d6b92ffaSHans Petter Selasky && mgmt_class <= UMAD_CLASS_VENDOR_RANGE2_END))
79*d6b92ffaSHans Petter Selasky return("Vendor");
80*d6b92ffaSHans Petter Selasky
81*d6b92ffaSHans Petter Selasky if (UMAD_CLASS_APPLICATION_START <= mgmt_class
82*d6b92ffaSHans Petter Selasky && mgmt_class <= UMAD_CLASS_APPLICATION_END) {
83*d6b92ffaSHans Petter Selasky return("Application");
84*d6b92ffaSHans Petter Selasky }
85*d6b92ffaSHans Petter Selasky return ("<unknown>");
86*d6b92ffaSHans Petter Selasky }
87*d6b92ffaSHans Petter Selasky
umad_common_method_str(uint8_t method)88*d6b92ffaSHans Petter Selasky static const char * umad_common_method_str(uint8_t method)
89*d6b92ffaSHans Petter Selasky {
90*d6b92ffaSHans Petter Selasky switch(method) {
91*d6b92ffaSHans Petter Selasky case UMAD_METHOD_GET:
92*d6b92ffaSHans Petter Selasky return ("Get");
93*d6b92ffaSHans Petter Selasky case UMAD_METHOD_SET:
94*d6b92ffaSHans Petter Selasky return ("Set");
95*d6b92ffaSHans Petter Selasky case UMAD_METHOD_GET_RESP:
96*d6b92ffaSHans Petter Selasky return ("GetResp");
97*d6b92ffaSHans Petter Selasky case UMAD_METHOD_SEND:
98*d6b92ffaSHans Petter Selasky return ("Send");
99*d6b92ffaSHans Petter Selasky case UMAD_METHOD_TRAP:
100*d6b92ffaSHans Petter Selasky return ("Trap");
101*d6b92ffaSHans Petter Selasky case UMAD_METHOD_REPORT:
102*d6b92ffaSHans Petter Selasky return ("Report");
103*d6b92ffaSHans Petter Selasky case UMAD_METHOD_REPORT_RESP:
104*d6b92ffaSHans Petter Selasky return ("ReportResp");
105*d6b92ffaSHans Petter Selasky case UMAD_METHOD_TRAP_REPRESS:
106*d6b92ffaSHans Petter Selasky return ("TrapRepress");
107*d6b92ffaSHans Petter Selasky default:
108*d6b92ffaSHans Petter Selasky return ("<unknown");
109*d6b92ffaSHans Petter Selasky }
110*d6b92ffaSHans Petter Selasky }
111*d6b92ffaSHans Petter Selasky
umad_sa_method_str(uint8_t method)112*d6b92ffaSHans Petter Selasky static const char * umad_sa_method_str(uint8_t method)
113*d6b92ffaSHans Petter Selasky {
114*d6b92ffaSHans Petter Selasky switch(method) {
115*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_GET_TABLE:
116*d6b92ffaSHans Petter Selasky return ("GetTable");
117*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_GET_TABLE_RESP:
118*d6b92ffaSHans Petter Selasky return ("GetTableResp");
119*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_DELETE:
120*d6b92ffaSHans Petter Selasky return ("Delete");
121*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_DELETE_RESP:
122*d6b92ffaSHans Petter Selasky return ("DeleteResp");
123*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_GET_MULTI:
124*d6b92ffaSHans Petter Selasky return ("GetMulti");
125*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_GET_MULTI_RESP:
126*d6b92ffaSHans Petter Selasky return ("GetMultiResp");
127*d6b92ffaSHans Petter Selasky case UMAD_SA_METHOD_GET_TRACE_TABLE:
128*d6b92ffaSHans Petter Selasky return ("GetTraceTable");
129*d6b92ffaSHans Petter Selasky default:
130*d6b92ffaSHans Petter Selasky return (umad_common_method_str(method));
131*d6b92ffaSHans Petter Selasky }
132*d6b92ffaSHans Petter Selasky }
133*d6b92ffaSHans Petter Selasky
umad_method_str(uint8_t mgmt_class,uint8_t method)134*d6b92ffaSHans Petter Selasky const char * umad_method_str(uint8_t mgmt_class, uint8_t method)
135*d6b92ffaSHans Petter Selasky {
136*d6b92ffaSHans Petter Selasky if (mgmt_class == UMAD_CLASS_SUBN_ADM)
137*d6b92ffaSHans Petter Selasky return(umad_sa_method_str(method));
138*d6b92ffaSHans Petter Selasky
139*d6b92ffaSHans Petter Selasky return (umad_common_method_str(method));
140*d6b92ffaSHans Petter Selasky }
141*d6b92ffaSHans Petter Selasky
umad_common_mad_status_str(__be16 _status)142*d6b92ffaSHans Petter Selasky const char * umad_common_mad_status_str(__be16 _status)
143*d6b92ffaSHans Petter Selasky {
144*d6b92ffaSHans Petter Selasky uint16_t status = be16toh(_status);
145*d6b92ffaSHans Petter Selasky
146*d6b92ffaSHans Petter Selasky if (status & UMAD_STATUS_BUSY)
147*d6b92ffaSHans Petter Selasky return ("Busy");
148*d6b92ffaSHans Petter Selasky
149*d6b92ffaSHans Petter Selasky if (status & UMAD_STATUS_REDIRECT)
150*d6b92ffaSHans Petter Selasky return ("Redirection required");
151*d6b92ffaSHans Petter Selasky
152*d6b92ffaSHans Petter Selasky switch(status & UMAD_STATUS_INVALID_FIELD_MASK) {
153*d6b92ffaSHans Petter Selasky case UMAD_STATUS_BAD_VERSION:
154*d6b92ffaSHans Petter Selasky return ("Bad Version");
155*d6b92ffaSHans Petter Selasky case UMAD_STATUS_METHOD_NOT_SUPPORTED:
156*d6b92ffaSHans Petter Selasky return ("Method not supported");
157*d6b92ffaSHans Petter Selasky case UMAD_STATUS_ATTR_NOT_SUPPORTED:
158*d6b92ffaSHans Petter Selasky return ("Method/Attribute combo not supported");
159*d6b92ffaSHans Petter Selasky case UMAD_STATUS_INVALID_ATTR_VALUE:
160*d6b92ffaSHans Petter Selasky return ("Invalid attribute/modifier field");
161*d6b92ffaSHans Petter Selasky }
162*d6b92ffaSHans Petter Selasky return ("Success");
163*d6b92ffaSHans Petter Selasky }
164*d6b92ffaSHans Petter Selasky
umad_sa_mad_status_str(__be16 _status)165*d6b92ffaSHans Petter Selasky const char * umad_sa_mad_status_str(__be16 _status)
166*d6b92ffaSHans Petter Selasky {
167*d6b92ffaSHans Petter Selasky uint16_t status = be16toh(_status);
168*d6b92ffaSHans Petter Selasky switch((status & UMAD_STATUS_CLASS_MASK) >> 8) {
169*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_SUCCESS:
170*d6b92ffaSHans Petter Selasky return ("Success");
171*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_NO_RESOURCES:
172*d6b92ffaSHans Petter Selasky return ("No Resources");
173*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_REQ_INVALID:
174*d6b92ffaSHans Petter Selasky return ("Request Invalid");
175*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_NO_RECORDS:
176*d6b92ffaSHans Petter Selasky return ("No Records");
177*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_TOO_MANY_RECORDS:
178*d6b92ffaSHans Petter Selasky return ("Too Many Records");
179*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_INVALID_GID:
180*d6b92ffaSHans Petter Selasky return ("Invalid GID");
181*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_INSUF_COMPS:
182*d6b92ffaSHans Petter Selasky return ("Insufficient Components");
183*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_REQ_DENIED:
184*d6b92ffaSHans Petter Selasky return ("Request Denied");
185*d6b92ffaSHans Petter Selasky case UMAD_SA_STATUS_PRI_SUGGESTED:
186*d6b92ffaSHans Petter Selasky return ("Priority Suggested");
187*d6b92ffaSHans Petter Selasky }
188*d6b92ffaSHans Petter Selasky return ("Undefined Error");
189*d6b92ffaSHans Petter Selasky }
190*d6b92ffaSHans Petter Selasky
umad_common_attr_str(__be16 attr_id)191*d6b92ffaSHans Petter Selasky static const char *umad_common_attr_str(__be16 attr_id)
192*d6b92ffaSHans Petter Selasky {
193*d6b92ffaSHans Petter Selasky switch(be16toh(attr_id)) {
194*d6b92ffaSHans Petter Selasky case UMAD_ATTR_CLASS_PORT_INFO:
195*d6b92ffaSHans Petter Selasky return "Class Port Info";
196*d6b92ffaSHans Petter Selasky case UMAD_ATTR_NOTICE:
197*d6b92ffaSHans Petter Selasky return "Notice";
198*d6b92ffaSHans Petter Selasky case UMAD_ATTR_INFORM_INFO:
199*d6b92ffaSHans Petter Selasky return "Inform Info";
200*d6b92ffaSHans Petter Selasky default:
201*d6b92ffaSHans Petter Selasky return "<unknown>";
202*d6b92ffaSHans Petter Selasky }
203*d6b92ffaSHans Petter Selasky }
204*d6b92ffaSHans Petter Selasky
umad_sm_attr_str(__be16 attr_id)205*d6b92ffaSHans Petter Selasky static const char * umad_sm_attr_str(__be16 attr_id)
206*d6b92ffaSHans Petter Selasky {
207*d6b92ffaSHans Petter Selasky switch(be16toh(attr_id)) {
208*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_NODE_DESC:
209*d6b92ffaSHans Petter Selasky return ("NodeDescription");
210*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_NODE_INFO:
211*d6b92ffaSHans Petter Selasky return ("NodeInfo");
212*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_SWITCH_INFO:
213*d6b92ffaSHans Petter Selasky return ("SwitchInfo");
214*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_GUID_INFO:
215*d6b92ffaSHans Petter Selasky return ("GUIDInfo");
216*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_PORT_INFO:
217*d6b92ffaSHans Petter Selasky return ("PortInfo");
218*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_PKEY_TABLE:
219*d6b92ffaSHans Petter Selasky return ("P_KeyTable");
220*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_SLVL_TABLE:
221*d6b92ffaSHans Petter Selasky return ("SLtoVLMappingTable");
222*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_VL_ARB_TABLE:
223*d6b92ffaSHans Petter Selasky return ("VLArbitrationTable");
224*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_LINEAR_FT:
225*d6b92ffaSHans Petter Selasky return ("LinearForwardingTable");
226*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_RANDOM_FT:
227*d6b92ffaSHans Petter Selasky return ("RandomForwardingTable");
228*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_MCAST_FT:
229*d6b92ffaSHans Petter Selasky return ("MulticastForwardingTable");
230*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_SM_INFO:
231*d6b92ffaSHans Petter Selasky return ("SMInfo");
232*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_VENDOR_DIAG:
233*d6b92ffaSHans Petter Selasky return ("VendorDiag");
234*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_LED_INFO:
235*d6b92ffaSHans Petter Selasky return ("LedInfo");
236*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_LINK_SPD_WIDTH_TABLE:
237*d6b92ffaSHans Petter Selasky return ("LinkSpeedWidthPairsTable");
238*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_VENDOR_MADS_TABLE:
239*d6b92ffaSHans Petter Selasky return ("VendorSpecificMadsTable");
240*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_HIERARCHY_INFO:
241*d6b92ffaSHans Petter Selasky return ("HierarchyInfo");
242*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_CABLE_INFO:
243*d6b92ffaSHans Petter Selasky return ("CableInfo");
244*d6b92ffaSHans Petter Selasky case UMAD_SM_ATTR_PORT_INFO_EXT:
245*d6b92ffaSHans Petter Selasky return ("PortInfoExtended");
246*d6b92ffaSHans Petter Selasky default:
247*d6b92ffaSHans Petter Selasky return (umad_common_attr_str(attr_id));
248*d6b92ffaSHans Petter Selasky }
249*d6b92ffaSHans Petter Selasky }
250*d6b92ffaSHans Petter Selasky
umad_sa_attr_str(__be16 attr_id)251*d6b92ffaSHans Petter Selasky static const char * umad_sa_attr_str(__be16 attr_id)
252*d6b92ffaSHans Petter Selasky {
253*d6b92ffaSHans Petter Selasky switch(be16toh(attr_id)) {
254*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_NODE_REC:
255*d6b92ffaSHans Petter Selasky return ("NodeRecord");
256*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_PORT_INFO_REC:
257*d6b92ffaSHans Petter Selasky return ("PortInfoRecord");
258*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_SLVL_REC:
259*d6b92ffaSHans Petter Selasky return ("SLtoVLMappingTableRecord");
260*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_SWITCH_INFO_REC:
261*d6b92ffaSHans Petter Selasky return ("SwitchInfoRecord");
262*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_LINEAR_FT_REC:
263*d6b92ffaSHans Petter Selasky return ("LinearForwardingTableRecord");
264*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_RANDOM_FT_REC:
265*d6b92ffaSHans Petter Selasky return ("RandomForwardingTableRecord");
266*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_MCAST_FT_REC:
267*d6b92ffaSHans Petter Selasky return ("MulticastForwardingTableRecord");
268*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_SM_INFO_REC:
269*d6b92ffaSHans Petter Selasky return ("SMInfoRecord");
270*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_INFORM_INFO_REC:
271*d6b92ffaSHans Petter Selasky return ("InformInfoRecord");
272*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_LINK_REC:
273*d6b92ffaSHans Petter Selasky return ("LinkRecord");
274*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_GUID_INFO_REC:
275*d6b92ffaSHans Petter Selasky return ("GuidInfoRecord");
276*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_SERVICE_REC:
277*d6b92ffaSHans Petter Selasky return ("ServiceRecord");
278*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_PKEY_TABLE_REC:
279*d6b92ffaSHans Petter Selasky return ("P_KeyTableRecord");
280*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_PATH_REC:
281*d6b92ffaSHans Petter Selasky return ("PathRecord");
282*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_VL_ARB_REC:
283*d6b92ffaSHans Petter Selasky return ("VLArbitrationTableRecord");
284*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_MCMEMBER_REC:
285*d6b92ffaSHans Petter Selasky return ("MCMemberRecord");
286*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_TRACE_REC:
287*d6b92ffaSHans Petter Selasky return ("TraceRecord");
288*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_MULTI_PATH_REC:
289*d6b92ffaSHans Petter Selasky return ("MultiPathRecord");
290*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_SERVICE_ASSOC_REC:
291*d6b92ffaSHans Petter Selasky return ("ServiceAssociationRecord");
292*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_LINK_SPD_WIDTH_TABLE_REC:
293*d6b92ffaSHans Petter Selasky return ("LinkSpeedWidthPairsTableRecord");
294*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_HIERARCHY_INFO_REC:
295*d6b92ffaSHans Petter Selasky return ("HierarchyInfoRecord");
296*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_CABLE_INFO_REC:
297*d6b92ffaSHans Petter Selasky return ("CableInfoRecord");
298*d6b92ffaSHans Petter Selasky case UMAD_SA_ATTR_PORT_INFO_EXT_REC:
299*d6b92ffaSHans Petter Selasky return ("PortInfoExtendedRecord");
300*d6b92ffaSHans Petter Selasky default:
301*d6b92ffaSHans Petter Selasky return (umad_common_attr_str(attr_id));
302*d6b92ffaSHans Petter Selasky }
303*d6b92ffaSHans Petter Selasky }
304*d6b92ffaSHans Petter Selasky
umad_cm_attr_str(__be16 attr_id)305*d6b92ffaSHans Petter Selasky static const char * umad_cm_attr_str(__be16 attr_id)
306*d6b92ffaSHans Petter Selasky {
307*d6b92ffaSHans Petter Selasky switch(be16toh(attr_id)) {
308*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_REQ:
309*d6b92ffaSHans Petter Selasky return "ConnectRequest";
310*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_MRA:
311*d6b92ffaSHans Petter Selasky return "MsgRcptAck";
312*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_REJ:
313*d6b92ffaSHans Petter Selasky return "ConnectReject";
314*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_REP:
315*d6b92ffaSHans Petter Selasky return "ConnectReply";
316*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_RTU:
317*d6b92ffaSHans Petter Selasky return "ReadyToUse";
318*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_DREQ:
319*d6b92ffaSHans Petter Selasky return "DisconnectRequest";
320*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_DREP:
321*d6b92ffaSHans Petter Selasky return "DisconnectReply";
322*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_SIDR_REQ:
323*d6b92ffaSHans Petter Selasky return "ServiceIDResReq";
324*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_SIDR_REP:
325*d6b92ffaSHans Petter Selasky return "ServiceIDResReqResp";
326*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_LAP:
327*d6b92ffaSHans Petter Selasky return "LoadAlternatePath";
328*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_APR:
329*d6b92ffaSHans Petter Selasky return "AlternatePathResponse";
330*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_SAP:
331*d6b92ffaSHans Petter Selasky return "SuggestAlternatePath";
332*d6b92ffaSHans Petter Selasky case UMAD_CM_ATTR_SPR:
333*d6b92ffaSHans Petter Selasky return "SuggestPathResponse";
334*d6b92ffaSHans Petter Selasky default:
335*d6b92ffaSHans Petter Selasky return (umad_common_attr_str(attr_id));
336*d6b92ffaSHans Petter Selasky }
337*d6b92ffaSHans Petter Selasky }
338*d6b92ffaSHans Petter Selasky
umad_attribute_str(uint8_t mgmt_class,__be16 attr_id)339*d6b92ffaSHans Petter Selasky const char * umad_attribute_str(uint8_t mgmt_class, __be16 attr_id)
340*d6b92ffaSHans Petter Selasky {
341*d6b92ffaSHans Petter Selasky switch (mgmt_class) {
342*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_LID_ROUTED:
343*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_DIRECTED_ROUTE:
344*d6b92ffaSHans Petter Selasky return(umad_sm_attr_str(attr_id));
345*d6b92ffaSHans Petter Selasky case UMAD_CLASS_SUBN_ADM:
346*d6b92ffaSHans Petter Selasky return(umad_sa_attr_str(attr_id));
347*d6b92ffaSHans Petter Selasky case UMAD_CLASS_CM:
348*d6b92ffaSHans Petter Selasky return(umad_cm_attr_str(attr_id));
349*d6b92ffaSHans Petter Selasky }
350*d6b92ffaSHans Petter Selasky
351*d6b92ffaSHans Petter Selasky return (umad_common_attr_str(attr_id));
352*d6b92ffaSHans Petter Selasky }
353