Skip to content

Commit d4ab347

Browse files
Dennis Dalessandrodledford
authored andcommitted
IB/core: Add core header changes needed for OPA
This patch adds the value of the CNP opcode to the existing list of enumerated opcodes in ib_pack.h Add common OPA header definitions for driver build: - opa_port_info.h - opa_smi.h - hfi1_user.h Additionally, ib_mad.h, has additional definitions that are common to ib_drivers including: - trap support - cca support The qib driver has the duplication removed in favor those in ib_mad.h Reviewed-by: Mike Marciniszyn <[email protected]> Reviewed-by: John, Jubin <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 072bf1f commit d4ab347

File tree

6 files changed

+1055
-139
lines changed

6 files changed

+1055
-139
lines changed

drivers/infiniband/hw/qib/qib_mad.h

Lines changed: 8 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -36,148 +36,17 @@
3636

3737
#include <rdma/ib_pma.h>
3838

39-
#define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004)
40-
#define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008)
41-
#define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C)
42-
#define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C)
39+
#define IB_SMP_UNSUP_VERSION \
40+
cpu_to_be16(IB_MGMT_MAD_STATUS_BAD_VERSION)
4341

44-
struct ib_node_info {
45-
u8 base_version;
46-
u8 class_version;
47-
u8 node_type;
48-
u8 num_ports;
49-
__be64 sys_guid;
50-
__be64 node_guid;
51-
__be64 port_guid;
52-
__be16 partition_cap;
53-
__be16 device_id;
54-
__be32 revision;
55-
u8 local_port_num;
56-
u8 vendor_id[3];
57-
} __packed;
58-
59-
struct ib_mad_notice_attr {
60-
u8 generic_type;
61-
u8 prod_type_msb;
62-
__be16 prod_type_lsb;
63-
__be16 trap_num;
64-
__be16 issuer_lid;
65-
__be16 toggle_count;
66-
67-
union {
68-
struct {
69-
u8 details[54];
70-
} raw_data;
71-
72-
struct {
73-
__be16 reserved;
74-
__be16 lid; /* where violation happened */
75-
u8 port_num; /* where violation happened */
76-
} __packed ntc_129_131;
77-
78-
struct {
79-
__be16 reserved;
80-
__be16 lid; /* LID where change occurred */
81-
u8 reserved2;
82-
u8 local_changes; /* low bit - local changes */
83-
__be32 new_cap_mask; /* new capability mask */
84-
u8 reserved3;
85-
u8 change_flags; /* low 3 bits only */
86-
} __packed ntc_144;
87-
88-
struct {
89-
__be16 reserved;
90-
__be16 lid; /* lid where sys guid changed */
91-
__be16 reserved2;
92-
__be64 new_sys_guid;
93-
} __packed ntc_145;
94-
95-
struct {
96-
__be16 reserved;
97-
__be16 lid;
98-
__be16 dr_slid;
99-
u8 method;
100-
u8 reserved2;
101-
__be16 attr_id;
102-
__be32 attr_mod;
103-
__be64 mkey;
104-
u8 reserved3;
105-
u8 dr_trunc_hop;
106-
u8 dr_rtn_path[30];
107-
} __packed ntc_256;
108-
109-
struct {
110-
__be16 reserved;
111-
__be16 lid1;
112-
__be16 lid2;
113-
__be32 key;
114-
__be32 sl_qp1; /* SL: high 4 bits */
115-
__be32 qp2; /* high 8 bits reserved */
116-
union ib_gid gid1;
117-
union ib_gid gid2;
118-
} __packed ntc_257_258;
119-
120-
} details;
121-
};
122-
123-
/*
124-
* Generic trap/notice types
125-
*/
126-
#define IB_NOTICE_TYPE_FATAL 0x80
127-
#define IB_NOTICE_TYPE_URGENT 0x81
128-
#define IB_NOTICE_TYPE_SECURITY 0x82
129-
#define IB_NOTICE_TYPE_SM 0x83
130-
#define IB_NOTICE_TYPE_INFO 0x84
42+
#define IB_SMP_UNSUP_METHOD \
43+
cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD)
13144

132-
/*
133-
* Generic trap/notice producers
134-
*/
135-
#define IB_NOTICE_PROD_CA cpu_to_be16(1)
136-
#define IB_NOTICE_PROD_SWITCH cpu_to_be16(2)
137-
#define IB_NOTICE_PROD_ROUTER cpu_to_be16(3)
138-
#define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4)
45+
#define IB_SMP_UNSUP_METH_ATTR \
46+
cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB)
13947

140-
/*
141-
* Generic trap/notice numbers
142-
*/
143-
#define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
144-
#define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
145-
#define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
146-
#define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
147-
#define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
148-
#define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
149-
#define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
150-
#define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
151-
152-
/*
153-
* Repress trap/notice flags
154-
*/
155-
#define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0)
156-
#define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1)
157-
#define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2)
158-
#define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3)
159-
#define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4)
160-
#define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5)
161-
#define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6)
162-
#define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7)
163-
164-
/*
165-
* Generic trap/notice other local changes flags (trap 144).
166-
*/
167-
#define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */
168-
#define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */
169-
#define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
170-
171-
/*
172-
* Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256).
173-
*/
174-
#define IB_NOTICE_TRAP_DR_NOTICE 0x80
175-
#define IB_NOTICE_TRAP_DR_TRUNC 0x40
176-
177-
struct ib_vl_weight_elem {
178-
u8 vl; /* Only low 4 bits, upper 4 bits reserved */
179-
u8 weight;
180-
};
48+
#define IB_SMP_INVALID_FIELD \
49+
cpu_to_be16(IB_MGMT_MAD_STATUS_INVALID_ATTRIB_VALUE)
18150

18251
#define IB_VLARB_LOWPRI_0_31 1
18352
#define IB_VLARB_LOWPRI_32_63 2

include/rdma/ib_mad.h

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,60 @@
127127
#define IB_DEFAULT_PKEY_PARTIAL 0x7FFF
128128
#define IB_DEFAULT_PKEY_FULL 0xFFFF
129129

130+
/*
131+
* Generic trap/notice types
132+
*/
133+
#define IB_NOTICE_TYPE_FATAL 0x80
134+
#define IB_NOTICE_TYPE_URGENT 0x81
135+
#define IB_NOTICE_TYPE_SECURITY 0x82
136+
#define IB_NOTICE_TYPE_SM 0x83
137+
#define IB_NOTICE_TYPE_INFO 0x84
138+
139+
/*
140+
* Generic trap/notice producers
141+
*/
142+
#define IB_NOTICE_PROD_CA cpu_to_be16(1)
143+
#define IB_NOTICE_PROD_SWITCH cpu_to_be16(2)
144+
#define IB_NOTICE_PROD_ROUTER cpu_to_be16(3)
145+
#define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4)
146+
147+
/*
148+
* Generic trap/notice numbers
149+
*/
150+
#define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
151+
#define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
152+
#define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
153+
#define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
154+
#define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
155+
#define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
156+
#define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
157+
#define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
158+
159+
/*
160+
* Repress trap/notice flags
161+
*/
162+
#define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0)
163+
#define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1)
164+
#define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2)
165+
#define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3)
166+
#define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4)
167+
#define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5)
168+
#define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6)
169+
#define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7)
170+
171+
/*
172+
* Generic trap/notice other local changes flags (trap 144).
173+
*/
174+
#define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */
175+
#define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */
176+
#define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
177+
178+
/*
179+
* Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256).
180+
*/
181+
#define IB_NOTICE_TRAP_DR_NOTICE 0x80
182+
#define IB_NOTICE_TRAP_DR_TRUNC 0x40
183+
130184
enum {
131185
IB_MGMT_MAD_HDR = 24,
132186
IB_MGMT_MAD_DATA = 232,
@@ -240,6 +294,90 @@ struct ib_class_port_info {
240294
__be32 trap_qkey;
241295
};
242296

297+
struct ib_node_info {
298+
u8 base_version;
299+
u8 class_version;
300+
u8 node_type;
301+
u8 num_ports;
302+
__be64 sys_guid;
303+
__be64 node_guid;
304+
__be64 port_guid;
305+
__be16 partition_cap;
306+
__be16 device_id;
307+
__be32 revision;
308+
u8 local_port_num;
309+
u8 vendor_id[3];
310+
} __packed;
311+
312+
struct ib_mad_notice_attr {
313+
u8 generic_type;
314+
u8 prod_type_msb;
315+
__be16 prod_type_lsb;
316+
__be16 trap_num;
317+
__be16 issuer_lid;
318+
__be16 toggle_count;
319+
320+
union {
321+
struct {
322+
u8 details[54];
323+
} raw_data;
324+
325+
struct {
326+
__be16 reserved;
327+
__be16 lid; /* where violation happened */
328+
u8 port_num; /* where violation happened */
329+
} __packed ntc_129_131;
330+
331+
struct {
332+
__be16 reserved;
333+
__be16 lid; /* LID where change occurred */
334+
u8 reserved2;
335+
u8 local_changes; /* low bit - local changes */
336+
__be32 new_cap_mask; /* new capability mask */
337+
u8 reserved3;
338+
u8 change_flags; /* low 3 bits only */
339+
} __packed ntc_144;
340+
341+
struct {
342+
__be16 reserved;
343+
__be16 lid; /* lid where sys guid changed */
344+
__be16 reserved2;
345+
__be64 new_sys_guid;
346+
} __packed ntc_145;
347+
348+
struct {
349+
__be16 reserved;
350+
__be16 lid;
351+
__be16 dr_slid;
352+
u8 method;
353+
u8 reserved2;
354+
__be16 attr_id;
355+
__be32 attr_mod;
356+
__be64 mkey;
357+
u8 reserved3;
358+
u8 dr_trunc_hop;
359+
u8 dr_rtn_path[30];
360+
} __packed ntc_256;
361+
362+
struct {
363+
__be16 reserved;
364+
__be16 lid1;
365+
__be16 lid2;
366+
__be32 key;
367+
__be32 sl_qp1; /* SL: high 4 bits */
368+
__be32 qp2; /* high 8 bits reserved */
369+
union ib_gid gid1;
370+
union ib_gid gid2;
371+
} __packed ntc_257_258;
372+
373+
} details;
374+
};
375+
376+
struct ib_vl_weight_elem {
377+
u8 vl; /* VL is low 5 bits, upper 3 bits reserved */
378+
u8 weight;
379+
};
380+
243381
/**
244382
* ib_mad_send_buf - MAD data buffer and work request for sends.
245383
* @next: A pointer used to chain together MADs for posting.

include/rdma/ib_pack.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ enum {
7676
IB_OPCODE_UC = 0x20,
7777
IB_OPCODE_RD = 0x40,
7878
IB_OPCODE_UD = 0x60,
79+
/* per IBTA 3.1 Table 38, A10.3.2 */
80+
IB_OPCODE_CNP = 0x80,
7981

8082
/* operations -- just used to define real constants */
8183
IB_OPCODE_SEND_FIRST = 0x00,

0 commit comments

Comments
 (0)