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