xref: /freebsd/contrib/ofed/libibumad/umad_sa.h (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1 /*
2  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3  * Copyright (c) 2005 Voltaire, Inc.  All rights reserved.
4  * Copyright (c) 2006, 2010 Intel Corporation.  All rights reserved.
5  * Copyright (c) 2014 Mellanox Technologies LTD. All rights reserved.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses.  You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * OpenIB.org BSD license below:
12  *
13  *     Redistribution and use in source and binary forms, with or
14  *     without modification, are permitted provided that the following
15  *     conditions are met:
16  *
17  *      - Redistributions of source code must retain the above
18  *        copyright notice, this list of conditions and the following
19  *        disclaimer.
20  *
21  *      - Redistributions in binary form must reproduce the above
22  *        copyright notice, this list of conditions and the following
23  *        disclaimer in the documentation and/or other materials
24  *        provided with the distribution.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33  * SOFTWARE.
34  *
35  */
36 #ifndef _UMAD_SA_H
37 #define _UMAD_SA_H
38 
39 #include <infiniband/umad_types.h>
40 
41 #ifdef __cplusplus
42 #  define BEGIN_C_DECLS extern "C" {
43 #  define END_C_DECLS   }
44 #else				/* !__cplusplus */
45 #  define BEGIN_C_DECLS
46 #  define END_C_DECLS
47 #endif				/* __cplusplus */
48 
49 BEGIN_C_DECLS
50 
51 /* SA specific methods */
52 enum {
53 	UMAD_SA_CLASS_VERSION		= 2,	/* IB spec version 1.1/1.2 */
54 
55 	UMAD_SA_METHOD_GET_TABLE	= 0x12,
56 	UMAD_SA_METHOD_GET_TABLE_RESP	= 0x92,
57 	UMAD_SA_METHOD_DELETE		= 0x15,
58 	UMAD_SA_METHOD_DELETE_RESP	= 0x95,
59 	UMAD_SA_METHOD_GET_MULTI	= 0x14,
60 	UMAD_SA_METHOD_GET_MULTI_RESP	= 0x94,
61 	UMAD_SA_METHOD_GET_TRACE_TABLE	= 0x13
62 };
63 
64 enum {
65 	UMAD_SA_STATUS_SUCCESS		= 0,
66 	UMAD_SA_STATUS_NO_RESOURCES	= 1,
67 	UMAD_SA_STATUS_REQ_INVALID	= 2,
68 	UMAD_SA_STATUS_NO_RECORDS	= 3,
69 	UMAD_SA_STATUS_TOO_MANY_RECORDS	= 4,
70 	UMAD_SA_STATUS_INVALID_GID	= 5,
71 	UMAD_SA_STATUS_INSUF_COMPS	= 6,
72 	UMAD_SA_STATUS_REQ_DENIED	= 7,
73 	UMAD_SA_STATUS_PRI_SUGGESTED	= 8
74 };
75 
76 /* SA attributes */
77 enum {
78 	UMAD_SA_ATTR_NODE_REC		= 0x0011,
79 	UMAD_SA_ATTR_PORT_INFO_REC	= 0x0012,
80 	UMAD_SA_ATTR_SLVL_REC		= 0x0013,
81 	UMAD_SA_ATTR_SWITCH_INFO_REC	= 0x0014,
82 	UMAD_SA_ATTR_LINEAR_FT_REC	= 0x0015,
83 	UMAD_SA_ATTR_RANDOM_FT_REC	= 0x0016,
84 	UMAD_SA_ATTR_MCAST_FT_REC	= 0x0017,
85 	UMAD_SA_ATTR_SM_INFO_REC	= 0x0018,
86 	UMAD_SA_ATTR_LINK_SPD_WIDTH_TABLE_REC = 0x0019,
87 	UMAD_SA_ATTR_INFORM_INFO_REC	= 0x00F3,
88 	UMAD_SA_ATTR_LINK_REC		= 0x0020,
89 	UMAD_SA_ATTR_GUID_INFO_REC	= 0x0030,
90 	UMAD_SA_ATTR_SERVICE_REC	= 0x0031,
91 	UMAD_SA_ATTR_PKEY_TABLE_REC	= 0x0033,
92 	UMAD_SA_ATTR_PATH_REC		= 0x0035,
93 	UMAD_SA_ATTR_VL_ARB_REC		= 0x0036,
94 	UMAD_SA_ATTR_MCMEMBER_REC	= 0x0038,
95 	UMAD_SA_ATTR_TRACE_REC		= 0x0039,
96 	UMAD_SA_ATTR_MULTI_PATH_REC	= 0x003A,
97 	UMAD_SA_ATTR_SERVICE_ASSOC_REC	= 0x003B,
98 	UMAD_SA_ATTR_HIERARCHY_INFO_REC = 0x003C,
99 	UMAD_SA_ATTR_CABLE_INFO_REC	= 0x003D,
100 	UMAD_SA_ATTR_PORT_INFO_EXT_REC	= 0x003E
101 };
102 
103 enum {
104 	UMAD_LEN_SA_DATA		= 200
105 };
106 
107 /* CM bits */
108 enum {
109 	UMAD_SA_CAP_MASK_IS_SUBNET_OPT_REC_SUP              = (1 << 8),
110 	UMAD_SA_CAP_MASK_IS_UD_MCAST_SUP                    = (1 << 9),
111 	UMAD_SA_CAP_MASK_IS_MULTIPATH_SUP                   = (1 << 10),
112 	UMAD_SA_CAP_MASK_IS_REINIT_SUP                      = (1 << 11),
113 	UMAD_SA_CAP_MASK_IS_GID_SCOPED_MULTIPATH_SUP        = (1 << 12),
114 	UMAD_SA_CAP_MASK_IS_PORTINFO_CAP_MASK_MATCH_SUP     = (1 << 13),
115 	UMAD_SA_CAP_MASK_IS_LINK_SPEED_WIDTH_PAIRS_REC_SUP  = (1 << 14),
116 	UMAD_SA_CAP_MASK_IS_PA_SERVICES_SUP                 = (1 << 15)
117 };
118 /* CM2 bits */
119 enum {
120 	UMAD_SA_CAP_MASK2_IS_UNPATH_REPATH_SUP              = (1 << 0),
121 	UMAD_SA_CAP_MASK2_IS_QOS_SUP                        = (1 << 1),
122 	UMAD_SA_CAP_MASK2_IS_REV_PATH_PKEY_MEM_BIT_SUP      = (1 << 2),
123 	UMAD_SA_CAP_MASK2_IS_MCAST_TOP_SUP                  = (1 << 3),
124 	UMAD_SA_CAP_MASK2_IS_HIERARCHY_INFO_SUP             = (1 << 4),
125 	UMAD_SA_CAP_MASK2_IS_ADDITIONAL_GUID_SUP            = (1 << 5),
126 	UMAD_SA_CAP_MASK2_IS_FULL_PORTINFO_REC_SUP          = (1 << 6),
127 	UMAD_SA_CAP_MASK2_IS_EXT_SPEEDS_SUP                 = (1 << 7),
128 	UMAD_SA_CAP_MASK2_IS_MCAST_SERVICE_REC_SUP          = (1 << 8),
129 	UMAD_SA_CAP_MASK2_IS_CABLE_INFO_REC_SUP             = (1 << 9),
130 	UMAD_SA_CAP_MASK2_IS_PORT_INFO_CAPMASK2_MATCH_SUP   = (1 << 10),
131 	UMAD_SA_CAP_MASK2_IS_PORT_INFO_EXT_REC_SUP          = (1 << 11)
132 };
133 
134 /*
135  *  sm_key is not aligned on an 8-byte boundary, so is defined as a byte array
136  */
137 struct umad_sa_packet {
138 	struct umad_hdr		mad_hdr;
139 	struct umad_rmpp_hdr	rmpp_hdr;
140 	uint8_t			sm_key[8]; /* network-byte order */
141 	__be16			attr_offset;
142 	__be16			reserved;
143 	__be64			comp_mask;
144 	uint8_t 		data[UMAD_LEN_SA_DATA]; /* network-byte order */
145 };
146 
147 END_C_DECLS
148 #endif				/* _UMAD_SA_H */
149