1a9800beGarrett D'Amore/*
2a9800beGarrett D'Amore * CDDL HEADER START
3a9800beGarrett D'Amore *
4a9800beGarrett D'Amore * The contents of this file are subject to the terms of the
5a9800beGarrett D'Amore * Common Development and Distribution License (the "License").
6a9800beGarrett D'Amore * You may not use this file except in compliance with the License.
7a9800beGarrett D'Amore *
88f23e9fHans Rosenfeld * You can obtain a copy of the license at
98f23e9fHans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt.
10a9800beGarrett D'Amore * See the License for the specific language governing permissions
11a9800beGarrett D'Amore * and limitations under the License.
12a9800beGarrett D'Amore *
13a9800beGarrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
14a9800beGarrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15a9800beGarrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
16a9800beGarrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
17a9800beGarrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
18a9800beGarrett D'Amore *
19a9800beGarrett D'Amore * CDDL HEADER END
20a9800beGarrett D'Amore */
21a9800beGarrett D'Amore
22a9800beGarrett D'Amore/*
238f23e9fHans Rosenfeld * Copyright (c) 2004-2012 Emulex. All rights reserved.
24a9800beGarrett D'Amore * Use is subject to license terms.
25a317005Paul Winder * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
26a9800beGarrett D'Amore */
27a9800beGarrett D'Amore
28a9800beGarrett D'Amore#ifndef _EMLXS_FCF_H
29a9800beGarrett D'Amore#define	_EMLXS_FCF_H
30a9800beGarrett D'Amore
31a9800beGarrett D'Amore#ifdef	__cplusplus
32a9800beGarrett D'Amoreextern "C" {
33a9800beGarrett D'Amore#endif
34a9800beGarrett D'Amore
35a9800beGarrett D'Amore#define	FCFTAB_MAX_FCFI_COUNT		1
36a9800beGarrett D'Amore#define	FCFI_MAX_VFI_COUNT		1
37a9800beGarrett D'Amore
38a9800beGarrett D'Amore/* Internal generic events */
39a9800beGarrett D'Amore#define	FCF_EVENT_STATE_ENTER		0
40a9800beGarrett D'Amore
41a9800beGarrett D'Amore/* External async fabric events */
42a9800beGarrett D'Amore#define	FCF_EVENT_SHUTDOWN		1
43a9800beGarrett D'Amore#define	FCF_EVENT_LINKUP		2
44a9800beGarrett D'Amore#define	FCF_EVENT_LINKDOWN		3
45a9800beGarrett D'Amore#define	FCF_EVENT_CVL			4
46a9800beGarrett D'Amore#define	FCF_EVENT_FCFTAB_FULL		5
47a9800beGarrett D'Amore#define	FCF_EVENT_FCF_FOUND		6
48a9800beGarrett D'Amore#define	FCF_EVENT_FCF_LOST		7
49a9800beGarrett D'Amore#define	FCF_EVENT_FCF_CHANGED		8
50a9800beGarrett D'Amore
51a9800beGarrett D'Amore/* Internal async events */
528f23e9fHans Rosenfeld#define	FCF_EVENT_FCFTAB_ONLINE		9
538f23e9fHans Rosenfeld#define	FCF_EVENT_FCFTAB_OFFLINE	10
54a9800beGarrett D'Amore
558f23e9fHans Rosenfeld#define	FCF_EVENT_FCFI_ONLINE		11
568f23e9fHans Rosenfeld#define	FCF_EVENT_FCFI_OFFLINE		12
578f23e9fHans Rosenfeld#define	FCF_EVENT_FCFI_PAUSE		13
58a9800beGarrett D'Amore
598f23e9fHans Rosenfeld#define	FCF_EVENT_VFI_ONLINE		14
608f23e9fHans Rosenfeld#define	FCF_EVENT_VFI_OFFLINE		15
618f23e9fHans Rosenfeld#define	FCF_EVENT_VFI_PAUSE		16
62a9800beGarrett D'Amore
638f23e9fHans Rosenfeld#define	FCF_EVENT_VPI_ONLINE		17
648f23e9fHans Rosenfeld#define	FCF_EVENT_VPI_OFFLINE		18
658f23e9fHans Rosenfeld#define	FCF_EVENT_VPI_PAUSE		19
668f23e9fHans Rosenfeld
678f23e9fHans Rosenfeld#define	FCF_EVENT_RPI_ONLINE		20
688f23e9fHans Rosenfeld#define	FCF_EVENT_RPI_OFFLINE		21
698f23e9fHans Rosenfeld#define	FCF_EVENT_RPI_PAUSE		22
708f23e9fHans Rosenfeld#define	FCF_EVENT_RPI_RESUME		23
71a9800beGarrett D'Amore
72a9800beGarrett D'Amore/* State change reason codes */		  /* explan */
73a9800beGarrett D'Amore#define	FCF_REASON_NONE			0
74a9800beGarrett D'Amore#define	FCF_REASON_REENTER		1
75a9800beGarrett D'Amore#define	FCF_REASON_EVENT		2 /* evt */
76a9800beGarrett D'Amore#define	FCF_REASON_REQUESTED		3
77a9800beGarrett D'Amore#define	FCF_REASON_NO_MBOX		4
78a9800beGarrett D'Amore#define	FCF_REASON_NO_BUFFER		5
79a9800beGarrett D'Amore#define	FCF_REASON_SEND_FAILED		6 /* status */
80a9800beGarrett D'Amore#define	FCF_REASON_MBOX_FAILED		7 /* status */
818f23e9fHans Rosenfeld#define	FCF_REASON_MBOX_BUSY		8 /* status */
828f23e9fHans Rosenfeld#define	FCF_REASON_NO_FCFI		9
838f23e9fHans Rosenfeld#define	FCF_REASON_NO_VFI		10
848f23e9fHans Rosenfeld#define	FCF_REASON_ONLINE_FAILED	11
858f23e9fHans Rosenfeld#define	FCF_REASON_OFFLINE_FAILED	12
868f23e9fHans Rosenfeld#define	FCF_REASON_OP_FAILED		13 /* attempts */
878f23e9fHans Rosenfeld#define	FCF_REASON_NO_PKT		14
888f23e9fHans Rosenfeld#define	FCF_REASON_NO_NODE		15
898f23e9fHans Rosenfeld#define	FCF_REASON_NOT_ALLOWED		16
908f23e9fHans Rosenfeld#define	FCF_REASON_UNUSED		17
918f23e9fHans Rosenfeld#define	FCF_REASON_INVALID		18
92a9800beGarrett D'Amore
93a9800beGarrett D'Amoretypedef struct XRIobj
94a9800beGarrett D'Amore{
95a9800beGarrett D'Amore	struct XRIobj	*_f;
96a9800beGarrett D'Amore	struct XRIobj	*_b;
97a9800beGarrett D'Amore	uint16_t	XRI;
98a9800beGarrett D'Amore	uint16_t	state;
99a9800beGarrett D'Amore#define	XRI_STATE_FREE			0
100a9800beGarrett D'Amore#define	XRI_STATE_ALLOCATED		1
101a9800beGarrett D'Amore
102a9800beGarrett D'Amore	uint16_t	sge_count;
103a9800beGarrett D'Amore	uint16_t	iotag;
104a317005Paul Winder	MATCHMAP	*SGList;
105a317005Paul Winder	uint32_t	SGSeg;
106a9800beGarrett D'Amore	struct RPIobj	*rpip;
1078f23e9fHans Rosenfeld	struct RPIobj	*reserved_rpip;
108a9800beGarrett D'Amore	emlxs_buf_t	*sbp;
109a9800beGarrett D'Amore	uint32_t 	rx_id; /* Used for unsol exchanges */
110a9800beGarrett D'Amore	uint32_t 	flag;
111a9800beGarrett D'Amore#define	EMLXS_XRI_RESERVED		0x00000001
112a9800beGarrett D'Amore#define	EMLXS_XRI_PENDING_IO		0x00000002
1138f23e9fHans Rosenfeld#define	EMLXS_XRI_BUSY			0x00000004
1148f23e9fHans Rosenfeld
1158f23e9fHans Rosenfeld	uint32_t 	type;
1168f23e9fHans Rosenfeld#define	EMLXS_XRI_SOL_FCP_TYPE		1
1178f23e9fHans Rosenfeld#define	EMLXS_XRI_UNSOL_FCP_TYPE	2
1188f23e9fHans Rosenfeld#define	EMLXS_XRI_SOL_CT_TYPE		3
1198f23e9fHans Rosenfeld#define	EMLXS_XRI_UNSOL_CT_TYPE		4
1208f23e9fHans Rosenfeld#define	EMLXS_XRI_SOL_ELS_TYPE		5
1218f23e9fHans Rosenfeld#define	EMLXS_XRI_UNSOL_ELS_TYPE	6
1228f23e9fHans Rosenfeld#define	EMLXS_XRI_SOL_BLS_TYPE		7
123a9800beGarrett D'Amore
124a9800beGarrett D'Amore} XRIobj_t;
125a9800beGarrett D'Amore
126a9800beGarrett D'Amore
127a9800beGarrett D'Amoretypedef struct emlxs_deferred_cmpl
128a9800beGarrett D'Amore{
129a9800beGarrett D'Amore	struct emlxs_port *port;
130a9800beGarrett D'Amore	struct emlxs_node *node;
131a9800beGarrett D'Amore
132a9800beGarrett D'Amore	void *arg1;
133a9800beGarrett D'Amore	void *arg2;
134a9800beGarrett D'Amore	void *arg3;
135a9800beGarrett D'Amore
136a9800beGarrett D'Amore} emlxs_deferred_cmpl_t;
137a9800beGarrett D'Amore
138a9800beGarrett D'Amore
1398f23e9fHans Rosenfeld#define	FABRIC_RPI		0xffff
1408f23e9fHans Rosenfeld
141a9800beGarrett D'Amoretypedef struct RPIobj
142a9800beGarrett D'Amore{
143a9800beGarrett D'Amore	uint16_t	index;
144a9800beGarrett D'Amore	uint16_t	RPI;
145a9800beGarrett D'Amore
146a9800beGarrett D'Amore	uint16_t	prev_reason;
147a9800beGarrett D'Amore	uint16_t	prev_state;
148a9800beGarrett D'Amore
149a9800beGarrett D'Amore	uint16_t	reason;
150a9800beGarrett D'Amore	uint16_t	state;
151a9800beGarrett D'Amore#define	RPI_STATE_FREE			0
152a9800beGarrett D'Amore
1538f23e9fHans Rosenfeld#define	RPI_STATE_RESERVED		1
1548f23e9fHans Rosenfeld#define	RPI_STATE_OFFLINE		2
155a9800beGarrett D'Amore
1568f23e9fHans Rosenfeld#define	RPI_STATE_UNREG_CMPL		3
1578f23e9fHans Rosenfeld#define	RPI_STATE_UNREG_FAILED		4
1588f23e9fHans Rosenfeld#define	RPI_STATE_UNREG			5
159a9800beGarrett D'Amore
1608f23e9fHans Rosenfeld#define	RPI_STATE_REG			6
1618f23e9fHans Rosenfeld#define	RPI_STATE_REG_FAILED		7
1628f23e9fHans Rosenfeld#define	RPI_STATE_REG_CMPL		8
163a9800beGarrett D'Amore
1648f23e9fHans Rosenfeld#define	RPI_STATE_PAUSED		9
165a9800beGarrett D'Amore
1668f23e9fHans Rosenfeld#define	RPI_STATE_RESUME		10
1678f23e9fHans Rosenfeld#define	RPI_STATE_RESUME_FAILED		11
1688f23e9fHans Rosenfeld#define	RPI_STATE_RESUME_CMPL		12
1698f23e9fHans Rosenfeld
1708f23e9fHans Rosenfeld#define	RPI_STATE_ONLINE		13
171a9800beGarrett D'Amore
172a9800beGarrett D'Amore
173a9800beGarrett D'Amore	uint32_t	flag;
174a9800beGarrett D'Amore#define	EMLXS_RPI_VPI			0x00000010 /* rpi_online set */
175a9800beGarrett D'Amore#define	EMLXS_RPI_PAUSED		0x00000020 /* rpi_paused set */
176a9800beGarrett D'Amore#define	EMLXS_RPI_REG			0x00000040
177a9800beGarrett D'Amore
178a9800beGarrett D'Amore#define	EMLXS_RPI_FIRST			0x80000000
179a9800beGarrett D'Amore
180a9800beGarrett D'Amore	uint32_t	attempts;
181a9800beGarrett D'Amore	uint32_t	xri_count;  /* Managed by XRIobj_t */
182a9800beGarrett D'Amore
1838f23e9fHans Rosenfeld	uint32_t	idle_timer;
1848f23e9fHans Rosenfeld
185a9800beGarrett D'Amore	struct VPIobj 	*vpip;
186a9800beGarrett D'Amore
187a9800beGarrett D'Amore	/* Node info */
188a9800beGarrett D'Amore	struct emlxs_node	*node;
189a9800beGarrett D'Amore	uint32_t	did;
190a9800beGarrett D'Amore	SERV_PARM	sparam;
191a9800beGarrett D'Amore
192a9800beGarrett D'Amore	emlxs_deferred_cmpl_t *cmpl;
193a9800beGarrett D'Amore
194a9800beGarrett D'Amore} RPIobj_t;
195a9800beGarrett D'Amore
196a9800beGarrett D'Amore
197a9800beGarrett D'Amoretypedef struct VPIobj
198a9800beGarrett D'Amore{
199a9800beGarrett D'Amore	uint16_t 	index;
200a9800beGarrett D'Amore	uint16_t 	VPI;
201a9800beGarrett D'Amore
202a9800beGarrett D'Amore	uint16_t	prev_reason;
203a9800beGarrett D'Amore	uint16_t	prev_state;
204a9800beGarrett D'Amore
205a9800beGarrett D'Amore	uint16_t	reason;
206a9800beGarrett D'Amore	uint16_t	state;
207a9800beGarrett D'Amore#define	VPI_STATE_OFFLINE		0
208a9800beGarrett D'Amore
209a9800beGarrett D'Amore#define	VPI_STATE_INIT			1
210a9800beGarrett D'Amore#define	VPI_STATE_INIT_FAILED		2
211a9800beGarrett D'Amore#define	VPI_STATE_INIT_CMPL		3
212a9800beGarrett D'Amore
213a9800beGarrett D'Amore#define	VPI_STATE_UNREG_CMPL		4
214a9800beGarrett D'Amore#define	VPI_STATE_UNREG_FAILED		5
215a9800beGarrett D'Amore#define	VPI_STATE_UNREG			6
216a9800beGarrett D'Amore
217a9800beGarrett D'Amore#define	VPI_STATE_LOGO_CMPL		7
218a9800beGarrett D'Amore#define	VPI_STATE_LOGO_FAILED		8
219a9800beGarrett D'Amore#define	VPI_STATE_LOGO			9
220a9800beGarrett D'Amore
221a9800beGarrett D'Amore#define	VPI_STATE_PORT_OFFLINE		10
222a9800beGarrett D'Amore#define	VPI_STATE_PORT_ONLINE		11
223a9800beGarrett D'Amore
224a9800beGarrett D'Amore#define	VPI_STATE_LOGI			12
225a9800beGarrett D'Amore#define	VPI_STATE_LOGI_FAILED		13
226a9800beGarrett D'Amore#define	VPI_STATE_LOGI_CMPL		14
227a9800beGarrett D'Amore
228a9800beGarrett D'Amore#define	VPI_STATE_REG			15
229a9800beGarrett D'Amore#define	VPI_STATE_REG_FAILED		16
230a9800beGarrett D'Amore#define	VPI_STATE_REG_CMPL		17
231a9800beGarrett D'Amore
232a9800beGarrett D'Amore#define	VPI_STATE_PAUSED		18
233a9800beGarrett D'Amore#define	VPI_STATE_ONLINE		19
234a9800beGarrett D'Amore
235a9800beGarrett D'Amore
236a9800beGarrett D'Amore	uint32_t 	flag;
237a9800beGarrett D'Amore#define	EMLXS_VPI_ONLINE_REQ		0x00000001
238a9800beGarrett D'Amore#define	EMLXS_VPI_OFFLINE_REQ		0x00000002
239a9800beGarrett D'Amore#define	EMLXS_VPI_PAUSE_REQ		0x00000004
240a9800beGarrett D'Amore#define	EMLXS_VPI_REQ_MASK		0x0000000F
241a9800beGarrett D'Amore
242a9800beGarrett D'Amore#define	EMLXS_VPI_VFI			0x00000010 /* vpi_online set */
243a9800beGarrett D'Amore#define	EMLXS_VPI_VFI_LOGI		0x00000020 /* logi_count set */
244a9800beGarrett D'Amore#define	EMLXS_VPI_INIT			0x00000040
245a9800beGarrett D'Amore#define	EMLXS_VPI_REG			0x00000080
246a9800beGarrett D'Amore#define	EMLXS_VPI_PORT_ONLINE		0x00000100
247a9800beGarrett D'Amore#define	EMLXS_VPI_LOGI			0x00000200
2488f23e9fHans Rosenfeld#define	EMLXS_VPI_PORT_UNBIND		0x40000000
249a9800beGarrett D'Amore#define	EMLXS_VPI_PORT_ENABLED		0x80000000
250a9800beGarrett D'Amore
251a9800beGarrett D'Amore	uint32_t	attempts;
252a9800beGarrett D'Amore
2538f23e9fHans Rosenfeld	RPIobj_t	fabric_rpi;	/* Reserved Fabric RPI object */
2548f23e9fHans Rosenfeld	RPIobj_t	*fabric_rpip;	/* Fabric RPI pointer (&fabric_rpi) */
2558f23e9fHans Rosenfeld	RPIobj_t	*p2p_rpip;
256a9800beGarrett D'Amore
257a9800beGarrett D'Amore	struct emlxs_port *port;
258a9800beGarrett D'Amore
259a9800beGarrett D'Amore	struct VFIobj	*vfip; /* Managed by VFIobj_t */
260a9800beGarrett D'Amore	uint32_t	rpi_online; /* Managed by RPIobj_t */
261a9800beGarrett D'Amore	uint32_t	rpi_paused; /* Managed by RPIobj_t */
262a9800beGarrett D'Amore
263a9800beGarrett D'Amore} VPIobj_t;
264a9800beGarrett D'Amore
265a9800beGarrett D'Amore
266a9800beGarrett D'Amoretypedef struct VFIobj
267a9800beGarrett D'Amore{
268a9800beGarrett D'Amore	uint16_t	index;
269a9800beGarrett D'Amore	uint16_t	VFI;
270a9800beGarrett D'Amore
271a9800beGarrett D'Amore	uint16_t	prev_reason;
272a9800beGarrett D'Amore	uint16_t	prev_state;
273a9800beGarrett D'Amore
274a9800beGarrett D'Amore	uint16_t	reason;
275a9800beGarrett D'Amore	uint16_t	state;
276a9800beGarrett D'Amore#define	VFI_STATE_OFFLINE		0
277a9800beGarrett D'Amore
278a9800beGarrett D'Amore#define	VFI_STATE_INIT			1
279a9800beGarrett D'Amore#define	VFI_STATE_INIT_FAILED		2
280a9800beGarrett D'Amore#define	VFI_STATE_INIT_CMPL		3
281a9800beGarrett D'Amore
282a9800beGarrett D'Amore#define	VFI_STATE_VPI_OFFLINE_CMPL	4
283a9800beGarrett D'Amore#define	VFI_STATE_VPI_OFFLINE		5
284a9800beGarrett D'Amore
285a9800beGarrett D'Amore#define	VFI_STATE_VPI_ONLINE		6
286a9800beGarrett D'Amore#define	VFI_STATE_VPI_ONLINE_CMPL	7
287a9800beGarrett D'Amore
288a9800beGarrett D'Amore#define	VFI_STATE_UNREG_CMPL		8
289a9800beGarrett D'Amore#define	VFI_STATE_UNREG_FAILED		9
290a9800beGarrett D'Amore#define	VFI_STATE_UNREG			10
291a9800beGarrett D'Amore
292a9800beGarrett D'Amore#define	VFI_STATE_REG			11
293a9800beGarrett D'Amore#define	VFI_STATE_REG_FAILED		12
294a9800beGarrett D'Amore#define	VFI_STATE_REG_CMPL		13
295a9800beGarrett D'Amore
296a9800beGarrett D'Amore#define	VFI_STATE_PAUSED		14
297a9800beGarrett D'Amore#define	VFI_STATE_ONLINE		15
298a9800beGarrett D'Amore
299a9800beGarrett D'Amore	uint32_t	flag;
300a9800beGarrett D'Amore#define	EMLXS_VFI_ONLINE_REQ		0x00000001
301a9800beGarrett D'Amore#define	EMLXS_VFI_OFFLINE_REQ		0x00000002
302a9800beGarrett D'Amore#define	EMLXS_VFI_PAUSE_REQ		0x00000004
303a9800beGarrett D'Amore#define	EMLXS_VFI_REQ_MASK		0x0000000F
304a9800beGarrett D'Amore
305a9800beGarrett D'Amore#define	EMLXS_VFI_FCFI			0x00000010 /* vfi_online set */
306a9800beGarrett D'Amore#define	EMLXS_VFI_INIT			0x00000020
307a9800beGarrett D'Amore#define	EMLXS_VFI_REG			0x00000040
308a9800beGarrett D'Amore
3098f23e9fHans Rosenfeld	SERV_PARM	sparam;		/* Last registered sparams */
3108f23e9fHans Rosenfeld
311a9800beGarrett D'Amore	uint32_t	attempts;
312a9800beGarrett D'Amore
3138f23e9fHans Rosenfeld	struct FCFIobj 	*fcfp;		/* Managed by FCFIobj_t */
314a9800beGarrett D'Amore
3158f23e9fHans Rosenfeld	uint32_t	vpi_online;	/* Managed by VPIobj_t */
3168f23e9fHans Rosenfeld	uint32_t 	logi_count;	/* Managed by VPIobj_t */
3178f23e9fHans Rosenfeld	struct VPIobj 	*flogi_vpip;	/* Managed by VPIobj_t */
318a9800beGarrett D'Amore
319a9800beGarrett D'Amore} VFIobj_t;
320a9800beGarrett D'Amore
321a9800beGarrett D'Amore
322a9800beGarrett D'Amoretypedef struct FCFIobj
323a9800beGarrett D'Amore{
324a9800beGarrett D'Amore	uint16_t	index;
325a9800beGarrett D'Amore	uint16_t	FCFI;
326a9800beGarrett D'Amore
327a9800beGarrett D'Amore	uint16_t	fcf_index;
328a9800beGarrett D'Amore	uint16_t	vlan_id;
329a9800beGarrett D'Amore
330a9800beGarrett D'Amore	uint16_t	prev_reason;
331a9800beGarrett D'Amore	uint16_t	prev_state;
332a9800beGarrett D'Amore
333a9800beGarrett D'Amore	uint16_t	reason;
334a9800beGarrett D'Amore	uint16_t	state;
335a9800beGarrett D'Amore#define	FCFI_STATE_FREE			0
336a9800beGarrett D'Amore
337a9800beGarrett D'Amore#define	FCFI_STATE_OFFLINE		1
338a9800beGarrett D'Amore
339a9800beGarrett D'Amore#define	FCFI_STATE_UNREG_CMPL		2
340a9800beGarrett D'Amore#define	FCFI_STATE_UNREG_FAILED		3
341a9800beGarrett D'Amore#define	FCFI_STATE_UNREG		4
342a9800beGarrett D'Amore
343a9800beGarrett D'Amore#define	FCFI_STATE_REG			5
344a9800beGarrett D'Amore#define	FCFI_STATE_REG_FAILED		6
345a9800beGarrett D'Amore#define	FCFI_STATE_REG_CMPL		7
346a9800beGarrett D'Amore
347a9800beGarrett D'Amore#define	FCFI_STATE_VFI_OFFLINE_CMPL	8
348a9800beGarrett D'Amore#define	FCFI_STATE_VFI_OFFLINE		9
349a9800beGarrett D'Amore
350a9800beGarrett D'Amore#define	FCFI_STATE_VFI_ONLINE		10
351a9800beGarrett D'Amore#define	FCFI_STATE_VFI_ONLINE_CMPL	11
352a9800beGarrett D'Amore
353a9800beGarrett D'Amore#define	FCFI_STATE_PAUSED		12
354a9800beGarrett D'Amore#define	FCFI_STATE_ONLINE		13
355a9800beGarrett D'Amore
3568f23e9fHans Rosenfeld
3578f23e9fHans Rosenfeld	uint16_t 	pad;
3588f23e9fHans Rosenfeld	uint16_t 	generation;
3598f23e9fHans Rosenfeld
360a9800beGarrett D'Amore	uint32_t 	offline_timer;
361a9800beGarrett D'Amore	uint32_t 	attempts;
3628f23e9fHans Rosenfeld
363a9800beGarrett D'Amore	uint32_t	event_tag;
364a9800beGarrett D'Amore	uint32_t	flag;
365a9800beGarrett D'Amore#define	EMLXS_FCFI_ONLINE_REQ		0x00000001
366a9800beGarrett D'Amore#define	EMLXS_FCFI_OFFLINE_REQ		0x00000002
367a9800beGarrett D'Amore#define	EMLXS_FCFI_PAUSE_REQ		0x00000004
368a9800beGarrett D'Amore#define	EMLXS_FCFI_REQ_MASK		0x0000000F
369a9800beGarrett D'Amore
370a9800beGarrett D'Amore#define	EMLXS_FCFI_FCFTAB		0x00000010 /* fcfi_online set */
371a9800beGarrett D'Amore#define	EMLXS_FCFI_REG			0x00000020
372a9800beGarrett D'Amore
373a9800beGarrett D'Amore#define	EMLXS_FCFI_VALID		0x00000100
374a9800beGarrett D'Amore#define	EMLXS_FCFI_AVAILABLE		0x00000200
375a9800beGarrett D'Amore#define	EMLXS_FCFI_CONFIGURED		0x00000400
376a9800beGarrett D'Amore#define	EMLXS_FCFI_FRESH		0x00000800
377a9800beGarrett D'Amore#define	EMLXS_FCFI_FAILED		0x00001000
378a9800beGarrett D'Amore#define	EMLXS_FCFI_SELECTED		0x00002000 /* in use */
379a9800beGarrett D'Amore
380a9800beGarrett D'Amore#define	EMLXS_FCFI_VLAN_ID		0x00010000
381a9800beGarrett D'Amore#define	EMLXS_FCFI_BOOT			0x00020000
382a9800beGarrett D'Amore#define	EMLXS_FCFI_PRIMARY		0x00040000
383a9800beGarrett D'Amore
384a9800beGarrett D'Amore#define	EMLXS_FCFI_TAGGED		0x80000000
385a9800beGarrett D'Amore
386a9800beGarrett D'Amore	/* struct VFTable	vftab */
387a9800beGarrett D'Amore
388a9800beGarrett D'Amore	FCF_RECORD_t	fcf_rec;
389a9800beGarrett D'Amore	uint32_t	priority;
390a9800beGarrett D'Amore
391a9800beGarrett D'Amore	uint32_t	vfi_online;  /* Managed by VFIobj_t */
392a9800beGarrett D'Amore
393a9800beGarrett D'Amore} FCFIobj_t;
394a9800beGarrett D'Amore
395a9800beGarrett D'Amore
396a9800beGarrett D'Amoretypedef struct VFTable
397a9800beGarrett D'Amore{
398a9800beGarrett D'Amore	uint16_t 	prev_reason;
399a9800beGarrett D'Amore	uint16_t 	prev_state;
400a9800beGarrett D'Amore
401a9800beGarrett D'Amore	uint16_t 	reason;
402a9800beGarrett D'Amore	uint16_t 	state;
403a9800beGarrett D'Amore#define	VFTAB_STATE_DISABLED		0
404a9800beGarrett D'Amore
405a9800beGarrett D'Amore	uint32_t	vfi_active;
406a9800beGarrett D'Amore	uint32_t	vfi_count;
407a9800beGarrett D'Amore	VFIobj_t	*table;
408a9800beGarrett D'Amore
409a9800beGarrett D'Amore} VFTable_t;
410a9800beGarrett D'Amore
411a9800beGarrett D'Amoretypedef struct FCFTable
412a9800beGarrett D'Amore{
413a9800beGarrett D'Amore
414a9800beGarrett D'Amore	uint16_t 	prev_reason;
415a9800beGarrett D'Amore	uint16_t 	prev_state;
416a9800beGarrett D'Amore
417a9800beGarrett D'Amore	uint16_t 	reason;
418a9800beGarrett D'Amore	uint16_t 	state;
4198f23e9fHans Rosenfeld/* Common states */
4208f23e9fHans Rosenfeld#define	FCFTAB_STATE_SHUTDOWN			0
4218f23e9fHans Rosenfeld#define	FCFTAB_STATE_OFFLINE			1
4228f23e9fHans Rosenfeld
4238f23e9fHans Rosenfeld/* FCOE states */
4248f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_SHUTDOWN		FCFTAB_STATE_SHUTDOWN
4258f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_OFFLINE		FCFTAB_STATE_OFFLINE
4268f23e9fHans Rosenfeld
4278f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_SOLICIT		2
4288f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_SOLICIT_FAILED	3
4298f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_SOLICIT_CMPL		4
430a9800beGarrett D'Amore
4318f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_READ			5
4328f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_READ_FAILED		6
4338f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_READ_CMPL		7
434a9800beGarrett D'Amore
4358f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL	8
4368f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_FCFI_OFFLINE		9
437a9800beGarrett D'Amore
4388f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_FCFI_ONLINE		10
4398f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL	11
440a9800beGarrett D'Amore
4418f23e9fHans Rosenfeld#define	FCOE_FCFTAB_STATE_ONLINE		12
442a9800beGarrett D'Amore
443a9800beGarrett D'Amore
4448f23e9fHans Rosenfeld/* FC states */
4458f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_SHUTDOWN		FCFTAB_STATE_SHUTDOWN
4468f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_OFFLINE			FCFTAB_STATE_OFFLINE
4478f23e9fHans Rosenfeld
4488f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_TOPO			2
4498f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_TOPO_FAILED		3
4508f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_TOPO_CMPL		4
4518f23e9fHans Rosenfeld
4528f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_CFGLINK			5
4538f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_CFGLINK_FAILED		6
4548f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_CFGLINK_CMPL		7
4558f23e9fHans Rosenfeld
4568f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_SPARM			8
4578f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_SPARM_FAILED		9
4588f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_SPARM_CMPL		10
4598f23e9fHans Rosenfeld
4608f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL	11
4618f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_FCFI_OFFLINE		12
4628f23e9fHans Rosenfeld
4638f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_FCFI_ONLINE		13
4648f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_FCFI_ONLINE_CMPL	14
4658f23e9fHans Rosenfeld
4668f23e9fHans Rosenfeld#define	FC_FCFTAB_STATE_ONLINE			15
4678f23e9fHans Rosenfeld
4688f23e9fHans Rosenfeld
4698f23e9fHans Rosenfeld	uint16_t 	TID;
4708f23e9fHans Rosenfeld	uint16_t 	generation;
471a9800beGarrett D'Amore
472a9800beGarrett D'Amore	uint32_t 	flag;
4738f23e9fHans Rosenfeld/* Common flags */
4748f23e9fHans Rosenfeld#define	EMLXS_FCFTAB_REQ_MASK			0x0000000F
4758f23e9fHans Rosenfeld#define	EMLXS_FCFTAB_SHUTDOWN			0x80000000
4768f23e9fHans Rosenfeld
4778f23e9fHans Rosenfeld/* FCOE flags */
4788f23e9fHans Rosenfeld#define	EMLXS_FCOE_FCFTAB_SOL_REQ		0x00000001
4798f23e9fHans Rosenfeld#define	EMLXS_FCOE_FCFTAB_READ_REQ		0x00000002
4808f23e9fHans Rosenfeld#define	EMLXS_FCOE_FCFTAB_OFFLINE_REQ		0x00000004
4818f23e9fHans Rosenfeld
4828f23e9fHans Rosenfeld/* FC flags */
4838f23e9fHans Rosenfeld#define	EMLXS_FC_FCFTAB_TOPO_REQ		0x00000001
4848f23e9fHans Rosenfeld#define	EMLXS_FC_FCFTAB_CFGLINK_REQ		0x00000002
4858f23e9fHans Rosenfeld#define	EMLXS_FC_FCFTAB_SPARM_REQ		0x00000004
4868f23e9fHans Rosenfeld#define	EMLXS_FC_FCFTAB_OFFLINE_REQ		0x00000008
487a9800beGarrett D'Amore
488a9800beGarrett D'Amore	uint32_t 	attempts;
489a9800beGarrett D'Amore
490a9800beGarrett D'Amore	uint32_t	fcfi_online;  /* Managed by FCFIobj_t */
491a9800beGarrett D'Amore
492a9800beGarrett D'Amore	FCFIobj_t	*fcfi[FCFTAB_MAX_FCFI_COUNT];
493a9800beGarrett D'Amore	uint32_t	fcfi_count;
494a9800beGarrett D'Amore
495a9800beGarrett D'Amore	FCFIobj_t	*table;
496a9800beGarrett D'Amore	uint16_t	table_count;
497a9800beGarrett D'Amore
4988f23e9fHans Rosenfeld	uint32_t 	online_timer;	/* FC */
4998f23e9fHans Rosenfeld
5008f23e9fHans Rosenfeld	uint32_t 	sol_timer;	/* FCOE */
5018f23e9fHans Rosenfeld	uint32_t 	read_timer;	/* FCOE */
502a9800beGarrett D'Amore
503a9800beGarrett D'Amore} FCFTable_t;
504a9800beGarrett D'Amore#define	FCFTAB_READ_ALL		(void*)0xffff
505a9800beGarrett D'Amore
506a9800beGarrett D'Amore#ifdef	__cplusplus
507a9800beGarrett D'Amore}
508a9800beGarrett D'Amore#endif
509a9800beGarrett D'Amore
510a9800beGarrett D'Amore#endif	/* _EMLXS_FCF_H */
511