1/*
2 * Copyright (c) 2004-2014 Mellanox Technologies Ltd.  All rights reserved.
3 * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
4 * Copyright (c) 2004 Intel Corporation.  All rights reserved.
5 * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
7 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
8 *
9 * This software is available to you under a choice of one of two
10 * licenses.  You may choose to be licensed under the terms of the GNU
11 * General Public License (GPL) Version 2, available from the file
12 * COPYING in the main directory of this source tree, or the
13 * OpenIB.org BSD license below:
14 *
15 *     Redistribution and use in source and binary forms, with or
16 *     without modification, are permitted provided that the following
17 *     conditions are met:
18 *
19 *      - Redistributions of source code must retain the above
20 *        copyright notice, this list of conditions and the following
21 *        disclaimer.
22 *
23 *      - Redistributions in binary form must reproduce the above
24 *        copyright notice, this list of conditions and the following
25 *        disclaimer in the documentation and/or other materials
26 *        provided with the distribution.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
32 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
33 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
34 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 * SOFTWARE.
36 */
37
38#ifndef _UMAD_SM_H
39#define _UMAD_SM_H
40
41#include <infiniband/umad_types.h>
42
43#ifdef __cplusplus
44#  define BEGIN_C_DECLS extern "C" {
45#  define END_C_DECLS   }
46#else				/* !__cplusplus */
47#  define BEGIN_C_DECLS
48#  define END_C_DECLS
49#endif				/* __cplusplus */
50
51BEGIN_C_DECLS
52
53enum {
54	UMAD_SMP_DIRECTION		= 0x8000,
55};
56
57/* Subnet management attributes */
58enum {
59	UMAD_SM_ATTR_NODE_DESC			= 0x0010,
60	UMAD_SM_ATTR_NODE_INFO			= 0x0011,
61	UMAD_SM_ATTR_SWITCH_INFO		= 0x0012,
62	UMAD_SM_ATTR_GUID_INFO			= 0x0014,
63	UMAD_SM_ATTR_PORT_INFO			= 0x0015,
64	UMAD_SM_ATTR_PKEY_TABLE			= 0x0016,
65	UMAD_SM_ATTR_SLVL_TABLE			= 0x0017,
66	UMAD_SM_ATTR_VL_ARB_TABLE		= 0x0018,
67	UMAD_SM_ATTR_LINEAR_FT			= 0x0019,
68	UMAD_SM_ATTR_RANDOM_FT			= 0x001A,
69	UMAD_SM_ATTR_MCAST_FT			= 0x001B,
70	UMAD_SM_ATTR_LINK_SPD_WIDTH_TABLE	= 0x001C,
71	UMAD_SM_ATTR_VENDOR_MADS_TABLE		= 0x001D,
72	UMAD_SM_ATTR_HIERARCHY_INFO		= 0x001E,
73	UMAD_SM_ATTR_SM_INFO			= 0x0020,
74	UMAD_SM_ATTR_VENDOR_DIAG		= 0x0030,
75	UMAD_SM_ATTR_LED_INFO			= 0x0031,
76	UMAD_SM_ATTR_CABLE_INFO			= 0x0032,
77	UMAD_SM_ATTR_PORT_INFO_EXT		= 0x0033,
78	UMAD_SM_ATTR_VENDOR_MASK		= 0xFF00,
79	UMAD_SM_ATTR_MLNX_EXT_PORT_INFO		= 0xFF90
80};
81
82enum {
83	UMAD_SM_GID_IN_SERVICE_TRAP		= 64,
84	UMAD_SM_GID_OUT_OF_SERVICE_TRAP		= 65,
85	UMAD_SM_MGID_CREATED_TRAP		= 66,
86	UMAD_SM_MGID_DESTROYED_TRAP		= 67,
87	UMAD_SM_UNPATH_TRAP			= 68,
88	UMAD_SM_REPATH_TRAP			= 69,
89	UMAD_SM_LINK_STATE_CHANGED_TRAP		= 128,
90	UMAD_SM_LINK_INTEGRITY_THRESHOLD_TRAP	= 129,
91	UMAD_SM_BUFFER_OVERRUN_THRESHOLD_TRAP	= 130,
92	UMAD_SM_WATCHDOG_TIMER_EXPIRED_TRAP	= 131,
93	UMAD_SM_LOCAL_CHANGES_TRAP		= 144,
94	UMAD_SM_SYS_IMG_GUID_CHANGED_TRAP	= 145,
95	UMAD_SM_BAD_MKEY_TRAP			= 256,
96	UMAD_SM_BAD_PKEY_TRAP			= 257,
97	UMAD_SM_BAD_QKEY_TRAP			= 258,
98	UMAD_SM_BAD_SWITCH_PKEY_TRAP		= 259
99};
100
101enum {
102	UMAD_LEN_SMP_DATA		= 64,
103	UMAD_SMP_MAX_HOPS		= 64
104};
105
106struct umad_smp {
107	uint8_t	 base_version;
108	uint8_t	 mgmt_class;
109	uint8_t	 class_version;
110	uint8_t	 method;
111	__be16   status;
112	uint8_t  hop_ptr;
113	uint8_t  hop_cnt;
114	__be64   tid;
115	__be16   attr_id;
116	__be16   resv;
117	__be32   attr_mod;
118	__be64   mkey;
119	__be16   dr_slid;
120	__be16   dr_dlid;
121	uint8_t  reserved[28];
122	uint8_t  data[UMAD_LEN_SMP_DATA];
123	uint8_t  initial_path[UMAD_SMP_MAX_HOPS];
124	uint8_t  return_path[UMAD_SMP_MAX_HOPS];
125};
126
127END_C_DECLS
128#endif				/* _UMAD_SM_H */
129