2
* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
4
* Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
6
* This software is available to you under a choice of one of two
7
* licenses. You may choose to be licensed under the terms of the GNU
8
* General Public License (GPL) Version 2, available from the file
9
* COPYING in the main directory of this source tree, or the
10
* OpenIB.org BSD license below:
12
* Redistribution and use in source and binary forms, with or
13
* without modification, are permitted provided that the following
16
* - Redistributions of source code must retain the above
17
* copyright notice, this list of conditions and the following
20
* - Redistributions in binary form must reproduce the above
21
* copyright notice, this list of conditions and the following
22
* disclaimer in the documentation and/or other materials
23
* provided with the distribution.
25
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
#include <rdma/ib_pma.h>
37
#define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004)
38
#define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008)
39
#define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C)
40
#define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C)
55
} __attribute__ ((packed));
57
struct ib_mad_notice_attr {
72
__be16 lid; /* where violation happened */
73
u8 port_num; /* where violation happened */
74
} __attribute__ ((packed)) ntc_129_131;
78
__be16 lid; /* LID where change occurred */
80
u8 local_changes; /* low bit - local changes */
81
__be32 new_cap_mask; /* new capability mask */
83
u8 change_flags; /* low 3 bits only */
84
} __attribute__ ((packed)) ntc_144;
88
__be16 lid; /* lid where sys guid changed */
91
} __attribute__ ((packed)) ntc_145;
105
} __attribute__ ((packed)) ntc_256;
112
__be32 sl_qp1; /* SL: high 4 bits */
113
__be32 qp2; /* high 8 bits reserved */
116
} __attribute__ ((packed)) ntc_257_258;
122
* Generic trap/notice types
124
#define IB_NOTICE_TYPE_FATAL 0x80
125
#define IB_NOTICE_TYPE_URGENT 0x81
126
#define IB_NOTICE_TYPE_SECURITY 0x82
127
#define IB_NOTICE_TYPE_SM 0x83
128
#define IB_NOTICE_TYPE_INFO 0x84
131
* Generic trap/notice producers
133
#define IB_NOTICE_PROD_CA cpu_to_be16(1)
134
#define IB_NOTICE_PROD_SWITCH cpu_to_be16(2)
135
#define IB_NOTICE_PROD_ROUTER cpu_to_be16(3)
136
#define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4)
139
* Generic trap/notice numbers
141
#define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
142
#define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
143
#define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
144
#define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
145
#define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
146
#define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
147
#define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
148
#define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
151
* Repress trap/notice flags
153
#define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0)
154
#define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1)
155
#define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2)
156
#define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3)
157
#define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4)
158
#define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5)
159
#define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6)
160
#define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7)
163
* Generic trap/notice other local changes flags (trap 144).
165
#define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */
166
#define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */
167
#define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
170
* Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256).
172
#define IB_NOTICE_TRAP_DR_NOTICE 0x80
173
#define IB_NOTICE_TRAP_DR_TRUNC 0x40
175
struct ib_vl_weight_elem {
176
u8 vl; /* Only low 4 bits, upper 4 bits reserved */
180
#define IB_VLARB_LOWPRI_0_31 1
181
#define IB_VLARB_LOWPRI_32_63 2
182
#define IB_VLARB_HIGHPRI_0_31 3
183
#define IB_VLARB_HIGHPRI_32_63 4
185
#define IB_PMA_PORT_COUNTERS_CONG cpu_to_be16(0xFF00)
187
struct ib_pma_portcounters_cong {
190
__be16 port_check_rate;
191
__be16 symbol_error_counter;
192
u8 link_error_recovery_counter;
193
u8 link_downed_counter;
194
__be16 port_rcv_errors;
195
__be16 port_rcv_remphys_errors;
196
__be16 port_rcv_switch_relay_errors;
197
__be16 port_xmit_discards;
198
u8 port_xmit_constraint_errors;
199
u8 port_rcv_constraint_errors;
201
u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
204
__be64 port_xmit_data;
205
__be64 port_rcv_data;
206
__be64 port_xmit_packets;
207
__be64 port_rcv_packets;
208
__be64 port_xmit_wait;
209
__be64 port_adr_events;
210
} __attribute__ ((packed));
212
#define IB_PMA_CONG_HW_CONTROL_TIMER 0x00
213
#define IB_PMA_CONG_HW_CONTROL_SAMPLE 0x01
215
#define QIB_XMIT_RATE_UNSUPPORTED 0x0
216
#define QIB_XMIT_RATE_PICO 0x7
217
/* number of 4nsec cycles equaling 2secs */
218
#define QIB_CONG_TIMER_PSINTERVAL 0x1DCD64EC
220
#define IB_PMA_SEL_CONG_ALL 0x01
221
#define IB_PMA_SEL_CONG_PORT_DATA 0x02
222
#define IB_PMA_SEL_CONG_XMIT 0x04
223
#define IB_PMA_SEL_CONG_ROUTING 0x08
226
* The PortSamplesControl.CounterMasks field is an array of 3 bit fields
227
* which specify the N'th counter's capabilities. See ch. 16.1.3.2.
228
* We support 5 counters which only count the mandatory quantities.
230
#define COUNTER_MASK(q, n) (q << ((9 - n) * 3))
231
#define COUNTER_MASK0_9 \
232
cpu_to_be32(COUNTER_MASK(1, 0) | \
233
COUNTER_MASK(1, 1) | \
234
COUNTER_MASK(1, 2) | \
235
COUNTER_MASK(1, 3) | \