4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _SYS_IB_EOIB_FIP_H
27 #define _SYS_IB_EOIB_FIP_H
33 #include <sys/ethernet.h>
34 #include <sys/ib/ib_types.h>
37 * Sizes of various objects in FIP headers
39 #define FIP_VENDOR_LEN 8
40 #define FIP_GUID_LEN 8
41 #define FIP_SYSNAME_LEN 32
42 #define FIP_PORTNAME_LEN 8
43 #define FIP_MGID_PREFIX_LEN 5
44 #define FIP_VNIC_NAME_LEN 16
45 #define FIP_VHUBID_LEN 3
48 * EoIB Pkeys and Qkeys
50 #define EIB_ADMIN_PKEY 0xFFFF
51 #define EIB_FIP_QKEY 0x80020002
52 #define EIB_DATA_QKEY 0x80020003
55 * EoIB Advertise and Solicit MCG GUIDs
57 #define EIB_GUID_ADVERTISE_PREFIX 0xFF12E01B00060000
58 #define EIB_GUID_SOLICIT_PREFIX 0xFF12E01B00070000
61 * FIP_Protocol_Version
63 #define FIP_PROTO_VERSION 0
64 typedef struct fip_proto_s
{
66 uint8_t pr_reserved
[3];
70 * Basic FIP Header: Opcodes and subcodes for EoIB
72 #define FIP_OPCODE_EOIB 0xFFF9
74 #define FIP_SUBCODE_H_SOLICIT 0x1
75 #define FIP_SUBCODE_G_ADVERTISE 0x2
76 #define FIP_SUBCODE_H_VNIC_LOGIN 0x3
77 #define FIP_SUBCODE_G_VNIC_LOGIN_ACK 0x4
78 #define FIP_SUBCODE_H_VNIC_LOGOUT 0x5
79 #define FIP_SUBCODE_G_VHUB_UPDATE 0x6
80 #define FIP_SUBCODE_G_VHUB_TABLE 0x7
81 #define FIP_SUBCODE_H_KEEP_ALIVE 0x8
84 * Basic FIP Header: Flags relevant to EoIB
86 #define FIP_BHFLAG_GWAVAIL 0x4
87 #define FIP_BHFLAG_SLCTMSG 0x2
92 #define FIP_DESC_TYPE_VENDOR_ID 13
93 #define FIP_DESC_LEN_VENDOR_ID 3
94 typedef struct fip_basic_hdr_s
{
98 uint16_t hd_desc_list_len
;
102 uint8_t hd_reserved2
[2];
103 uint8_t hd_vendor_id
[FIP_VENDOR_LEN
];
106 #define FIP_IBA_QPN_MASK 0x00FFFFFF
107 #define FIP_IBA_PORTID_MASK 0x0FFF
108 #define FIP_IBA_SL_MASK 0xF000
109 #define FIP_IBA_SL_SHIFT 12
112 * FIP_Descriptor_Infiniband_Address
114 #define FIP_DESC_TYPE_IBA 240
115 #define FIP_DESC_LEN_IBA 7
116 typedef struct fip_desc_iba_s
{
119 uint8_t ia_reserved
[2];
120 uint8_t ia_vendor_id
[FIP_VENDOR_LEN
];
122 uint16_t ia_sl_portid
;
124 uint8_t ia_guid
[FIP_GUID_LEN
];
128 * FIP Solicitation Control Message:
130 * FIP_Protocol_Version
132 * FIP_Descriptor_Infiniband_Address
134 typedef struct fip_solicit_s
{
135 fip_proto_t sl_proto_version
;
136 fip_basic_hdr_t sl_fip_hdr
;
137 fip_desc_iba_t sl_iba
;
141 * FIP_Descriptor_EoIB_Gateway_Information
143 #define FIP_DESC_TYPE_EOIB_GW_INFO 241
144 #define FIP_DESC_LEN_EOIB_GW_INFO 4
145 typedef struct fip_desc_gwinfo_s
{
148 uint8_t gi_reserved1
[2];
149 uint8_t gi_vendor_id
[FIP_VENDOR_LEN
];
151 uint8_t gi_reserved2
;
152 uint16_t gi_rss_qpn_num_net_vnics
;
155 #define FIP_GWI_HOST_ADMIND_VNICS_MASK 0x80
156 #define FIP_GWI_NUM_NET_VNICS_MASK 0x0FFF
157 #define FIP_GWI_RSS_QPN_MASK 0xF000
158 #define FIP_GWI_RSS_QPN_SHIFT 12
161 * FIP_Descriptor_Gateway_Identifier
163 #define FIP_DESC_TYPE_GW_ID 248
164 #define FIP_DESC_LEN_GW_ID 15
165 typedef struct fip_desc_gwid_s
{
168 uint8_t id_reserved
[2];
169 uint8_t id_vendor_id
[FIP_VENDOR_LEN
];
170 uint8_t id_guid
[FIP_GUID_LEN
];
171 uint8_t id_sysname
[FIP_SYSNAME_LEN
];
172 uint8_t id_portname
[FIP_PORTNAME_LEN
];
176 * FIP_Descriptor_Keep_Alive_Parameters
178 #define FIP_DESC_TYPE_KEEP_ALIVE 249
179 #define FIP_DESC_LEN_KEEP_ALIVE 6
180 typedef struct fip_desc_keepalive_s
{
183 uint8_t ka_reserved
[2];
184 uint8_t ka_vendor_id
[FIP_VENDOR_LEN
];
185 uint32_t ka_gw_adv_period
;
186 uint32_t ka_gw_ka_period
;
187 uint32_t ka_vnic_ka_period
;
188 } fip_desc_keepalive_t
;
191 * FIP Advertise Control Message:
193 * FIP_Protocol_Version
195 * FIP_Descriptor_Infiniband_Address
196 * FIP_Descriptor_EoIB_Gateway_Information
197 * FIP_Descriptor_Gateway_Identifier
198 * FIP_Descriptor_Keep_Alive_Parameters
200 typedef struct fip_advertise_s
{
201 fip_proto_t ad_proto_version
;
202 fip_basic_hdr_t ad_fip_header
;
203 fip_desc_iba_t ad_iba
;
204 fip_desc_gwinfo_t ad_gwinfo
;
205 fip_desc_gwid_t ad_gwid
;
206 fip_desc_keepalive_t ad_keep_alive
;
210 * FIP_Descriptor_vNIC_Login
212 #define FIP_DESC_TYPE_VNIC_LOGIN 242
213 #define FIP_DESC_LEN_VNIC_LOGIN 13
214 typedef struct fip_desc_vnic_login_s
{
217 uint8_t vl_reserved1
[2];
218 uint8_t vl_vendor_id
[FIP_VENDOR_LEN
];
221 uint16_t vl_flags_vlan
;
222 uint8_t vl_mac
[ETHERADDRL
];
223 uint8_t vl_gw_mgid_prefix
[FIP_MGID_PREFIX_LEN
];
224 uint8_t vl_reserved2
;
225 uint8_t vl_flags_rss
;
226 uint8_t vl_n_mac_mcgid
;
227 uint32_t vl_syndrome_ctl_qpn
;
228 uint8_t vl_vnic_name
[FIP_VNIC_NAME_LEN
];
229 } fip_desc_vnic_login_t
;
232 * Flags, masks and error codes for FIP_Descriptor_vNIC_Login
234 #define FIP_VL_VNIC_ID_MSBIT 0x8000
235 #define FIP_VL_FLAGS_V 0x8000
236 #define FIP_VL_FLAGS_M 0x4000
237 #define FIP_VL_FLAGS_VP 0x2000
238 #define FIP_VL_FLAGS_H 0x1000
239 #define FIP_VL_VLAN_MASK 0x0FFF
240 #define FIP_VL_RSS_MASK 0x10
241 #define FIP_VL_N_RSS_MCGID_MASK 0x0F
242 #define FIP_VL_N_MAC_MCGID_MASK 0x3F
243 #define FIP_VL_CTL_QPN_MASK 0x00FFFFFF
245 #define FIP_VL_SYN_MASK 0xFF000000
246 #define FIP_VL_SYN_SHIFT 24
248 #define FIP_VL_SYN_SUCCESS 0
249 #define FIP_VL_SYN_REJECTED 1
250 #define FIP_VL_SYN_GW_NO_RESOURCE 2
251 #define FIP_VL_SYN_NO_MORE_NWK_ADDRS 3
252 #define FIP_VL_SYN_UNKNOWN_HOST 4
253 #define FIP_VL_SYN_UNSUPP_PARAM 5
256 * FIP_Descriptor_Partition
258 #define FIP_DESC_TYPE_PARTITION 246
259 #define FIP_DESC_LEN_PARTITION 4
260 typedef struct fip_desc_partition_s
{
263 uint8_t pn_reserved1
[2];
264 uint8_t pn_vendor_id
[FIP_VENDOR_LEN
];
265 uint8_t pn_reserved2
[2];
267 } fip_desc_partition_t
;
270 * FIP Login Control Message:
272 * FIP_Protocol_Version
274 * FIP_Descriptor_Infiniband_Address
275 * FIP_Descriptor_vNIC_Login
277 typedef struct fip_login_s
{
278 fip_proto_t lg_proto_version
;
279 fip_basic_hdr_t lg_fip_header
;
280 fip_desc_iba_t lg_iba
;
281 fip_desc_vnic_login_t lg_vnic_login
;
285 * FIP Login ACK Control Message:
287 * FIP_Protocol_Version
289 * FIP_Descriptor_Infiniband_Address
290 * FIP_Descriptor_vNIC_Login
291 * FIP_Descriptor_Partition
293 typedef struct fip_login_ack_s
{
294 fip_proto_t ak_proto_version
;
295 fip_basic_hdr_t ak_fip_header
;
296 fip_desc_iba_t ak_iba
;
297 fip_desc_vnic_login_t ak_vnic_login
;
298 fip_desc_partition_t ak_vhub_partition
;
302 * FIP_Descriptor_vNIC_Identity
304 #define FIP_DESC_TYPE_VNIC_IDENTITY 245
305 #define FIP_DESC_LEN_VNIC_IDENTITY 13
306 typedef struct fip_desc_vnic_identity_s
{
309 uint8_t vi_reserved1
[2];
310 uint8_t vi_vendor_id
[FIP_VENDOR_LEN
];
311 uint32_t vi_flags_vhub_id
;
314 uint8_t vi_mac
[ETHERADDRL
];
315 uint8_t vi_port_guid
[FIP_GUID_LEN
];
316 uint8_t vi_vnic_name
[FIP_VNIC_NAME_LEN
];
317 } fip_desc_vnic_identity_t
;
319 #define FIP_VI_FLAG_U 0x80000000
320 #define FIP_VI_FLAG_R 0x40000000
321 #define FIP_VI_FLAG_VP 0x01000000
324 * FIP Keep Alive Control Message:
326 * FIP_Protocol_Version
328 * FIP_Descriptor_vNIC_Identity
330 typedef struct fip_keep_alive_s
{
331 fip_proto_t ka_proto_version
;
332 fip_basic_hdr_t ka_fip_header
;
333 fip_desc_vnic_identity_t ka_vnic_identity
;
337 * FIP_vHUB_Table_Entry
339 typedef struct fip_vhub_table_entry_s
{
340 uint8_t te_v_rss_type
;
341 uint8_t te_reserved1
;
342 uint8_t te_mac
[ETHERADDRL
];
344 uint8_t te_reserved2
;
347 } fip_vhub_table_entry_t
;
349 #define FIP_TE_VALID 0x80
350 #define FIP_TE_RSS 0x40
352 #define FIP_TE_TYPE_MASK 0x0F
353 #define FIP_TE_TYPE_VNIC 0x00
354 #define FIP_TE_TYPE_GATEWAY 0x01
355 #define FIP_TE_TYPE_UNICAST_MISS 0x02
356 #define FIP_TE_TYPE_MULTICAST_ENTRY 0x03
357 #define FIP_TE_TYPE_VHUB_MULTICAST 0x04
359 #define FIP_TE_SL_MASK 0x0F
360 #define FIP_TE_QPN_MASK 0x00FFFFFF
362 #define FIP_VHUB_TABLE_ENTRY_SZ (sizeof (fip_vhub_table_entry_t))
363 #define FIP_VHUB_TABLE_ENTRY_WORDS (FIP_VHUB_TABLE_ENTRY_SZ >> 2)
366 * FIP_Descriptor_vHUB_Update
368 #define FIP_DESC_TYPE_VHUB_UPDATE 243
369 #define FIP_DESC_LEN_VHUB_UPDATE 9
370 typedef struct fip_desc_vhub_update_s
{
373 uint8_t up_reserved1
[2];
374 uint8_t up_vendor_id
[FIP_VENDOR_LEN
];
375 uint32_t up_eport_vp_vhub_id
;
377 fip_vhub_table_entry_t up_tbl_entry
;
378 } fip_desc_vhub_update_t
;
380 #define FIP_UP_VP_SHIFT 24
381 #define FIP_UP_VP_MASK 0x1
382 #define FIP_UP_EPORT_STATE_SHIFT 28
383 #define FIP_UP_EPORT_STATE_MASK 0x3
384 #define FIP_UP_VHUB_ID_MASK 0x00FFFFFF
386 #define FIP_EPORT_DOWN 0x0
387 #define FIP_EPORT_UP 0x1
390 * FIP_Descriptor_vHUB_Table
392 #define FIP_DESC_TYPE_VHUB_TABLE 244
393 typedef struct fip_desc_vhub_table_s
{
396 uint8_t tb_reserved1
[2];
397 uint8_t tb_vendor_id
[FIP_VENDOR_LEN
];
398 uint32_t tb_flags_vhub_id
;
401 uint8_t tb_reserved2
;
402 uint16_t tb_table_size
;
404 * FIP_vHUB_Table_Entry
405 * FIP_vHUB_Table_Entry
411 } fip_desc_vhub_table_t
;
413 #define FIP_TB_FLAGS_VP_SHIFT 24
414 #define FIP_TB_FLAGS_VP_MASK 0x1
416 #define FIP_TB_VHUB_ID_MASK 0x00FFFFFF
418 #define FIP_TB_HDR_MIDDLE 0x00
419 #define FIP_TB_HDR_FIRST 0x40
420 #define FIP_TB_HDR_LAST 0x80
421 #define FIP_TB_HDR_ONLY 0xC0
423 #define FIP_DESC_VHUB_TABLE_SZ (sizeof (fip_desc_vhub_table_t))
424 #define FIP_DESC_VHUB_TABLE_WORDS (FIP_DESC_VHUB_TABLE_SZ >> 2)
427 * FIP vHUB Table Message:
429 * FIP_Protocol_Version
431 * FIP_Descriptor_vHUB_Table
433 typedef struct fip_vhub_table_s
{
434 fip_proto_t vt_proto_version
;
435 fip_basic_hdr_t vt_fip_header
;
436 fip_desc_vhub_table_t vt_vhub_table
;
440 * FIP vHUB Update Message:
442 * FIP_Protocol_Version
444 * FIP_Descriptor_vHUB_Update
446 typedef struct fip_vhub_update_s
{
447 fip_proto_t vu_proto_version
;
448 fip_basic_hdr_t vu_fip_header
;
449 fip_desc_vhub_update_t vu_vhub_update
;
453 * Just a generic container to handle either type of VHUB
456 typedef struct fip_vhub_pkt_s
{
457 fip_proto_t hb_proto_version
;
458 fip_basic_hdr_t hb_fip_header
;
465 #endif /* _SYS_IB_EOIB_FIP_H */