2 * Copyright (c) 2004-2007 Voltaire Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40 # define BEGIN_C_DECLS extern "C" {
41 # define END_C_DECLS }
42 #else /* !__cplusplus */
43 # define BEGIN_C_DECLS
45 #endif /* __cplusplus */
49 #define IB_SUBNET_PATH_HOPS_MAX 64
50 #define IB_DEFAULT_SUBN_PREFIX 0xfe80000000000000llu
51 #define IB_DEFAULT_QP1_QKEY 0x80010000
53 #define IB_MAD_SIZE 256
55 #define IB_SMP_DATA_OFFS 64
56 #define IB_SMP_DATA_SIZE 64
58 #define IB_VENDOR_RANGE1_DATA_OFFS 24
59 #define IB_VENDOR_RANGE1_DATA_SIZE (IB_MAD_SIZE - IB_VENDOR_RANGE1_DATA_OFFS)
61 #define IB_VENDOR_RANGE2_DATA_OFFS 40
62 #define IB_VENDOR_RANGE2_DATA_SIZE (IB_MAD_SIZE - IB_VENDOR_RANGE2_DATA_OFFS)
64 #define IB_SA_DATA_SIZE 200
65 #define IB_SA_DATA_OFFS 56
67 #define IB_PC_DATA_OFFS 64
68 #define IB_PC_DATA_SZ (IB_MAD_SIZE - IB_PC_DATA_OFFS)
70 #define IB_SA_MCM_RECSZ 53
71 #define IB_SA_PR_RECSZ 64
75 IB_SMI_DIRECT_CLASS = 0x81,
77 IB_PERFORMANCE_CLASS = 0x4,
78 IB_BOARD_MGMT_CLASS = 0x5,
79 IB_DEVICE_MGMT_CLASS = 0x6,
82 IB_VENDOR_RANGE1_START_CLASS = 0x9,
83 IB_VENDOR_RANGE1_END_CLASS = 0x0f,
85 IB_VENDOR_RANGE2_START_CLASS = 0x30,
86 IB_VENDOR_RANGE2_END_CLASS = 0x4f,
90 IB_MAD_METHOD_GET = 0x1,
91 IB_MAD_METHOD_SET = 0x2,
92 IB_MAD_METHOD_GET_RESPONSE = 0x81,
94 IB_MAD_METHOD_SEND = 0x3,
95 IB_MAD_METHOD_TRAP = 0x5,
96 IB_MAD_METHOD_TRAP_REPRESS = 0x7,
98 IB_MAD_METHOD_REPORT = 0x6,
99 IB_MAD_METHOD_REPORT_RESPONSE = 0x86,
100 IB_MAD_METHOD_GET_TABLE = 0x12,
101 IB_MAD_METHOD_GET_TABLE_RESPONSE = 0x92,
102 IB_MAD_METHOD_GET_TRACE_TABLE = 0x13,
103 IB_MAD_METHOD_GET_TRACE_TABLE_RESPONSE = 0x93,
104 IB_MAD_METHOD_GETMULTI = 0x14,
105 IB_MAD_METHOD_GETMULTI_RESPONSE = 0x94,
106 IB_MAD_METHOD_DELETE = 0x15,
107 IB_MAD_METHOD_DELETE_RESPONSE = 0x95,
109 IB_MAD_RESPONSE = 0x80,
113 CLASS_PORT_INFO = 0x1,
119 IB_ATTR_NODE_DESC = 0x10,
120 IB_ATTR_NODE_INFO = 0x11,
121 IB_ATTR_SWITCH_INFO = 0x12,
122 IB_ATTR_GUID_INFO = 0x14,
123 IB_ATTR_PORT_INFO = 0x15,
124 IB_ATTR_PKEY_TBL = 0x16,
125 IB_ATTR_SLVL_TABLE = 0x17,
126 IB_ATTR_VL_ARBITRATION = 0x18,
127 IB_ATTR_LINEARFORWTBL = 0x19,
128 IB_ATTR_MULTICASTFORWTBL = 0x1b,
129 IB_ATTR_SMINFO = 0x20,
135 IB_SA_ATTR_NOTICE = 0x02,
136 IB_SA_ATTR_INFORMINFO = 0x03,
137 IB_SA_ATTR_PORTINFORECORD = 0x12,
138 IB_SA_ATTR_LINKRECORD = 0x20,
139 IB_SA_ATTR_SERVICERECORD = 0x31,
140 IB_SA_ATTR_PATHRECORD = 0x35,
141 IB_SA_ATTR_MCRECORD = 0x38,
142 IB_SA_ATTR_MULTIPATH = 0x3a,
148 IB_GSI_PORT_SAMPLES_CONTROL = 0x10,
149 IB_GSI_PORT_SAMPLES_RESULT = 0x11,
150 IB_GSI_PORT_COUNTERS = 0x12,
151 IB_GSI_PORT_COUNTERS_EXT = 0x1D,
156 #define IB_VENDOR_OPENIB_PING_CLASS (IB_VENDOR_RANGE2_START_CLASS + 2)
157 #define IB_VENDOR_OPENIB_SYSSTAT_CLASS (IB_VENDOR_RANGE2_START_CLASS + 3)
158 #define IB_OPENIB_OUI (0x001405)
160 typedef uint8_t ibmad_gid_t[16];
161 #ifdef USE_DEPRECATED_IB_GID_T
162 typedef ibmad_gid_t ib_gid_t __attribute__((deprecated));
167 uint8_t p[IB_SUBNET_PATH_HOPS_MAX];
181 uint32_t rstatus; /* return status */
185 uint64_t trid; /* used for out mad if nonzero, return real val */
186 uint64_t mask; /* for sa mads */
187 unsigned recsz; /* for sa mads (attribute offset) */
189 uint32_t oui; /* for vendor range 2 mads */
192 typedef struct portid {
193 int lid; /* lid or 0 if directed route */
195 int grh_present; /* flag */
203 typedef void (ib_mad_dump_fn)(char *buf, int bufsz, void *val, int valsz);
205 #define IB_FIELD_NAME_LEN 32
207 typedef struct ib_field {
210 char name[IB_FIELD_NAME_LEN];
211 ib_mad_dump_fn *def_dump_fn;
220 /* first MAD word (0-3 bytes) */
227 /* second MAD word (4-7 bytes) */
234 IB_DRSMP_DIRECTION_F,
236 /* words 3,4,5,6 (8-23 bytes) */
241 /* word 7,8 (24-31 bytes) */
244 /* word 9 (32-37 bytes) */
248 /* word 10,11 (36-43 bytes) */
251 /* word 12 (44-47 bytes) */
254 /* word 13,14 (48-55 bytes) */
257 /* word 13,14 (56-255 bytes) */
266 /* bytes 128 - 191 */
269 /* bytes 192 - 255 */
276 IB_PORT_MKEY_F = IB_PORT_FIRST_F,
277 IB_PORT_GID_PREFIX_F,
282 IB_PORT_MKEY_LEASE_F,
283 IB_PORT_LOCAL_PORT_F,
284 IB_PORT_LINK_WIDTH_ENABLED_F,
285 IB_PORT_LINK_WIDTH_SUPPORTED_F,
286 IB_PORT_LINK_WIDTH_ACTIVE_F,
287 IB_PORT_LINK_SPEED_SUPPORTED_F,
289 IB_PORT_PHYS_STATE_F,
290 IB_PORT_LINK_DOWN_DEF_F,
291 IB_PORT_MKEY_PROT_BITS_F,
293 IB_PORT_LINK_SPEED_ACTIVE_F,
294 IB_PORT_LINK_SPEED_ENABLED_F,
295 IB_PORT_NEIGHBOR_MTU_F,
299 IB_PORT_VL_HIGH_LIMIT_F,
300 IB_PORT_VL_ARBITRATION_HIGH_CAP_F,
301 IB_PORT_VL_ARBITRATION_LOW_CAP_F,
302 IB_PORT_INIT_TYPE_REPLY_F,
304 IB_PORT_VL_STALL_COUNT_F,
307 IB_PORT_PART_EN_INB_F,
308 IB_PORT_PART_EN_OUTB_F,
309 IB_PORT_FILTER_RAW_INB_F,
310 IB_PORT_FILTER_RAW_OUTB_F,
315 IB_PORT_CLIENT_REREG_F,
316 IB_PORT_SUBN_TIMEOUT_F,
317 IB_PORT_RESP_TIME_VAL_F,
318 IB_PORT_LOCAL_PHYS_ERR_F,
319 IB_PORT_OVERRUN_ERR_F,
320 IB_PORT_MAX_CREDIT_HINT_F,
321 IB_PORT_LINK_ROUND_TRIP_F,
328 IB_NODE_BASE_VERS_F = IB_NODE_FIRST_F,
329 IB_NODE_CLASS_VERS_F,
332 IB_NODE_SYSTEM_GUID_F,
335 IB_NODE_PARTITION_CAP_F,
338 IB_NODE_LOCAL_PORT_F,
346 IB_SW_LINEAR_FDB_CAP_F = IB_SW_FIRST_F,
347 IB_SW_RANDOM_FDB_CAP_F,
348 IB_SW_MCAST_FDB_CAP_F,
349 IB_SW_LINEAR_FDB_TOP_F,
351 IB_SW_DEF_MCAST_PRIM_F,
352 IB_SW_DEF_MCAST_NOT_PRIM_F,
354 IB_SW_STATE_CHANGE_F,
355 IB_SW_LIDS_PER_PORT_F,
356 IB_SW_PARTITION_ENFORCE_CAP_F,
357 IB_SW_PARTITION_ENF_INB_F,
358 IB_SW_PARTITION_ENF_OUTB_F,
359 IB_SW_FILTER_RAW_INB_F,
360 IB_SW_FILTER_RAW_OUTB_F,
361 IB_SW_ENHANCED_PORT0_F,
365 * SwitchLinearForwardingTable fields:
367 IB_LINEAR_FORW_TBL_F,
370 * SwitchMulticastForwardingTable fields:
372 IB_MULTICAST_FORW_TBL_F,
375 * NodeDescription fields:
382 IB_NOTICE_IS_GENERIC_F,
384 IB_NOTICE_PRODUCER_F,
385 IB_NOTICE_TRAP_NUMBER_F,
386 IB_NOTICE_ISSUER_LID_F,
389 IB_NOTICE_DATA_DETAILS_F,
390 IB_NOTICE_DATA_LID_F,
391 IB_NOTICE_DATA_144_LID_F,
392 IB_NOTICE_DATA_144_CAPMASK_F,
398 IB_PC_PORT_SELECT_F = IB_PC_FIRST_F,
399 IB_PC_COUNTER_SELECT_F,
401 IB_PC_LINK_RECOVERS_F,
405 IB_PC_ERR_SWITCH_REL_F,
406 IB_PC_XMT_DISCARDS_F,
407 IB_PC_ERR_XMTCONSTR_F,
408 IB_PC_ERR_RCVCONSTR_F,
409 IB_PC_ERR_LOCALINTEG_F,
410 IB_PC_ERR_EXCESS_OVR_F,
411 IB_PC_VL15_DROPPED_F,
441 IB_SA_RMPP_LEN_F, /* DATA: Payload len */
442 IB_SA_RMPP_NEWWIN_F, /* ACK: new window last */
473 IB_SA_MCM_FLOW_LABEL_F,
474 IB_SA_MCM_JOIN_STATE_F,
475 IB_SA_MCM_PROXY_JOIN_F,
489 * ATS SM record - within SA_SR_DATA
491 IB_ATS_SM_NODE_ADDR_F,
492 IB_ATS_SM_MAGIC_KEY_F,
493 IB_ATS_SM_NODE_TYPE_F,
494 IB_ATS_SM_NODE_NAME_F,
497 * SLTOVL MAPPING TABLE
499 IB_SLTOVL_MAPPING_TABLE_F,
502 * VL ARBITRATION TABLE
504 IB_VL_ARBITRATION_TABLE_F,
507 * IB vendor class range 2
513 * PortCountersExtended
516 IB_PC_EXT_PORT_SELECT_F = IB_PC_EXT_FIRST_F,
517 IB_PC_EXT_COUNTER_SELECT_F,
518 IB_PC_EXT_XMT_BYTES_F,
519 IB_PC_EXT_RCV_BYTES_F,
520 IB_PC_EXT_XMT_PKTS_F,
521 IB_PC_EXT_RCV_PKTS_F,
522 IB_PC_EXT_XMT_UPKTS_F,
523 IB_PC_EXT_RCV_UPKTS_F,
524 IB_PC_EXT_XMT_MPKTS_F,
525 IB_PC_EXT_RCV_MPKTS_F,
533 IB_FIELD_LAST_ /* must be last */
539 enum RMPP_TYPE_ENUM {
547 enum RMPP_FLAGS_ENUM {
548 IB_RMPP_FLAG_ACTIVE = 1 << 0,
549 IB_RMPP_FLAG_FIRST = 1 << 1,
550 IB_RMPP_FLAG_LAST = 1 << 2,
572 typedef struct ib_sa_call {
578 uint64_t trid; /* used for out mad if nonzero, return real val */
579 unsigned recsz; /* return field */
583 typedef struct ib_vendor_call {
593 #define IB_MIN_UCAST_LID 1
594 #define IB_MAX_UCAST_LID (0xc000-1)
595 #define IB_MIN_MCAST_LID 0xc000
596 #define IB_MAX_MCAST_LID (0xffff-1)
598 #define IB_LID_VALID(lid) ((lid) >= IB_MIN_UCAST_LID && lid <= IB_MAX_UCAST_LID)
599 #define IB_MLID_VALID(lid) ((lid) >= IB_MIN_MCAST_LID && lid <= IB_MAX_MCAST_LID)
601 #define MAD_DEF_RETRIES 3
602 #define MAD_DEF_TIMEOUT_MS 1000
617 IB_NODE_MAX = NODE_RNIC
620 /******************************************************************************/
623 char * portid2str(ib_portid_t *portid);
624 int portid2portnum(ib_portid_t *portid);
625 int str2drpath(ib_dr_path_t *path, char *routepath, int drslid, int drdlid);
626 char * drpath2str(ib_dr_path_t *path, char *dstr, size_t dstr_size);
629 ib_portid_set(ib_portid_t *portid, int lid, int qp, int qkey)
634 portid->grh_present = 0;
640 extern ib_field_t ib_mad_f[];
642 void _set_field(void *buf, int base_offs, ib_field_t *f, uint32_t val);
643 uint32_t _get_field(void *buf, int base_offs, ib_field_t *f);
644 void _set_array(void *buf, int base_offs, ib_field_t *f, void *val);
645 void _get_array(void *buf, int base_offs, ib_field_t *f, void *val);
646 void _set_field64(void *buf, int base_offs, ib_field_t *f, uint64_t val);
647 uint64_t _get_field64(void *buf, int base_offs, ib_field_t *f);
650 static inline uint32_t
651 mad_get_field(void *buf, int base_offs, int field)
653 return _get_field(buf, base_offs, ib_mad_f + field);
657 mad_set_field(void *buf, int base_offs, int field, uint32_t val)
659 _set_field(buf, base_offs, ib_mad_f + field, val);
662 /* field must be byte aligned */
663 static inline uint64_t
664 mad_get_field64(void *buf, int base_offs, int field)
666 return _get_field64(buf, base_offs, ib_mad_f + field);
670 mad_set_field64(void *buf, int base_offs, int field, uint64_t val)
672 _set_field64(buf, base_offs, ib_mad_f + field, val);
676 mad_set_array(void *buf, int base_offs, int field, void *val)
678 _set_array(buf, base_offs, ib_mad_f + field, val);
682 mad_get_array(void *buf, int base_offs, int field, void *val)
684 _get_array(buf, base_offs, ib_mad_f + field, val);
687 void mad_decode_field(uint8_t *buf, int field, void *val);
688 void mad_encode_field(uint8_t *buf, int field, void *val);
689 void * mad_encode(void *buf, ib_rpc_t *rpc, ib_dr_path_t *drpath, void *data);
690 uint64_t mad_trid(void);
691 int mad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, ib_rmpp_hdr_t *rmpp, void *data);
694 int mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version);
695 int mad_register_client(int mgmt, uint8_t rmpp_version);
696 int mad_register_server(int mgmt, uint8_t rmpp_version,
697 long method_mask[16/sizeof(long)],
699 int mad_class_agent(int mgmt);
700 int mad_agent_class(int agent);
703 int mad_send(ib_rpc_t *rpc, ib_portid_t *dport, ib_rmpp_hdr_t *rmpp,
705 void * mad_receive(void *umad, int timeout);
706 int mad_respond(void *umad, ib_portid_t *portid, uint32_t rstatus);
707 void * mad_alloc(void);
708 void mad_free(void *umad);
711 uint8_t *ib_vendor_call(void *data, ib_portid_t *portid,
712 ib_vendor_call_t *call);
715 mad_is_vendor_range1(int mgmt)
717 return mgmt >= 0x9 && mgmt <= 0xf;
721 mad_is_vendor_range2(int mgmt)
723 return mgmt >= 0x30 && mgmt <= 0x4f;
727 int madrpc_portid(void);
728 int madrpc_set_retries(int retries);
729 int madrpc_set_timeout(int timeout);
730 void * madrpc(ib_rpc_t *rpc, ib_portid_t *dport, void *payload, void *rcvdata);
731 void * madrpc_rmpp(ib_rpc_t *rpc, ib_portid_t *dport, ib_rmpp_hdr_t *rmpp,
733 void madrpc_init(char *dev_name, int dev_port, int *mgmt_classes,
735 void madrpc_save_mad(void *madbuf, int len);
736 void madrpc_lock(void);
737 void madrpc_unlock(void);
738 void madrpc_show_errors(int set);
740 void * mad_rpc_open_port(char *dev_name, int dev_port, int *mgmt_classes,
742 void mad_rpc_close_port(void *ibmad_port);
743 void * mad_rpc(const void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport,
744 void *payload, void *rcvdata);
745 void * mad_rpc_rmpp(const void *ibmad_port, ib_rpc_t *rpc, ib_portid_t *dport,
746 ib_rmpp_hdr_t *rmpp, void *data);
749 uint8_t * smp_query(void *buf, ib_portid_t *id, unsigned attrid, unsigned mod,
751 uint8_t * smp_set(void *buf, ib_portid_t *id, unsigned attrid, unsigned mod,
753 uint8_t * smp_query_via(void *buf, ib_portid_t *id, unsigned attrid,
754 unsigned mod, unsigned timeout, const void *srcport);
755 uint8_t * smp_set_via(void *buf, ib_portid_t *id, unsigned attrid, unsigned mod,
756 unsigned timeout, const void *srcport);
758 inline static uint8_t *
759 safe_smp_query(void *rcvbuf, ib_portid_t *portid, unsigned attrid, unsigned mod,
765 p = smp_query(rcvbuf, portid, attrid, mod, timeout);
771 inline static uint8_t *
772 safe_smp_set(void *rcvbuf, ib_portid_t *portid, unsigned attrid, unsigned mod,
778 p = smp_set(rcvbuf, portid, attrid, mod, timeout);
785 uint8_t * sa_call(void *rcvbuf, ib_portid_t *portid, ib_sa_call_t *sa,
787 uint8_t * sa_rpc_call(const void *ibmad_port, void *rcvbuf, ib_portid_t *portid,
788 ib_sa_call_t *sa, unsigned timeout);
789 int ib_path_query(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t *sm_id,
790 void *buf); /* returns lid */
791 int ib_path_query_via(const void *srcport, ibmad_gid_t srcgid,
792 ibmad_gid_t destgid, ib_portid_t *sm_id, void *buf);
794 inline static uint8_t *
795 safe_sa_call(void *rcvbuf, ib_portid_t *portid, ib_sa_call_t *sa,
801 p = sa_call(rcvbuf, portid, sa, timeout);
808 int ib_resolve_smlid(ib_portid_t *sm_id, int timeout);
809 int ib_resolve_guid(ib_portid_t *portid, uint64_t *guid,
810 ib_portid_t *sm_id, int timeout);
811 int ib_resolve_portid_str(ib_portid_t *portid, char *addr_str,
812 int dest_type, ib_portid_t *sm_id);
813 int ib_resolve_self(ib_portid_t *portid, int *portnum, ibmad_gid_t *gid);
815 int ib_resolve_smlid_via(ib_portid_t *sm_id, int timeout,
816 const void *srcport);
817 int ib_resolve_guid_via(ib_portid_t *portid, uint64_t *guid,
818 ib_portid_t *sm_id, int timeout,
819 const void *srcport);
820 int ib_resolve_portid_str_via(ib_portid_t *portid, char *addr_str,
821 int dest_type, ib_portid_t *sm_id,
822 const void *srcport);
823 int ib_resolve_self_via(ib_portid_t *portid, int *portnum, ibmad_gid_t *gid,
824 const void *srcport);
827 uint8_t *perf_classportinfo_query(void *rcvbuf, ib_portid_t *dest, int port,
829 uint8_t *port_performance_query(void *rcvbuf, ib_portid_t *dest, int port,
831 uint8_t *port_performance_reset(void *rcvbuf, ib_portid_t *dest, int port,
832 unsigned mask, unsigned timeout);
833 uint8_t *port_performance_ext_query(void *rcvbuf, ib_portid_t *dest, int port,
835 uint8_t *port_performance_ext_reset(void *rcvbuf, ib_portid_t *dest, int port,
836 unsigned mask, unsigned timeout);
837 uint8_t *port_samples_control_query(void *rcvbuf, ib_portid_t *dest, int port,
839 uint8_t *port_samples_result_query(void *rcvbuf, ib_portid_t *dest, int port,
842 uint8_t *perf_classportinfo_query_via(void *rcvbuf, ib_portid_t *dest, int port,
843 unsigned timeout, const void *srcport);
844 uint8_t *port_performance_query_via(void *rcvbuf, ib_portid_t *dest, int port,
845 unsigned timeout, const void *srcport);
846 uint8_t *port_performance_reset_via(void *rcvbuf, ib_portid_t *dest, int port,
847 unsigned mask, unsigned timeout, const void *srcport);
848 uint8_t *port_performance_ext_query_via(void *rcvbuf, ib_portid_t *dest, int port,
849 unsigned timeout, const void *srcport);
850 uint8_t *port_performance_ext_reset_via(void *rcvbuf, ib_portid_t *dest, int port,
851 unsigned mask, unsigned timeout, const void *srcport);
852 uint8_t *port_samples_control_query_via(void *rcvbuf, ib_portid_t *dest, int port,
853 unsigned timeout, const void *srcport);
854 uint8_t *port_samples_result_query_via(void *rcvbuf, ib_portid_t *dest, int port,
855 unsigned timeout, const void *srcport);
858 mad_dump_int, mad_dump_uint, mad_dump_hex, mad_dump_rhex,
859 mad_dump_bitfield, mad_dump_array, mad_dump_string,
860 mad_dump_linkwidth, mad_dump_linkwidthsup, mad_dump_linkwidthen,
861 mad_dump_linkdowndefstate,
862 mad_dump_linkspeed, mad_dump_linkspeedsup, mad_dump_linkspeeden,
863 mad_dump_portstate, mad_dump_portstates,
864 mad_dump_physportstate, mad_dump_portcapmask,
865 mad_dump_mtu, mad_dump_vlcap, mad_dump_opervls,
867 mad_dump_sltovl, mad_dump_vlarbitration,
868 mad_dump_nodedesc, mad_dump_nodeinfo, mad_dump_portinfo, mad_dump_switchinfo,
869 mad_dump_perfcounters, mad_dump_perfcounters_ext;
871 int _mad_dump(ib_mad_dump_fn *fn, char *name, void *val, int valsz);
872 char * _mad_dump_field(ib_field_t *f, char *name, char *buf, int bufsz,
874 int _mad_print_field(ib_field_t *f, char *name, void *val, int valsz);
875 char * _mad_dump_val(ib_field_t *f, char *buf, int bufsz, void *val);
878 mad_print_field(int field, char *name, void *val)
880 if (field <= IB_NO_FIELD || field >= IB_FIELD_LAST_)
882 return _mad_print_field(ib_mad_f + field, name, val, 0);
886 mad_dump_field(int field, char *buf, int bufsz, void *val)
888 if (field <= IB_NO_FIELD || field >= IB_FIELD_LAST_)
890 return _mad_dump_field(ib_mad_f + field, 0, buf, bufsz, val);
894 mad_dump_val(int field, char *buf, int bufsz, void *val)
896 if (field <= IB_NO_FIELD || field >= IB_FIELD_LAST_)
898 return _mad_dump_val(ib_mad_f + field, buf, bufsz, val);