emlxs_fcf.c (a9800beb) emlxs_fcf.c (8f23e9fa)
1/*
2 * CDDL HEADER START
3 *
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.
7 *
1/*
2 * CDDL HEADER START
3 *
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.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
8 * You can obtain a copy of the license at
9 * http://www.opensource.org/licenses/cddl1.txt.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22/*
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2010 Emulex. All rights reserved.
23 * Copyright (c) 2004-2012 Emulex. All rights reserved.
24 * Use is subject to license terms.
25 */
26
24 * Use is subject to license terms.
25 */
26
27
28#include <emlxs.h>
29
30/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
31EMLXS_MSG_DEF(EMLXS_FCF_C);
32
33/*
34 * STATE MACHINE RULES:
35 *

--- 15 unchanged lines hidden (view full) ---

51 *
52 * - Its is forbidden to make direct calls to emlxs_XXXX_action().
53 * Only emlxs_XXXX_state() and emlxs_XXXX_event() routines may make
54 * calls to emlxs_XXXX_action().
55 *
56 * - The EMLXS_FCF_LOCK must be held before calling:
57 * emlxs_XXXX_state(), emlxs_XXXX_event() and emlxs_XXXX_action().
58 *
27#include <emlxs.h>
28
29/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
30EMLXS_MSG_DEF(EMLXS_FCF_C);
31
32/*
33 * STATE MACHINE RULES:
34 *

--- 15 unchanged lines hidden (view full) ---

50 *
51 * - Its is forbidden to make direct calls to emlxs_XXXX_action().
52 * Only emlxs_XXXX_state() and emlxs_XXXX_event() routines may make
53 * calls to emlxs_XXXX_action().
54 *
55 * - The EMLXS_FCF_LOCK must be held before calling:
56 * emlxs_XXXX_state(), emlxs_XXXX_event() and emlxs_XXXX_action().
57 *
59 * - All other calls touching fctab, fcfi, vfi, vpi, rpi objects must hold
60 * the EMLXS_FCF_LOCK to protect these objects.
58 * - All other calls touching fcftab, fcfi, vfi, vpi, rpi objects
59 * must hold the EMLXS_FCF_LOCK to protect these objects.
61 */
62
60 */
61
62/*
63 * DEBUG MESSAGE TERMINATION RULES:
64 *
65 * - A message should end in ">" if a thread operating outside the
66 * XXXX state machine enters the XXXX state machine with a call to
67 * emlxs_XXXX_event() or emlxs_XXXX_state(). This includes calls made
68 * from emlxs_..._notify(), emlxs_..._mbcmpl() and emlxs_..._timer()
69 * routines since they represent the beginnning of new threads.
70 *
71 * - A message should end in "<" if the thread is about exit
72 * an emlxs_XXXX_..._action() without previously calling the
73 * next emlxs_XXXX_state(). This includes the emlxs_XXXX_action()
74 * and emlxs_XXXX_state() routines themselves since errors
75 * in these routines represent the termination of state change
76 * thread.
77 *
78 * - A message should end in "." if none of the previous
79 * conditions apply.
80 */
81
63/* ************************************************************************** */
64/* FCF Generic */
65/* ************************************************************************** */
66
67/*
68 * EVENT ARG1
69 * --------------------------------------------
70 * FCF_EVENT_STATE_ENTER None

--- 17 unchanged lines hidden (view full) ---

88 * FCF_EVENT_VPI_ONLINE VPIobj_t*
89 * FCF_EVENT_VPI_OFFLINE VPIobj_t*
90 * FCF_EVENT_VPI_PAUSE VPIobj_t*
91 *
92 * FCF_EVENT_RPI_ONLINE RPIobj_t*
93 * FCF_EVENT_RPI_OFFLINE RPIobj_t*
94 * FCF_EVENT_RPI_PAUSE RPIobj_t*
95 * FCF_EVENT_RPI_RESUME RPIobj_t*
82/* ************************************************************************** */
83/* FCF Generic */
84/* ************************************************************************** */
85
86/*
87 * EVENT ARG1
88 * --------------------------------------------
89 * FCF_EVENT_STATE_ENTER None

--- 17 unchanged lines hidden (view full) ---

107 * FCF_EVENT_VPI_ONLINE VPIobj_t*
108 * FCF_EVENT_VPI_OFFLINE VPIobj_t*
109 * FCF_EVENT_VPI_PAUSE VPIobj_t*
110 *
111 * FCF_EVENT_RPI_ONLINE RPIobj_t*
112 * FCF_EVENT_RPI_OFFLINE RPIobj_t*
113 * FCF_EVENT_RPI_PAUSE RPIobj_t*
114 * FCF_EVENT_RPI_RESUME RPIobj_t*
115 * FCF_EVENT_RPI_TIMEOUT RPIobj_t*
96 */
97
98/* Order does not matter */
99emlxs_table_t emlxs_fcf_event_table[] =
100{
116 */
117
118/* Order does not matter */
119emlxs_table_t emlxs_fcf_event_table[] =
120{
101 {FCF_EVENT_STATE_ENTER, "STATE_ENTER"},
121 {FCF_EVENT_STATE_ENTER, "E_ENTER"},
102
122
103 {FCF_EVENT_SHUTDOWN, "SHUTDOWN"},
104 {FCF_EVENT_LINKUP, "LINK_UP"},
105 {FCF_EVENT_LINKDOWN, "LINK_DOWN"},
106 {FCF_EVENT_CVL, "CVL_RECD"},
107 {FCF_EVENT_FCFTAB_FULL, "TABLE_FULL"},
108 {FCF_EVENT_FCF_FOUND, "FCF_FOUND"},
109 {FCF_EVENT_FCF_LOST, "FCF_LOST"},
110 {FCF_EVENT_FCF_CHANGED, "FCF_CHANGED"},
123 {FCF_EVENT_SHUTDOWN, "E_SHUTDOWN"},
124 {FCF_EVENT_LINKUP, "E_LINKUP"},
125 {FCF_EVENT_LINKDOWN, "E_LINKDOWN"},
126 {FCF_EVENT_CVL, "E_CVL"},
127 {FCF_EVENT_FCFTAB_FULL, "E_TABLE_FULL"},
128 {FCF_EVENT_FCF_FOUND, "E_FCF_FOUND"},
129 {FCF_EVENT_FCF_LOST, "E_FCF_LOST"},
130 {FCF_EVENT_FCF_CHANGED, "E_FCF_CHANGED"},
111
131
112 {FCF_EVENT_FCFI_ONLINE, "FCFI_ONLINE"},
113 {FCF_EVENT_FCFI_OFFLINE, "FCFI_OFFLINE"},
114 {FCF_EVENT_FCFI_PAUSE, "FCFI_PAUSE"},
132 {FCF_EVENT_FCFI_ONLINE, "E_FCFI_ONLINE"},
133 {FCF_EVENT_FCFI_OFFLINE, "E_FCFI_OFFLINE"},
134 {FCF_EVENT_FCFI_PAUSE, "E_FCFI_PAUSE"},
115
135
116 {FCF_EVENT_VFI_ONLINE, "VFI_ONLINE"},
117 {FCF_EVENT_VFI_OFFLINE, "VFI_OFFLINE"},
118 {FCF_EVENT_VFI_PAUSE, "VFI_PAUSE"},
136 {FCF_EVENT_VFI_ONLINE, "E_VFI_ONLINE"},
137 {FCF_EVENT_VFI_OFFLINE, "E_VFI_OFFLINE"},
138 {FCF_EVENT_VFI_PAUSE, "E_VFI_PAUSE"},
119
139
120 {FCF_EVENT_VPI_ONLINE, "VPI_ONLINE"},
121 {FCF_EVENT_VPI_OFFLINE, "VPI_OFFLINE"},
122 {FCF_EVENT_VPI_PAUSE, "VPI_PAUSE"},
140 {FCF_EVENT_VPI_ONLINE, "E_VPI_ONLINE"},
141 {FCF_EVENT_VPI_OFFLINE, "E_VPI_OFFLINE"},
142 {FCF_EVENT_VPI_PAUSE, "E_VPI_PAUSE"},
123
143
124 {FCF_EVENT_RPI_ONLINE, "RPI_ONLINE"},
125 {FCF_EVENT_RPI_OFFLINE, "RPI_OFFLINE"},
126 {FCF_EVENT_RPI_PAUSE, "RPI_PAUSE"},
127 {FCF_EVENT_RPI_RESUME, "RPI_RESUME"},
144 {FCF_EVENT_RPI_ONLINE, "E_RPI_ONLINE"},
145 {FCF_EVENT_RPI_OFFLINE, "E_RPI_OFFLINE"},
146 {FCF_EVENT_RPI_PAUSE, "E_RPI_PAUSE"},
147 {FCF_EVENT_RPI_RESUME, "E_RPI_RESUME"},
128
129}; /* emlxs_fcf_event_table */
130
131
132/* Order does not matter */
133emlxs_table_t emlxs_fcf_reason_table[] =
134{
148
149}; /* emlxs_fcf_event_table */
150
151
152/* Order does not matter */
153emlxs_table_t emlxs_fcf_reason_table[] =
154{
135 {FCF_REASON_NONE, "REASON_NONE"},
136 {FCF_REASON_REENTER, "REASON_REENTER"},
137 {FCF_REASON_EVENT, "REASON_EVENT"},
138 {FCF_REASON_REQUESTED, "REASON_REQUESTED"},
139 {FCF_REASON_NO_MBOX, "REASON_NO_MBOX"},
140 {FCF_REASON_NO_BUFFER, "REASON_NO_BUFFER"},
141 {FCF_REASON_SEND_FAILED, "REASON_SEND_FAILED"},
142 {FCF_REASON_MBOX_FAILED, "REASON_MBOX_FAILED"},
143 {FCF_REASON_NO_FCFI, "REASON_NO_FCFI"},
144 {FCF_REASON_NO_VFI, "REASON_NO_VFI"},
145 {FCF_REASON_ONLINE_FAILED, "REASON_ONLINE_FAILED"},
146 {FCF_REASON_OFFLINE_FAILED, "REASON_OFFLINE_FAILED"},
147 {FCF_REASON_OP_FAILED, "REASON_OP_FAILED"},
148 {FCF_REASON_NO_PKT, "FCF_REASON_NO_PKT"},
149 {FCF_REASON_NO_NODE, "FCF_REASON_NO_NODE"},
150 {FCF_REASON_NOT_ALLOWED, "FCF_REASON_NOT_ALLOWED"},
155 {FCF_REASON_NONE, "R_NONE"},
156 {FCF_REASON_REENTER, "R_REENTER"},
157 {FCF_REASON_EVENT, "R_EVENT"},
158 {FCF_REASON_REQUESTED, "R_REQUESTED"},
159 {FCF_REASON_NO_MBOX, "R_NO_MBOX"},
160 {FCF_REASON_NO_BUFFER, "R_NO_BUFFER"},
161 {FCF_REASON_SEND_FAILED, "R_SEND_FAILED"},
162 {FCF_REASON_MBOX_FAILED, "R_MBOX_FAILED"},
163 {FCF_REASON_MBOX_BUSY, "R_MBOX_BUSY"},
164 {FCF_REASON_NO_FCFI, "R_NO_FCFI"},
165 {FCF_REASON_NO_VFI, "R_NO_VFI"},
166 {FCF_REASON_ONLINE_FAILED, "R_ONLINE_FAILED"},
167 {FCF_REASON_OFFLINE_FAILED, "R_OFFLINE_FAILED"},
168 {FCF_REASON_OP_FAILED, "R_OP_FAILED"},
169 {FCF_REASON_NO_PKT, "R_NO_PKT"},
170 {FCF_REASON_NO_NODE, "R_NO_NODE"},
171 {FCF_REASON_NOT_ALLOWED, "R_NOT_ALLOWED"},
172 {FCF_REASON_UNUSED, "R_UNUSED"},
173 {FCF_REASON_INVALID, "R_INVALID"},
151
152}; /* emlxs_fcf_reason_table */
153
154
155/* ********************************************************************** */
174
175}; /* emlxs_fcf_reason_table */
176
177
178/* ********************************************************************** */
156/* FCFTAB */
179/* FCFTAB Generic */
157/* ********************************************************************** */
180/* ********************************************************************** */
181static char *emlxs_fcftab_state_xlate(emlxs_port_t *port,
182 uint32_t state);
183static uint32_t emlxs_fcftab_event(emlxs_port_t *port, uint32_t evt,
184 void *arg1);
185static uint32_t emlxs_fcftab_shutdown_action(emlxs_port_t *port,
186 uint32_t evt, void *arg1);
158
187
188/* ********************************************************************** */
189/* FC FCFTAB */
190/* ********************************************************************** */
191
159/* Order does not matter */
192/* Order does not matter */
160emlxs_table_t emlxs_fcftab_state_table[] =
193emlxs_table_t emlxs_fc_fcftab_state_table[] =
161{
194{
162 {FCFTAB_STATE_SHUTDOWN, "FCFTAB_STATE_SHUTDOWN"},
163 {FCFTAB_STATE_OFFLINE, "FCFTAB_STATE_OFFLINE"},
195 {FC_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"},
196 {FC_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"},
164
197
165 {FCFTAB_STATE_SOLICIT, "FCFTAB_STATE_SOLICIT"},
166 {FCFTAB_STATE_SOLICIT_FAILED, "FCFTAB_STATE_SOLICIT_FAILED"},
167 {FCFTAB_STATE_SOLICIT_CMPL, "FCFTAB_STATE_SOLICIT_CMPL"},
198 {FC_FCFTAB_STATE_TOPO, "FCFTAB_TOPO"},
199 {FC_FCFTAB_STATE_TOPO_FAILED, "FCFTAB_TOPO_FAILED"},
200 {FC_FCFTAB_STATE_TOPO_CMPL, "FCFTAB_TOPO_CMPL"},
168
201
169 {FCFTAB_STATE_READ, "FCFTAB_STATE_READ"},
170 {FCFTAB_STATE_READ_FAILED, "FCFTAB_STATE_READ_FAILED"},
171 {FCFTAB_STATE_READ_CMPL, "FCFTAB_STATE_READ_CMPL"},
202 {FC_FCFTAB_STATE_CFGLINK, "FCFTAB_CFGLINK"},
203 {FC_FCFTAB_STATE_CFGLINK_FAILED, "FCFTAB_CFGLINK_FAILED"},
204 {FC_FCFTAB_STATE_CFGLINK_CMPL, "FCFTAB_CFGLINK_CMPL"},
172
205
173 {FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_STATE_FCFI_OFFLINE"},
174 {FCFTAB_STATE_FCFI_OFFLINE_CMPL, "FCFTAB_STATE_FCFI_OFFLINE_CMPL"},
206 {FC_FCFTAB_STATE_SPARM, "FCFTAB_SPARM"},
207 {FC_FCFTAB_STATE_SPARM_FAILED, "FCFTAB_SPARM_FAILED"},
208 {FC_FCFTAB_STATE_SPARM_CMPL, "FCFTAB_SPARM_CMPL"},
175
209
176 {FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_STATE_FCFI_ONLINE"},
177 {FCFTAB_STATE_FCFI_ONLINE_CMPL, "FCFTAB_STATE_FCFI_ONLINE_CMPL"},
210 {FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
211 "FCFTAB_FCFI_OFFLINE_CMPL"},
212 {FC_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"},
178
213
179 {FCFTAB_STATE_ONLINE, "FCFTAB_STATE_ONLINE"},
214 {FC_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"},
215 {FC_FCFTAB_STATE_FCFI_ONLINE_CMPL, "FCFTAB_FCFI_ONLINE_CMPL"},
180
216
181}; /* emlxs_fcftab_state_table */
217 {FC_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"},
182
218
219}; /* emlxs_fc_fcftab_state_table */
183
220
184static uint32_t emlxs_fcftab_sol_cmpl_action(emlxs_port_t *port,
221static void emlxs_fc_fcftab_online_timer(emlxs_hba_t *hba);
222
223static uint32_t emlxs_fc_fcftab_offline_action(emlxs_port_t *port,
185 uint32_t evt, void *arg1);
224 uint32_t evt, void *arg1);
186static uint32_t emlxs_fcftab_sol_failed_action(emlxs_port_t *port,
225static uint32_t emlxs_fc_fcftab_online_action(emlxs_port_t *port,
187 uint32_t evt, void *arg1);
226 uint32_t evt, void *arg1);
188static uint32_t emlxs_fcftab_sol_action(emlxs_port_t *port,
227
228static uint32_t emlxs_fc_fcftab_topo_cmpl_action(emlxs_port_t *port,
189 uint32_t evt, void *arg1);
229 uint32_t evt, void *arg1);
190static uint32_t emlxs_fcftab_shutdown_evt_action(emlxs_port_t *port,
230static uint32_t emlxs_fc_fcftab_topo_failed_action(emlxs_port_t *port,
191 uint32_t evt, void *arg1);
231 uint32_t evt, void *arg1);
192static uint32_t emlxs_fcftab_linkdown_evt_action(emlxs_port_t *port,
232static uint32_t emlxs_fc_fcftab_topo_action(emlxs_port_t *port,
193 uint32_t evt, void *arg1);
233 uint32_t evt, void *arg1);
194static uint32_t emlxs_fcftab_read_action(emlxs_port_t *port,
234
235static uint32_t emlxs_fc_fcftab_cfglink_cmpl_action(emlxs_port_t *port,
195 uint32_t evt, void *arg1);
236 uint32_t evt, void *arg1);
196static uint32_t emlxs_fcftab_read_failed_action(emlxs_port_t *port,
237static uint32_t emlxs_fc_fcftab_cfglink_failed_action(emlxs_port_t *port,
197 uint32_t evt, void *arg1);
238 uint32_t evt, void *arg1);
198static uint32_t emlxs_fcftab_read_cmpl_action(emlxs_port_t *port,
239static uint32_t emlxs_fc_fcftab_cfglink_action(emlxs_port_t *port,
199 uint32_t evt, void *arg1);
240 uint32_t evt, void *arg1);
200static uint32_t emlxs_fcftab_fcfi_online_action(emlxs_port_t *port,
241
242static uint32_t emlxs_fc_fcftab_sparm_cmpl_action(emlxs_port_t *port,
201 uint32_t evt, void *arg1);
243 uint32_t evt, void *arg1);
202static uint32_t emlxs_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port,
244static uint32_t emlxs_fc_fcftab_sparm_failed_action(emlxs_port_t *port,
203 uint32_t evt, void *arg1);
245 uint32_t evt, void *arg1);
204static uint32_t emlxs_fcftab_fcfi_offline_action(emlxs_port_t *port,
246static uint32_t emlxs_fc_fcftab_sparm_action(emlxs_port_t *port,
205 uint32_t evt, void *arg1);
247 uint32_t evt, void *arg1);
206static uint32_t emlxs_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port,
248
249static uint32_t emlxs_fc_fcftab_linkup_evt_action(emlxs_port_t *port,
207 uint32_t evt, void *arg1);
250 uint32_t evt, void *arg1);
208static uint32_t emlxs_fcftab_found_evt_action(emlxs_port_t *port,
251static uint32_t emlxs_fc_fcftab_linkdown_evt_action(emlxs_port_t *port,
209 uint32_t evt, void *arg1);
252 uint32_t evt, void *arg1);
210static uint32_t emlxs_fcftab_lost_evt_action(emlxs_port_t *port,
253
254static uint32_t emlxs_fc_fcftab_fcfi_online_evt_action(emlxs_port_t *port,
211 uint32_t evt, void *arg1);
255 uint32_t evt, void *arg1);
212static uint32_t emlxs_fcftab_changed_evt_action(emlxs_port_t *port,
256static uint32_t emlxs_fc_fcftab_fcfi_offline_evt_action(emlxs_port_t *port,
213 uint32_t evt, void *arg1);
257 uint32_t evt, void *arg1);
214static uint32_t emlxs_fcftab_full_evt_action(emlxs_port_t *port,
258
259static uint32_t emlxs_fc_fcftab_shutdown_evt_action(emlxs_port_t *port,
215 uint32_t evt, void *arg1);
260 uint32_t evt, void *arg1);
216static uint32_t emlxs_fcftab_linkup_evt_action(emlxs_port_t *port,
261static uint32_t emlxs_fc_fcftab_fcfi_offline_action(emlxs_port_t *port,
217 uint32_t evt, void *arg1);
262 uint32_t evt, void *arg1);
218static uint32_t emlxs_fcftab_cvl_evt_action(emlxs_port_t *port,
263static uint32_t emlxs_fc_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port,
219 uint32_t evt, void *arg1);
264 uint32_t evt, void *arg1);
220static uint32_t emlxs_fcftab_online_action(emlxs_port_t *port,
265static uint32_t emlxs_fc_fcftab_fcfi_online_action(emlxs_port_t *port,
221 uint32_t evt, void *arg1);
266 uint32_t evt, void *arg1);
222static uint32_t emlxs_fcftab_offline_action(emlxs_port_t *port,
267static uint32_t emlxs_fc_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port,
223 uint32_t evt, void *arg1);
268 uint32_t evt, void *arg1);
224static uint32_t emlxs_fcftab_fcfi_offline_evt_action(emlxs_port_t *port,
269
270static char *emlxs_fc_fcftab_state_xlate(uint32_t state);
271static uint32_t emlxs_fc_fcftab_event(emlxs_port_t *port,
225 uint32_t evt, void *arg1);
272 uint32_t evt, void *arg1);
226static uint32_t emlxs_fcftab_fcfi_online_evt_action(emlxs_port_t *port,
273static uint32_t emlxs_fc_fcftab_req_handler(emlxs_port_t *port, void *arg1);
274
275/*
276 * - Online sequencing can start from FC_FCFTAB_STATE_OFFLINE state
277 *
278 * - Offline sequencing can interrupt the online sequencing at the
279 * entry of the next wait state.
280 *
281 * NORMAL ONLINE SEQ
282 * ---------------------------
283 * LINK_UP event <-- Adapter
284 * FC_FCFTAB_STATE_OFFLINE
285 * FC_FCFTAB_STATE_TOPO
286 * FC_FCFTAB_STATE_TOPO_CMPL
287 * FC_FCFTAB_STATE_CFGLINK
288 * FC_FCFTAB_STATE_CFGLINK_CMPL
289 * FC_FCFTAB_STATE_SPARM
290 * FC_FCFTAB_STATE_SPARM_CMPL
291 * FC_FCFTAB_STATE_FCFI_ONLINE
292 * FC_FCFTAB_STATE_FCFI_ONLINE_CMPL
293 * FC_FCFTAB_STATE_ONLINE
294 *
295 *
296 * NORMAL OFFLINE SEQ
297 * ---------------------------
298 * LINK_DOWN event <-- Adapter
299 * FC_FCFTAB_STATE_ONLINE
300 * FC_FCFTAB_STATE_FCFI_OFFLINE
301 * FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL
302 * FC_FCFTAB_STATE_OFFLINE
303 *
304 */
305/* Order does matter */
306static void *emlxs_fc_fcftab_action_table[] =
307{
308 /* Action routine Event */
309/* FC_FCFTAB_STATE_SHUTDOWN 0 (Requires adapter reset) */
310 (void *) emlxs_fcftab_shutdown_action, /* STATE_ENTER */
311 (void *) NULL, /* SHUTDOWN */
312 (void *) NULL, /* LINK_UP */
313 (void *) NULL, /* LINK_DOWN */
314 (void *) NULL, /* FCFI_ONLINE */
315 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
316
317/* FC_FCFTAB_STATE_OFFLINE 1 (Wait for LINK_UP event) */
318 (void *) emlxs_fc_fcftab_offline_action, /* STATE_ENTER */
319 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
320 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
321 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
322 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
323 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
324
325
326/* FC_FCFTAB_STATE_TOPO 2 (Wait for topo mbcmpl) */
327 (void *) emlxs_fc_fcftab_topo_action, /* STATE_ENTER */
328 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
329 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
330 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
331 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
332 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
333
334/* FC_FCFTAB_STATE_TOPO_FAILED 3 (Transitional) */
335 (void *) emlxs_fc_fcftab_topo_failed_action, /* STATE_ENTER */
336 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
337 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
338 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
339 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
340 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
341
342/* FC_FCFTAB_STATE_TOPO_CMPL 4 (Transitional) */
343 (void *) emlxs_fc_fcftab_topo_cmpl_action, /* STATE_ENTER */
344 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
345 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
346 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
347 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
348 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
349
350
351/* FC_FCFTAB_STATE_CFGLINK 5 (Wait for cfglink mbcmpl) */
352 (void *) emlxs_fc_fcftab_cfglink_action, /* STATE_ENTER */
353 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
354 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
355 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
356 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
357 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
358
359/* FC_FCFTAB_STATE_CFGLINK_FAILED 6 (Transitional) */
360 (void *) emlxs_fc_fcftab_cfglink_failed_action, /* STATE_ENTER */
361 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
362 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
363 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
364 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
365 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
366
367/* FC_FCFTAB_STATE_CFGLINK_CMPL 7 (Transitional) */
368 (void *) emlxs_fc_fcftab_cfglink_cmpl_action, /* STATE_ENTER */
369 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
370 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
371 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
372 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
373 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
374
375
376/* FC_FCFTAB_STATE_SPARM 8 (Wait for sparm mbcmpl) */
377 (void *) emlxs_fc_fcftab_sparm_action, /* STATE_ENTER */
378 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
379 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
380 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
381 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
382 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
383
384/* FC_FCFTAB_STATE_SPARM_FAILED 9 (Transitional) */
385 (void *) emlxs_fc_fcftab_sparm_failed_action, /* STATE_ENTER */
386 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
387 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
388 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
389 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
390 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
391
392/* FC_FCFTAB_STATE_SPARM_CMPL 10 (Transitional) */
393 (void *) emlxs_fc_fcftab_sparm_cmpl_action, /* STATE_ENTER */
394 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
395 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
396 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
397 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
398 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
399
400
401/* FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL 11 (Transitional) */
402 (void *) emlxs_fc_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */
403 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
404 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
405 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
406 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
407 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
408
409/* FC_FCFTAB_STATE_FCFI_OFFLINE 12 (Wait for FCFI_OFFLINE event) */
410 (void *) emlxs_fc_fcftab_fcfi_offline_action, /* STATE_ENTER */
411 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
412 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
413 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
414 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
415 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
416
417
418/* FC_FCFTAB_STATE_FCFI_ONLINE 13 (Wait for FCFI_ONLINE event) */
419 (void *) emlxs_fc_fcftab_fcfi_online_action, /* STATE_ENTER */
420 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
421 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
422 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
423 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
424 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
425
426/* FC_FCFTAB_STATE_FCFI_ONLINE_CMPL 14 (Transitional) */
427 (void *) emlxs_fc_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */
428 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
429 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
430 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
431 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
432 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
433
434
435/* FC_FCFTAB_STATE_ONLINE 15 (Wait for LINK_DOWN evt) */
436 (void *) emlxs_fc_fcftab_online_action, /* STATE_ENTER */
437 (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */
438 (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */
439 (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */
440 (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
441 (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
442
443}; /* emlxs_fc_fcftab_action_table[] */
444#define FC_FCFTAB_ACTION_EVENTS 6
445#define FC_FCFTAB_ACTION_STATES \
446 (sizeof (emlxs_fc_fcftab_action_table)/ \
447 (FC_FCFTAB_ACTION_EVENTS * sizeof (void *)))
448
449
450/* ********************************************************************** */
451/* FCOE FCFTAB */
452/* ********************************************************************** */
453
454/* Order does not matter */
455emlxs_table_t emlxs_fcoe_fcftab_state_table[] =
456{
457 {FCOE_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"},
458 {FCOE_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"},
459
460 {FCOE_FCFTAB_STATE_SOLICIT, "FCFTAB_SOLICIT"},
461 {FCOE_FCFTAB_STATE_SOLICIT_FAILED, "FCFTAB_SOLICIT_FAILED"},
462 {FCOE_FCFTAB_STATE_SOLICIT_CMPL, "FCFTAB_SOLICIT_CMPL"},
463
464 {FCOE_FCFTAB_STATE_READ, "FCFTAB_READ"},
465 {FCOE_FCFTAB_STATE_READ_FAILED, "FCFTAB_READ_FAILED"},
466 {FCOE_FCFTAB_STATE_READ_CMPL, "FCFTAB_READ_CMPL"},
467
468 {FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
469 "FCFTAB_FCFI_OFFLINE_CMPL"},
470 {FCOE_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"},
471
472 {FCOE_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"},
473 {FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL,
474 "FCFTAB_FCFI_ONLINE_CMPL"},
475
476 {FCOE_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"},
477
478}; /* emlxs_fcoe_fcftab_state_table */
479
480static uint32_t emlxs_fcoe_fcftab_sol_cmpl_action(emlxs_port_t *port,
227 uint32_t evt, void *arg1);
481 uint32_t evt, void *arg1);
228static uint32_t emlxs_fcftab_shutdown_action(emlxs_port_t *port,
482static uint32_t emlxs_fcoe_fcftab_sol_failed_action(emlxs_port_t *port,
229 uint32_t evt, void *arg1);
483 uint32_t evt, void *arg1);
484static uint32_t emlxs_fcoe_fcftab_sol_action(emlxs_port_t *port,
485 uint32_t evt, void *arg1);
486static uint32_t emlxs_fcoe_fcftab_shutdown_evt_action(emlxs_port_t *port,
487 uint32_t evt, void *arg1);
488static uint32_t emlxs_fcoe_fcftab_linkdown_evt_action(emlxs_port_t *port,
489 uint32_t evt, void *arg1);
490static uint32_t emlxs_fcoe_fcftab_read_action(emlxs_port_t *port,
491 uint32_t evt, void *arg1);
492static uint32_t emlxs_fcoe_fcftab_read_failed_action(emlxs_port_t *port,
493 uint32_t evt, void *arg1);
494static uint32_t emlxs_fcoe_fcftab_read_cmpl_action(emlxs_port_t *port,
495 uint32_t evt, void *arg1);
496static uint32_t emlxs_fcoe_fcftab_fcfi_online_action(emlxs_port_t *port,
497 uint32_t evt, void *arg1);
498static uint32_t emlxs_fcoe_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port,
499 uint32_t evt, void *arg1);
500static uint32_t emlxs_fcoe_fcftab_fcfi_offline_action(emlxs_port_t *port,
501 uint32_t evt, void *arg1);
502static uint32_t emlxs_fcoe_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port,
503 uint32_t evt, void *arg1);
504static uint32_t emlxs_fcoe_fcftab_found_evt_action(emlxs_port_t *port,
505 uint32_t evt, void *arg1);
506static uint32_t emlxs_fcoe_fcftab_lost_evt_action(emlxs_port_t *port,
507 uint32_t evt, void *arg1);
508static uint32_t emlxs_fcoe_fcftab_changed_evt_action(emlxs_port_t *port,
509 uint32_t evt, void *arg1);
510static uint32_t emlxs_fcoe_fcftab_full_evt_action(emlxs_port_t *port,
511 uint32_t evt, void *arg1);
512static uint32_t emlxs_fcoe_fcftab_linkup_evt_action(emlxs_port_t *port,
513 uint32_t evt, void *arg1);
514static uint32_t emlxs_fcoe_fcftab_cvl_evt_action(emlxs_port_t *port,
515 uint32_t evt, void *arg1);
516static uint32_t emlxs_fcoe_fcftab_online_action(emlxs_port_t *port,
517 uint32_t evt, void *arg1);
518static uint32_t emlxs_fcoe_fcftab_offline_action(emlxs_port_t *port,
519 uint32_t evt, void *arg1);
520static uint32_t emlxs_fcoe_fcftab_fcfi_offline_evt_action(emlxs_port_t *port,
521 uint32_t evt, void *arg1);
522static uint32_t emlxs_fcoe_fcftab_fcfi_online_evt_action(emlxs_port_t *port,
523 uint32_t evt, void *arg1);
230
524
231static void emlxs_fcftab_read_timer(emlxs_hba_t *hba);
232static void emlxs_fcftab_sol_timer(emlxs_hba_t *hba);
233static void emlxs_fcftab_offline_timer(emlxs_hba_t *hba);
234static char *emlxs_fcftab_state_xlate(uint32_t state);
235static uint32_t emlxs_fcftab_event(emlxs_port_t *port,
525static void emlxs_fcoe_fcftab_read_timer(emlxs_hba_t *hba);
526static void emlxs_fcoe_fcftab_sol_timer(emlxs_hba_t *hba);
527static void emlxs_fcoe_fcftab_offline_timer(emlxs_hba_t *hba);
528static char *emlxs_fcoe_fcftab_state_xlate(uint32_t state);
529static uint32_t emlxs_fcoe_fcftab_event(emlxs_port_t *port,
236 uint32_t evt, void *arg1);
530 uint32_t evt, void *arg1);
531static uint32_t emlxs_fcoe_fcftab_state(emlxs_port_t *port, uint16_t state,
532 uint16_t reason, uint32_t explain, void *arg1);
237
238/*
533
534/*
239 * - Online sequencing can start from FCFI_STATE_OFFLINE state
535 * - Online sequencing can start from FCOE_FCFTAB_STATE_OFFLINE state
240 *
241 * - Offline sequencing can interrupt the online sequencing at the
242 * entry of the next wait state.
243 *
244 * NORMAL ONLINE SEQ
245 * ---------------------------
246 * LINK_UP event <-- Adapter
536 *
537 * - Offline sequencing can interrupt the online sequencing at the
538 * entry of the next wait state.
539 *
540 * NORMAL ONLINE SEQ
541 * ---------------------------
542 * LINK_UP event <-- Adapter
247 * FCFTAB_STATE_OFFLINE
248 * FCFTAB_STATE_SOLICIT
249 * FCFTAB_STATE_SOLICIT_CMPL
250 * FCFTAB_STATE_READ
251 * FCFTAB_STATE_READ_CMPL
252 * FCFTAB_STATE_FCFI_OFFLINE
253 * FCFTAB_STATE_FCFI_OFFLINE_CMPL
254 * FCFTAB_STATE_FCFI_ONLINE
255 * FCFTAB_STATE_FCFI_ONLINE_CMPL
256 * FCFTAB_STATE_ONLINE
543 * FCOE_FCFTAB_STATE_OFFLINE
544 * FCOE_FCFTAB_STATE_SOLICIT
545 * FCOE_FCFTAB_STATE_SOLICIT_CMPL
546 * FCOE_FCFTAB_STATE_READ
547 * FCOE_FCFTAB_STATE_READ_CMPL
548 * FCOE_FCFTAB_STATE_FCFI_OFFLINE
549 * FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL
550 * FCOE_FCFTAB_STATE_FCFI_ONLINE
551 * FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL
552 * FCOE_FCFTAB_STATE_ONLINE
257 *
258 *
259 * NORMAL OFFLINE SEQ
260 * ---------------------------
261 * LINK_DOWN event <-- Adapter
553 *
554 *
555 * NORMAL OFFLINE SEQ
556 * ---------------------------
557 * LINK_DOWN event <-- Adapter
262 * FCFTAB_STATE_ONLINE
263 * FCFTAB_STATE_FCFI_OFFLINE
264 * FCFTAB_STATE_FCFI_OFFLINE_CMPL
265 * FCFTAB_STATE_OFFLINE
558 * FCOE_FCFTAB_STATE_ONLINE
559 * FCOE_FCFTAB_STATE_FCFI_OFFLINE
560 * FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL
561 * FCOE_FCFTAB_STATE_OFFLINE
266 *
267 */
268/* Order does matter */
562 *
563 */
564/* Order does matter */
269static void *emlxs_fcftab_action_table[] =
565static void *emlxs_fcoe_fcftab_action_table[] =
270{
271 /* Action routine Event */
566{
567 /* Action routine Event */
272/* FCFTAB_STATE_SHUTDOWN 0 (Requires adapter reset) */
568/* FCOE_FCFTAB_STATE_SHUTDOWN 0 (Requires adapter reset) */
273 (void *) emlxs_fcftab_shutdown_action, /* STATE_ENTER */
274 (void *) NULL, /* SHUTDOWN */
275 (void *) NULL, /* LINK_UP */
276 (void *) NULL, /* LINK_DOWN */
277 (void *) NULL, /* CVL_RECD */
278 (void *) NULL, /* FCF_FOUND */
279 (void *) NULL, /* FCF_LOST */
280 (void *) NULL, /* FCF_CHANGED */
281 (void *) NULL, /* TABLE_FULL */
282 (void *) NULL, /* FCFI_ONLINE */
569 (void *) emlxs_fcftab_shutdown_action, /* STATE_ENTER */
570 (void *) NULL, /* SHUTDOWN */
571 (void *) NULL, /* LINK_UP */
572 (void *) NULL, /* LINK_DOWN */
573 (void *) NULL, /* CVL_RECD */
574 (void *) NULL, /* FCF_FOUND */
575 (void *) NULL, /* FCF_LOST */
576 (void *) NULL, /* FCF_CHANGED */
577 (void *) NULL, /* TABLE_FULL */
578 (void *) NULL, /* FCFI_ONLINE */
283 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
579 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
284
580
285/* FCFTAB_STATE_OFFLINE 1 (Wait for LINK_UP event) */
286 (void *) emlxs_fcftab_offline_action, /* STATE_ENTER */
287 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
288 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
289 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
290 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
291 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
292 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
293 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
294 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
295 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
296 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
581/* FCOE_FCFTAB_STATE_OFFLINE 1 (Wait for LINK_UP event) */
582 (void *) emlxs_fcoe_fcftab_offline_action, /* STATE_ENTER */
583 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
584 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
585 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
586 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
587 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
588 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
589 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
590 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
591 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
592 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
297
298
593
594
299/* FCFTAB_STATE_SOLICIT 2 (Wait on fcf_solicit cmpl) */
300 (void *) emlxs_fcftab_sol_action, /* STATE_ENTER */
301 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
302 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
303 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
304 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
305 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
306 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
307 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
308 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
309 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
310 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
595/* FCOE_FCFTAB_STATE_SOLICIT 2 (Wait on fcf_solicit cmpl) */
596 (void *) emlxs_fcoe_fcftab_sol_action, /* STATE_ENTER */
597 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
598 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
599 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
600 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
601 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
602 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
603 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
604 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
605 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
606 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
311
607
312/* FCFTAB_STATE_SOLICIT_FAILED 3 (Transitional) */
313 (void *) emlxs_fcftab_sol_failed_action, /* STATE_ENTER */
314 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
315 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
316 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
317 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
318 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
319 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
320 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
321 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
322 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
323 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
608/* FCOE_FCFTAB_STATE_SOLICIT_FAILED 3 (Transitional) */
609 (void *) emlxs_fcoe_fcftab_sol_failed_action, /* STATE_ENTER */
610 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
611 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
612 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
613 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
614 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
615 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
616 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
617 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
618 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
619 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
324
620
325/* FCFTAB_STATE_SOLICIT_CMPL 4 (Wait on fcf timer cmpl) */
326 (void *) emlxs_fcftab_sol_cmpl_action, /* STATE_ENTER */
327 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
328 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
329 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
330 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
331 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
332 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
333 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
334 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
335 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
336 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
621/* FCOE_FCFTAB_STATE_SOLICIT_CMPL 4 (Wait on fcf timer cmpl) */
622 (void *) emlxs_fcoe_fcftab_sol_cmpl_action, /* STATE_ENTER */
623 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
624 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
625 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
626 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
627 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
628 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
629 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
630 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
631 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
632 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
337
338
633
634
339/* FCFTAB_STATE_READ 5 (Wait on fcf_read cmpl) */
340 (void *) emlxs_fcftab_read_action, /* STATE_ENTER */
341 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
342 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
343 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
344 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
345 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
346 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
347 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
348 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
349 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
350 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
635/* FCOE_FCFTAB_STATE_READ 5 (Wait on fcf_read cmpl) */
636 (void *) emlxs_fcoe_fcftab_read_action, /* STATE_ENTER */
637 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
638 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
639 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
640 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
641 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
642 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
643 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
644 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
645 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
646 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
351
647
352/* FCFTAB_STATE_READ_FAILED 6 (Transitional) */
353 (void *) emlxs_fcftab_read_failed_action, /* STATE_ENTER */
354 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
355 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
356 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
357 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
358 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
359 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
360 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
361 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
362 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
363 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
648/* FCOE_FCFTAB_STATE_READ_FAILED 6 (Transitional) */
649 (void *) emlxs_fcoe_fcftab_read_failed_action, /* STATE_ENTER */
650 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
651 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
652 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
653 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
654 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
655 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
656 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
657 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
658 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
659 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
364
660
365/* FCFTAB_STATE_READ_CMPL 7 (Transitional) */
366 (void *) emlxs_fcftab_read_cmpl_action, /* STATE_ENTER */
367 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
368 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
369 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
370 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
371 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
372 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
373 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
374 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
375 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
376 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
661/* FCOE_FCFTAB_STATE_READ_CMPL 7 (Transitional) */
662 (void *) emlxs_fcoe_fcftab_read_cmpl_action, /* STATE_ENTER */
663 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
664 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
665 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
666 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
667 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
668 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
669 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
670 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
671 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
672 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
377
378
673
674
379/* FCFTAB_STATE_FCFI_OFFLINE_CMPL 8 (Transitional) */
380 (void *) emlxs_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */
381 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
382 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
383 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
384 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
385 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
386 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
387 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
388 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
389 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
390 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
675/* FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL 8 (Transitional) */
676 (void *) emlxs_fcoe_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */
677 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
678 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
679 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
680 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
681 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
682 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
683 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
684 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
685 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
686 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
391
687
392/* FCFTAB_STATE_FCFI_OFFLINE 9 (Wait for FCFI_OFFLINE event) */
393 (void *) emlxs_fcftab_fcfi_offline_action, /* STATE_ENTER */
394 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
395 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
396 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
397 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
398 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
399 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
400 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
401 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
402 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
403 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
688/* FCOE_FCFTAB_STATE_FCFI_OFFLINE 9 (Wait for FCFI_OFFLINE event) */
689 (void *) emlxs_fcoe_fcftab_fcfi_offline_action, /* STATE_ENTER */
690 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
691 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
692 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
693 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
694 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
695 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
696 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
697 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
698 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
699 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
404
405
700
701
406/* FCFTAB_STATE_FCFI_ONLINE 10 (Wait on FCFI_ONLINE event) */
407 (void *) emlxs_fcftab_fcfi_online_action, /* STATE_ENTER */
408 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
409 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
410 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
411 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
412 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
413 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
414 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
415 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
416 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
417 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
702/* FCOE_FCFTAB_STATE_FCFI_ONLINE 10 (Wait on FCFI_ONLINE event) */
703 (void *) emlxs_fcoe_fcftab_fcfi_online_action, /* STATE_ENTER */
704 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
705 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
706 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
707 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
708 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
709 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
710 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
711 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
712 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
713 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
418
714
419/* FCFTAB_STATE_FCFI_ONLINE_CMPL 11 (Transitional) */
420 (void *) emlxs_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */
421 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
422 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
423 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
424 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
425 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
426 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
427 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
428 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
429 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
430 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
715/* FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL 11 (Transitional) */
716 (void *) emlxs_fcoe_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */
717 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
718 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
719 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
720 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
721 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
722 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
723 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
724 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
725 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
726 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
431
432
727
728
433/* FCFTAB_STATE_ONLINE 12 (Wait for LINK_DOWN event) */
434 (void *) emlxs_fcftab_online_action, /* STATE_ENTER */
435 (void *) emlxs_fcftab_shutdown_evt_action, /* SHUTDOWN */
436 (void *) emlxs_fcftab_linkup_evt_action, /* LINK_UP */
437 (void *) emlxs_fcftab_linkdown_evt_action, /* LINK_DOWN */
438 (void *) emlxs_fcftab_cvl_evt_action, /* CVL_RECD */
439 (void *) emlxs_fcftab_found_evt_action, /* FCF_FOUND */
440 (void *) emlxs_fcftab_lost_evt_action, /* FCF_LOST */
441 (void *) emlxs_fcftab_changed_evt_action, /* FCF_CHANGED */
442 (void *) emlxs_fcftab_full_evt_action, /* TABLE_FULL */
443 (void *) emlxs_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
444 (void *) emlxs_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
729/* FCOE_FCFTAB_STATE_ONLINE 12 (Wait for LINK_DOWN event) */
730 (void *) emlxs_fcoe_fcftab_online_action, /* STATE_ENTER */
731 (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */
732 (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */
733 (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */
734 (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */
735 (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */
736 (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */
737 (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */
738 (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */
739 (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */
740 (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */
445
741
446}; /* emlxs_fcftab_action_table[] */
447#define FCFTAB_ACTION_EVENTS 11
448#define FCFTAB_ACTION_STATES \
449 (sizeof (emlxs_fcftab_action_table)/ \
450 (FCFTAB_ACTION_EVENTS * sizeof (void *)))
742}; /* emlxs_fcoe_fcftab_action_table[] */
743#define FCOE_FCFTAB_ACTION_EVENTS 11
744#define FCOE_FCFTAB_ACTION_STATES \
745 (sizeof (emlxs_fcoe_fcftab_action_table)/ \
746 (FCOE_FCFTAB_ACTION_EVENTS * sizeof (void *)))
451
452
747
748
453/* ********************************************************************** */
454/* VFTAB - This will be needed for multi-virtual fabric environments */
455/* ********************************************************************** */
456
749
457/* Order does not matter */
458emlxs_table_t emlxs_vftab_state_table[] =
459{
460 {VFTAB_STATE_DISABLED, "VFTAB_STATE_DISABLED"},
461
750
462}; /* emlxs_vftab_state_table */
463
464
465
466/* ********************************************************************** */
467/* FCFI */
468/* ********************************************************************** */
469
470/* Order does not matter */
471emlxs_table_t emlxs_fcfi_state_table[] =
472{
751/* ********************************************************************** */
752/* FCFI */
753/* ********************************************************************** */
754
755/* Order does not matter */
756emlxs_table_t emlxs_fcfi_state_table[] =
757{
473 {FCFI_STATE_FREE, "FCFI_STATE_FREE"},
758 {FCFI_STATE_FREE, "FCFI_FREE"},
474
759
475 {FCFI_STATE_OFFLINE, "FCFI_STATE_OFFLINE"},
760 {FCFI_STATE_OFFLINE, "FCFI_OFFLINE"},
476
761
477 {FCFI_STATE_UNREG_CMPL, "FCFI_STATE_UNREG_CMPL"},
478 {FCFI_STATE_UNREG_FAILED, "FCFI_STATE_UNREG_FAILED"},
479 {FCFI_STATE_UNREG, "FCFI_STATE_UNREG"},
762 {FCFI_STATE_UNREG_CMPL, "FCFI_UNREG_CMPL"},
763 {FCFI_STATE_UNREG_FAILED, "FCFI_UNREG_FAILED"},
764 {FCFI_STATE_UNREG, "FCFI_UNREG"},
480
765
481 {FCFI_STATE_REG, "FCFI_STATE_REG"},
482 {FCFI_STATE_REG_FAILED, "FCFI_STATE_REG_FAILED"},
483 {FCFI_STATE_REG_CMPL, "FCFI_STATE_REG_CMPL"},
766 {FCFI_STATE_REG, "FCFI_REG"},
767 {FCFI_STATE_REG_FAILED, "FCFI_REG_FAILED"},
768 {FCFI_STATE_REG_CMPL, "FCFI_REG_CMPL"},
484
769
485 {FCFI_STATE_VFI_OFFLINE_CMPL, "FCFI_STATE_VFI_OFFLINE_CMPL"},
486 {FCFI_STATE_VFI_OFFLINE, "FCFI_STATE_VFI_OFFLINE"},
770 {FCFI_STATE_VFI_OFFLINE_CMPL, "FCFI_VFI_OFFLINE_CMPL"},
771 {FCFI_STATE_VFI_OFFLINE, "FCFI_VFI_OFFLINE"},
487
772
488 {FCFI_STATE_VFI_ONLINE, "FCFI_STATE_VFI_ONLINE"},
489 {FCFI_STATE_VFI_ONLINE_CMPL, "FCFI_STATE_VFI_ONLINE_CMPL"},
773 {FCFI_STATE_VFI_ONLINE, "FCFI_VFI_ONLINE"},
774 {FCFI_STATE_VFI_ONLINE_CMPL, "FCFI_VFI_ONLINE_CMPL"},
490
775
491 {FCFI_STATE_PAUSED, "FCFI_STATE_PAUSED"},
492 {FCFI_STATE_ONLINE, "FCFI_STATE_ONLINE"},
776 {FCFI_STATE_PAUSED, "FCFI_PAUSED"},
777 {FCFI_STATE_ONLINE, "FCFI_ONLINE"},
493
494}; /* emlxs_fcfi_state_table */
495
496
497static uint32_t emlxs_fcfi_free_action(emlxs_port_t *port,
498 FCFIobj_t *fcfp, uint32_t evt, void *arg1);
499static uint32_t emlxs_fcfi_online_evt_action(emlxs_port_t *port,
500 FCFIobj_t *fcfp, uint32_t evt, void *arg1);

--- 206 unchanged lines hidden (view full) ---

707
708/* ********************************************************************** */
709/* VFI */
710/* ********************************************************************** */
711
712/* Order does not matter */
713emlxs_table_t emlxs_vfi_state_table[] =
714{
778
779}; /* emlxs_fcfi_state_table */
780
781
782static uint32_t emlxs_fcfi_free_action(emlxs_port_t *port,
783 FCFIobj_t *fcfp, uint32_t evt, void *arg1);
784static uint32_t emlxs_fcfi_online_evt_action(emlxs_port_t *port,
785 FCFIobj_t *fcfp, uint32_t evt, void *arg1);

--- 206 unchanged lines hidden (view full) ---

992
993/* ********************************************************************** */
994/* VFI */
995/* ********************************************************************** */
996
997/* Order does not matter */
998emlxs_table_t emlxs_vfi_state_table[] =
999{
715 {VFI_STATE_OFFLINE, "VFI_STATE_OFFLINE"},
1000 {VFI_STATE_OFFLINE, "VFI_OFFLINE"},
716
1001
717 {VFI_STATE_INIT, "VFI_STATE_INIT"},
718 {VFI_STATE_INIT_FAILED, "VFI_STATE_INIT_FAILED"},
719 {VFI_STATE_INIT_CMPL, "VFI_STATE_INIT_CMPL"},
1002 {VFI_STATE_INIT, "VFI_INIT"},
1003 {VFI_STATE_INIT_FAILED, "VFI_INIT_FAILED"},
1004 {VFI_STATE_INIT_CMPL, "VFI_INIT_CMPL"},
720
1005
721 {VFI_STATE_VPI_OFFLINE_CMPL, "VFI_STATE_VPI_OFFLINE_CMPL"},
722 {VFI_STATE_VPI_OFFLINE, "VFI_STATE_VPI_OFFLINE"},
1006 {VFI_STATE_VPI_OFFLINE_CMPL, "VFI_VPI_OFFLINE_CMPL"},
1007 {VFI_STATE_VPI_OFFLINE, "VFI_VPI_OFFLINE"},
723
1008
724 {VFI_STATE_VPI_ONLINE, "VFI_STATE_VPI_ONLINE"},
725 {VFI_STATE_VPI_ONLINE_CMPL, "VFI_STATE_VPI_ONLINE_CMPL"},
1009 {VFI_STATE_VPI_ONLINE, "VFI_VPI_ONLINE"},
1010 {VFI_STATE_VPI_ONLINE_CMPL, "VFI_VPI_ONLINE_CMPL"},
726
1011
727 {VFI_STATE_UNREG_CMPL, "VFI_STATE_UNREG_CMPL"},
728 {VFI_STATE_UNREG_FAILED, "VFI_STATE_UNREG_FAILED"},
729 {VFI_STATE_UNREG, "VFI_STATE_UNREG"},
1012 {VFI_STATE_UNREG_CMPL, "VFI_UNREG_CMPL"},
1013 {VFI_STATE_UNREG_FAILED, "VFI_UNREG_FAILED"},
1014 {VFI_STATE_UNREG, "VFI_UNREG"},
730
1015
731 {VFI_STATE_REG, "VFI_STATE_REG"},
732 {VFI_STATE_REG_FAILED, "VFI_STATE_REG_FAILED"},
733 {VFI_STATE_REG_CMPL, "VFI_STATE_REG_CMPL"},
1016 {VFI_STATE_REG, "VFI_REG"},
1017 {VFI_STATE_REG_FAILED, "VFI_REG_FAILED"},
1018 {VFI_STATE_REG_CMPL, "VFI_REG_CMPL"},
734
1019
735 {VFI_STATE_PAUSED, "VFI_STATE_PAUSED"},
736 {VFI_STATE_ONLINE, "VFI_STATE_ONLINE"},
1020 {VFI_STATE_PAUSED, "VFI_PAUSED"},
1021 {VFI_STATE_ONLINE, "VFI_ONLINE"},
737
738}; /* emlxs_vfi_state_table */
739
740
741static uint32_t emlxs_vfi_pause_evt_action(emlxs_port_t *port,
742 VFIobj_t *vfip, uint32_t evt, void *arg1);
743static uint32_t emlxs_vfi_online_evt_action(emlxs_port_t *port,
744 VFIobj_t *vfip, uint32_t evt, void *arg1);

--- 227 unchanged lines hidden (view full) ---

972
973/* ********************************************************************** */
974/* VPI */
975/* ********************************************************************** */
976
977/* Order does not matter */
978emlxs_table_t emlxs_vpi_state_table[] =
979{
1022
1023}; /* emlxs_vfi_state_table */
1024
1025
1026static uint32_t emlxs_vfi_pause_evt_action(emlxs_port_t *port,
1027 VFIobj_t *vfip, uint32_t evt, void *arg1);
1028static uint32_t emlxs_vfi_online_evt_action(emlxs_port_t *port,
1029 VFIobj_t *vfip, uint32_t evt, void *arg1);

--- 227 unchanged lines hidden (view full) ---

1257
1258/* ********************************************************************** */
1259/* VPI */
1260/* ********************************************************************** */
1261
1262/* Order does not matter */
1263emlxs_table_t emlxs_vpi_state_table[] =
1264{
980 {VPI_STATE_OFFLINE, "VPI_STATE_OFFLINE"},
1265 {VPI_STATE_OFFLINE, "VPI_OFFLINE"},
981
1266
982 {VPI_STATE_INIT, "VPI_STATE_INIT"},
983 {VPI_STATE_INIT_FAILED, "VPI_STATE_INIT_FAILED"},
984 {VPI_STATE_INIT_CMPL, "VPI_STATE_INIT_CMPL"},
1267 {VPI_STATE_INIT, "VPI_INIT"},
1268 {VPI_STATE_INIT_FAILED, "VPI_INIT_FAILED"},
1269 {VPI_STATE_INIT_CMPL, "VPI_INIT_CMPL"},
985
1270
986 {VPI_STATE_UNREG_CMPL, "VPI_STATE_UNREG_CMPL"},
987 {VPI_STATE_UNREG_FAILED, "VPI_STATE_UNREG_FAILED"},
988 {VPI_STATE_UNREG, "VPI_STATE_UNREG"},
1271 {VPI_STATE_UNREG_CMPL, "VPI_UNREG_CMPL"},
1272 {VPI_STATE_UNREG_FAILED, "VPI_UNREG_FAILED"},
1273 {VPI_STATE_UNREG, "VPI_UNREG"},
989
1274
990 {VPI_STATE_LOGO_CMPL, "VPI_STATE_LOGO_CMPL"},
991 {VPI_STATE_LOGO_FAILED, "VPI_STATE_LOGO_FAILED"},
992 {VPI_STATE_LOGO, "VPI_STATE_LOGO"},
1275 {VPI_STATE_LOGO_CMPL, "VPI_LOGO_CMPL"},
1276 {VPI_STATE_LOGO_FAILED, "VPI_LOGO_FAILED"},
1277 {VPI_STATE_LOGO, "VPI_LOGO"},
993
1278
994 {VPI_STATE_PORT_OFFLINE, "VPI_STATE_PORT_OFFLINE"},
995 {VPI_STATE_PORT_ONLINE, "VPI_STATE_PORT_ONLINE"},
1279 {VPI_STATE_PORT_OFFLINE, "VPI_PORT_OFFLINE"},
1280 {VPI_STATE_PORT_ONLINE, "VPI_PORT_ONLINE"},
996
1281
997 {VPI_STATE_LOGI, "VPI_STATE_LOGI"},
998 {VPI_STATE_LOGI_FAILED, "VPI_STATE_LOGI_FAILED"},
999 {VPI_STATE_LOGI_CMPL, "VPI_STATE_LOGI_CMPL"},
1282 {VPI_STATE_LOGI, "VPI_LOGI"},
1283 {VPI_STATE_LOGI_FAILED, "VPI_LOGI_FAILED"},
1284 {VPI_STATE_LOGI_CMPL, "VPI_LOGI_CMPL"},
1000
1285
1001 {VPI_STATE_REG, "VPI_STATE_REG"},
1002 {VPI_STATE_REG_FAILED, "VPI_STATE_REG_FAILED"},
1003 {VPI_STATE_REG_CMPL, "VPI_STATE_REG_CMPL"},
1286 {VPI_STATE_REG, "VPI_REG"},
1287 {VPI_STATE_REG_FAILED, "VPI_REG_FAILED"},
1288 {VPI_STATE_REG_CMPL, "VPI_REG_CMPL"},
1004
1289
1005 {VPI_STATE_PAUSED, "VPI_STATE_PAUSED"},
1006 {VPI_STATE_ONLINE, "VPI_STATE_ONLINE"},
1290 {VPI_STATE_PAUSED, "VPI_PAUSED"},
1291 {VPI_STATE_ONLINE, "VPI_ONLINE"},
1007
1008}; /* emlxs_vpi_state_table */
1009
1010
1011static uint32_t emlxs_vpi_online_evt_action(emlxs_port_t *port,
1012 VPIobj_t *vpip, uint32_t evt, void *arg1);
1013static uint32_t emlxs_vpi_offline_evt_action(emlxs_port_t *port,
1014 VPIobj_t *vpip, uint32_t evt, void *arg1);

--- 50 unchanged lines hidden (view full) ---

1065 VPIobj_t *vpip, uint32_t evt, void *arg1);
1066static uint32_t emlxs_vpi_logo_failed_action(emlxs_port_t *port,
1067 VPIobj_t *vpip, uint32_t evt, void *arg1);
1068static uint32_t emlxs_vpi_logo_cmpl_action(emlxs_port_t *port,
1069 VPIobj_t *vpip, uint32_t evt, void *arg1);
1070
1071static uint32_t emlxs_vpi_event(emlxs_port_t *port,
1072 uint32_t evt, void *arg1);
1292
1293}; /* emlxs_vpi_state_table */
1294
1295
1296static uint32_t emlxs_vpi_online_evt_action(emlxs_port_t *port,
1297 VPIobj_t *vpip, uint32_t evt, void *arg1);
1298static uint32_t emlxs_vpi_offline_evt_action(emlxs_port_t *port,
1299 VPIobj_t *vpip, uint32_t evt, void *arg1);

--- 50 unchanged lines hidden (view full) ---

1350 VPIobj_t *vpip, uint32_t evt, void *arg1);
1351static uint32_t emlxs_vpi_logo_failed_action(emlxs_port_t *port,
1352 VPIobj_t *vpip, uint32_t evt, void *arg1);
1353static uint32_t emlxs_vpi_logo_cmpl_action(emlxs_port_t *port,
1354 VPIobj_t *vpip, uint32_t evt, void *arg1);
1355
1356static uint32_t emlxs_vpi_event(emlxs_port_t *port,
1357 uint32_t evt, void *arg1);
1073static void emlxs_vpi_flogi_cmpl(emlxs_port_t *port, VPIobj_t *vpip,
1074 uint32_t status);
1358static uint32_t emlxs_vpi_logi_cmpl_notify(emlxs_port_t *port,
1359 RPIobj_t *rpip);
1360static void emlxs_vpi_logo_handler(emlxs_port_t *port,
1361 VPIobj_t *vpip);
1075
1076/*
1077 * - Online sequencing can only start from VPI_STATE_OFFLINE or
1078 * VPI_STATE_PORT_OFFLINE state.
1079 *
1080 * - Offline sequencing can interrupt the online sequencing at the
1081 * entry of the next wait state.
1082 *

--- 233 unchanged lines hidden (view full) ---

1316
1317/* ********************************************************************** */
1318/* RPI */
1319/* ********************************************************************** */
1320
1321/* Order does not matter */
1322emlxs_table_t emlxs_rpi_state_table[] =
1323{
1362
1363/*
1364 * - Online sequencing can only start from VPI_STATE_OFFLINE or
1365 * VPI_STATE_PORT_OFFLINE state.
1366 *
1367 * - Offline sequencing can interrupt the online sequencing at the
1368 * entry of the next wait state.
1369 *

--- 233 unchanged lines hidden (view full) ---

1603
1604/* ********************************************************************** */
1605/* RPI */
1606/* ********************************************************************** */
1607
1608/* Order does not matter */
1609emlxs_table_t emlxs_rpi_state_table[] =
1610{
1324 {RPI_STATE_FREE, "RPI_STATE_FREE"},
1611 {RPI_STATE_FREE, "RPI_FREE"},
1325
1612
1326 {RPI_STATE_OFFLINE, "RPI_STATE_OFFLINE"},
1613 {RPI_STATE_RESERVED, "RPI_RESERVED"},
1614 {RPI_STATE_OFFLINE, "RPI_OFFLINE"},
1327
1615
1328 {RPI_STATE_UNREG_CMPL, "RPI_STATE_UNREG_CMPL"},
1329 {RPI_STATE_UNREG_FAILED, "RPI_STATE_UNREG_FAILED"},
1330 {RPI_STATE_UNREG, "RPI_STATE_UNREG"},
1616 {RPI_STATE_UNREG_CMPL, "RPI_UNREG_CMPL"},
1617 {RPI_STATE_UNREG_FAILED, "RPI_UNREG_FAILED"},
1618 {RPI_STATE_UNREG, "RPI_UNREG"},
1331
1619
1332 {RPI_STATE_REG, "RPI_STATE_REG"},
1333 {RPI_STATE_REG_FAILED, "RPI_STATE_REG_FAILED"},
1334 {RPI_STATE_REG_CMPL, "RPI_STATE_REG_CMPL"},
1620 {RPI_STATE_REG, "RPI_REG"},
1621 {RPI_STATE_REG_FAILED, "RPI_REG_FAILED"},
1622 {RPI_STATE_REG_CMPL, "RPI_REG_CMPL"},
1335
1623
1336 {RPI_STATE_PAUSED, "RPI_STATE_PAUSED"},
1624 {RPI_STATE_PAUSED, "RPI_PAUSED"},
1337
1625
1338 {RPI_STATE_RESUME, "RPI_STATE_RESUME"},
1339 {RPI_STATE_RESUME_FAILED, "RPI_STATE_RESUME_FAILED"},
1340 {RPI_STATE_RESUME_CMPL, "RPI_STATE_RESUME_CMPL"},
1626 {RPI_STATE_RESUME, "RPI_RESUME"},
1627 {RPI_STATE_RESUME_FAILED, "RPI_RESUME_FAILED"},
1628 {RPI_STATE_RESUME_CMPL, "RPI_RESUME_CMPL"},
1341
1629
1342 {RPI_STATE_ONLINE, "RPI_STATE_ONLINE"},
1630 {RPI_STATE_ONLINE, "RPI_ONLINE"},
1343
1344}; /* emlxs_rpi_state_table */
1345
1346static uint32_t emlxs_rpi_free_action(emlxs_port_t *port,
1347 RPIobj_t *rpip, uint32_t evt, void *arg1);
1348
1349static uint32_t emlxs_rpi_online_evt_action(emlxs_port_t *port,
1350 RPIobj_t *rpip, uint32_t evt, void *arg1);

--- 19 unchanged lines hidden (view full) ---

1370 RPIobj_t *rpip, uint32_t evt, void *arg1);
1371
1372static uint32_t emlxs_rpi_online_action(emlxs_port_t *port,
1373 RPIobj_t *rpip, uint32_t evt, void *arg1);
1374static uint32_t emlxs_rpi_paused_action(emlxs_port_t *port,
1375 RPIobj_t *rpip, uint32_t evt, void *arg1);
1376static uint32_t emlxs_rpi_offline_action(emlxs_port_t *port,
1377 RPIobj_t *rpip, uint32_t evt, void *arg1);
1631
1632}; /* emlxs_rpi_state_table */
1633
1634static uint32_t emlxs_rpi_free_action(emlxs_port_t *port,
1635 RPIobj_t *rpip, uint32_t evt, void *arg1);
1636
1637static uint32_t emlxs_rpi_online_evt_action(emlxs_port_t *port,
1638 RPIobj_t *rpip, uint32_t evt, void *arg1);

--- 19 unchanged lines hidden (view full) ---

1658 RPIobj_t *rpip, uint32_t evt, void *arg1);
1659
1660static uint32_t emlxs_rpi_online_action(emlxs_port_t *port,
1661 RPIobj_t *rpip, uint32_t evt, void *arg1);
1662static uint32_t emlxs_rpi_paused_action(emlxs_port_t *port,
1663 RPIobj_t *rpip, uint32_t evt, void *arg1);
1664static uint32_t emlxs_rpi_offline_action(emlxs_port_t *port,
1665 RPIobj_t *rpip, uint32_t evt, void *arg1);
1666static uint32_t emlxs_rpi_reserved_action(emlxs_port_t *port,
1667 RPIobj_t *rpip, uint32_t evt, void *arg1);
1378
1379static uint32_t emlxs_rpi_resume_failed_action(emlxs_port_t *port,
1380 RPIobj_t *rpip, uint32_t evt, void *arg1);
1381static uint32_t emlxs_rpi_resume_cmpl_action(emlxs_port_t *port,
1382 RPIobj_t *rpip, uint32_t evt, void *arg1);
1383static uint32_t emlxs_rpi_resume_action(emlxs_port_t *port,
1384 RPIobj_t *rpip, uint32_t evt, void *arg1);
1385

--- 4 unchanged lines hidden (view full) ---

1390static RPIobj_t *emlxs_rpi_find_did(emlxs_port_t *port, uint32_t did);
1391
1392static void emlxs_rpi_resume_handler(emlxs_port_t *port,
1393 RPIobj_t *rpip);
1394static void emlxs_rpi_unreg_handler(emlxs_port_t *port,
1395 RPIobj_t *rpip);
1396static uint32_t emlxs_rpi_reg_handler(emlxs_port_t *port,
1397 RPIobj_t *rpip);
1668
1669static uint32_t emlxs_rpi_resume_failed_action(emlxs_port_t *port,
1670 RPIobj_t *rpip, uint32_t evt, void *arg1);
1671static uint32_t emlxs_rpi_resume_cmpl_action(emlxs_port_t *port,
1672 RPIobj_t *rpip, uint32_t evt, void *arg1);
1673static uint32_t emlxs_rpi_resume_action(emlxs_port_t *port,
1674 RPIobj_t *rpip, uint32_t evt, void *arg1);
1675

--- 4 unchanged lines hidden (view full) ---

1680static RPIobj_t *emlxs_rpi_find_did(emlxs_port_t *port, uint32_t did);
1681
1682static void emlxs_rpi_resume_handler(emlxs_port_t *port,
1683 RPIobj_t *rpip);
1684static void emlxs_rpi_unreg_handler(emlxs_port_t *port,
1685 RPIobj_t *rpip);
1686static uint32_t emlxs_rpi_reg_handler(emlxs_port_t *port,
1687 RPIobj_t *rpip);
1688
1689static void emlxs_rpi_idle_timer(emlxs_hba_t *hba);
1690
1691static uint32_t emlxs_rpi_state(emlxs_port_t *port, RPIobj_t *rpip,
1692 uint16_t state, uint16_t reason, uint32_t explain,
1693 void *arg1);
1694
1695static void emlxs_rpi_alloc_fabric_rpi(emlxs_port_t *port);
1696
1697static void emlxs_rpi_deferred_cmpl(emlxs_port_t *port, RPIobj_t *rpip,
1698 uint32_t status);
1699
1398/*
1700/*
1399 * - Online sequencing can start from RPI_STATE_OFFLINE state or
1701 * - Online sequencing can start from RPI_STATE_RESERVED state or
1400 * the RPI_STATE_PAUSED state.
1401 *
1402 * - Offline sequencing can interrupt the online sequencing at the
1403 * entry of the next wait state.
1404 *
1405 * NORMAL ONLINE SEQ
1406 * ---------------------------
1407 * RPI_ONLINE event <-- VPI
1702 * the RPI_STATE_PAUSED state.
1703 *
1704 * - Offline sequencing can interrupt the online sequencing at the
1705 * entry of the next wait state.
1706 *
1707 * NORMAL ONLINE SEQ
1708 * ---------------------------
1709 * RPI_ONLINE event <-- VPI
1408 * RPI_STATE_OFFLINE
1710 * RPI_STATE_RESERVED
1409 * RPI_STATE_REG
1410 * RPI_STATE_REG_CMPL
1411 * RPI_STATE_ONLINE
1412 * RPI_ONLINE event-->VPI
1413 *
1414 *
1415 * NORMAL OFFLINE SEQ
1416 * ---------------------------

--- 18 unchanged lines hidden (view full) ---

1435 /* Action routine Event */
1436/* RPI_STATE_FREE 0 (Wait for allocation) */
1437 (void *) emlxs_rpi_free_action, /* STATE_ENTER */
1438 (void *) NULL, /* RPI_ONLINE */
1439 (void *) NULL, /* RPI_OFFLINE */
1440 (void *) NULL, /* RPI_PAUSE */
1441 (void *) NULL, /* RPI_RESUME */
1442
1711 * RPI_STATE_REG
1712 * RPI_STATE_REG_CMPL
1713 * RPI_STATE_ONLINE
1714 * RPI_ONLINE event-->VPI
1715 *
1716 *
1717 * NORMAL OFFLINE SEQ
1718 * ---------------------------

--- 18 unchanged lines hidden (view full) ---

1737 /* Action routine Event */
1738/* RPI_STATE_FREE 0 (Wait for allocation) */
1739 (void *) emlxs_rpi_free_action, /* STATE_ENTER */
1740 (void *) NULL, /* RPI_ONLINE */
1741 (void *) NULL, /* RPI_OFFLINE */
1742 (void *) NULL, /* RPI_PAUSE */
1743 (void *) NULL, /* RPI_RESUME */
1744
1443/* RPI_STATE_OFFLINE 1 (Wait for RPI_ONLINE event) */
1745/* RPI_STATE_RESERVED 1 (Wait for RPI_ONLINE event) */
1746 (void *) emlxs_rpi_reserved_action, /* STATE_ENTER */
1747 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1748 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1749 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1750 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1751
1752/* RPI_STATE_OFFLINE 2 (Transitional) */
1444 (void *) emlxs_rpi_offline_action, /* STATE_ENTER */
1445 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1446 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1447 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1448 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1449
1753 (void *) emlxs_rpi_offline_action, /* STATE_ENTER */
1754 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1755 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1756 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1757 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1758
1450/* RPI_STATE_UNREG_CMPL 2 (Transitional) */
1759/* RPI_STATE_UNREG_CMPL 3 (Transitional) */
1451 (void *) emlxs_rpi_unreg_cmpl_action, /* STATE_ENTER */
1452 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1453 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1454 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1455 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1456
1760 (void *) emlxs_rpi_unreg_cmpl_action, /* STATE_ENTER */
1761 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1762 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1763 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1764 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1765
1457/* RPI_STATE_UNREG_FAILED 3 (Transitional) */
1766/* RPI_STATE_UNREG_FAILED 4 (Transitional) */
1458 (void *) emlxs_rpi_unreg_failed_action, /* STATE_ENTER */
1459 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1460 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1461 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1462 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1463
1767 (void *) emlxs_rpi_unreg_failed_action, /* STATE_ENTER */
1768 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1769 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1770 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1771 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1772
1464/* RPI_STATE_UNREG 4 (Wait for unreg_rpi cmpl) */
1773/* RPI_STATE_UNREG 5 (Wait for unreg_rpi cmpl) */
1465 (void *) emlxs_rpi_unreg_action, /* STATE_ENTER */
1466 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1467 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1468 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1469 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1470
1471
1774 (void *) emlxs_rpi_unreg_action, /* STATE_ENTER */
1775 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1776 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1777 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1778 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1779
1780
1472/* RPI_STATE_REG 5 (Wait for reg_rpi cmpl) */
1781/* RPI_STATE_REG 6 (Wait for reg_rpi cmpl) */
1473 (void *) emlxs_rpi_reg_action, /* STATE_ENTER */
1474 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1475 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1476 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1477 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1478
1782 (void *) emlxs_rpi_reg_action, /* STATE_ENTER */
1783 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1784 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1785 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1786 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1787
1479/* RPI_STATE_REG_FAILED 6 (Transitional) */
1788/* RPI_STATE_REG_FAILED 7 (Transitional) */
1480 (void *) emlxs_rpi_reg_failed_action, /* STATE_ENTER */
1481 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1482 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1483 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1484 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1485
1789 (void *) emlxs_rpi_reg_failed_action, /* STATE_ENTER */
1790 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1791 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1792 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1793 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1794
1486/* RPI_STATE_REG_CMPL 7 (Transitional) */
1795/* RPI_STATE_REG_CMPL 8 (Transitional) */
1487 (void *) emlxs_rpi_reg_cmpl_action, /* STATE_ENTER */
1488 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1489 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1490 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1491 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1492
1493
1796 (void *) emlxs_rpi_reg_cmpl_action, /* STATE_ENTER */
1797 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1798 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1799 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1800 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1801
1802
1494/* RPI_STATE_PAUSED 8 (Wait for RPI_ONLINE) */
1803/* RPI_STATE_PAUSED 9 (Wait for RPI_ONLINE) */
1495 (void *) emlxs_rpi_paused_action, /* STATE_ENTER */
1496 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1497 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1498 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1499 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1500
1501
1804 (void *) emlxs_rpi_paused_action, /* STATE_ENTER */
1805 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1806 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1807 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1808 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1809
1810
1502/* RPI_STATE_RESUME 9 (Wait for resume_rpi mbcmpl) */
1811/* RPI_STATE_RESUME 10 (Wait for resume_rpi mbcmpl) */
1503 (void *) emlxs_rpi_resume_action, /* STATE_ENTER */
1504 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1505 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1506 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1507 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1508
1812 (void *) emlxs_rpi_resume_action, /* STATE_ENTER */
1813 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1814 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1815 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1816 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1817
1509/* RPI_STATE_RESUME_FAILED 10 (Transitional) */
1818/* RPI_STATE_RESUME_FAILED 11 (Transitional) */
1510 (void *) emlxs_rpi_resume_failed_action, /* STATE_ENTER */
1511 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1512 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1513 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1514 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1515
1819 (void *) emlxs_rpi_resume_failed_action, /* STATE_ENTER */
1820 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1821 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1822 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1823 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1824
1516/* RPI_STATE_RESUME_CMPL 11 (Transitional) */
1825/* RPI_STATE_RESUME_CMPL 12 (Transitional) */
1517 (void *) emlxs_rpi_resume_cmpl_action, /* STATE_ENTER */
1518 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1519 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1520 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1521 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1522
1523
1826 (void *) emlxs_rpi_resume_cmpl_action, /* STATE_ENTER */
1827 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1828 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1829 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1830 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1831
1832
1524/* RPI_STATE_ONLINE 12 (Wait for RPI_OFFLINE event) */
1833/* RPI_STATE_ONLINE 13 (Wait for RPI_OFFLINE event) */
1525 (void *) emlxs_rpi_online_action, /* STATE_ENTER */
1526 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1527 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1528 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1529 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1530
1531}; /* emlxs_rpi_action_table[] */
1532#define RPI_ACTION_EVENTS 5
1533#define RPI_ACTION_STATES \
1534 (sizeof (emlxs_rpi_action_table)/ \
1535 (RPI_ACTION_EVENTS * sizeof (void *)))
1536
1537
1538/* ************************************************************************** */
1539/* FCF Generic */
1540/* ************************************************************************** */
1834 (void *) emlxs_rpi_online_action, /* STATE_ENTER */
1835 (void *) emlxs_rpi_online_evt_action, /* RPI_ONLINE */
1836 (void *) emlxs_rpi_offline_evt_action, /* RPI_OFFLINE */
1837 (void *) emlxs_rpi_pause_evt_action, /* RPI_PAUSE */
1838 (void *) emlxs_rpi_resume_evt_action, /* RPI_RESUME */
1839
1840}; /* emlxs_rpi_action_table[] */
1841#define RPI_ACTION_EVENTS 5
1842#define RPI_ACTION_STATES \
1843 (sizeof (emlxs_rpi_action_table)/ \
1844 (RPI_ACTION_EVENTS * sizeof (void *)))
1845
1846
1847/* ************************************************************************** */
1848/* FCF Generic */
1849/* ************************************************************************** */
1850static void
1851emlxs_fcf_linkdown(emlxs_port_t *port)
1852{
1853 emlxs_hba_t *hba = HBA;
1541
1854
1855 if (hba->state <= FC_LINK_DOWN) {
1856 return;
1857 }
1858
1859 mutex_enter(&EMLXS_PORT_LOCK);
1860
1861 if (hba->state <= FC_LINK_DOWN) {
1862 mutex_exit(&EMLXS_PORT_LOCK);
1863 return;
1864 }
1865
1866 HBASTATS.LinkDown++;
1867 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_DOWN);
1868
1869 hba->flag &= FC_LINKDOWN_MASK;
1870 hba->discovery_timer = 0;
1871 hba->linkup_timer = 0;
1872
1873 mutex_exit(&EMLXS_PORT_LOCK);
1874
1875 emlxs_log_link_event(port);
1876
1877 return;
1878
1879} /* emlxs_fcf_linkdown() */
1880
1881
1882static void
1883emlxs_fcf_linkup(emlxs_port_t *port)
1884{
1885 emlxs_hba_t *hba = HBA;
1886 emlxs_config_t *cfg = &CFG;
1887
1888 if (hba->state >= FC_LINK_UP) {
1889 return;
1890 }
1891
1892 mutex_enter(&EMLXS_PORT_LOCK);
1893
1894 if (hba->state >= FC_LINK_UP) {
1895 mutex_exit(&EMLXS_PORT_LOCK);
1896 return;
1897 }
1898
1899 /* Check for any mode changes */
1900 emlxs_mode_set(hba);
1901
1902 HBASTATS.LinkUp++;
1903 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_UP);
1904
1905 hba->discovery_timer = hba->timer_tics +
1906 cfg[CFG_LINKUP_TIMEOUT].current +
1907 cfg[CFG_DISC_TIMEOUT].current;
1908
1909 mutex_exit(&EMLXS_PORT_LOCK);
1910
1911 emlxs_log_link_event(port);
1912
1913 return;
1914
1915} /* emlxs_fcf_linkup() */
1916
1917
1542extern void
1543emlxs_fcf_fini(emlxs_hba_t *hba)
1544{
1545 emlxs_port_t *port = &PPORT;
1546 emlxs_port_t *vport;
1547 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
1548 uint32_t i;
1549 RPIobj_t *rpip;
1550
1918extern void
1919emlxs_fcf_fini(emlxs_hba_t *hba)
1920{
1921 emlxs_port_t *port = &PPORT;
1922 emlxs_port_t *vport;
1923 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
1924 uint32_t i;
1925 RPIobj_t *rpip;
1926
1551 if (!fcftab->table) {
1927 if (!(hba->sli.sli4.flag & EMLXS_SLI4_FCF_INIT)) {
1552 return;
1553 }
1554
1555 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
1928 return;
1929 }
1930
1931 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
1556 "emlxs_fcf_fini: %s flag=%x fcfi_online=%d.",
1557 emlxs_fcftab_state_xlate(fcftab->state),
1932 "fcf_fini: %s flag=%x fcfi_online=%d.",
1933 emlxs_fcftab_state_xlate(port, fcftab->state),
1558 fcftab->flag, fcftab->fcfi_online);
1559
1934 fcftab->flag, fcftab->fcfi_online);
1935
1560 if (fcftab->state != FCFTAB_STATE_SHUTDOWN) {
1936 if (!(fcftab->flag & EMLXS_FCFTAB_SHUTDOWN)) {
1561 (void) emlxs_fcf_shutdown_notify(port, 1);
1562 }
1563
1564 mutex_enter(&EMLXS_FCF_LOCK);
1937 (void) emlxs_fcf_shutdown_notify(port, 1);
1938 }
1939
1940 mutex_enter(&EMLXS_FCF_LOCK);
1941 hba->sli.sli4.flag &= ~EMLXS_SLI4_FCF_INIT;
1565
1566 /* Free the FCF memory */
1567
1568 kmem_free(fcftab->table,
1569 (sizeof (FCFIobj_t) * fcftab->table_count));
1570
1571 fcftab->table = NULL;
1572 fcftab->table_count = 0;

--- 5 unchanged lines hidden (view full) ---

1578
1579 hba->sli.sli4.VFI_table = NULL;
1580 hba->sli.sli4.VFICount = 0;
1581
1582 /* Free the VPI Fabric RPI's */
1583
1584 for (i = 0; i < MAX_VPORTS; i++) {
1585 vport = &VPORT(i);
1942
1943 /* Free the FCF memory */
1944
1945 kmem_free(fcftab->table,
1946 (sizeof (FCFIobj_t) * fcftab->table_count));
1947
1948 fcftab->table = NULL;
1949 fcftab->table_count = 0;

--- 5 unchanged lines hidden (view full) ---

1955
1956 hba->sli.sli4.VFI_table = NULL;
1957 hba->sli.sli4.VFICount = 0;
1958
1959 /* Free the VPI Fabric RPI's */
1960
1961 for (i = 0; i < MAX_VPORTS; i++) {
1962 vport = &VPORT(i);
1586 rpip = &vport->VPIobj.fcf_rpi;
1963 rpip = vport->vpip->fabric_rpip;
1587
1588 if (rpip->state == RPI_STATE_FREE) {
1589 continue;
1590 }
1591
1592 (void) emlxs_rpi_free(port, rpip);
1593 }
1594

--- 10 unchanged lines hidden (view full) ---

1605
1606 kmem_free(hba->sli.sli4.RPIp,
1607 (sizeof (RPIobj_t) * hba->sli.sli4.RPICount));
1608
1609 hba->sli.sli4.RPIp = NULL;
1610 hba->sli.sli4.RPICount = 0;
1611
1612 /* Free the mutex */
1964
1965 if (rpip->state == RPI_STATE_FREE) {
1966 continue;
1967 }
1968
1969 (void) emlxs_rpi_free(port, rpip);
1970 }
1971

--- 10 unchanged lines hidden (view full) ---

1982
1983 kmem_free(hba->sli.sli4.RPIp,
1984 (sizeof (RPIobj_t) * hba->sli.sli4.RPICount));
1985
1986 hba->sli.sli4.RPIp = NULL;
1987 hba->sli.sli4.RPICount = 0;
1988
1989 /* Free the mutex */
1613
1614 mutex_exit(&EMLXS_FCF_LOCK);
1615 mutex_destroy(&EMLXS_FCF_LOCK);
1616
1617 return;
1618
1619} /* emlxs_fcf_fini() */
1620
1621
1622extern void
1623emlxs_fcf_init(emlxs_hba_t *hba)
1624{
1625 emlxs_port_t *port = &PPORT;
1626 emlxs_port_t *vport;
1627 uint16_t i;
1628 FCFIobj_t *fcfp;
1990 mutex_exit(&EMLXS_FCF_LOCK);
1991 mutex_destroy(&EMLXS_FCF_LOCK);
1992
1993 return;
1994
1995} /* emlxs_fcf_fini() */
1996
1997
1998extern void
1999emlxs_fcf_init(emlxs_hba_t *hba)
2000{
2001 emlxs_port_t *port = &PPORT;
2002 emlxs_port_t *vport;
2003 uint16_t i;
2004 FCFIobj_t *fcfp;
2005 VPIobj_t *vpip;
1629 VFIobj_t *vfip;
1630 RPIobj_t *rpip;
2006 VFIobj_t *vfip;
2007 RPIobj_t *rpip;
1631 char buf[64];
1632 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2008 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
1633 uint16_t index;
1634
2009
1635 if (fcftab->table) {
2010 if (hba->sli.sli4.flag & EMLXS_SLI4_FCF_INIT) {
1636 return;
1637 }
1638
2011 return;
2012 }
2013
2014 mutex_init(&EMLXS_FCF_LOCK, NULL, MUTEX_DRIVER, NULL);
2015 mutex_enter(&EMLXS_FCF_LOCK);
2016
1639 /* FCFTAB */
1640
1641 bzero(fcftab, sizeof (FCFTable_t));
2017 /* FCFTAB */
2018
2019 bzero(fcftab, sizeof (FCFTable_t));
1642
1643 (void) sprintf(buf, "%s_fcf_lock mutex", DRIVER_NAME);
1644 mutex_init(&EMLXS_FCF_LOCK, buf, MUTEX_DRIVER, NULL);
1645 mutex_enter(&EMLXS_FCF_LOCK);
1646
1647 fcftab->state = FCFTAB_STATE_OFFLINE;
1648
1649 /* FCFI */
1650
1651 fcftab->table_count = hba->sli.sli4.FCFICount;
1652 fcftab->table = (FCFIobj_t *)kmem_zalloc(
1653 (sizeof (FCFIobj_t) * fcftab->table_count), KM_SLEEP);
1654

--- 5 unchanged lines hidden (view full) ---

1660 }
1661
1662 /* VFI */
1663
1664 hba->sli.sli4.VFI_table = (VFIobj_t *)kmem_zalloc(
1665 (sizeof (VFIobj_t) * hba->sli.sli4.VFICount), KM_SLEEP);
1666
1667 vfip = hba->sli.sli4.VFI_table;
2020 fcftab->state = FCFTAB_STATE_OFFLINE;
2021
2022 /* FCFI */
2023
2024 fcftab->table_count = hba->sli.sli4.FCFICount;
2025 fcftab->table = (FCFIobj_t *)kmem_zalloc(
2026 (sizeof (FCFIobj_t) * fcftab->table_count), KM_SLEEP);
2027

--- 5 unchanged lines hidden (view full) ---

2033 }
2034
2035 /* VFI */
2036
2037 hba->sli.sli4.VFI_table = (VFIobj_t *)kmem_zalloc(
2038 (sizeof (VFIobj_t) * hba->sli.sli4.VFICount), KM_SLEEP);
2039
2040 vfip = hba->sli.sli4.VFI_table;
1668 index = hba->sli.sli4.VFIBase;
1669 for (i = 0; i < hba->sli.sli4.VFICount; i++, vfip++, index++) {
1670 vfip->VFI = index;
2041 for (i = 0; i < hba->sli.sli4.VFICount; i++, vfip++) {
2042 vfip->VFI = emlxs_sli4_index_to_vfi(hba, i);
1671 vfip->index = i;
2043 vfip->index = i;
1672 vfip->state = VPI_STATE_OFFLINE;
2044 vfip->state = VFI_STATE_OFFLINE;
1673 }
1674
1675 /* VPI */
1676
1677 for (i = 0; i < MAX_VPORTS; i++) {
1678 vport = &VPORT(i);
2045 }
2046
2047 /* VPI */
2048
2049 for (i = 0; i < MAX_VPORTS; i++) {
2050 vport = &VPORT(i);
1679 bzero(&vport->VPIobj, sizeof (VPIobj_t));
2051 vpip = &vport->VPIobj;
1680
2052
1681 vport->VPIobj.index = i;
1682 vport->VPIobj.VPI = i + hba->sli.sli4.VPIBase;
1683 vport->VPIobj.port = vport;
1684 vport->VPIobj.state = VPI_STATE_OFFLINE;
2053 bzero(vpip, sizeof (VPIobj_t));
2054 vpip->index = i;
2055 vpip->VPI = emlxs_sli4_index_to_vpi(hba, i);
2056 vpip->port = vport;
2057 vpip->state = VPI_STATE_OFFLINE;
2058 vport->vpip = vpip;
1685
1686 /* Init the Fabric RPI's */
2059
2060 /* Init the Fabric RPI's */
1687 rpip = &vport->VPIobj.fcf_rpi;
2061 rpip = &vpip->fabric_rpi;
1688 rpip->state = RPI_STATE_FREE;
2062 rpip->state = RPI_STATE_FREE;
1689 rpip->RPI = 0xffff;
1690 rpip->index = 0xffff;
2063 rpip->index = 0xffff;
2064 rpip->RPI = FABRIC_RPI;
1691 rpip->did = FABRIC_DID;
2065 rpip->did = FABRIC_DID;
1692 rpip->vpip = &vport->VPIobj;
1693 vport->VPIobj.rpip = rpip;
2066 rpip->vpip = vpip;
2067 vpip->fabric_rpip = rpip;
1694 }
1695
1696 /* RPI */
1697
1698 hba->sli.sli4.RPIp = (RPIobj_t *)kmem_zalloc(
1699 (sizeof (RPIobj_t) * hba->sli.sli4.RPICount), KM_SLEEP);
1700
1701 rpip = hba->sli.sli4.RPIp;
2068 }
2069
2070 /* RPI */
2071
2072 hba->sli.sli4.RPIp = (RPIobj_t *)kmem_zalloc(
2073 (sizeof (RPIobj_t) * hba->sli.sli4.RPICount), KM_SLEEP);
2074
2075 rpip = hba->sli.sli4.RPIp;
1702 index = hba->sli.sli4.RPIBase;
1703 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++, index++) {
2076 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
1704 rpip->state = RPI_STATE_FREE;
2077 rpip->state = RPI_STATE_FREE;
1705 rpip->RPI = index;
2078 rpip->RPI = emlxs_sli4_index_to_rpi(hba, i);
1706 rpip->index = i;
1707 }
1708
1709 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2079 rpip->index = i;
2080 }
2081
2082 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
1710 "emlxs_fcf_init: %s flag=%x fcfi=%d vfi=%d vpi=%d rpi=%d",
1711 emlxs_fcftab_state_xlate(fcftab->state),
2083 "fcf_init: %s flag=%x fcfi=%d vfi=%d vpi=%d rpi=%d.",
2084 emlxs_fcftab_state_xlate(port, fcftab->state),
1712 fcftab->flag,
1713 fcftab->table_count,
1714 hba->sli.sli4.VFICount,
1715 MAX_VPORTS,
1716 hba->sli.sli4.RPICount);
1717
2085 fcftab->flag,
2086 fcftab->table_count,
2087 hba->sli.sli4.VFICount,
2088 MAX_VPORTS,
2089 hba->sli.sli4.RPICount);
2090
2091 hba->sli.sli4.flag |= EMLXS_SLI4_FCF_INIT;
1718 mutex_exit(&EMLXS_FCF_LOCK);
1719
1720 return;
1721
1722} /* emlxs_fcf_init() */
1723
1724
1725static char *

--- 5 unchanged lines hidden (view full) ---

1731
1732 count = sizeof (emlxs_fcf_event_table) / sizeof (emlxs_table_t);
1733 for (i = 0; i < count; i++) {
1734 if (state == emlxs_fcf_event_table[i].code) {
1735 return (emlxs_fcf_event_table[i].string);
1736 }
1737 }
1738
2092 mutex_exit(&EMLXS_FCF_LOCK);
2093
2094 return;
2095
2096} /* emlxs_fcf_init() */
2097
2098
2099static char *

--- 5 unchanged lines hidden (view full) ---

2105
2106 count = sizeof (emlxs_fcf_event_table) / sizeof (emlxs_table_t);
2107 for (i = 0; i < count; i++) {
2108 if (state == emlxs_fcf_event_table[i].code) {
2109 return (emlxs_fcf_event_table[i].string);
2110 }
2111 }
2112
1739 (void) sprintf(buffer, "event=0x%x", state);
2113 (void) snprintf(buffer, sizeof (buffer), "event=0x%x", state);
1740 return (buffer);
1741
1742} /* emlxs_fcf_event_xlate() */
1743
1744
1745static char *
1746emlxs_fcf_reason_xlate(uint32_t reason)
1747{
1748 static char buffer[32];
1749 uint32_t i;
1750 uint32_t count;
1751
1752 count = sizeof (emlxs_fcf_reason_table) / sizeof (emlxs_table_t);
1753 for (i = 0; i < count; i++) {
1754 if (reason == emlxs_fcf_reason_table[i].code) {
1755 return (emlxs_fcf_reason_table[i].string);
1756 }
1757 }
1758
2114 return (buffer);
2115
2116} /* emlxs_fcf_event_xlate() */
2117
2118
2119static char *
2120emlxs_fcf_reason_xlate(uint32_t reason)
2121{
2122 static char buffer[32];
2123 uint32_t i;
2124 uint32_t count;
2125
2126 count = sizeof (emlxs_fcf_reason_table) / sizeof (emlxs_table_t);
2127 for (i = 0; i < count; i++) {
2128 if (reason == emlxs_fcf_reason_table[i].code) {
2129 return (emlxs_fcf_reason_table[i].string);
2130 }
2131 }
2132
1759 (void) sprintf(buffer, "reason=0x%x", reason);
2133 (void) snprintf(buffer, sizeof (buffer), "reason=0x%x", reason);
1760 return (buffer);
1761
1762} /* emlxs_fcf_reason_xlate() */
1763
1764
1765extern void
1766emlxs_fcf_timer_notify(emlxs_hba_t *hba)
1767{

--- 4 unchanged lines hidden (view full) ---

1772 }
1773
1774 if (fcftab->table == 0) {
1775 return;
1776 }
1777
1778 mutex_enter(&EMLXS_FCF_LOCK);
1779
2134 return (buffer);
2135
2136} /* emlxs_fcf_reason_xlate() */
2137
2138
2139extern void
2140emlxs_fcf_timer_notify(emlxs_hba_t *hba)
2141{

--- 4 unchanged lines hidden (view full) ---

2146 }
2147
2148 if (fcftab->table == 0) {
2149 return;
2150 }
2151
2152 mutex_enter(&EMLXS_FCF_LOCK);
2153
1780 emlxs_fcftab_sol_timer(hba);
2154 if (SLI4_FCOE_MODE) {
2155 emlxs_fcoe_fcftab_sol_timer(hba);
1781
2156
1782 emlxs_fcftab_read_timer(hba);
2157 emlxs_fcoe_fcftab_read_timer(hba);
1783
2158
1784 emlxs_fcftab_offline_timer(hba);
2159 emlxs_fcoe_fcftab_offline_timer(hba);
2160 } else {
2161 emlxs_fc_fcftab_online_timer(hba);
2162 }
1785
2163
2164 emlxs_rpi_idle_timer(hba);
2165
1786 mutex_exit(&EMLXS_FCF_LOCK);
1787
1788 return;
1789
1790} /* emlxs_fcf_timer_notify() */
1791
1792
1793extern uint32_t
1794emlxs_fcf_shutdown_notify(emlxs_port_t *port, uint32_t wait)
1795{
1796 emlxs_hba_t *hba = HBA;
1797 emlxs_port_t *pport = &PPORT;
1798 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2166 mutex_exit(&EMLXS_FCF_LOCK);
2167
2168 return;
2169
2170} /* emlxs_fcf_timer_notify() */
2171
2172
2173extern uint32_t
2174emlxs_fcf_shutdown_notify(emlxs_port_t *port, uint32_t wait)
2175{
2176 emlxs_hba_t *hba = HBA;
2177 emlxs_port_t *pport = &PPORT;
2178 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
1799 uint32_t rval;
2179 uint32_t rval = 0;
1800 uint32_t i;
1801
1802 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1803 return (1);
1804 }
1805
2180 uint32_t i;
2181
2182 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2183 return (1);
2184 }
2185
1806 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2186 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2187 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1807 return (1);
1808 }
1809
2188 return (1);
2189 }
2190
2191 if (fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) {
2192 return (0);
2193 }
2194
1810 mutex_enter(&EMLXS_FCF_LOCK);
1811
2195 mutex_enter(&EMLXS_FCF_LOCK);
2196
2197 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2198 "fcf_shutdown_notify: %s flag=%x "
2199 "fcfi_online=%d. Shutting down FCFTAB. >",
2200 emlxs_fcftab_state_xlate(port, fcftab->state),
2201 fcftab->flag, fcftab->fcfi_online);
2202
1812 rval = emlxs_fcftab_event(port, FCF_EVENT_SHUTDOWN, 0);
1813
1814 if (wait && (rval == 0)) {
2203 rval = emlxs_fcftab_event(port, FCF_EVENT_SHUTDOWN, 0);
2204
2205 if (wait && (rval == 0)) {
1815 /* Wait for FCF table to shutdown */
2206 /* Wait for shutdown flag */
1816 i = 0;
2207 i = 0;
1817 while (i++ < 120) {
1818 if (fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) {
1819 break;
1820 }
1821
2208 while (!(fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) && (i++ < 120)) {
1822 mutex_exit(&EMLXS_FCF_LOCK);
2209 mutex_exit(&EMLXS_FCF_LOCK);
1823 DELAYMS(1000);
2210 BUSYWAIT_MS(1000);
1824 mutex_enter(&EMLXS_FCF_LOCK);
1825 }
1826
2211 mutex_enter(&EMLXS_FCF_LOCK);
2212 }
2213
1827 if (i >= 120) {
2214 if (!(fcftab->flag & EMLXS_FCFTAB_SHUTDOWN)) {
1828 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2215 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
1829 "fcf_shutdown_notify: %s flag=%x fcfi_online=%d. "
1830 "Shutdown timeout.",
1831 emlxs_fcftab_state_xlate(fcftab->state),
2216 "fcf_shutdown_notify: %s flag=%x "
2217 "fcfi_online=%d. Shutdown timeout.",
2218 emlxs_fcftab_state_xlate(port, fcftab->state),
1832 fcftab->flag, fcftab->fcfi_online);
2219 fcftab->flag, fcftab->fcfi_online);
2220 rval = 1;
1833 }
1834 }
1835
1836 mutex_exit(&EMLXS_FCF_LOCK);
1837
1838 return (rval);
1839
1840} /* emlxs_fcf_shutdown_notify() */
1841
1842
1843extern uint32_t
1844emlxs_fcf_linkup_notify(emlxs_port_t *port)
1845{
1846 emlxs_hba_t *hba = HBA;
1847 emlxs_port_t *pport = &PPORT;
2221 }
2222 }
2223
2224 mutex_exit(&EMLXS_FCF_LOCK);
2225
2226 return (rval);
2227
2228} /* emlxs_fcf_shutdown_notify() */
2229
2230
2231extern uint32_t
2232emlxs_fcf_linkup_notify(emlxs_port_t *port)
2233{
2234 emlxs_hba_t *hba = HBA;
2235 emlxs_port_t *pport = &PPORT;
1848 uint32_t rval;
2236 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2237 uint32_t rval = 0;
1849
1850 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1851 return (1);
1852 }
1853
2238
2239 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2240 return (1);
2241 }
2242
1854 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2243 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2244 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1855 return (1);
1856 }
1857
1858 mutex_enter(&EMLXS_FCF_LOCK);
1859
2245 return (1);
2246 }
2247
2248 mutex_enter(&EMLXS_FCF_LOCK);
2249
2250 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2251 "fcf_linkup_notify: %s flag=%x "
2252 "fcfi_online=%d. FCFTAB Link up. >",
2253 emlxs_fcftab_state_xlate(port, fcftab->state),
2254 fcftab->flag, fcftab->fcfi_online);
2255
1860 rval = emlxs_fcftab_event(port, FCF_EVENT_LINKUP, 0);
1861
1862 mutex_exit(&EMLXS_FCF_LOCK);
1863
1864 return (rval);
1865
1866} /* emlxs_fcf_linkup_notify() */
1867
1868
1869extern uint32_t
1870emlxs_fcf_linkdown_notify(emlxs_port_t *port)
1871{
1872 emlxs_hba_t *hba = HBA;
1873 emlxs_port_t *pport = &PPORT;
2256 rval = emlxs_fcftab_event(port, FCF_EVENT_LINKUP, 0);
2257
2258 mutex_exit(&EMLXS_FCF_LOCK);
2259
2260 return (rval);
2261
2262} /* emlxs_fcf_linkup_notify() */
2263
2264
2265extern uint32_t
2266emlxs_fcf_linkdown_notify(emlxs_port_t *port)
2267{
2268 emlxs_hba_t *hba = HBA;
2269 emlxs_port_t *pport = &PPORT;
1874 uint32_t rval;
2270 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2271 uint32_t rval = 0;
1875
1876 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1877 return (1);
1878 }
1879
2272
2273 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2274 return (1);
2275 }
2276
1880 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2277 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2278 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1881 return (1);
1882 }
1883
1884 mutex_enter(&EMLXS_FCF_LOCK);
1885
2279 return (1);
2280 }
2281
2282 mutex_enter(&EMLXS_FCF_LOCK);
2283
2284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2285 "fcf_linkdown_notify: %s flag=%x "
2286 "fcfi_online=%d. FCFTAB Link down. >",
2287 emlxs_fcftab_state_xlate(port, fcftab->state),
2288 fcftab->flag, fcftab->fcfi_online);
2289
1886 rval = emlxs_fcftab_event(port, FCF_EVENT_LINKDOWN, 0);
1887
1888 mutex_exit(&EMLXS_FCF_LOCK);
1889
1890 return (rval);
1891
1892} /* emlxs_fcf_linkdown_notify() */
1893
1894
1895extern uint32_t
1896emlxs_fcf_cvl_notify(emlxs_port_t *port, uint32_t vpi)
1897{
1898 emlxs_hba_t *hba = HBA;
1899 emlxs_port_t *pport = &PPORT;
2290 rval = emlxs_fcftab_event(port, FCF_EVENT_LINKDOWN, 0);
2291
2292 mutex_exit(&EMLXS_FCF_LOCK);
2293
2294 return (rval);
2295
2296} /* emlxs_fcf_linkdown_notify() */
2297
2298
2299extern uint32_t
2300emlxs_fcf_cvl_notify(emlxs_port_t *port, uint32_t vpi)
2301{
2302 emlxs_hba_t *hba = HBA;
2303 emlxs_port_t *pport = &PPORT;
1900 uint32_t rval;
2304 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2305 uint32_t rval = 0;
1901
1902 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1903 return (1);
1904 }
1905
2306
2307 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2308 return (1);
2309 }
2310
1906 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2311 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2312 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1907 return (1);
1908 }
1909
1910 mutex_enter(&EMLXS_FCF_LOCK);
1911
2313 return (1);
2314 }
2315
2316 mutex_enter(&EMLXS_FCF_LOCK);
2317
2318 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2319 "fcf_cvl_notify: %s flag=%x "
2320 "fcfi_online=%d. FCFTAB FCF CVL. >",
2321 emlxs_fcftab_state_xlate(port, fcftab->state),
2322 fcftab->flag, fcftab->fcfi_online);
2323
1912 rval = emlxs_fcftab_event(port, FCF_EVENT_CVL,
2324 rval = emlxs_fcftab_event(port, FCF_EVENT_CVL,
1913 (void *)((uintptr_t)vpi));
2325 (void *)((unsigned long)vpi));
1914
1915 mutex_exit(&EMLXS_FCF_LOCK);
1916
1917 return (rval);
1918
1919} /* emlxs_fcf_cvl_notify() */
1920
1921
1922extern uint32_t
1923emlxs_fcf_full_notify(emlxs_port_t *port)
1924{
1925 emlxs_hba_t *hba = HBA;
1926 emlxs_port_t *pport = &PPORT;
2326
2327 mutex_exit(&EMLXS_FCF_LOCK);
2328
2329 return (rval);
2330
2331} /* emlxs_fcf_cvl_notify() */
2332
2333
2334extern uint32_t
2335emlxs_fcf_full_notify(emlxs_port_t *port)
2336{
2337 emlxs_hba_t *hba = HBA;
2338 emlxs_port_t *pport = &PPORT;
1927 uint32_t rval;
2339 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2340 uint32_t rval = 0;
1928
1929 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1930 return (1);
1931 }
1932
2341
2342 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2343 return (1);
2344 }
2345
1933 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2346 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2347 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1934 return (1);
1935 }
1936
1937 mutex_enter(&EMLXS_FCF_LOCK);
1938
2348 return (1);
2349 }
2350
2351 mutex_enter(&EMLXS_FCF_LOCK);
2352
2353 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2354 "fcf_full_notify: %s flag=%x "
2355 "fcfi_online=%d. FCFTAB FCF full. >",
2356 emlxs_fcftab_state_xlate(port, fcftab->state),
2357 fcftab->flag, fcftab->fcfi_online);
2358
1939 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFTAB_FULL, 0);
1940
1941 mutex_exit(&EMLXS_FCF_LOCK);
1942
1943 return (rval);
1944
1945} /* emlxs_fcf_full_notify() */
1946
1947
1948extern uint32_t
1949emlxs_fcf_found_notify(emlxs_port_t *port, uint32_t fcf_index)
1950{
1951 emlxs_hba_t *hba = HBA;
1952 emlxs_port_t *pport = &PPORT;
2359 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFTAB_FULL, 0);
2360
2361 mutex_exit(&EMLXS_FCF_LOCK);
2362
2363 return (rval);
2364
2365} /* emlxs_fcf_full_notify() */
2366
2367
2368extern uint32_t
2369emlxs_fcf_found_notify(emlxs_port_t *port, uint32_t fcf_index)
2370{
2371 emlxs_hba_t *hba = HBA;
2372 emlxs_port_t *pport = &PPORT;
1953 uint32_t rval;
2373 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2374 uint32_t rval = 0;
1954
1955 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1956 return (1);
1957 }
1958
2375
2376 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2377 return (1);
2378 }
2379
1959 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2380 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2381 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1960 return (1);
1961 }
1962
1963 mutex_enter(&EMLXS_FCF_LOCK);
1964
2382 return (1);
2383 }
2384
2385 mutex_enter(&EMLXS_FCF_LOCK);
2386
2387 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2388 "fcf_found_notify: %s flag=%x "
2389 "fcfi_online=%d. FCFTAB FCF found. >",
2390 emlxs_fcftab_state_xlate(port, fcftab->state),
2391 fcftab->flag, fcftab->fcfi_online);
2392
1965 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_FOUND,
2393 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_FOUND,
1966 (void *)((uintptr_t)fcf_index));
2394 (void *)((unsigned long)fcf_index));
1967
1968 mutex_exit(&EMLXS_FCF_LOCK);
1969
1970 return (rval);
1971
1972} /* emlxs_fcf_found_notify() */
1973
1974
1975extern uint32_t
1976emlxs_fcf_changed_notify(emlxs_port_t *port, uint32_t fcf_index)
1977{
1978 emlxs_hba_t *hba = HBA;
1979 emlxs_port_t *pport = &PPORT;
2395
2396 mutex_exit(&EMLXS_FCF_LOCK);
2397
2398 return (rval);
2399
2400} /* emlxs_fcf_found_notify() */
2401
2402
2403extern uint32_t
2404emlxs_fcf_changed_notify(emlxs_port_t *port, uint32_t fcf_index)
2405{
2406 emlxs_hba_t *hba = HBA;
2407 emlxs_port_t *pport = &PPORT;
1980 uint32_t rval;
2408 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2409 uint32_t rval = 0;
1981
1982 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
1983 return (1);
1984 }
1985
2410
2411 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2412 return (1);
2413 }
2414
1986 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2415 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2416 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
1987 return (1);
1988 }
1989
1990 mutex_enter(&EMLXS_FCF_LOCK);
1991
2417 return (1);
2418 }
2419
2420 mutex_enter(&EMLXS_FCF_LOCK);
2421
2422 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2423 "fcf_changes_notify: %s flag=%x "
2424 "fcfi_online=%d. FCFTAB FCF changed. >",
2425 emlxs_fcftab_state_xlate(port, fcftab->state),
2426 fcftab->flag, fcftab->fcfi_online);
2427
1992 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_CHANGED,
2428 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_CHANGED,
1993 (void *)((uintptr_t)fcf_index));
2429 (void *)((unsigned long)fcf_index));
1994
1995 mutex_exit(&EMLXS_FCF_LOCK);
1996
1997 return (rval);
1998
1999} /* emlxs_fcf_changed_notify() */
2000
2001
2002extern uint32_t
2003emlxs_fcf_lost_notify(emlxs_port_t *port, uint32_t fcf_index)
2004{
2005 emlxs_hba_t *hba = HBA;
2006 emlxs_port_t *pport = &PPORT;
2430
2431 mutex_exit(&EMLXS_FCF_LOCK);
2432
2433 return (rval);
2434
2435} /* emlxs_fcf_changed_notify() */
2436
2437
2438extern uint32_t
2439emlxs_fcf_lost_notify(emlxs_port_t *port, uint32_t fcf_index)
2440{
2441 emlxs_hba_t *hba = HBA;
2442 emlxs_port_t *pport = &PPORT;
2007 uint32_t rval;
2443 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2444 uint32_t rval = 0;
2008
2009 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2010 return (1);
2011 }
2012
2445
2446 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
2447 return (1);
2448 }
2449
2013 if (!(pport->flag & EMLXS_PORT_BOUND)) {
2450 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2451 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
2014 return (1);
2015 }
2016
2017 mutex_enter(&EMLXS_FCF_LOCK);
2018
2452 return (1);
2453 }
2454
2455 mutex_enter(&EMLXS_FCF_LOCK);
2456
2457 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2458 "fcf_lost_notify: %s flag=%x "
2459 "fcfi_online=%d. FCFTAB FCF lost. >",
2460 emlxs_fcftab_state_xlate(port, fcftab->state),
2461 fcftab->flag, fcftab->fcfi_online);
2462
2019 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_LOST,
2463 rval = emlxs_fcftab_event(port, FCF_EVENT_FCF_LOST,
2020 (void *)((uintptr_t)fcf_index));
2464 (void *)((unsigned long)fcf_index));
2021
2022 mutex_exit(&EMLXS_FCF_LOCK);
2023
2024 return (rval);
2025
2026} /* emlxs_fcf_lost_notify() */
2027
2028
2465
2466 mutex_exit(&EMLXS_FCF_LOCK);
2467
2468 return (rval);
2469
2470} /* emlxs_fcf_lost_notify() */
2471
2472
2473/* ************************************************************************** */
2474/* FCFTAB Generic */
2475/* ************************************************************************** */
2029
2476
2477static char *
2478emlxs_fcftab_state_xlate(emlxs_port_t *port, uint32_t state)
2479{
2480 emlxs_hba_t *hba = HBA;
2481
2482 if (SLI4_FCOE_MODE) {
2483 return (emlxs_fcoe_fcftab_state_xlate(state));
2484 } else {
2485 return (emlxs_fc_fcftab_state_xlate(state));
2486 }
2487
2488} /* emlxs_fcftab_state_xlate() */
2489
2490static uint32_t
2491emlxs_fcftab_event(emlxs_port_t *port, uint32_t evt, void *arg1)
2492{
2493 emlxs_hba_t *hba = HBA;
2494
2495 if (SLI4_FCOE_MODE) {
2496 return (emlxs_fcoe_fcftab_event(port, evt, arg1));
2497 } else {
2498 return (emlxs_fc_fcftab_event(port, evt, arg1));
2499 }
2500
2501} /* emlxs_fcftab_event() */
2502
2503
2504/*ARGSUSED*/
2505static uint32_t
2506emlxs_fcftab_shutdown_action(emlxs_port_t *port, uint32_t evt,
2507 void *arg1)
2508{
2509 emlxs_hba_t *hba = HBA;
2510 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2511 FCFIobj_t *fcfp;
2512 uint32_t i;
2513 uint32_t online;
2514
2515 if (fcftab->state != FCFTAB_STATE_SHUTDOWN) {
2516 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2517 "fcftab_shutdown_action:%x %s:%s arg=%p. "
2518 "Invalid state. <",
2519 fcftab->TID,
2520 emlxs_fcftab_state_xlate(port, fcftab->state),
2521 emlxs_fcf_event_xlate(evt), arg1);
2522 return (1);
2523 }
2524
2525 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2526
2527 if (fcftab->prev_state != FCFTAB_STATE_SHUTDOWN) {
2528 /* Offline all FCF's */
2529 online = 0;
2530 fcfp = fcftab->table;
2531 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
2532
2533 if (fcfp->state <= FCFI_STATE_OFFLINE) {
2534 continue;
2535 }
2536
2537 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2538 "fcftab_shutdown_action:%x fcfi_online=%d. "
2539 "Offlining FCFI:%d. >",
2540 fcftab->TID,
2541 fcftab->fcfi_online,
2542 fcfp->fcf_index);
2543
2544 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_OFFLINE,
2545 fcfp);
2546
2547 online++;
2548 }
2549
2550 if (!online) {
2551 goto done;
2552 }
2553
2554 return (0);
2555 }
2556
2557 /* Check FCF states */
2558 online = 0;
2559 fcfp = fcftab->table;
2560 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
2561
2562 if (fcfp->state <= FCFI_STATE_OFFLINE) {
2563 continue;
2564 }
2565
2566 online++;
2567 }
2568
2569 if (online) {
2570 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2571 "fcftab_shutdown_action:%x %s:%s arg=%p. "
2572 "fcfi_online=%d,%d <",
2573 fcftab->TID,
2574 emlxs_fcftab_state_xlate(port, fcftab->state),
2575 emlxs_fcf_event_xlate(evt), arg1,
2576 online, fcftab->fcfi_online);
2577
2578 return (0);
2579 }
2580
2581done:
2582 /* Free FCF table */
2583 fcfp = fcftab->table;
2584 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
2585
2586 if (fcfp->state == FCFI_STATE_FREE) {
2587 continue;
2588 }
2589
2590 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2591 "fcftab_shutdown_action:%x. Freeing FCFI:%d. >",
2592 fcftab->TID,
2593 fcfp->fcf_index);
2594
2595 (void) emlxs_fcfi_free(port, fcfp);
2596 }
2597
2598 /* Clean the selection table */
2599 bzero(fcftab->fcfi, sizeof (fcftab->fcfi));
2600 fcftab->fcfi_count = 0;
2601
2602 fcftab->flag |= EMLXS_FCFTAB_SHUTDOWN;
2603
2604 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2605 "fcftab_shutdown_action:%x %s:%s arg=%p flag=%x fcfi_online=%d. "
2606 "Shutdown. <",
2607 fcftab->TID,
2608 emlxs_fcftab_state_xlate(port, fcftab->state),
2609 emlxs_fcf_event_xlate(evt), arg1,
2610 fcftab->flag, fcftab->fcfi_online);
2611
2612 return (0);
2613
2614} /* emlxs_fcftab_shutdown_action() */
2615
2616
2030/* ************************************************************************** */
2617/* ************************************************************************** */
2031/* FCFTAB */
2618/* FC FCFTAB */
2032/* ************************************************************************** */
2033
2034static char *
2619/* ************************************************************************** */
2620
2621static char *
2035emlxs_fcftab_state_xlate(uint32_t state)
2622emlxs_fc_fcftab_state_xlate(uint32_t state)
2036{
2037 static char buffer[32];
2038 uint32_t i;
2039 uint32_t count;
2040
2623{
2624 static char buffer[32];
2625 uint32_t i;
2626 uint32_t count;
2627
2041 count = sizeof (emlxs_fcftab_state_table) / sizeof (emlxs_table_t);
2628 count = sizeof (emlxs_fc_fcftab_state_table) / sizeof (emlxs_table_t);
2042 for (i = 0; i < count; i++) {
2629 for (i = 0; i < count; i++) {
2043 if (state == emlxs_fcftab_state_table[i].code) {
2044 return (emlxs_fcftab_state_table[i].string);
2630 if (state == emlxs_fc_fcftab_state_table[i].code) {
2631 return (emlxs_fc_fcftab_state_table[i].string);
2045 }
2046 }
2047
2632 }
2633 }
2634
2048 (void) sprintf(buffer, "state=0x%x", state);
2635 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
2049 return (buffer);
2050
2636 return (buffer);
2637
2051} /* emlxs_fcftab_state_xlate() */
2638} /* emlxs_fc_fcftab_state_xlate() */
2052
2053
2054static uint32_t
2639
2640
2641static uint32_t
2055emlxs_fcftab_action(emlxs_port_t *port, uint32_t evt,
2642emlxs_fc_fcftab_action(emlxs_port_t *port, uint32_t evt,
2056 void *arg1)
2057{
2058 emlxs_hba_t *hba = HBA;
2059 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2643 void *arg1)
2644{
2645 emlxs_hba_t *hba = HBA;
2646 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2060 uint32_t rval;
2647 uint32_t rval = 0;
2061 uint32_t(*func) (emlxs_port_t *, uint32_t, void *);
2062 uint32_t index;
2063 uint32_t events;
2064 uint16_t state;
2065
2066 /* Convert event to action table index */
2067 switch (evt) {
2068 case FCF_EVENT_STATE_ENTER:
2069 index = 0;
2070 break;
2071 case FCF_EVENT_SHUTDOWN:
2072 index = 1;
2073 break;
2074 case FCF_EVENT_LINKUP:
2075 index = 2;
2076 break;
2077 case FCF_EVENT_LINKDOWN:
2078 index = 3;
2079 break;
2648 uint32_t(*func) (emlxs_port_t *, uint32_t, void *);
2649 uint32_t index;
2650 uint32_t events;
2651 uint16_t state;
2652
2653 /* Convert event to action table index */
2654 switch (evt) {
2655 case FCF_EVENT_STATE_ENTER:
2656 index = 0;
2657 break;
2658 case FCF_EVENT_SHUTDOWN:
2659 index = 1;
2660 break;
2661 case FCF_EVENT_LINKUP:
2662 index = 2;
2663 break;
2664 case FCF_EVENT_LINKDOWN:
2665 index = 3;
2666 break;
2667 case FCF_EVENT_FCFI_ONLINE:
2668 index = 4;
2669 break;
2670 case FCF_EVENT_FCFI_OFFLINE:
2671 index = 5;
2672 break;
2673 default:
2674 return (1);
2675 }
2676
2677 events = FC_FCFTAB_ACTION_EVENTS;
2678 state = fcftab->state;
2679
2680 index += (state * events);
2681 func = (uint32_t(*) (emlxs_port_t *, uint32_t, void *))
2682 emlxs_fc_fcftab_action_table[index];
2683
2684 if (!func) {
2685 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
2686 "fc_fcftab_action:%x %s:%s arg=%p. No action. <",
2687 fcftab->TID,
2688 emlxs_fc_fcftab_state_xlate(fcftab->state),
2689 emlxs_fcf_event_xlate(evt), arg1);
2690
2691 return (1);
2692 }
2693
2694 rval = (func)(port, evt, arg1);
2695
2696 return (rval);
2697
2698} /* emlxs_fc_fcftab_action() */
2699
2700
2701static uint32_t
2702emlxs_fc_fcftab_event(emlxs_port_t *port, uint32_t evt,
2703 void *arg1)
2704{
2705 emlxs_hba_t *hba = HBA;
2706 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2707 uint32_t rval = 0;
2708
2709 /* Filter events */
2710 switch (evt) {
2711 case FCF_EVENT_SHUTDOWN:
2712 case FCF_EVENT_LINKUP:
2713 case FCF_EVENT_LINKDOWN:
2714 case FCF_EVENT_FCFI_ONLINE:
2715 case FCF_EVENT_FCFI_OFFLINE:
2716 break;
2717
2718 default:
2719 return (1);
2720 }
2721
2722 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
2723 "fc_fcftab_event:%x %s:%s arg=%p.",
2724 fcftab->TID,
2725 emlxs_fc_fcftab_state_xlate(fcftab->state),
2726 emlxs_fcf_event_xlate(evt), arg1);
2727
2728 rval = emlxs_fc_fcftab_action(port, evt, arg1);
2729
2730 return (rval);
2731
2732} /* emlxs_fc_fcftab_event() */
2733
2734
2735/* EMLXS_FCF_LOCK must be held to enter */
2736/*ARGSUSED*/
2737static uint32_t
2738emlxs_fc_fcftab_state(emlxs_port_t *port, uint16_t state, uint16_t reason,
2739 uint32_t explain, void *arg1)
2740{
2741 emlxs_hba_t *hba = HBA;
2742 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2743 uint32_t rval = 0;
2744
2745 if (state >= FC_FCFTAB_ACTION_STATES) {
2746 return (1);
2747 }
2748
2749 if ((fcftab->state == state) &&
2750 (reason != FCF_REASON_REENTER)) {
2751 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2752 "fcftab_state:%x %s:%s:0x%x arg=%p. "
2753 "State not changed. <",
2754 fcftab->TID,
2755 emlxs_fc_fcftab_state_xlate(state),
2756 emlxs_fcf_reason_xlate(reason),
2757 explain, arg1);
2758 return (1);
2759 }
2760
2761 if (!reason) {
2762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2763 "fcftab_state:%x %s-->%s arg=%p",
2764 fcftab->TID,
2765 emlxs_fc_fcftab_state_xlate(fcftab->state),
2766 emlxs_fc_fcftab_state_xlate(state), arg1);
2767 } else if (reason == FCF_REASON_EVENT) {
2768 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2769 "fcftab_state:%x %s-->%s:%s:%s arg=%p",
2770 fcftab->TID,
2771 emlxs_fc_fcftab_state_xlate(fcftab->state),
2772 emlxs_fc_fcftab_state_xlate(state),
2773 emlxs_fcf_reason_xlate(reason),
2774 emlxs_fcf_event_xlate(explain), arg1);
2775 } else if (explain) {
2776 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2777 "fcftab_state:%x %s-->%s:%s:0x%x arg=%p",
2778 fcftab->TID,
2779 emlxs_fc_fcftab_state_xlate(fcftab->state),
2780 emlxs_fc_fcftab_state_xlate(state),
2781 emlxs_fcf_reason_xlate(reason),
2782 explain, arg1);
2783 } else {
2784 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2785 "fcftab_state:%x %s-->%s:%s arg=%p",
2786 fcftab->TID,
2787 emlxs_fc_fcftab_state_xlate(fcftab->state),
2788 emlxs_fc_fcftab_state_xlate(state),
2789 emlxs_fcf_reason_xlate(reason), arg1);
2790 }
2791
2792 fcftab->prev_state = fcftab->state;
2793 fcftab->prev_reason = fcftab->reason;
2794 fcftab->state = state;
2795 fcftab->reason = reason;
2796
2797 rval = emlxs_fc_fcftab_action(port, FCF_EVENT_STATE_ENTER, arg1);
2798
2799 return (rval);
2800
2801} /* emlxs_fc_fcftab_state() */
2802
2803
2804static void
2805emlxs_fc_fcftab_online_timer(emlxs_hba_t *hba)
2806{
2807 emlxs_port_t *port = &PPORT;
2808 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2809
2810 /* Check FCF timer */
2811 if (!fcftab->online_timer ||
2812 (hba->timer_tics < fcftab->online_timer)) {
2813 return;
2814 }
2815 fcftab->online_timer = 0;
2816
2817 switch (fcftab->state) {
2818 case FC_FCFTAB_STATE_ONLINE:
2819 emlxs_fcf_linkup(port);
2820
2821 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2822 fcftab->flag |= EMLXS_FC_FCFTAB_TOPO_REQ;
2823 fcftab->generation++;
2824
2825 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2826 "fc_fcftab_online_timer:%x %s gen=%x. Read topology. >",
2827 fcftab->TID,
2828 emlxs_fc_fcftab_state_xlate(fcftab->state),
2829 fcftab->generation);
2830
2831 (void) emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO,
2832 FCF_REASON_EVENT, 0, 0);
2833 break;
2834
2835 default:
2836 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2837 "fc_fcftab_online_timer:%x %s",
2838 fcftab->TID,
2839 emlxs_fc_fcftab_state_xlate(fcftab->state));
2840 break;
2841 }
2842
2843 return;
2844
2845} /* emlxs_fc_fcftab_online_timer() */
2846
2847
2848/*ARGSUSED*/
2849static uint32_t
2850emlxs_fc_fcftab_offline_action(emlxs_port_t *port, uint32_t evt,
2851 void *arg1)
2852{
2853 emlxs_hba_t *hba = HBA;
2854 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2855 uint32_t rval = 0;
2856
2857 if (fcftab->state != FC_FCFTAB_STATE_OFFLINE) {
2858 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2859 "fc_fcftab_offline_action:%x %s:%s arg=%p. "
2860 "Invalid state. <",
2861 fcftab->TID,
2862 emlxs_fc_fcftab_state_xlate(fcftab->state),
2863 emlxs_fcf_event_xlate(evt), arg1);
2864 return (1);
2865 }
2866
2867 fcftab->flag &= ~EMLXS_FC_FCFTAB_OFFLINE_REQ;
2868
2869 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
2870 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2871 "fc_fcftab_offline_action:%x %s:%s arg=%p flag=%x. "
2872 "Handling request.",
2873 fcftab->TID,
2874 emlxs_fc_fcftab_state_xlate(fcftab->state),
2875 emlxs_fcf_event_xlate(evt), arg1,
2876 fcftab->flag);
2877
2878 rval = emlxs_fc_fcftab_req_handler(port, arg1);
2879 return (rval);
2880 }
2881
2882 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2883 "fc_fcftab_offline_action:%x %s:%s arg=%p fcfi_online=%d. "
2884 "Offline. <",
2885 fcftab->TID,
2886 emlxs_fc_fcftab_state_xlate(fcftab->state),
2887 emlxs_fcf_event_xlate(evt), arg1,
2888 fcftab->fcfi_online);
2889
2890 return (0);
2891
2892} /* emlxs_fc_fcftab_offline_action() */
2893
2894
2895/*ARGSUSED*/
2896static uint32_t
2897emlxs_fc_fcftab_online_action(emlxs_port_t *port, uint32_t evt,
2898 void *arg1)
2899{
2900 emlxs_hba_t *hba = HBA;
2901 emlxs_port_t *pport = &PPORT;
2902 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2903 uint32_t rval = 0;
2904
2905 if (fcftab->state != FC_FCFTAB_STATE_ONLINE) {
2906 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2907 "fc_fcftab_online_action:%x %s:%s arg=%p. "
2908 "Invalid state. <",
2909 fcftab->TID,
2910 emlxs_fc_fcftab_state_xlate(fcftab->state),
2911 emlxs_fcf_event_xlate(evt), arg1);
2912 return (1);
2913 }
2914
2915 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
2916 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2917 "fc_fcftab_online_action:%x flag=%x. "
2918 "Handling requested.",
2919 fcftab->TID,
2920 fcftab->flag);
2921
2922 rval = emlxs_fc_fcftab_req_handler(port, arg1);
2923 return (rval);
2924 }
2925
2926 if (fcftab->fcfi_online == 0) {
2927 if (!(pport->flag & EMLXS_PORT_BOUND) ||
2928 (pport->vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
2929 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2930 "fc_fcftab_online_action:%x %s:%s "
2931 "fcfi_online=0. Pport not bound. <",
2932 fcftab->TID,
2933 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2934 emlxs_fcf_event_xlate(evt));
2935 } else {
2936 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2937 "fc_fcftab_online_action:%x %s:%s "
2938 "fcfi_online=0. Starting online timer. <",
2939 fcftab->TID,
2940 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2941 emlxs_fcf_event_xlate(evt));
2942
2943 /* Start the online timer */
2944 fcftab->online_timer = hba->timer_tics + 1;
2945 }
2946
2947 emlxs_fcf_linkdown(port);
2948
2949 return (0);
2950 }
2951
2952 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2953 "fc_fcftab_online_action:%x flag=%x fcfi_online=%d. "
2954 "Online. <",
2955 fcftab->TID,
2956 fcftab->flag,
2957 fcftab->fcfi_online);
2958
2959 emlxs_fcf_linkup(port);
2960
2961 return (0);
2962
2963} /* emlxs_fc_fcftab_online_action() */
2964
2965
2966/*ARGSUSED*/
2967static uint32_t
2968emlxs_fc_fcftab_topo_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
2969{
2970 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
2971 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2972 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
2973 MATCHMAP *mp;
2974 uint8_t *alpa_map;
2975 uint32_t j;
2976 uint16_t TID;
2977
2978 mutex_enter(&EMLXS_FCF_LOCK);
2979 TID = (uint16_t)((unsigned long)mbq->context);
2980
2981 if (fcftab->state != FC_FCFTAB_STATE_TOPO) {
2982 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2983 "fc_fcftab_topo_mbcmpl:%x state=%s.",
2984 TID,
2985 emlxs_fc_fcftab_state_xlate(fcftab->state));
2986
2987 mutex_exit(&EMLXS_FCF_LOCK);
2988 return (0);
2989 }
2990
2991 if (TID != fcftab->generation) {
2992 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2993 "fc_fcftab_topo_mbcmpl:%x %s. "
2994 "Incorrect generation %x. Dropping.",
2995 TID,
2996 emlxs_fc_fcftab_state_xlate(fcftab->state),
2997 fcftab->generation);
2998
2999 mutex_exit(&EMLXS_FCF_LOCK);
3000 return (0);
3001 }
3002
3003 if (mb4->mbxStatus) {
3004 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3005 "fc_fcftab_topo_mbcmpl:%x failed. %s. >",
3006 fcftab->TID,
3007 emlxs_mb_xlate_status(mb4->mbxStatus));
3008
3009 if (mb4->mbxStatus == MBXERR_NO_RESOURCES) {
3010 (void) emlxs_fc_fcftab_state(port,
3011 FC_FCFTAB_STATE_TOPO_FAILED,
3012 FCF_REASON_MBOX_BUSY, mb4->mbxStatus, 0);
3013 } else {
3014 (void) emlxs_fc_fcftab_state(port,
3015 FC_FCFTAB_STATE_TOPO_FAILED,
3016 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
3017 }
3018
3019 mutex_exit(&EMLXS_FCF_LOCK);
3020 return (0);
3021 }
3022
3023 if (mb4->un.varReadLA.attType == AT_LINK_DOWN) {
3024 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3025 "fc_fcftab_topo_mbcmpl:%x Linkdown attention. "
3026 "Offline requested.",
3027 fcftab->TID);
3028
3029 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
3030 fcftab->flag |= EMLXS_FC_FCFTAB_OFFLINE_REQ;
3031 (void) emlxs_fc_fcftab_req_handler(port, 0);
3032
3033 mutex_exit(&EMLXS_FCF_LOCK);
3034 return (0);
3035 }
3036
3037 if (hba->link_event_tag != mb4->un.varReadLA.eventTag) {
3038 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3039 "fc_fcftab_topo_mbcmpl:%x Event tag invalid. %x != %x",
3040 fcftab->TID,
3041 hba->link_event_tag, mb4->un.varReadLA.eventTag);
3042 }
3043
3044 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3045 "fc_fcftab_topo_mbcmpl:%x state=%s type=%s iotag=%d "
3046 "alpa=%x. >",
3047 fcftab->TID,
3048 emlxs_fc_fcftab_state_xlate(fcftab->state),
3049 (mb4->un.varReadLA.attType == AT_LINK_UP)?"linkup":"linkdown",
3050 hba->link_event_tag,
3051 (uint32_t)mb4->un.varReadLA.granted_AL_PA);
3052
3053 /* Link is up */
3054
3055 /* Save the linkspeed & topology */
3056 hba->linkspeed = mb4->un.varReadLA.UlnkSpeed;
3057 hba->topology = mb4->un.varReadLA.topology;
3058
3059 if (hba->topology != TOPOLOGY_LOOP) {
3060 port->did = 0;
3061 port->lip_type = 0;
3062 hba->flag &= ~FC_BYPASSED_MODE;
3063 bzero((caddr_t)port->alpa_map, 128);
3064
3065 goto done;
3066 }
3067
3068 /* TOPOLOGY_LOOP */
3069
3070 port->lip_type = mb4->un.varReadLA.lipType;
3071
3072 if (mb4->un.varReadLA.pb) {
3073 hba->flag |= FC_BYPASSED_MODE;
3074 } else {
3075 hba->flag &= ~FC_BYPASSED_MODE;
3076 }
3077
3078 /* Save the granted_alpa and alpa_map */
3079
3080 port->granted_alpa = mb4->un.varReadLA.granted_AL_PA;
3081 mp = (MATCHMAP *)mbq->bp;
3082 alpa_map = (uint8_t *)port->alpa_map;
3083
3084 bcopy((caddr_t)mp->virt, (caddr_t)alpa_map, 128);
3085
3086 /* Check number of devices in map */
3087 if (alpa_map[0] > 127) {
3088 alpa_map[0] = 127;
3089 }
3090
3091 EMLXS_MSGF(EMLXS_CONTEXT,
3092 &emlxs_link_atten_msg,
3093 "alpa_map: %d device(s): "
3094 "%02x %02x %02x %02x %02x %02x %02x %02x",
3095 alpa_map[0], alpa_map[1],
3096 alpa_map[2], alpa_map[3],
3097 alpa_map[4], alpa_map[5],
3098 alpa_map[6], alpa_map[7],
3099 alpa_map[8]);
3100
3101 for (j = 9; j <= alpa_map[0]; j += 8) {
3102 EMLXS_MSGF(EMLXS_CONTEXT,
3103 &emlxs_link_atten_msg,
3104 "alpa_map: "
3105 "%02x %02x %02x %02x %02x %02x %02x %02x",
3106 alpa_map[j],
3107 alpa_map[j + 1],
3108 alpa_map[j + 2],
3109 alpa_map[j + 3],
3110 alpa_map[j + 4],
3111 alpa_map[j + 5],
3112 alpa_map[j + 6],
3113 alpa_map[j + 7]);
3114 }
3115
3116done:
3117
3118 (void) emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO_CMPL,
3119 0, 0, 0);
3120
3121 mutex_exit(&EMLXS_FCF_LOCK);
3122 return (0);
3123
3124} /* emlxs_fc_fcftab_topo_mbcmpl() */
3125
3126
3127/*ARGSUSED*/
3128static uint32_t
3129emlxs_fc_fcftab_topo_action(emlxs_port_t *port, uint32_t evt,
3130 void *arg1)
3131{
3132 emlxs_hba_t *hba = HBA;
3133 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3134 MAILBOXQ *mbq;
3135 MAILBOX4 *mb4;
3136 uint32_t rval = 0;
3137 MATCHMAP *mp;
3138
3139 if (fcftab->state != FC_FCFTAB_STATE_TOPO) {
3140 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3141 "fc_fcftab_topo_action:%x %s:%s arg=%p. "
3142 "Invalid state. <",
3143 fcftab->TID,
3144 emlxs_fc_fcftab_state_xlate(fcftab->state),
3145 emlxs_fcf_event_xlate(evt), arg1);
3146 return (1);
3147 }
3148
3149 if ((fcftab->prev_state != FC_FCFTAB_STATE_TOPO_FAILED) ||
3150 (fcftab->flag & EMLXS_FC_FCFTAB_TOPO_REQ)) {
3151 fcftab->flag &= ~EMLXS_FC_FCFTAB_TOPO_REQ;
3152 fcftab->attempts = 0;
3153 }
3154
3155 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3156 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3157 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3158 "Handling request.",
3159 fcftab->TID,
3160 emlxs_fc_fcftab_state_xlate(fcftab->state),
3161 emlxs_fcf_event_xlate(evt), arg1,
3162 fcftab->generation,
3163 fcftab->flag);
3164
3165 rval = emlxs_fc_fcftab_req_handler(port, arg1);
3166 return (rval);
3167 }
3168
3169 if (fcftab->attempts == 0) {
3170 fcftab->TID = fcftab->generation;
3171 }
3172
3173 if (hba->topology != TOPOLOGY_LOOP) {
3174 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3175 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3176 "Fabric Topology. Skipping READ_TOPO.",
3177 fcftab->TID,
3178 emlxs_fc_fcftab_state_xlate(fcftab->state),
3179 emlxs_fcf_event_xlate(evt), arg1,
3180 fcftab->generation,
3181 fcftab->flag);
3182
3183 port->did = 0;
3184 port->lip_type = 0;
3185 hba->flag &= ~FC_BYPASSED_MODE;
3186 bzero((caddr_t)port->alpa_map, 128);
3187
3188 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK,
3189 FCF_REASON_EVENT, evt, arg1);
3190 return (rval);
3191 }
3192
3193 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3194 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3195 "Sending READ_TOPO. <",
3196 fcftab->TID,
3197 emlxs_fc_fcftab_state_xlate(fcftab->state),
3198 emlxs_fcf_event_xlate(evt), arg1,
3199 fcftab->generation,
3200 fcftab->flag);
3201
3202 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
3203 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO_FAILED,
3204 FCF_REASON_NO_MBOX, 0, arg1);
3205 return (rval);
3206 }
3207 mb4 = (MAILBOX4*)mbq;
3208 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
3209
3210 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
3211 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3212
3213 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO_FAILED,
3214 FCF_REASON_NO_BUFFER, 0, arg1);
3215 return (rval);
3216 }
3217 bzero(mp->virt, mp->size);
3218
3219 mbq->nonembed = NULL;
3220 mbq->bp = (void *)mp;
3221 mbq->mbox_cmpl = emlxs_fc_fcftab_topo_mbcmpl;
3222 mbq->context = (void *)((unsigned long)fcftab->TID);
3223 mbq->port = (void *)port;
3224
3225 mb4->un.varSLIConfig.be.embedded = 0;
3226 mb4->mbxCommand = MBX_READ_TOPOLOGY;
3227 mb4->mbxOwner = OWN_HOST;
3228
3229 mb4->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128;
3230 mb4->un.varReadLA.un.lilpBde64.addrHigh = PADDR_HI(mp->phys);
3231 mb4->un.varReadLA.un.lilpBde64.addrLow = PADDR_LO(mp->phys);
3232
3233 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
3234 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
3235 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
3236 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3237
3238 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO_FAILED,
3239 FCF_REASON_SEND_FAILED, rval, arg1);
3240
3241 return (rval);
3242 }
3243
3244 return (0);
3245
3246} /* emlxs_fc_fcftab_topo_action() */
3247
3248
3249/*ARGSUSED*/
3250static uint32_t
3251emlxs_fc_fcftab_topo_failed_action(emlxs_port_t *port, uint32_t evt,
3252 void *arg1)
3253{
3254 emlxs_hba_t *hba = HBA;
3255 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3256 uint32_t rval = 0;
3257
3258 fcftab->attempts++;
3259
3260 if (fcftab->state != FC_FCFTAB_STATE_TOPO_FAILED) {
3261 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3262 "fc_fcftab_topo_failed_action:%x %s:%s arg=%p "
3263 "attempt=%d. Invalid state. <",
3264 fcftab->TID,
3265 emlxs_fc_fcftab_state_xlate(fcftab->state),
3266 emlxs_fcf_event_xlate(evt),
3267 arg1, fcftab->attempts);
3268 return (1);
3269 }
3270
3271 if ((fcftab->reason == FCF_REASON_MBOX_FAILED) ||
3272 (fcftab->reason == FCF_REASON_SEND_FAILED) ||
3273 (fcftab->attempts >= 3)) {
3274 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3275 "fc_fcftab_topo_failed_action:%x %s:%s arg=%p "
3276 "attempt=%d reason=%x. Giving up.",
3277 fcftab->TID,
3278 emlxs_fc_fcftab_state_xlate(fcftab->state),
3279 emlxs_fcf_event_xlate(evt), arg1,
3280 fcftab->attempts,
3281 fcftab->reason);
3282
3283 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO_CMPL,
3284 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3285
3286 } else {
3287 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3288 "fc_fcftab_topo_failed_action:%x %s:%s arg=%p "
3289 "attempt=%d reason=%x. Retrying.",
3290 fcftab->TID,
3291 emlxs_fc_fcftab_state_xlate(fcftab->state),
3292 emlxs_fcf_event_xlate(evt), arg1,
3293 fcftab->attempts,
3294 fcftab->reason);
3295
3296 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO,
3297 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3298 }
3299
3300 return (rval);
3301
3302} /* emlxs_fc_fcftab_topo_failed_action() */
3303
3304
3305/*ARGSUSED*/
3306static uint32_t
3307emlxs_fc_fcftab_topo_cmpl_action(emlxs_port_t *port, uint32_t evt,
3308 void *arg1)
3309{
3310 emlxs_hba_t *hba = HBA;
3311 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3312 uint32_t rval = 0;
3313
3314 if (fcftab->state != FC_FCFTAB_STATE_TOPO_CMPL) {
3315 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3316 "fc_fcftab_topo_cmpl_action:%x %s:%s arg=%p. "
3317 "Invalid state. <",
3318 fcftab->TID,
3319 emlxs_fc_fcftab_state_xlate(fcftab->state),
3320 emlxs_fcf_event_xlate(evt), arg1);
3321 return (1);
3322 }
3323
3324 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3325 "fc_fcftab_topo_cmpl_action:%x attempts=%d. "
3326 "Config link.",
3327 fcftab->TID,
3328 fcftab->attempts);
3329
3330 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK,
3331 FCF_REASON_EVENT, evt, arg1);
3332
3333 return (rval);
3334
3335} /* emlxs_fc_fcftab_topo_cmpl_action() */
3336
3337
3338/*ARGSUSED*/
3339static uint32_t
3340emlxs_fc_fcftab_cfglink_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
3341{
3342 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
3343 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3344 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
3345 uint16_t TID;
3346
3347 mutex_enter(&EMLXS_FCF_LOCK);
3348 TID = (uint16_t)((unsigned long)mbq->context);
3349
3350 if (fcftab->state != FC_FCFTAB_STATE_CFGLINK) {
3351 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3352 "fc_fcftab_cfglink_mbcmpl:%x state=%s.",
3353 TID,
3354 emlxs_fc_fcftab_state_xlate(fcftab->state));
3355
3356 mutex_exit(&EMLXS_FCF_LOCK);
3357 return (0);
3358 }
3359
3360 if (TID != fcftab->generation) {
3361 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3362 "fc_fcftab_cfglink_mbcmpl:%x %s. "
3363 "Incorrect generation %x. Dropping.",
3364 TID,
3365 emlxs_fc_fcftab_state_xlate(fcftab->state),
3366 fcftab->generation);
3367
3368 mutex_exit(&EMLXS_FCF_LOCK);
3369 return (0);
3370 }
3371
3372 if (mb4->mbxStatus) {
3373 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3374 "fc_fcftab_cfglink_mbcmpl:%x failed. %s. >",
3375 fcftab->TID,
3376 emlxs_mb_xlate_status(mb4->mbxStatus));
3377
3378 if (mb4->mbxStatus == MBXERR_NO_RESOURCES) {
3379 (void) emlxs_fc_fcftab_state(port,
3380 FC_FCFTAB_STATE_CFGLINK_FAILED,
3381 FCF_REASON_MBOX_BUSY, mb4->mbxStatus, 0);
3382 } else {
3383 (void) emlxs_fc_fcftab_state(port,
3384 FC_FCFTAB_STATE_CFGLINK_FAILED,
3385 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
3386 }
3387
3388 mutex_exit(&EMLXS_FCF_LOCK);
3389 return (0);
3390 }
3391
3392 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
3393 "fc_fcftab_cfglink_mbcmpl:%x. >",
3394 fcftab->TID);
3395
3396 (void) emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK_CMPL,
3397 0, 0, 0);
3398
3399 mutex_exit(&EMLXS_FCF_LOCK);
3400 return (0);
3401
3402} /* emlxs_fc_fcftab_cfglink_mbcmpl() */
3403
3404
3405
3406/*ARGSUSED*/
3407static uint32_t
3408emlxs_fc_fcftab_cfglink_action(emlxs_port_t *port, uint32_t evt,
3409 void *arg1)
3410{
3411 emlxs_hba_t *hba = HBA;
3412 emlxs_config_t *cfg = &CFG;
3413 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3414 MAILBOXQ *mbq;
3415 MAILBOX4 *mb4;
3416 uint32_t rval = 0;
3417
3418 if (fcftab->state != FC_FCFTAB_STATE_CFGLINK) {
3419 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3420 "fc_fcftab_cfglink_action:%x %s:%s arg=%p. "
3421 "Invalid state. <",
3422 fcftab->TID,
3423 emlxs_fc_fcftab_state_xlate(fcftab->state),
3424 emlxs_fcf_event_xlate(evt), arg1);
3425 return (1);
3426 }
3427
3428 if ((fcftab->prev_state != FC_FCFTAB_STATE_CFGLINK_FAILED) ||
3429 (fcftab->flag & EMLXS_FC_FCFTAB_CFGLINK_REQ)) {
3430 fcftab->flag &= ~EMLXS_FC_FCFTAB_CFGLINK_REQ;
3431 fcftab->attempts = 0;
3432 }
3433
3434 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3435 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3436 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3437 "Handling request.",
3438 fcftab->TID,
3439 emlxs_fc_fcftab_state_xlate(fcftab->state),
3440 emlxs_fcf_event_xlate(evt), arg1,
3441 fcftab->generation,
3442 fcftab->flag);
3443
3444 rval = emlxs_fc_fcftab_req_handler(port, arg1);
3445 return (rval);
3446 }
3447
3448 if (fcftab->attempts == 0) {
3449 fcftab->TID = fcftab->generation;
3450 }
3451
3452 if (hba->topology != TOPOLOGY_LOOP) {
3453 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3454 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3455 "Fabric Topology. Skipping CONFIG_LINK.",
3456 fcftab->TID,
3457 emlxs_fc_fcftab_state_xlate(fcftab->state),
3458 emlxs_fcf_event_xlate(evt), arg1,
3459 fcftab->generation,
3460 fcftab->flag);
3461
3462 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM,
3463 FCF_REASON_EVENT, evt, arg1);
3464 return (rval);
3465 }
3466
3467 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3468 "fc_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
3469 "Sending CONFIG_LINK. <",
3470 fcftab->TID,
3471 emlxs_fc_fcftab_state_xlate(fcftab->state),
3472 emlxs_fcf_event_xlate(evt), arg1,
3473 fcftab->generation,
3474 fcftab->flag);
3475
3476 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
3477 rval = emlxs_fc_fcftab_state(port,
3478 FC_FCFTAB_STATE_CFGLINK_FAILED,
3479 FCF_REASON_NO_MBOX, 0, arg1);
3480 return (rval);
3481 }
3482 mb4 = (MAILBOX4*)mbq;
3483 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
3484
3485 mbq->nonembed = NULL;
3486 mbq->mbox_cmpl = emlxs_fc_fcftab_cfglink_mbcmpl;
3487 mbq->context = (void *)((unsigned long)fcftab->TID);
3488 mbq->port = (void *)port;
3489
3490 mb4->un.varSLIConfig.be.embedded = 0;
3491 mb4->mbxCommand = MBX_CONFIG_LINK;
3492 mb4->mbxOwner = OWN_HOST;
3493
3494 if (cfg[CFG_CR_DELAY].current) {
3495 mb4->un.varCfgLnk.cr = 1;
3496 mb4->un.varCfgLnk.ci = 1;
3497 mb4->un.varCfgLnk.cr_delay = cfg[CFG_CR_DELAY].current;
3498 mb4->un.varCfgLnk.cr_count = cfg[CFG_CR_COUNT].current;
3499 }
3500
3501 if (cfg[CFG_ACK0].current) {
3502 mb4->un.varCfgLnk.ack0_enable = 1;
3503 }
3504
3505 mb4->un.varCfgLnk.myId = port->did;
3506 mb4->un.varCfgLnk.edtov = hba->fc_edtov;
3507 mb4->un.varCfgLnk.arbtov = hba->fc_arbtov;
3508 mb4->un.varCfgLnk.ratov = hba->fc_ratov;
3509 mb4->un.varCfgLnk.rttov = hba->fc_rttov;
3510 mb4->un.varCfgLnk.altov = hba->fc_altov;
3511 mb4->un.varCfgLnk.crtov = hba->fc_crtov;
3512 mb4->un.varCfgLnk.citov = hba->fc_citov;
3513
3514 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
3515 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
3516 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3517
3518 rval = emlxs_fc_fcftab_state(port,
3519 FC_FCFTAB_STATE_CFGLINK_FAILED,
3520 FCF_REASON_SEND_FAILED, rval, arg1);
3521
3522 return (rval);
3523 }
3524
3525 return (0);
3526
3527} /* emlxs_fc_fcftab_cfglink_action() */
3528
3529
3530/*ARGSUSED*/
3531static uint32_t
3532emlxs_fc_fcftab_cfglink_failed_action(emlxs_port_t *port, uint32_t evt,
3533 void *arg1)
3534{
3535 emlxs_hba_t *hba = HBA;
3536 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3537 uint32_t rval = 0;
3538
3539 fcftab->attempts++;
3540
3541 if (fcftab->state != FC_FCFTAB_STATE_CFGLINK_FAILED) {
3542 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3543 "fc_fcftab_cfglink_failed_action:%x %s:%s arg=%p "
3544 "attempt=%d. Invalid state. <",
3545 fcftab->TID,
3546 emlxs_fc_fcftab_state_xlate(fcftab->state),
3547 emlxs_fcf_event_xlate(evt),
3548 arg1, fcftab->attempts);
3549 return (1);
3550 }
3551
3552 if ((fcftab->reason == FCF_REASON_MBOX_FAILED) ||
3553 (fcftab->reason == FCF_REASON_SEND_FAILED) ||
3554 (fcftab->attempts >= 3)) {
3555 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3556 "fc_fcftab_cfglink_failed_action:%x %s:%s arg=%p "
3557 "attempt=%d reason=%x. Giving up.",
3558 fcftab->TID,
3559 emlxs_fc_fcftab_state_xlate(fcftab->state),
3560 emlxs_fcf_event_xlate(evt), arg1,
3561 fcftab->attempts,
3562 fcftab->reason);
3563
3564 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK_CMPL,
3565 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3566
3567 } else {
3568 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3569 "fc_fcftab_cfglink_failed_action:%x %s:%s arg=%p "
3570 "attempt=%d reason=%x. Retrying.",
3571 fcftab->TID,
3572 emlxs_fc_fcftab_state_xlate(fcftab->state),
3573 emlxs_fcf_event_xlate(evt), arg1,
3574 fcftab->attempts,
3575 fcftab->reason);
3576
3577 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK,
3578 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3579 }
3580
3581 return (rval);
3582
3583} /* emlxs_fc_fcftab_cfglink_failed_action() */
3584
3585
3586/*ARGSUSED*/
3587static uint32_t
3588emlxs_fc_fcftab_cfglink_cmpl_action(emlxs_port_t *port, uint32_t evt,
3589 void *arg1)
3590{
3591 emlxs_hba_t *hba = HBA;
3592 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3593 uint32_t rval = 0;
3594
3595 if (fcftab->state != FC_FCFTAB_STATE_CFGLINK_CMPL) {
3596 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3597 "fc_fcftab_cfglink_cmpl_action:%x %s:%s arg=%p. "
3598 "Invalid state. <",
3599 fcftab->TID,
3600 emlxs_fc_fcftab_state_xlate(fcftab->state),
3601 emlxs_fcf_event_xlate(evt), arg1);
3602 return (1);
3603 }
3604
3605 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3606 "fc_fcftab_cfglink_cmpl_action:%x attempts=%d. "
3607 "Read SPARM.",
3608 fcftab->TID,
3609 fcftab->attempts);
3610
3611 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM,
3612 FCF_REASON_EVENT, evt, arg1);
3613
3614 return (rval);
3615
3616} /* emlxs_fc_fcftab_cfglink_cmpl_action() */
3617
3618
3619/*ARGSUSED*/
3620static uint32_t
3621emlxs_fc_fcftab_sparm_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
3622{
3623 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
3624 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3625 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
3626 MATCHMAP *mp;
3627 emlxs_port_t *vport;
3628 VPIobj_t *vpip;
3629 int32_t i;
3630 uint8_t null_wwn[8];
3631 uint16_t TID;
3632
3633 mutex_enter(&EMLXS_FCF_LOCK);
3634 TID = (uint16_t)((unsigned long)mbq->context);
3635
3636 if (fcftab->state != FC_FCFTAB_STATE_SPARM) {
3637 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3638 "fc_fcftab_sparm_mbcmpl:%x state=%s.",
3639 TID,
3640 emlxs_fc_fcftab_state_xlate(fcftab->state));
3641
3642 mutex_exit(&EMLXS_FCF_LOCK);
3643 return (0);
3644 }
3645
3646 if (TID != fcftab->generation) {
3647 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3648 "fc_fcftab_sparm_mbcmpl:%x %s. "
3649 "Incorrect generation %x. Dropping.",
3650 TID,
3651 emlxs_fc_fcftab_state_xlate(fcftab->state),
3652 fcftab->generation);
3653
3654 mutex_exit(&EMLXS_FCF_LOCK);
3655 return (0);
3656 }
3657
3658 if (mb4->mbxStatus) {
3659 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3660 "fc_fcftab_sparm_mbcmpl:%x failed. %s. >",
3661 fcftab->TID,
3662 emlxs_mb_xlate_status(mb4->mbxStatus));
3663
3664 if (mb4->mbxStatus == MBXERR_NO_RESOURCES) {
3665 (void) emlxs_fc_fcftab_state(port,
3666 FC_FCFTAB_STATE_SPARM_FAILED,
3667 FCF_REASON_MBOX_BUSY, mb4->mbxStatus, 0);
3668 } else {
3669 (void) emlxs_fc_fcftab_state(port,
3670 FC_FCFTAB_STATE_SPARM_FAILED,
3671 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
3672 }
3673
3674 mutex_exit(&EMLXS_FCF_LOCK);
3675 return (0);
3676 }
3677
3678 /* Save the parameters */
3679 mp = (MATCHMAP *)mbq->bp;
3680 bcopy((caddr_t)mp->virt, (caddr_t)&hba->sparam, sizeof (SERV_PARM));
3681
3682 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
3683 "fc_fcftab_sparm_mbcmpl:%x edtov=%x,%x bbc=%x. >",
3684 fcftab->TID,
3685 hba->fc_edtov, hba->sparam.cmn.e_d_tov,
3686 hba->sparam.cmn.bbCreditlsb);
3687
3688 /* Initialize the node name and port name only once */
3689 bzero(null_wwn, 8);
3690 if ((bcmp((caddr_t)&hba->wwnn, (caddr_t)null_wwn, 8) == 0) &&
3691 (bcmp((caddr_t)&hba->wwpn, (caddr_t)null_wwn, 8) == 0)) {
3692 bcopy((caddr_t)&hba->sparam.nodeName,
3693 (caddr_t)&hba->wwnn, sizeof (NAME_TYPE));
3694
3695 bcopy((caddr_t)&hba->sparam.portName,
3696 (caddr_t)&hba->wwpn, sizeof (NAME_TYPE));
3697 } else {
3698 bcopy((caddr_t)&hba->wwnn,
3699 (caddr_t)&hba->sparam.nodeName, sizeof (NAME_TYPE));
3700
3701 bcopy((caddr_t)&hba->wwpn,
3702 (caddr_t)&hba->sparam.portName, sizeof (NAME_TYPE));
3703 }
3704
3705 /* Update all bound ports */
3706 for (i = 0; i < MAX_VPORTS; i++) {
3707 vport = &VPORT(i);
3708 vpip = vport->vpip;
3709
3710 if (!(vport->flag & EMLXS_PORT_BOUND) ||
3711 (vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
3712 continue;
3713 }
3714
3715 bcopy((caddr_t)&hba->sparam,
3716 (caddr_t)&vport->sparam,
3717 sizeof (SERV_PARM));
3718
3719 bcopy((caddr_t)&vport->wwnn,
3720 (caddr_t)&vport->sparam.nodeName,
3721 sizeof (NAME_TYPE));
3722
3723 bcopy((caddr_t)&vport->wwpn,
3724 (caddr_t)&vport->sparam.portName,
3725 sizeof (NAME_TYPE));
3726 }
3727
3728 (void) emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM_CMPL,
3729 0, 0, 0);
3730
3731 mutex_exit(&EMLXS_FCF_LOCK);
3732 return (0);
3733
3734} /* emlxs_fc_fcftab_sparm_mbcmpl() */
3735
3736
3737/*ARGSUSED*/
3738static uint32_t
3739emlxs_fc_fcftab_sparm_action(emlxs_port_t *port, uint32_t evt,
3740 void *arg1)
3741{
3742 emlxs_hba_t *hba = HBA;
3743 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3744 MAILBOXQ *mbq;
3745 MAILBOX4 *mb4;
3746 uint32_t rval = 0;
3747 MATCHMAP *mp;
3748
3749 if (fcftab->state != FC_FCFTAB_STATE_SPARM) {
3750 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3751 "fc_fcftab_sparm_action:%x %s:%s arg=%p. "
3752 "Invalid state. <",
3753 fcftab->TID,
3754 emlxs_fc_fcftab_state_xlate(fcftab->state),
3755 emlxs_fcf_event_xlate(evt), arg1);
3756 return (1);
3757 }
3758
3759 if ((fcftab->prev_state != FC_FCFTAB_STATE_SPARM_FAILED) ||
3760 (fcftab->flag & EMLXS_FC_FCFTAB_SPARM_REQ)) {
3761 fcftab->flag &= ~EMLXS_FC_FCFTAB_SPARM_REQ;
3762 fcftab->attempts = 0;
3763 }
3764
3765 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3766 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3767 "fc_fcftab_read_action:%x %s:%s arg=%p flag=%x. "
3768 "Handling request.",
3769 fcftab->TID,
3770 emlxs_fc_fcftab_state_xlate(fcftab->state),
3771 emlxs_fcf_event_xlate(evt), arg1,
3772 fcftab->flag);
3773
3774 rval = emlxs_fc_fcftab_req_handler(port, arg1);
3775 return (rval);
3776 }
3777
3778 if (fcftab->attempts == 0) {
3779 fcftab->TID = fcftab->generation;
3780 }
3781
3782 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3783 "fc_fcftab_read_action:%x %s:%s arg=%p attempts=%d. "
3784 "Reading SPARM. <",
3785 fcftab->TID,
3786 emlxs_fc_fcftab_state_xlate(fcftab->state),
3787 emlxs_fcf_event_xlate(evt), arg1,
3788 fcftab->attempts);
3789
3790 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
3791 rval = emlxs_fc_fcftab_state(port,
3792 FC_FCFTAB_STATE_SPARM_FAILED,
3793 FCF_REASON_NO_MBOX, 0, arg1);
3794 return (rval);
3795 }
3796 mb4 = (MAILBOX4*)mbq;
3797 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
3798
3799 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
3800 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3801
3802 rval = emlxs_fc_fcftab_state(port,
3803 FC_FCFTAB_STATE_SPARM_FAILED,
3804 FCF_REASON_NO_BUFFER, 0, arg1);
3805 return (rval);
3806 }
3807 bzero(mp->virt, mp->size);
3808
3809 mbq->nonembed = NULL;
3810 mbq->bp = (void *)mp;
3811 mbq->mbox_cmpl = emlxs_fc_fcftab_sparm_mbcmpl;
3812 mbq->context = (void *)((unsigned long)fcftab->TID);
3813 mbq->port = (void *)port;
3814
3815 mb4->un.varSLIConfig.be.embedded = 0;
3816 mb4->mbxCommand = MBX_READ_SPARM64;
3817 mb4->mbxOwner = OWN_HOST;
3818
3819 mb4->un.varRdSparm.un.sp64.tus.f.bdeSize = sizeof (SERV_PARM);
3820 mb4->un.varRdSparm.un.sp64.addrHigh = PADDR_HI(mp->phys);
3821 mb4->un.varRdSparm.un.sp64.addrLow = PADDR_LO(mp->phys);
3822
3823 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
3824 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
3825 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
3826 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3827
3828 rval = emlxs_fc_fcftab_state(port,
3829 FC_FCFTAB_STATE_SPARM_FAILED,
3830 FCF_REASON_SEND_FAILED, rval, arg1);
3831
3832 return (rval);
3833 }
3834
3835 return (0);
3836
3837} /* emlxs_fc_fcftab_sparm_action() */
3838
3839
3840/*ARGSUSED*/
3841static uint32_t
3842emlxs_fc_fcftab_sparm_failed_action(emlxs_port_t *port, uint32_t evt,
3843 void *arg1)
3844{
3845 emlxs_hba_t *hba = HBA;
3846 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3847 uint32_t rval = 0;
3848
3849 fcftab->attempts++;
3850
3851 if (fcftab->state != FC_FCFTAB_STATE_SPARM_FAILED) {
3852 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3853 "fc_fcftab_sparm_failed_action:%x %s:%s arg=%p "
3854 "attempt=%d. Invalid state. <",
3855 fcftab->TID,
3856 emlxs_fc_fcftab_state_xlate(fcftab->state),
3857 emlxs_fcf_event_xlate(evt),
3858 arg1, fcftab->attempts);
3859 return (1);
3860 }
3861
3862 if ((fcftab->reason == FCF_REASON_MBOX_FAILED) ||
3863 (fcftab->reason == FCF_REASON_SEND_FAILED) ||
3864 (fcftab->attempts >= 3)) {
3865 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3866 "fc_fcftab_read_failed_action:%x %s:%s arg=%p "
3867 "attempt=%d reason=%x. Giving up.",
3868 fcftab->TID,
3869 emlxs_fc_fcftab_state_xlate(fcftab->state),
3870 emlxs_fcf_event_xlate(evt), arg1,
3871 fcftab->attempts,
3872 fcftab->reason);
3873
3874 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM_CMPL,
3875 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3876 } else {
3877 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3878 "fc_fcftab_read_failed_action:%x %s:%s arg=%p "
3879 "attempt=%d reason=%x. Retrying.",
3880 fcftab->TID,
3881 emlxs_fc_fcftab_state_xlate(fcftab->state),
3882 emlxs_fcf_event_xlate(evt), arg1,
3883 fcftab->attempts,
3884 fcftab->reason);
3885
3886 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM,
3887 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3888 }
3889
3890 return (rval);
3891
3892} /* emlxs_fc_fcftab_sparm_failed_action() */
3893
3894
3895/*ARGSUSED*/
3896static uint32_t
3897emlxs_fc_fcftab_sparm_cmpl_action(emlxs_port_t *port, uint32_t evt,
3898 void *arg1)
3899{
3900 emlxs_hba_t *hba = HBA;
3901 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3902 uint32_t rval = 0;
3903
3904 if (fcftab->state != FC_FCFTAB_STATE_SPARM_CMPL) {
3905 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3906 "fc_fcftab_sparm_cmpl_action:%x %s:%s arg=%p. "
3907 "Invalid state. <",
3908 fcftab->TID,
3909 emlxs_fc_fcftab_state_xlate(fcftab->state),
3910 emlxs_fcf_event_xlate(evt), arg1);
3911 return (1);
3912 }
3913
3914 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3915 "fc_fcftab_sparm_cmpl_action:%x attempts=%d. "
3916 "Bring FCFTAB online.",
3917 fcftab->TID,
3918 fcftab->attempts);
3919
3920 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_ONLINE,
3921 FCF_REASON_EVENT, evt, arg1);
3922
3923 return (rval);
3924
3925} /* emlxs_fc_fcftab_sparm_cmpl_action() */
3926
3927
3928/*ARGSUSED*/
3929static void
3930emlxs_fc_fcftab_process(emlxs_port_t *port)
3931{
3932 emlxs_hba_t *hba = HBA;
3933 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3934 FCFIobj_t *fcfp;
3935 FCF_RECORD_t fcf_record;
3936 FCF_RECORD_t *fcf_rec;
3937 uint8_t bitmap[512];
3938 uint16_t i;
3939
3940 /* Get the FCFI */
3941 fcfp = fcftab->fcfi[0];
3942
3943 if (!fcfp) {
3944 /* Allocate an fcfi */
3945 fcfp = emlxs_fcfi_alloc(port);
3946 }
3947
3948 if (!fcfp) {
3949 fcftab->fcfi_count = 0;
3950
3951 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3952 "fc_fcftab_process:%x No FCF available.",
3953 fcftab->TID);
3954 return;
3955 }
3956
3957 if (fcfp->flag & EMLXS_FCFI_SELECTED) {
3958 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3959 "fc_fcftab_process:%x fcfi=%d %s. "
3960 "FCF still selected.",
3961 fcftab->TID,
3962 fcfp->fcf_index,
3963 emlxs_fcfi_state_xlate(fcfp->state));
3964 } else {
3965 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3966 "fc_fcftab_process:%x fcfi=%d %s. "
3967 "New FCF selected.",
3968 fcftab->TID,
3969 fcfp->fcf_index,
3970 emlxs_fcfi_state_xlate(fcfp->state));
3971 }
3972
3973 /* Initalize an fcf_rec */
3974 fcf_rec = &fcf_record;
3975 bzero(fcf_rec, sizeof (FCF_RECORD_t));
3976
3977 fcf_rec->max_recv_size = EMLXS_FCOE_MAX_RCV_SZ;
3978 fcf_rec->fka_adv_period = 0;
3979 fcf_rec->fip_priority = 128;
3980
3981#ifdef EMLXS_BIG_ENDIAN
3982 fcf_rec->fcf_mac_address_hi[0] = FCOE_FCF_MAC3;
3983 fcf_rec->fcf_mac_address_hi[1] = FCOE_FCF_MAC2;
3984 fcf_rec->fcf_mac_address_hi[2] = FCOE_FCF_MAC1;
3985 fcf_rec->fcf_mac_address_hi[3] = FCOE_FCF_MAC0;
3986 fcf_rec->fcf_mac_address_low[0] = FCOE_FCF_MAC5;
3987 fcf_rec->fcf_mac_address_low[1] = FCOE_FCF_MAC4;
3988 fcf_rec->fc_map[0] = hba->sli.sli4.cfgFCOE.FCMap[2];
3989 fcf_rec->fc_map[1] = hba->sli.sli4.cfgFCOE.FCMap[1];
3990 fcf_rec->fc_map[2] = hba->sli.sli4.cfgFCOE.FCMap[0];
3991#endif /* EMLXS_BIG_ENDIAN */
3992#ifdef EMLXS_LITTLE_ENDIAN
3993 fcf_rec->fcf_mac_address_hi[0] = FCOE_FCF_MAC0;
3994 fcf_rec->fcf_mac_address_hi[1] = FCOE_FCF_MAC1;
3995 fcf_rec->fcf_mac_address_hi[2] = FCOE_FCF_MAC2;
3996 fcf_rec->fcf_mac_address_hi[3] = FCOE_FCF_MAC3;
3997 fcf_rec->fcf_mac_address_low[0] = FCOE_FCF_MAC4;
3998 fcf_rec->fcf_mac_address_low[1] = FCOE_FCF_MAC5;
3999 fcf_rec->fc_map[0] = hba->sli.sli4.cfgFCOE.FCMap[0];
4000 fcf_rec->fc_map[1] = hba->sli.sli4.cfgFCOE.FCMap[1];
4001 fcf_rec->fc_map[2] = hba->sli.sli4.cfgFCOE.FCMap[2];
4002#endif /* EMLXS_LITTLE_ENDIAN */
4003
4004 if (hba->sli.sli4.cfgFCOE.fip_flags & TLV_FCOE_VLAN) {
4005 bzero((void *) bitmap, 512);
4006 i = hba->sli.sli4.cfgFCOE.VLanId;
4007 bitmap[i / 8] = (1 << (i % 8));
4008 BE_SWAP32_BCOPY(bitmap, fcf_rec->vlan_bitmap, 512);
4009 } else {
4010 bzero((void *) bitmap, 512);
4011 bitmap[0] = 1; /* represents bit 0 */
4012 BE_SWAP32_BCOPY(bitmap, fcf_rec->vlan_bitmap, 512);
4013 }
4014
4015 fcf_rec->fcf_valid = 1;
4016 fcf_rec->fcf_available = 1;
4017
4018 /* Update the FCFI */
4019 emlxs_fcfi_update(port, fcfp, fcf_rec, hba->link_event_tag);
4020
4021 /* Select the FCFI */
4022 fcfp->flag &= ~EMLXS_FCFI_FAILED;
4023 fcfp->flag |= EMLXS_FCFI_SELECTED;
4024 fcftab->fcfi[0] = fcfp;
4025 fcftab->fcfi_count = 1;
4026
4027 return;
4028
4029} /* emlxs_fc_fcftab_process() */
4030
4031
4032/*ARGSUSED*/
4033static uint32_t
4034emlxs_fc_fcftab_fcfi_online_action(emlxs_port_t *port, uint32_t evt,
4035 void *arg1)
4036{
4037 emlxs_hba_t *hba = HBA;
4038 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4039 uint32_t rval = 0;
4040 FCFIobj_t *fcfp;
4041
4042 if (fcftab->state != FC_FCFTAB_STATE_FCFI_ONLINE) {
4043 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4044 "fc_fcftab_fcfi_online_action:%x %s:%s arg=%p. "
4045 "Invalid state. <",
4046 fcftab->TID,
4047 emlxs_fc_fcftab_state_xlate(fcftab->state),
4048 emlxs_fcf_event_xlate(evt), arg1);
4049 return (1);
4050 }
4051
4052 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
4053 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4054 "fc_fcftab_fcfi_online_action:%x flag=%x. "
4055 "Handling request.",
4056 fcftab->TID,
4057 fcftab->flag);
4058
4059 rval = emlxs_fc_fcftab_req_handler(port, arg1);
4060 return (rval);
4061 }
4062
4063 emlxs_fc_fcftab_process(port);
4064
4065 fcfp = fcftab->fcfi[0];
4066 if (!fcfp) {
4067 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4068 "fc_fcftab_fcfi_online_action:%x. "
4069 "No FCF available. Offlining.",
4070 fcftab->TID);
4071
4072 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4073 fcftab->flag |= EMLXS_FC_FCFTAB_OFFLINE_REQ;
4074 rval = emlxs_fc_fcftab_req_handler(port, arg1);
4075
4076 mutex_exit(&EMLXS_FCF_LOCK);
4077 return (rval);
4078 }
4079
4080 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4081 "fc_fcftab_fcfi_online_action:%x fcfi_count=%d. "
4082 "Onlining FCFI:%d. >",
4083 fcftab->TID,
4084 fcftab->fcfi_count,
4085 fcfp->fcf_index);
4086
4087 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_ONLINE, fcfp);
4088
4089 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_ONLINE_CMPL,
4090 FCF_REASON_EVENT, evt, arg1);
4091
4092 return (rval);
4093
4094} /* emlxs_fc_fcftab_fcfi_online_action() */
4095
4096
4097/*ARGSUSED*/
4098static uint32_t
4099emlxs_fc_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port, uint32_t evt,
4100 void *arg1)
4101{
4102 emlxs_hba_t *hba = HBA;
4103 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4104 uint32_t rval = 0;
4105
4106 if (fcftab->state != FC_FCFTAB_STATE_FCFI_ONLINE_CMPL) {
4107 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4108 "fc_fcftab_fcfi_online_cmpl_action:%x %s:%s arg=%p. "
4109 "Invalid state. <",
4110 fcftab->TID,
4111 emlxs_fc_fcftab_state_xlate(fcftab->state),
4112 emlxs_fcf_event_xlate(evt), arg1);
4113 return (1);
4114 }
4115
4116 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
4117 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4118 "fc_fcftab_fcfi_online_cmpl_action:%x %s:%s arg=%p "
4119 "flag=%x. Handling request.",
4120 fcftab->TID,
4121 emlxs_fc_fcftab_state_xlate(fcftab->state),
4122 emlxs_fcf_event_xlate(evt), arg1,
4123 fcftab->flag);
4124
4125 rval = emlxs_fc_fcftab_req_handler(port, arg1);
4126 return (rval);
4127 }
4128
4129 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4130 "fc_fcftab_fcfi_online_cmpl_action:%x %s:%s arg=%p. "
4131 "Going online.",
4132 fcftab->TID,
4133 emlxs_fc_fcftab_state_xlate(fcftab->state),
4134 emlxs_fcf_event_xlate(evt), arg1);
4135
4136 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_ONLINE,
4137 FCF_REASON_EVENT, evt, arg1);
4138
4139 return (rval);
4140
4141} /* emlxs_fc_fcftab_fcfi_online_cmpl_action() */
4142
4143
4144/*ARGSUSED*/
4145static uint32_t
4146emlxs_fc_fcftab_fcfi_offline_action(emlxs_port_t *port, uint32_t evt,
4147 void *arg1)
4148{
4149 emlxs_hba_t *hba = HBA;
4150 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4151 uint32_t rval = 0;
4152 FCFIobj_t *fcfp;
4153
4154 if (fcftab->state != FC_FCFTAB_STATE_FCFI_OFFLINE) {
4155 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4156 "fc_fcftab_fcftab_offline_action:%x %s:%s arg=%p. "
4157 "Invalid state. <",
4158 fcftab->TID,
4159 emlxs_fc_fcftab_state_xlate(fcftab->state),
4160 emlxs_fcf_event_xlate(evt), arg1);
4161 return (1);
4162 }
4163
4164 if (fcftab->fcfi_online) {
4165 fcfp = fcftab->fcfi[0];
4166
4167 if (!(fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
4168 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4169 "fc_fcftab_fcfi_offline_action:%d. "
4170 "Offlining FCFI:%d. >",
4171 fcftab->TID,
4172 fcfp->fcf_index);
4173
4174 rval = emlxs_fcfi_event(port,
4175 FCF_EVENT_FCFI_OFFLINE, fcfp);
4176
4177 return (rval);
4178 }
4179
4180 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4181 "fc_fcftab_fcfi_offline_action:%x fcfi_online=%d. "
4182 "Waiting on FCF. <",
4183 fcftab->TID,
4184 fcftab->fcfi_online);
4185
4186 return (0);
4187 }
4188
4189 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4190 "fc_fcftab_fcfi_offline_action:%x %s:%s arg=%p.",
4191 fcftab->TID,
4192 emlxs_fc_fcftab_state_xlate(fcftab->state),
4193 emlxs_fcf_event_xlate(evt), arg1);
4194
4195 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
4196 FCF_REASON_EVENT, evt, arg1);
4197
4198 return (rval);
4199
4200} /* emlxs_fc_fcftab_fcfi_offline_action() */
4201
4202
4203/*ARGSUSED*/
4204static uint32_t
4205emlxs_fc_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port, uint32_t evt,
4206 void *arg1)
4207{
4208 emlxs_hba_t *hba = HBA;
4209 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4210 uint32_t rval = 0;
4211
4212 if (fcftab->state != FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL) {
4213 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4214 "fc_fcftab_fcftab_offline_cmpl_action:%x %s:%s arg=%p. "
4215 "Invalid state. <",
4216 fcftab->TID,
4217 emlxs_fc_fcftab_state_xlate(fcftab->state),
4218 emlxs_fcf_event_xlate(evt), arg1);
4219 return (1);
4220 }
4221
4222 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
4223 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4224 "fc_fcftab_fcfi_offline_cmpl_action:%x %s:%s arg=%p. "
4225 "Handling request.",
4226 fcftab->TID,
4227 emlxs_fc_fcftab_state_xlate(fcftab->state),
4228 emlxs_fcf_event_xlate(evt), arg1);
4229
4230 rval = emlxs_fc_fcftab_req_handler(port, arg1);
4231 return (rval);
4232 }
4233
4234 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4235 "fc_fcftab_fcftab_offline_cmpl_action:%x %s:%s arg=%p. "
4236 "Returning FCF(s) online.",
4237 fcftab->TID,
4238 emlxs_fc_fcftab_state_xlate(fcftab->state),
4239 emlxs_fcf_event_xlate(evt), arg1);
4240
4241 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_ONLINE,
4242 FCF_REASON_EVENT, evt, arg1);
4243
4244 return (rval);
4245
4246} /* emlxs_fc_fcftab_fcfi_offline_cmpl_action() */
4247
4248
4249/*ARGSUSED*/
4250static uint32_t
4251emlxs_fc_fcftab_linkup_evt_action(emlxs_port_t *port, uint32_t evt,
4252 void *arg1)
4253{
4254 emlxs_hba_t *hba = HBA;
4255 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4256 uint32_t rval = 0;
4257
4258 if (evt != FCF_EVENT_LINKUP) {
4259 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4260 "fc_fcftab_linkup_evt_action:%x %s:%s arg=%p flag=%x. "
4261 "Invalid event type. <",
4262 fcftab->TID,
4263 emlxs_fc_fcftab_state_xlate(fcftab->state),
4264 emlxs_fcf_event_xlate(evt), arg1,
4265 fcftab->flag);
4266 return (1);
4267 }
4268
4269 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4270 "fc_fcftab_linkup_evt_action:%x %s:%s arg=%p gen=%x. Link up.",
4271 fcftab->TID,
4272 emlxs_fc_fcftab_state_xlate(fcftab->state),
4273 emlxs_fcf_event_xlate(evt), arg1,
4274 fcftab->generation);
4275
4276 emlxs_fcf_linkup(port);
4277
4278 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4279 fcftab->flag |= EMLXS_FC_FCFTAB_TOPO_REQ;
4280 fcftab->generation++;
4281
4282 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4283 "fc_fcftab_linkup_evt_action:%x %s gen=%x. "
4284 "Read topology.",
4285 fcftab->TID,
4286 emlxs_fc_fcftab_state_xlate(fcftab->state),
4287 fcftab->generation);
4288
4289 switch (fcftab->state) {
4290 case FC_FCFTAB_STATE_TOPO:
4291 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO,
4292 FCF_REASON_REENTER, evt, arg1);
4293 break;
4294
4295 default:
4296 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO,
4297 FCF_REASON_EVENT, evt, arg1);
4298 break;
4299 }
4300
4301 return (rval);
4302
4303} /* emlxs_fc_fcftab_linkup_evt_action() */
4304
4305
4306/*ARGSUSED*/
4307static uint32_t
4308emlxs_fc_fcftab_linkdown_evt_action(emlxs_port_t *port, uint32_t evt,
4309 void *arg1)
4310{
4311 emlxs_hba_t *hba = HBA;
4312 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4313 uint32_t rval = 0;
4314 uint32_t i;
4315 FCFIobj_t *fcfp;
4316
4317 if (evt != FCF_EVENT_LINKDOWN) {
4318 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4319 "fc_fcftab_linkdown_evt_action:%x %s:%s arg=%p flag=%x. "
4320 "Invalid event type. <",
4321 fcftab->TID,
4322 emlxs_fc_fcftab_state_xlate(fcftab->state),
4323 emlxs_fcf_event_xlate(evt), arg1,
4324 fcftab->flag);
4325 return (1);
4326 }
4327
4328 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4329 fcftab->flag |= EMLXS_FC_FCFTAB_OFFLINE_REQ;
4330
4331 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4332 "fc_fcftab_linkdown_evt_action:%x %s:%s arg=%p flag=%x. Linkdown.",
4333 fcftab->TID,
4334 emlxs_fc_fcftab_state_xlate(fcftab->state),
4335 emlxs_fcf_event_xlate(evt), arg1,
4336 fcftab->flag);
4337
4338 emlxs_fcf_linkdown(port);
4339
4340 /* Pause all active FCFI's */
4341 for (i = 0; i < fcftab->fcfi_count; i++) {
4342 fcfp = fcftab->fcfi[i];
4343
4344 if ((fcfp->state == FCFI_STATE_OFFLINE) ||
4345 (fcfp->state == FCFI_STATE_PAUSED)) {
4346 break;
4347 }
4348
4349 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4350 "fc_fcftab_linkdown_evt_action:%x. "
4351 "Pausing FCFI:%d. >",
4352 fcftab->TID,
4353 fcfp->fcf_index);
4354
4355 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_PAUSE, fcfp);
4356 }
4357
4358 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4359 "fc_fcftab_linkdown_evt_action:%x "
4360 "Going offline.",
4361 fcftab->TID);
4362
4363 switch (fcftab->state) {
4364 case FC_FCFTAB_STATE_OFFLINE:
4365 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_OFFLINE,
4366 FCF_REASON_REENTER, evt, arg1);
4367 break;
4368
4369 default:
4370 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_OFFLINE,
4371 FCF_REASON_EVENT, evt, arg1);
4372 break;
4373 }
4374
4375 return (rval);
4376
4377} /* emlxs_fc_fcftab_linkdown_evt_action() */
4378
4379
4380/*ARGSUSED*/
4381static uint32_t
4382emlxs_fc_fcftab_fcfi_offline_evt_action(emlxs_port_t *port, uint32_t evt,
4383 void *arg1)
4384{
4385 emlxs_hba_t *hba = HBA;
4386 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4387 uint32_t rval = 0;
4388 FCFIobj_t *fcfp;
4389
4390 if (evt != FCF_EVENT_FCFI_OFFLINE) {
4391 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4392 "fc_fcftab_fcftab_offline_evt_action:%x %s:%s arg=%p "
4393 "flag=%x. Invalid event type. <",
4394 fcftab->TID,
4395 emlxs_fc_fcftab_state_xlate(fcftab->state),
4396 emlxs_fcf_event_xlate(evt), arg1,
4397 fcftab->flag);
4398 return (1);
4399 }
4400
4401 fcfp = (FCFIobj_t *)arg1;
4402
4403 switch (fcftab->state) {
4404 case FC_FCFTAB_STATE_SHUTDOWN:
4405 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4406 "fc_fcftab_fcfi_offline_evt_action:%x fcfi:%d. "
4407 "Shutting down.",
4408 fcftab->TID,
4409 fcfp->fcf_index);
4410
4411 /* This will trigger final shutdown */
4412 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SHUTDOWN,
4413 FCF_REASON_REENTER, evt, arg1);
4414 break;
4415
4416 case FC_FCFTAB_STATE_FCFI_OFFLINE:
4417 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4418 "fc_fcftab_fcfi_offline_evt_action:%x fcfi:%d. Offlining.",
4419 fcftab->TID,
4420 fcfp->fcf_index);
4421
4422 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_OFFLINE,
4423 FCF_REASON_REENTER, evt, arg1);
4424 break;
4425
4426 case FC_FCFTAB_STATE_FCFI_ONLINE:
4427 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4428 "fc_fcftab_fcfi_offline_evt_action:%x fcfi:%d. "
4429 "Retrying FCF.",
4430 fcftab->TID,
4431 fcfp->fcf_index);
4432
4433 fcfp->flag |= EMLXS_FCFI_FAILED;
4434
4435 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_FCFI_ONLINE,
4436 FCF_REASON_REENTER, evt, arg1);
4437 break;
4438
4439 case FC_FCFTAB_STATE_ONLINE:
4440 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4441 "fc_fcftab_fcfi_offline_evt_action:%x fcfi:%d.",
4442 fcftab->TID,
4443 fcfp->fcf_index);
4444
4445 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_ONLINE,
4446 FCF_REASON_REENTER, evt, arg1);
4447 break;
4448
4449 default:
4450 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4451 "fc_fcftab_fcfi_offline_evt_action:%x %s fcfi:%d.",
4452 fcftab->TID,
4453 emlxs_fc_fcftab_state_xlate(fcftab->state),
4454 fcfp->fcf_index);
4455 break;
4456 }
4457
4458 return (rval);
4459
4460} /* emlxs_fc_fcftab_fcfi_offline_evt_action() */
4461
4462
4463/*ARGSUSED*/
4464static uint32_t
4465emlxs_fc_fcftab_fcfi_online_evt_action(emlxs_port_t *port, uint32_t evt,
4466 void *arg1)
4467{
4468 emlxs_hba_t *hba = HBA;
4469 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4470 uint32_t rval = 0;
4471 FCFIobj_t *fcfp;
4472
4473 if (evt != FCF_EVENT_FCFI_ONLINE) {
4474 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4475 "fc_fcftab_fcftab_online_evt_action:%x %s:%s arg=%p "
4476 "flag=%x. Invalid event type. <",
4477 fcftab->TID,
4478 emlxs_fc_fcftab_state_xlate(fcftab->state),
4479 emlxs_fcf_event_xlate(evt), arg1,
4480 fcftab->flag);
4481 return (1);
4482 }
4483
4484 fcfp = (FCFIobj_t *)arg1;
4485
4486 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4487 "fc_fcftab_fcfi_online_evt_action:%d fcfi:%d. <",
4488 fcftab->TID,
4489 fcfp->fcf_index);
4490
4491 return (rval);
4492
4493} /* emlxs_fc_fcftab_fcfi_online_evt_action() */
4494
4495
4496/*ARGSUSED*/
4497static uint32_t
4498emlxs_fc_fcftab_shutdown_evt_action(emlxs_port_t *port, uint32_t evt,
4499 void *arg1)
4500{
4501 emlxs_hba_t *hba = HBA;
4502 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4503 uint32_t rval = 0;
4504
4505 if (evt != FCF_EVENT_SHUTDOWN) {
4506 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4507 "fc_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
4508 "Invalid event type. <",
4509 fcftab->TID,
4510 emlxs_fc_fcftab_state_xlate(fcftab->state),
4511 emlxs_fcf_event_xlate(evt), arg1,
4512 fcftab->flag);
4513 return (1);
4514 }
4515
4516 if (fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) {
4517 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4518 "fc_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
4519 "Already shut down. <",
4520 fcftab->TID,
4521 emlxs_fc_fcftab_state_xlate(fcftab->state),
4522 emlxs_fcf_event_xlate(evt), arg1,
4523 fcftab->flag);
4524 return (1);
4525 }
4526
4527 if (fcftab->state == FC_FCFTAB_STATE_SHUTDOWN) {
4528 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4529 "fc_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
4530 "Already shutting down. <",
4531 fcftab->TID,
4532 emlxs_fc_fcftab_state_xlate(fcftab->state),
4533 emlxs_fcf_event_xlate(evt), arg1,
4534 fcftab->flag);
4535 return (1);
4536 }
4537
4538 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4539 "fc_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
4540 "Shutting down.",
4541 fcftab->TID,
4542 emlxs_fc_fcftab_state_xlate(fcftab->state),
4543 emlxs_fcf_event_xlate(evt), arg1,
4544 fcftab->flag);
4545
4546 emlxs_fcf_linkdown(port);
4547
4548 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SHUTDOWN,
4549 FCF_REASON_EVENT, evt, arg1);
4550
4551 return (rval);
4552
4553} /* emlxs_fc_fcftab_shutdown_evt_action() */
4554
4555
4556static uint32_t
4557emlxs_fc_fcftab_req_handler(emlxs_port_t *port, void *arg1)
4558{
4559 emlxs_hba_t *hba = HBA;
4560 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4561 uint32_t rval = 0;
4562
4563 if (!(fcftab->flag & EMLXS_FCFTAB_REQ_MASK)) {
4564 return (1);
4565 }
4566
4567 if (fcftab->flag & EMLXS_FC_FCFTAB_OFFLINE_REQ) {
4568 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_OFFLINE,
4569 FCF_REASON_REQUESTED, 0, arg1);
4570 }
4571
4572 else if (fcftab->flag & EMLXS_FC_FCFTAB_TOPO_REQ) {
4573 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_TOPO,
4574 FCF_REASON_REQUESTED, 0, arg1);
4575 }
4576
4577 else if (fcftab->flag & EMLXS_FC_FCFTAB_CFGLINK_REQ) {
4578 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_CFGLINK,
4579 FCF_REASON_REQUESTED, 0, arg1);
4580 }
4581
4582 else if (fcftab->flag & EMLXS_FC_FCFTAB_SPARM_REQ) {
4583 rval = emlxs_fc_fcftab_state(port, FC_FCFTAB_STATE_SPARM,
4584 FCF_REASON_REQUESTED, 0, arg1);
4585 }
4586
4587 return (rval);
4588
4589} /* emlxs_fc_fcftab_req_handler() */
4590
4591
4592
4593/* ************************************************************************** */
4594/* FCOE FCFTAB */
4595/* ************************************************************************** */
4596
4597static char *
4598emlxs_fcoe_fcftab_state_xlate(uint32_t state)
4599{
4600 static char buffer[32];
4601 uint32_t i;
4602 uint32_t count;
4603
4604 count = sizeof (emlxs_fcoe_fcftab_state_table) / sizeof (emlxs_table_t);
4605 for (i = 0; i < count; i++) {
4606 if (state == emlxs_fcoe_fcftab_state_table[i].code) {
4607 return (emlxs_fcoe_fcftab_state_table[i].string);
4608 }
4609 }
4610
4611 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
4612 return (buffer);
4613
4614} /* emlxs_fcoe_fcftab_state_xlate() */
4615
4616
4617static uint32_t
4618emlxs_fcoe_fcftab_action(emlxs_port_t *port, uint32_t evt,
4619 void *arg1)
4620{
4621 emlxs_hba_t *hba = HBA;
4622 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4623 uint32_t rval = 0;
4624 uint32_t(*func) (emlxs_port_t *, uint32_t, void *);
4625 uint32_t index;
4626 uint32_t events;
4627 uint16_t state;
4628
4629 /* Convert event to action table index */
4630 switch (evt) {
4631 case FCF_EVENT_STATE_ENTER:
4632 index = 0;
4633 break;
4634 case FCF_EVENT_SHUTDOWN:
4635 index = 1;
4636 break;
4637 case FCF_EVENT_LINKUP:
4638 index = 2;
4639 break;
4640 case FCF_EVENT_LINKDOWN:
4641 index = 3;
4642 break;
2080 case FCF_EVENT_CVL:
2081 index = 4;
2082 break;
2083 case FCF_EVENT_FCF_FOUND:
2084 index = 5;
2085 break;
2086 case FCF_EVENT_FCF_LOST:
2087 index = 6;

--- 9 unchanged lines hidden (view full) ---

2097 break;
2098 case FCF_EVENT_FCFI_OFFLINE:
2099 index = 10;
2100 break;
2101 default:
2102 return (1);
2103 }
2104
4643 case FCF_EVENT_CVL:
4644 index = 4;
4645 break;
4646 case FCF_EVENT_FCF_FOUND:
4647 index = 5;
4648 break;
4649 case FCF_EVENT_FCF_LOST:
4650 index = 6;

--- 9 unchanged lines hidden (view full) ---

4660 break;
4661 case FCF_EVENT_FCFI_OFFLINE:
4662 index = 10;
4663 break;
4664 default:
4665 return (1);
4666 }
4667
2105 events = FCFTAB_ACTION_EVENTS;
4668 events = FCOE_FCFTAB_ACTION_EVENTS;
2106 state = fcftab->state;
2107
2108 index += (state * events);
2109 func = (uint32_t(*) (emlxs_port_t *, uint32_t, void *))
4669 state = fcftab->state;
4670
4671 index += (state * events);
4672 func = (uint32_t(*) (emlxs_port_t *, uint32_t, void *))
2110 emlxs_fcftab_action_table[index];
4673 emlxs_fcoe_fcftab_action_table[index];
2111
2112 if (!func) {
2113 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4674
4675 if (!func) {
4676 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
2114 "fcftab: %s:%s arg=%p. No action. Terminated.",
2115 emlxs_fcftab_state_xlate(fcftab->state),
4677 "fcoe_fcftab_action:%x %s:%s arg=%p. No action. <",
4678 fcftab->TID,
4679 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2116 emlxs_fcf_event_xlate(evt), arg1);
2117
2118 return (1);
2119 }
2120
2121 rval = (func)(port, evt, arg1);
2122
2123 return (rval);
2124
4680 emlxs_fcf_event_xlate(evt), arg1);
4681
4682 return (1);
4683 }
4684
4685 rval = (func)(port, evt, arg1);
4686
4687 return (rval);
4688
2125} /* emlxs_fcftab_action() */
4689} /* emlxs_fcoe_fcftab_action() */
2126
2127
2128static uint32_t
4690
4691
4692static uint32_t
2129emlxs_fcftab_event(emlxs_port_t *port, uint32_t evt,
4693emlxs_fcoe_fcftab_event(emlxs_port_t *port, uint32_t evt,
2130 void *arg1)
2131{
2132 emlxs_hba_t *hba = HBA;
2133 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4694 void *arg1)
4695{
4696 emlxs_hba_t *hba = HBA;
4697 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2134 uint32_t rval;
4698 uint32_t rval = 0;
2135
2136 /* Filter events */
2137 switch (evt) {
2138 case FCF_EVENT_SHUTDOWN:
2139 case FCF_EVENT_LINKUP:
2140 case FCF_EVENT_LINKDOWN:
2141 case FCF_EVENT_CVL:
2142 case FCF_EVENT_FCF_FOUND:

--- 4 unchanged lines hidden (view full) ---

2147 case FCF_EVENT_FCFI_ONLINE:
2148 break;
2149
2150 default:
2151 return (1);
2152 }
2153
2154 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4699
4700 /* Filter events */
4701 switch (evt) {
4702 case FCF_EVENT_SHUTDOWN:
4703 case FCF_EVENT_LINKUP:
4704 case FCF_EVENT_LINKDOWN:
4705 case FCF_EVENT_CVL:
4706 case FCF_EVENT_FCF_FOUND:

--- 4 unchanged lines hidden (view full) ---

4711 case FCF_EVENT_FCFI_ONLINE:
4712 break;
4713
4714 default:
4715 return (1);
4716 }
4717
4718 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
2155 "fcftab: %s:%s arg=%p.",
2156 emlxs_fcftab_state_xlate(fcftab->state),
4719 "fcoe_fcftab_event:%x %s:%s arg=%p.",
4720 fcftab->TID,
4721 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2157 emlxs_fcf_event_xlate(evt), arg1);
2158
4722 emlxs_fcf_event_xlate(evt), arg1);
4723
2159 rval = emlxs_fcftab_action(port, evt, arg1);
4724 rval = emlxs_fcoe_fcftab_action(port, evt, arg1);
2160
2161 return (rval);
2162
4725
4726 return (rval);
4727
2163} /* emlxs_fcftab_event() */
4728} /* emlxs_fcoe_fcftab_event() */
2164
2165
2166/* EMLXS_FCF_LOCK must be held to enter */
2167/*ARGSUSED*/
2168static uint32_t
4729
4730
4731/* EMLXS_FCF_LOCK must be held to enter */
4732/*ARGSUSED*/
4733static uint32_t
2169emlxs_fcftab_state(emlxs_port_t *port, uint16_t state, uint16_t reason,
4734emlxs_fcoe_fcftab_state(emlxs_port_t *port, uint16_t state, uint16_t reason,
2170 uint32_t explain, void *arg1)
2171{
2172 emlxs_hba_t *hba = HBA;
2173 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2174 uint32_t rval = 0;
2175
4735 uint32_t explain, void *arg1)
4736{
4737 emlxs_hba_t *hba = HBA;
4738 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4739 uint32_t rval = 0;
4740
2176 if (state >= FCFTAB_ACTION_STATES) {
4741 if (state >= FCOE_FCFTAB_ACTION_STATES) {
2177 return (1);
2178 }
2179
2180 if ((fcftab->state == state) &&
2181 (reason != FCF_REASON_REENTER)) {
2182 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4742 return (1);
4743 }
4744
4745 if ((fcftab->state == state) &&
4746 (reason != FCF_REASON_REENTER)) {
4747 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2183 "fcftab_state: %s:%s:0x%x arg=%p. "
2184 "State not changed. Terminated.",
2185 emlxs_fcftab_state_xlate(state),
4748 "fcftab_state:%x %s:%s:0x%x arg=%p. "
4749 "State not changed. <",
4750 fcftab->TID,
4751 emlxs_fcoe_fcftab_state_xlate(state),
2186 emlxs_fcf_reason_xlate(reason),
2187 explain, arg1);
4752 emlxs_fcf_reason_xlate(reason),
4753 explain, arg1);
2188
2189 return (1);
2190 }
2191
2192 if (!reason) {
2193 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4754 return (1);
4755 }
4756
4757 if (!reason) {
4758 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2194 "fcftab:%s-->%s arg=%p",
2195 emlxs_fcftab_state_xlate(fcftab->state),
2196 emlxs_fcftab_state_xlate(state), arg1);
4759 "fcftab_state:%x %s-->%s arg=%p",
4760 fcftab->TID,
4761 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4762 emlxs_fcoe_fcftab_state_xlate(state), arg1);
2197 } else if (reason == FCF_REASON_EVENT) {
2198 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4763 } else if (reason == FCF_REASON_EVENT) {
4764 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2199 "fcftab:%s-->%s:%s:%s arg=%p",
2200 emlxs_fcftab_state_xlate(fcftab->state),
2201 emlxs_fcftab_state_xlate(state),
4765 "fcftab_state:%x %s-->%s:%s:%s arg=%p",
4766 fcftab->TID,
4767 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4768 emlxs_fcoe_fcftab_state_xlate(state),
2202 emlxs_fcf_reason_xlate(reason),
2203 emlxs_fcf_event_xlate(explain), arg1);
2204 } else if (explain) {
2205 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4769 emlxs_fcf_reason_xlate(reason),
4770 emlxs_fcf_event_xlate(explain), arg1);
4771 } else if (explain) {
4772 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2206 "fcftab:%s-->%s:%s:0x%x arg=%p",
2207 emlxs_fcftab_state_xlate(fcftab->state),
2208 emlxs_fcftab_state_xlate(state),
4773 "fcftab_state:%x %s-->%s:%s:0x%x arg=%p",
4774 fcftab->TID,
4775 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4776 emlxs_fcoe_fcftab_state_xlate(state),
2209 emlxs_fcf_reason_xlate(reason),
2210 explain, arg1);
2211 } else {
2212 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4777 emlxs_fcf_reason_xlate(reason),
4778 explain, arg1);
4779 } else {
4780 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
2213 "fcftab:%s-->%s:%s arg=%p",
2214 emlxs_fcftab_state_xlate(fcftab->state),
2215 emlxs_fcftab_state_xlate(state),
4781 "fcftab_state:%x %s-->%s:%s arg=%p",
4782 fcftab->TID,
4783 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4784 emlxs_fcoe_fcftab_state_xlate(state),
2216 emlxs_fcf_reason_xlate(reason), arg1);
2217 }
2218
2219 fcftab->prev_state = fcftab->state;
2220 fcftab->prev_reason = fcftab->reason;
2221 fcftab->state = state;
2222 fcftab->reason = reason;
2223
4785 emlxs_fcf_reason_xlate(reason), arg1);
4786 }
4787
4788 fcftab->prev_state = fcftab->state;
4789 fcftab->prev_reason = fcftab->reason;
4790 fcftab->state = state;
4791 fcftab->reason = reason;
4792
2224 rval = emlxs_fcftab_action(port, FCF_EVENT_STATE_ENTER, arg1);
4793 rval = emlxs_fcoe_fcftab_action(port, FCF_EVENT_STATE_ENTER, arg1);
2225
2226 return (rval);
2227
4794
4795 return (rval);
4796
2228} /* emlxs_fcftab_state() */
4797} /* emlxs_fcoe_fcftab_state() */
2229
2230
2231/*ARGSUSED*/
2232static uint32_t
4798
4799
4800/*ARGSUSED*/
4801static uint32_t
2233emlxs_fcftab_fcfi_offline_evt_action(emlxs_port_t *port, uint32_t evt,
4802emlxs_fcoe_fcftab_fcfi_offline_evt_action(emlxs_port_t *port, uint32_t evt,
2234 void *arg1)
2235{
2236 emlxs_hba_t *hba = HBA;
2237 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2238 uint32_t rval = 0;
2239 FCFIobj_t *fcfp;
2240
2241 if (evt != FCF_EVENT_FCFI_OFFLINE) {
2242 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4803 void *arg1)
4804{
4805 emlxs_hba_t *hba = HBA;
4806 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4807 uint32_t rval = 0;
4808 FCFIobj_t *fcfp;
4809
4810 if (evt != FCF_EVENT_FCFI_OFFLINE) {
4811 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2243 "fcftab_fcfi_offline_evt_action: %s:%s arg=%p flag=%x. "
2244 "Invalid event type. Terminated.",
2245 emlxs_fcftab_state_xlate(fcftab->state),
4812 "fcoe_fcftab_fcfi_offline_evt_action:%x %s:%s arg=%p "
4813 "flag=%x. Invalid event type. <",
4814 fcftab->TID,
4815 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2246 emlxs_fcf_event_xlate(evt), arg1,
2247 fcftab->flag);
2248 return (1);
2249 }
2250
2251 fcfp = (FCFIobj_t *)arg1;
2252
2253 switch (fcftab->state) {
4816 emlxs_fcf_event_xlate(evt), arg1,
4817 fcftab->flag);
4818 return (1);
4819 }
4820
4821 fcfp = (FCFIobj_t *)arg1;
4822
4823 switch (fcftab->state) {
2254 case FCFTAB_STATE_SHUTDOWN:
4824 case FCOE_FCFTAB_STATE_SHUTDOWN:
2255 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4825 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2256 "fcftab_fcfi_offline_evt_action:%d. Shutting down.",
4826 "fcoe_fcftab_fcfi_offline_evt_action:%x fcfi:%d. "
4827 "Shutting down.",
4828 fcftab->TID,
2257 fcfp->fcf_index);
2258
4829 fcfp->fcf_index);
4830
2259 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SHUTDOWN,
4831 /* This will trigger final shutdown */
4832 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SHUTDOWN,
2260 FCF_REASON_REENTER, evt, arg1);
2261 break;
2262
4833 FCF_REASON_REENTER, evt, arg1);
4834 break;
4835
2263 case FCFTAB_STATE_FCFI_OFFLINE:
4836 case FCOE_FCFTAB_STATE_FCFI_OFFLINE:
2264 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4837 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2265 "fcftab_fcfi_offline_evt_action:%d. Offlining.",
4838 "fcoe_fcftab_fcfi_offline_evt_action:%x fcfi:%d. "
4839 "Offlining.",
4840 fcftab->TID,
2266 fcfp->fcf_index);
2267
4841 fcfp->fcf_index);
4842
2268 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_OFFLINE,
4843 rval = emlxs_fcoe_fcftab_state(port,
4844 FCOE_FCFTAB_STATE_FCFI_OFFLINE,
2269 FCF_REASON_REENTER, evt, arg1);
2270 break;
2271
4845 FCF_REASON_REENTER, evt, arg1);
4846 break;
4847
2272 case FCFTAB_STATE_FCFI_ONLINE:
4848 case FCOE_FCFTAB_STATE_FCFI_ONLINE:
2273 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4849 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2274 "fcftab_fcfi_offline_evt_action:%d. Attempting failover.",
4850 "fcoe_fcftab_fcfi_offline_evt_action:%x fcfi:%d. "
4851 "Attempting failover.",
4852 fcftab->TID,
2275 fcfp->fcf_index);
2276
2277 fcfp->flag |= EMLXS_FCFI_FAILED;
2278
4853 fcfp->fcf_index);
4854
4855 fcfp->flag |= EMLXS_FCFI_FAILED;
4856
2279 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_ONLINE,
4857 rval = emlxs_fcoe_fcftab_state(port,
4858 FCOE_FCFTAB_STATE_FCFI_ONLINE,
2280 FCF_REASON_REENTER, evt, arg1);
2281 break;
2282
4859 FCF_REASON_REENTER, evt, arg1);
4860 break;
4861
2283 case FCFTAB_STATE_ONLINE:
4862 case FCOE_FCFTAB_STATE_ONLINE:
2284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4863 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2285 "fcftab_fcfi_offline_evt_action:%d.",
4864 "fcoe_fcftab_fcfi_offline_evt_action:%x fcfi:%d.",
4865 fcftab->TID,
2286 fcfp->fcf_index);
2287
4866 fcfp->fcf_index);
4867
2288 rval = emlxs_fcftab_state(port, FCFTAB_STATE_ONLINE,
4868 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_ONLINE,
2289 FCF_REASON_REENTER, evt, arg1);
2290 break;
2291
2292 default:
2293 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4869 FCF_REASON_REENTER, evt, arg1);
4870 break;
4871
4872 default:
4873 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2294 "fcftab_fcfi_offline_evt_action:%d %s. Terminated.",
2295 fcfp->fcf_index,
2296 emlxs_fcftab_state_xlate(fcftab->state));
4874 "fcoe_fcftab_fcfi_offline_evt_action:%x %s fcfi:%d.",
4875 fcftab->TID,
4876 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4877 fcfp->fcf_index);
2297 break;
2298 }
2299
2300 return (rval);
2301
4878 break;
4879 }
4880
4881 return (rval);
4882
2302} /* emlxs_fcftab_fcfi_offline_evt_action() */
4883} /* emlxs_fcoe_fcftab_fcfi_offline_evt_action() */
2303
2304
2305/*ARGSUSED*/
2306static uint32_t
4884
4885
4886/*ARGSUSED*/
4887static uint32_t
2307emlxs_fcftab_fcfi_online_evt_action(emlxs_port_t *port, uint32_t evt,
4888emlxs_fcoe_fcftab_fcfi_online_evt_action(emlxs_port_t *port, uint32_t evt,
2308 void *arg1)
2309{
2310 emlxs_hba_t *hba = HBA;
2311 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2312 uint32_t rval = 0;
2313 FCFIobj_t *fcfp;
2314
2315 if (evt != FCF_EVENT_FCFI_ONLINE) {
2316 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4889 void *arg1)
4890{
4891 emlxs_hba_t *hba = HBA;
4892 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4893 uint32_t rval = 0;
4894 FCFIobj_t *fcfp;
4895
4896 if (evt != FCF_EVENT_FCFI_ONLINE) {
4897 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2317 "fcftab_fcfi_online_evt_action: %s:%s arg=%p flag=%x. "
2318 "Invalid event type. Terminated.",
2319 emlxs_fcftab_state_xlate(fcftab->state),
4898 "fcoe_fcftab_fcfi_online_evt_action:%x %s:%s arg=%p "
4899 "flag=%x. Invalid event type. <",
4900 fcftab->TID,
4901 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2320 emlxs_fcf_event_xlate(evt), arg1,
2321 fcftab->flag);
2322 return (1);
2323 }
2324
2325 fcfp = (FCFIobj_t *)arg1;
2326
2327 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4902 emlxs_fcf_event_xlate(evt), arg1,
4903 fcftab->flag);
4904 return (1);
4905 }
4906
4907 fcfp = (FCFIobj_t *)arg1;
4908
4909 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2328 "fcftab_fcfi_online_evt_action:%d. Terminated.",
4910 "fcoe_fcftab_fcfi_online_evt_action:%x fcfi:%d. <",
4911 fcftab->TID,
2329 fcfp->fcf_index);
2330
2331 return (rval);
2332
4912 fcfp->fcf_index);
4913
4914 return (rval);
4915
2333} /* emlxs_fcftab_fcfi_online_evt_action() */
4916} /* emlxs_fcoe_fcftab_fcfi_online_evt_action() */
2334
2335
2336/*ARGSUSED*/
2337static uint32_t
4917
4918
4919/*ARGSUSED*/
4920static uint32_t
2338emlxs_fcftab_cvl_evt_action(emlxs_port_t *port, uint32_t evt,
4921emlxs_fcoe_fcftab_cvl_evt_action(emlxs_port_t *port, uint32_t evt,
2339 void *arg1)
2340{
2341 emlxs_hba_t *hba = HBA;
2342 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4922 void *arg1)
4923{
4924 emlxs_hba_t *hba = HBA;
4925 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2343 uint32_t rval;
4926 uint32_t rval = 0;
2344 emlxs_port_t *vport;
2345 uint32_t vpi;
2346 VPIobj_t *vpip;
2347
2348 if (evt != FCF_EVENT_CVL) {
2349 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4927 emlxs_port_t *vport;
4928 uint32_t vpi;
4929 VPIobj_t *vpip;
4930
4931 if (evt != FCF_EVENT_CVL) {
4932 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2350 "fcftab_cvl_evt_action: %s:%s arg=%p flag=%x. "
2351 "Invalid event type. Terminated.",
2352 emlxs_fcftab_state_xlate(fcftab->state),
4933 "fcoe_fcftab_cvl_evt_action:%x %s:%s arg=%p flag=%x. "
4934 "Invalid event type. <",
4935 fcftab->TID,
4936 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2353 emlxs_fcf_event_xlate(evt), arg1,
2354 fcftab->flag);
2355 return (1);
2356 }
2357
2358 /* Pause VPI */
4937 emlxs_fcf_event_xlate(evt), arg1,
4938 fcftab->flag);
4939 return (1);
4940 }
4941
4942 /* Pause VPI */
2359 vpi = (uint32_t)((uintptr_t)arg1);
4943 vpi = (uint32_t)((unsigned long)arg1);
2360 vport = &VPORT(vpi);
4944 vport = &VPORT(vpi);
2361 vpip = &vport->VPIobj;
4945 vpip = vport->vpip;
2362
2363 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4946
4947 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2364 "fcftab_cvl_evt_action: %s gen=%x. Pausing VPI:%d.",
2365 emlxs_fcftab_state_xlate(fcftab->state),
4948 "fcoe_fcftab_cvl_evt_action:%x %s gen=%x. Pausing VPI:%d. >",
4949 fcftab->TID,
4950 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2366 fcftab->generation,
2367 vpip->VPI);
2368
2369 rval = emlxs_vpi_event(vport, FCF_EVENT_VPI_PAUSE, vpip);
2370
2371 switch (fcftab->state) {
4951 fcftab->generation,
4952 vpip->VPI);
4953
4954 rval = emlxs_vpi_event(vport, FCF_EVENT_VPI_PAUSE, vpip);
4955
4956 switch (fcftab->state) {
2372 case FCFTAB_STATE_SOLICIT:
4957 case FCOE_FCFTAB_STATE_SOLICIT:
2373 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4958 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2374 "fcftab_cvl_evt_action: %s gen=%x. "
2375 "Already soliciting. Terminated.",
2376 emlxs_fcftab_state_xlate(fcftab->state),
4959 "fcoe_fcftab_cvl_evt_action:%x %s gen=%x. "
4960 "Already soliciting. <",
4961 fcftab->TID,
4962 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2377 fcftab->generation);
2378 break;
2379
2380 default:
2381 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4963 fcftab->generation);
4964 break;
4965
4966 default:
4967 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2382 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
4968 fcftab->flag |= EMLXS_FCOE_FCFTAB_SOL_REQ;
2383 fcftab->generation++;
2384
2385 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4969 fcftab->generation++;
4970
4971 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2386 "fcftab_cvl_evt_action: %s gen=%x. Soliciting.",
2387 emlxs_fcftab_state_xlate(fcftab->state),
4972 "fcoe_fcftab_cvl_evt_action:%x %s gen=%x. Soliciting.",
4973 fcftab->TID,
4974 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2388 fcftab->generation);
2389
4975 fcftab->generation);
4976
2390 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
4977 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
2391 FCF_REASON_EVENT, evt, arg1);
2392 break;
2393 }
2394
2395 return (rval);
2396
4978 FCF_REASON_EVENT, evt, arg1);
4979 break;
4980 }
4981
4982 return (rval);
4983
2397} /* emlxs_fcftab_cvl_evt_action() */
4984} /* emlxs_fcoe_fcftab_cvl_evt_action() */
2398
2399
2400/*ARGSUSED*/
2401static uint32_t
4985
4986
4987/*ARGSUSED*/
4988static uint32_t
2402emlxs_fcftab_linkup_evt_action(emlxs_port_t *port, uint32_t evt,
4989emlxs_fcoe_fcftab_linkup_evt_action(emlxs_port_t *port, uint32_t evt,
2403 void *arg1)
2404{
2405 emlxs_hba_t *hba = HBA;
2406 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2407 uint32_t rval = 0;
4990 void *arg1)
4991{
4992 emlxs_hba_t *hba = HBA;
4993 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4994 uint32_t rval = 0;
2408 emlxs_config_t *cfg = &CFG;
2409
2410 if (evt != FCF_EVENT_LINKUP) {
2411 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4995
4996 if (evt != FCF_EVENT_LINKUP) {
4997 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2412 "fcftab_linkup_evt_action: %s:%s arg=%p flag=%x. "
2413 "Invalid event type. Terminated.",
2414 emlxs_fcftab_state_xlate(fcftab->state),
4998 "fcoe_fcftab_linkup_evt_action:%x %s:%s arg=%p flag=%x. "
4999 "Invalid event type. <",
5000 fcftab->TID,
5001 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2415 emlxs_fcf_event_xlate(evt), arg1,
2416 fcftab->flag);
2417 return (1);
2418 }
2419
2420 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5002 emlxs_fcf_event_xlate(evt), arg1,
5003 fcftab->flag);
5004 return (1);
5005 }
5006
5007 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2421 "fcftab_linkup_evt_action: %s:%s arg=%p gen=%x. Link up.",
2422 emlxs_fcftab_state_xlate(fcftab->state),
5008 "fcoe_fcftab_linkup_evt_action:%x %s:%s arg=%p gen=%x. Link up.",
5009 fcftab->TID,
5010 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2423 emlxs_fcf_event_xlate(evt), arg1,
2424 fcftab->generation);
2425
5011 emlxs_fcf_event_xlate(evt), arg1,
5012 fcftab->generation);
5013
2426 mutex_enter(&EMLXS_PORT_LOCK);
2427 if (hba->state < FC_LINK_UP) {
2428 HBASTATS.LinkUp++;
2429 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_UP);
2430 }
2431 hba->discovery_timer =
2432 hba->timer_tics + cfg[CFG_LINKUP_TIMEOUT].current +
2433 cfg[CFG_DISC_TIMEOUT].current;
2434 mutex_exit(&EMLXS_PORT_LOCK);
5014 emlxs_fcf_linkup(port);
2435
5015
2436 emlxs_log_link_event(port);
2437
2438 switch (fcftab->state) {
5016 switch (fcftab->state) {
2439 case FCFTAB_STATE_SOLICIT:
5017 case FCOE_FCFTAB_STATE_SOLICIT:
2440 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5018 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2441 "fcftab_linkup_evt_action: %s gen=%x. "
2442 "Already soliciting. Terminated.",
2443 emlxs_fcftab_state_xlate(fcftab->state),
5019 "fcoe_fcftab_linkup_evt_action:%x %s gen=%x. "
5020 "Already soliciting. <",
5021 fcftab->TID,
5022 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2444 fcftab->generation);
2445 break;
2446
2447 default:
2448 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
5023 fcftab->generation);
5024 break;
5025
5026 default:
5027 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2449 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
5028 fcftab->flag |= EMLXS_FCOE_FCFTAB_SOL_REQ;
2450 fcftab->generation++;
2451
2452 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5029 fcftab->generation++;
5030
5031 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2453 "fcftab_linkup_evt_action: %s gen=%x. Soliciting.",
2454 emlxs_fcftab_state_xlate(fcftab->state),
5032 "fcoe_fcftab_linkup_evt_action:%x %s gen=%x. Soliciting.",
5033 fcftab->TID,
5034 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2455 fcftab->generation);
2456
5035 fcftab->generation);
5036
2457 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
5037 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
2458 FCF_REASON_EVENT, evt, arg1);
2459 break;
2460 }
2461
2462 return (rval);
2463
5038 FCF_REASON_EVENT, evt, arg1);
5039 break;
5040 }
5041
5042 return (rval);
5043
2464} /* emlxs_fcftab_linkup_evt_action() */
5044} /* emlxs_fcoe_fcftab_linkup_evt_action() */
2465
2466
2467/*ARGSUSED*/
2468static uint32_t
5045
5046
5047/*ARGSUSED*/
5048static uint32_t
2469emlxs_fcftab_linkdown_evt_action(emlxs_port_t *port, uint32_t evt,
5049emlxs_fcoe_fcftab_linkdown_evt_action(emlxs_port_t *port, uint32_t evt,
2470 void *arg1)
2471{
2472 emlxs_hba_t *hba = HBA;
2473 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2474 uint32_t rval = 0;
2475 int32_t i;
2476 FCFIobj_t *fcfp;
2477
2478 if (evt != FCF_EVENT_LINKDOWN) {
2479 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5050 void *arg1)
5051{
5052 emlxs_hba_t *hba = HBA;
5053 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5054 uint32_t rval = 0;
5055 int32_t i;
5056 FCFIobj_t *fcfp;
5057
5058 if (evt != FCF_EVENT_LINKDOWN) {
5059 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2480 "fcftab_linkdown_evt_action: %s:%s arg=%p flag=%x. "
2481 "Invalid event type. Terminated.",
2482 emlxs_fcftab_state_xlate(fcftab->state),
5060 "fcoe_fcftab_linkdown_evt_action:%x %s:%s arg=%p "
5061 "flag=%x. Invalid event type. <",
5062 fcftab->TID,
5063 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2483 emlxs_fcf_event_xlate(evt), arg1,
2484 fcftab->flag);
2485 return (1);
2486 }
2487
2488 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
5064 emlxs_fcf_event_xlate(evt), arg1,
5065 fcftab->flag);
5066 return (1);
5067 }
5068
5069 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2489 fcftab->flag |= EMLXS_FCFTAB_OFFLINE_REQ;
5070 fcftab->flag |= EMLXS_FCOE_FCFTAB_OFFLINE_REQ;
2490
2491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5071
5072 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2492 "fcftab_linkdown_evt_action: %s:%s arg=%p flag=%x. Linkdown.",
2493 emlxs_fcftab_state_xlate(fcftab->state),
5073 "fcoe_fcftab_linkdown_evt_action:%x %s:%s arg=%p flag=%x. "
5074 "Linkdown.",
5075 fcftab->TID,
5076 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2494 emlxs_fcf_event_xlate(evt), arg1,
2495 fcftab->flag);
2496
5077 emlxs_fcf_event_xlate(evt), arg1,
5078 fcftab->flag);
5079
2497 mutex_enter(&EMLXS_PORT_LOCK);
2498 if (hba->state > FC_LINK_DOWN) {
2499 HBASTATS.LinkDown++;
2500 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_DOWN);
2501 }
2502 hba->flag &= FC_LINKDOWN_MASK;
2503 hba->discovery_timer = 0;
2504 mutex_exit(&EMLXS_PORT_LOCK);
5080 emlxs_fcf_linkdown(port);
2505
5081
2506 emlxs_log_link_event(port);
2507
2508 /* Pause all active FCFI's */
2509 for (i = 0; i < fcftab->fcfi_count; i++) {
2510 fcfp = fcftab->fcfi[i];
2511
2512 if ((fcfp->state == FCFI_STATE_OFFLINE) ||
2513 (fcfp->state == FCFI_STATE_PAUSED)) {
2514 break;
2515 }
2516
2517 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5082 /* Pause all active FCFI's */
5083 for (i = 0; i < fcftab->fcfi_count; i++) {
5084 fcfp = fcftab->fcfi[i];
5085
5086 if ((fcfp->state == FCFI_STATE_OFFLINE) ||
5087 (fcfp->state == FCFI_STATE_PAUSED)) {
5088 break;
5089 }
5090
5091 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2518 "fcftab_linkdown_evt_action: Pausing FCFI:%d.",
5092 "fcoe_fcftab_linkdown_evt_action:%x Pausing FCFI:%d. >",
5093 fcftab->TID,
2519 fcfp->fcf_index);
2520
2521 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_PAUSE, fcfp);
2522 }
2523
2524 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5094 fcfp->fcf_index);
5095
5096 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_PAUSE, fcfp);
5097 }
5098
5099 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2525 "fcftab_linkdown_evt_action: Going offline.");
5100 "fcoe_fcftab_linkdown_evt_action:%x "
5101 "Going offline.",
5102 fcftab->TID);
2526
2527 switch (fcftab->state) {
5103
5104 switch (fcftab->state) {
2528 case FCFTAB_STATE_OFFLINE:
2529 rval = emlxs_fcftab_state(port, FCFTAB_STATE_OFFLINE,
5105 case FCOE_FCFTAB_STATE_OFFLINE:
5106 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_OFFLINE,
2530 FCF_REASON_REENTER, evt, arg1);
2531 break;
2532
2533 default:
5107 FCF_REASON_REENTER, evt, arg1);
5108 break;
5109
5110 default:
2534 rval = emlxs_fcftab_state(port, FCFTAB_STATE_OFFLINE,
5111 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_OFFLINE,
2535 FCF_REASON_EVENT, evt, arg1);
2536 break;
2537 }
2538
2539 return (rval);
2540
5112 FCF_REASON_EVENT, evt, arg1);
5113 break;
5114 }
5115
5116 return (rval);
5117
2541} /* emlxs_fcftab_linkdown_evt_action() */
5118} /* emlxs_fcoe_fcftab_linkdown_evt_action() */
2542
2543
2544/*ARGSUSED*/
2545static uint32_t
5119
5120
5121/*ARGSUSED*/
5122static uint32_t
2546emlxs_fcftab_shutdown_evt_action(emlxs_port_t *port, uint32_t evt,
5123emlxs_fcoe_fcftab_shutdown_evt_action(emlxs_port_t *port, uint32_t evt,
2547 void *arg1)
2548{
2549 emlxs_hba_t *hba = HBA;
2550 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2551 uint32_t rval = 0;
2552
2553 if (evt != FCF_EVENT_SHUTDOWN) {
2554 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5124 void *arg1)
5125{
5126 emlxs_hba_t *hba = HBA;
5127 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5128 uint32_t rval = 0;
5129
5130 if (evt != FCF_EVENT_SHUTDOWN) {
5131 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2555 "fcftab_shutdown_evt_action: %s:%s arg=%p flag=%x. "
2556 "Invalid event type. Terminated.",
2557 emlxs_fcftab_state_xlate(fcftab->state),
5132 "fcoe_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
5133 "Invalid event type. <",
5134 fcftab->TID,
5135 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2558 emlxs_fcf_event_xlate(evt), arg1,
2559 fcftab->flag);
2560 return (1);
2561 }
2562
2563 if (fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) {
2564 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5136 emlxs_fcf_event_xlate(evt), arg1,
5137 fcftab->flag);
5138 return (1);
5139 }
5140
5141 if (fcftab->flag & EMLXS_FCFTAB_SHUTDOWN) {
5142 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2565 "fcftab_shutdown_evt_action: %s:%s arg=%p flag=%x. "
2566 "Already shut down. Terminated.",
2567 emlxs_fcftab_state_xlate(fcftab->state),
5143 "fcoe_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
5144 "Already shut down. <",
5145 fcftab->TID,
5146 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2568 emlxs_fcf_event_xlate(evt), arg1,
2569 fcftab->flag);
2570 return (1);
2571 }
2572
5147 emlxs_fcf_event_xlate(evt), arg1,
5148 fcftab->flag);
5149 return (1);
5150 }
5151
2573 if (fcftab->state == FCFTAB_STATE_SHUTDOWN) {
5152 if (fcftab->state == FCOE_FCFTAB_STATE_SHUTDOWN) {
2574 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5153 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2575 "fcftab_shutdown_evt_action: %s:%s arg=%p flag=%x. "
2576 "Already shutting down. Terminated.",
2577 emlxs_fcftab_state_xlate(fcftab->state),
5154 "fcoe_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
5155 "Already shutting down. <",
5156 fcftab->TID,
5157 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2578 emlxs_fcf_event_xlate(evt), arg1,
2579 fcftab->flag);
2580 return (1);
2581 }
2582
2583 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5158 emlxs_fcf_event_xlate(evt), arg1,
5159 fcftab->flag);
5160 return (1);
5161 }
5162
5163 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2584 "fcftab_shutdown_evt_action: %s:%s arg=%p flag=%x. "
5164 "fcoe_fcftab_shutdown_evt_action:%x %s:%s arg=%p flag=%x. "
2585 "Shutting down.",
5165 "Shutting down.",
2586 emlxs_fcftab_state_xlate(fcftab->state),
5166 fcftab->TID,
5167 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2587 emlxs_fcf_event_xlate(evt), arg1,
2588 fcftab->flag);
2589
5168 emlxs_fcf_event_xlate(evt), arg1,
5169 fcftab->flag);
5170
2590 if (hba->state > FC_LINK_DOWN) {
2591 mutex_enter(&EMLXS_PORT_LOCK);
2592 if (hba->state > FC_LINK_DOWN) {
2593 HBASTATS.LinkDown++;
2594 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_DOWN);
2595 }
2596 hba->flag &= FC_LINKDOWN_MASK;
2597 hba->discovery_timer = 0;
2598 mutex_exit(&EMLXS_PORT_LOCK);
5171 emlxs_fcf_linkdown(port);
2599
5172
2600 emlxs_log_link_event(port);
2601 }
2602
2603 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SHUTDOWN,
5173 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SHUTDOWN,
2604 FCF_REASON_EVENT, evt, arg1);
2605
2606 return (rval);
2607
5174 FCF_REASON_EVENT, evt, arg1);
5175
5176 return (rval);
5177
2608} /* emlxs_fcftab_shutdown_evt_action() */
5178} /* emlxs_fcoe_fcftab_shutdown_evt_action() */
2609
2610
2611static uint32_t
5179
5180
5181static uint32_t
2612emlxs_fcftab_req_handler(emlxs_port_t *port, void *arg1)
5182emlxs_fcoe_fcftab_req_handler(emlxs_port_t *port, void *arg1)
2613{
2614 emlxs_hba_t *hba = HBA;
2615 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2616 uint32_t rval = 0;
2617
2618 if (!(fcftab->flag & EMLXS_FCFTAB_REQ_MASK)) {
2619 return (1);
2620 }
2621
5183{
5184 emlxs_hba_t *hba = HBA;
5185 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5186 uint32_t rval = 0;
5187
5188 if (!(fcftab->flag & EMLXS_FCFTAB_REQ_MASK)) {
5189 return (1);
5190 }
5191
2622 if (fcftab->flag & EMLXS_FCFTAB_OFFLINE_REQ) {
2623 rval = emlxs_fcftab_state(port, FCFTAB_STATE_OFFLINE,
5192 if (fcftab->flag & EMLXS_FCOE_FCFTAB_OFFLINE_REQ) {
5193 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_OFFLINE,
2624 FCF_REASON_REQUESTED, 0, arg1);
2625 }
2626
5194 FCF_REASON_REQUESTED, 0, arg1);
5195 }
5196
2627 else if (fcftab->flag & EMLXS_FCFTAB_SOL_REQ) {
2628 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
5197 else if (fcftab->flag & EMLXS_FCOE_FCFTAB_SOL_REQ) {
5198 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
2629 FCF_REASON_REQUESTED, 0, arg1);
2630 }
2631
5199 FCF_REASON_REQUESTED, 0, arg1);
5200 }
5201
2632 else if (fcftab->flag & EMLXS_FCFTAB_READ_REQ) {
2633 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ,
5202 else if (fcftab->flag & EMLXS_FCOE_FCFTAB_READ_REQ) {
5203 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_READ,
2634 FCF_REASON_REQUESTED, 0, FCFTAB_READ_ALL);
2635 }
2636
2637 return (rval);
2638
5204 FCF_REASON_REQUESTED, 0, FCFTAB_READ_ALL);
5205 }
5206
5207 return (rval);
5208
2639} /* emlxs_fcftab_req_handler() */
5209} /* emlxs_fcoe_fcftab_req_handler() */
2640
2641
2642static void
5210
5211
5212static void
2643emlxs_fcftab_read_timer(emlxs_hba_t *hba)
5213emlxs_fcoe_fcftab_read_timer(emlxs_hba_t *hba)
2644{
2645 emlxs_port_t *port = &PPORT;
2646 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2647
2648 /* Check FCF timer */
2649 if (!fcftab->read_timer ||
5214{
5215 emlxs_port_t *port = &PPORT;
5216 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5217
5218 /* Check FCF timer */
5219 if (!fcftab->read_timer ||
2650 (hba->timer_tics <= fcftab->read_timer)) {
5220 (hba->timer_tics < fcftab->read_timer)) {
2651 return;
2652 }
2653 fcftab->read_timer = 0;
5221 return;
5222 }
5223 fcftab->read_timer = 0;
2654 fcftab->flag |= EMLXS_FCFTAB_READ_REQ;
5224 fcftab->flag |= EMLXS_FCOE_FCFTAB_READ_REQ;
2655
2656 switch (fcftab->state) {
5225
5226 switch (fcftab->state) {
2657 case FCFTAB_STATE_SOLICIT_CMPL:
5227 case FCOE_FCFTAB_STATE_SOLICIT_CMPL:
2658 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5228 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2659 "fcftab_timer: %s",
2660 emlxs_fcftab_state_xlate(fcftab->state));
5229 "fcoe_fcftab_timer:%x %s >",
5230 fcftab->TID,
5231 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
2661
5232
2662 (void) emlxs_fcftab_state(port, FCFTAB_STATE_READ, 0, 0,
2663 FCFTAB_READ_ALL);
5233 (void) emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_READ,
5234 0, 0, FCFTAB_READ_ALL);
2664 break;
2665
2666 default:
2667 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5235 break;
5236
5237 default:
5238 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2668 "fcftab_timer: %s Terminated.",
2669 emlxs_fcftab_state_xlate(fcftab->state));
5239 "fcoe_fcftab_timer:%x %s",
5240 fcftab->TID,
5241 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
2670 break;
2671 }
2672
2673 return;
2674
5242 break;
5243 }
5244
5245 return;
5246
2675} /* emlxs_fcftab_read_timer() */
5247} /* emlxs_fcoe_fcftab_read_timer() */
2676
2677
2678static void
5248
5249
5250static void
2679emlxs_fcftab_sol_timer(emlxs_hba_t *hba)
5251emlxs_fcoe_fcftab_sol_timer(emlxs_hba_t *hba)
2680{
2681 emlxs_port_t *port = &PPORT;
2682 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2683
2684 /* Check FCF timer */
2685 if (!fcftab->sol_timer ||
5252{
5253 emlxs_port_t *port = &PPORT;
5254 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5255
5256 /* Check FCF timer */
5257 if (!fcftab->sol_timer ||
2686 (hba->timer_tics <= fcftab->sol_timer)) {
5258 (hba->timer_tics < fcftab->sol_timer)) {
2687 return;
2688 }
2689 fcftab->sol_timer = 0;
2690
2691 switch (fcftab->state) {
5259 return;
5260 }
5261 fcftab->sol_timer = 0;
5262
5263 switch (fcftab->state) {
2692 case FCFTAB_STATE_ONLINE:
5264 case FCOE_FCFTAB_STATE_ONLINE:
2693 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
5265 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
2694 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
5266 fcftab->flag |= EMLXS_FCOE_FCFTAB_SOL_REQ;
2695 fcftab->generation++;
2696
2697 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5267 fcftab->generation++;
5268
5269 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2698 "fcftab_sol_timer: %s gen=%x. Soliciting.",
2699 emlxs_fcftab_state_xlate(fcftab->state),
5270 "fcoe_fcftab_sol_timer:%x %s gen=%x. Soliciting. >",
5271 fcftab->TID,
5272 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2700 fcftab->generation);
2701
5273 fcftab->generation);
5274
2702 (void) emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
5275 (void) emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
2703 FCF_REASON_EVENT, 0, 0);
2704 break;
2705
2706 default:
2707 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5276 FCF_REASON_EVENT, 0, 0);
5277 break;
5278
5279 default:
5280 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2708 "fcftab_sol_timer: %s Terminated.",
2709 emlxs_fcftab_state_xlate(fcftab->state));
5281 "fcoe_fcftab_sol_timer:%x %s",
5282 fcftab->TID,
5283 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
2710 break;
2711 }
2712
2713 return;
2714
5284 break;
5285 }
5286
5287 return;
5288
2715} /* emlxs_fcftab_sol_timer() */
5289} /* emlxs_fcoe_fcftab_sol_timer() */
2716
2717
2718static void
5290
5291
5292static void
2719emlxs_fcftab_offline_timer(emlxs_hba_t *hba)
5293emlxs_fcoe_fcftab_offline_timer(emlxs_hba_t *hba)
2720{
2721 emlxs_port_t *port = &PPORT;
2722 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2723 uint32_t i;
2724 FCFIobj_t *fcfp;
2725
2726 for (i = 0; i < fcftab->fcfi_count; i++) {
2727 fcfp = fcftab->fcfi[i];
2728
2729 /* Check offline timer */
2730 if (!fcfp->offline_timer ||
5294{
5295 emlxs_port_t *port = &PPORT;
5296 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5297 uint32_t i;
5298 FCFIobj_t *fcfp;
5299
5300 for (i = 0; i < fcftab->fcfi_count; i++) {
5301 fcfp = fcftab->fcfi[i];
5302
5303 /* Check offline timer */
5304 if (!fcfp->offline_timer ||
2731 (hba->timer_tics <= fcfp->offline_timer)) {
5305 (hba->timer_tics < fcfp->offline_timer)) {
2732 continue;
2733 }
2734 fcfp->offline_timer = 0;
2735
2736 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5306 continue;
5307 }
5308 fcfp->offline_timer = 0;
5309
5310 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2737 "fcftab_offline_timer:%d %s. Offlining.",
2738 fcfp->fcf_index,
2739 emlxs_fcfi_state_xlate(fcfp->state));
5311 "fcoe_fcftab_offline_timer:%x. Offlining FCFI:%d. >",
5312 fcftab->TID,
5313 fcfp->fcf_index);
2740
2741 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_OFFLINE, fcfp);
2742 }
2743
2744 return;
2745
5314
5315 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_OFFLINE, fcfp);
5316 }
5317
5318 return;
5319
2746} /* emlxs_fcftab_offline_timer() */
5320} /* emlxs_fcoe_fcftab_offline_timer() */
2747
2748
2749/*ARGSUSED*/
2750static uint32_t
5321
5322
5323/*ARGSUSED*/
5324static uint32_t
2751emlxs_fcftab_sol_failed_action(emlxs_port_t *port, uint32_t evt,
5325emlxs_fcoe_fcftab_sol_failed_action(emlxs_port_t *port, uint32_t evt,
2752 void *arg1)
2753{
2754 emlxs_hba_t *hba = HBA;
2755 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5326 void *arg1)
5327{
5328 emlxs_hba_t *hba = HBA;
5329 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2756 uint32_t rval;
5330 uint32_t rval = 0;
2757
2758 fcftab->attempts++;
2759
5331
5332 fcftab->attempts++;
5333
2760 if (fcftab->state != FCFTAB_STATE_SOLICIT_FAILED) {
5334 if (fcftab->state != FCOE_FCFTAB_STATE_SOLICIT_FAILED) {
2761 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5335 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2762 "fcftab_sol_failed_action: %s:%s arg=%p attempt=%d. "
2763 "Invalid state. Terminated.",
2764 emlxs_fcftab_state_xlate(fcftab->state),
5336 "fcoe_fcftab_sol_failed_action:%x %s:%s arg=%p "
5337 "attempt=%d. Invalid state. <",
5338 fcftab->TID,
5339 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2765 emlxs_fcf_event_xlate(evt),
2766 arg1, fcftab->attempts);
2767 return (1);
2768 }
2769
5340 emlxs_fcf_event_xlate(evt),
5341 arg1, fcftab->attempts);
5342 return (1);
5343 }
5344
2770 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2771 "fcftab_sol_failed_action: %s:%s arg=%p attempt=%d reason=%x",
2772 emlxs_fcftab_state_xlate(fcftab->state),
2773 emlxs_fcf_event_xlate(evt), arg1,
2774 fcftab->attempts,
2775 fcftab->reason);
2776
2777 if ((fcftab->reason == FCF_REASON_SEND_FAILED) ||
5345 if ((fcftab->reason == FCF_REASON_MBOX_FAILED) ||
5346 (fcftab->reason == FCF_REASON_SEND_FAILED) ||
2778 (fcftab->attempts >= 3)) {
5347 (fcftab->attempts >= 3)) {
2779 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT_CMPL,
5348 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5349 "fcoe_fcftab_sol_failed_action:%x %s:%s arg=%p "
5350 "attempt=%d reason=%x. Giving up.",
5351 fcftab->TID,
5352 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
5353 emlxs_fcf_event_xlate(evt), arg1,
5354 fcftab->attempts,
5355 fcftab->reason);
5356
5357 rval = emlxs_fcoe_fcftab_state(port,
5358 FCOE_FCFTAB_STATE_SOLICIT_CMPL,
2780 FCF_REASON_OP_FAILED, 0, arg1);
2781 } else {
5359 FCF_REASON_OP_FAILED, 0, arg1);
5360 } else {
2782 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
5361 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5362 "fcoe_fcftab_sol_failed_action:%x %s:%s arg=%p "
5363 "attempt=%d reason=%x. Retrying.",
5364 fcftab->TID,
5365 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
5366 emlxs_fcf_event_xlate(evt), arg1,
5367 fcftab->attempts,
5368 fcftab->reason);
5369
5370 rval = emlxs_fcoe_fcftab_state(port,
5371 FCOE_FCFTAB_STATE_SOLICIT,
2783 FCF_REASON_OP_FAILED, 0, arg1);
2784 }
2785
2786 return (rval);
2787
5372 FCF_REASON_OP_FAILED, 0, arg1);
5373 }
5374
5375 return (rval);
5376
2788} /* emlxs_fcftab_sol_failed_action() */
5377} /* emlxs_fcoe_fcftab_sol_failed_action() */
2789
2790
2791/*ARGSUSED*/
2792static uint32_t
5378
5379
5380/*ARGSUSED*/
5381static uint32_t
2793emlxs_fcftab_sol_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
5382emlxs_fcoe_fcftab_sol_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
2794{
2795 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
2796 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2797 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
5383{
5384 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
5385 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5386 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
2798 uint32_t generation;
5387 uint16_t TID;
2799 mbox_rsp_hdr_t *hdr_rsp;
2800 MATCHMAP *mp;
2801 uint32_t status = MGMT_STATUS_FCF_IN_USE;
2802 uint32_t xstatus = 0;
2803 uint32_t fip_mode = 1;
2804
2805 mutex_enter(&EMLXS_FCF_LOCK);
5388 mbox_rsp_hdr_t *hdr_rsp;
5389 MATCHMAP *mp;
5390 uint32_t status = MGMT_STATUS_FCF_IN_USE;
5391 uint32_t xstatus = 0;
5392 uint32_t fip_mode = 1;
5393
5394 mutex_enter(&EMLXS_FCF_LOCK);
5395 TID = (uint16_t)((unsigned long)mbq->context);
2806
2807 if (mbq->nonembed) {
2808 fip_mode = 0;
2809
2810 mp = (MATCHMAP *)mbq->nonembed;
2811 mbq->nonembed = NULL;
2812
2813 hdr_rsp = (mbox_rsp_hdr_t *)mp->virt;
2814 status = hdr_rsp->status;
2815 xstatus = hdr_rsp->extra_status;
2816
2817 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
2818 }
2819
5396
5397 if (mbq->nonembed) {
5398 fip_mode = 0;
5399
5400 mp = (MATCHMAP *)mbq->nonembed;
5401 mbq->nonembed = NULL;
5402
5403 hdr_rsp = (mbox_rsp_hdr_t *)mp->virt;
5404 status = hdr_rsp->status;
5405 xstatus = hdr_rsp->extra_status;
5406
5407 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
5408 }
5409
2820 if (fcftab->state != FCFTAB_STATE_SOLICIT) {
5410 if (fcftab->state != FCOE_FCFTAB_STATE_SOLICIT) {
2821 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5411 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2822 "fcftab_sol_mbcmpl: %s. Terminated.",
2823 emlxs_fcftab_state_xlate(fcftab->state));
5412 "fcoe_fcftab_sol_mbcmpl:%x %s.",
5413 TID,
5414 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
2824
2825 mutex_exit(&EMLXS_FCF_LOCK);
2826 return (0);
2827 }
2828
5415
5416 mutex_exit(&EMLXS_FCF_LOCK);
5417 return (0);
5418 }
5419
2829 generation = (uint32_t)((uintptr_t)mbq->context);
2830 if (generation != fcftab->generation) {
5420 if (TID != fcftab->generation) {
2831 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5421 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2832 "fcftab_sol_mbcmpl: %s gen=%x,%x. "
2833 "Incorrect generation. Terminated.",
2834 emlxs_fcftab_state_xlate(fcftab->state),
2835 generation, fcftab->generation);
5422 "fcoe_fcftab_sol_mbcmpl:%x %s. "
5423 "Incorrect generation %x. Dropping.",
5424 TID,
5425 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
5426 fcftab->generation);
2836
2837 mutex_exit(&EMLXS_FCF_LOCK);
2838 return (0);
2839 }
2840
2841 if (mb4->mbxStatus) {
2842 if (fip_mode) {
2843 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5427
5428 mutex_exit(&EMLXS_FCF_LOCK);
5429 return (0);
5430 }
5431
5432 if (mb4->mbxStatus) {
5433 if (fip_mode) {
5434 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2844 "fcftab_sol_mbcmpl:failed. status=%x",
2845 mb4->mbxStatus);
5435 "fcoe_fcftab_sol_mbcmpl:%x failed. %s. >",
5436 fcftab->TID,
5437 emlxs_mb_xlate_status(mb4->mbxStatus));
2846
5438
2847 (void) emlxs_fcftab_state(port,
2848 FCFTAB_STATE_SOLICIT_FAILED,
5439 (void) emlxs_fcoe_fcftab_state(port,
5440 FCOE_FCFTAB_STATE_SOLICIT_FAILED,
2849 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
2850
2851 mutex_exit(&EMLXS_FCF_LOCK);
2852 return (0);
2853
2854 } else if ((status == 0)||(status != MGMT_STATUS_FCF_IN_USE)) {
2855 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5441 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
5442
5443 mutex_exit(&EMLXS_FCF_LOCK);
5444 return (0);
5445
5446 } else if ((status == 0)||(status != MGMT_STATUS_FCF_IN_USE)) {
5447 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2856 "fcftab_sol_mbcmpl:failed. status=%x,%x,%x",
2857 mb4->mbxStatus, status,
2858 xstatus);
5448 "fcoe_fcftab_sol_mbcmpl:%x failed. %s %x,%x. >",
5449 fcftab->TID,
5450 emlxs_mb_xlate_status(mb4->mbxStatus),
5451 status, xstatus);
2859
5452
2860 (void) emlxs_fcftab_state(port,
2861 FCFTAB_STATE_SOLICIT_FAILED,
5453 (void) emlxs_fcoe_fcftab_state(port,
5454 FCOE_FCFTAB_STATE_SOLICIT_FAILED,
2862 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
2863
2864 mutex_exit(&EMLXS_FCF_LOCK);
2865 return (0);
2866 }
2867 }
2868
2869 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5455 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
5456
5457 mutex_exit(&EMLXS_FCF_LOCK);
5458 return (0);
5459 }
5460 }
5461
5462 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2870 "fcftab_sol_mbcmpl: %s gen=%x",
2871 emlxs_fcftab_state_xlate(fcftab->state),
5463 "fcoe_fcftab_sol_mbcmpl:%x %s gen=%x. Solicit complete. >",
5464 fcftab->TID,
5465 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2872 fcftab->generation);
2873
5466 fcftab->generation);
5467
2874 (void) emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT_CMPL,
5468 (void) emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT_CMPL,
2875 0, 0, 0);
2876
2877 mutex_exit(&EMLXS_FCF_LOCK);
2878 return (0);
2879
5469 0, 0, 0);
5470
5471 mutex_exit(&EMLXS_FCF_LOCK);
5472 return (0);
5473
2880} /* emlxs_fcftab_sol_mbcmpl() */
5474} /* emlxs_fcoe_fcftab_sol_mbcmpl() */
2881
2882
2883/*ARGSUSED*/
2884static uint32_t
5475
5476
5477/*ARGSUSED*/
5478static uint32_t
2885emlxs_fcftab_sol_action(emlxs_port_t *port, uint32_t evt,
5479emlxs_fcoe_fcftab_sol_action(emlxs_port_t *port, uint32_t evt,
2886 void *arg1)
2887{
2888 emlxs_hba_t *hba = HBA;
2889 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
2890 MAILBOXQ *mbq;
2891 MAILBOX4 *mb4;
2892 MATCHMAP *mp = NULL;
5480 void *arg1)
5481{
5482 emlxs_hba_t *hba = HBA;
5483 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5484 MAILBOXQ *mbq;
5485 MAILBOX4 *mb4;
5486 MATCHMAP *mp = NULL;
2893 uint32_t rval;
5487 uint32_t rval = 0;
2894
5488
2895 if (fcftab->state != FCFTAB_STATE_SOLICIT) {
5489 if (fcftab->state != FCOE_FCFTAB_STATE_SOLICIT) {
2896 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5490 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
2897 "fcftab_sol_action: %s:%s arg=%p. "
2898 "Invalid state. Terminated.",
2899 emlxs_fcftab_state_xlate(fcftab->state),
5491 "fcoe_fcftab_sol_action:%x %s:%s arg=%p. "
5492 "Invalid state. <",
5493 fcftab->TID,
5494 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2900 emlxs_fcf_event_xlate(evt), arg1);
2901 return (1);
2902 }
2903
5495 emlxs_fcf_event_xlate(evt), arg1);
5496 return (1);
5497 }
5498
2904 if ((fcftab->prev_state != FCFTAB_STATE_SOLICIT_FAILED) ||
2905 (fcftab->flag & EMLXS_FCFTAB_SOL_REQ)) {
2906 fcftab->flag &= ~EMLXS_FCFTAB_SOL_REQ;
5499 if ((fcftab->prev_state != FCOE_FCFTAB_STATE_SOLICIT_FAILED) ||
5500 (fcftab->flag & EMLXS_FCOE_FCFTAB_SOL_REQ)) {
5501 fcftab->flag &= ~EMLXS_FCOE_FCFTAB_SOL_REQ;
2907 fcftab->attempts = 0;
2908 }
2909
2910 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
2911 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5502 fcftab->attempts = 0;
5503 }
5504
5505 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
5506 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2912 "fcftab_sol_action: %s:%s arg=%p gen=%d flag=%x. "
5507 "fcoe_fcftab_sol_action:%x %s:%s arg=%p gen=%d flag=%x. "
2913 "Handling request.",
5508 "Handling request.",
2914 emlxs_fcftab_state_xlate(fcftab->state),
5509 fcftab->TID,
5510 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2915 emlxs_fcf_event_xlate(evt), arg1,
2916 fcftab->generation,
2917 fcftab->flag);
2918
5511 emlxs_fcf_event_xlate(evt), arg1,
5512 fcftab->generation,
5513 fcftab->flag);
5514
2919 rval = emlxs_fcftab_req_handler(port, arg1);
5515 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
2920 return (rval);
2921 }
2922
5516 return (rval);
5517 }
5518
5519 if (fcftab->attempts == 0) {
5520 fcftab->TID = fcftab->generation;
5521 }
5522
2923 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5523 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
2924 "fcftab_sol_action: %s:%s arg = %p gen=%x fip=%x. "
2925 "Requesting solicit.",
2926 emlxs_fcftab_state_xlate(fcftab->state),
5524 "fcoe_fcftab_sol_action:%x %s:%s arg=%p gen=%x fip=%x. "
5525 "Requesting solicit. <",
5526 fcftab->TID,
5527 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
2927 emlxs_fcf_event_xlate(evt), arg1,
2928 fcftab->generation,
2929 ((hba->flag & FC_FIP_SUPPORTED)? 1:0));
2930
5528 emlxs_fcf_event_xlate(evt), arg1,
5529 fcftab->generation,
5530 ((hba->flag & FC_FIP_SUPPORTED)? 1:0));
5531
2931 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
2932 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT_FAILED,
5532 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
5533 rval = emlxs_fcoe_fcftab_state(port,
5534 FCOE_FCFTAB_STATE_SOLICIT_FAILED,
2933 FCF_REASON_NO_MBOX, 0, 0);
2934 return (rval);
2935 }
2936
2937 mb4 = (MAILBOX4*)mbq;
2938 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
2939
2940 if (hba->flag & FC_FIP_SUPPORTED) {
2941 IOCTL_FCOE_REDISCOVER_FCF_TABLE *fcf;
2942
2943 mbq->nonembed = NULL;
5535 FCF_REASON_NO_MBOX, 0, 0);
5536 return (rval);
5537 }
5538
5539 mb4 = (MAILBOX4*)mbq;
5540 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
5541
5542 if (hba->flag & FC_FIP_SUPPORTED) {
5543 IOCTL_FCOE_REDISCOVER_FCF_TABLE *fcf;
5544
5545 mbq->nonembed = NULL;
2944 mbq->mbox_cmpl = emlxs_fcftab_sol_mbcmpl;
2945 mbq->context = (void *)((uintptr_t)fcftab->generation);
5546 mbq->mbox_cmpl = emlxs_fcoe_fcftab_sol_mbcmpl;
5547 mbq->context = (void *)((unsigned long)fcftab->TID);
2946 mbq->port = (void *)port;
2947
2948 mb4->un.varSLIConfig.be.embedded = 1;
2949 mb4->mbxCommand = MBX_SLI_CONFIG;
2950 mb4->mbxOwner = OWN_HOST;
2951 mb4->un.varSLIConfig.be.payload_length =
2952 sizeof (IOCTL_FCOE_REDISCOVER_FCF_TABLE) +
2953 IOCTL_HEADER_SZ;

--- 15 unchanged lines hidden (view full) ---

2969 /* we must add to the table */
2970
2971 IOCTL_FCOE_ADD_FCF_TABLE *fcf;
2972 mbox_req_hdr_t *hdr_req;
2973 FCF_RECORD_t *fcf_rec;
2974 uint8_t bitmap[512];
2975 uint16_t i;
2976
5548 mbq->port = (void *)port;
5549
5550 mb4->un.varSLIConfig.be.embedded = 1;
5551 mb4->mbxCommand = MBX_SLI_CONFIG;
5552 mb4->mbxOwner = OWN_HOST;
5553 mb4->un.varSLIConfig.be.payload_length =
5554 sizeof (IOCTL_FCOE_REDISCOVER_FCF_TABLE) +
5555 IOCTL_HEADER_SZ;

--- 15 unchanged lines hidden (view full) ---

5571 /* we must add to the table */
5572
5573 IOCTL_FCOE_ADD_FCF_TABLE *fcf;
5574 mbox_req_hdr_t *hdr_req;
5575 FCF_RECORD_t *fcf_rec;
5576 uint8_t bitmap[512];
5577 uint16_t i;
5578
2977 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
5579 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
2978 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
2979
5580 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
5581
2980 rval = emlxs_fcftab_state(port,
2981 FCFTAB_STATE_SOLICIT_FAILED,
5582 rval = emlxs_fcoe_fcftab_state(port,
5583 FCOE_FCFTAB_STATE_SOLICIT_FAILED,
2982 FCF_REASON_NO_BUFFER, 0, arg1);
2983 return (rval);
2984 }
2985 bzero(mp->virt, mp->size);
2986
2987 mbq->nonembed = (void *)mp;
5584 FCF_REASON_NO_BUFFER, 0, arg1);
5585 return (rval);
5586 }
5587 bzero(mp->virt, mp->size);
5588
5589 mbq->nonembed = (void *)mp;
2988 mbq->mbox_cmpl = emlxs_fcftab_sol_mbcmpl;
2989 mbq->context = (void *)((uintptr_t)fcftab->generation);
5590 mbq->mbox_cmpl = emlxs_fcoe_fcftab_sol_mbcmpl;
5591 mbq->context = (void *)((unsigned long)fcftab->generation);
2990 mbq->port = (void *)port;
2991
2992 mb4->un.varSLIConfig.be.embedded = 0;
2993 mb4->mbxCommand = MBX_SLI_CONFIG;
2994 mb4->mbxOwner = OWN_HOST;
2995
2996 hdr_req = (mbox_req_hdr_t *)mp->virt;
2997 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;

--- 49 unchanged lines hidden (view full) ---

3047
3048 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
3049 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
3050 if (mp) {
3051 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
3052 }
3053 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3054
5592 mbq->port = (void *)port;
5593
5594 mb4->un.varSLIConfig.be.embedded = 0;
5595 mb4->mbxCommand = MBX_SLI_CONFIG;
5596 mb4->mbxOwner = OWN_HOST;
5597
5598 hdr_req = (mbox_req_hdr_t *)mp->virt;
5599 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;

--- 49 unchanged lines hidden (view full) ---

5649
5650 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
5651 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
5652 if (mp) {
5653 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
5654 }
5655 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
5656
3055 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT_FAILED,
5657 rval = emlxs_fcoe_fcftab_state(port,
5658 FCOE_FCFTAB_STATE_SOLICIT_FAILED,
3056 FCF_REASON_SEND_FAILED, rval, 0);
3057
3058 return (rval);
3059 }
3060
3061 return (0);
3062
5659 FCF_REASON_SEND_FAILED, rval, 0);
5660
5661 return (rval);
5662 }
5663
5664 return (0);
5665
5666} /* emlxs_fcoe_fcftab_sol_action() */
3063
5667
3064} /* emlxs_fcftab_sol_action() */
3065
5668
3066
3067/*ARGSUSED*/
3068static uint32_t
5669/*ARGSUSED*/
5670static uint32_t
3069emlxs_fcftab_sol_cmpl_action(emlxs_port_t *port, uint32_t evt,
5671emlxs_fcoe_fcftab_sol_cmpl_action(emlxs_port_t *port, uint32_t evt,
3070 void *arg1)
3071{
3072 emlxs_hba_t *hba = HBA;
3073 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5672 void *arg1)
5673{
5674 emlxs_hba_t *hba = HBA;
5675 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3074 uint32_t rval;
5676 uint32_t rval = 0;
3075 emlxs_config_t *cfg = &CFG;
3076
5677 emlxs_config_t *cfg = &CFG;
5678
3077 if (fcftab->state != FCFTAB_STATE_SOLICIT_CMPL) {
5679 if (fcftab->state != FCOE_FCFTAB_STATE_SOLICIT_CMPL) {
3078 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5680 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3079 "fcftab_sol_cmpl_action: %s:%s arg=%p "
3080 "Invalid state. Terminated.",
3081 emlxs_fcftab_state_xlate(fcftab->state),
5681 "fcoe_fcftab_sol_cmpl_action:%x %s:%s arg=%p "
5682 "Invalid state. <",
5683 fcftab->TID,
5684 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3082 emlxs_fcf_event_xlate(evt), arg1);
3083 return (1);
3084 }
3085
5685 emlxs_fcf_event_xlate(evt), arg1);
5686 return (1);
5687 }
5688
3086 /* Increment the generation counter */
3087 fcftab->generation++;
3088
3089 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3090 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5689 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
5690 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3091 "fcftab_sol_cmpl_action: %s:%s arg=%p gen=%d flag=%x. "
3092 "Handling request.",
3093 emlxs_fcftab_state_xlate(fcftab->state),
5691 "fcoe_fcftab_sol_cmpl_action:%x %s:%s arg=%p gen=%d "
5692 "flag=%x. Handling request.",
5693 fcftab->TID,
5694 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3094 emlxs_fcf_event_xlate(evt), arg1,
3095 fcftab->generation,
3096 fcftab->flag);
3097
5695 emlxs_fcf_event_xlate(evt), arg1,
5696 fcftab->generation,
5697 fcftab->flag);
5698
3098 rval = emlxs_fcftab_req_handler(port, arg1);
5699 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
3099 return (rval);
3100 }
3101
3102 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5700 return (rval);
5701 }
5702
5703 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3103 "fcftab_sol_cmpl_action: %s:%s arg=%p gen=%d. "
5704 "fcoe_fcftab_sol_cmpl_action:%x %s:%s arg=%p gen=%d. "
3104 "Starting timer (%d secs).",
5705 "Starting timer (%d secs).",
3105 emlxs_fcftab_state_xlate(fcftab->state),
5706 fcftab->TID,
5707 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3106 emlxs_fcf_event_xlate(evt), arg1,
3107 fcftab->generation,
3108 cfg[CFG_FCF_SOLICIT_DELAY].current);
3109
3110 /* Start the read timer */
3111 fcftab->read_timer = hba->timer_tics +
3112 cfg[CFG_FCF_SOLICIT_DELAY].current;
3113
3114 return (0);
3115
5708 emlxs_fcf_event_xlate(evt), arg1,
5709 fcftab->generation,
5710 cfg[CFG_FCF_SOLICIT_DELAY].current);
5711
5712 /* Start the read timer */
5713 fcftab->read_timer = hba->timer_tics +
5714 cfg[CFG_FCF_SOLICIT_DELAY].current;
5715
5716 return (0);
5717
3116} /* emlxs_fcftab_sol_cmpl_action() */
5718} /* emlxs_fcoe_fcftab_sol_cmpl_action() */
3117
3118
3119/*ARGSUSED*/
3120static uint32_t
5719
5720
5721/*ARGSUSED*/
5722static uint32_t
3121emlxs_fcftab_read_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
5723emlxs_fcoe_fcftab_read_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
3122{
3123 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
3124 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3125 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
3126 mbox_rsp_hdr_t *hdr_rsp;
3127 IOCTL_FCOE_READ_FCF_TABLE *fcf;
3128 FCF_RECORD_t *fcfrec;
3129 FCFIobj_t *fcfp;
3130 MATCHMAP *mp;
5724{
5725 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
5726 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5727 MAILBOX4 *mb4 = (MAILBOX4 *)mbq;
5728 mbox_rsp_hdr_t *hdr_rsp;
5729 IOCTL_FCOE_READ_FCF_TABLE *fcf;
5730 FCF_RECORD_t *fcfrec;
5731 FCFIobj_t *fcfp;
5732 MATCHMAP *mp;
3131 uint32_t index;
5733 uint32_t context;
5734 uint16_t index;
5735 uint16_t TID;
3132 uint32_t event_tag;
3133
3134 mutex_enter(&EMLXS_FCF_LOCK);
5736 uint32_t event_tag;
5737
5738 mutex_enter(&EMLXS_FCF_LOCK);
5739 context = (uint32_t)((unsigned long)mbq->context);
5740 TID = (uint16_t)(context >> 16);
5741 index = (uint16_t)(context & 0xFFFF);
3135
5742
3136 if (fcftab->state != FCFTAB_STATE_READ) {
5743 if (fcftab->state != FCOE_FCFTAB_STATE_READ) {
3137 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5744 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3138 "fcftab_read_mbcmpl: state=%s. Terminated.",
3139 emlxs_fcftab_state_xlate(fcftab->state));
5745 "fcoe_fcftab_read_mbcmpl:%x index=%d %s.",
5746 TID, index,
5747 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
3140
3141 mutex_exit(&EMLXS_FCF_LOCK);
3142 return (0);
3143 }
3144
5748
5749 mutex_exit(&EMLXS_FCF_LOCK);
5750 return (0);
5751 }
5752
3145 index = (uint32_t)((uintptr_t)mbq->context);
5753 if (TID != fcftab->generation) {
5754 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5755 "fcoe_fcftab_read_mbcmpl:%x index=%d %s. "
5756 "Incorrect generation %x. Dropping.",
5757 TID, index,
5758 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
5759 fcftab->generation);
5760
5761 mutex_exit(&EMLXS_FCF_LOCK);
5762 return (0);
5763 }
5764
3146 mp = (MATCHMAP *)mbq->nonembed;
3147 hdr_rsp = (mbox_rsp_hdr_t *)mp->virt;
3148
3149 if (mb4->mbxStatus || hdr_rsp->status) {
3150 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5765 mp = (MATCHMAP *)mbq->nonembed;
5766 hdr_rsp = (mbox_rsp_hdr_t *)mp->virt;
5767
5768 if (mb4->mbxStatus || hdr_rsp->status) {
5769 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3151 "fcftab_read_mbcmpl:%d failed. status=%x,%x,%x",
3152 index, mb4->mbxStatus, hdr_rsp->status,
3153 hdr_rsp->extra_status);
5770 "fcoe_fcftab_read_mbcmpl:%x index=%d failed. %s %x,%x. >",
5771 fcftab->TID, index,
5772 emlxs_mb_xlate_status(mb4->mbxStatus),
5773 hdr_rsp->status, hdr_rsp->extra_status);
3154
5774
3155 (void) emlxs_fcftab_state(port, FCFTAB_STATE_READ_FAILED,
3156 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
5775 (void) emlxs_fcoe_fcftab_state(port,
5776 FCOE_FCFTAB_STATE_READ_FAILED,
5777 FCF_REASON_MBOX_FAILED, mb4->mbxStatus,
5778 (void*)((unsigned long)index));
3157
3158 mutex_exit(&EMLXS_FCF_LOCK);
3159 return (0);
3160 }
3161
3162 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5779
5780 mutex_exit(&EMLXS_FCF_LOCK);
5781 return (0);
5782 }
5783
5784 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3163 "fcftab_read_mbcmpl: state=%s",
3164 emlxs_fcftab_state_xlate(fcftab->state));
5785 "fcoe_fcftab_read_mbcmpl:%x index=%d %s",
5786 fcftab->TID, index,
5787 emlxs_fcoe_fcftab_state_xlate(fcftab->state));
3165
3166 fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_rsp + 1);
3167 fcfrec = &fcf->params.response.fcf_entry[0];
3168
3169#ifdef EMLXS_BIG_ENDIAN
3170{
3171 uint32_t *iptr;
3172 uint32_t i;

--- 27 unchanged lines hidden (view full) ---

3200
3201 /* If not found, allocate a new one */
3202 if (!fcfp) {
3203 fcfp = emlxs_fcfi_alloc(port);
3204 }
3205
3206 if (!fcfp) {
3207 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5788
5789 fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_rsp + 1);
5790 fcfrec = &fcf->params.response.fcf_entry[0];
5791
5792#ifdef EMLXS_BIG_ENDIAN
5793{
5794 uint32_t *iptr;
5795 uint32_t i;

--- 27 unchanged lines hidden (view full) ---

5823
5824 /* If not found, allocate a new one */
5825 if (!fcfp) {
5826 fcfp = emlxs_fcfi_alloc(port);
5827 }
5828
5829 if (!fcfp) {
5830 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3208 "fcftab_read_mbcmpl:%d failed. Unable to allocate fcfi.",
3209 index);
5831 "fcoe_fcftab_read_mbcmpl:%x index=%d failed. "
5832 "Unable to allocate fcfi. >",
5833 fcftab->TID, index);
3210
5834
3211 (void) emlxs_fcftab_state(port, FCFTAB_STATE_READ_FAILED,
3212 FCF_REASON_NO_FCFI, 0, 0);
5835 (void) emlxs_fcoe_fcftab_state(port,
5836 FCOE_FCFTAB_STATE_READ_FAILED,
5837 FCF_REASON_NO_FCFI, 0,
5838 (void*)((unsigned long)index));
3213
3214 mutex_exit(&EMLXS_FCF_LOCK);
3215 return (0);
3216 }
3217
3218 /* Update the FCFI */
3219 emlxs_fcfi_update(port, fcfp, fcfrec, event_tag);
3220
3221 /* Check if another record needs to be acquired */
3222 if (fcf->params.response.next_valid_fcf_index != 0xffff) {
5839
5840 mutex_exit(&EMLXS_FCF_LOCK);
5841 return (0);
5842 }
5843
5844 /* Update the FCFI */
5845 emlxs_fcfi_update(port, fcfp, fcfrec, event_tag);
5846
5847 /* Check if another record needs to be acquired */
5848 if (fcf->params.response.next_valid_fcf_index != 0xffff) {
3223 fcftab->index = fcf->params.response.next_valid_fcf_index;
5849 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5850 "fcoe_fcftab_read_mbcmpl:%x. Read next. >",
5851 fcftab->TID);
3224
5852
3225 (void) emlxs_fcftab_state(port, FCFTAB_STATE_READ,
5853 (void) emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_READ,
3226 FCF_REASON_REENTER, 0,
5854 FCF_REASON_REENTER, 0,
3227 (void *)((uintptr_t)fcf->params.response.
5855 (void *)((unsigned long)fcf->params.response.
3228 next_valid_fcf_index));
3229 } else {
5856 next_valid_fcf_index));
5857 } else {
3230 (void) emlxs_fcftab_state(port, FCFTAB_STATE_READ_CMPL,
3231 0, 0, 0);
5858 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5859 "fcoe_fcftab_read_mbcmpl:%x. Read complete. >",
5860 fcftab->TID);
5861
5862 (void) emlxs_fcoe_fcftab_state(port,
5863 FCOE_FCFTAB_STATE_READ_CMPL,
5864 0, 0, (void*)((unsigned long)index));
3232 }
3233
3234 mutex_exit(&EMLXS_FCF_LOCK);
3235 return (0);
3236
5865 }
5866
5867 mutex_exit(&EMLXS_FCF_LOCK);
5868 return (0);
5869
3237} /* emlxs_fcftab_read_mbcmpl() */
5870} /* emlxs_fcoe_fcftab_read_mbcmpl() */
3238
3239
3240/*ARGSUSED*/
3241static uint32_t
5871
5872
5873/*ARGSUSED*/
5874static uint32_t
3242emlxs_fcftab_read_action(emlxs_port_t *port, uint32_t evt,
5875emlxs_fcoe_fcftab_read_action(emlxs_port_t *port, uint32_t evt,
3243 void *arg1)
3244{
3245 emlxs_hba_t *hba = HBA;
3246 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3247 MAILBOXQ *mbq;
3248 MAILBOX4 *mb4;
3249 IOCTL_FCOE_READ_FCF_TABLE *fcf;
5876 void *arg1)
5877{
5878 emlxs_hba_t *hba = HBA;
5879 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5880 MAILBOXQ *mbq;
5881 MAILBOX4 *mb4;
5882 IOCTL_FCOE_READ_FCF_TABLE *fcf;
3250 uint32_t rval;
5883 uint32_t rval = 0;
3251 MATCHMAP *mp;
3252 mbox_req_hdr_t *hdr_req;
5884 MATCHMAP *mp;
5885 mbox_req_hdr_t *hdr_req;
3253 uint16_t index;
5886 uint16_t index = (uint16_t)((unsigned long)arg1);
5887 uint32_t context;
3254
5888
3255 if (fcftab->state != FCFTAB_STATE_READ) {
5889 if (fcftab->state != FCOE_FCFTAB_STATE_READ) {
3256 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5890 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3257 "fcftab_read_action: %s:%s arg=%p. "
3258 "Invalid state. Terminated.",
3259 emlxs_fcftab_state_xlate(fcftab->state),
5891 "fcoe_fcftab_read_action:%x %s:%s arg=%p. "
5892 "Invalid state. <",
5893 fcftab->TID,
5894 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3260 emlxs_fcf_event_xlate(evt), arg1);
3261 return (1);
3262 }
3263
5895 emlxs_fcf_event_xlate(evt), arg1);
5896 return (1);
5897 }
5898
3264 fcftab->flag &= ~EMLXS_FCFTAB_READ_REQ;
3265
3266 if (fcftab->prev_state != FCFTAB_STATE_READ_FAILED) {
5899 if ((fcftab->prev_state != FCOE_FCFTAB_STATE_READ_FAILED) ||
5900 (fcftab->flag & EMLXS_FCOE_FCFTAB_READ_REQ)) {
5901 fcftab->flag &= ~EMLXS_FCOE_FCFTAB_READ_REQ;
3267 fcftab->attempts = 0;
3268 }
3269
3270 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3271 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5902 fcftab->attempts = 0;
5903 }
5904
5905 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
5906 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3272 "fcftab_read_action: %s:%s arg=%p flag=%x. "
5907 "fcoe_fcftab_read_action:%x %s:%s arg=%p flag=%x. "
3273 "Handling request.",
5908 "Handling request.",
3274 emlxs_fcftab_state_xlate(fcftab->state),
5909 fcftab->TID,
5910 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3275 emlxs_fcf_event_xlate(evt), arg1,
3276 fcftab->flag);
3277
5911 emlxs_fcf_event_xlate(evt), arg1,
5912 fcftab->flag);
5913
3278 rval = emlxs_fcftab_req_handler(port, arg1);
5914 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
3279 return (rval);
3280 }
3281
5915 return (rval);
5916 }
5917
3282 index = (uint16_t)((uintptr_t)arg1);
5918 if (fcftab->attempts == 0) {
5919 fcftab->TID = fcftab->generation;
5920 }
3283
3284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5921
5922 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3285 "fcftab_read_action: %s:%s arg=%p attempts=%d. Reading FCF.",
3286 emlxs_fcftab_state_xlate(fcftab->state),
5923 "fcoe_fcftab_read_action:%x %s:%s arg=%p attempts=%d. "
5924 "Reading FCF. <",
5925 fcftab->TID,
5926 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3287 emlxs_fcf_event_xlate(evt), arg1,
3288 fcftab->attempts);
3289
5927 emlxs_fcf_event_xlate(evt), arg1,
5928 fcftab->attempts);
5929
3290 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
3291 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ_FAILED,
5930 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
5931 rval = emlxs_fcoe_fcftab_state(port,
5932 FCOE_FCFTAB_STATE_READ_FAILED,
3292 FCF_REASON_NO_MBOX, 0, arg1);
3293 return (rval);
3294 }
3295 mb4 = (MAILBOX4*)mbq;
3296 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
3297
5933 FCF_REASON_NO_MBOX, 0, arg1);
5934 return (rval);
5935 }
5936 mb4 = (MAILBOX4*)mbq;
5937 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
5938
3298 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
5939 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
3299 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3300
5940 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
5941
3301 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ_FAILED,
5942 rval = emlxs_fcoe_fcftab_state(port,
5943 FCOE_FCFTAB_STATE_READ_FAILED,
3302 FCF_REASON_NO_BUFFER, 0, arg1);
3303 return (rval);
3304 }
3305 bzero(mp->virt, mp->size);
3306
3307 mbq->nonembed = (void *)mp;
5944 FCF_REASON_NO_BUFFER, 0, arg1);
5945 return (rval);
5946 }
5947 bzero(mp->virt, mp->size);
5948
5949 mbq->nonembed = (void *)mp;
3308 mbq->mbox_cmpl = emlxs_fcftab_read_mbcmpl;
3309 mbq->context = (void *)((uintptr_t)index);
5950 mbq->mbox_cmpl = emlxs_fcoe_fcftab_read_mbcmpl;
5951
5952 context = ((uint32_t)fcftab->TID << 16) | (uint32_t)index;
5953 mbq->context = (void *)((unsigned long)context);
3310 mbq->port = (void *)port;
3311
3312 mb4->un.varSLIConfig.be.embedded = 0;
3313 mb4->mbxCommand = MBX_SLI_CONFIG;
3314 mb4->mbxOwner = OWN_HOST;
3315
3316 hdr_req = (mbox_req_hdr_t *)mp->virt;
3317 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;

--- 4 unchanged lines hidden (view full) ---

3322 fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_req + 1);
3323 fcf->params.request.fcf_index = index;
3324
3325 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
3326 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
3327 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
3328 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
3329
5954 mbq->port = (void *)port;
5955
5956 mb4->un.varSLIConfig.be.embedded = 0;
5957 mb4->mbxCommand = MBX_SLI_CONFIG;
5958 mb4->mbxOwner = OWN_HOST;
5959
5960 hdr_req = (mbox_req_hdr_t *)mp->virt;
5961 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;

--- 4 unchanged lines hidden (view full) ---

5966 fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_req + 1);
5967 fcf->params.request.fcf_index = index;
5968
5969 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
5970 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
5971 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
5972 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
5973
3330 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ_FAILED,
5974 rval = emlxs_fcoe_fcftab_state(port,
5975 FCOE_FCFTAB_STATE_READ_FAILED,
3331 FCF_REASON_SEND_FAILED, rval, arg1);
3332
3333 return (rval);
3334 }
3335
3336 return (0);
3337
5976 FCF_REASON_SEND_FAILED, rval, arg1);
5977
5978 return (rval);
5979 }
5980
5981 return (0);
5982
3338} /* emlxs_fcftab_read_action() */
5983} /* emlxs_fcoe_fcftab_read_action() */
3339
3340
3341/*ARGSUSED*/
3342static uint32_t
5984
5985
5986/*ARGSUSED*/
5987static uint32_t
3343emlxs_fcftab_read_failed_action(emlxs_port_t *port, uint32_t evt,
5988emlxs_fcoe_fcftab_read_failed_action(emlxs_port_t *port, uint32_t evt,
3344 void *arg1)
3345{
3346 emlxs_hba_t *hba = HBA;
3347 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5989 void *arg1)
5990{
5991 emlxs_hba_t *hba = HBA;
5992 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3348 uint32_t rval;
5993 uint32_t rval = 0;
3349
3350 fcftab->attempts++;
3351
5994
5995 fcftab->attempts++;
5996
3352 if (fcftab->state != FCFTAB_STATE_READ_FAILED) {
5997 if (fcftab->state != FCOE_FCFTAB_STATE_READ_FAILED) {
3353 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5998 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3354 "fcftab_read_failed_action: %s:%s arg=%p attempt=%d. "
3355 "Invalid state. Terminated.",
3356 emlxs_fcftab_state_xlate(fcftab->state),
5999 "fcoe_fcftab_read_failed_action:%x %s:%s arg=%p "
6000 "attempt=%d. Invalid state. <",
6001 fcftab->TID,
6002 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3357 emlxs_fcf_event_xlate(evt),
3358 arg1, fcftab->attempts);
6003 emlxs_fcf_event_xlate(evt),
6004 arg1, fcftab->attempts);
3359
3360 return (1);
3361 }
3362
6005 return (1);
6006 }
6007
3363 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3364 "fcftab_read_failed_action: %s:%s arg=%p attempt=%d reason=%x",
3365 emlxs_fcftab_state_xlate(fcftab->state),
3366 emlxs_fcf_event_xlate(evt), arg1,
3367 fcftab->attempts,
3368 fcftab->reason);
3369
3370 if ((fcftab->reason == FCF_REASON_SEND_FAILED) ||
6008 if ((fcftab->reason == FCF_REASON_MBOX_FAILED) ||
6009 (fcftab->reason == FCF_REASON_SEND_FAILED) ||
3371 (fcftab->attempts >= 3)) {
6010 (fcftab->attempts >= 3)) {
3372 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ_CMPL,
6011 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6012 "fcoe_fcftab_read_failed_action:%x %s:%s arg=%p "
6013 "attempt=%d reason=%x. Giving up.",
6014 fcftab->TID,
6015 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
6016 emlxs_fcf_event_xlate(evt), arg1,
6017 fcftab->attempts,
6018 fcftab->reason);
6019
6020 rval = emlxs_fcoe_fcftab_state(port,
6021 FCOE_FCFTAB_STATE_READ_CMPL,
3373 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
3374 } else {
6022 FCF_REASON_OP_FAILED, fcftab->attempts, arg1);
6023 } else {
3375 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ,
6024 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6025 "fcoe_fcftab_read_failed_action:%x %s:%s arg=%p "
6026 "attempt=%d reason=%x. Retrying.",
6027 fcftab->TID,
6028 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
6029 emlxs_fcf_event_xlate(evt), arg1,
6030 fcftab->attempts,
6031 fcftab->reason);
6032
6033 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_READ,
3376 FCF_REASON_OP_FAILED, fcftab->attempts, FCFTAB_READ_ALL);
3377 }
3378
3379 return (rval);
3380
6034 FCF_REASON_OP_FAILED, fcftab->attempts, FCFTAB_READ_ALL);
6035 }
6036
6037 return (rval);
6038
3381} /* emlxs_fcftab_read_failed_action() */
6039} /* emlxs_fcoe_fcftab_read_failed_action() */
3382
3383
3384/*ARGSUSED*/
3385static uint32_t
6040
6041
6042/*ARGSUSED*/
6043static uint32_t
3386emlxs_fcftab_read_cmpl_action(emlxs_port_t *port, uint32_t evt,
6044emlxs_fcoe_fcftab_read_cmpl_action(emlxs_port_t *port, uint32_t evt,
3387 void *arg1)
3388{
3389 emlxs_hba_t *hba = HBA;
3390 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6045 void *arg1)
6046{
6047 emlxs_hba_t *hba = HBA;
6048 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3391 uint32_t rval;
6049 uint32_t rval = 0;
3392 FCFIobj_t *fcfp;
3393 uint32_t i;
3394
6050 FCFIobj_t *fcfp;
6051 uint32_t i;
6052
3395 if (fcftab->state != FCFTAB_STATE_READ_CMPL) {
6053 if (fcftab->state != FCOE_FCFTAB_STATE_READ_CMPL) {
3396 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6054 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3397 "fcftab_read_cmpl_action: %s:%s arg=%p. "
3398 "Invalid state. Terminated.",
3399 emlxs_fcftab_state_xlate(fcftab->state),
6055 "fcoe_fcftab_read_cmpl_action:%x %s:%s arg=%p. "
6056 "Invalid state. <",
6057 fcftab->TID,
6058 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3400 emlxs_fcf_event_xlate(evt), arg1);
3401 return (1);
3402 }
3403
3404 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6059 emlxs_fcf_event_xlate(evt), arg1);
6060 return (1);
6061 }
6062
6063 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3405 "fcftab_read_cmpl_action: %s:%s arg=%p attempts=%d. "
6064 "fcoe_fcftab_read_cmpl_action:%x %s:%s arg=%p attempts=%d. "
3406 "Cleaning table.",
6065 "Cleaning table.",
3407 emlxs_fcftab_state_xlate(fcftab->state),
6066 fcftab->TID,
6067 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3408 emlxs_fcf_event_xlate(evt), arg1,
3409 fcftab->attempts);
3410
3411 /* Clean FCFI table */
3412 fcfp = fcftab->table;
3413 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
3414 if (fcfp->state == FCFI_STATE_FREE) {
3415 continue;

--- 8 unchanged lines hidden (view full) ---

3424
3425 /* Clear the failed bit */
3426 fcfp->flag &= ~EMLXS_FCFI_FAILED;
3427
3428 /* Free all stale unselected entries now */
3429 if (!(fcfp->flag & EMLXS_FCFI_FRESH) &&
3430 !(fcfp->flag & EMLXS_FCFI_SELECTED)) {
3431 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6068 emlxs_fcf_event_xlate(evt), arg1,
6069 fcftab->attempts);
6070
6071 /* Clean FCFI table */
6072 fcfp = fcftab->table;
6073 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
6074 if (fcfp->state == FCFI_STATE_FREE) {
6075 continue;

--- 8 unchanged lines hidden (view full) ---

6084
6085 /* Clear the failed bit */
6086 fcfp->flag &= ~EMLXS_FCFI_FAILED;
6087
6088 /* Free all stale unselected entries now */
6089 if (!(fcfp->flag & EMLXS_FCFI_FRESH) &&
6090 !(fcfp->flag & EMLXS_FCFI_SELECTED)) {
6091 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3432 "fcftab_read_cmpl_action:%d %s. "
3433 "FCF stale. Freeing FCF.",
3434 fcfp->fcf_index,
3435 emlxs_fcfi_state_xlate(fcfp->state));
6092 "fcoe_fcftab_read_cmpl_action:%x. FCF stale. "
6093 "Freeing FCFI:%d. >",
6094 fcftab->TID,
6095 fcfp->fcf_index);
3436
3437 (void) emlxs_fcfi_free(port, fcfp);
3438 continue;
3439 }
3440 }
3441
6096
6097 (void) emlxs_fcfi_free(port, fcfp);
6098 continue;
6099 }
6100 }
6101
3442 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_ONLINE,
6102 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_FCFI_ONLINE,
3443 FCF_REASON_EVENT, evt, arg1);
3444
3445 return (rval);
3446
6103 FCF_REASON_EVENT, evt, arg1);
6104
6105 return (rval);
6106
3447} /* emlxs_fcftab_read_cmpl_action() */
6107} /* emlxs_fcoe_fcftab_read_cmpl_action() */
3448
3449
3450static FCFIobj_t *
6108
6109
6110static FCFIobj_t *
3451emlxs_fcftab_fcfi_select(emlxs_port_t *port, char *fabric_wwn)
6111emlxs_fcoe_fcftab_fcfi_select(emlxs_port_t *port, char *fabric_wwn)
3452{
3453 emlxs_hba_t *hba = HBA;
3454 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3455 FCFIobj_t *fcfp;
3456 FCFIobj_t *fcfp1;
3457 uint32_t mask;
3458 uint32_t viable;
3459 uint32_t i;

--- 88 unchanged lines hidden (view full) ---

3548 fcfp = fcf_table[0];
3549 }
3550
3551 /* Free the priority table */
3552 kmem_free(fcf_table, (sizeof (uintptr_t) * fcf_table_count));
3553
3554 return (fcfp);
3555
6112{
6113 emlxs_hba_t *hba = HBA;
6114 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6115 FCFIobj_t *fcfp;
6116 FCFIobj_t *fcfp1;
6117 uint32_t mask;
6118 uint32_t viable;
6119 uint32_t i;

--- 88 unchanged lines hidden (view full) ---

6208 fcfp = fcf_table[0];
6209 }
6210
6211 /* Free the priority table */
6212 kmem_free(fcf_table, (sizeof (uintptr_t) * fcf_table_count));
6213
6214 return (fcfp);
6215
3556} /* emlxs_fcftab_fcfi_select() */
6216} /* emlxs_fcoe_fcftab_fcfi_select() */
3557
3558
3559/*ARGSUSED*/
3560static void
6217
6218
6219/*ARGSUSED*/
6220static void
3561emlxs_fcftab_process(emlxs_port_t *port)
6221emlxs_fcoe_fcftab_process(emlxs_port_t *port)
3562{
3563 emlxs_hba_t *hba = HBA;
3564 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3565 FCFIobj_t *fcfp;
3566 FCFIobj_t *prev_fcfp;
3567 uint32_t i;
3568 uint32_t j;
3569 uint32_t count;

--- 16 unchanged lines hidden (view full) ---

3586 }
3587
3588 /* Check if entry is viable */
3589 if ((fcfp->flag & mask) == viable) {
3590 if (fcfp->offline_timer) {
3591 fcfp->offline_timer = 0;
3592
3593 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6222{
6223 emlxs_hba_t *hba = HBA;
6224 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6225 FCFIobj_t *fcfp;
6226 FCFIobj_t *prev_fcfp;
6227 uint32_t i;
6228 uint32_t j;
6229 uint32_t count;

--- 16 unchanged lines hidden (view full) ---

6246 }
6247
6248 /* Check if entry is viable */
6249 if ((fcfp->flag & mask) == viable) {
6250 if (fcfp->offline_timer) {
6251 fcfp->offline_timer = 0;
6252
6253 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3594 "fcftab_process:%d fcfi=%d %s. "
6254 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3595 "FCF viable. Offline timer disabled.",
6255 "FCF viable. Offline timer disabled.",
6256 fcftab->TID,
3596 i, fcfp->fcf_index,
3597 emlxs_fcfi_state_xlate(fcfp->state),
3598 cfg[CFG_FCF_FAILOVER_DELAY].current);
3599 }
3600 continue;
3601 }
3602
3603 /* Previous entry is no longer viable */
3604
3605 /* If FCF is still online */
3606 if (fcfp->state > FCFI_STATE_OFFLINE) {
3607 if (fcfp->offline_timer == 0) {
3608 /* Set the offline timer */
3609 fcfp->offline_timer = hba->timer_tics +
3610 cfg[CFG_FCF_FAILOVER_DELAY].current;
3611
3612 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6257 i, fcfp->fcf_index,
6258 emlxs_fcfi_state_xlate(fcfp->state),
6259 cfg[CFG_FCF_FAILOVER_DELAY].current);
6260 }
6261 continue;
6262 }
6263
6264 /* Previous entry is no longer viable */
6265
6266 /* If FCF is still online */
6267 if (fcfp->state > FCFI_STATE_OFFLINE) {
6268 if (fcfp->offline_timer == 0) {
6269 /* Set the offline timer */
6270 fcfp->offline_timer = hba->timer_tics +
6271 cfg[CFG_FCF_FAILOVER_DELAY].current;
6272
6273 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3613 "fcftab_process:%d fcfi=%d %s. "
6274 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3614 "No longer viable. "
3615 "Offlining FCF (%d secs).",
6275 "No longer viable. "
6276 "Offlining FCF (%d secs).",
6277 fcftab->TID,
3616 i, fcfp->fcf_index,
3617 emlxs_fcfi_state_xlate(fcfp->state),
3618 cfg[CFG_FCF_FAILOVER_DELAY].current);
3619 }
3620 continue;
3621 }
3622
3623 /* Deselect it */
3624 fcfp->flag &= ~EMLXS_FCFI_SELECTED;
3625
3626 if (!(fcfp->flag & EMLXS_FCFI_FRESH)) {
3627 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6278 i, fcfp->fcf_index,
6279 emlxs_fcfi_state_xlate(fcfp->state),
6280 cfg[CFG_FCF_FAILOVER_DELAY].current);
6281 }
6282 continue;
6283 }
6284
6285 /* Deselect it */
6286 fcfp->flag &= ~EMLXS_FCFI_SELECTED;
6287
6288 if (!(fcfp->flag & EMLXS_FCFI_FRESH)) {
6289 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3628 "fcftab_process:%d fcfi=%d %s. "
3629 "No longer viable. Freeing FCF.",
3630 i, fcfp->fcf_index,
3631 emlxs_fcfi_state_xlate(fcfp->state));
6290 "fcoe_fcftab_process:%x %d. "
6291 "No longer viable. Freeing FCFI:%d. >",
6292 fcftab->TID,
6293 i, fcfp->fcf_index);
3632
3633 (void) emlxs_fcfi_free(port, fcfp);
3634 } else {
3635 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6294
6295 (void) emlxs_fcfi_free(port, fcfp);
6296 } else {
6297 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3636 "fcftab_process:%d fcfi=%d %s. "
6298 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3637 "No longer viable. FCF deselected.",
6299 "No longer viable. FCF deselected.",
6300 fcftab->TID,
3638 i, fcfp->fcf_index,
3639 emlxs_fcfi_state_xlate(fcfp->state));
3640 }
3641 }
3642
3643 /* Reselection process */
3644 for (i = 0; i < FCFTAB_MAX_FCFI_COUNT; i++) {
3645 prev_fcfp = fcftab->fcfi[i];
3646 fcftab->fcfi[i] = NULL;
3647
3648 /* If no previous selection, then make new one */
3649 if (!prev_fcfp) {
3650 /* Select an fcf on any fabric */
6301 i, fcfp->fcf_index,
6302 emlxs_fcfi_state_xlate(fcfp->state));
6303 }
6304 }
6305
6306 /* Reselection process */
6307 for (i = 0; i < FCFTAB_MAX_FCFI_COUNT; i++) {
6308 prev_fcfp = fcftab->fcfi[i];
6309 fcftab->fcfi[i] = NULL;
6310
6311 /* If no previous selection, then make new one */
6312 if (!prev_fcfp) {
6313 /* Select an fcf on any fabric */
3651 fcfp = emlxs_fcftab_fcfi_select(port, 0);
6314 fcfp = emlxs_fcoe_fcftab_fcfi_select(port, 0);
3652
3653 if (fcfp) {
3654 fcfp->flag |= EMLXS_FCFI_SELECTED;
3655 fcftab->fcfi[i] = fcfp;
3656
3657 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6315
6316 if (fcfp) {
6317 fcfp->flag |= EMLXS_FCFI_SELECTED;
6318 fcftab->fcfi[i] = fcfp;
6319
6320 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3658 "fcftab_process:%d fcfi=%d %s. "
6321 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3659 "New FCF selected.",
6322 "New FCF selected.",
6323 fcftab->TID,
3660 i, fcfp->fcf_index,
3661 emlxs_fcfi_state_xlate(fcfp->state));
3662 } else {
3663 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6324 i, fcfp->fcf_index,
6325 emlxs_fcfi_state_xlate(fcfp->state));
6326 } else {
6327 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3664 "fcftab_process:%d. No FCF available.",
6328 "fcoe_fcftab_process:%x %d. "
6329 "No FCF available.",
6330 fcftab->TID,
3665 i);
3666 }
3667 continue;
3668 }
3669
3670 /* If previous entry is still selected, keep it */
3671 if (prev_fcfp->flag & EMLXS_FCFI_SELECTED) {
3672 fcfp = prev_fcfp;
3673 fcftab->fcfi[i] = fcfp;
3674
3675 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6331 i);
6332 }
6333 continue;
6334 }
6335
6336 /* If previous entry is still selected, keep it */
6337 if (prev_fcfp->flag & EMLXS_FCFI_SELECTED) {
6338 fcfp = prev_fcfp;
6339 fcftab->fcfi[i] = fcfp;
6340
6341 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3676 "fcftab_process:%d fcfi=%d %s. "
6342 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3677 "FCF still selected.",
6343 "FCF still selected.",
6344 fcftab->TID,
3678 i, fcfp->fcf_index,
3679 emlxs_fcfi_state_xlate(fcfp->state));
3680 continue;
3681 }
3682
3683 /* Previous entry is no longer selected */
3684
3685 /* Select a new fcf from same fabric */
6345 i, fcfp->fcf_index,
6346 emlxs_fcfi_state_xlate(fcfp->state));
6347 continue;
6348 }
6349
6350 /* Previous entry is no longer selected */
6351
6352 /* Select a new fcf from same fabric */
3686 fcfp = emlxs_fcftab_fcfi_select(port,
6353 fcfp = emlxs_fcoe_fcftab_fcfi_select(port,
3687 (char *)prev_fcfp->fcf_rec.fabric_name_identifier);
3688
3689 if (fcfp) {
3690 fcfp->flag |= EMLXS_FCFI_SELECTED;
3691 fcftab->fcfi[i] = fcfp;
3692
3693 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6354 (char *)prev_fcfp->fcf_rec.fabric_name_identifier);
6355
6356 if (fcfp) {
6357 fcfp->flag |= EMLXS_FCFI_SELECTED;
6358 fcftab->fcfi[i] = fcfp;
6359
6360 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3694 "fcftab_process:%d fcfi=%d %s. "
6361 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3695 "New FCF, same fabric selected.",
6362 "New FCF, same fabric selected.",
6363 fcftab->TID,
3696 i, fcfp->fcf_index,
3697 emlxs_fcfi_state_xlate(fcfp->state));
3698 continue;
3699 }
3700
3701 /* Select fcf from any fabric */
6364 i, fcfp->fcf_index,
6365 emlxs_fcfi_state_xlate(fcfp->state));
6366 continue;
6367 }
6368
6369 /* Select fcf from any fabric */
3702 fcfp = emlxs_fcftab_fcfi_select(port, 0);
6370 fcfp = emlxs_fcoe_fcftab_fcfi_select(port, 0);
3703
3704 if (fcfp) {
3705 fcfp->flag |= EMLXS_FCFI_SELECTED;
3706 fcftab->fcfi[i] = fcfp;
3707
3708 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6371
6372 if (fcfp) {
6373 fcfp->flag |= EMLXS_FCFI_SELECTED;
6374 fcftab->fcfi[i] = fcfp;
6375
6376 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3709 "fcftab_process:%d fcfi=%d %s. "
6377 "fcoe_fcftab_process:%x %d fcfi=%d %s. "
3710 "New FCF, new fabric selected.",
6378 "New FCF, new fabric selected.",
6379 fcftab->TID,
3711 i, fcfp->fcf_index,
3712 emlxs_fcfi_state_xlate(fcfp->state));
3713 continue;
3714 }
3715
3716 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6380 i, fcfp->fcf_index,
6381 emlxs_fcfi_state_xlate(fcfp->state));
6382 continue;
6383 }
6384
6385 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3717 "fcftab_process:%d. No FCF available.",
6386 "fcoe_fcftab_process:%x %d. No FCF available.",
6387 fcftab->TID,
3718 i);
3719 }
3720
3721 /* Pack entries */
3722 count = 0;
3723 for (i = 0; i < FCFTAB_MAX_FCFI_COUNT; i++) {
3724 if (fcftab->fcfi[i]) {
3725 count++;

--- 14 unchanged lines hidden (view full) ---

3740 if (j == FCFTAB_MAX_FCFI_COUNT) {
3741 break;
3742 }
3743 }
3744 fcftab->fcfi_count = count;
3745
3746 return;
3747
6388 i);
6389 }
6390
6391 /* Pack entries */
6392 count = 0;
6393 for (i = 0; i < FCFTAB_MAX_FCFI_COUNT; i++) {
6394 if (fcftab->fcfi[i]) {
6395 count++;

--- 14 unchanged lines hidden (view full) ---

6410 if (j == FCFTAB_MAX_FCFI_COUNT) {
6411 break;
6412 }
6413 }
6414 fcftab->fcfi_count = count;
6415
6416 return;
6417
3748} /* emlxs_fcftab_process() */
6418} /* emlxs_fcoe_fcftab_process() */
3749
3750
6419
6420
3751
3752/*ARGSUSED*/
3753static uint32_t
6421/*ARGSUSED*/
6422static uint32_t
3754emlxs_fcftab_fcfi_online_action(emlxs_port_t *port, uint32_t evt,
6423emlxs_fcoe_fcftab_fcfi_online_action(emlxs_port_t *port, uint32_t evt,
3755 void *arg1)
3756{
3757 emlxs_hba_t *hba = HBA;
3758 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3759 FCFIobj_t *fcfp;
3760 uint32_t rval = 0;
3761 uint32_t i;
3762 uint32_t offline_count = 0;
3763 uint32_t online_count = 0;
3764
6424 void *arg1)
6425{
6426 emlxs_hba_t *hba = HBA;
6427 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6428 FCFIobj_t *fcfp;
6429 uint32_t rval = 0;
6430 uint32_t i;
6431 uint32_t offline_count = 0;
6432 uint32_t online_count = 0;
6433
3765 if (fcftab->state != FCFTAB_STATE_FCFI_ONLINE) {
6434 if (fcftab->state != FCOE_FCFTAB_STATE_FCFI_ONLINE) {
3766 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6435 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3767 "fcftab_fcfi_online_action: %s:%s arg=%p. "
3768 "Invalid state. Terminated.",
3769 emlxs_fcftab_state_xlate(fcftab->state),
6436 "fcoe_fcftab_fcfi_online_action:%x %s:%s arg=%p. "
6437 "Invalid state. <",
6438 fcftab->TID,
6439 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3770 emlxs_fcf_event_xlate(evt), arg1);
3771 return (1);
3772 }
3773
3774 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3775 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6440 emlxs_fcf_event_xlate(evt), arg1);
6441 return (1);
6442 }
6443
6444 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
6445 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3776 "fcftab_fcfi_online_action: %s:%s arg=%p flag=%x. "
6446 "fcoe_fcftab_fcfi_online_action:%x flag=%x. "
3777 "Handling request.",
6447 "Handling request.",
3778 emlxs_fcftab_state_xlate(fcftab->state),
3779 emlxs_fcf_event_xlate(evt), arg1,
6448 fcftab->TID,
3780 fcftab->flag);
3781
6449 fcftab->flag);
6450
3782 rval = emlxs_fcftab_req_handler(port, arg1);
6451 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
3783 return (rval);
3784 }
3785
6452 return (rval);
6453 }
6454
3786 emlxs_fcftab_process(port);
6455 emlxs_fcoe_fcftab_process(port);
3787
3788 for (i = 0; i < fcftab->fcfi_count; i++) {
3789 fcfp = fcftab->fcfi[i];
3790
3791 if (fcfp->offline_timer == 0) {
3792 online_count++;
3793
3794 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6456
6457 for (i = 0; i < fcftab->fcfi_count; i++) {
6458 fcfp = fcftab->fcfi[i];
6459
6460 if (fcfp->offline_timer == 0) {
6461 online_count++;
6462
6463 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3795 "fcftab_fcfi_online_action: fcfi_count=%d. "
3796 "Onlining FCF:%d.",
6464 "fcoe_fcftab_fcfi_online_action:%x fcfi_count=%d. "
6465 "Onlining FCFI:%d. >",
6466 fcftab->TID,
3797 fcftab->fcfi_count,
3798 fcfp->fcf_index);
3799
3800 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_ONLINE,
3801 fcfp);
3802 } else {
3803 offline_count++;
3804
3805 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6467 fcftab->fcfi_count,
6468 fcfp->fcf_index);
6469
6470 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_ONLINE,
6471 fcfp);
6472 } else {
6473 offline_count++;
6474
6475 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3806 "fcftab_fcfi_online_action: fcfi_count=%d. "
3807 "Offlining FCF:%d.",
6476 "fcoe_fcftab_fcfi_online_action:%x fcfi_count=%d. "
6477 "Offlining fcfi:%d.",
6478 fcftab->TID,
3808 fcftab->fcfi_count,
3809 fcfp->fcf_index);
3810 }
3811 }
3812
3813 if (offline_count) {
3814 /* Wait for FCF's to go offline */
6479 fcftab->fcfi_count,
6480 fcfp->fcf_index);
6481 }
6482 }
6483
6484 if (offline_count) {
6485 /* Wait for FCF's to go offline */
3815 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_OFFLINE,
6486 rval = emlxs_fcoe_fcftab_state(port,
6487 FCOE_FCFTAB_STATE_FCFI_OFFLINE,
3816 FCF_REASON_EVENT, evt, arg1);
3817
3818 /* Service timer now */
6488 FCF_REASON_EVENT, evt, arg1);
6489
6490 /* Service timer now */
3819 emlxs_fcftab_offline_timer(hba);
6491 emlxs_fcoe_fcftab_offline_timer(hba);
3820
3821 return (rval);
3822 }
3823
3824 if (!online_count) {
3825 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6492
6493 return (rval);
6494 }
6495
6496 if (!online_count) {
6497 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3826 "fcftab_fcfi_online_action: fcfi_count=%d.",
6498 "fcoe_fcftab_fcfi_online_action:%x fcfi_count=%d.",
6499 fcftab->TID,
3827 fcftab->fcfi_count);
3828 }
3829
6500 fcftab->fcfi_count);
6501 }
6502
3830 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_ONLINE_CMPL,
6503 rval = emlxs_fcoe_fcftab_state(port,
6504 FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL,
3831 FCF_REASON_EVENT, evt, arg1);
3832
3833 return (rval);
3834
6505 FCF_REASON_EVENT, evt, arg1);
6506
6507 return (rval);
6508
3835} /* emlxs_fcftab_fcfi_online_action() */
6509} /* emlxs_fcoe_fcftab_fcfi_online_action() */
3836
3837
3838/*ARGSUSED*/
3839static uint32_t
6510
6511
6512/*ARGSUSED*/
6513static uint32_t
3840emlxs_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port, uint32_t evt,
6514emlxs_fcoe_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port, uint32_t evt,
3841 void *arg1)
3842{
3843 emlxs_hba_t *hba = HBA;
3844 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6515 void *arg1)
6516{
6517 emlxs_hba_t *hba = HBA;
6518 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3845 uint32_t rval;
6519 uint32_t rval = 0;
3846
6520
3847 if (fcftab->state != FCFTAB_STATE_FCFI_ONLINE_CMPL) {
6521 if (fcftab->state != FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL) {
3848 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6522 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3849 "fcftab_fcfi_online_cmpl_action: %s:%s arg=%p. "
3850 "Invalid state. Terminated.",
3851 emlxs_fcftab_state_xlate(fcftab->state),
6523 "fcoe_fcftab_fcfi_online_cmpl_action:%x %s:%s arg=%p. "
6524 "Invalid state. <",
6525 fcftab->TID,
6526 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3852 emlxs_fcf_event_xlate(evt), arg1);
3853 return (1);
3854 }
3855
3856 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3857 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6527 emlxs_fcf_event_xlate(evt), arg1);
6528 return (1);
6529 }
6530
6531 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
6532 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3858 "fcftab_fcfi_online_cmpl_action: %s:%s arg=%p flag=%x. "
3859 "Handling request.",
3860 emlxs_fcftab_state_xlate(fcftab->state),
6533 "fcoe_fcftab_fcfi_online_cmpl_action:%x %s:%s "
6534 "arg=%p flag=%x. Handling request.",
6535 fcftab->TID,
6536 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3861 emlxs_fcf_event_xlate(evt), arg1,
3862 fcftab->flag);
3863
6537 emlxs_fcf_event_xlate(evt), arg1,
6538 fcftab->flag);
6539
3864 rval = emlxs_fcftab_req_handler(port, arg1);
6540 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
3865 return (rval);
3866 }
3867
3868 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6541 return (rval);
6542 }
6543
6544 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3869 "fcftab_fcfi_online_cmpl_action: %s:%s arg=%p",
3870 emlxs_fcftab_state_xlate(fcftab->state),
6545 "fcoe_fcftab_fcfi_online_cmpl_action:%x %s:%s arg=%p. "
6546 "Going online.",
6547 fcftab->TID,
6548 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3871 emlxs_fcf_event_xlate(evt), arg1);
3872
6549 emlxs_fcf_event_xlate(evt), arg1);
6550
3873 rval = emlxs_fcftab_state(port, FCFTAB_STATE_ONLINE,
6551 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_ONLINE,
3874 FCF_REASON_EVENT, evt, arg1);
3875
3876 return (rval);
3877
6552 FCF_REASON_EVENT, evt, arg1);
6553
6554 return (rval);
6555
3878} /* emlxs_fcftab_fcfi_online_cmpl_action() */
6556} /* emlxs_fcoe_fcftab_fcfi_online_cmpl_action() */
3879
3880
3881/*ARGSUSED*/
3882static uint32_t
6557
6558
6559/*ARGSUSED*/
6560static uint32_t
3883emlxs_fcftab_fcfi_offline_action(emlxs_port_t *port, uint32_t evt,
6561emlxs_fcoe_fcftab_fcfi_offline_action(emlxs_port_t *port, uint32_t evt,
3884 void *arg1)
3885{
3886 emlxs_hba_t *hba = HBA;
3887 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3888 FCFIobj_t *fcfp;
6562 void *arg1)
6563{
6564 emlxs_hba_t *hba = HBA;
6565 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6566 FCFIobj_t *fcfp;
3889 uint32_t rval;
6567 uint32_t rval = 0;
3890 int32_t i;
3891 uint32_t fcfi_offline;
3892
6568 int32_t i;
6569 uint32_t fcfi_offline;
6570
3893 if (fcftab->state != FCFTAB_STATE_FCFI_OFFLINE) {
6571 if (fcftab->state != FCOE_FCFTAB_STATE_FCFI_OFFLINE) {
3894 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6572 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3895 "fcftab_fcfi_offline_action: %s:%s arg=%p. "
3896 "Invalid state. Terminated.",
3897 emlxs_fcftab_state_xlate(fcftab->state),
6573 "fcoe_fcftab_fcfi_offline_action:%x %s:%s arg=%p. "
6574 "Invalid state. <",
6575 fcftab->TID,
6576 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3898 emlxs_fcf_event_xlate(evt), arg1);
3899 return (1);
3900 }
3901
3902 /* Check for FCF's going offline */
3903 fcfi_offline = 0;
3904 for (i = 0; i < fcftab->fcfi_count; i++) {
3905 fcfp = fcftab->fcfi[i];

--- 5 unchanged lines hidden (view full) ---

3911 if (fcfp->offline_timer ||
3912 (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
3913 fcfi_offline++;
3914 }
3915 }
3916
3917 if (fcfi_offline) {
3918 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6577 emlxs_fcf_event_xlate(evt), arg1);
6578 return (1);
6579 }
6580
6581 /* Check for FCF's going offline */
6582 fcfi_offline = 0;
6583 for (i = 0; i < fcftab->fcfi_count; i++) {
6584 fcfp = fcftab->fcfi[i];

--- 5 unchanged lines hidden (view full) ---

6590 if (fcfp->offline_timer ||
6591 (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
6592 fcfi_offline++;
6593 }
6594 }
6595
6596 if (fcfi_offline) {
6597 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3919 "fcftab_fcfi_offline_action: %s:%s arg=%p "
3920 "fcfi_offline=%d. Terminated.",
3921 emlxs_fcftab_state_xlate(fcftab->state),
6598 "fcoe_fcftab_fcfi_offline_action:%x %s:%s arg=%p "
6599 "fcfi_offline=%d. <",
6600 fcftab->TID,
6601 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3922 emlxs_fcf_event_xlate(evt), arg1,
3923 fcfi_offline);
3924
3925 return (0);
3926 }
3927
3928 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6602 emlxs_fcf_event_xlate(evt), arg1,
6603 fcfi_offline);
6604
6605 return (0);
6606 }
6607
6608 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3929 "fcftab_fcfi_offline_action: %s:%s arg=%p.",
3930 emlxs_fcftab_state_xlate(fcftab->state),
6609 "fcoe_fcftab_fcfi_offline_action:%x %s:%s arg=%p.",
6610 fcftab->TID,
6611 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3931 emlxs_fcf_event_xlate(evt), arg1);
3932
6612 emlxs_fcf_event_xlate(evt), arg1);
6613
3933 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_OFFLINE_CMPL,
6614 rval = emlxs_fcoe_fcftab_state(port,
6615 FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL,
3934 FCF_REASON_EVENT, evt, arg1);
6616 FCF_REASON_EVENT, evt, arg1);
6617
3935 return (rval);
3936
6618 return (rval);
6619
3937} /* emlxs_fcftab_fcfi_offline_action() */
6620} /* emlxs_fcoe_fcftab_fcfi_offline_action() */
3938
3939
3940/*ARGSUSED*/
3941static uint32_t
6621
6622
6623/*ARGSUSED*/
6624static uint32_t
3942emlxs_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port, uint32_t evt,
6625emlxs_fcoe_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port, uint32_t evt,
3943 void *arg1)
3944{
3945 emlxs_hba_t *hba = HBA;
3946 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6626 void *arg1)
6627{
6628 emlxs_hba_t *hba = HBA;
6629 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3947 uint32_t rval;
6630 uint32_t rval = 0;
3948
6631
3949 if (fcftab->state != FCFTAB_STATE_FCFI_OFFLINE_CMPL) {
6632 if (fcftab->state != FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL) {
3950 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6633 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3951 "fcftab_fcfi_offline_cmpl_action: %s:%s arg=%p. "
3952 "Invalid state. Terminated.",
3953 emlxs_fcftab_state_xlate(fcftab->state),
6634 "fcoe_fcftab_fcfi_offline_cmpl_action:%x %s:%s arg=%p. "
6635 "Invalid state. <",
6636 fcftab->TID,
6637 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3954 emlxs_fcf_event_xlate(evt), arg1);
3955 return (1);
3956 }
3957
3958 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
6638 emlxs_fcf_event_xlate(evt), arg1);
6639 return (1);
6640 }
6641
6642 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
3959 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
3960 "fcftab_fcfi_offline_cmpl_action: %s:%s arg=%p. "
6643 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6644 "fcoe_fcftab_fcfi_offline_cmpl_action:%x %s:%s arg=%p. "
3961 "Handling request.",
6645 "Handling request.",
3962 emlxs_fcftab_state_xlate(fcftab->state),
6646 fcftab->TID,
6647 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3963 emlxs_fcf_event_xlate(evt), arg1);
3964
6648 emlxs_fcf_event_xlate(evt), arg1);
6649
3965 rval = emlxs_fcftab_req_handler(port, arg1);
6650 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
3966 return (rval);
3967 }
3968
3969 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6651 return (rval);
6652 }
6653
6654 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3970 "fcftab_fcfi_offline_cmpl_action: %s:%s arg=%p.",
3971 emlxs_fcftab_state_xlate(fcftab->state),
6655 "fcoe_fcftab_fcfi_offline_cmpl_action:%x %s:%s arg=%p. "
6656 "Returning FCF(s) online.",
6657 fcftab->TID,
6658 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3972 emlxs_fcf_event_xlate(evt), arg1);
3973
6659 emlxs_fcf_event_xlate(evt), arg1);
6660
3974 rval = emlxs_fcftab_state(port, FCFTAB_STATE_FCFI_ONLINE,
6661 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_FCFI_ONLINE,
3975 FCF_REASON_EVENT, evt, arg1);
3976
3977 return (rval);
3978
6662 FCF_REASON_EVENT, evt, arg1);
6663
6664 return (rval);
6665
3979} /* emlxs_fcftab_fcfi_offline_cmpl_action() */
6666} /* emlxs_fcoe_fcftab_fcfi_offline_cmpl_action() */
3980
3981
3982/*ARGSUSED*/
3983static uint32_t
6667
6668
6669/*ARGSUSED*/
6670static uint32_t
3984emlxs_fcftab_found_evt_action(emlxs_port_t *port, uint32_t evt,
6671emlxs_fcoe_fcftab_found_evt_action(emlxs_port_t *port, uint32_t evt,
3985 void *arg1)
3986{
3987 emlxs_hba_t *hba = HBA;
3988 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6672 void *arg1)
6673{
6674 emlxs_hba_t *hba = HBA;
6675 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
3989 uint32_t fcf_index = (uint32_t)((uintptr_t)arg1);
6676 uint32_t fcf_index = (uint32_t)((unsigned long)arg1);
3990 FCFIobj_t *fcfp;
3991 uint32_t rval = 0;
3992
3993 if (evt != FCF_EVENT_FCF_FOUND) {
3994 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6677 FCFIobj_t *fcfp;
6678 uint32_t rval = 0;
6679
6680 if (evt != FCF_EVENT_FCF_FOUND) {
6681 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
3995 "fcftab_found_evt_action: %s:%s fcf_index=%d. "
3996 "Invalid event type. Terminated.",
3997 emlxs_fcftab_state_xlate(fcftab->state),
6682 "fcoe_fcftab_found_evt_action:%x %s:%s fcf_index=%d. "
6683 "Invalid event type. <",
6684 fcftab->TID,
6685 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
3998 emlxs_fcf_event_xlate(evt),
3999 fcf_index);
4000
4001 return (1);
4002 }
4003
4004 switch (fcftab->state) {
6686 emlxs_fcf_event_xlate(evt),
6687 fcf_index);
6688
6689 return (1);
6690 }
6691
6692 switch (fcftab->state) {
4005 case FCFTAB_STATE_SOLICIT:
4006 case FCFTAB_STATE_SOLICIT_CMPL:
4007 case FCFTAB_STATE_READ:
6693 case FCOE_FCFTAB_STATE_SOLICIT:
6694 case FCOE_FCFTAB_STATE_SOLICIT_CMPL:
6695 case FCOE_FCFTAB_STATE_READ:
4008 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6696 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4009 "fcftab_found_evt_action: %s:%s fcf_index=%d gen=%x. "
4010 "Terminated.",
4011 emlxs_fcftab_state_xlate(fcftab->state),
6697 "fcoe_fcftab_found_evt_action:%x %s:%s "
6698 "fcf_index=%d gen=%x. <",
6699 fcftab->TID,
6700 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4012 emlxs_fcf_event_xlate(evt),
4013 fcf_index, fcftab->generation);
4014 break;
4015
6701 emlxs_fcf_event_xlate(evt),
6702 fcf_index, fcftab->generation);
6703 break;
6704
4016 /* case FCFTAB_STATE_FCFI_OFFLINE: */
6705 /* case FCOE_FCFTAB_STATE_FCFI_OFFLINE: */
4017 default:
4018
4019 /* Scan for matching fcf index in table */
4020 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
4021
4022 if (fcfp && (fcfp->flag & EMLXS_FCFI_SELECTED)) {
4023
4024 /* Trigger table read */
4025 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
6706 default:
6707
6708 /* Scan for matching fcf index in table */
6709 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
6710
6711 if (fcfp && (fcfp->flag & EMLXS_FCFI_SELECTED)) {
6712
6713 /* Trigger table read */
6714 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4026 fcftab->flag |= EMLXS_FCFTAB_READ_REQ;
6715 fcftab->flag |= EMLXS_FCOE_FCFTAB_READ_REQ;
4027 fcftab->generation++;
4028
4029 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6716 fcftab->generation++;
6717
6718 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4030 "fcftab_found_evt_action: %s:%s fcf_index=%d "
4031 "gen=%x. Read FCF table.",
4032 emlxs_fcftab_state_xlate(fcftab->state),
6719 "fcoe_fcftab_found_evt_action:%x %s:%s "
6720 "fcf_index=%d gen=%x. Read FCF table.",
6721 fcftab->TID,
6722 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4033 emlxs_fcf_event_xlate(evt),
4034 fcf_index, fcftab->generation);
4035
6723 emlxs_fcf_event_xlate(evt),
6724 fcf_index, fcftab->generation);
6725
4036 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ,
6726 rval = emlxs_fcoe_fcftab_state(port,
6727 FCOE_FCFTAB_STATE_READ,
4037 FCF_REASON_EVENT, evt, arg1);
4038
4039 break;
4040 }
4041
4042 /* Check if we need more FCF's */
4043 if (fcftab->fcfi_online < FCFTAB_MAX_FCFI_COUNT) {
4044
4045 /* Trigger table read */
4046 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
6728 FCF_REASON_EVENT, evt, arg1);
6729
6730 break;
6731 }
6732
6733 /* Check if we need more FCF's */
6734 if (fcftab->fcfi_online < FCFTAB_MAX_FCFI_COUNT) {
6735
6736 /* Trigger table read */
6737 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4047 fcftab->flag |= EMLXS_FCFTAB_READ_REQ;
6738 fcftab->flag |= EMLXS_FCOE_FCFTAB_READ_REQ;
4048 fcftab->generation++;
4049
4050 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6739 fcftab->generation++;
6740
6741 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4051 "fcftab_found_evt_action: %s:%s fcf_index=%d "
4052 "gen=%x fcfi_online=%d. Read FCF table.",
4053 emlxs_fcftab_state_xlate(fcftab->state),
6742 "fcoe_fcftab_found_evt_action:%x %s:%s "
6743 "fcf_index=%d gen=%x fcfi_online=%d. "
6744 "Read FCF table.",
6745 fcftab->TID,
6746 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4054 emlxs_fcf_event_xlate(evt),
4055 fcf_index, fcftab->generation,
4056 fcftab->fcfi_online);
4057
6747 emlxs_fcf_event_xlate(evt),
6748 fcf_index, fcftab->generation,
6749 fcftab->fcfi_online);
6750
4058 rval = emlxs_fcftab_state(port, FCFTAB_STATE_READ,
6751 rval = emlxs_fcoe_fcftab_state(port,
6752 FCOE_FCFTAB_STATE_READ,
4059 FCF_REASON_EVENT, evt, arg1);
4060
4061 break;
4062 }
4063
4064 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6753 FCF_REASON_EVENT, evt, arg1);
6754
6755 break;
6756 }
6757
6758 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4065 "fcftab_found_evt_action: %s:%s fcfi=%d. "
4066 "FCF not needed. Terminated.",
4067 emlxs_fcftab_state_xlate(fcftab->state),
6759 "fcoe_fcftab_found_evt_action:%x %s:%s fcfi=%d. "
6760 "FCF not needed. <",
6761 fcftab->TID,
6762 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4068 emlxs_fcf_event_xlate(evt),
4069 fcf_index);
4070
4071 break;
4072 }
4073
4074 return (rval);
4075
6763 emlxs_fcf_event_xlate(evt),
6764 fcf_index);
6765
6766 break;
6767 }
6768
6769 return (rval);
6770
4076} /* emlxs_fcftab_found_evt_action() */
6771} /* emlxs_fcoe_fcftab_found_evt_action() */
4077
4078
4079/*ARGSUSED*/
4080static uint32_t
6772
6773
6774/*ARGSUSED*/
6775static uint32_t
4081emlxs_fcftab_lost_evt_action(emlxs_port_t *port, uint32_t evt,
6776emlxs_fcoe_fcftab_lost_evt_action(emlxs_port_t *port, uint32_t evt,
4082 void *arg1)
4083{
4084 emlxs_hba_t *hba = HBA;
4085 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4086 FCFIobj_t *fcfp;
6777 void *arg1)
6778{
6779 emlxs_hba_t *hba = HBA;
6780 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6781 FCFIobj_t *fcfp;
4087 uint32_t fcf_index = (uint32_t)((uintptr_t)arg1);
6782 uint32_t fcf_index = (uint32_t)((unsigned long)arg1);
4088 emlxs_port_t *vport;
4089 VPIobj_t *vpip;
4090 uint32_t i;
6783 emlxs_port_t *vport;
6784 VPIobj_t *vpip;
6785 uint32_t i;
4091 uint32_t rval;
6786 uint32_t rval = 0;
4092
4093 if (evt != FCF_EVENT_FCF_LOST) {
4094 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6787
6788 if (evt != FCF_EVENT_FCF_LOST) {
6789 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4095 "fcftab_lost_evt_action: %s:%s fcf_index=%d. "
4096 "Invalid event type. Terminated",
4097 emlxs_fcftab_state_xlate(fcftab->state),
6790 "fcoe_fcftab_lost_evt_action:%x %s:%s fcf_index=%d. "
6791 "Invalid event type. <",
6792 fcftab->TID,
6793 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4098 emlxs_fcf_event_xlate(evt),
4099 fcf_index);
4100
4101 return (1);
4102 }
4103
4104 /* Scan for matching fcf index in table */
4105 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
4106
4107 if (!fcfp) {
4108 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6794 emlxs_fcf_event_xlate(evt),
6795 fcf_index);
6796
6797 return (1);
6798 }
6799
6800 /* Scan for matching fcf index in table */
6801 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
6802
6803 if (!fcfp) {
6804 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4109 "fcftab_lost_evt_action: %s:%s fcf_index=%d. "
4110 "FCF not found. Terminated.",
4111 emlxs_fcftab_state_xlate(fcftab->state),
6805 "fcoe_fcftab_lost_evt_action:%x %s:%s fcf_index=%d. "
6806 "FCF not found. <",
6807 fcftab->TID,
6808 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4112 emlxs_fcf_event_xlate(evt),
4113 fcf_index);
4114
4115 return (0);
4116 }
4117
4118 if (!(fcfp->flag & EMLXS_FCFI_SELECTED)) {
4119 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6809 emlxs_fcf_event_xlate(evt),
6810 fcf_index);
6811
6812 return (0);
6813 }
6814
6815 if (!(fcfp->flag & EMLXS_FCFI_SELECTED)) {
6816 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4120 "fcftab_changed_evt_action: %s:%s fcf_index=%d. "
4121 "FCF not selected. Terminated.",
4122 emlxs_fcftab_state_xlate(fcftab->state),
6817 "fcoe_fcftab_changed_evt_action:%x %s:%s fcf_index=%d. "
6818 "FCF not selected. <",
6819 fcftab->TID,
6820 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4123 emlxs_fcf_event_xlate(evt),
4124 fcf_index);
4125
4126 return (0);
4127 }
4128
4129 /* Offline VPI's of this FCFI */
4130 for (i = 0; i <= hba->vpi_max; i++) {
4131 vport = &VPORT(i);
6821 emlxs_fcf_event_xlate(evt),
6822 fcf_index);
6823
6824 return (0);
6825 }
6826
6827 /* Offline VPI's of this FCFI */
6828 for (i = 0; i <= hba->vpi_max; i++) {
6829 vport = &VPORT(i);
4132 vpip = &vport->VPIobj;
6830 vpip = vport->vpip;
4133
4134 if ((vpip->state == VPI_STATE_OFFLINE) ||
4135 (vpip->vfip->fcfp != fcfp)) {
4136 continue;
4137 }
4138
4139 /* Fabric logo is implied */
6831
6832 if ((vpip->state == VPI_STATE_OFFLINE) ||
6833 (vpip->vfip->fcfp != fcfp)) {
6834 continue;
6835 }
6836
6837 /* Fabric logo is implied */
4140 vpip->flag &= ~EMLXS_VPI_LOGI;
4141 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
4142 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
6838 emlxs_vpi_logo_handler(port, vpip);
4143
6839
4144 if (vpip->vfip->logi_count > 0) {
4145 vpip->vfip->logi_count--;
4146 }
4147 }
4148
4149 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6840 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4150 "fcftab_lost_evt_action: %s:%s fcf_index=%d gen=%x. "
4151 "Offlining VPI:%d.",
4152 emlxs_fcftab_state_xlate(fcftab->state),
6841 "fcoe_fcftab_lost_evt_action:%x %s:%s fcf_index=%d gen=%x. "
6842 "Offlining VPI:%d. >",
6843 fcftab->TID,
6844 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4153 emlxs_fcf_event_xlate(evt),
4154 fcf_index, fcftab->generation,
4155 vpip->VPI);
4156
4157 (void) emlxs_vpi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
4158 }
4159
4160 switch (fcftab->state) {
6845 emlxs_fcf_event_xlate(evt),
6846 fcf_index, fcftab->generation,
6847 vpip->VPI);
6848
6849 (void) emlxs_vpi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
6850 }
6851
6852 switch (fcftab->state) {
4161 case FCFTAB_STATE_SOLICIT:
6853 case FCOE_FCFTAB_STATE_SOLICIT:
4162 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6854 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4163 "fcftab_lost_evt_action: %s gen=%x. "
4164 "Already soliciting. Terminated.",
4165 emlxs_fcftab_state_xlate(fcftab->state),
6855 "fcoe_fcftab_lost_evt_action:%x %s gen=%x. "
6856 "Already soliciting. <",
6857 fcftab->TID,
6858 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4166 fcftab->generation);
4167 break;
4168
4169 default:
4170 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
6859 fcftab->generation);
6860 break;
6861
6862 default:
6863 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4171 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
6864 fcftab->flag |= EMLXS_FCOE_FCFTAB_SOL_REQ;
4172 fcftab->generation++;
4173
4174 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6865 fcftab->generation++;
6866
6867 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4175 "fcftab_lost_evt_action: %s gen=%x. Soliciting.",
4176 emlxs_fcftab_state_xlate(fcftab->state),
6868 "fcoe_fcftab_lost_evt_action:%x %s gen=%x. Soliciting.",
6869 fcftab->TID,
6870 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4177 fcftab->generation);
4178
6871 fcftab->generation);
6872
4179 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
6873 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
4180 FCF_REASON_EVENT, evt, arg1);
4181 break;
4182 }
4183
4184 return (rval);
4185
6874 FCF_REASON_EVENT, evt, arg1);
6875 break;
6876 }
6877
6878 return (rval);
6879
4186} /* emlxs_fcftab_lost_evt_action() */
6880} /* emlxs_fcoe_fcftab_lost_evt_action() */
4187
4188
4189/*ARGSUSED*/
4190static uint32_t
6881
6882
6883/*ARGSUSED*/
6884static uint32_t
4191emlxs_fcftab_changed_evt_action(emlxs_port_t *port, uint32_t evt,
6885emlxs_fcoe_fcftab_changed_evt_action(emlxs_port_t *port, uint32_t evt,
4192 void *arg1)
4193{
4194 emlxs_hba_t *hba = HBA;
4195 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4196 FCFIobj_t *fcfp;
6886 void *arg1)
6887{
6888 emlxs_hba_t *hba = HBA;
6889 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6890 FCFIobj_t *fcfp;
4197 uint32_t fcf_index = (uint32_t)((uintptr_t)arg1);
4198 uint32_t rval;
6891 uint32_t fcf_index = (uint32_t)((unsigned long)arg1);
6892 uint32_t rval = 0;
4199
4200 if (evt != FCF_EVENT_FCF_CHANGED) {
4201 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6893
6894 if (evt != FCF_EVENT_FCF_CHANGED) {
6895 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4202 "fcftab_changed_evt_action: %s:%s fcf_index=%d. "
4203 "Invalid event type. Terminated",
4204 emlxs_fcftab_state_xlate(fcftab->state),
6896 "fcoe_fcftab_changed_evt_action:%x %s:%s fcf_index=%d. "
6897 "Invalid event type. <",
6898 fcftab->TID,
6899 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4205 emlxs_fcf_event_xlate(evt),
4206 fcf_index);
4207
4208 return (1);
4209 }
4210
6900 emlxs_fcf_event_xlate(evt),
6901 fcf_index);
6902
6903 return (1);
6904 }
6905
4211 /* Scan for matching fcf index in table */
4212 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
4213
4214 if (!fcfp) {
6906 switch (fcftab->state) {
6907 case FCOE_FCFTAB_STATE_SOLICIT:
6908 case FCOE_FCFTAB_STATE_SOLICIT_CMPL:
6909 case FCOE_FCFTAB_STATE_READ:
4215 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6910 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4216 "fcftab_changed_evt_action: %s:%s fcf_index=%d. "
4217 "FCFI not found. Terminated.",
4218 emlxs_fcftab_state_xlate(fcftab->state),
6911 "fcoe_fcftab_changed_evt_action:%x %s:%s "
6912 "fcf_index=%d gen=%x. <",
6913 fcftab->TID,
6914 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4219 emlxs_fcf_event_xlate(evt),
6915 emlxs_fcf_event_xlate(evt),
4220 fcf_index);
6916 fcf_index, fcftab->generation);
6917 break;
4221
6918
4222 return (1);
4223 }
6919 /* case FCOE_FCFTAB_STATE_FCFI_OFFLINE: */
6920 default:
4224
6921
4225 if (!(fcfp->flag & EMLXS_FCFI_SELECTED)) {
4226 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4227 "fcftab_changed_evt_action: %s:%s fcf_index=%d. "
4228 "FCFI not selected. Terminated.",
4229 emlxs_fcftab_state_xlate(fcftab->state),
4230 emlxs_fcf_event_xlate(evt),
4231 fcf_index);
6922 /* Scan for matching fcf index in table */
6923 fcfp = emlxs_fcfi_find(port, 0, &fcf_index);
4232
6924
4233 return (1);
4234 }
6925 if (fcfp && (fcfp->flag & EMLXS_FCFI_SELECTED)) {
4235
6926
4236 switch (fcftab->state) {
4237 case FCFTAB_STATE_SOLICIT:
4238 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4239 "fcftab_changed_evt_action: %s gen=%x. "
4240 "Already soliciting. Terminated.",
4241 emlxs_fcftab_state_xlate(fcftab->state),
4242 fcftab->generation);
4243 break;
6927 /* Trigger table read */
6928 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
6929 fcftab->flag |= EMLXS_FCOE_FCFTAB_READ_REQ;
6930 fcftab->generation++;
4244
6931
4245 default:
4246 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4247 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
4248 fcftab->generation++;
6932 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6933 "fcoe_fcftab_changed_evt_action:%x %s:%s "
6934 "fcf_index=%d gen=%x. Read FCF table.",
6935 fcftab->TID,
6936 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
6937 emlxs_fcf_event_xlate(evt),
6938 fcf_index, fcftab->generation);
4249
6939
6940 rval = emlxs_fcoe_fcftab_state(port,
6941 FCOE_FCFTAB_STATE_READ,
6942 FCF_REASON_EVENT, evt, arg1);
6943
6944 break;
6945 }
6946
6947 /* Check if we need more FCF's */
6948 if (fcftab->fcfi_online < FCFTAB_MAX_FCFI_COUNT) {
6949
6950 /* Trigger table read */
6951 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
6952 fcftab->flag |= EMLXS_FCOE_FCFTAB_READ_REQ;
6953 fcftab->generation++;
6954
6955 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6956 "fcoe_fcftab_changed_evt_action:%x %s:%s "
6957 "fcf_index=%d gen=%x fcfi_online=%d. "
6958 "Read FCF table.",
6959 fcftab->TID,
6960 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
6961 emlxs_fcf_event_xlate(evt),
6962 fcf_index, fcftab->generation,
6963 fcftab->fcfi_online);
6964
6965 rval = emlxs_fcoe_fcftab_state(port,
6966 FCOE_FCFTAB_STATE_READ,
6967 FCF_REASON_EVENT, evt, arg1);
6968
6969 break;
6970 }
6971
4250 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6972 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4251 "fcftab_changed_evt_action: %s gen=%x. Soliciting.",
4252 emlxs_fcftab_state_xlate(fcftab->state),
4253 fcftab->generation);
6973 "fcoe_fcftab_changed_evt_action:%x %s:%s fcfi=%d. "
6974 "FCF not needed. <",
6975 fcftab->TID,
6976 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
6977 emlxs_fcf_event_xlate(evt),
6978 fcf_index);
4254
6979
4255 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
4256 FCF_REASON_EVENT, evt, arg1);
4257 break;
4258 }
4259
4260 return (rval);
4261
6980 break;
6981 }
6982
6983 return (rval);
6984
4262} /* emlxs_fcftab_changed_evt_action() */
6985} /* emlxs_fcoe_fcftab_changed_evt_action() */
4263
4264
4265/*ARGSUSED*/
4266static uint32_t
6986
6987
6988/*ARGSUSED*/
6989static uint32_t
4267emlxs_fcftab_fcf_delete(emlxs_port_t *port, uint32_t fcf_index)
6990emlxs_fcoe_fcftab_fcf_delete(emlxs_port_t *port, uint32_t fcf_index)
4268{
4269 emlxs_hba_t *hba = HBA;
4270 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4271 MAILBOXQ *mbq;
4272 MAILBOX4 *mb4;
4273 MATCHMAP *mp = NULL;
6991{
6992 emlxs_hba_t *hba = HBA;
6993 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
6994 MAILBOXQ *mbq;
6995 MAILBOX4 *mb4;
6996 MATCHMAP *mp = NULL;
4274 uint32_t rval;
6997 uint32_t rval = 0;
4275
4276 IOCTL_FCOE_DELETE_FCF_TABLE *fcf;
4277 mbox_req_hdr_t *hdr_req;
4278
4279 if (fcf_index >= fcftab->fcfi_count) {
4280 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6998
6999 IOCTL_FCOE_DELETE_FCF_TABLE *fcf;
7000 mbox_req_hdr_t *hdr_req;
7001
7002 if (fcf_index >= fcftab->fcfi_count) {
7003 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4281 "fcftab_fcf_delete:%d failed. Out of range.",
7004 "fcoe_fcftab_fcf_delete:%x fcfi:%d failed. "
7005 "Out of range.",
7006 fcftab->TID,
4282 fcf_index);
4283
4284 return (1);
4285 }
4286
7007 fcf_index);
7008
7009 return (1);
7010 }
7011
4287 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
7012 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
4288 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7013 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4289 "fcftab_fcf_delete:%d failed. Unable to allocate mailbox.",
7014 "fcoe_fcftab_fcf_delete:%x fcfi:%d failed. "
7015 "Unable to allocate mailbox.",
7016 fcftab->TID,
4290 fcf_index);
4291
4292 return (1);
4293 }
4294
4295 mb4 = (MAILBOX4*)mbq;
4296 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
4297
7017 fcf_index);
7018
7019 return (1);
7020 }
7021
7022 mb4 = (MAILBOX4*)mbq;
7023 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
7024
4298 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
7025 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
4299 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7026 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4300 "fcftab_fcf_delete:%d failed. Unable to allocate buffer.",
7027 "fcoe_fcftab_fcf_delete:%x fcfi:%d failed. "
7028 "Unable to allocate buffer.",
7029 fcftab->TID,
4301 fcf_index);
4302
4303 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
4304 return (1);
4305 }
4306 bzero(mp->virt, mp->size);
4307
4308 mbq->nonembed = (void *)mp;
4309 mbq->mbox_cmpl = NULL;
7030 fcf_index);
7031
7032 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
7033 return (1);
7034 }
7035 bzero(mp->virt, mp->size);
7036
7037 mbq->nonembed = (void *)mp;
7038 mbq->mbox_cmpl = NULL;
4310 mbq->context = (void *)((uintptr_t)fcf_index);
7039 mbq->context = (void *)((unsigned long)fcf_index);
4311 mbq->port = (void *)port;
4312
4313 mb4->un.varSLIConfig.be.embedded = 0;
4314 mb4->mbxCommand = MBX_SLI_CONFIG;
4315 mb4->mbxOwner = OWN_HOST;
4316
4317 hdr_req = (mbox_req_hdr_t *)mp->virt;
4318 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;
4319 hdr_req->opcode = FCOE_OPCODE_DELETE_FCF_TABLE;
4320 hdr_req->timeout = 0;
4321 hdr_req->req_length = sizeof (IOCTL_FCOE_DELETE_FCF_TABLE);
4322
4323 fcf = (IOCTL_FCOE_DELETE_FCF_TABLE *)(hdr_req + 1);
4324 fcf->params.request.fcf_count = 1;
4325 fcf->params.request.fcf_indexes[0] = (uint16_t)fcf_index;
4326
4327 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7040 mbq->port = (void *)port;
7041
7042 mb4->un.varSLIConfig.be.embedded = 0;
7043 mb4->mbxCommand = MBX_SLI_CONFIG;
7044 mb4->mbxOwner = OWN_HOST;
7045
7046 hdr_req = (mbox_req_hdr_t *)mp->virt;
7047 hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;
7048 hdr_req->opcode = FCOE_OPCODE_DELETE_FCF_TABLE;
7049 hdr_req->timeout = 0;
7050 hdr_req->req_length = sizeof (IOCTL_FCOE_DELETE_FCF_TABLE);
7051
7052 fcf = (IOCTL_FCOE_DELETE_FCF_TABLE *)(hdr_req + 1);
7053 fcf->params.request.fcf_count = 1;
7054 fcf->params.request.fcf_indexes[0] = (uint16_t)fcf_index;
7055
7056 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4328 "fcftab_fcf_delete:%d.",
7057 "fcoe_fcftab_fcf_delete:%x fcfi:%d. <",
7058 fcftab->TID,
4329 fcf_index);
4330
4331 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
4332 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
4333 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7059 fcf_index);
7060
7061 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
7062 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
7063 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4334 "fcftab_fcf_delete:%d failed. Unable to send request.",
7064 "fcoe_fcftab_fcf_delete:%x fcfi:%d failed. "
7065 "Unable to send request.",
7066 fcftab->TID,
4335 fcf_index);
4336
4337 if (mp) {
4338 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
4339 }
4340 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
4341
4342 return (1);
4343 }
4344
4345 return (0);
4346
4347
7067 fcf_index);
7068
7069 if (mp) {
7070 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
7071 }
7072 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
7073
7074 return (1);
7075 }
7076
7077 return (0);
7078
7079
4348} /* emlxs_fcftab_fcf_delete() */
7080} /* emlxs_fcoe_fcftab_fcf_delete() */
4349
4350
4351/*ARGSUSED*/
4352static uint32_t
7081
7082
7083/*ARGSUSED*/
7084static uint32_t
4353emlxs_fcftab_full_evt_action(emlxs_port_t *port, uint32_t evt,
7085emlxs_fcoe_fcftab_full_evt_action(emlxs_port_t *port, uint32_t evt,
4354 void *arg1)
4355{
4356 emlxs_hba_t *hba = HBA;
4357 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4358 FCFIobj_t *fcfp;
7086 void *arg1)
7087{
7088 emlxs_hba_t *hba = HBA;
7089 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
7090 FCFIobj_t *fcfp;
4359 uint32_t rval;
7091 uint32_t rval = 0;
4360 uint32_t mask;
4361 uint32_t viable;
4362 uint32_t i;
4363 uint32_t count;
4364
4365 if (evt != FCF_EVENT_FCFTAB_FULL) {
4366 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7092 uint32_t mask;
7093 uint32_t viable;
7094 uint32_t i;
7095 uint32_t count;
7096
7097 if (evt != FCF_EVENT_FCFTAB_FULL) {
7098 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4367 "fcftab_full_evt_action: %s:%s arg=%p. "
4368 "Invalid event type. Terminated",
4369 emlxs_fcftab_state_xlate(fcftab->state),
7099 "fcoe_fcftab_full_evt_action:%x %s:%s arg=%p. "
7100 "Invalid event type. <",
7101 fcftab->TID,
7102 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4370 emlxs_fcf_event_xlate(evt), arg1);
4371
4372 return (1);
4373 }
4374
4375 if (fcftab->fcfi_online == FCFTAB_MAX_FCFI_COUNT) {
4376 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7103 emlxs_fcf_event_xlate(evt), arg1);
7104
7105 return (1);
7106 }
7107
7108 if (fcftab->fcfi_online == FCFTAB_MAX_FCFI_COUNT) {
7109 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4377 "fcftab_full_evt_action: %s:%s arg=%p fcfi_online=%d. "
4378 "Terminated.",
4379 emlxs_fcftab_state_xlate(fcftab->state),
7110 "fcoe_fcftab_full_evt_action:%x %s:%s arg=%p "
7111 "fcfi_online=%d. <",
7112 fcftab->TID,
7113 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4380 emlxs_fcf_event_xlate(evt), arg1,
4381 fcftab->fcfi_online);
4382
4383 return (0);
4384 }
4385
4386 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7114 emlxs_fcf_event_xlate(evt), arg1,
7115 fcftab->fcfi_online);
7116
7117 return (0);
7118 }
7119
7120 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4387 "fcftab_full_evt_action: %s:%s arg=%p fcfi_online=%d. "
7121 "fcoe_fcftab_full_evt_action:%x %s:%s arg=%p fcfi_online=%d. "
4388 "Cleaning table...",
7122 "Cleaning table...",
4389 emlxs_fcftab_state_xlate(fcftab->state),
7123 fcftab->TID,
7124 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4390 emlxs_fcf_event_xlate(evt), arg1,
4391 fcftab->fcfi_online);
4392
4393 mask = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
4394 EMLXS_FCFI_CONFIGURED);
4395 viable = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
4396 EMLXS_FCFI_CONFIGURED);
4397

--- 8 unchanged lines hidden (view full) ---

4406 continue;
4407 }
4408
4409 if ((fcfp->flag & mask) == viable) {
4410 continue;
4411 }
4412
4413 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7125 emlxs_fcf_event_xlate(evt), arg1,
7126 fcftab->fcfi_online);
7127
7128 mask = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
7129 EMLXS_FCFI_CONFIGURED);
7130 viable = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
7131 EMLXS_FCFI_CONFIGURED);
7132

--- 8 unchanged lines hidden (view full) ---

7141 continue;
7142 }
7143
7144 if ((fcfp->flag & mask) == viable) {
7145 continue;
7146 }
7147
7148 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4414 "fcftab_full_evt_action: fcfi=%d %s flag=%x. "
4415 "Deleting FCF.",
7149 "fcoe_fcftab_full_evt_action:%x. "
7150 "Deleting FCFI:%d %x. >",
7151 fcftab->TID,
4416 fcfp->fcf_index,
7152 fcfp->fcf_index,
4417 emlxs_fcfi_state_xlate(fcfp->state),
4418 fcfp->flag);
4419
4420 (void) emlxs_fcfi_free(port, fcfp);
4421
7153 fcfp->flag);
7154
7155 (void) emlxs_fcfi_free(port, fcfp);
7156
4422 (void) emlxs_fcftab_fcf_delete(port, fcfp->fcf_index);
7157 (void) emlxs_fcoe_fcftab_fcf_delete(port, fcfp->fcf_index);
4423
4424 count++;
4425 }
4426
4427 if (!count) {
4428 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7158
7159 count++;
7160 }
7161
7162 if (!count) {
7163 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4429 "fcftab_full_evt_action: %s:%s arg=%p. "
4430 "All FCF's are viable. Terminated.",
4431 emlxs_fcftab_state_xlate(fcftab->state),
7164 "fcoe_fcftab_full_evt_action:%x %s:%s arg=%p. "
7165 "All FCF's are viable. <",
7166 fcftab->TID,
7167 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4432 emlxs_fcf_event_xlate(evt), arg1);
4433
4434 return (0);
4435 }
4436
4437 switch (fcftab->state) {
7168 emlxs_fcf_event_xlate(evt), arg1);
7169
7170 return (0);
7171 }
7172
7173 switch (fcftab->state) {
4438 case FCFTAB_STATE_SOLICIT:
7174 case FCOE_FCFTAB_STATE_SOLICIT:
4439 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7175 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4440 "fcftab_full_evt_action: %s gen=%x. "
4441 "Already soliciting. Terminated.",
4442 emlxs_fcftab_state_xlate(fcftab->state),
7176 "fcoe_fcftab_full_evt_action:%x %s gen=%x. "
7177 "Already soliciting. <",
7178 fcftab->TID,
7179 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4443 fcftab->generation);
4444 break;
4445
4446 default:
4447 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
7180 fcftab->generation);
7181 break;
7182
7183 default:
7184 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4448 fcftab->flag |= EMLXS_FCFTAB_SOL_REQ;
7185 fcftab->flag |= EMLXS_FCOE_FCFTAB_SOL_REQ;
4449 fcftab->generation++;
4450
4451 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7186 fcftab->generation++;
7187
7188 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4452 "fcftab_full_evt_action: %s gen=%x. Soliciting.",
4453 emlxs_fcftab_state_xlate(fcftab->state),
7189 "fcoe_fcftab_full_evt_action:%x %s gen=%x. Soliciting.",
7190 fcftab->TID,
7191 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4454 fcftab->generation);
4455
7192 fcftab->generation);
7193
4456 rval = emlxs_fcftab_state(port, FCFTAB_STATE_SOLICIT,
7194 rval = emlxs_fcoe_fcftab_state(port, FCOE_FCFTAB_STATE_SOLICIT,
4457 FCF_REASON_EVENT, evt, arg1);
4458 break;
4459 }
4460
4461 return (rval);
4462
7195 FCF_REASON_EVENT, evt, arg1);
7196 break;
7197 }
7198
7199 return (rval);
7200
4463} /* emlxs_fcftab_full_evt_action() */
7201} /* emlxs_fcoe_fcftab_full_evt_action() */
4464
4465
4466/*ARGSUSED*/
4467static uint32_t
7202
7203
7204/*ARGSUSED*/
7205static uint32_t
4468emlxs_fcftab_online_action(emlxs_port_t *port, uint32_t evt,
7206emlxs_fcoe_fcftab_online_action(emlxs_port_t *port, uint32_t evt,
4469 void *arg1)
4470{
4471 emlxs_hba_t *hba = HBA;
4472 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4473 emlxs_config_t *cfg = &CFG;
4474 FCFIobj_t *fcfp;
7207 void *arg1)
7208{
7209 emlxs_hba_t *hba = HBA;
7210 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
7211 emlxs_config_t *cfg = &CFG;
7212 FCFIobj_t *fcfp;
4475 uint32_t rval;
7213 uint32_t rval = 0;
4476 uint32_t mask;
4477 uint32_t viable;
4478 uint32_t i;
4479 uint32_t count = 0;
4480
7214 uint32_t mask;
7215 uint32_t viable;
7216 uint32_t i;
7217 uint32_t count = 0;
7218
4481 if (fcftab->state != FCFTAB_STATE_ONLINE) {
7219 if (fcftab->state != FCOE_FCFTAB_STATE_ONLINE) {
4482 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7220 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4483 "fcftab_online_action: %s:%s arg=%p. "
4484 "Invalid state. Terminated.",
4485 emlxs_fcftab_state_xlate(fcftab->state),
7221 "fcoe_fcftab_online_action:%x %s:%s arg=%p. "
7222 "Invalid state. <",
7223 fcftab->TID,
7224 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4486 emlxs_fcf_event_xlate(evt), arg1);
4487 return (1);
4488 }
4489
4490 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
4491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7225 emlxs_fcf_event_xlate(evt), arg1);
7226 return (1);
7227 }
7228
7229 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
7230 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4492 "fcftab_online_action: %s:%s arg=%p flag=%x. "
7231 "fcoe_fcftab_online_action:%x flag=%x. "
4493 "Handling request.",
7232 "Handling request.",
4494 emlxs_fcftab_state_xlate(fcftab->state),
4495 emlxs_fcf_event_xlate(evt), arg1,
7233 fcftab->TID,
4496 fcftab->flag);
4497
7234 fcftab->flag);
7235
4498 rval = emlxs_fcftab_req_handler(port, arg1);
7236 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
4499 return (rval);
4500 }
4501
4502 if (fcftab->fcfi_online == 0) {
4503 mask = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
4504 EMLXS_FCFI_CONFIGURED);
4505 viable = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
4506 EMLXS_FCFI_CONFIGURED);

--- 8 unchanged lines hidden (view full) ---

4515
4516 if ((fcfp->flag & mask) == viable) {
4517 count++;
4518 }
4519 }
4520
4521 if (count) {
4522 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7237 return (rval);
7238 }
7239
7240 if (fcftab->fcfi_online == 0) {
7241 mask = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
7242 EMLXS_FCFI_CONFIGURED);
7243 viable = (EMLXS_FCFI_VALID|EMLXS_FCFI_AVAILABLE|
7244 EMLXS_FCFI_CONFIGURED);

--- 8 unchanged lines hidden (view full) ---

7253
7254 if ((fcfp->flag & mask) == viable) {
7255 count++;
7256 }
7257 }
7258
7259 if (count) {
7260 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4523 "fcftab_online_action: %s:%s "
4524 "fcfi_online=0,%d,%d. Starting solicit timer.",
4525 emlxs_fcftab_state_xlate(fcftab->state),
7261 "fcoe_fcftab_online_action:%x %s:%s "
7262 "fcfi_online=0,%d,%d. Starting resolicit timer. <",
7263 fcftab->TID,
7264 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4526 emlxs_fcf_event_xlate(evt),
4527 fcftab->fcfi_count, count);
4528
4529 /* Start the solicit timer */
4530 fcftab->sol_timer = hba->timer_tics +
4531 cfg[CFG_FCF_RESOLICIT_DELAY].current;
4532 } else {
4533 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7265 emlxs_fcf_event_xlate(evt),
7266 fcftab->fcfi_count, count);
7267
7268 /* Start the solicit timer */
7269 fcftab->sol_timer = hba->timer_tics +
7270 cfg[CFG_FCF_RESOLICIT_DELAY].current;
7271 } else {
7272 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4534 "fcftab_online_action: %s:%s "
4535 "fcfi_online=0,%d,0. Wait for FCF event.",
4536 emlxs_fcftab_state_xlate(fcftab->state),
7273 "fcoe_fcftab_online_action:%x %s:%s "
7274 "fcfi_online=0,%d,0. Wait for FCF event. <",
7275 fcftab->TID,
7276 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4537 emlxs_fcf_event_xlate(evt),
4538 fcftab->fcfi_count);
4539 }
4540
7277 emlxs_fcf_event_xlate(evt),
7278 fcftab->fcfi_count);
7279 }
7280
4541 if (hba->state > FC_LINK_DOWN) {
4542 mutex_enter(&EMLXS_PORT_LOCK);
4543 if (hba->state > FC_LINK_DOWN) {
4544 HBASTATS.LinkDown++;
4545 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_DOWN);
4546 }
4547 hba->flag &= FC_LINKDOWN_MASK;
4548 hba->discovery_timer = 0;
4549 mutex_exit(&EMLXS_PORT_LOCK);
7281 emlxs_fcf_linkdown(port);
4550
7282
4551 emlxs_log_link_event(port);
4552 }
4553
4554 return (0);
4555 }
4556
7283 return (0);
7284 }
7285
4557 if (hba->state < FC_LINK_UP) {
4558 mutex_enter(&EMLXS_PORT_LOCK);
4559 if (hba->state < FC_LINK_UP) {
4560 HBASTATS.LinkUp++;
4561 EMLXS_STATE_CHANGE_LOCKED(hba, FC_LINK_UP);
4562 }
4563 hba->discovery_timer =
4564 hba->timer_tics + cfg[CFG_LINKUP_TIMEOUT].current +
4565 cfg[CFG_DISC_TIMEOUT].current;
4566 mutex_exit(&EMLXS_PORT_LOCK);
4567
4568 emlxs_log_link_event(port);
4569 }
4570
4571 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7286 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4572 "fcftab_online_action: %s:%s arg=%p fcfi_online=%d. Terminated.",
4573 emlxs_fcftab_state_xlate(fcftab->state),
4574 emlxs_fcf_event_xlate(evt), arg1,
7287 "fcoe_fcftab_online_action:%x flag=%x fcfi_online=%d. "
7288 "Online. <",
7289 fcftab->TID,
7290 fcftab->flag,
4575 fcftab->fcfi_online);
4576
7291 fcftab->fcfi_online);
7292
4577 return (0);
7293 emlxs_fcf_linkup(port);
4578
7294
4579} /* emlxs_fcftab_online_action() */
7295 return (rval);
4580
7296
7297} /* emlxs_fcoe_fcftab_online_action() */
4581
7298
7299
4582/*ARGSUSED*/
4583static uint32_t
7300/*ARGSUSED*/
7301static uint32_t
4584emlxs_fcftab_offline_action(emlxs_port_t *port, uint32_t evt,
7302emlxs_fcoe_fcftab_offline_action(emlxs_port_t *port, uint32_t evt,
4585 void *arg1)
4586{
4587 emlxs_hba_t *hba = HBA;
4588 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
7303 void *arg1)
7304{
7305 emlxs_hba_t *hba = HBA;
7306 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4589 uint32_t rval;
7307 uint32_t rval = 0;
4590
7308
4591 if (fcftab->state != FCFTAB_STATE_OFFLINE) {
7309 if (fcftab->state != FCOE_FCFTAB_STATE_OFFLINE) {
4592 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7310 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4593 "fcftab_offline_action: %s:%s arg=%p. "
4594 "Invalid state. Terminated.",
4595 emlxs_fcftab_state_xlate(fcftab->state),
7311 "fcoe_fcftab_offline_action:%x %s:%s arg=%p. "
7312 "Invalid state. <",
7313 fcftab->TID,
7314 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4596 emlxs_fcf_event_xlate(evt), arg1);
4597 return (1);
4598 }
4599
7315 emlxs_fcf_event_xlate(evt), arg1);
7316 return (1);
7317 }
7318
4600 fcftab->flag &= ~EMLXS_FCFTAB_OFFLINE_REQ;
4601
7319
7320 fcftab->flag &= ~EMLXS_FCOE_FCFTAB_OFFLINE_REQ;
7321
4602 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
4603 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7322 if (fcftab->flag & EMLXS_FCFTAB_REQ_MASK) {
7323 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4604 "fcftab_offline_action: %s:%s arg=%p flag=%x. "
7324 "fcoe_fcftab_offline_action:%x %s:%s arg=%p flag=%x. "
4605 "Handling request.",
7325 "Handling request.",
4606 emlxs_fcftab_state_xlate(fcftab->state),
7326 fcftab->TID,
7327 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4607 emlxs_fcf_event_xlate(evt), arg1,
4608 fcftab->flag);
4609
7328 emlxs_fcf_event_xlate(evt), arg1,
7329 fcftab->flag);
7330
4610 rval = emlxs_fcftab_req_handler(port, arg1);
7331 rval = emlxs_fcoe_fcftab_req_handler(port, arg1);
4611 return (rval);
4612 }
4613
4614 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7332 return (rval);
7333 }
7334
7335 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4615 "fcftab_offline_action: %s:%s arg=%p fcfi_online=%d. Terminated.",
4616 emlxs_fcftab_state_xlate(fcftab->state),
7336 "fcoe_fcftab_offline_action:%x %s:%s arg=%p fcfi_online=%d. "
7337 "Offline. <",
7338 fcftab->TID,
7339 emlxs_fcoe_fcftab_state_xlate(fcftab->state),
4617 emlxs_fcf_event_xlate(evt), arg1,
4618 fcftab->fcfi_online);
4619
7340 emlxs_fcf_event_xlate(evt), arg1,
7341 fcftab->fcfi_online);
7342
4620 return (0);
7343 return (rval);
4621
7344
4622} /* emlxs_fcftab_offline_action() */
7345} /* emlxs_fcoe_fcftab_offline_action() */
4623
4624
7346
7347
4625/*ARGSUSED*/
4626static uint32_t
4627emlxs_fcftab_shutdown_action(emlxs_port_t *port, uint32_t evt,
4628 void *arg1)
4629{
4630 emlxs_hba_t *hba = HBA;
4631 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
4632 FCFIobj_t *fcfp;
4633 uint32_t i;
4634 uint32_t online;
4635
4636 if (fcftab->state != FCFTAB_STATE_SHUTDOWN) {
4637 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4638 "fcftab_shutdown_action: %s:%s arg=%p. "
4639 "Invalid state. Terminated.",
4640 emlxs_fcftab_state_xlate(fcftab->state),
4641 emlxs_fcf_event_xlate(evt), arg1);
4642 return (1);
4643 }
4644
4645 fcftab->flag &= ~EMLXS_FCFTAB_REQ_MASK;
4646
4647 if (fcftab->prev_state != FCFTAB_STATE_SHUTDOWN) {
4648 /* Offline all FCF's */
4649 fcfp = fcftab->table;
4650 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
4651
4652 if (fcfp->state <= FCFI_STATE_OFFLINE) {
4653 continue;
4654 }
4655
4656 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4657 "fcftab_shutdown_action: fcfi=%d %s "
4658 "fcfi_online=%d. Offlining FCF.",
4659 fcfp->fcf_index,
4660 emlxs_fcfi_state_xlate(fcfp->state),
4661 fcftab->fcfi_online);
4662
4663 (void) emlxs_fcfi_event(port, FCF_EVENT_FCFI_OFFLINE,
4664 fcfp);
4665 }
4666
4667 return (0);
4668 }
4669
4670 /* Check FCF state */
4671 online = 0;
4672 fcfp = fcftab->table;
4673 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
4674
4675 if (fcfp->state <= FCFI_STATE_OFFLINE) {
4676 continue;
4677 }
4678
4679 online++;
4680 }
4681
4682 if (online) {
4683 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4684 "fcftab_shutdown_action: %s:%s arg=%p. "
4685 "fcfi_online=%d,%d Terminated.",
4686 emlxs_fcftab_state_xlate(fcftab->state),
4687 emlxs_fcf_event_xlate(evt), arg1,
4688 online, fcftab->fcfi_online);
4689
4690 return (0);
4691 }
4692
4693 /* Free FCF table */
4694 fcfp = fcftab->table;
4695 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
4696
4697 if (fcfp->state == FCFI_STATE_FREE) {
4698 continue;
4699 }
4700
4701 (void) emlxs_fcfi_free(port, fcfp);
4702 }
4703
4704 /* Clean the selection table */
4705 bzero(fcftab->fcfi, sizeof (fcftab->fcfi));
4706 fcftab->fcfi_count = 0;
4707
4708 fcftab->flag |= EMLXS_FCFTAB_SHUTDOWN;
4709
4710 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
4711 "fcftab_shutdown_action: %s:%s arg=%p flag=%x fcfi_online=%d. "
4712 "Shutdown.",
4713 emlxs_fcftab_state_xlate(fcftab->state),
4714 emlxs_fcf_event_xlate(evt), arg1,
4715 fcftab->flag, fcftab->fcfi_online);
4716
4717 return (0);
4718
4719} /* emlxs_fcftab_shutdown_action() */
4720
4721
4722
4723/* ************************************************************************** */
4724/* FCFI */
4725/* ************************************************************************** */
4726
4727static char *
4728emlxs_fcfi_state_xlate(uint32_t state)
4729{
4730 static char buffer[32];
4731 uint32_t i;
4732 uint32_t count;
4733
4734 count = sizeof (emlxs_fcfi_state_table) / sizeof (emlxs_table_t);
4735 for (i = 0; i < count; i++) {
4736 if (state == emlxs_fcfi_state_table[i].code) {
4737 return (emlxs_fcfi_state_table[i].string);
4738 }
4739 }
4740
7348/* ************************************************************************** */
7349/* FCFI */
7350/* ************************************************************************** */
7351
7352static char *
7353emlxs_fcfi_state_xlate(uint32_t state)
7354{
7355 static char buffer[32];
7356 uint32_t i;
7357 uint32_t count;
7358
7359 count = sizeof (emlxs_fcfi_state_table) / sizeof (emlxs_table_t);
7360 for (i = 0; i < count; i++) {
7361 if (state == emlxs_fcfi_state_table[i].code) {
7362 return (emlxs_fcfi_state_table[i].string);
7363 }
7364 }
7365
4741 (void) sprintf(buffer, "state=0x%x", state);
7366 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
4742 return (buffer);
4743
4744} /* emlxs_fcfi_state_xlate() */
4745
4746
4747static uint32_t
4748emlxs_fcfi_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
4749 void *arg1)
4750{
7367 return (buffer);
7368
7369} /* emlxs_fcfi_state_xlate() */
7370
7371
7372static uint32_t
7373emlxs_fcfi_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
7374 void *arg1)
7375{
4751 uint32_t rval;
7376 uint32_t rval = 0;
4752 uint32_t(*func) (emlxs_port_t *, FCFIobj_t *, uint32_t, void *);
4753 uint32_t index;
4754 uint32_t events;
4755 uint16_t state;
4756
4757 /* Convert event to action table index */
4758 switch (evt) {
4759 case FCF_EVENT_STATE_ENTER:

--- 22 unchanged lines hidden (view full) ---

4782 state = fcfp->state;
4783
4784 index += (state * events);
4785 func = (uint32_t(*) (emlxs_port_t *, FCFIobj_t *, uint32_t, void *))
4786 emlxs_fcfi_action_table[index];
4787
4788 if (!func) {
4789 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
7377 uint32_t(*func) (emlxs_port_t *, FCFIobj_t *, uint32_t, void *);
7378 uint32_t index;
7379 uint32_t events;
7380 uint16_t state;
7381
7382 /* Convert event to action table index */
7383 switch (evt) {
7384 case FCF_EVENT_STATE_ENTER:

--- 22 unchanged lines hidden (view full) ---

7407 state = fcfp->state;
7408
7409 index += (state * events);
7410 func = (uint32_t(*) (emlxs_port_t *, FCFIobj_t *, uint32_t, void *))
7411 emlxs_fcfi_action_table[index];
7412
7413 if (!func) {
7414 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4790 "fcfi:%d %s:%s arg=%p. No action. Terminated.",
7415 "fcfi_action:%d %s:%s arg=%p. No action. <",
4791 fcfp->fcf_index,
4792 emlxs_fcfi_state_xlate(fcfp->state),
4793 emlxs_fcf_event_xlate(evt), arg1);
4794
4795 return (1);
4796 }
4797
4798 rval = (func)(port, fcfp, evt, arg1);

--- 4 unchanged lines hidden (view full) ---

4803
4804
4805static uint32_t
4806emlxs_fcfi_event(emlxs_port_t *port, uint32_t evt,
4807 void *arg1)
4808{
4809 FCFIobj_t *fcfp = NULL;
4810 VFIobj_t *vfip = NULL;
7416 fcfp->fcf_index,
7417 emlxs_fcfi_state_xlate(fcfp->state),
7418 emlxs_fcf_event_xlate(evt), arg1);
7419
7420 return (1);
7421 }
7422
7423 rval = (func)(port, fcfp, evt, arg1);

--- 4 unchanged lines hidden (view full) ---

7428
7429
7430static uint32_t
7431emlxs_fcfi_event(emlxs_port_t *port, uint32_t evt,
7432 void *arg1)
7433{
7434 FCFIobj_t *fcfp = NULL;
7435 VFIobj_t *vfip = NULL;
4811 uint32_t rval;
7436 uint32_t rval = 0;
4812
4813 /* Filter events and acquire fcfi context */
4814 switch (evt) {
4815 case FCF_EVENT_VFI_ONLINE:
4816 case FCF_EVENT_VFI_OFFLINE:
4817 vfip = (VFIobj_t *)arg1;
4818
4819 if (!vfip) {
4820 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
7437
7438 /* Filter events and acquire fcfi context */
7439 switch (evt) {
7440 case FCF_EVENT_VFI_ONLINE:
7441 case FCF_EVENT_VFI_OFFLINE:
7442 vfip = (VFIobj_t *)arg1;
7443
7444 if (!vfip) {
7445 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4821 "fcfi: %s arg=%p. Null VFI found. Terminated.",
7446 "fcfi_event: %s arg=%p. Null VFI found. <",
4822 emlxs_fcf_event_xlate(evt), arg1);
4823
4824 return (1);
4825 }
4826
4827 fcfp = vfip->fcfp;
4828 if (!fcfp) {
4829 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
7447 emlxs_fcf_event_xlate(evt), arg1);
7448
7449 return (1);
7450 }
7451
7452 fcfp = vfip->fcfp;
7453 if (!fcfp) {
7454 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4830 "fcfi: %s arg=%p. FCF not found. Terminated.",
7455 "fcfi_event: %s arg=%p. FCF not found. <",
4831 emlxs_fcf_event_xlate(evt), arg1);
4832
4833 return (1);
4834 }
4835 break;
4836
4837 case FCF_EVENT_FCFI_ONLINE:
4838 case FCF_EVENT_FCFI_OFFLINE:
4839 case FCF_EVENT_FCFI_PAUSE:
4840 fcfp = (FCFIobj_t *)arg1;
4841 if (!fcfp) {
4842 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
7456 emlxs_fcf_event_xlate(evt), arg1);
7457
7458 return (1);
7459 }
7460 break;
7461
7462 case FCF_EVENT_FCFI_ONLINE:
7463 case FCF_EVENT_FCFI_OFFLINE:
7464 case FCF_EVENT_FCFI_PAUSE:
7465 fcfp = (FCFIobj_t *)arg1;
7466 if (!fcfp) {
7467 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4843 "fcfi: %s arg=%p. Null FCFI found. Terminated.",
7468 "fcfi_event: %s arg=%p. Null FCFI found. <",
4844 emlxs_fcf_event_xlate(evt), arg1);
4845
4846 return (1);
4847 }
4848 break;
4849
4850 default:
4851 return (1);
4852 }
4853
4854 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
7469 emlxs_fcf_event_xlate(evt), arg1);
7470
7471 return (1);
7472 }
7473 break;
7474
7475 default:
7476 return (1);
7477 }
7478
7479 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
4855 "fcfi:%d %s:%s arg=%p",
7480 "fcfi_event:%d %s:%s arg=%p",
4856 fcfp->fcf_index,
4857 emlxs_fcfi_state_xlate(fcfp->state),
4858 emlxs_fcf_event_xlate(evt), arg1);
4859
4860 rval = emlxs_fcfi_action(port, fcfp, evt, arg1);
4861
4862 return (rval);
4863

--- 11 unchanged lines hidden (view full) ---

4875 if (state >= FCFI_ACTION_STATES) {
4876 return (1);
4877 }
4878
4879 if ((fcfp->state == state) &&
4880 (reason != FCF_REASON_REENTER)) {
4881 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
4882 "fcfi_state:%d %s:%s:0x%x arg=%p. "
7481 fcfp->fcf_index,
7482 emlxs_fcfi_state_xlate(fcfp->state),
7483 emlxs_fcf_event_xlate(evt), arg1);
7484
7485 rval = emlxs_fcfi_action(port, fcfp, evt, arg1);
7486
7487 return (rval);
7488

--- 11 unchanged lines hidden (view full) ---

7500 if (state >= FCFI_ACTION_STATES) {
7501 return (1);
7502 }
7503
7504 if ((fcfp->state == state) &&
7505 (reason != FCF_REASON_REENTER)) {
7506 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7507 "fcfi_state:%d %s:%s:0x%x arg=%p. "
4883 "State not changed. Terminated.",
7508 "State not changed. <",
4884 fcfp->fcf_index,
4885 emlxs_fcfi_state_xlate(state),
4886 emlxs_fcf_reason_xlate(reason),
4887 explain, arg1);
7509 fcfp->fcf_index,
7510 emlxs_fcfi_state_xlate(state),
7511 emlxs_fcf_reason_xlate(reason),
7512 explain, arg1);
4888
4889 return (1);
4890 }
4891
4892 if (!reason) {
4893 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
7513 return (1);
7514 }
7515
7516 if (!reason) {
7517 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4894 "fcfi:%d %s-->%s arg=%p",
7518 "fcfi_state:%d %s-->%s arg=%p",
4895 fcfp->fcf_index,
4896 emlxs_fcfi_state_xlate(fcfp->state),
4897 emlxs_fcfi_state_xlate(state), arg1);
4898 } else if (reason == FCF_REASON_EVENT) {
4899 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
7519 fcfp->fcf_index,
7520 emlxs_fcfi_state_xlate(fcfp->state),
7521 emlxs_fcfi_state_xlate(state), arg1);
7522 } else if (reason == FCF_REASON_EVENT) {
7523 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4900 "fcfi:%d %s-->%s:%s:%s arg=%p",
7524 "fcfi_state:%d %s-->%s:%s:%s arg=%p",
4901 fcfp->fcf_index,
4902 emlxs_fcfi_state_xlate(fcfp->state),
4903 emlxs_fcfi_state_xlate(state),
4904 emlxs_fcf_reason_xlate(reason),
4905 emlxs_fcf_event_xlate(explain), arg1);
4906 } else if (explain) {
4907 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
7525 fcfp->fcf_index,
7526 emlxs_fcfi_state_xlate(fcfp->state),
7527 emlxs_fcfi_state_xlate(state),
7528 emlxs_fcf_reason_xlate(reason),
7529 emlxs_fcf_event_xlate(explain), arg1);
7530 } else if (explain) {
7531 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4908 "fcfi:%d %s-->%s:%s:0x%x arg=%p",
7532 "fcfi_state:%d %s-->%s:%s:0x%x arg=%p",
4909 fcfp->fcf_index,
4910 emlxs_fcfi_state_xlate(fcfp->state),
4911 emlxs_fcfi_state_xlate(state),
4912 emlxs_fcf_reason_xlate(reason),
4913 explain, arg1);
4914 } else {
4915 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
7533 fcfp->fcf_index,
7534 emlxs_fcfi_state_xlate(fcfp->state),
7535 emlxs_fcfi_state_xlate(state),
7536 emlxs_fcf_reason_xlate(reason),
7537 explain, arg1);
7538 } else {
7539 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
4916 "fcfi:%d %s-->%s:%s arg=%p",
7540 "fcfi_state:%d %s-->%s:%s arg=%p",
4917 fcfp->fcf_index,
4918 emlxs_fcfi_state_xlate(fcfp->state),
4919 emlxs_fcfi_state_xlate(state),
4920 emlxs_fcf_reason_xlate(reason), arg1);
4921 }
4922
4923 fcfp->prev_state = fcfp->state;
4924 fcfp->prev_reason = fcfp->reason;

--- 18 unchanged lines hidden (view full) ---

4943 fcfp = fcftab->table;
4944 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
4945 if (fcfp->state == FCFI_STATE_FREE) {
4946
4947 bzero(fcfp, sizeof (FCFIobj_t));
4948 fcfp->index = i;
4949 fcfp->FCFI = 0xFFFF;
4950
7541 fcfp->fcf_index,
7542 emlxs_fcfi_state_xlate(fcfp->state),
7543 emlxs_fcfi_state_xlate(state),
7544 emlxs_fcf_reason_xlate(reason), arg1);
7545 }
7546
7547 fcfp->prev_state = fcfp->state;
7548 fcfp->prev_reason = fcfp->reason;

--- 18 unchanged lines hidden (view full) ---

7567 fcfp = fcftab->table;
7568 for (i = 0; i < fcftab->table_count; i++, fcfp++) {
7569 if (fcfp->state == FCFI_STATE_FREE) {
7570
7571 bzero(fcfp, sizeof (FCFIobj_t));
7572 fcfp->index = i;
7573 fcfp->FCFI = 0xFFFF;
7574
7575 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7576 "fcfi_alloc:%d. Allocating FCFI. >",
7577 fcfp->index);
7578
4951 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_OFFLINE,
4952 0, 0, 0);
4953 return (fcfp);
4954 }
4955 }
4956
7579 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_OFFLINE,
7580 0, 0, 0);
7581 return (fcfp);
7582 }
7583 }
7584
7585 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7586 "fcfi_alloc: Out of FCFI objects.",
7587 fcfp->index);
7588
4957 return (NULL);
4958
4959} /* emlxs_fcfi_alloc() */
4960
4961
4962static uint32_t
4963emlxs_fcfi_free(emlxs_port_t *port, FCFIobj_t *fcfp)
4964{
7589 return (NULL);
7590
7591} /* emlxs_fcfi_alloc() */
7592
7593
7594static uint32_t
7595emlxs_fcfi_free(emlxs_port_t *port, FCFIobj_t *fcfp)
7596{
4965 uint32_t rval;
7597 uint32_t rval = 0;
4966
4967 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_FREE, 0, 0, 0);
4968
4969 return (rval);
4970
4971} /* emlxs_fcfi_free() */
4972
4973

--- 50 unchanged lines hidden (view full) ---

5024static uint32_t
5025emlxs_fcfi_free_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5026 void *arg1)
5027{
5028
5029 if (fcfp->state != FCFI_STATE_FREE) {
5030 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5031 "fcfi_free_action:%d %s:%s arg=%p. "
7598
7599 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_FREE, 0, 0, 0);
7600
7601 return (rval);
7602
7603} /* emlxs_fcfi_free() */
7604
7605

--- 50 unchanged lines hidden (view full) ---

7656static uint32_t
7657emlxs_fcfi_free_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
7658 void *arg1)
7659{
7660
7661 if (fcfp->state != FCFI_STATE_FREE) {
7662 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7663 "fcfi_free_action:%d %s:%s arg=%p. "
5032 "Invalid state. Terminated.",
7664 "Invalid state. <",
5033 fcfp->fcf_index,
5034 emlxs_fcfi_state_xlate(fcfp->state),
5035 emlxs_fcf_event_xlate(evt), arg1);
5036 return (1);
5037 }
5038
5039 if (fcfp->vfi_online) {
5040 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5041 "fcfi_free_action:%d flag=%x vfi_online=%d",
5042 fcfp->fcf_index,
5043 fcfp->flag,
5044 fcfp->vfi_online);
5045 }
5046
5047 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7665 fcfp->fcf_index,
7666 emlxs_fcfi_state_xlate(fcfp->state),
7667 emlxs_fcf_event_xlate(evt), arg1);
7668 return (1);
7669 }
7670
7671 if (fcfp->vfi_online) {
7672 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7673 "fcfi_free_action:%d flag=%x vfi_online=%d",
7674 fcfp->fcf_index,
7675 fcfp->flag,
7676 fcfp->vfi_online);
7677 }
7678
7679 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5048 "fcfi_free_action:%d flag=%x. FCF freed.",
7680 "fcfi_free_action:%d flag=%x. FCF freed. <",
5049 fcfp->fcf_index,
5050 fcfp->flag);
5051
5052 fcfp->flag = 0;
5053
5054 return (0);
5055
5056} /* emlxs_fcfi_free_action() */
5057
5058
5059/*ARGSUSED*/
5060static uint32_t
5061emlxs_fcfi_offline_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5062 void *arg1)
5063{
5064 emlxs_hba_t *hba = HBA;
5065 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
7681 fcfp->fcf_index,
7682 fcfp->flag);
7683
7684 fcfp->flag = 0;
7685
7686 return (0);
7687
7688} /* emlxs_fcfi_free_action() */
7689
7690
7691/*ARGSUSED*/
7692static uint32_t
7693emlxs_fcfi_offline_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
7694 void *arg1)
7695{
7696 emlxs_hba_t *hba = HBA;
7697 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5066 uint32_t rval;
7698 uint32_t rval = 0;
5067
5068 if (fcfp->state != FCFI_STATE_OFFLINE) {
5069 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5070 "fcfi_offline_action:%d %s:%s arg=%p. "
7699
7700 if (fcfp->state != FCFI_STATE_OFFLINE) {
7701 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7702 "fcfi_offline_action:%d %s:%s arg=%p. "
5071 "Invalid state. Terminated.",
7703 "Invalid state. <",
5072 fcfp->fcf_index,
5073 emlxs_fcfi_state_xlate(fcfp->state),
5074 emlxs_fcf_event_xlate(evt), arg1);
5075 return (1);
5076 }
5077
5078 fcfp->flag &= ~(EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);
5079
5080 if (fcfp->prev_state == FCFI_STATE_FREE) {
5081 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7704 fcfp->fcf_index,
7705 emlxs_fcfi_state_xlate(fcfp->state),
7706 emlxs_fcf_event_xlate(evt), arg1);
7707 return (1);
7708 }
7709
7710 fcfp->flag &= ~(EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);
7711
7712 if (fcfp->prev_state == FCFI_STATE_FREE) {
7713 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5082 "fcfi_offline_action:%d fcfi_online=%d. Terminated.",
7714 "fcfi_offline_action:%d fcfi_online=%d. <",
5083 fcfp->fcf_index,
5084 fcftab->fcfi_online);
5085
5086 return (0);
5087 }
5088
5089 if (fcfp->vfi_online) {
5090 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 21 unchanged lines hidden (view full) ---

5112
5113 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG,
5114 FCF_REASON_REQUESTED, 0, arg1);
5115 return (rval);
5116 }
5117
5118 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5119 "fcfi_offline_action:%d fcfi_online=%d. "
7715 fcfp->fcf_index,
7716 fcftab->fcfi_online);
7717
7718 return (0);
7719 }
7720
7721 if (fcfp->vfi_online) {
7722 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 21 unchanged lines hidden (view full) ---

7744
7745 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG,
7746 FCF_REASON_REQUESTED, 0, arg1);
7747 return (rval);
7748 }
7749
7750 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7751 "fcfi_offline_action:%d fcfi_online=%d. "
5120 "FCFI offline. Notifying fcftab.",
7752 "FCFI offline. Notifying fcftab. >",
5121 fcfp->fcf_index,
5122 fcftab->fcfi_online);
5123
5124 /* Notify FCFTAB */
5125 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFI_OFFLINE, fcfp);
5126
5127 return (rval);
5128
5129} /* emlxs_fcfi_offline_action() */
5130
5131
5132/*ARGSUSED*/
5133static uint32_t
5134emlxs_fcfi_vfi_online_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5135 uint32_t evt, void *arg1)
5136{
7753 fcfp->fcf_index,
7754 fcftab->fcfi_online);
7755
7756 /* Notify FCFTAB */
7757 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFI_OFFLINE, fcfp);
7758
7759 return (rval);
7760
7761} /* emlxs_fcfi_offline_action() */
7762
7763
7764/*ARGSUSED*/
7765static uint32_t
7766emlxs_fcfi_vfi_online_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
7767 uint32_t evt, void *arg1)
7768{
5137 uint32_t rval;
7769 uint32_t rval = 0;
5138
5139 if (evt != FCF_EVENT_VFI_ONLINE) {
5140 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5141 "fcfi_vfi_online_evt_action:%d %s:%s arg=%p flag=%x. "
7770
7771 if (evt != FCF_EVENT_VFI_ONLINE) {
7772 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7773 "fcfi_vfi_online_evt_action:%d %s:%s arg=%p flag=%x. "
5142 "Invalid event type. Terminated.",
7774 "Invalid event type. <",
5143 fcfp->fcf_index,
5144 emlxs_fcfi_state_xlate(fcfp->state),
5145 emlxs_fcf_event_xlate(evt), arg1,
5146 fcfp->flag);
5147 return (1);
5148 }
5149
5150 switch (fcfp->state) {

--- 18 unchanged lines hidden (view full) ---

5169 fcfp->vfi_online);
5170
5171 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_ONLINE_CMPL,
5172 FCF_REASON_EVENT, evt, arg1);
5173 break;
5174
5175 default:
5176 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7775 fcfp->fcf_index,
7776 emlxs_fcfi_state_xlate(fcfp->state),
7777 emlxs_fcf_event_xlate(evt), arg1,
7778 fcfp->flag);
7779 return (1);
7780 }
7781
7782 switch (fcfp->state) {

--- 18 unchanged lines hidden (view full) ---

7801 fcfp->vfi_online);
7802
7803 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_ONLINE_CMPL,
7804 FCF_REASON_EVENT, evt, arg1);
7805 break;
7806
7807 default:
7808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5177 "fcfi_vfi_online_evt_action:%d flag=%x vfi_online=%d. "
5178 "Terminated.",
7809 "fcfi_vfi_online_evt_action:%d flag=%x vfi_online=%d. <",
5179 fcfp->fcf_index,
5180 fcfp->flag,
5181 fcfp->vfi_online);
5182 return (0);
5183 }
5184
5185 return (rval);
5186
5187} /* emlxs_fcfi_vfi_online_evt_action() */
5188
5189
5190/*ARGSUSED*/
5191static uint32_t
5192emlxs_fcfi_offline_handler(emlxs_port_t *port, FCFIobj_t *fcfp, void *arg1)
5193{
7810 fcfp->fcf_index,
7811 fcfp->flag,
7812 fcfp->vfi_online);
7813 return (0);
7814 }
7815
7816 return (rval);
7817
7818} /* emlxs_fcfi_vfi_online_evt_action() */
7819
7820
7821/*ARGSUSED*/
7822static uint32_t
7823emlxs_fcfi_offline_handler(emlxs_port_t *port, FCFIobj_t *fcfp, void *arg1)
7824{
5194 uint32_t rval;
7825 uint32_t rval = 0;
5195
5196 if (!(fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
5197 return (0);
5198 }
5199
7826
7827 if (!(fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
7828 return (0);
7829 }
7830
5200 if (fcfp->vfi_online != 0) {
7831 if (fcfp->vfi_online) {
5201 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {
5202 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_PAUSED,
5203 FCF_REASON_REQUESTED, 0, arg1);
5204 } else {
5205 rval = emlxs_fcfi_state(port, fcfp,
5206 FCFI_STATE_VFI_OFFLINE, FCF_REASON_REQUESTED,
5207 0, arg1);
5208 }

--- 12 unchanged lines hidden (view full) ---

5221} /* emlxs_fcfi_offline_handler() */
5222
5223
5224/*ARGSUSED*/
5225static uint32_t
5226emlxs_fcfi_vfi_offline_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5227 uint32_t evt, void *arg1)
5228{
7832 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {
7833 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_PAUSED,
7834 FCF_REASON_REQUESTED, 0, arg1);
7835 } else {
7836 rval = emlxs_fcfi_state(port, fcfp,
7837 FCFI_STATE_VFI_OFFLINE, FCF_REASON_REQUESTED,
7838 0, arg1);
7839 }

--- 12 unchanged lines hidden (view full) ---

7852} /* emlxs_fcfi_offline_handler() */
7853
7854
7855/*ARGSUSED*/
7856static uint32_t
7857emlxs_fcfi_vfi_offline_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
7858 uint32_t evt, void *arg1)
7859{
5229 uint32_t rval;
7860 uint32_t rval = 0;
5230 VFIobj_t *vfip;
5231
5232 if (evt != FCF_EVENT_VFI_OFFLINE) {
5233 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5234 "fcfi_vfi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
7861 VFIobj_t *vfip;
7862
7863 if (evt != FCF_EVENT_VFI_OFFLINE) {
7864 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7865 "fcfi_vfi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
5235 "Invalid event type. Terminated.",
7866 "Invalid event type. <",
5236 fcfp->fcf_index,
5237 emlxs_fcfi_state_xlate(fcfp->state),
5238 emlxs_fcf_event_xlate(evt), arg1,
5239 fcfp->flag);
5240 return (1);
5241 }
5242
5243 vfip = (VFIobj_t *)arg1;

--- 11 unchanged lines hidden (view full) ---

5255
5256 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5257 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
5258
5259 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
5260 } else {
5261 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5262 "fcfi_vfi_offline_evt_action:%d flag=%x "
7867 fcfp->fcf_index,
7868 emlxs_fcfi_state_xlate(fcfp->state),
7869 emlxs_fcf_event_xlate(evt), arg1,
7870 fcfp->flag);
7871 return (1);
7872 }
7873
7874 vfip = (VFIobj_t *)arg1;

--- 11 unchanged lines hidden (view full) ---

7886
7887 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
7888 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
7889
7890 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
7891 } else {
7892 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7893 "fcfi_vfi_offline_evt_action:%d flag=%x "
5263 "vfi_online=%d. Terminated.",
7894 "vfi_online=%d. <",
5264 fcfp->fcf_index,
5265 fcfp->flag, fcfp->vfi_online);
5266 }
5267 break;
5268
5269 case FCFI_STATE_PAUSED:
5270 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7895 fcfp->fcf_index,
7896 fcfp->flag, fcfp->vfi_online);
7897 }
7898 break;
7899
7900 case FCFI_STATE_PAUSED:
7901 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5271 "fcfi_vfi_offline_evt_action:%d flag=%x vfi_online=%d. "
5272 "Terminated.",
7902 "fcfi_vfi_offline_evt_action:%d flag=%x vfi_online=%d. <",
5273 fcfp->fcf_index,
5274 fcfp->flag, fcfp->vfi_online);
5275 break;
5276
5277 case FCFI_STATE_VFI_OFFLINE:
5278 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5279 "fcfi_vfi_offline_evt_action:%d flag=%x. Offline cmpl.",
5280 fcfp->fcf_index,

--- 12 unchanged lines hidden (view full) ---

5293 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_OFFLINE_CMPL,
5294 FCF_REASON_REENTER, evt, arg1);
5295 break;
5296
5297 default:
5298 if (fcfp->vfi_online == 0) {
5299 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5300 "fcfi_vfi_offline_evt_action:%d flag=%x "
7903 fcfp->fcf_index,
7904 fcfp->flag, fcfp->vfi_online);
7905 break;
7906
7907 case FCFI_STATE_VFI_OFFLINE:
7908 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7909 "fcfi_vfi_offline_evt_action:%d flag=%x. Offline cmpl.",
7910 fcfp->fcf_index,

--- 12 unchanged lines hidden (view full) ---

7923 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_OFFLINE_CMPL,
7924 FCF_REASON_REENTER, evt, arg1);
7925 break;
7926
7927 default:
7928 if (fcfp->vfi_online == 0) {
7929 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7930 "fcfi_vfi_offline_evt_action:%d flag=%x "
5301 "vfi_online=%d. Offline requested.",
7931 "vfi_online=%d. Offline requested. <",
5302 fcfp->fcf_index,
5303 fcfp->flag, fcfp->vfi_online);
5304
5305 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5306 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
5307 } else {
5308 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5309 "fcfi_vfi_offline_evt_action:%d flag = %x "
7932 fcfp->fcf_index,
7933 fcfp->flag, fcfp->vfi_online);
7934
7935 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
7936 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
7937 } else {
7938 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7939 "fcfi_vfi_offline_evt_action:%d flag = %x "
5310 "vfi_online=%d. Terminated.",
7940 "vfi_online=%d. <",
5311 fcfp->fcf_index,
5312 fcfp->flag, fcfp->vfi_online);
5313 }
5314 return (0);
5315 }
5316
5317 return (rval);
5318

--- 5 unchanged lines hidden (view full) ---

5324emlxs_fcfi_online_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5325 uint32_t evt, void *arg1)
5326{
5327 uint32_t rval = 0;
5328
5329 if (evt != FCF_EVENT_FCFI_ONLINE) {
5330 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5331 "fcfi_online_evt_action:%d %s:%s arg=%p. "
7941 fcfp->fcf_index,
7942 fcfp->flag, fcfp->vfi_online);
7943 }
7944 return (0);
7945 }
7946
7947 return (rval);
7948

--- 5 unchanged lines hidden (view full) ---

7954emlxs_fcfi_online_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp,
7955 uint32_t evt, void *arg1)
7956{
7957 uint32_t rval = 0;
7958
7959 if (evt != FCF_EVENT_FCFI_ONLINE) {
7960 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7961 "fcfi_online_evt_action:%d %s:%s arg=%p. "
5332 "Invalid event type. Terminated.",
7962 "Invalid event type. <",
5333 fcfp->fcf_index,
5334 emlxs_fcfi_state_xlate(fcfp->state),
5335 emlxs_fcf_event_xlate(evt), arg1);
5336 return (1);
5337 }
5338
5339 if (fcfp->flag & EMLXS_FCFI_ONLINE_REQ) {
5340 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5341 "fcfi_online_evt_action:%d. "
7963 fcfp->fcf_index,
7964 emlxs_fcfi_state_xlate(fcfp->state),
7965 emlxs_fcf_event_xlate(evt), arg1);
7966 return (1);
7967 }
7968
7969 if (fcfp->flag & EMLXS_FCFI_ONLINE_REQ) {
7970 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7971 "fcfi_online_evt_action:%d. "
5342 "Online already requested. Terminated.",
7972 "Online already requested. <",
5343 fcfp->fcf_index);
5344 return (1);
5345 }
5346
5347 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5348 fcfp->flag |= EMLXS_FCFI_ONLINE_REQ;
5349
5350 switch (fcfp->state) {

--- 25 unchanged lines hidden (view full) ---

5376 fcfp->flag);
5377
5378 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_ONLINE,
5379 FCF_REASON_REENTER, evt, arg1);
5380 break;
5381
5382 default:
5383 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7973 fcfp->fcf_index);
7974 return (1);
7975 }
7976
7977 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
7978 fcfp->flag |= EMLXS_FCFI_ONLINE_REQ;
7979
7980 switch (fcfp->state) {

--- 25 unchanged lines hidden (view full) ---

8006 fcfp->flag);
8007
8008 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_ONLINE,
8009 FCF_REASON_REENTER, evt, arg1);
8010 break;
8011
8012 default:
8013 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5384 "fcfi_online_evt_action:%d flag=%x. Terminated.",
8014 "fcfi_online_evt_action:%d flag=%x. <",
5385 fcfp->fcf_index,
5386 fcfp->flag);
5387 break;
5388 }
5389
5390 return (rval);
5391
5392} /* emlxs_fcfi_online_evt_action() */
5393
5394
5395/*ARGSUSED*/
5396static uint32_t
5397emlxs_fcfi_vfi_online_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5398 uint32_t evt, void *arg1)
5399{
5400 emlxs_hba_t *hba = HBA;
5401 uint32_t i;
8015 fcfp->fcf_index,
8016 fcfp->flag);
8017 break;
8018 }
8019
8020 return (rval);
8021
8022} /* emlxs_fcfi_online_evt_action() */
8023
8024
8025/*ARGSUSED*/
8026static uint32_t
8027emlxs_fcfi_vfi_online_action(emlxs_port_t *port, FCFIobj_t *fcfp,
8028 uint32_t evt, void *arg1)
8029{
8030 emlxs_hba_t *hba = HBA;
8031 uint32_t i;
5402 uint32_t rval;
8032 uint32_t rval = 0;
5403 VFIobj_t *vfip;
5404
5405 if (fcfp->state != FCFI_STATE_VFI_ONLINE) {
5406 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5407 "fcfi_vfi_online_action:%d %s:%s arg=%p. "
8033 VFIobj_t *vfip;
8034
8035 if (fcfp->state != FCFI_STATE_VFI_ONLINE) {
8036 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8037 "fcfi_vfi_online_action:%d %s:%s arg=%p. "
5408 "Invalid state. Terminated.",
8038 "Invalid state. <",
5409 fcfp->fcf_index,
5410 emlxs_fcfi_state_xlate(fcfp->state),
5411 emlxs_fcf_event_xlate(evt), arg1);
5412 return (1);
5413 }
5414
5415 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
5416 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 37 unchanged lines hidden (view full) ---

5454 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5455 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
5456
5457 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
5458 return (rval);
5459 }
5460
5461 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8039 fcfp->fcf_index,
8040 emlxs_fcfi_state_xlate(fcfp->state),
8041 emlxs_fcf_event_xlate(evt), arg1);
8042 return (1);
8043 }
8044
8045 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
8046 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 37 unchanged lines hidden (view full) ---

8084 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
8085 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
8086
8087 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
8088 return (rval);
8089 }
8090
8091 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5462 "fcfi_vfi_online_action:%d vfi_online=%d. Onlining VFI:%d.",
8092 "fcfi_vfi_online_action:%d vfi_online=%d. Onlining VFI:%d. >",
5463 fcfp->fcf_index,
5464 fcfp->vfi_online,
5465 vfip->VFI);
5466
5467 rval = emlxs_vfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
5468
5469 /* Wait for FCF_EVENT_VFI_ONLINE in return */
5470
5471 return (rval);
5472
5473} /* emlxs_fcfi_vfi_online_action() */
5474
5475
5476/*ARGSUSED*/
5477static uint32_t
5478emlxs_fcfi_vfi_online_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5479 uint32_t evt, void *arg1)
5480{
8093 fcfp->fcf_index,
8094 fcfp->vfi_online,
8095 vfip->VFI);
8096
8097 rval = emlxs_vfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
8098
8099 /* Wait for FCF_EVENT_VFI_ONLINE in return */
8100
8101 return (rval);
8102
8103} /* emlxs_fcfi_vfi_online_action() */
8104
8105
8106/*ARGSUSED*/
8107static uint32_t
8108emlxs_fcfi_vfi_online_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp,
8109 uint32_t evt, void *arg1)
8110{
5481 uint32_t rval;
8111 uint32_t rval = 0;
5482
5483 if (fcfp->state != FCFI_STATE_VFI_ONLINE_CMPL) {
5484 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5485 "fcfi_vfi_online_cmpl_action:%d %s:%s arg=%p. "
8112
8113 if (fcfp->state != FCFI_STATE_VFI_ONLINE_CMPL) {
8114 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8115 "fcfi_vfi_online_cmpl_action:%d %s:%s arg=%p. "
5486 "Invalid state. Terminated.",
8116 "Invalid state. <",
5487 fcfp->fcf_index,
5488 emlxs_fcfi_state_xlate(fcfp->state),
5489 emlxs_fcf_event_xlate(evt), arg1);
5490 return (1);
5491 }
5492
5493 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5494 "fcfi_vfi_online_cmpl_action:%d. Going online.",

--- 9 unchanged lines hidden (view full) ---

5504
5505/*ARGSUSED*/
5506static uint32_t
5507emlxs_fcfi_vfi_offline_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5508 void *arg1)
5509{
5510 emlxs_hba_t *hba = HBA;
5511 VFIobj_t *vfip;
8117 fcfp->fcf_index,
8118 emlxs_fcfi_state_xlate(fcfp->state),
8119 emlxs_fcf_event_xlate(evt), arg1);
8120 return (1);
8121 }
8122
8123 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8124 "fcfi_vfi_online_cmpl_action:%d. Going online.",

--- 9 unchanged lines hidden (view full) ---

8134
8135/*ARGSUSED*/
8136static uint32_t
8137emlxs_fcfi_vfi_offline_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8138 void *arg1)
8139{
8140 emlxs_hba_t *hba = HBA;
8141 VFIobj_t *vfip;
5512 uint32_t rval;
8142 uint32_t rval = 0;
5513 int32_t i;
5514
5515 if (fcfp->state != FCFI_STATE_VFI_OFFLINE) {
5516 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5517 "fcfi_vfi_offline_action:%d %s:%s arg=%p. "
8143 int32_t i;
8144
8145 if (fcfp->state != FCFI_STATE_VFI_OFFLINE) {
8146 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8147 "fcfi_vfi_offline_action:%d %s:%s arg=%p. "
5518 "Invalid state. Terminated.",
8148 "Invalid state. <",
5519 fcfp->fcf_index,
5520 emlxs_fcfi_state_xlate(fcfp->state),
5521 emlxs_fcf_event_xlate(evt), arg1);
5522
5523 return (1);
5524 }
5525
5526 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {

--- 26 unchanged lines hidden (view full) ---

5553
5554 if ((vfip->fcfp != fcfp) ||
5555 (vfip->state == VFI_STATE_OFFLINE) ||
5556 (vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
5557 continue;
5558 }
5559
5560 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8149 fcfp->fcf_index,
8150 emlxs_fcfi_state_xlate(fcfp->state),
8151 emlxs_fcf_event_xlate(evt), arg1);
8152
8153 return (1);
8154 }
8155
8156 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {

--- 26 unchanged lines hidden (view full) ---

8183
8184 if ((vfip->fcfp != fcfp) ||
8185 (vfip->state == VFI_STATE_OFFLINE) ||
8186 (vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
8187 continue;
8188 }
8189
8190 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5561 "fcfi_vfi_offline_action:%d. Offlining VFI:%d",
8191 "fcfi_vfi_offline_action:%d. Offlining VFI:%d >",
5562 fcfp->fcf_index,
5563 vfip->VFI);
5564
5565 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_OFFLINE, vfip);
5566 }
5567
5568 /* Wait for FCF_EVENT_VFI_OFFLINE in return */
5569

--- 9 unchanged lines hidden (view full) ---

5579{
5580 emlxs_hba_t *hba = HBA;
5581 VFIobj_t *vfip;
5582 int32_t i;
5583
5584 if (fcfp->state != FCFI_STATE_PAUSED) {
5585 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5586 "fcfi_paused_action:%d %s:%s arg=%p. "
8192 fcfp->fcf_index,
8193 vfip->VFI);
8194
8195 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_OFFLINE, vfip);
8196 }
8197
8198 /* Wait for FCF_EVENT_VFI_OFFLINE in return */
8199

--- 9 unchanged lines hidden (view full) ---

8209{
8210 emlxs_hba_t *hba = HBA;
8211 VFIobj_t *vfip;
8212 int32_t i;
8213
8214 if (fcfp->state != FCFI_STATE_PAUSED) {
8215 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8216 "fcfi_paused_action:%d %s:%s arg=%p. "
5587 "Invalid state. Terminated.",
8217 "Invalid state. <",
5588 fcfp->fcf_index,
5589 emlxs_fcfi_state_xlate(fcfp->state),
5590 emlxs_fcf_event_xlate(evt), arg1);
5591
5592 return (1);
5593 }
5594
5595 fcfp->flag &= ~(EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);

--- 4 unchanged lines hidden (view full) ---

5600
5601 if ((vfip->state == VFI_STATE_OFFLINE) ||
5602 (vfip->state == VFI_STATE_PAUSED) ||
5603 (vfip->fcfp != fcfp)) {
5604 continue;
5605 }
5606
5607 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8218 fcfp->fcf_index,
8219 emlxs_fcfi_state_xlate(fcfp->state),
8220 emlxs_fcf_event_xlate(evt), arg1);
8221
8222 return (1);
8223 }
8224
8225 fcfp->flag &= ~(EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);

--- 4 unchanged lines hidden (view full) ---

8230
8231 if ((vfip->state == VFI_STATE_OFFLINE) ||
8232 (vfip->state == VFI_STATE_PAUSED) ||
8233 (vfip->fcfp != fcfp)) {
8234 continue;
8235 }
8236
8237 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5608 "fcfi_paused_action:%d vfi_online=%d. Pausing VFI:%d.",
8238 "fcfi_paused_action:%d vfi_online=%d. Pausing VFI:%d. >",
5609 fcfp->fcf_index,
5610 fcfp->vfi_online,
5611 vfip->VFI);
5612
5613 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_PAUSE, vfip);
5614 }
5615
5616 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8239 fcfp->fcf_index,
8240 fcfp->vfi_online,
8241 vfip->VFI);
8242
8243 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_PAUSE, vfip);
8244 }
8245
8246 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5617 "fcfi_paused_action:%d vfi_online=%d. FCFI paused.",
8247 "fcfi_paused_action:%d vfi_online=%d. FCFI paused. <",
5618 fcfp->fcf_index,
5619 fcfp->vfi_online);
5620
5621 return (0);
5622
5623} /* emlxs_fcfi_paused_action() */
5624
5625
5626/*ARGSUSED*/
5627static uint32_t
5628emlxs_fcfi_vfi_offline_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5629 uint32_t evt, void *arg1)
5630{
5631 uint32_t rval = 0;
5632
5633 if (fcfp->state != FCFI_STATE_VFI_OFFLINE_CMPL) {
5634 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5635 "fcfi_vfi_offline_cmpl_action:%d %s:%s arg=%p. "
8248 fcfp->fcf_index,
8249 fcfp->vfi_online);
8250
8251 return (0);
8252
8253} /* emlxs_fcfi_paused_action() */
8254
8255
8256/*ARGSUSED*/
8257static uint32_t
8258emlxs_fcfi_vfi_offline_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp,
8259 uint32_t evt, void *arg1)
8260{
8261 uint32_t rval = 0;
8262
8263 if (fcfp->state != FCFI_STATE_VFI_OFFLINE_CMPL) {
8264 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8265 "fcfi_vfi_offline_cmpl_action:%d %s:%s arg=%p. "
5636 "Invalid state. Terminated.",
8266 "Invalid state. <",
5637 fcfp->fcf_index,
5638 emlxs_fcfi_state_xlate(fcfp->state),
5639 emlxs_fcf_event_xlate(evt), arg1);
5640 return (1);
5641 }
5642
5643 if ((fcfp->vfi_online == 0) &&
5644 (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
5645 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5646 "fcfi_vfi_offline_cmpl_action:%d vfi_online=%d. "
5647 "Unregistering.",
5648 fcfp->fcf_index,
5649 fcfp->vfi_online);
5650
5651 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG,
5652 FCF_REASON_EVENT, evt, arg1);
5653 } else {
5654 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8267 fcfp->fcf_index,
8268 emlxs_fcfi_state_xlate(fcfp->state),
8269 emlxs_fcf_event_xlate(evt), arg1);
8270 return (1);
8271 }
8272
8273 if ((fcfp->vfi_online == 0) &&
8274 (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ)) {
8275 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8276 "fcfi_vfi_offline_cmpl_action:%d vfi_online=%d. "
8277 "Unregistering.",
8278 fcfp->fcf_index,
8279 fcfp->vfi_online);
8280
8281 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG,
8282 FCF_REASON_EVENT, evt, arg1);
8283 } else {
8284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5655 "fcfi_vfi_offline_cmpl_action:%d vfi_online=%d. "
5656 "Terminated.",
8285 "fcfi_vfi_offline_cmpl_action:%d vfi_online=%d. <",
5657 fcfp->fcf_index,
5658 fcfp->vfi_online);
5659 }
5660
5661 return (rval);
5662
5663} /* emlxs_fcfi_vfi_offline_cmpl_action() */
5664
5665
5666/*ARGSUSED*/
5667static uint32_t
5668emlxs_fcfi_offline_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5669 void *arg1)
5670{
8286 fcfp->fcf_index,
8287 fcfp->vfi_online);
8288 }
8289
8290 return (rval);
8291
8292} /* emlxs_fcfi_vfi_offline_cmpl_action() */
8293
8294
8295/*ARGSUSED*/
8296static uint32_t
8297emlxs_fcfi_offline_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8298 void *arg1)
8299{
5671 uint32_t rval;
8300 uint32_t rval = 0;
5672
5673 if (evt != FCF_EVENT_FCFI_OFFLINE) {
5674 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5675 "fcfi_offline_evt_action:%d %s:%s arg=%p. "
8301
8302 if (evt != FCF_EVENT_FCFI_OFFLINE) {
8303 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8304 "fcfi_offline_evt_action:%d %s:%s arg=%p. "
5676 "Invalid event type. Terminated.",
8305 "Invalid event type. <",
5677 fcfp->fcf_index,
5678 emlxs_fcfi_state_xlate(fcfp->state),
5679 emlxs_fcf_event_xlate(evt), arg1);
5680 return (1);
5681 }
5682
5683 if ((fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) &&
5684 !(fcfp->flag & EMLXS_FCFI_PAUSE_REQ)) {
5685 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8306 fcfp->fcf_index,
8307 emlxs_fcfi_state_xlate(fcfp->state),
8308 emlxs_fcf_event_xlate(evt), arg1);
8309 return (1);
8310 }
8311
8312 if ((fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) &&
8313 !(fcfp->flag & EMLXS_FCFI_PAUSE_REQ)) {
8314 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5686 "fcfi_offline_evt_action:%d. Offline already requested. "
5687 "Terminated.",
8315 "fcfi_offline_evt_action:%d. Offline already requested. <",
5688 fcfp->fcf_index);
5689 return (1);
5690 }
5691
5692 switch (fcfp->state) {
5693 case FCFI_STATE_OFFLINE:
5694 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8316 fcfp->fcf_index);
8317 return (1);
8318 }
8319
8320 switch (fcfp->state) {
8321 case FCFI_STATE_OFFLINE:
8322 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5695 "fcfi_offline_evt_action:%d flag=%x. Already offline. "
5696 "Terminated.",
8323 "fcfi_offline_evt_action:%d flag=%x. Already offline. <",
5697 fcfp->fcf_index,
5698 fcfp->flag);
5699 break;
5700
5701 /* Wait states */
5702 case FCFI_STATE_VFI_ONLINE:
5703 case FCFI_STATE_VFI_OFFLINE:
5704 case FCFI_STATE_REG:

--- 13 unchanged lines hidden (view full) ---

5718
5719 /* Transitional states */
5720 default:
5721 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5722 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
5723
5724 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5725 "fcfi_offline_evt_action:%d. "
8324 fcfp->fcf_index,
8325 fcfp->flag);
8326 break;
8327
8328 /* Wait states */
8329 case FCFI_STATE_VFI_ONLINE:
8330 case FCFI_STATE_VFI_OFFLINE:
8331 case FCFI_STATE_REG:

--- 13 unchanged lines hidden (view full) ---

8345
8346 /* Transitional states */
8347 default:
8348 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
8349 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
8350
8351 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8352 "fcfi_offline_evt_action:%d. "
5726 "Invalid state. Terminated.",
8353 "Invalid state. <",
5727 fcfp->fcf_index);
5728 break;
5729 }
5730
5731 return (rval);
5732
5733} /* emlxs_fcfi_offline_evt_action() */
5734
5735
5736/*ARGSUSED*/
5737static uint32_t
5738emlxs_fcfi_pause_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5739 void *arg1)
5740{
8354 fcfp->fcf_index);
8355 break;
8356 }
8357
8358 return (rval);
8359
8360} /* emlxs_fcfi_offline_evt_action() */
8361
8362
8363/*ARGSUSED*/
8364static uint32_t
8365emlxs_fcfi_pause_evt_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8366 void *arg1)
8367{
5741 uint32_t rval;
8368 uint32_t rval = 0;
5742
5743 if (evt != FCF_EVENT_FCFI_PAUSE) {
5744 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5745 "fcfi_pause_evt_action:%d %s:%s arg=%p. "
8369
8370 if (evt != FCF_EVENT_FCFI_PAUSE) {
8371 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8372 "fcfi_pause_evt_action:%d %s:%s arg=%p. "
5746 "Invalid event type. Terminated.",
8373 "Invalid event type. <",
5747 fcfp->fcf_index,
5748 emlxs_fcfi_state_xlate(fcfp->state),
5749 emlxs_fcf_event_xlate(evt), arg1);
5750 return (1);
5751 }
5752
5753 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {
5754 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8374 fcfp->fcf_index,
8375 emlxs_fcfi_state_xlate(fcfp->state),
8376 emlxs_fcf_event_xlate(evt), arg1);
8377 return (1);
8378 }
8379
8380 if (fcfp->flag & EMLXS_FCFI_PAUSE_REQ) {
8381 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5755 "fcfi_pause_evt_action:%d. Pause already requested. "
5756 "Terminated.",
8382 "fcfi_pause_evt_action:%d. Pause already requested. <",
5757 fcfp->fcf_index);
5758 return (1);
5759 }
5760
5761 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
5762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8383 fcfp->fcf_index);
8384 return (1);
8385 }
8386
8387 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
8388 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5763 "fcfi_pause_evt_action:%d. Offline already requested. "
5764 "Terminated.",
8389 "fcfi_pause_evt_action:%d. Offline already requested. <",
5765 fcfp->fcf_index);
5766 return (1);
5767 }
5768
5769 switch (fcfp->state) {
5770 case FCFI_STATE_OFFLINE:
5771 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8390 fcfp->fcf_index);
8391 return (1);
8392 }
8393
8394 switch (fcfp->state) {
8395 case FCFI_STATE_OFFLINE:
8396 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5772 "fcfi_pause_evt_action:%d flag=%x. Already offline. "
5773 "Terminated.",
8397 "fcfi_pause_evt_action:%d flag=%x. Already offline. <",
5774 fcfp->fcf_index,
5775 fcfp->flag);
5776 break;
5777
5778 case FCFI_STATE_PAUSED:
5779 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8398 fcfp->fcf_index,
8399 fcfp->flag);
8400 break;
8401
8402 case FCFI_STATE_PAUSED:
8403 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5780 "fcfi_pause_evt_action:%d flag=%x. Already paused. "
5781 "Terminated.",
8404 "fcfi_pause_evt_action:%d flag=%x. Already paused. <",
5782 fcfp->fcf_index,
5783 fcfp->flag);
5784 break;
5785
5786 /* Wait states */
5787 case FCFI_STATE_VFI_ONLINE:
5788 case FCFI_STATE_VFI_OFFLINE:
5789 case FCFI_STATE_REG:

--- 12 unchanged lines hidden (view full) ---

5802
5803 /* Transitional states */
5804 default:
5805 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5806 fcfp->flag |= (EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);
5807
5808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5809 "fcfi_pause_evt_action:%d. "
8405 fcfp->fcf_index,
8406 fcfp->flag);
8407 break;
8408
8409 /* Wait states */
8410 case FCFI_STATE_VFI_ONLINE:
8411 case FCFI_STATE_VFI_OFFLINE:
8412 case FCFI_STATE_REG:

--- 12 unchanged lines hidden (view full) ---

8425
8426 /* Transitional states */
8427 default:
8428 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
8429 fcfp->flag |= (EMLXS_FCFI_OFFLINE_REQ | EMLXS_FCFI_PAUSE_REQ);
8430
8431 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8432 "fcfi_pause_evt_action:%d. "
5810 "Invalid state. Terminated.",
8433 "Invalid state. <",
5811 fcfp->fcf_index);
5812 break;
5813 }
5814
5815 return (rval);
5816
5817} /* emlxs_fcfi_pause_evt_action() */
5818
5819
5820/*ARGSUSED*/
5821static uint32_t
5822emlxs_fcfi_unreg_failed_action(emlxs_port_t *port, FCFIobj_t *fcfp,
5823 uint32_t evt, void *arg1)
5824{
8434 fcfp->fcf_index);
8435 break;
8436 }
8437
8438 return (rval);
8439
8440} /* emlxs_fcfi_pause_evt_action() */
8441
8442
8443/*ARGSUSED*/
8444static uint32_t
8445emlxs_fcfi_unreg_failed_action(emlxs_port_t *port, FCFIobj_t *fcfp,
8446 uint32_t evt, void *arg1)
8447{
5825 uint32_t rval;
8448 uint32_t rval = 0;
5826
5827 fcfp->attempts++;
5828
5829 if (fcfp->state != FCFI_STATE_UNREG_FAILED) {
5830 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5831 "fcfi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
8449
8450 fcfp->attempts++;
8451
8452 if (fcfp->state != FCFI_STATE_UNREG_FAILED) {
8453 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8454 "fcfi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
5832 "Invalid state. Terminated.",
8455 "Invalid state. <",
5833 fcfp->fcf_index,
5834 emlxs_fcfi_state_xlate(fcfp->state),
5835 emlxs_fcf_event_xlate(evt),
5836 arg1, fcfp->attempts);
8456 fcfp->fcf_index,
8457 emlxs_fcfi_state_xlate(fcfp->state),
8458 emlxs_fcf_event_xlate(evt),
8459 arg1, fcfp->attempts);
5837
5838 return (1);
5839 }
5840
5841 if ((fcfp->reason == FCF_REASON_SEND_FAILED) ||
5842 (fcfp->attempts >= 3)) {
5843 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5844 "fcfi_unreg_failed_action:%d attempt=%d reason=%x. "
5845 "Unreg cmpl.",

--- 20 unchanged lines hidden (view full) ---

5866} /* emlxs_fcfi_unreg_failed_action() */
5867
5868
5869/*ARGSUSED*/
5870static uint32_t
5871emlxs_fcfi_reg_failed_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5872 void *arg1)
5873{
8460 return (1);
8461 }
8462
8463 if ((fcfp->reason == FCF_REASON_SEND_FAILED) ||
8464 (fcfp->attempts >= 3)) {
8465 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8466 "fcfi_unreg_failed_action:%d attempt=%d reason=%x. "
8467 "Unreg cmpl.",

--- 20 unchanged lines hidden (view full) ---

8488} /* emlxs_fcfi_unreg_failed_action() */
8489
8490
8491/*ARGSUSED*/
8492static uint32_t
8493emlxs_fcfi_reg_failed_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8494 void *arg1)
8495{
5874 uint32_t rval;
8496 uint32_t rval = 0;
5875
5876 fcfp->attempts++;
5877
5878 if (fcfp->state != FCFI_STATE_REG_FAILED) {
5879 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5880 "fcfi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
8497
8498 fcfp->attempts++;
8499
8500 if (fcfp->state != FCFI_STATE_REG_FAILED) {
8501 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8502 "fcfi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
5881 "Invalid state. Terminated.",
8503 "Invalid state. <",
5882 fcfp->fcf_index,
5883 emlxs_fcfi_state_xlate(fcfp->state),
5884 emlxs_fcf_event_xlate(evt), arg1,
5885 fcfp->attempts);
8504 fcfp->fcf_index,
8505 emlxs_fcfi_state_xlate(fcfp->state),
8506 emlxs_fcf_event_xlate(evt), arg1,
8507 fcfp->attempts);
5886
5887 return (1);
5888 }
5889
5890 if ((fcfp->reason == FCF_REASON_SEND_FAILED) ||
5891 (fcfp->attempts >= 3)) {
5892 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5893 "fcfi_reg_failed_action:%d attempt=%d reason=%x. Reg cmpl.",
5894 fcfp->fcf_index,
5895 fcfp->attempts,
5896 fcfp->reason);
5897
8508 return (1);
8509 }
8510
8511 if ((fcfp->reason == FCF_REASON_SEND_FAILED) ||
8512 (fcfp->attempts >= 3)) {
8513 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8514 "fcfi_reg_failed_action:%d attempt=%d reason=%x. Reg cmpl.",
8515 fcfp->fcf_index,
8516 fcfp->attempts,
8517 fcfp->reason);
8518
5898 fcfp->flag &= ~EMLXS_FCFI_REG;
5899 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
5900 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
5901
5902 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_CMPL,
5903 FCF_REASON_OP_FAILED, fcfp->attempts, arg1);
5904 } else {
5905 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5906 "fcfi_reg_failed_action:%d attempt=%d. Registering.",

--- 19 unchanged lines hidden (view full) ---

5926
5927 fcfp = (FCFIobj_t *)mbq->context;
5928 mb4 = (MAILBOX4 *)mbq;
5929
5930 mutex_enter(&EMLXS_FCF_LOCK);
5931
5932 if (fcfp->state != FCFI_STATE_REG) {
5933 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8519 fcfp->flag &= ~EMLXS_FCFI_REQ_MASK;
8520 fcfp->flag |= EMLXS_FCFI_OFFLINE_REQ;
8521
8522 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_CMPL,
8523 FCF_REASON_OP_FAILED, fcfp->attempts, arg1);
8524 } else {
8525 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8526 "fcfi_reg_failed_action:%d attempt=%d. Registering.",

--- 19 unchanged lines hidden (view full) ---

8546
8547 fcfp = (FCFIobj_t *)mbq->context;
8548 mb4 = (MAILBOX4 *)mbq;
8549
8550 mutex_enter(&EMLXS_FCF_LOCK);
8551
8552 if (fcfp->state != FCFI_STATE_REG) {
8553 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5934 "fcfi_reg_mbcmpl:%d state=%s. Terminated.",
8554 "fcfi_reg_mbcmpl:%d state=%s.",
5935 fcfp->fcf_index,
5936 emlxs_fcfi_state_xlate(fcfp->state));
5937
5938 mutex_exit(&EMLXS_FCF_LOCK);
5939 return (0);
5940 }
5941
5942 if (mb4->mbxStatus) {
5943 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8555 fcfp->fcf_index,
8556 emlxs_fcfi_state_xlate(fcfp->state));
8557
8558 mutex_exit(&EMLXS_FCF_LOCK);
8559 return (0);
8560 }
8561
8562 if (mb4->mbxStatus) {
8563 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5944 "fcfi_reg_mbcmpl:%d failed. status=%x",
8564 "fcfi_reg_mbcmpl:%d failed. %s. >",
5945 fcfp->fcf_index,
8565 fcfp->fcf_index,
5946 mb4->mbxStatus);
8566 emlxs_mb_xlate_status(mb4->mbxStatus));
5947
5948 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_FAILED,
5949 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
5950
5951 mutex_exit(&EMLXS_FCF_LOCK);
5952 return (0);
5953 }
5954
5955 fcfp->FCFI = mb4->un.varRegFCFI.FCFI;
5956
5957 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8567
8568 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_FAILED,
8569 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
8570
8571 mutex_exit(&EMLXS_FCF_LOCK);
8572 return (0);
8573 }
8574
8575 fcfp->FCFI = mb4->un.varRegFCFI.FCFI;
8576
8577 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
5958 "fcfi_reg_mbcmpl:%d Registered. FCFI=%d",
8578 "fcfi_reg_mbcmpl:%d FCFI=%d. Reg complete. >",
5959 fcfp->fcf_index,
5960 fcfp->FCFI);
5961
5962 fcfp->flag |= EMLXS_FCFI_REG;
5963
5964 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_CMPL,
5965 0, 0, 0);
5966 mutex_exit(&EMLXS_FCF_LOCK);

--- 6 unchanged lines hidden (view full) ---

5973static uint32_t
5974emlxs_fcfi_reg_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
5975 void *arg1)
5976{
5977 emlxs_hba_t *hba = HBA;
5978 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
5979 MAILBOX4 *mb4;
5980 MAILBOXQ *mbq;
8579 fcfp->fcf_index,
8580 fcfp->FCFI);
8581
8582 fcfp->flag |= EMLXS_FCFI_REG;
8583
8584 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_CMPL,
8585 0, 0, 0);
8586 mutex_exit(&EMLXS_FCF_LOCK);

--- 6 unchanged lines hidden (view full) ---

8593static uint32_t
8594emlxs_fcfi_reg_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8595 void *arg1)
8596{
8597 emlxs_hba_t *hba = HBA;
8598 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
8599 MAILBOX4 *mb4;
8600 MAILBOXQ *mbq;
5981 uint32_t rval;
8601 uint32_t rval = 0;
5982
5983 if (fcfp->state != FCFI_STATE_REG) {
5984 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
5985 "fcfi_reg_action:%d %s:%s arg=%p. "
8602
8603 if (fcfp->state != FCFI_STATE_REG) {
8604 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8605 "fcfi_reg_action:%d %s:%s arg=%p. "
5986 "Invalid state. Terminated.",
8606 "Invalid state. <",
5987 fcfp->fcf_index,
5988 emlxs_fcfi_state_xlate(fcfp->state),
5989 emlxs_fcf_event_xlate(evt), arg1);
5990 return (1);
5991 }
5992
5993 if (!(fcfp->flag & EMLXS_FCFI_FCFTAB)) {
5994 fcfp->flag |= EMLXS_FCFI_FCFTAB;

--- 11 unchanged lines hidden (view full) ---

6006 fcfp->attempts);
6007
6008 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
6009 return (rval);
6010 }
6011
6012 if (fcfp->flag & EMLXS_FCFI_REG) {
6013 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8607 fcfp->fcf_index,
8608 emlxs_fcfi_state_xlate(fcfp->state),
8609 emlxs_fcf_event_xlate(evt), arg1);
8610 return (1);
8611 }
8612
8613 if (!(fcfp->flag & EMLXS_FCFI_FCFTAB)) {
8614 fcfp->flag |= EMLXS_FCFI_FCFTAB;

--- 11 unchanged lines hidden (view full) ---

8626 fcfp->attempts);
8627
8628 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
8629 return (rval);
8630 }
8631
8632 if (fcfp->flag & EMLXS_FCFI_REG) {
8633 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6014 "fcfi_reg_action:%d. Already registered. Skipping reg.",
8634 "fcfi_reg_action:%d. Already registered. "
8635 "Skipping REG_FCFI update.",
6015 fcfp->fcf_index);
6016
6017 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_ONLINE,
6018 FCF_REASON_EVENT, evt, arg1);
6019 return (rval);
6020 }
6021
6022 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8636 fcfp->fcf_index);
8637
8638 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_VFI_ONLINE,
8639 FCF_REASON_EVENT, evt, arg1);
8640 return (rval);
8641 }
8642
8643 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6023 "fcfi_reg_action:%d attempts=%d. Sending FCFI_REG.",
8644 "fcfi_reg_action:%d attempts=%d. Sending REG_FCFI. <",
6024 fcfp->fcf_index,
6025 fcfp->attempts);
6026
8645 fcfp->fcf_index,
8646 fcfp->attempts);
8647
6027 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
8648 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
6028 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_FAILED,
6029 FCF_REASON_NO_MBOX, 0, arg1);
6030
6031 return (rval);
6032 }
6033 mb4 = (MAILBOX4*)mbq;
6034 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
6035

--- 39 unchanged lines hidden (view full) ---

6075} /* emlxs_fcfi_reg_action() */
6076
6077
6078/*ARGSUSED*/
6079static uint32_t
6080emlxs_fcfi_reg_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
6081 void *arg1)
6082{
8649 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_REG_FAILED,
8650 FCF_REASON_NO_MBOX, 0, arg1);
8651
8652 return (rval);
8653 }
8654 mb4 = (MAILBOX4*)mbq;
8655 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
8656

--- 39 unchanged lines hidden (view full) ---

8696} /* emlxs_fcfi_reg_action() */
8697
8698
8699/*ARGSUSED*/
8700static uint32_t
8701emlxs_fcfi_reg_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8702 void *arg1)
8703{
6083 uint32_t rval;
8704 uint32_t rval = 0;
6084
6085 if (fcfp->state != FCFI_STATE_REG_CMPL) {
6086 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6087 "fcfi_reg_cmpl_action:%d %s:%s arg=%p. "
8705
8706 if (fcfp->state != FCFI_STATE_REG_CMPL) {
8707 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8708 "fcfi_reg_cmpl_action:%d %s:%s arg=%p. "
6088 "Invalid state. Terminated.",
8709 "Invalid state. <",
6089 fcfp->fcf_index,
6090 emlxs_fcfi_state_xlate(fcfp->state),
6091 emlxs_fcf_event_xlate(evt), arg1);
6092 return (1);
6093 }
6094
6095 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
6096 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 27 unchanged lines hidden (view full) ---

6124
6125 fcfp = (FCFIobj_t *)mbq->context;
6126 mb4 = (MAILBOX4 *)mbq;
6127
6128 mutex_enter(&EMLXS_FCF_LOCK);
6129
6130 if (fcfp->state != FCFI_STATE_UNREG) {
6131 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8710 fcfp->fcf_index,
8711 emlxs_fcfi_state_xlate(fcfp->state),
8712 emlxs_fcf_event_xlate(evt), arg1);
8713 return (1);
8714 }
8715
8716 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
8717 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 27 unchanged lines hidden (view full) ---

8745
8746 fcfp = (FCFIobj_t *)mbq->context;
8747 mb4 = (MAILBOX4 *)mbq;
8748
8749 mutex_enter(&EMLXS_FCF_LOCK);
8750
8751 if (fcfp->state != FCFI_STATE_UNREG) {
8752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6132 "fcfi_unreg_mbcmpl:%d state=%s. Terminated.",
8753 "fcfi_unreg_mbcmpl:%d state=%s.",
6133 fcfp->fcf_index,
6134 emlxs_fcfi_state_xlate(fcfp->state));
6135
6136 mutex_exit(&EMLXS_FCF_LOCK);
6137 return (0);
6138 }
6139
6140 if (mb4->mbxStatus) {
6141 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8754 fcfp->fcf_index,
8755 emlxs_fcfi_state_xlate(fcfp->state));
8756
8757 mutex_exit(&EMLXS_FCF_LOCK);
8758 return (0);
8759 }
8760
8761 if (mb4->mbxStatus) {
8762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6142 "fcfi_unreg_mbcmpl:%d failed. status=%x",
8763 "fcfi_unreg_mbcmpl:%d failed. %s. >",
6143 fcfp->fcf_index,
8764 fcfp->fcf_index,
6144 mb4->mbxStatus);
8765 emlxs_mb_xlate_status(mb4->mbxStatus));
6145
6146 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_FAILED,
6147 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
6148
6149 mutex_exit(&EMLXS_FCF_LOCK);
6150 return (0);
6151 }
6152
6153 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8766
8767 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_FAILED,
8768 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
8769
8770 mutex_exit(&EMLXS_FCF_LOCK);
8771 return (0);
8772 }
8773
8774 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6154 "fcfi_unreg_mbcmpl:%d Unregistered.",
8775 "fcfi_unreg_mbcmpl:%d. Unreg complete. >",
6155 fcfp->fcf_index);
6156
6157 fcfp->flag &= ~EMLXS_FCFI_REG;
6158 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_CMPL,
6159 0, 0, 0);
6160
6161 mutex_exit(&EMLXS_FCF_LOCK);
6162 return (0);

--- 4 unchanged lines hidden (view full) ---

6167/*ARGSUSED*/
6168static uint32_t
6169emlxs_fcfi_unreg_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
6170 void *arg1)
6171{
6172 emlxs_hba_t *hba = HBA;
6173 MAILBOX4 *mb4;
6174 MAILBOXQ *mbq;
8776 fcfp->fcf_index);
8777
8778 fcfp->flag &= ~EMLXS_FCFI_REG;
8779 (void) emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_CMPL,
8780 0, 0, 0);
8781
8782 mutex_exit(&EMLXS_FCF_LOCK);
8783 return (0);

--- 4 unchanged lines hidden (view full) ---

8788/*ARGSUSED*/
8789static uint32_t
8790emlxs_fcfi_unreg_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8791 void *arg1)
8792{
8793 emlxs_hba_t *hba = HBA;
8794 MAILBOX4 *mb4;
8795 MAILBOXQ *mbq;
6175 uint32_t rval;
8796 uint32_t rval = 0;
6176
6177 if (fcfp->state != FCFI_STATE_UNREG) {
6178 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6179 "fcfi_unreg_action:%d %s:%s arg=%p. "
8797
8798 if (fcfp->state != FCFI_STATE_UNREG) {
8799 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8800 "fcfi_unreg_action:%d %s:%s arg=%p. "
6180 "Invalid state. Terminated.",
8801 "Invalid state. <",
6181 fcfp->fcf_index,
6182 emlxs_fcfi_state_xlate(fcfp->state),
6183 emlxs_fcf_event_xlate(evt), arg1);
8802 fcfp->fcf_index,
8803 emlxs_fcfi_state_xlate(fcfp->state),
8804 emlxs_fcf_event_xlate(evt), arg1);
6184
6185 return (1);
6186 }
6187
6188 if (!(fcfp->flag & EMLXS_FCFI_REG)) {
6189 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8805 return (1);
8806 }
8807
8808 if (!(fcfp->flag & EMLXS_FCFI_REG)) {
8809 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6190 "fcfi_unreg_action:%d. Not registered. Skipping unreg.",
8810 "fcfi_unreg_action:%d. Not registered. "
8811 "Skipping UNREG_FCFI.",
6191 fcfp->fcf_index);
6192
6193 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_OFFLINE,
6194 FCF_REASON_EVENT, evt, arg1);
6195 return (rval);
6196 }
6197
6198 if (fcfp->prev_state != FCFI_STATE_UNREG_FAILED) {
6199 fcfp->attempts = 0;
6200 }
6201
6202 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8812 fcfp->fcf_index);
8813
8814 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_OFFLINE,
8815 FCF_REASON_EVENT, evt, arg1);
8816 return (rval);
8817 }
8818
8819 if (fcfp->prev_state != FCFI_STATE_UNREG_FAILED) {
8820 fcfp->attempts = 0;
8821 }
8822
8823 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6203 "fcfi_unreg_action:%d attempts=%d. Sending FCFI_UNREG.",
8824 "fcfi_unreg_action:%d attempts=%d. Sending UNREG_FCFI. <",
6204 fcfp->fcf_index,
6205 fcfp->attempts);
6206
8825 fcfp->fcf_index,
8826 fcfp->attempts);
8827
6207 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
8828 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
6208 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_FAILED,
6209 FCF_REASON_NO_MBOX, 0, arg1);
6210 return (rval);
6211 }
6212 mb4 = (MAILBOX4*)mbq;
6213 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
6214
6215 mbq->mbox_cmpl = emlxs_fcfi_unreg_mbcmpl;

--- 19 unchanged lines hidden (view full) ---

6235} /* emlxs_fcfi_unreg_action() */
6236
6237
6238/*ARGSUSED*/
6239static uint32_t
6240emlxs_fcfi_unreg_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
6241 void *arg1)
6242{
8829 rval = emlxs_fcfi_state(port, fcfp, FCFI_STATE_UNREG_FAILED,
8830 FCF_REASON_NO_MBOX, 0, arg1);
8831 return (rval);
8832 }
8833 mb4 = (MAILBOX4*)mbq;
8834 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
8835
8836 mbq->mbox_cmpl = emlxs_fcfi_unreg_mbcmpl;

--- 19 unchanged lines hidden (view full) ---

8856} /* emlxs_fcfi_unreg_action() */
8857
8858
8859/*ARGSUSED*/
8860static uint32_t
8861emlxs_fcfi_unreg_cmpl_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8862 void *arg1)
8863{
6243 uint32_t rval;
8864 uint32_t rval = 0;
6244
6245 if (fcfp->state != FCFI_STATE_UNREG_CMPL) {
6246 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6247 "fcfi_unreg_cmpl_action:%d %s:%s arg=%p. "
8865
8866 if (fcfp->state != FCFI_STATE_UNREG_CMPL) {
8867 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8868 "fcfi_unreg_cmpl_action:%d %s:%s arg=%p. "
6248 "Invalid state. Terminated.",
8869 "Invalid state. <",
6249 fcfp->fcf_index,
6250 emlxs_fcfi_state_xlate(fcfp->state),
6251 emlxs_fcf_event_xlate(evt), arg1);
6252 return (1);
6253 }
6254
6255 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6256 "fcfi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 11 unchanged lines hidden (view full) ---

6268
6269
6270/*ARGSUSED*/
6271static uint32_t
6272emlxs_fcfi_online_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
6273 void *arg1)
6274{
6275 emlxs_hba_t *hba = HBA;
8870 fcfp->fcf_index,
8871 emlxs_fcfi_state_xlate(fcfp->state),
8872 emlxs_fcf_event_xlate(evt), arg1);
8873 return (1);
8874 }
8875
8876 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8877 "fcfi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 11 unchanged lines hidden (view full) ---

8889
8890
8891/*ARGSUSED*/
8892static uint32_t
8893emlxs_fcfi_online_action(emlxs_port_t *port, FCFIobj_t *fcfp, uint32_t evt,
8894 void *arg1)
8895{
8896 emlxs_hba_t *hba = HBA;
6276 uint32_t rval;
8897 uint32_t rval = 0;
6277 VFIobj_t *vfip;
6278 uint32_t i;
6279
6280 if (fcfp->state != FCFI_STATE_ONLINE) {
6281 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6282 "fcfi_online_action:%d %s:%s arg=%p. "
8898 VFIobj_t *vfip;
8899 uint32_t i;
8900
8901 if (fcfp->state != FCFI_STATE_ONLINE) {
8902 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8903 "fcfi_online_action:%d %s:%s arg=%p. "
6283 "Invalid state. Terminated.",
8904 "Invalid state. <",
6284 fcfp->fcf_index,
6285 emlxs_fcfi_state_xlate(fcfp->state),
6286 emlxs_fcf_event_xlate(evt), arg1);
6287 return (1);
6288 }
6289
6290 fcfp->flag &= ~EMLXS_FCFI_ONLINE_REQ;
6291
6292 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
6293 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6294 "fcfi_online_action:%d attempts=%d. Offline requested.",
6295 fcfp->fcf_index,
6296 fcfp->attempts);
6297
6298 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
8905 fcfp->fcf_index,
8906 emlxs_fcfi_state_xlate(fcfp->state),
8907 emlxs_fcf_event_xlate(evt), arg1);
8908 return (1);
8909 }
8910
8911 fcfp->flag &= ~EMLXS_FCFI_ONLINE_REQ;
8912
8913 if (fcfp->flag & EMLXS_FCFI_OFFLINE_REQ) {
8914 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8915 "fcfi_online_action:%d attempts=%d. Offline requested.",
8916 fcfp->fcf_index,
8917 fcfp->attempts);
8918
8919 rval = emlxs_fcfi_offline_handler(port, fcfp, arg1);
6299 return (1);
8920 return (rval);
6300 }
6301
6302 /* Online remaining VFI's for this FCFI */
6303 vfip = hba->sli.sli4.VFI_table;
6304 for (i = 0; i < hba->sli.sli4.VFICount; i++, vfip++) {
6305 if (vfip->fcfp != fcfp) {
6306 continue;
6307 }
6308
6309 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8921 }
8922
8923 /* Online remaining VFI's for this FCFI */
8924 vfip = hba->sli.sli4.VFI_table;
8925 for (i = 0; i < hba->sli.sli4.VFICount; i++, vfip++) {
8926 if (vfip->fcfp != fcfp) {
8927 continue;
8928 }
8929
8930 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6310 "fcfi_online_action:%d vfi_online=%d. Onlining VFI:%d.",
8931 "fcfi_online_action:%d vfi_online=%d. Onlining VFI:%d. >",
6311 fcfp->fcf_index,
6312 fcfp->vfi_online,
6313 vfip->VFI);
6314
6315 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
6316 }
6317
6318 if (fcfp->prev_state != FCFI_STATE_ONLINE) {

--- 8 unchanged lines hidden (view full) ---

6327 "VSAN discovery required.",
6328 fcfp->fcf_index,
6329 fcfp->vfi_online);
6330 }
6331 }
6332
6333 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6334 "fcfi_online_action:%d vfi_online=%d. "
8932 fcfp->fcf_index,
8933 fcfp->vfi_online,
8934 vfip->VFI);
8935
8936 (void) emlxs_vfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
8937 }
8938
8939 if (fcfp->prev_state != FCFI_STATE_ONLINE) {

--- 8 unchanged lines hidden (view full) ---

8948 "VSAN discovery required.",
8949 fcfp->fcf_index,
8950 fcfp->vfi_online);
8951 }
8952 }
8953
8954 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8955 "fcfi_online_action:%d vfi_online=%d. "
6335 "FCFI online. Notifying fcftab.",
8956 "FCFI online. Notifying fcftab. >",
6336 fcfp->fcf_index,
6337 fcfp->vfi_online);
6338
6339 /* Notify FCFTAB */
6340 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFI_ONLINE, fcfp);
6341
6342 return (rval);
6343

--- 143 unchanged lines hidden (view full) ---

6487 }
6488
6489 if (fcf_rec->fcf_available) {
6490 fcfp->flag |= EMLXS_FCFI_AVAILABLE;
6491 } else {
6492 fcfp->flag &= ~EMLXS_FCFI_AVAILABLE;
6493 }
6494
8957 fcfp->fcf_index,
8958 fcfp->vfi_online);
8959
8960 /* Notify FCFTAB */
8961 rval = emlxs_fcftab_event(port, FCF_EVENT_FCFI_ONLINE, fcfp);
8962
8963 return (rval);
8964

--- 143 unchanged lines hidden (view full) ---

9108 }
9109
9110 if (fcf_rec->fcf_available) {
9111 fcfp->flag |= EMLXS_FCFI_AVAILABLE;
9112 } else {
9113 fcfp->flag &= ~EMLXS_FCFI_AVAILABLE;
9114 }
9115
6495 if (fcf_rec->fcf_valid) {
9116 if (fcf_rec->fcf_valid && !fcf_rec->fcf_sol) {
6496 fcfp->flag |= EMLXS_FCFI_VALID;
6497 } else {
6498 fcfp->flag &= ~EMLXS_FCFI_VALID;
6499 }
6500
6501 /* Check config region 23 */
6502 /* Also sets BOOT and PRIMARY cfg bits as needed */
6503 if (emlxs_fcf_configured(port, fcfp)) {

--- 8 unchanged lines hidden (view full) ---

6512 fcfp->priority |= (fcfp->flag & EMLXS_FCFI_PRIMARY)? 0x100:0;
6513 fcfp->priority |= ~(fcf_rec->fip_priority & 0xff);
6514
6515 fcfp->event_tag = event_tag;
6516 fcfp->generation = fcftab->generation;
6517 fcfp->flag |= EMLXS_FCFI_FRESH;
6518
6519 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9117 fcfp->flag |= EMLXS_FCFI_VALID;
9118 } else {
9119 fcfp->flag &= ~EMLXS_FCFI_VALID;
9120 }
9121
9122 /* Check config region 23 */
9123 /* Also sets BOOT and PRIMARY cfg bits as needed */
9124 if (emlxs_fcf_configured(port, fcfp)) {

--- 8 unchanged lines hidden (view full) ---

9133 fcfp->priority |= (fcfp->flag & EMLXS_FCFI_PRIMARY)? 0x100:0;
9134 fcfp->priority |= ~(fcf_rec->fip_priority & 0xff);
9135
9136 fcfp->event_tag = event_tag;
9137 fcfp->generation = fcftab->generation;
9138 fcfp->flag |= EMLXS_FCFI_FRESH;
9139
9140 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6520 "fcfi:%d gen=%x tag=%x flag=%x avl=%x val=%x state=%x "
9141 "fcfi:%d gen=%x iotag=%d flag=%x sol=%x avl=%x val=%x state=%x "
6521 "map=%x pri=%x vid=%x",
6522 fcf_rec->fcf_index,
6523 fcfp->generation,
6524 fcfp->event_tag,
6525 fcfp->flag,
9142 "map=%x pri=%x vid=%x",
9143 fcf_rec->fcf_index,
9144 fcfp->generation,
9145 fcfp->event_tag,
9146 fcfp->flag,
9147 fcf_rec->fcf_sol,
6526 fcf_rec->fcf_available,
6527 fcf_rec->fcf_valid,
6528 fcf_rec->fcf_state,
6529 fcf_rec->mac_address_provider,
6530 fcfp->priority,
6531 fcfp->vlan_id);
6532
6533 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 44 unchanged lines hidden (view full) ---

6578
6579 count = sizeof (emlxs_vfi_state_table) / sizeof (emlxs_table_t);
6580 for (i = 0; i < count; i++) {
6581 if (state == emlxs_vfi_state_table[i].code) {
6582 return (emlxs_vfi_state_table[i].string);
6583 }
6584 }
6585
9148 fcf_rec->fcf_available,
9149 fcf_rec->fcf_valid,
9150 fcf_rec->fcf_state,
9151 fcf_rec->mac_address_provider,
9152 fcfp->priority,
9153 fcfp->vlan_id);
9154
9155 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 44 unchanged lines hidden (view full) ---

9200
9201 count = sizeof (emlxs_vfi_state_table) / sizeof (emlxs_table_t);
9202 for (i = 0; i < count; i++) {
9203 if (state == emlxs_vfi_state_table[i].code) {
9204 return (emlxs_vfi_state_table[i].string);
9205 }
9206 }
9207
6586 (void) sprintf(buffer, "state=0x%x", state);
9208 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
6587 return (buffer);
6588
6589} /* emlxs_vfi_state_xlate() */
6590
6591
6592static uint32_t
6593emlxs_vfi_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
6594 void *arg1)
6595{
9209 return (buffer);
9210
9211} /* emlxs_vfi_state_xlate() */
9212
9213
9214static uint32_t
9215emlxs_vfi_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
9216 void *arg1)
9217{
6596 uint32_t rval;
9218 uint32_t rval = 0;
6597 uint32_t(*func) (emlxs_port_t *, VFIobj_t *, uint32_t, void *);
6598 uint32_t index;
6599 uint32_t events;
6600 uint16_t state;
6601
6602 /* Convert event to action table index */
6603 switch (evt) {
6604 case FCF_EVENT_STATE_ENTER:

--- 22 unchanged lines hidden (view full) ---

6627 state = vfip->state;
6628
6629 index += (state * events);
6630 func = (uint32_t(*) (emlxs_port_t *, VFIobj_t *, uint32_t, void *))
6631 emlxs_vfi_action_table[index];
6632
6633 if (!func) {
6634 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
9219 uint32_t(*func) (emlxs_port_t *, VFIobj_t *, uint32_t, void *);
9220 uint32_t index;
9221 uint32_t events;
9222 uint16_t state;
9223
9224 /* Convert event to action table index */
9225 switch (evt) {
9226 case FCF_EVENT_STATE_ENTER:

--- 22 unchanged lines hidden (view full) ---

9249 state = vfip->state;
9250
9251 index += (state * events);
9252 func = (uint32_t(*) (emlxs_port_t *, VFIobj_t *, uint32_t, void *))
9253 emlxs_vfi_action_table[index];
9254
9255 if (!func) {
9256 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
6635 "vfi:%d %s:%s arg=%p. No action. Terminated.",
9257 "vfi_action:%d %s:%s arg=%p. No action. <",
6636 vfip->VFI,
6637 emlxs_vfi_state_xlate(state),
6638 emlxs_fcf_event_xlate(evt), arg1);
6639
6640 return (1);
6641 }
6642
6643 rval = (func)(port, vfip, evt, arg1);

--- 14 unchanged lines hidden (view full) ---

6658 /* Filter events and acquire fcfi context */
6659 switch (evt) {
6660 case FCF_EVENT_VPI_ONLINE:
6661 case FCF_EVENT_VPI_OFFLINE:
6662 vpip = (VPIobj_t *)arg1;
6663
6664 if (!vpip) {
6665 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
9258 vfip->VFI,
9259 emlxs_vfi_state_xlate(state),
9260 emlxs_fcf_event_xlate(evt), arg1);
9261
9262 return (1);
9263 }
9264
9265 rval = (func)(port, vfip, evt, arg1);

--- 14 unchanged lines hidden (view full) ---

9280 /* Filter events and acquire fcfi context */
9281 switch (evt) {
9282 case FCF_EVENT_VPI_ONLINE:
9283 case FCF_EVENT_VPI_OFFLINE:
9284 vpip = (VPIobj_t *)arg1;
9285
9286 if (!vpip) {
9287 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
6666 "vfi: %s arg=%p. Null VPI found. Terminated.",
9288 "vfi_event: %s arg=%p. Null VPI found. <",
6667 emlxs_fcf_event_xlate(evt), arg1);
6668
6669 return (1);
6670 }
6671
6672 vfip = vpip->vfip;
6673
6674 if (!vfip) {
6675 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
9289 emlxs_fcf_event_xlate(evt), arg1);
9290
9291 return (1);
9292 }
9293
9294 vfip = vpip->vfip;
9295
9296 if (!vfip) {
9297 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
6676 "vfi: %s arg=%p. VFI not found. Terminated.",
9298 "vfi_event: %s arg=%p. VFI not found. <",
6677 emlxs_fcf_event_xlate(evt), arg1);
6678
6679 return (1);
6680 }
6681 break;
6682
6683 case FCF_EVENT_VFI_ONLINE:
6684 case FCF_EVENT_VFI_OFFLINE:
6685 case FCF_EVENT_VFI_PAUSE:
6686 vfip = (VFIobj_t *)arg1;
6687
6688 if (!vfip) {
6689 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
9299 emlxs_fcf_event_xlate(evt), arg1);
9300
9301 return (1);
9302 }
9303 break;
9304
9305 case FCF_EVENT_VFI_ONLINE:
9306 case FCF_EVENT_VFI_OFFLINE:
9307 case FCF_EVENT_VFI_PAUSE:
9308 vfip = (VFIobj_t *)arg1;
9309
9310 if (!vfip) {
9311 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
6690 "vfi: %s arg=%p. VFI not found. Terminated.",
9312 "vfi_event: %s arg=%p. VFI not found. <",
6691 emlxs_fcf_event_xlate(evt), arg1);
6692
6693 return (1);
6694 }
6695 break;
6696
6697 default:
6698 return (1);
6699 }
6700
6701 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
9313 emlxs_fcf_event_xlate(evt), arg1);
9314
9315 return (1);
9316 }
9317 break;
9318
9319 default:
9320 return (1);
9321 }
9322
9323 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
6702 "vfi:%d %s:%s arg=%p",
9324 "vfi_event:%d %s:%s arg=%p",
6703 vfip->VFI,
6704 emlxs_vfi_state_xlate(vfip->state),
6705 emlxs_fcf_event_xlate(evt), arg1);
6706
6707 rval = emlxs_vfi_action(port, vfip, evt, arg1);
6708
6709 return (rval);
6710
6711} /* emlxs_vfi_event() */
6712
6713
6714/*ARGSUSED*/
6715static uint32_t
6716emlxs_vfi_state(emlxs_port_t *port, VFIobj_t *vfip, uint16_t state,
6717 uint16_t reason, uint32_t explain, void *arg1)
6718{
9325 vfip->VFI,
9326 emlxs_vfi_state_xlate(vfip->state),
9327 emlxs_fcf_event_xlate(evt), arg1);
9328
9329 rval = emlxs_vfi_action(port, vfip, evt, arg1);
9330
9331 return (rval);
9332
9333} /* emlxs_vfi_event() */
9334
9335
9336/*ARGSUSED*/
9337static uint32_t
9338emlxs_vfi_state(emlxs_port_t *port, VFIobj_t *vfip, uint16_t state,
9339 uint16_t reason, uint32_t explain, void *arg1)
9340{
6719 uint32_t rval;
9341 uint32_t rval = 0;
6720
6721 if (state >= VFI_ACTION_STATES) {
6722 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6723 "vfi_state:%d %s. "
9342
9343 if (state >= VFI_ACTION_STATES) {
9344 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9345 "vfi_state:%d %s. "
6724 "Invalid state. Terminated.",
9346 "Invalid state. <",
6725 vfip->VFI,
6726 emlxs_vfi_state_xlate(vfip->state));
9347 vfip->VFI,
9348 emlxs_vfi_state_xlate(vfip->state));
6727
6728 return (1);
6729 }
6730
6731 if ((vfip->state == state) &&
6732 (reason != FCF_REASON_REENTER)) {
6733 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6734 "vfi_state:%d %s:%s:0x%x arg=%p. "
9349 return (1);
9350 }
9351
9352 if ((vfip->state == state) &&
9353 (reason != FCF_REASON_REENTER)) {
9354 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9355 "vfi_state:%d %s:%s:0x%x arg=%p. "
6735 "State not changed. Terminated.",
9356 "State not changed. <",
6736 vfip->VFI,
6737 emlxs_vfi_state_xlate(vfip->state),
6738 emlxs_fcf_reason_xlate(reason),
6739 explain, arg1);
6740
6741 return (1);
6742 }
6743
6744 if (!reason) {
6745 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
9357 vfip->VFI,
9358 emlxs_vfi_state_xlate(vfip->state),
9359 emlxs_fcf_reason_xlate(reason),
9360 explain, arg1);
9361
9362 return (1);
9363 }
9364
9365 if (!reason) {
9366 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
6746 "vfi:%d %s-->%s arg=%p",
9367 "vfi_state:%d %s-->%s arg=%p",
6747 vfip->VFI,
6748 emlxs_vfi_state_xlate(vfip->state),
6749 emlxs_vfi_state_xlate(state), arg1);
6750 } else if (reason == FCF_REASON_EVENT) {
6751 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
9368 vfip->VFI,
9369 emlxs_vfi_state_xlate(vfip->state),
9370 emlxs_vfi_state_xlate(state), arg1);
9371 } else if (reason == FCF_REASON_EVENT) {
9372 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
6752 "vfi:%d %s-->%s:%s:%s arg=%p",
9373 "vfi_state:%d %s-->%s:%s:%s arg=%p",
6753 vfip->VFI,
6754 emlxs_vfi_state_xlate(vfip->state),
6755 emlxs_vfi_state_xlate(state),
6756 emlxs_fcf_reason_xlate(reason),
6757 emlxs_fcf_event_xlate(explain), arg1);
6758 } else if (explain) {
6759 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
9374 vfip->VFI,
9375 emlxs_vfi_state_xlate(vfip->state),
9376 emlxs_vfi_state_xlate(state),
9377 emlxs_fcf_reason_xlate(reason),
9378 emlxs_fcf_event_xlate(explain), arg1);
9379 } else if (explain) {
9380 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
6760 "vfi:%d %s-->%s:%s:0x%x arg=%p",
9381 "vfi_state:%d %s-->%s:%s:0x%x arg=%p",
6761 vfip->VFI,
6762 emlxs_vfi_state_xlate(vfip->state),
6763 emlxs_vfi_state_xlate(state),
6764 emlxs_fcf_reason_xlate(reason),
6765 explain, arg1);
6766 } else {
6767 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
9382 vfip->VFI,
9383 emlxs_vfi_state_xlate(vfip->state),
9384 emlxs_vfi_state_xlate(state),
9385 emlxs_fcf_reason_xlate(reason),
9386 explain, arg1);
9387 } else {
9388 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
6768 "vfi:%d %s-->%s:%s arg=%p",
9389 "vfi_state:%d %s-->%s:%s arg=%p",
6769 vfip->VFI,
6770 emlxs_vfi_state_xlate(vfip->state),
6771 emlxs_vfi_state_xlate(state),
6772 emlxs_fcf_reason_xlate(reason), arg1);
6773 }
6774
6775 vfip->prev_state = vfip->state;
6776 vfip->prev_reason = vfip->reason;

--- 7 unchanged lines hidden (view full) ---

6784} /* emlxs_vfi_state() */
6785
6786
6787/*ARGSUSED*/
6788static uint32_t
6789emlxs_vfi_vpi_online_evt_action(emlxs_port_t *port, VFIobj_t *vfip,
6790 uint32_t evt, void *arg1)
6791{
9390 vfip->VFI,
9391 emlxs_vfi_state_xlate(vfip->state),
9392 emlxs_vfi_state_xlate(state),
9393 emlxs_fcf_reason_xlate(reason), arg1);
9394 }
9395
9396 vfip->prev_state = vfip->state;
9397 vfip->prev_reason = vfip->reason;

--- 7 unchanged lines hidden (view full) ---

9405} /* emlxs_vfi_state() */
9406
9407
9408/*ARGSUSED*/
9409static uint32_t
9410emlxs_vfi_vpi_online_evt_action(emlxs_port_t *port, VFIobj_t *vfip,
9411 uint32_t evt, void *arg1)
9412{
6792 uint32_t rval;
9413 uint32_t rval = 0;
6793
6794 if (evt != FCF_EVENT_VPI_ONLINE) {
6795 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6796 "vfi_vpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
9414
9415 if (evt != FCF_EVENT_VPI_ONLINE) {
9416 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9417 "vfi_vpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
6797 "Invalid event type. Terminated.",
9418 "Invalid event type. <",
6798 vfip->VFI,
6799 emlxs_vfi_state_xlate(vfip->state),
6800 emlxs_fcf_event_xlate(evt), arg1,
6801 vfip->flag);
9419 vfip->VFI,
9420 emlxs_vfi_state_xlate(vfip->state),
9421 emlxs_fcf_event_xlate(evt), arg1,
9422 vfip->flag);
6802
6803 return (1);
6804 }
6805
6806 switch (vfip->state) {
6807 case VFI_STATE_ONLINE:
6808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6809 "vfi_vpi_online_evt_action:%d flag=%x vpi_online=%d. "
6810 "Reentering online.",

--- 14 unchanged lines hidden (view full) ---

6825 vfip->vpi_online);
6826
6827 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE_CMPL,
6828 FCF_REASON_EVENT, evt, arg1);
6829 break;
6830
6831 default:
6832 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9423 return (1);
9424 }
9425
9426 switch (vfip->state) {
9427 case VFI_STATE_ONLINE:
9428 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9429 "vfi_vpi_online_evt_action:%d flag=%x vpi_online=%d. "
9430 "Reentering online.",

--- 14 unchanged lines hidden (view full) ---

9445 vfip->vpi_online);
9446
9447 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE_CMPL,
9448 FCF_REASON_EVENT, evt, arg1);
9449 break;
9450
9451 default:
9452 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6833 "vfi_vpi_online_evt_action:%d flag=%x vpi_online=%d. "
6834 "Terminated.",
9453 "vfi_vpi_online_evt_action:%d flag=%x vpi_online=%d. <",
6835 vfip->VFI,
6836 vfip->flag,
6837 vfip->vpi_online);
6838
6839 return (1);
6840 }
6841
6842 return (rval);
6843
6844} /* emlxs_vfi_vpi_online_evt_action() */
6845
6846
6847/*ARGSUSED*/
6848static uint32_t
6849emlxs_vfi_offline_handler(emlxs_port_t *port, VFIobj_t *vfip, void *arg1)
6850{
9454 vfip->VFI,
9455 vfip->flag,
9456 vfip->vpi_online);
9457
9458 return (1);
9459 }
9460
9461 return (rval);
9462
9463} /* emlxs_vfi_vpi_online_evt_action() */
9464
9465
9466/*ARGSUSED*/
9467static uint32_t
9468emlxs_vfi_offline_handler(emlxs_port_t *port, VFIobj_t *vfip, void *arg1)
9469{
6851 uint32_t rval;
9470 uint32_t rval = 0;
6852
6853 if (!(vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
6854 return (0);
6855 }
6856
9471
9472 if (!(vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
9473 return (0);
9474 }
9475
6857 if (vfip->vpi_online > 0) {
9476 if (vfip->vpi_online) {
6858 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
6859 rval = emlxs_vfi_state(port, vfip, VFI_STATE_PAUSED,
6860 FCF_REASON_REQUESTED, 0, arg1);
6861 } else {
6862 rval = emlxs_vfi_state(port, vfip,
6863 VFI_STATE_VPI_OFFLINE, FCF_REASON_REQUESTED,
6864 0, arg1);
6865 }

--- 16 unchanged lines hidden (view full) ---

6882} /* emlxs_vfi_offline_handler() */
6883
6884
6885/*ARGSUSED*/
6886static uint32_t
6887emlxs_vfi_vpi_offline_evt_action(emlxs_port_t *port, VFIobj_t *vfip,
6888 uint32_t evt, void *arg1)
6889{
9477 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
9478 rval = emlxs_vfi_state(port, vfip, VFI_STATE_PAUSED,
9479 FCF_REASON_REQUESTED, 0, arg1);
9480 } else {
9481 rval = emlxs_vfi_state(port, vfip,
9482 VFI_STATE_VPI_OFFLINE, FCF_REASON_REQUESTED,
9483 0, arg1);
9484 }

--- 16 unchanged lines hidden (view full) ---

9501} /* emlxs_vfi_offline_handler() */
9502
9503
9504/*ARGSUSED*/
9505static uint32_t
9506emlxs_vfi_vpi_offline_evt_action(emlxs_port_t *port, VFIobj_t *vfip,
9507 uint32_t evt, void *arg1)
9508{
6890 uint32_t rval;
9509 uint32_t rval = 0;
6891 VPIobj_t *vpip;
6892
6893 if (evt != FCF_EVENT_VPI_OFFLINE) {
6894 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6895 "vfi_vpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
9510 VPIobj_t *vpip;
9511
9512 if (evt != FCF_EVENT_VPI_OFFLINE) {
9513 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9514 "vfi_vpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
6896 "Invalid event type. Terminated.",
9515 "Invalid event type. <",
6897 vfip->VFI,
6898 emlxs_vfi_state_xlate(vfip->state),
6899 emlxs_fcf_event_xlate(evt), arg1,
6900 vfip->flag);
6901 return (1);
6902 }
6903
6904 /* Disconnect VPI object from VFI */

--- 11 unchanged lines hidden (view full) ---

6916 vfip->flag, vfip->vpi_online);
6917
6918 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
6919 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
6920 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
6921 } else {
6922 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6923 "vfi_vpi_offline_evt_action:%d flag=%x "
9516 vfip->VFI,
9517 emlxs_vfi_state_xlate(vfip->state),
9518 emlxs_fcf_event_xlate(evt), arg1,
9519 vfip->flag);
9520 return (1);
9521 }
9522
9523 /* Disconnect VPI object from VFI */

--- 11 unchanged lines hidden (view full) ---

9535 vfip->flag, vfip->vpi_online);
9536
9537 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
9538 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
9539 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
9540 } else {
9541 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9542 "vfi_vpi_offline_evt_action:%d flag=%x "
6924 "vpi_online=%d. Terminated.",
9543 "vpi_online=%d. <",
6925 vfip->VFI,
6926 vfip->flag, vfip->vpi_online);
6927 }
6928 break;
6929
6930 case VFI_STATE_PAUSED:
9544 vfip->VFI,
9545 vfip->flag, vfip->vpi_online);
9546 }
9547 break;
9548
9549 case VFI_STATE_PAUSED:
6931 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6932 "vfi_vpi_offline_evt_action:%d flag=%x vpi_online=%d. "
6933 "Terminated.",
9550 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9551 "vfi_vpi_offline_evt_action:%d flag=%x vpi_online=%d. <",
6934 vfip->VFI,
6935 vfip->flag, vfip->vpi_online);
6936 break;
6937
6938 case VFI_STATE_VPI_OFFLINE:
6939 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6940 "vfi_vpi_offline_evt_action:%d flag=%x. VPI offline cmpl.",
6941 vfip->VFI,

--- 11 unchanged lines hidden (view full) ---

6953
6954 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_OFFLINE_CMPL,
6955 FCF_REASON_REENTER, evt, arg1);
6956 break;
6957
6958 default:
6959 if (vfip->vpi_online == 0) {
6960 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9552 vfip->VFI,
9553 vfip->flag, vfip->vpi_online);
9554 break;
9555
9556 case VFI_STATE_VPI_OFFLINE:
9557 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9558 "vfi_vpi_offline_evt_action:%d flag=%x. VPI offline cmpl.",
9559 vfip->VFI,

--- 11 unchanged lines hidden (view full) ---

9571
9572 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_OFFLINE_CMPL,
9573 FCF_REASON_REENTER, evt, arg1);
9574 break;
9575
9576 default:
9577 if (vfip->vpi_online == 0) {
9578 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6961 "vfi_vpi_offline_evt_action:%d flag=%x "\
6962 "vpi_online=%d. Requesting offline.",
9579 "vfi_vpi_offline_evt_action:%d flag=%x "
9580 "vpi_online=%d. Requesting offline. <",
6963 vfip->VFI,
6964 vfip->flag, vfip->vpi_online);
6965
6966 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
6967 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
6968 } else {
6969 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9581 vfip->VFI,
9582 vfip->flag, vfip->vpi_online);
9583
9584 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
9585 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
9586 } else {
9587 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
6970 "vfi_vpi_offline_evt_action:%d flag=%x "\
6971 "vpi_online=%d. Terminated.",
9588 "vfi_vpi_offline_evt_action:%d flag=%x "
9589 "vpi_online=%d. <",
6972 vfip->VFI,
6973 vfip->flag, vfip->vpi_online);
6974 }
6975 return (1);
6976 }
6977
6978 return (rval);
6979

--- 9 unchanged lines hidden (view full) ---

6989 emlxs_port_t *vport;
6990 VPIobj_t *vpip;
6991 uint32_t rval = 0;
6992 uint32_t i;
6993
6994 if (evt != FCF_EVENT_VFI_ONLINE) {
6995 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
6996 "vfi_online_evt_action:%d %s:%s arg=%p flag=%x. "
9590 vfip->VFI,
9591 vfip->flag, vfip->vpi_online);
9592 }
9593 return (1);
9594 }
9595
9596 return (rval);
9597

--- 9 unchanged lines hidden (view full) ---

9607 emlxs_port_t *vport;
9608 VPIobj_t *vpip;
9609 uint32_t rval = 0;
9610 uint32_t i;
9611
9612 if (evt != FCF_EVENT_VFI_ONLINE) {
9613 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9614 "vfi_online_evt_action:%d %s:%s arg=%p flag=%x. "
6997 "Invalid event type. Terminated.",
9615 "Invalid event type. <",
6998 vfip->VFI,
6999 emlxs_vfi_state_xlate(vfip->state),
7000 emlxs_fcf_event_xlate(evt), arg1,
7001 vfip->flag);
7002 return (1);
7003 }
7004
7005 if (vfip->flag & EMLXS_VFI_ONLINE_REQ) {
7006 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7007 "vfi_online_evt_action:%d flag=%x. "
9616 vfip->VFI,
9617 emlxs_vfi_state_xlate(vfip->state),
9618 emlxs_fcf_event_xlate(evt), arg1,
9619 vfip->flag);
9620 return (1);
9621 }
9622
9623 if (vfip->flag & EMLXS_VFI_ONLINE_REQ) {
9624 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9625 "vfi_online_evt_action:%d flag=%x. "
7008 "Online already requested. Terminated.",
9626 "Online already requested. <",
7009 vfip->VFI,
7010 vfip->flag);
7011 return (0);
7012 }
7013
7014 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
9627 vfip->VFI,
9628 vfip->flag);
9629 return (0);
9630 }
9631
9632 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
7015 vfip->flag |= EMLXS_VFI_ONLINE_REQ;
7016
7017 switch (vfip->state) {
7018 case VFI_STATE_OFFLINE:
9633
9634 switch (vfip->state) {
9635 case VFI_STATE_OFFLINE:
9636 vfip->flag |= EMLXS_VFI_ONLINE_REQ;
7019 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7020 "vfi_online_evt_action:%d flag=%x. Initiating online.",
7021 vfip->VFI,
7022 vfip->flag);
7023
7024 rval = emlxs_vfi_state(port, vfip, VFI_STATE_INIT,
7025 FCF_REASON_EVENT, evt, arg1);
7026 break;
7027
7028 case VFI_STATE_VPI_OFFLINE:
7029 case VFI_STATE_PAUSED:
9637 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9638 "vfi_online_evt_action:%d flag=%x. Initiating online.",
9639 vfip->VFI,
9640 vfip->flag);
9641
9642 rval = emlxs_vfi_state(port, vfip, VFI_STATE_INIT,
9643 FCF_REASON_EVENT, evt, arg1);
9644 break;
9645
9646 case VFI_STATE_VPI_OFFLINE:
9647 case VFI_STATE_PAUSED:
9648 vfip->flag |= EMLXS_VFI_ONLINE_REQ;
7030 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7031 "vfi_online_evt_action:%d flag=%x. Initiating online.",
7032 vfip->VFI,
7033 vfip->flag);
7034
7035 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
7036 FCF_REASON_EVENT, evt, arg1);
7037 break;
7038
7039 case VFI_STATE_ONLINE:
7040 /* Online all VPI's belonging to this vfi */
7041 for (i = 0; i <= hba->vpi_max; i++) {
7042 vport = &VPORT(i);
9649 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9650 "vfi_online_evt_action:%d flag=%x. Initiating online.",
9651 vfip->VFI,
9652 vfip->flag);
9653
9654 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
9655 FCF_REASON_EVENT, evt, arg1);
9656 break;
9657
9658 case VFI_STATE_ONLINE:
9659 /* Online all VPI's belonging to this vfi */
9660 for (i = 0; i <= hba->vpi_max; i++) {
9661 vport = &VPORT(i);
7043 vpip = &vport->VPIobj;
9662 vpip = vport->vpip;
7044
9663
7045 if (!(vport->flag & EMLXS_PORT_BOUND)) {
9664 if (!(vport->flag & EMLXS_PORT_BOUND) ||
9665 (vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
7046 continue;
7047 }
7048
7049 if (vpip->vfip != vfip) {
7050 continue;
7051 }
7052
7053 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9666 continue;
9667 }
9668
9669 if (vpip->vfip != vfip) {
9670 continue;
9671 }
9672
9673 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7054 "vfi_online_evt_action:%d. Onlining VPI:%d",
9674 "vfi_online_evt_action:%d. Onlining VPI:%d >",
7055 vfip->VFI,
7056 vpip->VPI);
7057
7058 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_ONLINE,
7059 vpip);
7060 }
7061 break;
7062
7063 default:
9675 vfip->VFI,
9676 vpip->VPI);
9677
9678 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_ONLINE,
9679 vpip);
9680 }
9681 break;
9682
9683 default:
9684 vfip->flag |= EMLXS_VFI_ONLINE_REQ;
7064 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9685 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7065 "vfi_online_evt_action:%d flag=%x. Terminated.",
9686 "vfi_online_evt_action:%d flag=%x. <",
7066 vfip->VFI,
7067 vfip->flag);
7068 return (1);
7069 }
7070
7071 return (rval);
7072
7073} /* emlxs_vfi_online_evt_action() */

--- 4 unchanged lines hidden (view full) ---

7078emlxs_vfi_offline_evt_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7079 void *arg1)
7080{
7081 uint32_t rval = 0;
7082
7083 if (evt != FCF_EVENT_VFI_OFFLINE) {
7084 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7085 "vfi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
9687 vfip->VFI,
9688 vfip->flag);
9689 return (1);
9690 }
9691
9692 return (rval);
9693
9694} /* emlxs_vfi_online_evt_action() */

--- 4 unchanged lines hidden (view full) ---

9699emlxs_vfi_offline_evt_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
9700 void *arg1)
9701{
9702 uint32_t rval = 0;
9703
9704 if (evt != FCF_EVENT_VFI_OFFLINE) {
9705 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9706 "vfi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
7086 "Invalid event type. Terminated.",
9707 "Invalid event type. <",
7087 vfip->VFI,
7088 emlxs_vfi_state_xlate(vfip->state),
7089 emlxs_fcf_event_xlate(evt), arg1,
7090 vfip->flag);
7091 return (1);
7092 }
7093
7094 if ((vfip->flag & EMLXS_VFI_OFFLINE_REQ) &&
7095 !(vfip->flag & EMLXS_VFI_PAUSE_REQ)) {
7096 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7097 "vfi_offline_evt_action:%d flag=%x. "
9708 vfip->VFI,
9709 emlxs_vfi_state_xlate(vfip->state),
9710 emlxs_fcf_event_xlate(evt), arg1,
9711 vfip->flag);
9712 return (1);
9713 }
9714
9715 if ((vfip->flag & EMLXS_VFI_OFFLINE_REQ) &&
9716 !(vfip->flag & EMLXS_VFI_PAUSE_REQ)) {
9717 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9718 "vfi_offline_evt_action:%d flag=%x. "
7098 "Offline already requested. Terminated.",
9719 "Offline already requested. <",
7099 vfip->VFI,
7100 vfip->flag);
7101 return (0);
7102 }
7103
7104 switch (vfip->state) {
7105 case VFI_STATE_OFFLINE:
7106 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7107 "vfi_offline_evt_action:%d flag=%x. "
9720 vfip->VFI,
9721 vfip->flag);
9722 return (0);
9723 }
9724
9725 switch (vfip->state) {
9726 case VFI_STATE_OFFLINE:
9727 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9728 "vfi_offline_evt_action:%d flag=%x. "
7108 "Already offline. Terminated.",
9729 "Already offline. <",
7109 vfip->VFI,
7110 vfip->flag);
7111 break;
7112
7113 /* Wait states */
7114 case VFI_STATE_VPI_ONLINE:
7115 case VFI_STATE_VPI_OFFLINE:
7116 case VFI_STATE_VPI_OFFLINE_CMPL:

--- 13 unchanged lines hidden (view full) ---

7130 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
7131 break;
7132
7133 default:
7134 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
7135 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
7136
7137 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9730 vfip->VFI,
9731 vfip->flag);
9732 break;
9733
9734 /* Wait states */
9735 case VFI_STATE_VPI_ONLINE:
9736 case VFI_STATE_VPI_OFFLINE:
9737 case VFI_STATE_VPI_OFFLINE_CMPL:

--- 13 unchanged lines hidden (view full) ---

9751 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
9752 break;
9753
9754 default:
9755 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
9756 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
9757
9758 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7138 "vfi_offline_evt_action:%d flag=%x. Terminated.",
9759 "vfi_offline_evt_action:%d flag=%x. <",
7139 vfip->VFI,
7140 vfip->flag);
7141 break;
7142 }
7143
7144 return (rval);
7145
7146} /* emlxs_vfi_offline_evt_action() */

--- 4 unchanged lines hidden (view full) ---

7151emlxs_vfi_pause_evt_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7152 void *arg1)
7153{
7154 uint32_t rval = 0;
7155
7156 if (evt != FCF_EVENT_VFI_PAUSE) {
7157 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7158 "vfi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
9760 vfip->VFI,
9761 vfip->flag);
9762 break;
9763 }
9764
9765 return (rval);
9766
9767} /* emlxs_vfi_offline_evt_action() */

--- 4 unchanged lines hidden (view full) ---

9772emlxs_vfi_pause_evt_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
9773 void *arg1)
9774{
9775 uint32_t rval = 0;
9776
9777 if (evt != FCF_EVENT_VFI_PAUSE) {
9778 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9779 "vfi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
7159 "Invalid event type. Terminated.",
9780 "Invalid event type. <",
7160 vfip->VFI,
7161 emlxs_vfi_state_xlate(vfip->state),
7162 emlxs_fcf_event_xlate(evt), arg1,
7163 vfip->flag);
7164 return (1);
7165 }
7166
7167 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
7168 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7169 "vfi_pause_evt_action:%d flag=%x. "
9781 vfip->VFI,
9782 emlxs_vfi_state_xlate(vfip->state),
9783 emlxs_fcf_event_xlate(evt), arg1,
9784 vfip->flag);
9785 return (1);
9786 }
9787
9788 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
9789 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9790 "vfi_pause_evt_action:%d flag=%x. "
7170 "Pause already requested. Terminated.",
9791 "Pause already requested. <",
7171 vfip->VFI,
7172 vfip->flag);
7173 return (0);
7174 }
7175
7176 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
7177 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7178 "vfi_pause_evt_action:%d flag=%x. "
9792 vfip->VFI,
9793 vfip->flag);
9794 return (0);
9795 }
9796
9797 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
9798 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9799 "vfi_pause_evt_action:%d flag=%x. "
7179 "Offline already requested. Terminated.",
9800 "Offline already requested. <",
7180 vfip->VFI,
7181 vfip->flag);
7182 return (0);
7183 }
7184
7185 switch (vfip->state) {
7186 case VFI_STATE_OFFLINE:
7187 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7188 "vfi_pause_evt_action:%d flag=%x. "
9801 vfip->VFI,
9802 vfip->flag);
9803 return (0);
9804 }
9805
9806 switch (vfip->state) {
9807 case VFI_STATE_OFFLINE:
9808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9809 "vfi_pause_evt_action:%d flag=%x. "
7189 "Already offline. Terminated.",
9810 "Already offline. <",
7190 vfip->VFI,
7191 vfip->flag);
7192 break;
7193
7194 case VFI_STATE_PAUSED:
7195 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7196 "vfi_pause_evt_action:%d flag=%x. "
9811 vfip->VFI,
9812 vfip->flag);
9813 break;
9814
9815 case VFI_STATE_PAUSED:
9816 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9817 "vfi_pause_evt_action:%d flag=%x. "
7197 "Already paused. Terminated.",
9818 "Already paused. <",
7198 vfip->VFI,
7199 vfip->flag);
7200 break;
7201
7202 /* Wait states */
7203 case VFI_STATE_VPI_ONLINE:
7204 case VFI_STATE_VPI_OFFLINE_CMPL:
7205 case VFI_STATE_INIT:

--- 11 unchanged lines hidden (view full) ---

7217 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
7218 break;
7219
7220 default:
7221 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
7222 vfip->flag |= (EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
7223
7224 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9819 vfip->VFI,
9820 vfip->flag);
9821 break;
9822
9823 /* Wait states */
9824 case VFI_STATE_VPI_ONLINE:
9825 case VFI_STATE_VPI_OFFLINE_CMPL:
9826 case VFI_STATE_INIT:

--- 11 unchanged lines hidden (view full) ---

9838 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
9839 break;
9840
9841 default:
9842 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
9843 vfip->flag |= (EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
9844
9845 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7225 "vfi_pause_evt_action:%d flag=%x. Terminated.",
9846 "vfi_pause_evt_action:%d flag=%x. <",
7226 vfip->VFI,
7227 vfip->flag);
7228 break;
7229 }
7230
7231 return (rval);
7232
7233} /* emlxs_vfi_pause_evt_action() */
7234
7235
7236/*ARGSUSED*/
7237static uint32_t
7238emlxs_vfi_offline_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7239 void *arg1)
7240{
9847 vfip->VFI,
9848 vfip->flag);
9849 break;
9850 }
9851
9852 return (rval);
9853
9854} /* emlxs_vfi_pause_evt_action() */
9855
9856
9857/*ARGSUSED*/
9858static uint32_t
9859emlxs_vfi_offline_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
9860 void *arg1)
9861{
7241 uint32_t rval;
9862 uint32_t rval = 0;
7242
7243 if (vfip->state != VFI_STATE_OFFLINE) {
7244 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7245 "vfi_offline_action:%d %s:%s arg=%p. "
9863
9864 if (vfip->state != VFI_STATE_OFFLINE) {
9865 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9866 "vfi_offline_action:%d %s:%s arg=%p. "
7246 "Invalid state. Terminated.",
9867 "Invalid state. <",
7247 vfip->VFI,
7248 emlxs_vfi_state_xlate(vfip->state),
7249 emlxs_fcf_event_xlate(evt), arg1);
7250 return (1);
7251 }
7252
7253 if (!vfip->fcfp) {
7254 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7255 "vfi_offline_action:%d %s:%s arg=%p flag=%x. "
9868 vfip->VFI,
9869 emlxs_vfi_state_xlate(vfip->state),
9870 emlxs_fcf_event_xlate(evt), arg1);
9871 return (1);
9872 }
9873
9874 if (!vfip->fcfp) {
9875 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9876 "vfi_offline_action:%d %s:%s arg=%p flag=%x. "
7256 "Null fcfp found. Terminated.",
9877 "Null fcfp found. <",
7257 vfip->VFI,
7258 emlxs_vfi_state_xlate(vfip->state),
7259 emlxs_fcf_event_xlate(evt), arg1,
7260 vfip->flag);
7261 return (1);
7262 }
7263
7264 vfip->flag &= ~(EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
7265
7266 if (vfip->prev_state == VFI_STATE_OFFLINE) {
7267 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9878 vfip->VFI,
9879 emlxs_vfi_state_xlate(vfip->state),
9880 emlxs_fcf_event_xlate(evt), arg1,
9881 vfip->flag);
9882 return (1);
9883 }
9884
9885 vfip->flag &= ~(EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
9886
9887 if (vfip->prev_state == VFI_STATE_OFFLINE) {
9888 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7268 "vfi_offline_action:%d vfi_online=%d. Terminated.",
9889 "vfi_offline_action:%d vfi_online=%d. <",
7269 vfip->VFI,
7270 vfip->fcfp->vfi_online);
7271
7272 return (0);
7273 }
7274
7275 if (vfip->vpi_online) {
7276 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 19 unchanged lines hidden (view full) ---

7296
7297 rval = emlxs_vfi_state(port, vfip, VFI_STATE_INIT,
7298 FCF_REASON_REQUESTED, 0, arg1);
7299 return (rval);
7300 }
7301
7302 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7303 "vfi_offline_action:%d vfi_online=%d. "
9890 vfip->VFI,
9891 vfip->fcfp->vfi_online);
9892
9893 return (0);
9894 }
9895
9896 if (vfip->vpi_online) {
9897 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 19 unchanged lines hidden (view full) ---

9917
9918 rval = emlxs_vfi_state(port, vfip, VFI_STATE_INIT,
9919 FCF_REASON_REQUESTED, 0, arg1);
9920 return (rval);
9921 }
9922
9923 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9924 "vfi_offline_action:%d vfi_online=%d. "
7304 "VFI offline. Notifying FCFI:%d",
9925 "VFI offline. Notifying FCFI:%d >",
7305 vfip->VFI,
7306 vfip->fcfp->vfi_online,
7307 vfip->fcfp->fcf_index);
7308
7309 /* Notify FCFI */
7310 rval = emlxs_fcfi_event(port, FCF_EVENT_VFI_OFFLINE, vfip);
7311
7312 return (rval);

--- 11 unchanged lines hidden (view full) ---

7324
7325 vfip = (VFIobj_t *)mbq->context;
7326 mb4 = (MAILBOX4 *)mbq;
7327
7328 mutex_enter(&EMLXS_FCF_LOCK);
7329
7330 if (vfip->state != VFI_STATE_INIT) {
7331 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9926 vfip->VFI,
9927 vfip->fcfp->vfi_online,
9928 vfip->fcfp->fcf_index);
9929
9930 /* Notify FCFI */
9931 rval = emlxs_fcfi_event(port, FCF_EVENT_VFI_OFFLINE, vfip);
9932
9933 return (rval);

--- 11 unchanged lines hidden (view full) ---

9945
9946 vfip = (VFIobj_t *)mbq->context;
9947 mb4 = (MAILBOX4 *)mbq;
9948
9949 mutex_enter(&EMLXS_FCF_LOCK);
9950
9951 if (vfip->state != VFI_STATE_INIT) {
9952 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7332 "vfi_init_mbcmpl:%d %s. Terminated.",
9953 "vfi_init_mbcmpl:%d %s.",
7333 vfip->VFI,
7334 emlxs_vfi_state_xlate(vfip->state));
7335
7336 mutex_exit(&EMLXS_FCF_LOCK);
7337 return (0);
7338 }
7339
7340 if (mb4->mbxStatus) {
7341 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9954 vfip->VFI,
9955 emlxs_vfi_state_xlate(vfip->state));
9956
9957 mutex_exit(&EMLXS_FCF_LOCK);
9958 return (0);
9959 }
9960
9961 if (mb4->mbxStatus) {
9962 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7342 "vfi_init_mbcmpl:%d failed. status=%x",
9963 "vfi_init_mbcmpl:%d failed. %s. >",
7343 vfip->VFI,
9964 vfip->VFI,
7344 mb4->mbxStatus);
9965 emlxs_mb_xlate_status(mb4->mbxStatus));
7345
7346 (void) emlxs_vfi_state(port, vfip, VFI_STATE_INIT_FAILED,
7347 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
7348
7349 mutex_exit(&EMLXS_FCF_LOCK);
7350 return (0);
7351 }
7352
7353 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9966
9967 (void) emlxs_vfi_state(port, vfip, VFI_STATE_INIT_FAILED,
9968 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
9969
9970 mutex_exit(&EMLXS_FCF_LOCK);
9971 return (0);
9972 }
9973
9974 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7354 "vfi_init_mbcmpl:%d Initialized.",
9975 "vfi_init_mbcmpl:%d. Init complete. >",
7355 vfip->VFI,
7356 mb4->mbxStatus);
7357
7358 vfip->flag |= EMLXS_VFI_INIT;
7359 (void) emlxs_vfi_state(port, vfip, VFI_STATE_INIT_CMPL, 0, 0, 0);
7360
7361 mutex_exit(&EMLXS_FCF_LOCK);
7362 return (0);

--- 4 unchanged lines hidden (view full) ---

7367/*ARGSUSED*/
7368static uint32_t
7369emlxs_vfi_init_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7370 void *arg1)
7371{
7372 emlxs_hba_t *hba = HBA;
7373 MAILBOXQ *mbq;
7374 MAILBOX4 *mb4;
9976 vfip->VFI,
9977 mb4->mbxStatus);
9978
9979 vfip->flag |= EMLXS_VFI_INIT;
9980 (void) emlxs_vfi_state(port, vfip, VFI_STATE_INIT_CMPL, 0, 0, 0);
9981
9982 mutex_exit(&EMLXS_FCF_LOCK);
9983 return (0);

--- 4 unchanged lines hidden (view full) ---

9988/*ARGSUSED*/
9989static uint32_t
9990emlxs_vfi_init_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
9991 void *arg1)
9992{
9993 emlxs_hba_t *hba = HBA;
9994 MAILBOXQ *mbq;
9995 MAILBOX4 *mb4;
7375 uint32_t rval;
9996 uint32_t rval = 0;
7376
7377 if (vfip->state != VFI_STATE_INIT) {
7378 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7379 "vfi_init_action:%d %s:%s arg=%p. "
9997
9998 if (vfip->state != VFI_STATE_INIT) {
9999 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10000 "vfi_init_action:%d %s:%s arg=%p. "
7380 "Invalid state. Terminated.",
10001 "Invalid state. <",
7381 vfip->VFI,
7382 emlxs_vfi_state_xlate(vfip->state),
7383 emlxs_fcf_event_xlate(evt), arg1);
7384 return (1);
7385 }
7386
7387 if (!(vfip->flag & EMLXS_VFI_FCFI)) {
7388 vfip->flag |= EMLXS_VFI_FCFI;

--- 12 unchanged lines hidden (view full) ---

7401
7402 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
7403 return (rval);
7404 }
7405
7406 if (vfip->flag & EMLXS_VFI_INIT) {
7407 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7408 "vfi_init_action:%d flag=%x. "
10002 vfip->VFI,
10003 emlxs_vfi_state_xlate(vfip->state),
10004 emlxs_fcf_event_xlate(evt), arg1);
10005 return (1);
10006 }
10007
10008 if (!(vfip->flag & EMLXS_VFI_FCFI)) {
10009 vfip->flag |= EMLXS_VFI_FCFI;

--- 12 unchanged lines hidden (view full) ---

10022
10023 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
10024 return (rval);
10025 }
10026
10027 if (vfip->flag & EMLXS_VFI_INIT) {
10028 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10029 "vfi_init_action:%d flag=%x. "
7409 "Already init'd. Skipping init.",
10030 "Already init'd. Skipping INIT_VFI.",
7410 vfip->VFI);
7411
7412 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
7413 FCF_REASON_EVENT, evt, arg1);
7414 return (rval);
7415 }
7416
10031 vfip->VFI);
10032
10033 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
10034 FCF_REASON_EVENT, evt, arg1);
10035 return (rval);
10036 }
10037
7417 if (vfip->fcfp->vfi_online == 1) {
10038 if (((hba->sli_intf & SLI_INTF_IF_TYPE_MASK) ==
10039 SLI_INTF_IF_TYPE_0) && (vfip->fcfp->vfi_online == 1)) {
7418 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10040 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7419 "vfi_init_action:%d vfi_online=%d. Skipping init.",
7420 vfip->VFI,
7421 vfip->fcfp->vfi_online);
10041 "vfi_init_action:%d. First VFI. Skipping INIT_VFI.",
10042 vfip->VFI);
7422
7423 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
7424 FCF_REASON_EVENT, evt, arg1);
7425 return (rval);
7426 }
7427
7428 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10043
10044 rval = emlxs_vfi_state(port, vfip, VFI_STATE_VPI_ONLINE,
10045 FCF_REASON_EVENT, evt, arg1);
10046 return (rval);
10047 }
10048
10049 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7429 "vfi_init_action:%d vfi_online=%d attempts=%d",
10050 "vfi_init_action:%d vfi_online=%d attempts=%d. Sending INIT_VFI. <",
7430 vfip->VFI,
7431 vfip->fcfp->vfi_online,
7432 vfip->attempts);
7433
10051 vfip->VFI,
10052 vfip->fcfp->vfi_online,
10053 vfip->attempts);
10054
7434 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
10055 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
7435 rval = emlxs_vfi_state(port, vfip, FCFI_STATE_REG_FAILED,
7436 FCF_REASON_NO_MBOX, 0, arg1);
7437 return (rval);
7438 }
7439 mb4 = (MAILBOX4*)mbq;
7440 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
7441
7442 mbq->nonembed = NULL;

--- 23 unchanged lines hidden (view full) ---

7466} /* emlxs_vfi_init_action() */
7467
7468
7469/*ARGSUSED*/
7470static uint32_t
7471emlxs_vfi_init_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7472 void *arg1)
7473{
10056 rval = emlxs_vfi_state(port, vfip, FCFI_STATE_REG_FAILED,
10057 FCF_REASON_NO_MBOX, 0, arg1);
10058 return (rval);
10059 }
10060 mb4 = (MAILBOX4*)mbq;
10061 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
10062
10063 mbq->nonembed = NULL;

--- 23 unchanged lines hidden (view full) ---

10087} /* emlxs_vfi_init_action() */
10088
10089
10090/*ARGSUSED*/
10091static uint32_t
10092emlxs_vfi_init_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10093 void *arg1)
10094{
7474 uint32_t rval;
10095 uint32_t rval = 0;
7475
7476 vfip->attempts++;
7477
7478 if (vfip->state != VFI_STATE_INIT_FAILED) {
7479 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7480 "vfi_init_action:%d %s:%s arg=%p attempt=%d. "
10096
10097 vfip->attempts++;
10098
10099 if (vfip->state != VFI_STATE_INIT_FAILED) {
10100 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10101 "vfi_init_action:%d %s:%s arg=%p attempt=%d. "
7481 "Invalid state. Terminated.",
10102 "Invalid state. <",
7482 vfip->VFI,
7483 emlxs_vfi_state_xlate(vfip->state),
7484 emlxs_fcf_event_xlate(evt), arg1,
7485 vfip->attempts);
10103 vfip->VFI,
10104 emlxs_vfi_state_xlate(vfip->state),
10105 emlxs_fcf_event_xlate(evt), arg1,
10106 vfip->attempts);
7486
7487 return (1);
7488 }
7489
7490 if ((vfip->reason == FCF_REASON_SEND_FAILED) ||
7491 (vfip->attempts >= 3)) {
7492 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7493 "vfi_init_action:%d attempt=%d reason=%x. Init cmpl.",
7494 vfip->VFI,

--- 21 unchanged lines hidden (view full) ---

7516} /* emlxs_vfi_init_failed_action() */
7517
7518
7519/*ARGSUSED*/
7520static uint32_t
7521emlxs_vfi_init_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7522 void *arg1)
7523{
10107 return (1);
10108 }
10109
10110 if ((vfip->reason == FCF_REASON_SEND_FAILED) ||
10111 (vfip->attempts >= 3)) {
10112 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10113 "vfi_init_action:%d attempt=%d reason=%x. Init cmpl.",
10114 vfip->VFI,

--- 21 unchanged lines hidden (view full) ---

10136} /* emlxs_vfi_init_failed_action() */
10137
10138
10139/*ARGSUSED*/
10140static uint32_t
10141emlxs_vfi_init_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10142 void *arg1)
10143{
7524 uint32_t rval;
10144 uint32_t rval = 0;
7525
7526 if (vfip->state != VFI_STATE_INIT_CMPL) {
7527 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7528 "vfi_init_cmpl_action:%d %s:%s arg=%p. "
10145
10146 if (vfip->state != VFI_STATE_INIT_CMPL) {
10147 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10148 "vfi_init_cmpl_action:%d %s:%s arg=%p. "
7529 "Invalid state. Terminated.",
10149 "Invalid state. <",
7530 vfip->VFI,
7531 emlxs_vfi_state_xlate(vfip->state),
7532 emlxs_fcf_event_xlate(evt), arg1);
7533 return (1);
7534 }
7535
7536 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7537 "vfi_init_cmpl_action:%d attempts=%d. Init cmpl.",

--- 9 unchanged lines hidden (view full) ---

7547
7548
7549/*ARGSUSED*/
7550static uint32_t
7551emlxs_vfi_vpi_online_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7552 void *arg1)
7553{
7554 emlxs_hba_t *hba = HBA;
10150 vfip->VFI,
10151 emlxs_vfi_state_xlate(vfip->state),
10152 emlxs_fcf_event_xlate(evt), arg1);
10153 return (1);
10154 }
10155
10156 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10157 "vfi_init_cmpl_action:%d attempts=%d. Init cmpl.",

--- 9 unchanged lines hidden (view full) ---

10167
10168
10169/*ARGSUSED*/
10170static uint32_t
10171emlxs_vfi_vpi_online_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10172 void *arg1)
10173{
10174 emlxs_hba_t *hba = HBA;
7555 uint32_t rval;
10175 uint32_t rval = 0;
7556 uint32_t i;
7557 emlxs_port_t *vport;
7558 VPIobj_t *vpip;
7559
7560 if (vfip->state != VFI_STATE_VPI_ONLINE) {
7561 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7562 "vfi_vpi_online_action:%d %s:%s arg=%p. "
10176 uint32_t i;
10177 emlxs_port_t *vport;
10178 VPIobj_t *vpip;
10179
10180 if (vfip->state != VFI_STATE_VPI_ONLINE) {
10181 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10182 "vfi_vpi_online_action:%d %s:%s arg=%p. "
7563 "Invalid state. Terminated.",
10183 "Invalid state. <",
7564 vfip->VFI,
7565 emlxs_vfi_state_xlate(vfip->state),
7566 emlxs_fcf_event_xlate(evt), arg1);
7567 return (1);
7568 }
7569
7570 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
7571 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7572 "vfi_vpi_online_action:%d. Offline requested.",
7573 vfip->VFI);
7574
7575 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
7576 return (rval);
7577 }
7578
10184 vfip->VFI,
10185 emlxs_vfi_state_xlate(vfip->state),
10186 emlxs_fcf_event_xlate(evt), arg1);
10187 return (1);
10188 }
10189
10190 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
10191 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10192 "vfi_vpi_online_action:%d. Offline requested.",
10193 vfip->VFI);
10194
10195 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
10196 return (rval);
10197 }
10198
7579 if (vfip->logi_count > 0) {
10199 if (vfip->logi_count) {
7580 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7581 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
7582 "VPI already logged in.",
7583 vfip->VFI,
7584 vfip->vpi_online,
7585 vfip->logi_count);
7586 }
7587
10200 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10201 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
10202 "VPI already logged in.",
10203 vfip->VFI,
10204 vfip->vpi_online,
10205 vfip->logi_count);
10206 }
10207
7588 if (vfip->vpi_online > 0) {
7589 /* Waking up out after being paused */
10208 if (vfip->vpi_online) {
10209 /* Waking up after being paused */
7590
7591 /* Find first VPI of this VFI */
7592 for (i = 0; i <= hba->vpi_max; i++) {
7593 vport = &VPORT(i);
10210
10211 /* Find first VPI of this VFI */
10212 for (i = 0; i <= hba->vpi_max; i++) {
10213 vport = &VPORT(i);
7594 vpip = &vport->VPIobj;
10214 vpip = vport->vpip;
7595
10215
7596 if (!(vport->flag & EMLXS_PORT_BOUND)) {
10216 if (!(vport->flag & EMLXS_PORT_BOUND) ||
10217 (vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
7597 continue;
7598 }
7599
7600 if (vpip->vfip == vfip) {
7601 break;
7602 }
7603 }
7604
7605 } else {
7606
7607 /* Find first available VPI */
7608 for (i = 0; i <= hba->vpi_max; i++) {
7609 vport = &VPORT(i);
10218 continue;
10219 }
10220
10221 if (vpip->vfip == vfip) {
10222 break;
10223 }
10224 }
10225
10226 } else {
10227
10228 /* Find first available VPI */
10229 for (i = 0; i <= hba->vpi_max; i++) {
10230 vport = &VPORT(i);
7610 vpip = &vport->VPIobj;
10231 vpip = vport->vpip;
7611
10232
7612 if (!(vport->flag & EMLXS_PORT_BOUND)) {
10233 if (!(vport->flag & EMLXS_PORT_BOUND) ||
10234 (vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
7613 continue;
7614 }
7615
7616 if (vpip->vfip == NULL) {
7617 vpip->vfip = vfip;
7618 break;
7619 }
7620 }
7621 }
7622
7623 if (i > hba->vpi_max) {
10235 continue;
10236 }
10237
10238 if (vpip->vfip == NULL) {
10239 vpip->vfip = vfip;
10240 break;
10241 }
10242 }
10243 }
10244
10245 if (i > hba->vpi_max) {
7624 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10246 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7625 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
7626 "No VPI found. Offlining.",
7627 vfip->VFI,
7628 vfip->vpi_online,
7629 vfip->logi_count);
7630
7631 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
7632 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
7633 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
7634 return (rval);
7635 }
7636
7637 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7638 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
10247 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
10248 "No VPI found. Offlining.",
10249 vfip->VFI,
10250 vfip->vpi_online,
10251 vfip->logi_count);
10252
10253 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
10254 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
10255 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
10256 return (rval);
10257 }
10258
10259 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10260 "vfi_vpi_online_action:%d vpi_online=%d logi_count=%d. "
7639 "Onlining VPI:%d",
10261 "Onlining VPI:%d >",
7640 vfip->VFI,
7641 vfip->vpi_online,
7642 vfip->logi_count,
7643 vpip->VPI);
7644
7645 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
7646
7647 /* Wait for FCF_EVENT_VPI_ONLINE in return */
7648
7649 return (rval);
7650
7651} /* emlxs_vfi_vpi_online_action() */
7652
7653
7654/*ARGSUSED*/
7655static uint32_t
7656emlxs_vfi_vpi_online_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip,
7657 uint32_t evt, void *arg1)
7658{
10262 vfip->VFI,
10263 vfip->vpi_online,
10264 vfip->logi_count,
10265 vpip->VPI);
10266
10267 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
10268
10269 /* Wait for FCF_EVENT_VPI_ONLINE in return */
10270
10271 return (rval);
10272
10273} /* emlxs_vfi_vpi_online_action() */
10274
10275
10276/*ARGSUSED*/
10277static uint32_t
10278emlxs_vfi_vpi_online_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip,
10279 uint32_t evt, void *arg1)
10280{
7659 uint32_t rval;
10281 uint32_t rval = 0;
10282 VPIobj_t *vpip = (VPIobj_t *)arg1;
7660
7661 if (vfip->state != VFI_STATE_VPI_ONLINE_CMPL) {
7662 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7663 "vfi_vpi_online_cmpl_action:%d %s:%s arg=%p. "
10283
10284 if (vfip->state != VFI_STATE_VPI_ONLINE_CMPL) {
10285 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10286 "vfi_vpi_online_cmpl_action:%d %s:%s arg=%p. "
7664 "Invalid state. Terminated.",
10287 "Invalid state. <",
7665 vfip->VFI,
7666 emlxs_vfi_state_xlate(vfip->state),
7667 emlxs_fcf_event_xlate(evt), arg1);
7668 return (1);
7669 }
7670
10288 vfip->VFI,
10289 emlxs_vfi_state_xlate(vfip->state),
10290 emlxs_fcf_event_xlate(evt), arg1);
10291 return (1);
10292 }
10293
7671 if (vfip->vpi_online > 1) {
7672 /* Waking up after pause */
10294 if (vpip == vfip->flogi_vpip) {
7673 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7674 "vfi_vpi_online_cmpl_action:%d flag=%x vpi_online=%d "
10295 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10296 "vfi_vpi_online_cmpl_action:%d flag=%x vpi_online=%d "
7675 "logi_count=%d. Going online.",
10297 "logi_count=%d. flogi_vpi. Registering.",
7676 vfip->VFI,
7677 vfip->flag,
7678 vfip->vpi_online,
7679 vfip->logi_count);
7680
10298 vfip->VFI,
10299 vfip->flag,
10300 vfip->vpi_online,
10301 vfip->logi_count);
10302
7681 rval = emlxs_vfi_state(port, vfip, VFI_STATE_ONLINE,
10303 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG,
7682 FCF_REASON_EVENT, evt, arg1);
7683 } else {
10304 FCF_REASON_EVENT, evt, arg1);
10305 } else {
10306 /* Waking up after pause */
7684 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7685 "vfi_vpi_online_cmpl_action:%d flag=%x vpi_online=%d "
10307 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10308 "vfi_vpi_online_cmpl_action:%d flag=%x vpi_online=%d "
7686 "logi_count=%d. Registering.",
10309 "logi_count=%d. Going online.",
7687 vfip->VFI,
7688 vfip->flag,
7689 vfip->vpi_online,
7690 vfip->logi_count);
7691
10310 vfip->VFI,
10311 vfip->flag,
10312 vfip->vpi_online,
10313 vfip->logi_count);
10314
7692 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG,
10315 rval = emlxs_vfi_state(port, vfip, VFI_STATE_ONLINE,
7693 FCF_REASON_EVENT, evt, arg1);
7694 }
7695
7696 return (rval);
7697
7698} /* emlxs_vfi_vpi_online_cmpl_action() */
7699
7700
7701/*ARGSUSED*/
7702static uint32_t
7703emlxs_vfi_vpi_offline_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip,
7704 uint32_t evt, void *arg1)
7705{
7706 uint32_t rval = 0;
7707
7708 if (vfip->state != VFI_STATE_VPI_OFFLINE_CMPL) {
7709 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7710 "vfi_vpi_offline_cmpl_action:%d %s:%s arg=%p. "
10316 FCF_REASON_EVENT, evt, arg1);
10317 }
10318
10319 return (rval);
10320
10321} /* emlxs_vfi_vpi_online_cmpl_action() */
10322
10323
10324/*ARGSUSED*/
10325static uint32_t
10326emlxs_vfi_vpi_offline_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip,
10327 uint32_t evt, void *arg1)
10328{
10329 uint32_t rval = 0;
10330
10331 if (vfip->state != VFI_STATE_VPI_OFFLINE_CMPL) {
10332 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10333 "vfi_vpi_offline_cmpl_action:%d %s:%s arg=%p. "
7711 "Invalid state. Terminated.",
10334 "Invalid state. <",
7712 vfip->VFI,
7713 emlxs_vfi_state_xlate(vfip->state),
7714 emlxs_fcf_event_xlate(evt), arg1);
7715 return (1);
7716 }
7717
7718 if ((vfip->vpi_online == 0) &&
7719 (vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
7720 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7721 "vfi_vpi_offline_cmpl_action:%d vpi_online=%d. "
7722 "Unregistering.",
7723 vfip->VFI,
7724 vfip->vpi_online);
7725
7726 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG,
7727 FCF_REASON_EVENT, evt, arg1);
7728 } else {
7729 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10335 vfip->VFI,
10336 emlxs_vfi_state_xlate(vfip->state),
10337 emlxs_fcf_event_xlate(evt), arg1);
10338 return (1);
10339 }
10340
10341 if ((vfip->vpi_online == 0) &&
10342 (vfip->flag & EMLXS_VFI_OFFLINE_REQ)) {
10343 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10344 "vfi_vpi_offline_cmpl_action:%d vpi_online=%d. "
10345 "Unregistering.",
10346 vfip->VFI,
10347 vfip->vpi_online);
10348
10349 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG,
10350 FCF_REASON_EVENT, evt, arg1);
10351 } else {
10352 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7730 "vfi_vpi_offline_cmpl_action:%d vpi_online=%d. Terminated.",
10353 "vfi_vpi_offline_cmpl_action:%d vpi_online=%d. <",
7731 vfip->VFI,
7732 vfip->vpi_online);
7733 }
7734
7735 return (rval);
7736
7737} /* emlxs_vfi_vpi_offline_cmpl_action() */
7738
7739
7740/*ARGSUSED*/
7741static uint32_t
7742emlxs_vfi_vpi_offline_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7743 void *arg1)
7744{
7745 emlxs_hba_t *hba = HBA;
7746 emlxs_port_t *vport;
10354 vfip->VFI,
10355 vfip->vpi_online);
10356 }
10357
10358 return (rval);
10359
10360} /* emlxs_vfi_vpi_offline_cmpl_action() */
10361
10362
10363/*ARGSUSED*/
10364static uint32_t
10365emlxs_vfi_vpi_offline_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10366 void *arg1)
10367{
10368 emlxs_hba_t *hba = HBA;
10369 emlxs_port_t *vport;
7747 uint32_t rval;
10370 uint32_t rval = 0;
7748 int32_t i;
7749 VPIobj_t *vpip;
7750
7751 if (vfip->state != VFI_STATE_VPI_OFFLINE) {
7752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7753 "vfi_vpi_offline_action:%d %s:%s arg=%p. "
10371 int32_t i;
10372 VPIobj_t *vpip;
10373
10374 if (vfip->state != VFI_STATE_VPI_OFFLINE) {
10375 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10376 "vfi_vpi_offline_action:%d %s:%s arg=%p. "
7754 "Invalid state. Terminated.",
10377 "Invalid state. <",
7755 vfip->VFI,
7756 emlxs_vfi_state_xlate(vfip->state),
7757 emlxs_fcf_event_xlate(evt), arg1);
7758 return (1);
7759 }
7760
7761 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
7762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 5 unchanged lines hidden (view full) ---

7768 FCF_REASON_EVENT, evt, arg1);
7769
7770 return (rval);
7771 }
7772
7773 if (vfip->vpi_online == 0) {
7774 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7775 "vfi_vpi_offline_action:%d vpi_online=%d. "
10378 vfip->VFI,
10379 emlxs_vfi_state_xlate(vfip->state),
10380 emlxs_fcf_event_xlate(evt), arg1);
10381 return (1);
10382 }
10383
10384 if (vfip->flag & EMLXS_VFI_PAUSE_REQ) {
10385 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 5 unchanged lines hidden (view full) ---

10391 FCF_REASON_EVENT, evt, arg1);
10392
10393 return (rval);
10394 }
10395
10396 if (vfip->vpi_online == 0) {
10397 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10398 "vfi_vpi_offline_action:%d vpi_online=%d. "
7776 "VPI already offline. Skipping offline.",
10399 "VPI already offline. Skipping VPI offline.",
7777 vfip->VFI,
7778 vfip->vpi_online);
7779
7780 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG,
7781 FCF_REASON_EVENT, evt, arg1);
7782
7783 return (rval);
7784 }
7785
7786 /* Offline all VPI's of this VFI */
7787 for (i = hba->vpi_max; i >= 0; i--) {
7788 vport = &VPORT(i);
10400 vfip->VFI,
10401 vfip->vpi_online);
10402
10403 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG,
10404 FCF_REASON_EVENT, evt, arg1);
10405
10406 return (rval);
10407 }
10408
10409 /* Offline all VPI's of this VFI */
10410 for (i = hba->vpi_max; i >= 0; i--) {
10411 vport = &VPORT(i);
7789 vpip = &vport->VPIobj;
10412 vpip = vport->vpip;
7790
7791 if ((vpip->state == VPI_STATE_OFFLINE) ||
7792 (vpip->vfip != vfip)) {
7793 continue;
7794 }
7795
7796 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10413
10414 if ((vpip->state == VPI_STATE_OFFLINE) ||
10415 (vpip->vfip != vfip)) {
10416 continue;
10417 }
10418
10419 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7797 "vfi_vpi_offline_action:%d. Offlining VPI:%d.",
10420 "vfi_vpi_offline_action:%d. Offlining VPI:%d. >",
7798 vfip->VFI,
7799 vpip->VPI);
7800
7801 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_OFFLINE, vpip);
7802 }
7803
7804 /* Wait for FCF_EVENT_VPI_OFFLINE in return */
7805

--- 10 unchanged lines hidden (view full) ---

7816 emlxs_hba_t *hba = HBA;
7817 emlxs_port_t *vport;
7818 int32_t i;
7819 VPIobj_t *vpip;
7820
7821 if (vfip->state != VFI_STATE_PAUSED) {
7822 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7823 "vfi_paused_action:%d %s:%s arg=%p. "
10421 vfip->VFI,
10422 vpip->VPI);
10423
10424 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_OFFLINE, vpip);
10425 }
10426
10427 /* Wait for FCF_EVENT_VPI_OFFLINE in return */
10428

--- 10 unchanged lines hidden (view full) ---

10439 emlxs_hba_t *hba = HBA;
10440 emlxs_port_t *vport;
10441 int32_t i;
10442 VPIobj_t *vpip;
10443
10444 if (vfip->state != VFI_STATE_PAUSED) {
10445 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10446 "vfi_paused_action:%d %s:%s arg=%p. "
7824 "Invalid state. Terminated.",
10447 "Invalid state. <",
7825 vfip->VFI,
7826 emlxs_vfi_state_xlate(vfip->state),
7827 emlxs_fcf_event_xlate(evt), arg1);
7828 return (1);
7829 }
7830
7831 vfip->flag &= ~(EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
7832
7833 /* Pause all VPI's of this VFI */
7834 for (i = hba->vpi_max; i >= 0; i--) {
7835 vport = &VPORT(i);
10448 vfip->VFI,
10449 emlxs_vfi_state_xlate(vfip->state),
10450 emlxs_fcf_event_xlate(evt), arg1);
10451 return (1);
10452 }
10453
10454 vfip->flag &= ~(EMLXS_VFI_OFFLINE_REQ | EMLXS_VFI_PAUSE_REQ);
10455
10456 /* Pause all VPI's of this VFI */
10457 for (i = hba->vpi_max; i >= 0; i--) {
10458 vport = &VPORT(i);
7836 vpip = &vport->VPIobj;
10459 vpip = vport->vpip;
7837
7838 if ((vpip->state == VPI_STATE_PAUSED) ||
7839 (vpip->vfip != vfip)) {
7840 continue;
7841 }
7842
7843 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10460
10461 if ((vpip->state == VPI_STATE_PAUSED) ||
10462 (vpip->vfip != vfip)) {
10463 continue;
10464 }
10465
10466 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7844 "vfi_paused_action:%d vpi_online=%d. Pausing VPI:%d.",
10467 "vfi_paused_action:%d vpi_online=%d. Pausing VPI:%d. >",
7845 vfip->VFI,
7846 vfip->vpi_online,
7847 vpip->VPI);
7848
7849 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_PAUSE, vpip);
7850 }
7851
7852 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10468 vfip->VFI,
10469 vfip->vpi_online,
10470 vpip->VPI);
10471
10472 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_PAUSE, vpip);
10473 }
10474
10475 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7853 "vfi_paused_action:%d vpi_online=%d. VFI paused.",
10476 "vfi_paused_action:%d vpi_online=%d. VFI paused. <",
7854 vfip->VFI,
7855 vfip->vpi_online);
7856
7857 return (0);
7858
7859} /* emlxs_vfi_paused_action() */
7860
7861
7862/*ARGSUSED*/
7863static uint32_t
7864emlxs_vfi_unreg_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7865 void *arg1)
7866{
10477 vfip->VFI,
10478 vfip->vpi_online);
10479
10480 return (0);
10481
10482} /* emlxs_vfi_paused_action() */
10483
10484
10485/*ARGSUSED*/
10486static uint32_t
10487emlxs_vfi_unreg_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10488 void *arg1)
10489{
7867 uint32_t rval;
10490 uint32_t rval = 0;
7868
7869 vfip->attempts++;
7870
7871 if (vfip->state != VFI_STATE_UNREG_FAILED) {
7872 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7873 "vfi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
10491
10492 vfip->attempts++;
10493
10494 if (vfip->state != VFI_STATE_UNREG_FAILED) {
10495 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10496 "vfi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
7874 "Invalid state. Terminated.",
10497 "Invalid state. <",
7875 vfip->VFI,
7876 emlxs_vfi_state_xlate(vfip->state),
7877 emlxs_fcf_event_xlate(evt), arg1,
7878 vfip->attempts);
10498 vfip->VFI,
10499 emlxs_vfi_state_xlate(vfip->state),
10500 emlxs_fcf_event_xlate(evt), arg1,
10501 vfip->attempts);
7879
7880 return (1);
7881 }
7882
7883 if (vfip->attempts >= 3) {
7884 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7885 "vfi_unreg_failed_action:%d attempt=%d. Unreg cmpl.",
7886 vfip->VFI,
7887 vfip->attempts);

--- 27 unchanged lines hidden (view full) ---

7915
7916 vfip = (VFIobj_t *)mbq->context;
7917 mb4 = (MAILBOX4 *)mbq;
7918
7919 mutex_enter(&EMLXS_FCF_LOCK);
7920
7921 if (vfip->state != VFI_STATE_UNREG) {
7922 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10502 return (1);
10503 }
10504
10505 if (vfip->attempts >= 3) {
10506 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10507 "vfi_unreg_failed_action:%d attempt=%d. Unreg cmpl.",
10508 vfip->VFI,
10509 vfip->attempts);

--- 27 unchanged lines hidden (view full) ---

10537
10538 vfip = (VFIobj_t *)mbq->context;
10539 mb4 = (MAILBOX4 *)mbq;
10540
10541 mutex_enter(&EMLXS_FCF_LOCK);
10542
10543 if (vfip->state != VFI_STATE_UNREG) {
10544 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7923 "vfi_unreg_mbcmpl:%d state=%s. Terminated.",
10545 "vfi_unreg_mbcmpl:%d state=%s.",
7924 vfip->VFI,
7925 emlxs_vfi_state_xlate(vfip->state));
7926
7927 mutex_exit(&EMLXS_FCF_LOCK);
7928 return (0);
7929 }
7930
7931 if (mb4->mbxStatus) {
7932 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10546 vfip->VFI,
10547 emlxs_vfi_state_xlate(vfip->state));
10548
10549 mutex_exit(&EMLXS_FCF_LOCK);
10550 return (0);
10551 }
10552
10553 if (mb4->mbxStatus) {
10554 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7933 "vfi_unreg_mbcmpl:%d failed. status=%x",
10555 "vfi_unreg_mbcmpl:%d failed. %s. >",
7934 vfip->VFI,
10556 vfip->VFI,
7935 mb4->mbxStatus);
10557 emlxs_mb_xlate_status(mb4->mbxStatus));
7936
7937 (void) emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_FAILED,
7938 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
7939
7940 mutex_exit(&EMLXS_FCF_LOCK);
7941 return (0);
7942 }
7943
7944 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10558
10559 (void) emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_FAILED,
10560 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
10561
10562 mutex_exit(&EMLXS_FCF_LOCK);
10563 return (0);
10564 }
10565
10566 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7945 "vfi_unreg_mbcmpl:%d Unregistered.",
10567 "vfi_unreg_mbcmpl:%d. Unreg complete. >",
7946 vfip->VFI);
7947
7948 vfip->flag &= ~(EMLXS_VFI_REG | EMLXS_VFI_INIT);
7949 (void) emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_CMPL,
7950 0, 0, 0);
7951
7952 mutex_exit(&EMLXS_FCF_LOCK);
7953 return (0);

--- 4 unchanged lines hidden (view full) ---

7958/*ARGSUSED*/
7959static uint32_t
7960emlxs_vfi_unreg_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
7961 void *arg1)
7962{
7963 emlxs_hba_t *hba = HBA;
7964 MAILBOX4 *mb4;
7965 MAILBOXQ *mbq;
10568 vfip->VFI);
10569
10570 vfip->flag &= ~(EMLXS_VFI_REG | EMLXS_VFI_INIT);
10571 (void) emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_CMPL,
10572 0, 0, 0);
10573
10574 mutex_exit(&EMLXS_FCF_LOCK);
10575 return (0);

--- 4 unchanged lines hidden (view full) ---

10580/*ARGSUSED*/
10581static uint32_t
10582emlxs_vfi_unreg_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10583 void *arg1)
10584{
10585 emlxs_hba_t *hba = HBA;
10586 MAILBOX4 *mb4;
10587 MAILBOXQ *mbq;
7966 uint32_t rval;
10588 uint32_t rval = 0;
7967
7968 if (vfip->state != VFI_STATE_UNREG) {
7969 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
7970 "vfi_unreg_action:%d %s:%s arg=%p. "
10589
10590 if (vfip->state != VFI_STATE_UNREG) {
10591 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10592 "vfi_unreg_action:%d %s:%s arg=%p. "
7971 "Invalid state. Terminated.",
10593 "Invalid state. <",
7972 vfip->VFI,
7973 emlxs_vfi_state_xlate(vfip->state),
7974 emlxs_fcf_event_xlate(evt), arg1);
10594 vfip->VFI,
10595 emlxs_vfi_state_xlate(vfip->state),
10596 emlxs_fcf_event_xlate(evt), arg1);
7975
7976 return (1);
7977 }
7978
7979 if (!(vfip->flag & EMLXS_VFI_REG)) {
7980 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10597 return (1);
10598 }
10599
10600 if (!(vfip->flag & EMLXS_VFI_REG)) {
10601 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7981 "vfi_unreg_action:%d. Not registered. Skipping unreg.",
10602 "vfi_unreg_action:%d. Not registered. Skipping UNREG_VFI.",
7982 vfip->VFI);
7983
7984 rval = emlxs_vfi_state(port, vfip, VFI_STATE_OFFLINE,
7985 FCF_REASON_EVENT, evt, arg1);
7986 return (rval);
7987 }
7988
7989 if (vfip->prev_state != VFI_STATE_UNREG_FAILED) {
7990 vfip->attempts = 0;
7991 }
7992
7993 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10603 vfip->VFI);
10604
10605 rval = emlxs_vfi_state(port, vfip, VFI_STATE_OFFLINE,
10606 FCF_REASON_EVENT, evt, arg1);
10607 return (rval);
10608 }
10609
10610 if (vfip->prev_state != VFI_STATE_UNREG_FAILED) {
10611 vfip->attempts = 0;
10612 }
10613
10614 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
7994 "vfi_unreg_action:%d attempts=%d. Sending UNREG_VFI.",
10615 "vfi_unreg_action:%d attempts=%d. Sending UNREG_VFI. <",
7995 vfip->VFI,
7996 vfip->attempts);
7997
10616 vfip->VFI,
10617 vfip->attempts);
10618
7998 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
10619 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
7999 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_FAILED,
8000 FCF_REASON_NO_MBOX, 0, arg1);
8001
8002 return (rval);
8003 }
8004 mb4 = (MAILBOX4*)mbq;
8005 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
8006

--- 21 unchanged lines hidden (view full) ---

8028} /* emlxs_vfi_unreg_action() */
8029
8030
8031/*ARGSUSED*/
8032static uint32_t
8033emlxs_vfi_unreg_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
8034 void *arg1)
8035{
10620 rval = emlxs_vfi_state(port, vfip, VFI_STATE_UNREG_FAILED,
10621 FCF_REASON_NO_MBOX, 0, arg1);
10622
10623 return (rval);
10624 }
10625 mb4 = (MAILBOX4*)mbq;
10626 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
10627

--- 21 unchanged lines hidden (view full) ---

10649} /* emlxs_vfi_unreg_action() */
10650
10651
10652/*ARGSUSED*/
10653static uint32_t
10654emlxs_vfi_unreg_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10655 void *arg1)
10656{
8036 uint32_t rval;
10657 uint32_t rval = 0;
8037
8038 if (vfip->state != VFI_STATE_UNREG_CMPL) {
8039 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8040 "vfi_unreg_cmpl_action:%d %s:%s arg=%p. "
10658
10659 if (vfip->state != VFI_STATE_UNREG_CMPL) {
10660 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10661 "vfi_unreg_cmpl_action:%d %s:%s arg=%p. "
8041 "Invalid state. Terminated.",
10662 "Invalid state. <",
8042 vfip->VFI,
8043 emlxs_vfi_state_xlate(vfip->state),
8044 emlxs_fcf_event_xlate(evt), arg1);
8045 return (1);
8046 }
8047
8048 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8049 "vfi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 8 unchanged lines hidden (view full) ---

8058} /* emlxs_vfi_unreg_cmpl_action() */
8059
8060
8061/*ARGSUSED*/
8062static uint32_t
8063emlxs_vfi_reg_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
8064 void *arg1)
8065{
10663 vfip->VFI,
10664 emlxs_vfi_state_xlate(vfip->state),
10665 emlxs_fcf_event_xlate(evt), arg1);
10666 return (1);
10667 }
10668
10669 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10670 "vfi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 8 unchanged lines hidden (view full) ---

10679} /* emlxs_vfi_unreg_cmpl_action() */
10680
10681
10682/*ARGSUSED*/
10683static uint32_t
10684emlxs_vfi_reg_failed_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10685 void *arg1)
10686{
8066 uint32_t rval;
10687 uint32_t rval = 0;
8067
8068 vfip->attempts++;
8069
8070 if (vfip->state != VFI_STATE_REG_FAILED) {
8071 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8072 "vfi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
10688
10689 vfip->attempts++;
10690
10691 if (vfip->state != VFI_STATE_REG_FAILED) {
10692 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10693 "vfi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
8073 "Invalid state. Terminated.",
10694 "Invalid state. <",
8074 vfip->VFI,
8075 emlxs_vfi_state_xlate(vfip->state),
8076 emlxs_fcf_event_xlate(evt), arg1,
8077 vfip->attempts);
10695 vfip->VFI,
10696 emlxs_vfi_state_xlate(vfip->state),
10697 emlxs_fcf_event_xlate(evt), arg1,
10698 vfip->attempts);
8078
8079 return (1);
8080 }
8081
8082 if ((vfip->reason == FCF_REASON_SEND_FAILED) ||
8083 (vfip->attempts >= 3)) {
8084 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8085 "vfi_reg_failed_action:%d attempt=%d reason=%x. Reg cmpl.",
8086 vfip->VFI,
8087 vfip->attempts,
8088 vfip->reason);
8089
10699 return (1);
10700 }
10701
10702 if ((vfip->reason == FCF_REASON_SEND_FAILED) ||
10703 (vfip->attempts >= 3)) {
10704 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10705 "vfi_reg_failed_action:%d attempt=%d reason=%x. Reg cmpl.",
10706 vfip->VFI,
10707 vfip->attempts,
10708 vfip->reason);
10709
8090 vfip->flag &= ~(EMLXS_VFI_REG | EMLXS_VFI_INIT);
8091
8092 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
8093 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
8094 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_CMPL,
8095 FCF_REASON_OP_FAILED, vfip->attempts, arg1);
8096 } else {
8097 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8098 "vfi_reg_failed_action:%d attempt=%d. Registering.",
8099 vfip->VFI,

--- 10 unchanged lines hidden (view full) ---

8110
8111/*ARGSUSED*/
8112static uint32_t
8113emlxs_vfi_reg_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
8114{
8115 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
8116 MAILBOX4 *mb4;
8117 VFIobj_t *vfip;
10710 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
10711 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
10712 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_CMPL,
10713 FCF_REASON_OP_FAILED, vfip->attempts, arg1);
10714 } else {
10715 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10716 "vfi_reg_failed_action:%d attempt=%d. Registering.",
10717 vfip->VFI,

--- 10 unchanged lines hidden (view full) ---

10728
10729/*ARGSUSED*/
10730static uint32_t
10731emlxs_vfi_reg_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
10732{
10733 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
10734 MAILBOX4 *mb4;
10735 VFIobj_t *vfip;
10736 MATCHMAP *mp;
8118
8119 vfip = (VFIobj_t *)mbq->context;
8120 mb4 = (MAILBOX4 *)mbq;
8121
8122 mutex_enter(&EMLXS_FCF_LOCK);
8123
8124 if (vfip->state != VFI_STATE_REG) {
8125 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10737
10738 vfip = (VFIobj_t *)mbq->context;
10739 mb4 = (MAILBOX4 *)mbq;
10740
10741 mutex_enter(&EMLXS_FCF_LOCK);
10742
10743 if (vfip->state != VFI_STATE_REG) {
10744 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8126 "vfi_reg_mbcmpl:%d state=%s. Terminated.",
10745 "vfi_reg_mbcmpl:%d state=%s.",
8127 vfip->VFI,
8128 emlxs_vfi_state_xlate(vfip->state));
8129
8130 mutex_exit(&EMLXS_FCF_LOCK);
8131 return (0);
8132 }
8133
8134 if (mb4->mbxStatus) {
8135 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10746 vfip->VFI,
10747 emlxs_vfi_state_xlate(vfip->state));
10748
10749 mutex_exit(&EMLXS_FCF_LOCK);
10750 return (0);
10751 }
10752
10753 if (mb4->mbxStatus) {
10754 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8136 "vfi_reg_mbcmpl:%d failed. status=%x",
10755 "vfi_reg_mbcmpl:%d failed. %s. >",
8137 vfip->VFI,
10756 vfip->VFI,
8138 mb4->mbxStatus);
10757 emlxs_mb_xlate_status(mb4->mbxStatus));
8139
8140 (void) emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
8141 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
8142
8143 mutex_exit(&EMLXS_FCF_LOCK);
8144 return (0);
8145 }
8146
10758
10759 (void) emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
10760 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
10761
10762 mutex_exit(&EMLXS_FCF_LOCK);
10763 return (0);
10764 }
10765
8147 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8148 "vfi_reg_mbcmpl:%d Registered.",
8149 vfip->VFI);
10766 /* Archive a copy of the sparams in case we need them later */
10767 mp = (MATCHMAP *)mbq->bp;
10768 bcopy((uint32_t *)mp->virt, (uint32_t *)&vfip->sparam,
10769 sizeof (SERV_PARM));
8150
10770
8151 if (vfip->vpi_online == 1) {
8152 port->VPIobj.flag |= EMLXS_VPI_REG;
10771 if (vfip->flogi_vpip) {
10772 if (mb4->un.varRegVFI4.vp == 1) {
10773 vfip->flogi_vpip->flag |= EMLXS_VPI_REG;
10774 }
10775 vfip->flogi_vpip = NULL;
8153 }
8154
8155 vfip->flag |= EMLXS_VFI_REG;
8156
10776 }
10777
10778 vfip->flag |= EMLXS_VFI_REG;
10779
10780 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10781 "vfi_reg_mbcmpl:%d. Reg complete. >",
10782 vfip->VFI);
10783
8157 (void) emlxs_vfi_state(port, vfip, VFI_STATE_REG_CMPL, 0, 0, 0);
8158
8159 mutex_exit(&EMLXS_FCF_LOCK);
8160 return (0);
8161
8162} /* emlxs_vfi_reg_mbcmpl() */
8163
8164
8165/*ARGSUSED*/
8166static uint32_t
8167emlxs_vfi_reg_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
8168 void *arg1)
8169{
8170 emlxs_hba_t *hba = HBA;
10784 (void) emlxs_vfi_state(port, vfip, VFI_STATE_REG_CMPL, 0, 0, 0);
10785
10786 mutex_exit(&EMLXS_FCF_LOCK);
10787 return (0);
10788
10789} /* emlxs_vfi_reg_mbcmpl() */
10790
10791
10792/*ARGSUSED*/
10793static uint32_t
10794emlxs_vfi_reg_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10795 void *arg1)
10796{
10797 emlxs_hba_t *hba = HBA;
8171 FCFIobj_t *fcfp;
8172 MAILBOX4 *mb4;
8173 MAILBOXQ *mbq;
8174 MATCHMAP *mp;
10798 MAILBOX4 *mb4;
10799 MAILBOXQ *mbq;
10800 MATCHMAP *mp;
8175 uint32_t rval;
10801 uint32_t rval = 0;
8176 uint32_t edtov;
8177 uint32_t ratov;
10802 uint32_t edtov;
10803 uint32_t ratov;
10804 SERV_PARM *flogi_sparam;
10805 uint32_t *wwpn;
8178
8179 if (vfip->state != VFI_STATE_REG) {
8180 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8181 "vfi_reg_action:%d %s:%s arg=%p. "
10806
10807 if (vfip->state != VFI_STATE_REG) {
10808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10809 "vfi_reg_action:%d %s:%s arg=%p. "
8182 "Invalid state. Terminated.",
10810 "Invalid state. <",
8183 vfip->VFI,
8184 emlxs_vfi_state_xlate(vfip->state),
8185 emlxs_fcf_event_xlate(evt), arg1);
10811 vfip->VFI,
10812 emlxs_vfi_state_xlate(vfip->state),
10813 emlxs_fcf_event_xlate(evt), arg1);
8186
8187 return (1);
8188 }
8189
8190 if (vfip->prev_state != VFI_STATE_REG_FAILED) {
8191 vfip->attempts = 0;
8192 }
8193
8194 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
8195 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8196 "vfi_reg_action:%d %attempts=%d. Offline requested.",
8197 vfip->VFI,
8198 vfip->attempts);
8199
8200 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
8201 return (rval);
8202 }
8203
10814 return (1);
10815 }
10816
10817 if (vfip->prev_state != VFI_STATE_REG_FAILED) {
10818 vfip->attempts = 0;
10819 }
10820
10821 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
10822 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10823 "vfi_reg_action:%d %attempts=%d. Offline requested.",
10824 vfip->VFI,
10825 vfip->attempts);
10826
10827 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
10828 return (rval);
10829 }
10830
8204 if (vfip->flag & EMLXS_VFI_REG) {
10831 if (!vfip->flogi_vpip) {
8205 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10832 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10833 "vfi_reg_action:%d %attempts=%d. No flogi_vpi found.",
10834 vfip->VFI,
10835 vfip->attempts);
10836
10837 vfip->flag &= ~EMLXS_VFI_REQ_MASK;
10838 vfip->flag |= EMLXS_VFI_OFFLINE_REQ;
10839
10840 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
10841 return (rval);
10842 }
10843
10844 if ((hba->model_info.chip & EMLXS_BE_CHIPS) &&
10845 (vfip->flag & EMLXS_VFI_REG)) {
10846 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8206 "vfi_reg_action:%d flag=%x. "
10847 "vfi_reg_action:%d flag=%x. "
8207 "Already registered. Skipping reg.",
10848 "Already registered. Skipping REG_VFI update.",
8208 vfip->VFI);
8209
8210 rval = emlxs_vfi_state(port, vfip, VFI_STATE_ONLINE,
8211 FCF_REASON_EVENT, evt, arg1);
8212 return (rval);
8213 }
8214
10849 vfip->VFI);
10850
10851 rval = emlxs_vfi_state(port, vfip, VFI_STATE_ONLINE,
10852 FCF_REASON_EVENT, evt, arg1);
10853 return (rval);
10854 }
10855
8215 if (vfip->fcf_sparam.cmn.edtovResolution) {
8216 edtov = (LE_SWAP32(vfip->fcf_sparam.cmn.e_d_tov) + 999999) /
10856 /* Get the flogi_vpip's fabric_rpip's service parameters */
10857 flogi_sparam = &vfip->flogi_vpip->fabric_rpip->sparam;
10858
10859 if (flogi_sparam->cmn.edtovResolution) {
10860 edtov = (LE_SWAP32(flogi_sparam->cmn.e_d_tov) + 999999) /
8217 1000000;
8218 } else {
10861 1000000;
10862 } else {
8219 edtov = LE_SWAP32(vfip->fcf_sparam.cmn.e_d_tov);
10863 edtov = LE_SWAP32(flogi_sparam->cmn.e_d_tov);
8220 }
8221
10864 }
10865
8222 ratov = (LE_SWAP32(vfip->fcf_sparam.cmn.w2.r_a_tov) + 999) / 1000;
10866 ratov = (LE_SWAP32(flogi_sparam->cmn.w2.r_a_tov) + 999) / 1000;
8223
10867
8224 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8225 "vfi_reg_action:%d attempts=%d edtov=%d ratov=%d. "
8226 "Sending REG_VFI.",
8227 vfip->VFI,
8228 vfip->attempts,
8229 edtov, ratov);
10868 if (vfip->flag & EMLXS_VFI_REG) {
10869 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10870 "vfi_reg_action:%d attempts=%d edtov=%d ratov=%d. "
10871 "Updating REG_VFI. <",
10872 vfip->VFI,
10873 vfip->attempts,
10874 edtov, ratov);
10875 } else {
10876 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10877 "vfi_reg_action:%d attempts=%d edtov=%d ratov=%d. "
10878 "Sending REG_VFI. <",
10879 vfip->VFI,
10880 vfip->attempts,
10881 edtov, ratov);
10882 }
8230
10883
8231 fcfp = vfip->fcfp;
8232
8233 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
10884 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
8234 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
8235 FCF_REASON_NO_MBOX, 0, arg1);
8236
8237 return (rval);
8238 }
8239 mb4 = (MAILBOX4*)mbq;
8240 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
8241
10885 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
10886 FCF_REASON_NO_MBOX, 0, arg1);
10887
10888 return (rval);
10889 }
10890 mb4 = (MAILBOX4*)mbq;
10891 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
10892
8242 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
10893 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
8243 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
8244
8245 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
8246 FCF_REASON_NO_BUFFER, 0, arg1);
8247
8248 return (1);
8249 }
8250
8251 mbq->bp = (void *)mp;
8252 mbq->nonembed = NULL;
8253
8254 mbq->mbox_cmpl = emlxs_vfi_reg_mbcmpl;
8255 mbq->context = (void *)vfip;
8256 mbq->port = (void *)port;
8257
8258 mb4->mbxCommand = MBX_REG_VFI;
8259 mb4->mbxOwner = OWN_HOST;
10894 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
10895
10896 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
10897 FCF_REASON_NO_BUFFER, 0, arg1);
10898
10899 return (1);
10900 }
10901
10902 mbq->bp = (void *)mp;
10903 mbq->nonembed = NULL;
10904
10905 mbq->mbox_cmpl = emlxs_vfi_reg_mbcmpl;
10906 mbq->context = (void *)vfip;
10907 mbq->port = (void *)port;
10908
10909 mb4->mbxCommand = MBX_REG_VFI;
10910 mb4->mbxOwner = OWN_HOST;
10911
8260 mb4->un.varRegVFI4.vfi = vfip->VFI;
10912 mb4->un.varRegVFI4.vfi = vfip->VFI;
10913 mb4->un.varRegVFI4.upd = (vfip->flag & EMLXS_VFI_REG)? 1:0;
8261
10914
8262 if (vfip->fcfp->vfi_online == 1) {
10915 /* If the flogi_vpip was not previously registered, */
10916 /* perform the REG_VPI now */
10917 if (!(vfip->flogi_vpip->flag & EMLXS_VPI_REG)) {
8263 mb4->un.varRegVFI4.vp = 1;
10918 mb4->un.varRegVFI4.vp = 1;
8264 mb4->un.varRegVFI4.vpi = port->VPIobj.VPI;
10919 mb4->un.varRegVFI4.vpi = vfip->flogi_vpip->VPI;
8265 }
8266
10920 }
10921
8267 mb4->un.varRegVFI4.fcfi = fcfp->FCFI;
10922 mb4->un.varRegVFI4.fcfi = vfip->fcfp->FCFI;
10923 wwpn = (uint32_t *)&port->wwpn;
10924 mb4->un.varRegVFI4.portname[0] = BE_SWAP32(*wwpn);
10925 wwpn++;
10926 mb4->un.varRegVFI4.portname[1] = BE_SWAP32(*wwpn);
8268 mb4->un.varRegVFI4.sid = port->did;
8269 mb4->un.varRegVFI4.edtov = edtov;
10927 mb4->un.varRegVFI4.sid = port->did;
10928 mb4->un.varRegVFI4.edtov = edtov;
8270
8271 /* Convert to seconds */
8272 mb4->un.varRegVFI4.ratov = ratov;
8273 mb4->un.varRegVFI4.bde.tus.f.bdeSize = sizeof (SERV_PARM);
8274 mb4->un.varRegVFI4.bde.addrHigh = PADDR_HI(mp->phys);
8275 mb4->un.varRegVFI4.bde.addrLow = PADDR_LO(mp->phys);
10929 mb4->un.varRegVFI4.ratov = ratov;
10930 mb4->un.varRegVFI4.bde.tus.f.bdeSize = sizeof (SERV_PARM);
10931 mb4->un.varRegVFI4.bde.addrHigh = PADDR_HI(mp->phys);
10932 mb4->un.varRegVFI4.bde.addrLow = PADDR_LO(mp->phys);
8276 bcopy((uint32_t *)&vfip->fcf_sparam,
8277 (uint32_t *)mp->virt, sizeof (SERV_PARM));
10933 bcopy((uint32_t *)flogi_sparam, (uint32_t *)mp->virt,
10934 sizeof (SERV_PARM));
8278
8279 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
8280 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
8281 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
8282 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
8283
8284 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
8285 FCF_REASON_SEND_FAILED, rval, arg1);

--- 6 unchanged lines hidden (view full) ---

8292} /* emlxs_vfi_reg_action() */
8293
8294
8295/*ARGSUSED*/
8296static uint32_t
8297emlxs_vfi_reg_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
8298 void *arg1)
8299{
10935
10936 rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
10937 if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
10938 emlxs_mem_put(hba, MEM_BUF, (void *)mp);
10939 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
10940
10941 rval = emlxs_vfi_state(port, vfip, VFI_STATE_REG_FAILED,
10942 FCF_REASON_SEND_FAILED, rval, arg1);

--- 6 unchanged lines hidden (view full) ---

10949} /* emlxs_vfi_reg_action() */
10950
10951
10952/*ARGSUSED*/
10953static uint32_t
10954emlxs_vfi_reg_cmpl_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10955 void *arg1)
10956{
8300 uint32_t rval;
10957 uint32_t rval = 0;
8301
8302 if (vfip->state != VFI_STATE_REG_CMPL) {
8303 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8304 "vfi_reg_cmpl_action:%d %s:%s arg=%p. "
10958
10959 if (vfip->state != VFI_STATE_REG_CMPL) {
10960 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10961 "vfi_reg_cmpl_action:%d %s:%s arg=%p. "
8305 "Invalid state. Terminated.",
10962 "Invalid state. <",
8306 vfip->VFI,
8307 emlxs_vfi_state_xlate(vfip->state),
8308 emlxs_fcf_event_xlate(evt), arg1);
8309 return (1);
8310 }
8311
8312 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
8313 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 20 unchanged lines hidden (view full) ---

8334
8335/*ARGSUSED*/
8336static uint32_t
8337emlxs_vfi_online_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
8338 void *arg1)
8339{
8340 emlxs_hba_t *hba = HBA;
8341 uint32_t i;
10963 vfip->VFI,
10964 emlxs_vfi_state_xlate(vfip->state),
10965 emlxs_fcf_event_xlate(evt), arg1);
10966 return (1);
10967 }
10968
10969 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
10970 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 20 unchanged lines hidden (view full) ---

10991
10992/*ARGSUSED*/
10993static uint32_t
10994emlxs_vfi_online_action(emlxs_port_t *port, VFIobj_t *vfip, uint32_t evt,
10995 void *arg1)
10996{
10997 emlxs_hba_t *hba = HBA;
10998 uint32_t i;
8342 uint32_t rval;
8343 VPIobj_t *vpip;
10999 uint32_t rval = 0;
11000 VPIobj_t *vpip = port->vpip;
8344 emlxs_port_t *vport;
8345
8346 if (vfip->state != VFI_STATE_ONLINE) {
8347 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8348 "vfi_online_action:%d %s:%s arg=%p. "
11001 emlxs_port_t *vport;
11002
11003 if (vfip->state != VFI_STATE_ONLINE) {
11004 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11005 "vfi_online_action:%d %s:%s arg=%p. "
8349 "Invalid state. Terminated.",
11006 "Invalid state. <",
8350 vfip->VFI,
8351 emlxs_vfi_state_xlate(vfip->state),
8352 emlxs_fcf_event_xlate(evt), arg1);
8353 return (1);
8354 }
8355
8356 vfip->flag &= ~EMLXS_VFI_ONLINE_REQ;
8357
8358 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
8359 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8360 "vfi_online_action:%d attempts=%d. Offline requested.",
8361 vfip->VFI,
8362 vfip->attempts);
8363
8364 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
8365 return (rval);
8366 }
8367
11007 vfip->VFI,
11008 emlxs_vfi_state_xlate(vfip->state),
11009 emlxs_fcf_event_xlate(evt), arg1);
11010 return (1);
11011 }
11012
11013 vfip->flag &= ~EMLXS_VFI_ONLINE_REQ;
11014
11015 if (vfip->flag & EMLXS_VFI_OFFLINE_REQ) {
11016 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11017 "vfi_online_action:%d attempts=%d. Offline requested.",
11018 vfip->VFI,
11019 vfip->attempts);
11020
11021 rval = emlxs_vfi_offline_handler(port, vfip, arg1);
11022 return (rval);
11023 }
11024
8368 vpip = &port->VPIobj;
11025 /* Take the port's Fabric RPI online now */
11026 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11027 "vfi_online_action:%d. Onlining Fabric RPI. >",
11028 vfip->VFI);
8369
11029
8370 /* Take Fabric RPI online now */
8371 if (vpip->rpip->state != RPI_STATE_ONLINE) {
8372 /* This will complete the FLOGI/FDISC back to Leadville */
8373 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_ONLINE, vpip->rpip);
8374 }
11030 /* This will complete the FLOGI/FDISC back to Leadville */
11031 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_ONLINE,
11032 vpip->fabric_rpip);
8375
8376 /* FLOGI/FDISC has been completed back to Leadville */
8377 /* It is now safe to accept unsolicited requests */
8378 vpip->flag |= EMLXS_VPI_PORT_ENABLED;
8379
8380 /* Online remaining VPI's */
8381 for (i = 0; i <= hba->vpi_max; i++) {
8382 vport = &VPORT(i);
11033
11034 /* FLOGI/FDISC has been completed back to Leadville */
11035 /* It is now safe to accept unsolicited requests */
11036 vpip->flag |= EMLXS_VPI_PORT_ENABLED;
11037
11038 /* Online remaining VPI's */
11039 for (i = 0; i <= hba->vpi_max; i++) {
11040 vport = &VPORT(i);
8383 vpip = &vport->VPIobj;
11041 vpip = vport->vpip;
8384
11042
8385 if (!(vport->flag & EMLXS_PORT_BOUND)) {
11043 if (!(vport->flag & EMLXS_PORT_BOUND) ||
11044 (vpip->flag & EMLXS_VPI_PORT_UNBIND)) {
8386 continue;
8387 }
8388
8389 if ((vpip->state == VPI_STATE_ONLINE) ||
8390 (vpip->flag & EMLXS_VPI_ONLINE_REQ)) {
8391 continue;
8392 }
8393
8394 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8395 "vfi_online_action:%d vpi_online=%d logi_count=%d. "
11045 continue;
11046 }
11047
11048 if ((vpip->state == VPI_STATE_ONLINE) ||
11049 (vpip->flag & EMLXS_VPI_ONLINE_REQ)) {
11050 continue;
11051 }
11052
11053 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11054 "vfi_online_action:%d vpi_online=%d logi_count=%d. "
8396 "Onlining VPI:%d",
11055 "Onlining VPI:%d >",
8397 vfip->VFI,
8398 vfip->vpi_online,
8399 vfip->logi_count,
8400 vpip->VPI);
8401
8402 vpip->vfip = vfip;
8403 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_ONLINE, vpip);
8404 }
8405
8406 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8407 "vfi_online_action:%d vpi_online=%d logi_count=%d. "
11056 vfip->VFI,
11057 vfip->vpi_online,
11058 vfip->logi_count,
11059 vpip->VPI);
11060
11061 vpip->vfip = vfip;
11062 (void) emlxs_vpi_event(vport, FCF_EVENT_VPI_ONLINE, vpip);
11063 }
11064
11065 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11066 "vfi_online_action:%d vpi_online=%d logi_count=%d. "
8408 "VFI online. Notifying FCFI:%d.",
11067 "VFI online. Notifying FCFI:%d. >",
8409 vfip->VFI,
8410 vfip->vpi_online,
8411 vfip->logi_count,
8412 vfip->fcfp->fcf_index);
8413
8414 /* Notify FCFI */
8415 rval = emlxs_fcfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
8416

--- 15 unchanged lines hidden (view full) ---

8432
8433 count = sizeof (emlxs_vpi_state_table) / sizeof (emlxs_table_t);
8434 for (i = 0; i < count; i++) {
8435 if (state == emlxs_vpi_state_table[i].code) {
8436 return (emlxs_vpi_state_table[i].string);
8437 }
8438 }
8439
11068 vfip->VFI,
11069 vfip->vpi_online,
11070 vfip->logi_count,
11071 vfip->fcfp->fcf_index);
11072
11073 /* Notify FCFI */
11074 rval = emlxs_fcfi_event(port, FCF_EVENT_VFI_ONLINE, vfip);
11075

--- 15 unchanged lines hidden (view full) ---

11091
11092 count = sizeof (emlxs_vpi_state_table) / sizeof (emlxs_table_t);
11093 for (i = 0; i < count; i++) {
11094 if (state == emlxs_vpi_state_table[i].code) {
11095 return (emlxs_vpi_state_table[i].string);
11096 }
11097 }
11098
8440 (void) sprintf(buffer, "state=0x%x", state);
11099 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
8441 return (buffer);
8442
8443} /* emlxs_vpi_state_xlate() */
8444
8445
8446static uint32_t
8447emlxs_vpi_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
8448 void *arg1)
8449{
11100 return (buffer);
11101
11102} /* emlxs_vpi_state_xlate() */
11103
11104
11105static uint32_t
11106emlxs_vpi_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
11107 void *arg1)
11108{
8450 uint32_t rval;
11109 uint32_t rval = 0;
8451 uint32_t(*func) (emlxs_port_t *, VPIobj_t *, uint32_t, void *);
8452 uint32_t index;
8453 uint32_t events;
8454 uint16_t state;
8455
8456 /* Convert event to action table index */
8457 switch (evt) {
8458 case FCF_EVENT_STATE_ENTER:

--- 25 unchanged lines hidden (view full) ---

8484 state = vpip->state;
8485
8486 index += (state * events);
8487 func = (uint32_t(*) (emlxs_port_t *, VPIobj_t *, uint32_t, void *))
8488 emlxs_vpi_action_table[index];
8489
8490 if (!func) {
8491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11110 uint32_t(*func) (emlxs_port_t *, VPIobj_t *, uint32_t, void *);
11111 uint32_t index;
11112 uint32_t events;
11113 uint16_t state;
11114
11115 /* Convert event to action table index */
11116 switch (evt) {
11117 case FCF_EVENT_STATE_ENTER:

--- 25 unchanged lines hidden (view full) ---

11143 state = vpip->state;
11144
11145 index += (state * events);
11146 func = (uint32_t(*) (emlxs_port_t *, VPIobj_t *, uint32_t, void *))
11147 emlxs_vpi_action_table[index];
11148
11149 if (!func) {
11150 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
8492 "vpi:%d %s:%s arg=%p. No action. Terminated.",
11151 "vpi_action:%d %s:%s arg=%p. No action. <",
8493 vpip->VPI,
8494 emlxs_vpi_state_xlate(vpip->state),
8495 emlxs_fcf_event_xlate(evt), arg1);
8496
8497 return (1);
8498 }
8499
8500 rval = (func)(port, vpip, evt, arg1);

--- 4 unchanged lines hidden (view full) ---

8505
8506
8507static uint32_t
8508emlxs_vpi_event(emlxs_port_t *port, uint32_t evt,
8509 void *arg1)
8510{
8511 VPIobj_t *vpip = NULL;
8512 RPIobj_t *rpip;
11152 vpip->VPI,
11153 emlxs_vpi_state_xlate(vpip->state),
11154 emlxs_fcf_event_xlate(evt), arg1);
11155
11156 return (1);
11157 }
11158
11159 rval = (func)(port, vpip, evt, arg1);

--- 4 unchanged lines hidden (view full) ---

11164
11165
11166static uint32_t
11167emlxs_vpi_event(emlxs_port_t *port, uint32_t evt,
11168 void *arg1)
11169{
11170 VPIobj_t *vpip = NULL;
11171 RPIobj_t *rpip;
8513 uint32_t rval;
11172 uint32_t rval = 0;
8514
8515 /* Filter events and acquire fcfi context */
8516 switch (evt) {
8517 case FCF_EVENT_RPI_ONLINE:
8518 case FCF_EVENT_RPI_OFFLINE:
8519 case FCF_EVENT_RPI_PAUSE:
8520 rpip = (RPIobj_t *)arg1;
8521
8522 if (!rpip) {
8523 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11173
11174 /* Filter events and acquire fcfi context */
11175 switch (evt) {
11176 case FCF_EVENT_RPI_ONLINE:
11177 case FCF_EVENT_RPI_OFFLINE:
11178 case FCF_EVENT_RPI_PAUSE:
11179 rpip = (RPIobj_t *)arg1;
11180
11181 if (!rpip) {
11182 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
8524 "rpi: %s arg=%p. Null RPI found. Terminated.",
11183 "vpi_event: %s arg=%p. Null RPI found. <",
8525 emlxs_fcf_event_xlate(evt), arg1);
8526
8527 return (1);
8528 }
8529
8530 vpip = rpip->vpip;
8531 break;
8532
8533 case FCF_EVENT_VPI_ONLINE:
8534 case FCF_EVENT_VPI_PAUSE:
8535 case FCF_EVENT_VPI_OFFLINE:
8536 vpip = (VPIobj_t *)arg1;
8537
8538 if (!vpip) {
8539 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11184 emlxs_fcf_event_xlate(evt), arg1);
11185
11186 return (1);
11187 }
11188
11189 vpip = rpip->vpip;
11190 break;
11191
11192 case FCF_EVENT_VPI_ONLINE:
11193 case FCF_EVENT_VPI_PAUSE:
11194 case FCF_EVENT_VPI_OFFLINE:
11195 vpip = (VPIobj_t *)arg1;
11196
11197 if (!vpip) {
11198 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
8540 "vpi: %s arg=%p. Null VPI found. Terminated.",
11199 "vpi_event: %s arg=%p. Null VPI found. <",
8541 emlxs_fcf_event_xlate(evt), arg1);
8542
8543 return (1);
8544 }
8545
8546 break;
8547
8548 default:
8549 return (1);
8550 }
8551
8552 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11200 emlxs_fcf_event_xlate(evt), arg1);
11201
11202 return (1);
11203 }
11204
11205 break;
11206
11207 default:
11208 return (1);
11209 }
11210
11211 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
8553 "vpi:%d %s:%s arg=%p",
11212 "vpi_event:%d %s:%s arg=%p",
8554 vpip->VPI,
8555 emlxs_vpi_state_xlate(vpip->state),
8556 emlxs_fcf_event_xlate(evt), arg1);
8557
8558 rval = emlxs_vpi_action(port, vpip, evt, arg1);
8559
8560 return (rval);
8561

--- 10 unchanged lines hidden (view full) ---

8572 if (state >= VPI_ACTION_STATES) {
8573 return (1);
8574 }
8575
8576 if ((vpip->state == state) &&
8577 (reason != FCF_REASON_REENTER)) {
8578 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8579 "vpi_state:%d %s:%s:0x%x arg=%p. "
11213 vpip->VPI,
11214 emlxs_vpi_state_xlate(vpip->state),
11215 emlxs_fcf_event_xlate(evt), arg1);
11216
11217 rval = emlxs_vpi_action(port, vpip, evt, arg1);
11218
11219 return (rval);
11220

--- 10 unchanged lines hidden (view full) ---

11231 if (state >= VPI_ACTION_STATES) {
11232 return (1);
11233 }
11234
11235 if ((vpip->state == state) &&
11236 (reason != FCF_REASON_REENTER)) {
11237 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11238 "vpi_state:%d %s:%s:0x%x arg=%p. "
8580 "State not changed. Terminated.",
11239 "State not changed. <",
8581 vpip->VPI,
8582 emlxs_vpi_state_xlate(vpip->state),
8583 emlxs_fcf_reason_xlate(reason),
8584 explain, arg1);
11240 vpip->VPI,
11241 emlxs_vpi_state_xlate(vpip->state),
11242 emlxs_fcf_reason_xlate(reason),
11243 explain, arg1);
8585
8586 return (1);
8587 }
8588
8589 if (!reason) {
8590 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11244 return (1);
11245 }
11246
11247 if (!reason) {
11248 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
8591 "vpi:%d %s-->%s arg=%p",
11249 "vpi_state:%d %s-->%s arg=%p",
8592 vpip->VPI,
8593 emlxs_vpi_state_xlate(vpip->state),
8594 emlxs_vpi_state_xlate(state), arg1);
8595 } else if (reason == FCF_REASON_EVENT) {
8596 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11250 vpip->VPI,
11251 emlxs_vpi_state_xlate(vpip->state),
11252 emlxs_vpi_state_xlate(state), arg1);
11253 } else if (reason == FCF_REASON_EVENT) {
11254 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
8597 "vpi:%d %s-->%s:%s:%s arg=%p",
11255 "vpi_state:%d %s-->%s:%s:%s arg=%p",
8598 vpip->VPI,
8599 emlxs_vpi_state_xlate(vpip->state),
8600 emlxs_vpi_state_xlate(state),
8601 emlxs_fcf_reason_xlate(reason),
8602 emlxs_fcf_event_xlate(explain), arg1);
8603 } else if (explain) {
8604 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11256 vpip->VPI,
11257 emlxs_vpi_state_xlate(vpip->state),
11258 emlxs_vpi_state_xlate(state),
11259 emlxs_fcf_reason_xlate(reason),
11260 emlxs_fcf_event_xlate(explain), arg1);
11261 } else if (explain) {
11262 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
8605 "vpi:%d %s-->%s:%s:0x%x arg=%p",
11263 "vpi_state:%d %s-->%s:%s:0x%x arg=%p",
8606 vpip->VPI,
8607 emlxs_vpi_state_xlate(vpip->state),
8608 emlxs_vpi_state_xlate(state),
8609 emlxs_fcf_reason_xlate(reason),
8610 explain, arg1);
8611 } else {
8612 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11264 vpip->VPI,
11265 emlxs_vpi_state_xlate(vpip->state),
11266 emlxs_vpi_state_xlate(state),
11267 emlxs_fcf_reason_xlate(reason),
11268 explain, arg1);
11269 } else {
11270 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
8613 "vpi:%d %s-->%s:%s arg=%p",
11271 "vpi_state:%d %s-->%s:%s arg=%p",
8614 vpip->VPI,
8615 emlxs_vpi_state_xlate(vpip->state),
8616 emlxs_vpi_state_xlate(state),
8617 emlxs_fcf_reason_xlate(reason), arg1);
8618 }
8619
8620 vpip->prev_state = vpip->state;
8621 vpip->prev_reason = vpip->reason;

--- 6 unchanged lines hidden (view full) ---

8628
8629} /* emlxs_vpi_state() */
8630
8631
8632extern uint32_t
8633emlxs_vpi_port_bind_notify(emlxs_port_t *port)
8634{
8635 emlxs_hba_t *hba = HBA;
11272 vpip->VPI,
11273 emlxs_vpi_state_xlate(vpip->state),
11274 emlxs_vpi_state_xlate(state),
11275 emlxs_fcf_reason_xlate(reason), arg1);
11276 }
11277
11278 vpip->prev_state = vpip->state;
11279 vpip->prev_reason = vpip->reason;

--- 6 unchanged lines hidden (view full) ---

11286
11287} /* emlxs_vpi_state() */
11288
11289
11290extern uint32_t
11291emlxs_vpi_port_bind_notify(emlxs_port_t *port)
11292{
11293 emlxs_hba_t *hba = HBA;
8636 VPIobj_t *vpip = &port->VPIobj;
11294 VPIobj_t *vpip = port->vpip;
8637 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
8638 uint32_t rval = 0;
8639 VFIobj_t *vfip;
8640 VFIobj_t *vfip1;
11295 FCFTable_t *fcftab = &hba->sli.sli4.fcftab;
11296 uint32_t rval = 0;
11297 VFIobj_t *vfip;
11298 VFIobj_t *vfip1;
8641 uint32_t i;
11299 uint32_t i = 0;
8642 FCFIobj_t *fcfp;
8643 FCFIobj_t *fcfp1;
8644
8645 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
8646 return (1);
8647 }
8648
8649 if (hba->state < FC_LINK_UP) {
8650 if (port->vpi == 0) {
8651 (void) emlxs_reset_link(hba, 1, 0);
11300 FCFIobj_t *fcfp;
11301 FCFIobj_t *fcfp1;
11302
11303 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
11304 return (1);
11305 }
11306
11307 if (hba->state < FC_LINK_UP) {
11308 if (port->vpi == 0) {
11309 (void) emlxs_reset_link(hba, 1, 0);
11310
11311 /* Wait for VPI to go online */
11312 while ((vpip->state != VPI_STATE_PORT_ONLINE) &&
11313 (hba->state != FC_ERROR)) {
11314 delay(drv_usectohz(500000));
11315 if (i++ > 30) {
11316 break;
11317 }
11318 }
8652 }
8653 return (0);
8654 }
8655
8656 mutex_enter(&EMLXS_FCF_LOCK);
8657
8658 if (vpip->vfip) {
8659 vfip = vpip->vfip;

--- 12 unchanged lines hidden (view full) ---

8672 fcfp = fcfp1;
8673 break;
8674 }
8675 }
8676
8677 if (!fcfp) {
8678 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8679 "vpi_port_bind_notify:%d %s. "
11319 }
11320 return (0);
11321 }
11322
11323 mutex_enter(&EMLXS_FCF_LOCK);
11324
11325 if (vpip->vfip) {
11326 vfip = vpip->vfip;

--- 12 unchanged lines hidden (view full) ---

11339 fcfp = fcfp1;
11340 break;
11341 }
11342 }
11343
11344 if (!fcfp) {
11345 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11346 "vpi_port_bind_notify:%d %s. "
8680 "No FCF available yet. Terminated.",
11347 "No FCF available yet.",
8681 vpip->VPI,
8682 emlxs_vpi_state_xlate(vpip->state));
8683
8684 mutex_exit(&EMLXS_FCF_LOCK);
8685 return (0);
8686 }
8687
8688 /* Find first available VFI for this FCFI */

--- 4 unchanged lines hidden (view full) ---

8693 vfip = vfip1;
8694 break;
8695 }
8696 }
8697
8698 if (!vfip) {
8699 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8700 "vpi_port_bind_notify:%d %s fcfi:%d. "
11348 vpip->VPI,
11349 emlxs_vpi_state_xlate(vpip->state));
11350
11351 mutex_exit(&EMLXS_FCF_LOCK);
11352 return (0);
11353 }
11354
11355 /* Find first available VFI for this FCFI */

--- 4 unchanged lines hidden (view full) ---

11360 vfip = vfip1;
11361 break;
11362 }
11363 }
11364
11365 if (!vfip) {
11366 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11367 "vpi_port_bind_notify:%d %s fcfi:%d. "
8701 "No VFI available yet. Terminated.",
11368 "No VFI available yet.",
8702 vpip->VPI,
8703 emlxs_vpi_state_xlate(vpip->state),
8704 fcfp->fcf_index);
8705
8706 mutex_exit(&EMLXS_FCF_LOCK);
8707 return (0);
8708 }
8709
8710 vpip->vfip = vfip;
8711done:
8712
8713 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11369 vpip->VPI,
11370 emlxs_vpi_state_xlate(vpip->state),
11371 fcfp->fcf_index);
11372
11373 mutex_exit(&EMLXS_FCF_LOCK);
11374 return (0);
11375 }
11376
11377 vpip->vfip = vfip;
11378done:
11379
11380 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8714 "vpi_port_bind_notify:%d %s fcfi:%d vfi:%d. Onlining VPI:%d",
11381 "vpi_port_bind_notify:%d %s fcfi:%d vfi:%d. Onlining VPI:%d >",
8715 vpip->VPI,
8716 emlxs_vpi_state_xlate(vpip->state),
8717 fcfp->fcf_index,
8718 vfip->VFI,
8719 vpip->VPI);
8720
8721 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
8722
8723 mutex_exit(&EMLXS_FCF_LOCK);
8724
8725 return (rval);
8726
8727} /* emlxs_vpi_port_bind_notify() */
8728
8729
8730extern uint32_t
8731emlxs_vpi_port_unbind_notify(emlxs_port_t *port, uint32_t wait)
8732{
8733 emlxs_hba_t *hba = HBA;
11382 vpip->VPI,
11383 emlxs_vpi_state_xlate(vpip->state),
11384 fcfp->fcf_index,
11385 vfip->VFI,
11386 vpip->VPI);
11387
11388 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
11389
11390 mutex_exit(&EMLXS_FCF_LOCK);
11391
11392 return (rval);
11393
11394} /* emlxs_vpi_port_bind_notify() */
11395
11396
11397extern uint32_t
11398emlxs_vpi_port_unbind_notify(emlxs_port_t *port, uint32_t wait)
11399{
11400 emlxs_hba_t *hba = HBA;
8734 VPIobj_t *vpip = &port->VPIobj;
11401 VPIobj_t *vpip = port->vpip;
8735 uint32_t rval = 0;
8736 VFIobj_t *vfip;
8737 uint32_t i;
8738 FCFIobj_t *fcfp;
8739
8740 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
8741 return (1);
8742 }
8743
11402 uint32_t rval = 0;
11403 VFIobj_t *vfip;
11404 uint32_t i;
11405 FCFIobj_t *fcfp;
11406
11407 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
11408 return (1);
11409 }
11410
11411 if (!(hba->sli.sli4.flag & EMLXS_SLI4_FCF_INIT)) {
11412 return (0);
11413 }
11414
8744 mutex_enter(&EMLXS_FCF_LOCK);
8745
8746 if (vpip->state == VPI_STATE_OFFLINE) {
8747 mutex_exit(&EMLXS_FCF_LOCK);
8748 return (0);
8749 }
8750
11415 mutex_enter(&EMLXS_FCF_LOCK);
11416
11417 if (vpip->state == VPI_STATE_OFFLINE) {
11418 mutex_exit(&EMLXS_FCF_LOCK);
11419 return (0);
11420 }
11421
11422 /*
11423 * Set flag to indicate that emlxs_vpi_port_unbind_notify
11424 * has been called
11425 */
11426 vpip->flag |= EMLXS_VPI_PORT_UNBIND;
11427
8751 vfip = vpip->vfip;
8752 fcfp = vfip->fcfp;
8753
8754 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8755 "vpi_port_unbind_notify:%d %s fcfi:%d vfi:%d. "
11428 vfip = vpip->vfip;
11429 fcfp = vfip->fcfp;
11430
11431 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11432 "vpi_port_unbind_notify:%d %s fcfi:%d vfi:%d. "
8756 "Offlining VPI:%d,%d",
11433 "Offlining VPI:%d,%d >",
8757 vpip->VPI,
8758 emlxs_vpi_state_xlate(vpip->state),
8759 fcfp->fcf_index,
8760 vfip->VFI,
8761 vpip->index, vpip->VPI);
8762
8763 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
8764
8765 if (wait && (rval == 0)) {
8766 /* Wait for VPI to go offline */
8767 i = 0;
8768 while (i++ < 120) {
8769 if (vpip->state == VPI_STATE_OFFLINE) {
8770 break;
8771 }
8772
8773 mutex_exit(&EMLXS_FCF_LOCK);
11434 vpip->VPI,
11435 emlxs_vpi_state_xlate(vpip->state),
11436 fcfp->fcf_index,
11437 vfip->VFI,
11438 vpip->index, vpip->VPI);
11439
11440 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
11441
11442 if (wait && (rval == 0)) {
11443 /* Wait for VPI to go offline */
11444 i = 0;
11445 while (i++ < 120) {
11446 if (vpip->state == VPI_STATE_OFFLINE) {
11447 break;
11448 }
11449
11450 mutex_exit(&EMLXS_FCF_LOCK);
8774 DELAYMS(1000);
11451 BUSYWAIT_MS(1000);
8775 mutex_enter(&EMLXS_FCF_LOCK);
8776 }
8777
8778 if (i >= 120) {
8779 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8780 "vpi_port_unbind_notify:%d %s fcfi:%d vfi:%d "
8781 "rpi_online=%d,%d. Offline timeout.",
8782 vpip->VPI,
8783 emlxs_vpi_state_xlate(vpip->state),
8784 fcfp->fcf_index,
8785 vfip->VFI,
8786 vpip->rpi_online, vpip->rpi_paused);
8787 }
8788 }
8789
11452 mutex_enter(&EMLXS_FCF_LOCK);
11453 }
11454
11455 if (i >= 120) {
11456 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11457 "vpi_port_unbind_notify:%d %s fcfi:%d vfi:%d "
11458 "rpi_online=%d,%d. Offline timeout.",
11459 vpip->VPI,
11460 emlxs_vpi_state_xlate(vpip->state),
11461 fcfp->fcf_index,
11462 vfip->VFI,
11463 vpip->rpi_online, vpip->rpi_paused);
11464 }
11465 }
11466
11467 vpip->flag &= ~EMLXS_VPI_PORT_UNBIND;
11468
8790 mutex_exit(&EMLXS_FCF_LOCK);
8791
8792 return (rval);
8793
8794} /* emlxs_vpi_port_unbind_notify() */
8795
8796
8797/*ARGSUSED*/
8798static uint32_t
8799emlxs_vpi_rpi_offline_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
8800 uint32_t evt, void *arg1)
8801{
11469 mutex_exit(&EMLXS_FCF_LOCK);
11470
11471 return (rval);
11472
11473} /* emlxs_vpi_port_unbind_notify() */
11474
11475
11476/*ARGSUSED*/
11477static uint32_t
11478emlxs_vpi_rpi_offline_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
11479 uint32_t evt, void *arg1)
11480{
8802 uint32_t rval;
11481 uint32_t rval = 0;
8803 RPIobj_t *rpip = (RPIobj_t *)arg1;
8804
8805 if (evt != FCF_EVENT_RPI_OFFLINE) {
8806 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8807 "vpi_rpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
11482 RPIobj_t *rpip = (RPIobj_t *)arg1;
11483
11484 if (evt != FCF_EVENT_RPI_OFFLINE) {
11485 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11486 "vpi_rpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
8808 "Invalid event type. Terminated.",
11487 "Invalid event type. <",
8809 vpip->VPI,
8810 emlxs_vpi_state_xlate(vpip->state),
8811 emlxs_fcf_event_xlate(evt), arg1,
8812 vpip->flag);
8813 return (1);
8814 }
8815
8816 switch (vpip->state) {
8817 case VPI_STATE_LOGO:
8818 /* rpi_online will be checked when LOGO is complete */
8819 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8820 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
11488 vpip->VPI,
11489 emlxs_vpi_state_xlate(vpip->state),
11490 emlxs_fcf_event_xlate(evt), arg1,
11491 vpip->flag);
11492 return (1);
11493 }
11494
11495 switch (vpip->state) {
11496 case VPI_STATE_LOGO:
11497 /* rpi_online will be checked when LOGO is complete */
11498 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11499 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
8821 "rpi=%d. Waiting for LOGO. Terminated.",
11500 "rpi=%d. Waiting for LOGO. <",
8822 vpip->VPI,
8823 vpip->rpi_online, vpip->rpi_paused,
8824 rpip->did, rpip->RPI);
8825
8826 rval = 0;
8827 break;
8828
8829 case VPI_STATE_PORT_OFFLINE:

--- 6 unchanged lines hidden (view full) ---

8836
8837 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
8838 FCF_REASON_REENTER, evt, arg1);
8839 break;
8840
8841 case VPI_STATE_PAUSED:
8842 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8843 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
11501 vpip->VPI,
11502 vpip->rpi_online, vpip->rpi_paused,
11503 rpip->did, rpip->RPI);
11504
11505 rval = 0;
11506 break;
11507
11508 case VPI_STATE_PORT_OFFLINE:

--- 6 unchanged lines hidden (view full) ---

11515
11516 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
11517 FCF_REASON_REENTER, evt, arg1);
11518 break;
11519
11520 case VPI_STATE_PAUSED:
11521 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11522 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
8844 "rpi=%d. VPI paused. Terminated.",
11523 "rpi=%d. VPI paused. <",
8845 vpip->VPI,
8846 vpip->rpi_online, vpip->rpi_paused,
8847 rpip->did, rpip->RPI);
8848
8849 rval = 0;
8850 break;
8851
8852 case VPI_STATE_ONLINE:
8853 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8854 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
11524 vpip->VPI,
11525 vpip->rpi_online, vpip->rpi_paused,
11526 rpip->did, rpip->RPI);
11527
11528 rval = 0;
11529 break;
11530
11531 case VPI_STATE_ONLINE:
11532 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11533 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
8855 "rpi=%d. Terminated.",
11534 "rpi=%d. <",
8856 vpip->VPI,
8857 vpip->rpi_online, vpip->rpi_paused,
8858 rpip->did, rpip->RPI);
8859
8860 rval = 0;
8861 break;
8862
8863 default:
8864 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8865 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
8866 "rpi=%d. "
11535 vpip->VPI,
11536 vpip->rpi_online, vpip->rpi_paused,
11537 rpip->did, rpip->RPI);
11538
11539 rval = 0;
11540 break;
11541
11542 default:
11543 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11544 "vpi_rpi_offline_evt_action:%d rpi_online=%d,%d did=%x "
11545 "rpi=%d. "
8867 "Invalid state. Terminated.",
11546 "Invalid state. <",
8868 vpip->VPI,
8869 vpip->rpi_online, vpip->rpi_paused,
8870 rpip->did, rpip->RPI);
8871
8872 rval = 1;
8873 break;
8874 }
8875
8876 return (rval);
8877
8878} /* emlxs_vpi_rpi_offline_evt_action() */
8879
8880
8881/*ARGSUSED*/
8882static uint32_t
8883emlxs_vpi_rpi_pause_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
8884 uint32_t evt, void *arg1)
8885{
11547 vpip->VPI,
11548 vpip->rpi_online, vpip->rpi_paused,
11549 rpip->did, rpip->RPI);
11550
11551 rval = 1;
11552 break;
11553 }
11554
11555 return (rval);
11556
11557} /* emlxs_vpi_rpi_offline_evt_action() */
11558
11559
11560/*ARGSUSED*/
11561static uint32_t
11562emlxs_vpi_rpi_pause_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
11563 uint32_t evt, void *arg1)
11564{
8886 uint32_t rval;
11565 uint32_t rval = 0;
8887 RPIobj_t *rpip = (RPIobj_t *)arg1;
8888
8889 if (evt != FCF_EVENT_RPI_PAUSE) {
8890 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8891 "vpi_rpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
11566 RPIobj_t *rpip = (RPIobj_t *)arg1;
11567
11568 if (evt != FCF_EVENT_RPI_PAUSE) {
11569 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11570 "vpi_rpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
8892 "Invalid event type. Terminated.",
11571 "Invalid event type. <",
8893 vpip->VPI,
8894 emlxs_vpi_state_xlate(vpip->state),
8895 emlxs_fcf_event_xlate(evt), arg1,
8896 vpip->flag);
8897 return (1);
8898 }
8899
8900 switch (vpip->state) {
8901 case VPI_STATE_LOGO:
8902 /* rpi_online will be checked when LOGO is complete */
8903 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8904 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
11572 vpip->VPI,
11573 emlxs_vpi_state_xlate(vpip->state),
11574 emlxs_fcf_event_xlate(evt), arg1,
11575 vpip->flag);
11576 return (1);
11577 }
11578
11579 switch (vpip->state) {
11580 case VPI_STATE_LOGO:
11581 /* rpi_online will be checked when LOGO is complete */
11582 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11583 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
8905 "rpi=%d. Waiting for LOGO. Terminated.",
11584 "rpi=%d. Waiting for LOGO. <",
8906 vpip->VPI,
8907 vpip->rpi_online, vpip->rpi_paused,
8908 rpip->did, rpip->RPI);
8909
8910 rval = 0;
8911 break;
8912
8913 case VPI_STATE_PORT_OFFLINE:

--- 6 unchanged lines hidden (view full) ---

8920
8921 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
8922 FCF_REASON_REENTER, 0, 0);
8923 break;
8924
8925 case VPI_STATE_PAUSED:
8926 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8927 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
11585 vpip->VPI,
11586 vpip->rpi_online, vpip->rpi_paused,
11587 rpip->did, rpip->RPI);
11588
11589 rval = 0;
11590 break;
11591
11592 case VPI_STATE_PORT_OFFLINE:

--- 6 unchanged lines hidden (view full) ---

11599
11600 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
11601 FCF_REASON_REENTER, 0, 0);
11602 break;
11603
11604 case VPI_STATE_PAUSED:
11605 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11606 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
8928 "rpi=%d. VPI already paused. Terminated.",
11607 "rpi=%d. VPI already paused. <",
8929 vpip->VPI,
8930 vpip->rpi_online, vpip->rpi_paused,
8931 rpip->did, rpip->RPI);
8932
8933 rval = 0;
8934 break;
8935
8936 default:
8937 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8938 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
8939 "rpi=%d. "
11608 vpip->VPI,
11609 vpip->rpi_online, vpip->rpi_paused,
11610 rpip->did, rpip->RPI);
11611
11612 rval = 0;
11613 break;
11614
11615 default:
11616 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11617 "vpi_rpi_pause_evt_action:%d rpi_online=%d,%d did=%x "
11618 "rpi=%d. "
8940 "Invalid state. Terminated.",
11619 "Invalid state. <",
8941 vpip->VPI,
8942 vpip->rpi_online, vpip->rpi_paused,
8943 rpip->did, rpip->RPI);
8944
8945 rval = 1;
8946 break;
8947 }
8948

--- 7 unchanged lines hidden (view full) ---

8956emlxs_vpi_rpi_online_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
8957 uint32_t evt, void *arg1)
8958{
8959 RPIobj_t *rpip = (RPIobj_t *)arg1;
8960
8961 if (evt != FCF_EVENT_RPI_ONLINE) {
8962 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8963 "vpi_rpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
11620 vpip->VPI,
11621 vpip->rpi_online, vpip->rpi_paused,
11622 rpip->did, rpip->RPI);
11623
11624 rval = 1;
11625 break;
11626 }
11627

--- 7 unchanged lines hidden (view full) ---

11635emlxs_vpi_rpi_online_evt_action(emlxs_port_t *port, VPIobj_t *vpip,
11636 uint32_t evt, void *arg1)
11637{
11638 RPIobj_t *rpip = (RPIobj_t *)arg1;
11639
11640 if (evt != FCF_EVENT_RPI_ONLINE) {
11641 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11642 "vpi_rpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
8964 "Invalid event type. Terminated.",
11643 "Invalid event type. <",
8965 vpip->VPI,
8966 emlxs_vpi_state_xlate(vpip->state),
8967 emlxs_fcf_event_xlate(evt), arg1,
8968 vpip->flag);
8969 return (1);
8970 }
8971
8972 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11644 vpip->VPI,
11645 emlxs_vpi_state_xlate(vpip->state),
11646 emlxs_fcf_event_xlate(evt), arg1,
11647 vpip->flag);
11648 return (1);
11649 }
11650
11651 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
8973 "vpi_rpi_online_evt_action:%d rpi_online=%d,%d did=%x rpi=%d. "
8974 "Terminated.",
11652 "vpi_rpi_online_evt_action:%d rpi_online=%d,%d did=%x rpi=%d. <",
8975 vpip->VPI,
8976 vpip->rpi_online, vpip->rpi_paused,
8977 rpip->did, rpip->RPI);
8978
8979 return (0);
8980
8981} /* emlxs_vpi_rpi_online_evt_action() */
8982
8983
8984/*ARGSUSED*/
8985static uint32_t
8986emlxs_vpi_online_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
8987 void *arg1)
8988{
11653 vpip->VPI,
11654 vpip->rpi_online, vpip->rpi_paused,
11655 rpip->did, rpip->RPI);
11656
11657 return (0);
11658
11659} /* emlxs_vpi_rpi_online_evt_action() */
11660
11661
11662/*ARGSUSED*/
11663static uint32_t
11664emlxs_vpi_online_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
11665 void *arg1)
11666{
8989 uint32_t rval;
11667 uint32_t rval = 0;
8990
8991 if (evt != FCF_EVENT_VPI_ONLINE) {
8992 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
8993 "vpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
11668
11669 if (evt != FCF_EVENT_VPI_ONLINE) {
11670 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11671 "vpi_online_evt_action:%d %s:%s arg=%p flag=%x. "
8994 "Invalid event type. Terminated.",
11672 "Invalid event type. <",
8995 vpip->VPI,
8996 emlxs_vpi_state_xlate(vpip->state),
8997 emlxs_fcf_event_xlate(evt), arg1,
8998 vpip->flag);
8999 return (1);
9000 }
9001
9002 if (vpip->flag & EMLXS_VPI_ONLINE_REQ) {
9003 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9004 "vpi_online_evt_action:%d flag=%x. "
11673 vpip->VPI,
11674 emlxs_vpi_state_xlate(vpip->state),
11675 emlxs_fcf_event_xlate(evt), arg1,
11676 vpip->flag);
11677 return (1);
11678 }
11679
11680 if (vpip->flag & EMLXS_VPI_ONLINE_REQ) {
11681 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11682 "vpi_online_evt_action:%d flag=%x. "
9005 "Online already requested. Terminated.",
11683 "Online already requested. <",
9006 vpip->VPI,
9007 vpip->flag);
9008 return (1);
9009 }
9010
9011 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
9012 vpip->flag |= EMLXS_VPI_ONLINE_REQ;
9013

--- 16 unchanged lines hidden (view full) ---

9030 vpip->flag);
9031
9032 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
9033 FCF_REASON_EVENT, evt, arg1);
9034 break;
9035
9036 default:
9037 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11684 vpip->VPI,
11685 vpip->flag);
11686 return (1);
11687 }
11688
11689 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
11690 vpip->flag |= EMLXS_VPI_ONLINE_REQ;
11691

--- 16 unchanged lines hidden (view full) ---

11708 vpip->flag);
11709
11710 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
11711 FCF_REASON_EVENT, evt, arg1);
11712 break;
11713
11714 default:
11715 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9038 "vpi_online_evt_action:%d flag=%x. Terminated.",
11716 "vpi_online_evt_action:%d flag=%x. <",
9039 vpip->VPI,
9040 vpip->flag);
9041 return (1);
9042 }
9043
9044 return (rval);
9045
9046} /* emlxs_vpi_online_evt_action() */
9047
9048
9049/*ARGSUSED*/
9050static uint32_t
9051emlxs_vpi_offline_handler(emlxs_port_t *port, VPIobj_t *vpip, void *arg1)
9052{
11717 vpip->VPI,
11718 vpip->flag);
11719 return (1);
11720 }
11721
11722 return (rval);
11723
11724} /* emlxs_vpi_online_evt_action() */
11725
11726
11727/*ARGSUSED*/
11728static uint32_t
11729emlxs_vpi_offline_handler(emlxs_port_t *port, VPIobj_t *vpip, void *arg1)
11730{
9053 uint32_t rval;
11731 uint32_t rval = 0;
9054
9055 if (!(vpip->flag & EMLXS_VPI_OFFLINE_REQ)) {
9056 return (0);
9057 }
9058
9059 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
9060 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
9061 FCF_REASON_REQUESTED, 0, arg1);

--- 20 unchanged lines hidden (view full) ---

9082} /* emlxs_vpi_offline_handler() */
9083
9084
9085/*ARGSUSED*/
9086static uint32_t
9087emlxs_vpi_offline_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9088 void *arg1)
9089{
11732
11733 if (!(vpip->flag & EMLXS_VPI_OFFLINE_REQ)) {
11734 return (0);
11735 }
11736
11737 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
11738 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
11739 FCF_REASON_REQUESTED, 0, arg1);

--- 20 unchanged lines hidden (view full) ---

11760} /* emlxs_vpi_offline_handler() */
11761
11762
11763/*ARGSUSED*/
11764static uint32_t
11765emlxs_vpi_offline_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
11766 void *arg1)
11767{
9090 uint32_t rval;
11768 uint32_t rval = 0;
9091 uint32_t pause_req;
9092
9093 if (evt != FCF_EVENT_VPI_OFFLINE) {
9094 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9095 "vpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
11769 uint32_t pause_req;
11770
11771 if (evt != FCF_EVENT_VPI_OFFLINE) {
11772 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11773 "vpi_offline_evt_action:%d %s:%s arg=%p flag=%x. "
9096 "Invalid event type. Terminated.",
11774 "Invalid event type. <",
9097 vpip->VPI,
9098 emlxs_vpi_state_xlate(vpip->state),
9099 emlxs_fcf_event_xlate(evt), arg1,
9100 vpip->flag);
9101 return (1);
9102 }
9103
9104 if ((vpip->flag & EMLXS_VPI_OFFLINE_REQ) &&
9105 !(vpip->flag & EMLXS_VPI_PAUSE_REQ)) {
9106 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9107 "vpi_offline_evt_action:%d flag=%x. "
11775 vpip->VPI,
11776 emlxs_vpi_state_xlate(vpip->state),
11777 emlxs_fcf_event_xlate(evt), arg1,
11778 vpip->flag);
11779 return (1);
11780 }
11781
11782 if ((vpip->flag & EMLXS_VPI_OFFLINE_REQ) &&
11783 !(vpip->flag & EMLXS_VPI_PAUSE_REQ)) {
11784 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11785 "vpi_offline_evt_action:%d flag=%x. "
9108 "Offline already requested. Terminated.",
11786 "Offline already requested. <",
9109 vpip->VPI,
9110 vpip->flag);
9111 return (1);
9112 }
9113
9114 pause_req = vpip->flag & EMLXS_VPI_PAUSE_REQ;
9115
9116 vpip->flag &= ~EMLXS_VPI_REQ_MASK;

--- 64 unchanged lines hidden (view full) ---

9181
9182 /* Handle offline now */
9183 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
9184 break;
9185
9186 /* Transitional states */
9187 default:
9188 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11787 vpip->VPI,
11788 vpip->flag);
11789 return (1);
11790 }
11791
11792 pause_req = vpip->flag & EMLXS_VPI_PAUSE_REQ;
11793
11794 vpip->flag &= ~EMLXS_VPI_REQ_MASK;

--- 64 unchanged lines hidden (view full) ---

11859
11860 /* Handle offline now */
11861 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
11862 break;
11863
11864 /* Transitional states */
11865 default:
11866 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9189 "vpi_offline_evt_action:%d flag=%x. Terminated.",
11867 "vpi_offline_evt_action:%d flag=%x. <",
9190 vpip->VPI,
9191 vpip->flag);
9192 break;
9193 }
9194
9195 return (rval);
9196
9197} /* emlxs_vpi_offline_evt_action() */
9198
9199
9200/*ARGSUSED*/
9201static uint32_t
9202emlxs_vpi_pause_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9203 void *arg1)
9204{
9205 emlxs_hba_t *hba = HBA;
11868 vpip->VPI,
11869 vpip->flag);
11870 break;
11871 }
11872
11873 return (rval);
11874
11875} /* emlxs_vpi_offline_evt_action() */
11876
11877
11878/*ARGSUSED*/
11879static uint32_t
11880emlxs_vpi_pause_evt_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
11881 void *arg1)
11882{
11883 emlxs_hba_t *hba = HBA;
9206 uint32_t rval;
11884 uint32_t rval = 0;
9207
9208 if (evt != FCF_EVENT_VPI_PAUSE) {
9209 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9210 "vpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
11885
11886 if (evt != FCF_EVENT_VPI_PAUSE) {
11887 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11888 "vpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
9211 "Invalid event type. Terminated.",
11889 "Invalid event type. <",
9212 vpip->VPI,
9213 emlxs_vpi_state_xlate(vpip->state),
9214 emlxs_fcf_event_xlate(evt), arg1,
9215 vpip->flag);
9216 return (1);
9217 }
9218
9219 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
9220 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9221 "vpi_pause_evt_action:%d flag=%x. "
11890 vpip->VPI,
11891 emlxs_vpi_state_xlate(vpip->state),
11892 emlxs_fcf_event_xlate(evt), arg1,
11893 vpip->flag);
11894 return (1);
11895 }
11896
11897 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
11898 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11899 "vpi_pause_evt_action:%d flag=%x. "
9222 "Pause already requested. Terminated.",
11900 "Pause already requested. <",
9223 vpip->VPI,
9224 vpip->flag);
9225 return (1);
9226 }
9227
9228 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
9229 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9230 "vpi_pause_evt_action:%d flag=%x. "
11901 vpip->VPI,
11902 vpip->flag);
11903 return (1);
11904 }
11905
11906 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
11907 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11908 "vpi_pause_evt_action:%d flag=%x. "
9231 "Offline already requested. Terminated.",
11909 "Offline already requested. <",
9232 vpip->VPI,
9233 vpip->flag);
9234 return (1);
9235 }
9236
11910 vpip->VPI,
11911 vpip->flag);
11912 return (1);
11913 }
11914
9237 if (!(hba->sli.sli4.flag & EMLXS_SLI4_DOWN_LINK)) {
11915 if (SLI4_FC_MODE || !(hba->sli.sli4.flag & EMLXS_SLI4_DOWN_LINK)) {
9238 /* Fabric logo is implied */
11916 /* Fabric logo is implied */
9239 vpip->flag &= ~EMLXS_VPI_LOGI;
9240 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
9241 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
9242
9243 if (vpip->vfip->logi_count > 0) {
9244 vpip->vfip->logi_count--;
9245 }
9246 }
11917 emlxs_vpi_logo_handler(port, vpip);
9247 }
9248
9249 switch (vpip->state) {
9250 case VPI_STATE_PORT_OFFLINE:
9251 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9252 "vpi_pause_evt_action:%d flag=%x. "
11918 }
11919
11920 switch (vpip->state) {
11921 case VPI_STATE_PORT_OFFLINE:
11922 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11923 "vpi_pause_evt_action:%d flag=%x. "
9253 "Already offline. Terminated.",
11924 "Already offline. <",
9254 vpip->VPI,
9255 vpip->flag);
9256 break;
9257
9258 case VPI_STATE_PAUSED:
9259 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9260 "vpi_pause_evt_action:%d flag=%x. "
11925 vpip->VPI,
11926 vpip->flag);
11927 break;
11928
11929 case VPI_STATE_PAUSED:
11930 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11931 "vpi_pause_evt_action:%d flag=%x. "
9261 "Already paused. Terminated.",
11932 "Already paused. <",
9262 vpip->VPI,
9263 vpip->flag);
9264 break;
9265
9266 /* Wait states */
9267 case VPI_STATE_UNREG:
9268 case VPI_STATE_PORT_ONLINE:
9269 case VPI_STATE_LOGI:

--- 13 unchanged lines hidden (view full) ---

9283 break;
9284
9285 /* Transitional states */
9286 default:
9287 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
9288 vpip->flag |= (EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
9289
9290 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11933 vpip->VPI,
11934 vpip->flag);
11935 break;
11936
11937 /* Wait states */
11938 case VPI_STATE_UNREG:
11939 case VPI_STATE_PORT_ONLINE:
11940 case VPI_STATE_LOGI:

--- 13 unchanged lines hidden (view full) ---

11954 break;
11955
11956 /* Transitional states */
11957 default:
11958 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
11959 vpip->flag |= (EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
11960
11961 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9291 "vpi_pause_evt_action:%d flag=%x. Terminated.",
11962 "vpi_pause_evt_action:%d flag=%x. <",
9292 vpip->VPI,
9293 vpip->flag);
9294 break;
9295 }
9296
9297 return (rval);
9298
9299} /* emlxs_vpi_pause_evt_action() */
9300
9301
9302/* ARGSUSED */
9303static void
11963 vpip->VPI,
11964 vpip->flag);
11965 break;
11966 }
11967
11968 return (rval);
11969
11970} /* emlxs_vpi_pause_evt_action() */
11971
11972
11973/* ARGSUSED */
11974static void
9304emlxs_pkt_cmpl_thread(emlxs_hba_t *hba,
11975emlxs_deferred_cmpl_thread(emlxs_hba_t *hba,
9305 void *arg1, void *arg2)
9306{
11976 void *arg1, void *arg2)
11977{
9307 emlxs_buf_t *sbp = (emlxs_buf_t *)arg1;
9308 emlxs_pkt_complete(sbp, -1, 0, 1);
11978 emlxs_deferred_cmpl_t *cmpl = (emlxs_deferred_cmpl_t *)arg1;
11979 uint32_t status = (uint32_t)((unsigned long)arg2);
11980 emlxs_port_t *port;
11981 uint32_t mbxStatus;
11982 emlxs_buf_t *sbp;
11983 fc_unsol_buf_t *ubp;
11984 IOCBQ *iocbq;
9309
11985
11986 mbxStatus = (status)? MBX_FAILURE:MBX_SUCCESS;
11987
11988 port = cmpl->port;
11989 sbp = (emlxs_buf_t *)cmpl->arg1;
11990 ubp = (fc_unsol_buf_t *)cmpl->arg2;
11991 iocbq = (IOCBQ *)cmpl->arg3;
11992
11993 kmem_free(cmpl, sizeof (emlxs_deferred_cmpl_t));
11994
11995 emlxs_mb_deferred_cmpl(port, mbxStatus, sbp, ubp, iocbq);
11996
9310 return;
9311
11997 return;
11998
9312} /* emlxs_pkt_cmpl_thread() */
11999} /* emlxs_deferred_cmpl_thread() */
9313
9314
12000
12001
12002
12003
9315/* ARGSUSED */
9316static void
9317emlxs_port_offline_thread(emlxs_hba_t *hba,
9318 void *arg1, void *arg2)
9319{
9320 emlxs_port_t *port = (emlxs_port_t *)arg1;
12004/* ARGSUSED */
12005static void
12006emlxs_port_offline_thread(emlxs_hba_t *hba,
12007 void *arg1, void *arg2)
12008{
12009 emlxs_port_t *port = (emlxs_port_t *)arg1;
9321 uint32_t scope = (uint32_t)((uintptr_t)arg2);
12010 uint32_t scope = (uint32_t)((unsigned long)arg2);
9322
9323 (void) emlxs_port_offline(port, scope);
9324 return;
9325
9326} /* emlxs_port_offline_thread() */
9327
9328
9329/* ARGSUSED */

--- 5 unchanged lines hidden (view full) ---

9335
9336 (void) emlxs_port_online(port);
9337 return;
9338
9339} /* emlxs_port_online_thread() */
9340
9341
9342/*ARGSUSED*/
12011
12012 (void) emlxs_port_offline(port, scope);
12013 return;
12014
12015} /* emlxs_port_offline_thread() */
12016
12017
12018/* ARGSUSED */

--- 5 unchanged lines hidden (view full) ---

12024
12025 (void) emlxs_port_online(port);
12026 return;
12027
12028} /* emlxs_port_online_thread() */
12029
12030
12031/*ARGSUSED*/
12032static void
12033emlxs_vpi_logo_handler(emlxs_port_t *port, VPIobj_t *vpip)
12034{
12035 vpip->flag &= ~EMLXS_VPI_LOGI;
12036 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
12037 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
12038
12039 if (vpip->vfip->logi_count) {
12040 vpip->vfip->logi_count--;
12041 }
12042 if (vpip == vpip->vfip->flogi_vpip) {
12043 vpip->vfip->flogi_vpip = NULL;
12044 }
12045 }
12046
12047} /* emlxs_vpi_logo_handler() */
12048
12049
12050/*ARGSUSED*/
9343static uint32_t
9344emlxs_vpi_port_offline_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9345 void *arg1)
9346{
9347 emlxs_hba_t *hba = HBA;
9348 uint32_t rval = 0;
9349 uint32_t scope;
9350
9351 if (vpip->state != VPI_STATE_PORT_OFFLINE) {
9352 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9353 "vpi_port_offline_action:%d %s:%s arg=%p. "
12051static uint32_t
12052emlxs_vpi_port_offline_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12053 void *arg1)
12054{
12055 emlxs_hba_t *hba = HBA;
12056 uint32_t rval = 0;
12057 uint32_t scope;
12058
12059 if (vpip->state != VPI_STATE_PORT_OFFLINE) {
12060 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12061 "vpi_port_offline_action:%d %s:%s arg=%p. "
9354 "Invalid state. Terminated.",
12062 "Invalid state. <",
9355 vpip->VPI,
9356 emlxs_vpi_state_xlate(vpip->state),
9357 emlxs_fcf_event_xlate(evt), arg1);
9358 return (1);
9359 }
9360
9361 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
9362 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12063 vpip->VPI,
12064 emlxs_vpi_state_xlate(vpip->state),
12065 emlxs_fcf_event_xlate(evt), arg1);
12066 return (1);
12067 }
12068
12069 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
12070 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9363 "vpi_port_offline_action:%d flag=%x. Offline port.",
12071 "vpi_port_offline_action:%d flag=%x. Offlining port...",
9364 vpip->VPI,
9365 vpip->flag);
9366
9367 vpip->flag &= ~(EMLXS_VPI_PORT_ONLINE|EMLXS_VPI_PORT_ENABLED);
9368
9369 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
9370 scope = 0xFFFFFFFF; /* Clear all non-FCP2 nodes */
9371 /* Pause FCP2 nodes */
9372 } else {
9373 scope = 0xFDFFFFFF; /* Clear all nodes */
9374 }
9375
9376 emlxs_thread_spawn(hba, emlxs_port_offline_thread,
12072 vpip->VPI,
12073 vpip->flag);
12074
12075 vpip->flag &= ~(EMLXS_VPI_PORT_ONLINE|EMLXS_VPI_PORT_ENABLED);
12076
12077 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
12078 scope = 0xFFFFFFFF; /* Clear all non-FCP2 nodes */
12079 /* Pause FCP2 nodes */
12080 } else {
12081 scope = 0xFDFFFFFF; /* Clear all nodes */
12082 }
12083
12084 emlxs_thread_spawn(hba, emlxs_port_offline_thread,
9377 (void *)vpip->port, (void *)((uintptr_t)scope));
12085 (void *)vpip->port, (void *)((unsigned long)scope));
9378
9379 if (vpip->flag & EMLXS_VPI_LOGI) {
9380 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO,
9381 FCF_REASON_EVENT, evt, arg1);
9382
9383 return (rval);
9384 }
9385 }
9386
9387 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
9388 if (vpip->rpi_online > vpip->rpi_paused) {
9389 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9390 "vpi_port_offline_action:%d rpi_online=%d,%d. "
12086
12087 if (vpip->flag & EMLXS_VPI_LOGI) {
12088 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO,
12089 FCF_REASON_EVENT, evt, arg1);
12090
12091 return (rval);
12092 }
12093 }
12094
12095 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {
12096 if (vpip->rpi_online > vpip->rpi_paused) {
12097 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12098 "vpi_port_offline_action:%d rpi_online=%d,%d. "
9391 "Pausing. Waiting for RPI's.",
12099 "Pausing. Waiting for RPI's. <",
9392 vpip->VPI,
9393 vpip->rpi_online, vpip->rpi_paused);
9394 return (0);
9395 }
9396
9397 /* Take the Fabric RPI offline now */
12100 vpip->VPI,
12101 vpip->rpi_online, vpip->rpi_paused);
12102 return (0);
12103 }
12104
12105 /* Take the Fabric RPI offline now */
9398 if (vpip->rpip->state != RPI_STATE_FREE) {
12106 if (vpip->fabric_rpip->state != RPI_STATE_FREE) {
12107 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12108 "vpi_port_offline_action:%d. "
12109 "Offlining Fabric RPI. >",
12110 vpip->VPI);
12111
9399 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE,
12112 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE,
9400 vpip->rpip);
12113 vpip->fabric_rpip);
9401 }
9402
9403 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9404 "vpi_port_offline_action:%d rpi_online=%d,%d. Pausing.",
9405 vpip->VPI,
9406 vpip->rpi_online, vpip->rpi_paused);
9407
9408 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PAUSED,
9409 FCF_REASON_EVENT, evt, arg1);
9410
9411 return (rval);
9412 }
9413
9414 if (vpip->rpi_online > 0) {
9415 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9416 "vpi_port_offline_action:%d rpi_online=%d,%d. Offlining. "
12114 }
12115
12116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12117 "vpi_port_offline_action:%d rpi_online=%d,%d. Pausing.",
12118 vpip->VPI,
12119 vpip->rpi_online, vpip->rpi_paused);
12120
12121 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PAUSED,
12122 FCF_REASON_EVENT, evt, arg1);
12123
12124 return (rval);
12125 }
12126
12127 if (vpip->rpi_online > 0) {
12128 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12129 "vpi_port_offline_action:%d rpi_online=%d,%d. Offlining. "
9417 "Waiting for RPI's.",
12130 "Waiting for RPI's. <",
9418 vpip->VPI,
9419 vpip->rpi_online, vpip->rpi_paused);
9420
9421 return (0);
9422 }
9423
9424 /* Take the Fabric RPI offline now */
12131 vpip->VPI,
12132 vpip->rpi_online, vpip->rpi_paused);
12133
12134 return (0);
12135 }
12136
12137 /* Take the Fabric RPI offline now */
9425 if (vpip->rpip->state != RPI_STATE_FREE) {
9426 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE, vpip->rpip);
12138 if (vpip->fabric_rpip->state != RPI_STATE_FREE) {
12139 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12140 "vpi_port_offline_action:%d. Offlining Fabric RPI. >",
12141 vpip->VPI);
12142
12143 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE,
12144 vpip->fabric_rpip);
9427 }
9428
9429 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9430 "vpi_port_offline_action:%d rpi_online=%d,%d. Offlining. "
9431 "Unreg VPI.",
9432 vpip->VPI,
9433 vpip->rpi_online, vpip->rpi_paused);
9434

--- 8 unchanged lines hidden (view full) ---

9443/*ARGSUSED*/
9444static uint32_t
9445emlxs_vpi_paused_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9446 void *arg1)
9447{
9448 if (vpip->state != VPI_STATE_PAUSED) {
9449 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9450 "vpi_paused_action:%d %s:%s arg=%p. "
12145 }
12146
12147 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12148 "vpi_port_offline_action:%d rpi_online=%d,%d. Offlining. "
12149 "Unreg VPI.",
12150 vpip->VPI,
12151 vpip->rpi_online, vpip->rpi_paused);
12152

--- 8 unchanged lines hidden (view full) ---

12161/*ARGSUSED*/
12162static uint32_t
12163emlxs_vpi_paused_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12164 void *arg1)
12165{
12166 if (vpip->state != VPI_STATE_PAUSED) {
12167 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12168 "vpi_paused_action:%d %s:%s arg=%p. "
9451 "Invalid state. Terminated.",
12169 "Invalid state. <",
9452 vpip->VPI,
9453 emlxs_vpi_state_xlate(vpip->state),
9454 emlxs_fcf_event_xlate(evt), arg1);
9455 return (1);
9456 }
9457
9458 vpip->flag &= ~(EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
9459
9460 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12170 vpip->VPI,
12171 emlxs_vpi_state_xlate(vpip->state),
12172 emlxs_fcf_event_xlate(evt), arg1);
12173 return (1);
12174 }
12175
12176 vpip->flag &= ~(EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
12177
12178 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9461 "vpi_paused_action:%d rpi_online=%d,%d. VPI paused.",
12179 "vpi_paused_action:%d rpi_online=%d,%d. VPI paused. <",
9462 vpip->VPI,
9463 vpip->rpi_online, vpip->rpi_paused);
9464
9465 return (0);
9466
9467} /* emlxs_vpi_paused_action() */
9468
9469
9470/*ARGSUSED*/
9471static uint32_t
9472emlxs_vpi_offline_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9473 void *arg1)
9474{
12180 vpip->VPI,
12181 vpip->rpi_online, vpip->rpi_paused);
12182
12183 return (0);
12184
12185} /* emlxs_vpi_paused_action() */
12186
12187
12188/*ARGSUSED*/
12189static uint32_t
12190emlxs_vpi_offline_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12191 void *arg1)
12192{
9475 uint32_t rval;
12193 uint32_t rval = 0;
9476
9477 if (vpip->state != VPI_STATE_OFFLINE) {
9478 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9479 "vpi_offline_action:%d %s:%s arg=%p. "
12194
12195 if (vpip->state != VPI_STATE_OFFLINE) {
12196 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12197 "vpi_offline_action:%d %s:%s arg=%p. "
9480 "Invalid state. Terminated.",
12198 "Invalid state. <",
9481 vpip->VPI,
9482 emlxs_vpi_state_xlate(vpip->state),
9483 emlxs_fcf_event_xlate(evt), arg1);
9484 return (1);
9485 }
9486
9487 if (!vpip->vfip) {
9488 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9489 "vpi_offline_action:%d %s:%s arg=%p flag=%x. "
12199 vpip->VPI,
12200 emlxs_vpi_state_xlate(vpip->state),
12201 emlxs_fcf_event_xlate(evt), arg1);
12202 return (1);
12203 }
12204
12205 if (!vpip->vfip) {
12206 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12207 "vpi_offline_action:%d %s:%s arg=%p flag=%x. "
9490 "Null vfip found. Terminated.",
12208 "Null vfip found. <",
9491 vpip->VPI,
9492 emlxs_vpi_state_xlate(vpip->state),
9493 emlxs_fcf_event_xlate(evt), arg1,
9494 vpip->flag);
9495 return (1);
9496 }
9497
9498 /* Take the Fabric RPI offline, if still active */
12209 vpip->VPI,
12210 emlxs_vpi_state_xlate(vpip->state),
12211 emlxs_fcf_event_xlate(evt), arg1,
12212 vpip->flag);
12213 return (1);
12214 }
12215
12216 /* Take the Fabric RPI offline, if still active */
9499 if (vpip->rpip->state != RPI_STATE_FREE) {
9500 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE, vpip->rpip);
12217 if (vpip->fabric_rpip->state != RPI_STATE_FREE) {
12218 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12219 "vpi_offline_action:%d. Offlining Fabric RPI. >",
12220 vpip->VPI);
12221
12222 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE,
12223 vpip->fabric_rpip);
9501 }
9502
9503 vpip->flag &= ~(EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
9504
9505 if (vpip->flag & EMLXS_VPI_VFI) {
9506 vpip->flag &= ~EMLXS_VPI_VFI;
9507
9508 if (vpip->vfip->vpi_online) {

--- 10 unchanged lines hidden (view full) ---

9519
9520 rval = emlxs_vpi_state(port, vpip, VPI_STATE_INIT,
9521 FCF_REASON_REQUESTED, 0, arg1);
9522 return (rval);
9523 }
9524
9525 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9526 "vpi_offline_action:%d vpi_online=%d. "
12224 }
12225
12226 vpip->flag &= ~(EMLXS_VPI_OFFLINE_REQ | EMLXS_VPI_PAUSE_REQ);
12227
12228 if (vpip->flag & EMLXS_VPI_VFI) {
12229 vpip->flag &= ~EMLXS_VPI_VFI;
12230
12231 if (vpip->vfip->vpi_online) {

--- 10 unchanged lines hidden (view full) ---

12242
12243 rval = emlxs_vpi_state(port, vpip, VPI_STATE_INIT,
12244 FCF_REASON_REQUESTED, 0, arg1);
12245 return (rval);
12246 }
12247
12248 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12249 "vpi_offline_action:%d vpi_online=%d. "
9527 "VPI offline. Notifying VFI:%d.",
12250 "VPI offline. Notifying VFI:%d. >",
9528 vpip->VPI,
9529 vpip->vfip->vpi_online,
9530 vpip->vfip->VFI);
9531
9532 /* Notify VFI */
9533 rval = emlxs_vfi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
9534
9535 return (rval);

--- 11 unchanged lines hidden (view full) ---

9547
9548 vpip = (VPIobj_t *)mbq->context;
9549 mb4 = (MAILBOX4 *)mbq;
9550
9551 mutex_enter(&EMLXS_FCF_LOCK);
9552
9553 if (vpip->state != VPI_STATE_INIT) {
9554 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12251 vpip->VPI,
12252 vpip->vfip->vpi_online,
12253 vpip->vfip->VFI);
12254
12255 /* Notify VFI */
12256 rval = emlxs_vfi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
12257
12258 return (rval);

--- 11 unchanged lines hidden (view full) ---

12270
12271 vpip = (VPIobj_t *)mbq->context;
12272 mb4 = (MAILBOX4 *)mbq;
12273
12274 mutex_enter(&EMLXS_FCF_LOCK);
12275
12276 if (vpip->state != VPI_STATE_INIT) {
12277 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9555 "vpi_init_mbcmpl:%d %s. Terminated.",
12278 "vpi_init_mbcmpl:%d %s.",
9556 vpip->VPI,
9557 emlxs_vpi_state_xlate(vpip->state));
9558
9559 mutex_exit(&EMLXS_FCF_LOCK);
9560 return (0);
9561 }
9562
9563 if (mb4->mbxStatus) {
9564 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12279 vpip->VPI,
12280 emlxs_vpi_state_xlate(vpip->state));
12281
12282 mutex_exit(&EMLXS_FCF_LOCK);
12283 return (0);
12284 }
12285
12286 if (mb4->mbxStatus) {
12287 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9565 "vpi_init_mbcmpl:%d failed. status=%x",
12288 "vpi_init_mbcmpl:%d failed. %s. >",
9566 vpip->VPI,
12289 vpip->VPI,
9567 mb4->mbxStatus);
12290 emlxs_mb_xlate_status(mb4->mbxStatus));
9568
9569 (void) emlxs_vpi_state(port, vpip, VPI_STATE_INIT_FAILED,
9570 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
9571
9572 mutex_exit(&EMLXS_FCF_LOCK);
9573 return (0);
9574 }
9575
9576 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12291
12292 (void) emlxs_vpi_state(port, vpip, VPI_STATE_INIT_FAILED,
12293 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
12294
12295 mutex_exit(&EMLXS_FCF_LOCK);
12296 return (0);
12297 }
12298
12299 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9577 "vpi_init_mbcmpl:%d Initialized.",
12300 "vpi_init_mbcmpl:%d. Init complete. >",
9578 vpip->VPI,
9579 mb4->mbxStatus);
9580
9581 vpip->flag |= EMLXS_VPI_INIT;
9582 (void) emlxs_vpi_state(port, vpip, VPI_STATE_INIT_CMPL,
9583 0, 0, 0);
9584
9585 mutex_exit(&EMLXS_FCF_LOCK);

--- 5 unchanged lines hidden (view full) ---

9591/*ARGSUSED*/
9592static uint32_t
9593emlxs_vpi_init_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9594 void *arg1)
9595{
9596 emlxs_hba_t *hba = HBA;
9597 MAILBOXQ *mbq;
9598 MAILBOX4 *mb4;
12301 vpip->VPI,
12302 mb4->mbxStatus);
12303
12304 vpip->flag |= EMLXS_VPI_INIT;
12305 (void) emlxs_vpi_state(port, vpip, VPI_STATE_INIT_CMPL,
12306 0, 0, 0);
12307
12308 mutex_exit(&EMLXS_FCF_LOCK);

--- 5 unchanged lines hidden (view full) ---

12314/*ARGSUSED*/
12315static uint32_t
12316emlxs_vpi_init_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12317 void *arg1)
12318{
12319 emlxs_hba_t *hba = HBA;
12320 MAILBOXQ *mbq;
12321 MAILBOX4 *mb4;
9599 uint32_t rval;
12322 uint32_t rval = 0;
9600
9601 if (vpip->state != VPI_STATE_INIT) {
9602 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9603 "vpi_init_action:%d %s:%s arg=%p. "
12323
12324 if (vpip->state != VPI_STATE_INIT) {
12325 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12326 "vpi_init_action:%d %s:%s arg=%p. "
9604 "Invalid state. Terminated.",
12327 "Invalid state. <",
9605 vpip->VPI,
9606 emlxs_vpi_state_xlate(vpip->state),
9607 emlxs_fcf_event_xlate(evt), arg1);
9608 return (1);
9609 }
9610
9611 if (vpip->prev_state != VPI_STATE_INIT_FAILED) {
9612 vpip->attempts = 0;

--- 9 unchanged lines hidden (view full) ---

9622 return (rval);
9623 }
9624
9625 if (!(vpip->flag & EMLXS_VPI_VFI)) {
9626 vpip->flag |= EMLXS_VPI_VFI;
9627 vpip->vfip->vpi_online++;
9628 }
9629
12328 vpip->VPI,
12329 emlxs_vpi_state_xlate(vpip->state),
12330 emlxs_fcf_event_xlate(evt), arg1);
12331 return (1);
12332 }
12333
12334 if (vpip->prev_state != VPI_STATE_INIT_FAILED) {
12335 vpip->attempts = 0;

--- 9 unchanged lines hidden (view full) ---

12345 return (rval);
12346 }
12347
12348 if (!(vpip->flag & EMLXS_VPI_VFI)) {
12349 vpip->flag |= EMLXS_VPI_VFI;
12350 vpip->vfip->vpi_online++;
12351 }
12352
9630 if (vpip->vfip->vpi_online == 1) {
12353 if (((hba->sli_intf & SLI_INTF_IF_TYPE_MASK) ==
12354 SLI_INTF_IF_TYPE_0) && (vpip->vfip->vpi_online == 1)) {
9631 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12355 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9632 "vpi_init_action:%d vpi_online=%d. Skipping init.",
9633 vpip->VPI,
9634 vpip->vfip->vpi_online);
12356 "vpi_init_action:%d. First VPI. Skipping INIT_VPI.",
12357 vpip->VPI);
9635
9636 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
9637 FCF_REASON_EVENT, evt, arg1);
9638 return (rval);
9639 }
9640
9641 if (vpip->flag & EMLXS_VPI_INIT) {
9642 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9643 "vpi_init_action:%d flag=%x. "
12358
12359 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
12360 FCF_REASON_EVENT, evt, arg1);
12361 return (rval);
12362 }
12363
12364 if (vpip->flag & EMLXS_VPI_INIT) {
12365 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12366 "vpi_init_action:%d flag=%x. "
9644 "Already init'd. Skipping init.",
12367 "Already init'd. Skipping INIT_VPI.",
9645 vpip->VPI);
9646
9647 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
9648 FCF_REASON_EVENT, evt, arg1);
9649 return (rval);
9650 }
9651
9652 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12368 vpip->VPI);
12369
12370 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_ONLINE,
12371 FCF_REASON_EVENT, evt, arg1);
12372 return (rval);
12373 }
12374
12375 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9653 "vpi_init_action:%d vpi_online=%d attempts=%d. Sending INIT_VPI.",
12376 "vpi_init_action:%d vpi_online=%d attempts=%d. Sending INIT_VPI. <",
9654 vpip->VPI,
9655 vpip->vfip->vpi_online,
9656 vpip->attempts);
9657
12377 vpip->VPI,
12378 vpip->vfip->vpi_online,
12379 vpip->attempts);
12380
9658 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
12381 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
9659 rval = emlxs_vpi_state(port, vpip, FCFI_STATE_REG_FAILED,
9660 FCF_REASON_NO_MBOX, 0, arg1);
9661 return (rval);
9662 }
9663 mb4 = (MAILBOX4*)mbq;
9664 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
9665
9666 mbq->nonembed = NULL;

--- 21 unchanged lines hidden (view full) ---

9688} /* emlxs_vpi_init_action() */
9689
9690
9691/*ARGSUSED*/
9692static uint32_t
9693emlxs_vpi_init_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9694 void *arg1)
9695{
12382 rval = emlxs_vpi_state(port, vpip, FCFI_STATE_REG_FAILED,
12383 FCF_REASON_NO_MBOX, 0, arg1);
12384 return (rval);
12385 }
12386 mb4 = (MAILBOX4*)mbq;
12387 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
12388
12389 mbq->nonembed = NULL;

--- 21 unchanged lines hidden (view full) ---

12411} /* emlxs_vpi_init_action() */
12412
12413
12414/*ARGSUSED*/
12415static uint32_t
12416emlxs_vpi_init_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12417 void *arg1)
12418{
9696 uint32_t rval;
12419 uint32_t rval = 0;
9697
9698 vpip->attempts++;
9699
9700 if (vpip->state != VPI_STATE_INIT_FAILED) {
9701 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9702 "vpi_init_action:%d %s:%s arg=%p attempt=%d. "
12420
12421 vpip->attempts++;
12422
12423 if (vpip->state != VPI_STATE_INIT_FAILED) {
12424 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12425 "vpi_init_action:%d %s:%s arg=%p attempt=%d. "
9703 "Invalid state. Terminated.",
12426 "Invalid state. <",
9704 vpip->VPI,
9705 emlxs_vpi_state_xlate(vpip->state),
9706 emlxs_fcf_event_xlate(evt), arg1,
9707 vpip->attempts);
12427 vpip->VPI,
12428 emlxs_vpi_state_xlate(vpip->state),
12429 emlxs_fcf_event_xlate(evt), arg1,
12430 vpip->attempts);
9708
9709 return (1);
9710 }
9711
9712 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||
9713 (vpip->attempts >= 3)) {
9714 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9715 "vpi_init_action:%d attempt=%d reason=%x. Init cmpl.",
9716 vpip->VPI,

--- 21 unchanged lines hidden (view full) ---

9738} /* emlxs_vpi_init_failed_action() */
9739
9740
9741/*ARGSUSED*/
9742static uint32_t
9743emlxs_vpi_init_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9744 void *arg1)
9745{
12431 return (1);
12432 }
12433
12434 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||
12435 (vpip->attempts >= 3)) {
12436 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12437 "vpi_init_action:%d attempt=%d reason=%x. Init cmpl.",
12438 vpip->VPI,

--- 21 unchanged lines hidden (view full) ---

12460} /* emlxs_vpi_init_failed_action() */
12461
12462
12463/*ARGSUSED*/
12464static uint32_t
12465emlxs_vpi_init_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12466 void *arg1)
12467{
9746 uint32_t rval;
12468 uint32_t rval = 0;
9747
9748 if (vpip->state != VPI_STATE_INIT_CMPL) {
9749 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9750 "vpi_init_cmpl_action:%d %s:%s arg=%p. "
12469
12470 if (vpip->state != VPI_STATE_INIT_CMPL) {
12471 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12472 "vpi_init_cmpl_action:%d %s:%s arg=%p. "
9751 "Invalid state. Terminated.",
12473 "Invalid state. <",
9752 vpip->VPI,
9753 emlxs_vpi_state_xlate(vpip->state),
9754 emlxs_fcf_event_xlate(evt), arg1);
9755 return (1);
9756 }
9757
9758 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9759 "vpi_init_cmpl_action:%d attempts=%d. Onlining port.",

--- 8 unchanged lines hidden (view full) ---

9768
9769
9770/*ARGSUSED*/
9771static uint32_t
9772emlxs_vpi_port_online_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9773 void *arg1)
9774{
9775 emlxs_hba_t *hba = HBA;
12474 vpip->VPI,
12475 emlxs_vpi_state_xlate(vpip->state),
12476 emlxs_fcf_event_xlate(evt), arg1);
12477 return (1);
12478 }
12479
12480 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12481 "vpi_init_cmpl_action:%d attempts=%d. Onlining port.",

--- 8 unchanged lines hidden (view full) ---

12490
12491
12492/*ARGSUSED*/
12493static uint32_t
12494emlxs_vpi_port_online_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12495 void *arg1)
12496{
12497 emlxs_hba_t *hba = HBA;
9776 uint32_t rval;
12498 emlxs_config_t *cfg = &CFG;
12499 uint32_t rval = 0;
9777
9778 if (vpip->state != VPI_STATE_PORT_ONLINE) {
9779 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9780 "vpi_port_online_action:%d %s:%s arg=%p. "
12500
12501 if (vpip->state != VPI_STATE_PORT_ONLINE) {
12502 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12503 "vpi_port_online_action:%d %s:%s arg=%p. "
9781 "Invalid state. Terminated.",
12504 "Invalid state. <",
9782 vpip->VPI,
9783 emlxs_vpi_state_xlate(vpip->state),
9784 emlxs_fcf_event_xlate(evt), arg1);
9785 return (1);
9786 }
9787
9788 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
9789 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 6 unchanged lines hidden (view full) ---

9796 "vpi_port_online_action:%d. Offline requested.",
9797 vpip->VPI);
9798
9799 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
9800 return (rval);
9801 }
9802
9803 /* Initialize the Fabric RPI */
12505 vpip->VPI,
12506 emlxs_vpi_state_xlate(vpip->state),
12507 emlxs_fcf_event_xlate(evt), arg1);
12508 return (1);
12509 }
12510
12511 if (vpip->flag & EMLXS_VPI_PORT_ONLINE) {
12512 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 6 unchanged lines hidden (view full) ---

12519 "vpi_port_online_action:%d. Offline requested.",
12520 vpip->VPI);
12521
12522 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
12523 return (rval);
12524 }
12525
12526 /* Initialize the Fabric RPI */
9804 if (vpip->rpip->state == RPI_STATE_FREE) {
9805 (void) emlxs_rpi_alloc(port, FABRIC_DID);
12527 if (vpip->fabric_rpip->state == RPI_STATE_FREE) {
12528 emlxs_rpi_alloc_fabric_rpi(vpip->port);
9806 }
9807
12529 }
12530
12531 /* Notify ULP */
12532 vpip->flag |= EMLXS_VPI_PORT_ONLINE;
12533
12534 if (hba->flag & FC_LOOPBACK_MODE) {
12535 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12536 "vpi_port_online_action:%d. Loopback mode. "
12537 "Registering VPI.",
12538 vpip->VPI);
12539
12540 if (hba->topology != TOPOLOGY_LOOP) {
12541 port->did = 1;
12542 }
12543
12544 vpip->vfip->flogi_vpip = vpip;
12545
12546 bcopy((void *)&vpip->port->sparam,
12547 (void *)&vpip->fabric_rpip->sparam,
12548 sizeof (SERV_PARM));
12549
12550 /* Update the VPI Fabric RPI */
12551 vpip->fabric_rpip->sparam.cmn.w2.r_a_tov =
12552 LE_SWAP32((FF_DEF_RATOV * 1000));
12553
12554 rval = emlxs_vpi_state(port, vpip, VPI_STATE_REG,
12555 FCF_REASON_EVENT, evt, arg1);
12556
12557 return (rval);
12558 }
12559
12560 if ((hba->topology == TOPOLOGY_LOOP) && ! (port->did)) {
12561 port->did = port->granted_alpa;
12562 }
12563
9808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12564 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9809 "vpi_port_online_action:%d vpi_online=%d. Onlining port.",
12565 "vpi_port_online_action:%d vpi_online=%d. Onlining port... <",
9810 vpip->VPI,
9811 vpip->vfip->vpi_online);
9812
12566 vpip->VPI,
12567 vpip->vfip->vpi_online);
12568
9813 /* Notify ULP */
9814 vpip->flag |= EMLXS_VPI_PORT_ONLINE;
12569 if (SLI4_FC_MODE && (port->vpi == 0)) {
12570 mutex_enter(&EMLXS_PORT_LOCK);
12571 hba->linkup_timer = hba->timer_tics +
12572 cfg[CFG_LINKUP_TIMEOUT].current;
12573 mutex_exit(&EMLXS_PORT_LOCK);
12574 } else {
12575 emlxs_thread_spawn(hba, emlxs_port_online_thread,
12576 (void *)vpip->port, 0);
12577 }
9815
12578
9816 emlxs_thread_spawn(hba, emlxs_port_online_thread,
9817 (void *)vpip->port, 0);
9818
9819 /* Wait for emlxs_vpi_logi_notify() */
9820
9821 return (0);
9822
9823} /* emlxs_vpi_port_online_action() */
9824
9825
9826extern uint32_t
9827emlxs_vpi_logi_notify(emlxs_port_t *port, emlxs_buf_t *sbp)
9828{
12579 /* Wait for emlxs_vpi_logi_notify() */
12580
12581 return (0);
12582
12583} /* emlxs_vpi_port_online_action() */
12584
12585
12586extern uint32_t
12587emlxs_vpi_logi_notify(emlxs_port_t *port, emlxs_buf_t *sbp)
12588{
9829 VPIobj_t *vpip = &port->VPIobj;
12589 VPIobj_t *vpip = port->vpip;
9830 emlxs_hba_t *hba = HBA;
12590 emlxs_hba_t *hba = HBA;
9831 uint32_t rval;
12591 uint32_t rval = 0;
9832
9833 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
9834 return (1);
9835 }
9836
9837 mutex_enter(&EMLXS_FCF_LOCK);
9838
9839 if (vpip->state == VPI_STATE_OFFLINE) {
9840 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12592
12593 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
12594 return (1);
12595 }
12596
12597 mutex_enter(&EMLXS_FCF_LOCK);
12598
12599 if (vpip->state == VPI_STATE_OFFLINE) {
12600 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9841 "port_logi_notify:%d %s. Terminated.",
12601 "vpi_logi_notify:%d %s.",
9842 vpip->VPI,
9843 emlxs_vpi_state_xlate(vpip->state));
9844
9845 mutex_exit(&EMLXS_FCF_LOCK);
9846
9847 return (1);
9848 }
9849
9850 if (vpip->state != VPI_STATE_PORT_ONLINE) {
9851 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12602 vpip->VPI,
12603 emlxs_vpi_state_xlate(vpip->state));
12604
12605 mutex_exit(&EMLXS_FCF_LOCK);
12606
12607 return (1);
12608 }
12609
12610 if (vpip->state != VPI_STATE_PORT_ONLINE) {
12611 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9852 "port_logi_notify:%d %s. "
9853 "Invalid state. Terminated.",
12612 "vpi_logi_notify:%d %s. "
12613 "Invalid state.",
9854 vpip->VPI,
9855 emlxs_vpi_state_xlate(vpip->state));
9856
9857 mutex_exit(&EMLXS_FCF_LOCK);
9858
9859 return (1);
9860 }
9861
12614 vpip->VPI,
12615 emlxs_vpi_state_xlate(vpip->state));
12616
12617 mutex_exit(&EMLXS_FCF_LOCK);
12618
12619 return (1);
12620 }
12621
12622 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12623 "vpi_logi_notify:%d %s. "
12624 "Logging in. >",
12625 vpip->VPI,
12626 emlxs_vpi_state_xlate(vpip->state));
12627
9862 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI,
9863 0, 0, sbp);
9864
9865 if (rval) {
9866 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12628 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI,
12629 0, 0, sbp);
12630
12631 if (rval) {
12632 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9867 "port_logi_notify:%d %s rval=%d.",
12633 "vpi_logi_notify:%d %s rval=%d.",
9868 vpip->VPI,
9869 emlxs_vpi_state_xlate(vpip->state),
9870 rval);
9871 }
9872
9873 mutex_exit(&EMLXS_FCF_LOCK);
9874
9875 return (rval);
9876
9877} /* emlxs_vpi_logi_notify() */
9878
9879
12634 vpip->VPI,
12635 emlxs_vpi_state_xlate(vpip->state),
12636 rval);
12637 }
12638
12639 mutex_exit(&EMLXS_FCF_LOCK);
12640
12641 return (rval);
12642
12643} /* emlxs_vpi_logi_notify() */
12644
12645
9880extern uint32_t
9881emlxs_vpi_logi_cmpl_notify(emlxs_port_t *port, emlxs_buf_t *sbp)
12646static uint32_t
12647emlxs_vpi_logi_cmpl_notify(emlxs_port_t *port, RPIobj_t *rpip)
9882{
12648{
9883 VPIobj_t *vpip = &port->VPIobj;
9884 emlxs_hba_t *hba = HBA;
12649 emlxs_hba_t *hba = HBA;
9885 uint32_t rval;
12650 VPIobj_t *vpip = port->vpip;
12651 uint32_t rval = 0;
9886
12652
9887 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
9888 emlxs_pkt_complete(sbp, IOSTAT_LOCAL_REJECT,
9889 IOERR_NO_RESOURCES, 1);
9890 return (1);
9891 }
12653 /* EMLXS_FCF_LOCK must be held when calling this routine */
9892
12654
9893 mutex_enter(&EMLXS_FCF_LOCK);
9894
9895 if (vpip->state != VPI_STATE_LOGI) {
9896 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12655 if (vpip->state != VPI_STATE_LOGI) {
12656 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9897 "port_logi_cmpl_notify:%d %s. "
9898 "Invalid state. Terminated.",
12657 "vpi_logi_cmpl_notify:%d %s. "
12658 "Invalid state.",
9899 vpip->VPI,
9900 emlxs_vpi_state_xlate(vpip->state));
12659 vpip->VPI,
12660 emlxs_vpi_state_xlate(vpip->state));
9901
9902 mutex_exit(&EMLXS_FCF_LOCK);
9903 return (1);
9904 }
9905
12661 return (1);
12662 }
12663
9906 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI_CMPL,
9907 0, 0, sbp);
12664 if (rpip->RPI == FABRIC_RPI) {
12665 if (hba->flag & FC_PT_TO_PT) {
12666 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12667 "vpi_logi_cmpl_notify:%d %s. P2P mode. "
12668 "Completing FLOGI.",
12669 vpip->VPI,
12670 emlxs_vpi_state_xlate(vpip->state));
9908
12671
9909 if (rval) {
12672 /* Complete the FLOGI/FDISC now */
12673 if (rpip->cmpl) {
12674 emlxs_rpi_deferred_cmpl(port, rpip, 0);
12675 }
12676
12677 /* Wait for P2P PLOGI completion to continue */
12678 return (0);
12679 }
12680
12681 if (!rpip->cmpl || !rpip->cmpl->arg1) {
12682 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12683 "vpi_logi_cmpl_notify:%d. Null sbp.",
12684 vpip->VPI);
12685 return (1);
12686 }
12687
9910 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12688 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9911 "port_logi_cmpl_notify:%d %s rval=%d.",
12689 "vpi_logi_cmpl_notify:%d %s. Fabric mode. "
12690 "Completing login. >",
9912 vpip->VPI,
12691 vpip->VPI,
9913 emlxs_vpi_state_xlate(vpip->state),
9914 rval);
12692 emlxs_vpi_state_xlate(vpip->state));
12693
12694 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI_CMPL,
12695 0, 0, 0);
12696
12697 if (rval) {
12698 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12699 "vpi_logi_cmpl_notify:%d %s rval=%d.",
12700 vpip->VPI,
12701 emlxs_vpi_state_xlate(vpip->state),
12702 rval);
12703 }
12704
12705 return (rval);
9915 }
9916
12706 }
12707
9917 mutex_exit(&EMLXS_FCF_LOCK);
12708 if (hba->flag & FC_PT_TO_PT) {
12709 if (port->did == 0) {
12710 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12711 "vpi_logi_cmpl_notify:%d %s did=0. P2P mode. "
12712 "Wait for PLOGI compl.",
12713 vpip->VPI,
12714 emlxs_vpi_state_xlate(vpip->state));
9918
12715
9919 return (rval);
12716 if (rpip->cmpl) {
12717 emlxs_rpi_deferred_cmpl(port, rpip, 0);
12718 }
9920
12719
12720 /* Wait for P2P PLOGI completion to continue */
12721 return (0);
12722 }
12723
12724 vpip->p2p_rpip = rpip;
12725
12726 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12727 "vpi_logi_cmpl_notify:%d %s. P2P mode. "
12728 "Completing login. >",
12729 vpip->VPI,
12730 emlxs_vpi_state_xlate(vpip->state));
12731
12732 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI_CMPL,
12733 0, 0, 0);
12734
12735 if (rval) {
12736 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12737 "vpi_logi_cmpl_notify:%d %s rval=%d.",
12738 vpip->VPI,
12739 emlxs_vpi_state_xlate(vpip->state),
12740 rval);
12741 }
12742
12743 return (rval);
12744 }
12745
12746 return (1);
12747
9921} /* emlxs_vpi_logi_cmpl_notify() */
9922
9923
9924extern uint32_t
12748} /* emlxs_vpi_logi_cmpl_notify() */
12749
12750
12751extern uint32_t
9925emlxs_vpi_logi_failed_notify(emlxs_port_t *port)
12752emlxs_vpi_logi_failed_notify(emlxs_port_t *port, emlxs_buf_t *sbp)
9926{
9927 emlxs_hba_t *hba = HBA;
12753{
12754 emlxs_hba_t *hba = HBA;
9928 VPIobj_t *vpip = &port->VPIobj;
9929 uint32_t rval;
12755 VPIobj_t *vpip = port->vpip;
12756 RPIobj_t *rpip = vpip->fabric_rpip;
12757 uint32_t rval = 0;
12758 emlxs_deferred_cmpl_t *cmpl;
9930
9931 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
9932 return (1);
9933 }
9934
9935 mutex_enter(&EMLXS_FCF_LOCK);
9936
9937 if (vpip->state != VPI_STATE_LOGI) {
12759
12760 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
12761 return (1);
12762 }
12763
12764 mutex_enter(&EMLXS_FCF_LOCK);
12765
12766 if (vpip->state != VPI_STATE_LOGI) {
9938 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9939 "port_logi_failed_notify:%d %s. "
9940 "Invalid state. Terminated.",
12767 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12768 "vpi_logi_failed_notify:%d %s. "
12769 "Invalid state.",
9941 vpip->VPI,
9942 emlxs_vpi_state_xlate(vpip->state));
9943
12770 vpip->VPI,
12771 emlxs_vpi_state_xlate(vpip->state));
12772
12773 /* Fabric logo is implied */
12774 emlxs_vpi_logo_handler(port, vpip);
12775
9944 mutex_exit(&EMLXS_FCF_LOCK);
9945
9946 return (1);
9947 }
9948
12776 mutex_exit(&EMLXS_FCF_LOCK);
12777
12778 return (1);
12779 }
12780
12781 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12782 "vpi_logi_failed_notify:%d %s. "
12783 "Failing login. >",
12784 vpip->VPI,
12785 emlxs_vpi_state_xlate(vpip->state));
12786
12787 /* For safety */
12788 if (rpip->cmpl) {
12789 emlxs_rpi_deferred_cmpl(port, rpip, 1);
12790 }
12791
12792 if (sbp) {
12793 cmpl = (emlxs_deferred_cmpl_t *)kmem_zalloc(
12794 sizeof (emlxs_deferred_cmpl_t), KM_SLEEP);
12795
12796 cmpl->port = port;
12797 cmpl->arg1 = (void *)sbp;
12798 cmpl->arg2 = 0;
12799 cmpl->arg3 = 0;
12800
12801 rpip->cmpl = cmpl;
12802 }
12803
9949 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI_FAILED,
9950 FCF_REASON_OP_FAILED, 1, 0);
9951
12804 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGI_FAILED,
12805 FCF_REASON_OP_FAILED, 1, 0);
12806
9952 if (rval) {
9953 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9954 "port_logi_failed_notify:%d %s rval=%d.",
9955 vpip->VPI,
9956 emlxs_vpi_state_xlate(vpip->state),
9957 rval);
12807 if (rval && rpip->cmpl) {
12808 kmem_free(rpip->cmpl, sizeof (emlxs_deferred_cmpl_t));
12809 rpip->cmpl = 0;
9958 }
9959
9960 mutex_exit(&EMLXS_FCF_LOCK);
12810 }
12811
12812 mutex_exit(&EMLXS_FCF_LOCK);
9961
9962 return (rval);
9963
9964} /* emlxs_vpi_logi_failed_notify() */
9965
9966
12813 return (rval);
12814
12815} /* emlxs_vpi_logi_failed_notify() */
12816
12817
12818extern uint32_t
12819emlxs_vpi_logo_cmpl_notify(emlxs_port_t *port)
12820{
12821 emlxs_hba_t *hba = HBA;
12822 VPIobj_t *vpip = port->vpip;
12823 uint32_t rval = 0;
12824 VFIobj_t *vfip;
12825 FCFIobj_t *fcfp;
12826
12827 if (hba->sli_mode < EMLXS_HBA_SLI4_MODE) {
12828 return (1);
12829 }
12830
12831 mutex_enter(&EMLXS_FCF_LOCK);
12832
12833 /* Fabric logo is complete */
12834 emlxs_vpi_logo_handler(port, vpip);
12835
12836 if ((vpip->state == VPI_STATE_OFFLINE) ||
12837 (vpip->flag & EMLXS_VPI_OFFLINE_REQ)) {
12838 /* Already offline. Do nothing */
12839 mutex_exit(&EMLXS_FCF_LOCK);
12840 return (0);
12841 }
12842
12843 vfip = vpip->vfip;
12844 fcfp = vfip->fcfp;
12845
12846 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12847 "vpi_logo_cmpl_notify:%d %s fcfi:%d vfi:%d. "
12848 "Offlining VPI:%d,%d >",
12849 vpip->VPI,
12850 emlxs_vpi_state_xlate(vpip->state),
12851 fcfp->fcf_index,
12852 vfip->VFI,
12853 vpip->index, vpip->VPI);
12854
12855 rval = emlxs_vpi_event(port, FCF_EVENT_VPI_OFFLINE, vpip);
12856
12857 mutex_exit(&EMLXS_FCF_LOCK);
12858
12859 return (rval);
12860
12861} /* emlxs_vpi_logo_cmpl_notify() */
12862
12863
9967/*ARGSUSED*/
9968static uint32_t
9969emlxs_vpi_logi_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
9970 void *arg1)
9971{
12864/*ARGSUSED*/
12865static uint32_t
12866emlxs_vpi_logi_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12867 void *arg1)
12868{
12869 emlxs_hba_t *hba = HBA;
9972 emlxs_buf_t *sbp = (emlxs_buf_t *)arg1;
9973 fc_packet_t *pkt = PRIV2PKT(sbp);
12870 emlxs_buf_t *sbp = (emlxs_buf_t *)arg1;
12871 fc_packet_t *pkt = PRIV2PKT(sbp);
9974 uint32_t rval;
12872 uint32_t rval = 0;
9975
9976 if (vpip->state != VPI_STATE_LOGI) {
9977 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9978 "vpi_logi_action:%d %s:%s arg=%p. "
12873
12874 if (vpip->state != VPI_STATE_LOGI) {
12875 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12876 "vpi_logi_action:%d %s:%s arg=%p. "
9979 "Invalid state. Terminated.",
12877 "Invalid state. <",
9980 vpip->VPI,
9981 emlxs_vpi_state_xlate(vpip->state),
9982 emlxs_fcf_event_xlate(evt), arg1);
9983 return (1);
9984 }
9985
9986 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
9987 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
9988 "vpi_logi_action:%d. Offline requested.",
9989 vpip->VPI);
9990
9991 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
9992 return (rval);
9993 }
9994
9995 if (vpip->flag & EMLXS_VPI_LOGI) {
9996 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
9997 "vpi_logi_action:%d flag=%x. LOGI already set.",
12878 vpip->VPI,
12879 emlxs_vpi_state_xlate(vpip->state),
12880 emlxs_fcf_event_xlate(evt), arg1);
12881 return (1);
12882 }
12883
12884 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
12885 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12886 "vpi_logi_action:%d. Offline requested.",
12887 vpip->VPI);
12888
12889 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
12890 return (rval);
12891 }
12892
12893 if (vpip->flag & EMLXS_VPI_LOGI) {
12894 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12895 "vpi_logi_action:%d flag=%x. LOGI already set.",
9998 vpip->VPI);
12896 vpip->VPI, vpip->flag);
9999
12897
10000 vpip->flag &= ~EMLXS_VPI_LOGI;
10001 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
10002 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
12898 /* Fabric logo is implied */
12899 emlxs_vpi_logo_handler(port, vpip);
12900 }
10003
12901
10004 if (vpip->vfip->logi_count > 0) {
10005 vpip->vfip->logi_count--;
10006 }
12902 /* Check if FC_PT_TO_PT is set */
12903 if (hba->flag & FC_PT_TO_PT) {
12904 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12905 "vpi_logi_action:%d logi_count=%d. FLOGI set. P2P. <",
12906 vpip->VPI,
12907 vpip->vfip->logi_count);
12908
12909 *((uint32_t *)pkt->pkt_cmd) = (uint32_t)ELS_CMD_FLOGI;
12910
12911 vpip->vfip->flogi_vpip = vpip;
12912
12913 if (vpip->vfip->logi_count == 0) {
12914 vpip->vfip->logi_count++;
12915 vpip->flag |= EMLXS_VPI_VFI_LOGI;
10007 }
12916 }
12917
12918 return (0);
10008 }
10009
10010 /* Set login command based on vfi logi_count */
10011 if (vpip->vfip->logi_count == 0) {
10012 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12919 }
12920
12921 /* Set login command based on vfi logi_count */
12922 if (vpip->vfip->logi_count == 0) {
12923 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10013 "vpi_logi_action:%d logi_count=%d. FLOGI set.",
12924 "vpi_logi_action:%d logi_count=%d. FLOGI set. <",
10014 vpip->VPI,
10015 vpip->vfip->logi_count);
10016
10017 *((uint32_t *)pkt->pkt_cmd) = (uint32_t)ELS_CMD_FLOGI;
12925 vpip->VPI,
12926 vpip->vfip->logi_count);
12927
12928 *((uint32_t *)pkt->pkt_cmd) = (uint32_t)ELS_CMD_FLOGI;
12929
12930 vpip->vfip->flogi_vpip = vpip;
10018 } else {
10019 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12931 } else {
12932 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10020 "vpi_logi_action:%d logi_count=%d. FDISC set.",
12933 "vpi_logi_action:%d logi_count=%d. FDISC set. <",
10021 vpip->VPI,
10022 vpip->vfip->logi_count);
10023
10024 *((uint32_t *)pkt->pkt_cmd) = (uint32_t)ELS_CMD_FDISC;
10025 }
10026
10027 vpip->vfip->logi_count++;
10028 vpip->flag |= EMLXS_VPI_VFI_LOGI;
10029
10030 return (0);
10031
10032} /* emlxs_vpi_logi_action() */
10033
10034
10035/*ARGSUSED*/
10036static uint32_t
10037emlxs_vpi_logi_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10038 void *arg1)
10039{
12934 vpip->VPI,
12935 vpip->vfip->logi_count);
12936
12937 *((uint32_t *)pkt->pkt_cmd) = (uint32_t)ELS_CMD_FDISC;
12938 }
12939
12940 vpip->vfip->logi_count++;
12941 vpip->flag |= EMLXS_VPI_VFI_LOGI;
12942
12943 return (0);
12944
12945} /* emlxs_vpi_logi_action() */
12946
12947
12948/*ARGSUSED*/
12949static uint32_t
12950emlxs_vpi_logi_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
12951 void *arg1)
12952{
10040 uint32_t rval;
12953 emlxs_hba_t *hba = HBA;
12954 uint32_t rval = 0;
10041
10042 if (vpip->state != VPI_STATE_LOGI_FAILED) {
10043 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10044 "vpi_logi_failed_action:%d %s:%s arg=%p. "
12955
12956 if (vpip->state != VPI_STATE_LOGI_FAILED) {
12957 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12958 "vpi_logi_failed_action:%d %s:%s arg=%p. "
10045 "Invalid state. Terminated.",
12959 "Invalid state. <",
10046 vpip->VPI,
10047 emlxs_vpi_state_xlate(vpip->state),
10048 emlxs_fcf_event_xlate(evt), arg1);
10049 return (1);
10050 }
10051
12960 vpip->VPI,
12961 emlxs_vpi_state_xlate(vpip->state),
12962 emlxs_fcf_event_xlate(evt), arg1);
12963 return (1);
12964 }
12965
10052 vpip->flag &= ~EMLXS_VPI_LOGI;
10053 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
10054 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
12966 /* Fabric logo is implied */
12967 emlxs_vpi_logo_handler(port, vpip);
10055
12968
10056 if (vpip->vfip->logi_count > 0) {
10057 vpip->vfip->logi_count--;
10058 }
12969 if (hba->topology == TOPOLOGY_LOOP) {
12970 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12971 "vpi_logi_failed_action:%d. Private loop. "
12972 "Registering VPI.",
12973 vpip->VPI);
12974
12975 /* Update the VPI flogi_vpip pointer for loop */
12976 /* because the vpi_logo_handler cleared it */
12977 vpip->vfip->flogi_vpip = vpip;
12978
12979 bcopy((void *)&vpip->port->sparam,
12980 (void *)&vpip->fabric_rpip->sparam,
12981 sizeof (SERV_PARM));
12982
12983 /* Update the VPI Fabric RPI */
12984 vpip->fabric_rpip->sparam.cmn.w2.r_a_tov =
12985 LE_SWAP32((FF_DEF_RATOV * 1000));
12986
12987 rval = emlxs_vpi_state(port, vpip, VPI_STATE_REG,
12988 FCF_REASON_EVENT, evt, arg1);
12989 return (rval);
10059 }
10060
10061 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10062 "vpi_logi_failed_action:%d. Requesting offline.",
10063 vpip->VPI);
10064
10065 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
10066 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
10067 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
10068
10069 return (rval);
10070
10071} /* emlxs_vpi_logi_failed_action() */
10072
10073
12990 }
12991
12992 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12993 "vpi_logi_failed_action:%d. Requesting offline.",
12994 vpip->VPI);
12995
12996 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
12997 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
12998 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
12999
13000 return (rval);
13001
13002} /* emlxs_vpi_logi_failed_action() */
13003
13004
10074static void
10075emlxs_vpi_flogi_cmpl(emlxs_port_t *port, VPIobj_t *vpip, uint32_t status)
10076{
10077 emlxs_hba_t *hba = HBA;
10078 emlxs_buf_t *sbp;
10079
10080 sbp = vpip->flogi_sbp;
10081 if (!sbp) {
10082 return;
10083 }
10084 vpip->flogi_sbp = NULL;
10085
10086 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10087 "vpi_flogi_cmpl:%d. status=%x",
10088 vpip->VPI,
10089 status);
10090
10091 sbp->pkt_flags &= ~PACKET_STATE_VALID;
10092
10093 if (status) {
10094 emlxs_set_pkt_state(sbp, IOSTAT_LOCAL_REJECT,
10095 IOERR_NO_RESOURCES, 1);
10096 } else {
10097 emlxs_set_pkt_state(sbp, IOSTAT_SUCCESS, 0, 1);
10098 }
10099
10100 emlxs_thread_spawn(hba, emlxs_pkt_cmpl_thread, (void *)sbp, 0);
10101
10102 return;
10103
10104} /* emlxs_vpi_flogi_cmpl() */
10105
10106
10107/*ARGSUSED*/
10108static uint32_t
10109emlxs_vpi_logi_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10110 void *arg1)
10111{
13005/*ARGSUSED*/
13006static uint32_t
13007emlxs_vpi_logi_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13008 void *arg1)
13009{
10112 uint32_t rval;
10113 SERV_PARM *sp;
10114 fc_packet_t *pkt;
10115 emlxs_buf_t *sbp;
13010 emlxs_hba_t *hba = HBA;
13011 uint32_t rval = 0;
10116 char buffer1[64];
10117 char buffer2[64];
13012 char buffer1[64];
13013 char buffer2[64];
13014 uint32_t new_config = 0;
10118
10119 if (vpip->state != VPI_STATE_LOGI_CMPL) {
10120 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10121 "vpi_logi_cmpl_action:%d %s:%s arg=%p. "
13015
13016 if (vpip->state != VPI_STATE_LOGI_CMPL) {
13017 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13018 "vpi_logi_cmpl_action:%d %s:%s arg=%p. "
10122 "Invalid state. Terminated.",
13019 "Invalid state. <",
10123 vpip->VPI,
10124 emlxs_vpi_state_xlate(vpip->state),
10125 emlxs_fcf_event_xlate(evt), arg1);
10126 return (1);
10127 }
10128
10129 vpip->flag |= EMLXS_VPI_LOGI;
10130
13020 vpip->VPI,
13021 emlxs_vpi_state_xlate(vpip->state),
13022 emlxs_fcf_event_xlate(evt), arg1);
13023 return (1);
13024 }
13025
13026 vpip->flag |= EMLXS_VPI_LOGI;
13027
10131 sbp = (emlxs_buf_t *)arg1;
10132 if (!sbp) {
10133 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10134 "vpi_logi_cmpl_action:%d. Null sbp. Terminated.",
10135 vpip->VPI);
10136 return (1);
10137 }
13028 /* Check for new fabric */
13029 if (port->prev_did) {
13030 if (SLI4_FCOE_MODE) {
13031 /* Check for FCF change */
13032 if (((port->prev_did != port->did) ||
13033 bcmp(&port->prev_fabric_sparam.portName,
13034 &port->fabric_sparam.portName, 8)) &&
13035 emlxs_nport_count(port)) {
13036 new_config = 1;
13037 }
13038 } else {
13039 uint32_t old_topo;
13040 uint32_t new_topo;
10138
13041
10139 /* Check login parameters */
10140 pkt = PRIV2PKT(sbp);
10141 sp = (SERV_PARM *)((caddr_t)pkt->pkt_resp + sizeof (uint32_t));
13042 /* Check for topology change (0=loop 1=fabric) */
13043 old_topo = ((port->prev_did && 0xFFFF00) == 0)? 0:1;
13044 new_topo = ((port->did && 0xFFFF00) == 0)? 0:1;
10142
13045
10143 /* For safety */
10144 if (vpip->flogi_sbp) {
10145 emlxs_vpi_flogi_cmpl(port, vpip, 1);
10146 }
10147 vpip->flogi_sbp = sbp;
13046 if (old_topo != new_topo) {
13047 new_config = 1;
10148
13048
10149 /* Update the Fabric RPI */
10150 bcopy((void *)sp, (void *)&vpip->rpip->sparam, sizeof (SERV_PARM));
10151
10152 if (vpip->vfip->vpi_online == 1) {
10153 bcopy((void *)sp, (void *)&vpip->vfip->fcf_sparam,
10154 sizeof (SERV_PARM));
13049 /* Check for any switch change */
13050 } else if ((port->prev_did != port->did) ||
13051 bcmp(&port->prev_fabric_sparam.portName,
13052 &port->fabric_sparam.portName, 8)) {
13053 new_config = 1;
13054 }
13055 }
10155 }
10156
13056 }
13057
10157 if (port->prev_did &&
10158 ((port->prev_did != port->did) ||
10159 bcmp(&port->prev_fabric_sparam.portName,
10160 &port->fabric_sparam.portName, 8)) &&
10161 emlxs_nport_count(port)) {
10162
13058 if (new_config) {
10163 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10164 "vpi_logi_cmpl_action:%d. "
13059 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13060 "vpi_logi_cmpl_action:%d. "
10165 "New fabric. Offlining port.",
13061 "New config. Offlining port.",
10166 vpip->VPI);
10167
10168 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10169 "vpi_logi_cmpl_action: prev_wwpn=%s wwpn=%s prev_did=%x "
10170 "did=%x.",
13062 vpip->VPI);
13063
13064 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13065 "vpi_logi_cmpl_action: prev_wwpn=%s wwpn=%s prev_did=%x "
13066 "did=%x.",
10171 emlxs_wwn_xlate(buffer1,
13067 emlxs_wwn_xlate(buffer1, sizeof (buffer1),
10172 (uint8_t *)&port->prev_fabric_sparam.portName),
13068 (uint8_t *)&port->prev_fabric_sparam.portName),
10173 emlxs_wwn_xlate(buffer2,
13069 emlxs_wwn_xlate(buffer2, sizeof (buffer2),
10174 (uint8_t *)&port->fabric_sparam.portName),
10175 port->prev_did, port->did);
10176
10177 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
10178 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
10179 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
10180
10181 return (rval);

--- 12 unchanged lines hidden (view full) ---

10194
10195
10196/*ARGSUSED*/
10197static uint32_t
10198emlxs_vpi_logo_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10199 void *arg1)
10200{
10201 emlxs_hba_t *hba = HBA;
13070 (uint8_t *)&port->fabric_sparam.portName),
13071 port->prev_did, port->did);
13072
13073 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
13074 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
13075 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
13076
13077 return (rval);

--- 12 unchanged lines hidden (view full) ---

13090
13091
13092/*ARGSUSED*/
13093static uint32_t
13094emlxs_vpi_logo_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13095 void *arg1)
13096{
13097 emlxs_hba_t *hba = HBA;
10202 uint32_t rval;
13098 uint32_t rval = 0;
10203
10204 vpip->attempts++;
10205
10206 if (vpip->state != VPI_STATE_LOGO_FAILED) {
10207 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10208 "vpi_logo_failed_action:%d %s:%s arg=%p attempt=%d. "
13099
13100 vpip->attempts++;
13101
13102 if (vpip->state != VPI_STATE_LOGO_FAILED) {
13103 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13104 "vpi_logo_failed_action:%d %s:%s arg=%p attempt=%d. "
10209 "Invalid state. Terminated.",
13105 "Invalid state. <",
10210 vpip->VPI,
10211 emlxs_vpi_state_xlate(vpip->state),
10212 emlxs_fcf_event_xlate(evt), arg1,
10213 vpip->attempts);
13106 vpip->VPI,
13107 emlxs_vpi_state_xlate(vpip->state),
13108 emlxs_fcf_event_xlate(evt), arg1,
13109 vpip->attempts);
10214
10215 return (1);
10216 }
10217
10218 if (hba->state <= FC_LINK_DOWN) {
10219 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10220 "vpi_logo_failed_action:%d attempt=%d. Logo cmpl.",
10221 vpip->VPI,
10222 vpip->attempts);

--- 25 unchanged lines hidden (view full) ---

10248
10249/*ARGSUSED*/
10250static uint32_t
10251emlxs_vpi_logo_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10252 void *arg1)
10253{
10254 emlxs_hba_t *hba = HBA;
10255 emlxs_port_t *vport = vpip->port;
13110 return (1);
13111 }
13112
13113 if (hba->state <= FC_LINK_DOWN) {
13114 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13115 "vpi_logo_failed_action:%d attempt=%d. Logo cmpl.",
13116 vpip->VPI,
13117 vpip->attempts);

--- 25 unchanged lines hidden (view full) ---

13143
13144/*ARGSUSED*/
13145static uint32_t
13146emlxs_vpi_logo_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13147 void *arg1)
13148{
13149 emlxs_hba_t *hba = HBA;
13150 emlxs_port_t *vport = vpip->port;
10256 uint32_t rval;
13151 uint32_t rval = 0;
10257 uint32_t did;
10258 uint32_t sid;
10259 fc_packet_t *pkt;
10260 ELS_PKT *els;
10261
10262 if (vpip->state != VPI_STATE_LOGO) {
10263 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10264 "vpi_logo_action:%d %s:%s arg=%p. "
13152 uint32_t did;
13153 uint32_t sid;
13154 fc_packet_t *pkt;
13155 ELS_PKT *els;
13156
13157 if (vpip->state != VPI_STATE_LOGO) {
13158 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13159 "vpi_logo_action:%d %s:%s arg=%p. "
10265 "Invalid state. Terminated.",
13160 "Invalid state. <",
10266 vpip->VPI,
10267 emlxs_vpi_state_xlate(vpip->state),
10268 emlxs_fcf_event_xlate(evt), arg1);
13161 vpip->VPI,
13162 emlxs_vpi_state_xlate(vpip->state),
13163 emlxs_fcf_event_xlate(evt), arg1);
10269
10270 return (1);
10271 }
10272
10273 if (!(vpip->flag & EMLXS_VPI_LOGI)) {
10274 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13164 return (1);
13165 }
13166
13167 if (!(vpip->flag & EMLXS_VPI_LOGI)) {
13168 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10275 "vpi_logo_action:%d. No login. Skipping logo.",
13169 "vpi_logo_action:%d. No login. Skipping LOGO.",
10276 vpip->VPI);
10277
10278 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
10279 FCF_REASON_EVENT, evt, arg1);
10280 return (rval);
10281 }
10282
13170 vpip->VPI);
13171
13172 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
13173 FCF_REASON_EVENT, evt, arg1);
13174 return (rval);
13175 }
13176
10283 if (!(hba->flag & FC_ONLINE_MODE)) {
13177 if (!(hba->flag & FC_ONLINE_MODE) &&
13178 !(hba->flag & FC_OFFLINING_MODE)) {
10284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13179 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10285 "vpi_logo_action:%d. HBA offline. Skipping logo.",
13180 "vpi_logo_action:%d. HBA offline. Skipping LOGO.",
10286 vpip->VPI);
10287
13181 vpip->VPI);
13182
13183 /* Fabric logo is implied */
13184 emlxs_vpi_logo_handler(port, vpip);
13185
10288 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
10289 FCF_REASON_EVENT, evt, arg1);
10290 return (rval);
10291 }
10292
13186 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
13187 FCF_REASON_EVENT, evt, arg1);
13188 return (rval);
13189 }
13190
13191 if (SLI4_FC_MODE) {
13192 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13193 "vpi_logo_action:%d. FC mode. Skipping LOGO.",
13194 vpip->VPI);
13195
13196 /* Fabric logo is implied */
13197 emlxs_vpi_logo_handler(port, vpip);
13198
13199 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
13200 FCF_REASON_EVENT, evt, arg1);
13201 return (rval);
13202 }
13203
10293 if (vpip->prev_state != VPI_STATE_LOGO_FAILED) {
10294 vpip->attempts = 0;
10295 }
10296
13204 if (vpip->prev_state != VPI_STATE_LOGO_FAILED) {
13205 vpip->attempts = 0;
13206 }
13207
13208 did = FABRIC_DID;
13209 sid = (vport->did)? vport->did:vport->prev_did;
13210
10297 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13211 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10298 "vpi_logo_action:%d. Sending logo. Sending LOGO.",
13212 "vpi_logo_action:%d attempts=%d sid=%x did=%x. Sending LOGO. <",
10299 vpip->VPI,
13213 vpip->VPI,
10300 vpip->attempts);
13214 vpip->attempts,
13215 sid, did);
10301
10302 pkt = emlxs_pkt_alloc(vport,
10303 (sizeof (uint32_t) + sizeof (LOGO)),
10304 (sizeof (uint32_t) + sizeof (LOGO)), 0, KM_NOSLEEP);
10305
10306 if (!pkt) {
10307 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO_FAILED,
10308 FCF_REASON_NO_PKT, 0, arg1);
10309
10310 return (rval);
10311 }
10312
10313 pkt->pkt_tran_type = FC_PKT_EXCHANGE;
10314 pkt->pkt_timeout = (2 * hba->fc_ratov);
10315
10316 /* Build the fc header */
13216
13217 pkt = emlxs_pkt_alloc(vport,
13218 (sizeof (uint32_t) + sizeof (LOGO)),
13219 (sizeof (uint32_t) + sizeof (LOGO)), 0, KM_NOSLEEP);
13220
13221 if (!pkt) {
13222 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO_FAILED,
13223 FCF_REASON_NO_PKT, 0, arg1);
13224
13225 return (rval);
13226 }
13227
13228 pkt->pkt_tran_type = FC_PKT_EXCHANGE;
13229 pkt->pkt_timeout = (2 * hba->fc_ratov);
13230
13231 /* Build the fc header */
10317 did = FABRIC_DID;
10318 sid = (vport->did)? vport->did:vport->prev_did;
10319
10320 pkt->pkt_cmd_fhdr.d_id = LE_SWAP24_LO(did);
10321 pkt->pkt_cmd_fhdr.r_ctl =
10322 R_CTL_EXTENDED_SVC | R_CTL_SOLICITED_CONTROL;
10323 pkt->pkt_cmd_fhdr.s_id = LE_SWAP24_LO(sid);
10324 pkt->pkt_cmd_fhdr.type = FC_TYPE_EXTENDED_LS;
10325 pkt->pkt_cmd_fhdr.f_ctl =
10326 F_CTL_FIRST_SEQ | F_CTL_END_SEQ | F_CTL_SEQ_INITIATIVE;
10327 pkt->pkt_cmd_fhdr.seq_id = 0;

--- 5 unchanged lines hidden (view full) ---

10333
10334 /* Build the command */
10335 els = (ELS_PKT *)pkt->pkt_cmd;
10336 els->elsCode = 0x05;
10337 els->un.logo.un.nPortId32 = pkt->pkt_cmd_fhdr.s_id;
10338 bcopy((uint8_t *)&vport->wwpn,
10339 (uint8_t *)&els->un.logo.portName, 8);
10340
13232 pkt->pkt_cmd_fhdr.d_id = LE_SWAP24_LO(did);
13233 pkt->pkt_cmd_fhdr.r_ctl =
13234 R_CTL_EXTENDED_SVC | R_CTL_SOLICITED_CONTROL;
13235 pkt->pkt_cmd_fhdr.s_id = LE_SWAP24_LO(sid);
13236 pkt->pkt_cmd_fhdr.type = FC_TYPE_EXTENDED_LS;
13237 pkt->pkt_cmd_fhdr.f_ctl =
13238 F_CTL_FIRST_SEQ | F_CTL_END_SEQ | F_CTL_SEQ_INITIATIVE;
13239 pkt->pkt_cmd_fhdr.seq_id = 0;

--- 5 unchanged lines hidden (view full) ---

13245
13246 /* Build the command */
13247 els = (ELS_PKT *)pkt->pkt_cmd;
13248 els->elsCode = 0x05;
13249 els->un.logo.un.nPortId32 = pkt->pkt_cmd_fhdr.s_id;
13250 bcopy((uint8_t *)&vport->wwpn,
13251 (uint8_t *)&els->un.logo.portName, 8);
13252
10341 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10342 "vpi_logo_action:%d LOGO:sid=%x did=%x.",
10343 vpip->VPI,
10344 sid, did);
10345
10346 /* Send the pkt now */
13253 /* Send the pkt now */
10347 rval = emlxs_pkt_send(pkt, 1);
13254 rval = emlxs_pkt_send(pkt, 0);
10348 if (rval != FC_SUCCESS) {
10349 /* Free the pkt */
10350 emlxs_pkt_free(pkt);
10351
10352 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO_FAILED,
10353 FCF_REASON_SEND_FAILED, rval, arg1);
10354
10355 return (rval);

--- 8 unchanged lines hidden (view full) ---

10364} /* emlxs_vpi_logo_action() */
10365
10366
10367/*ARGSUSED*/
10368static uint32_t
10369emlxs_vpi_logo_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10370 void *arg1)
10371{
13255 if (rval != FC_SUCCESS) {
13256 /* Free the pkt */
13257 emlxs_pkt_free(pkt);
13258
13259 rval = emlxs_vpi_state(port, vpip, VPI_STATE_LOGO_FAILED,
13260 FCF_REASON_SEND_FAILED, rval, arg1);
13261
13262 return (rval);

--- 8 unchanged lines hidden (view full) ---

13271} /* emlxs_vpi_logo_action() */
13272
13273
13274/*ARGSUSED*/
13275static uint32_t
13276emlxs_vpi_logo_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13277 void *arg1)
13278{
10372 uint32_t rval;
13279 uint32_t rval = 0;
10373
10374 if (vpip->state != VPI_STATE_LOGO_CMPL) {
10375 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10376 "vpi_logo_cmpl_action:%d %s:%s arg=%p. "
13280
13281 if (vpip->state != VPI_STATE_LOGO_CMPL) {
13282 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13283 "vpi_logo_cmpl_action:%d %s:%s arg=%p. "
10377 "Invalid state. Terminated.",
13284 "Invalid state. <",
10378 vpip->VPI,
10379 emlxs_vpi_state_xlate(vpip->state),
10380 emlxs_fcf_event_xlate(evt), arg1);
10381 return (1);
10382 }
10383
13285 vpip->VPI,
13286 emlxs_vpi_state_xlate(vpip->state),
13287 emlxs_fcf_event_xlate(evt), arg1);
13288 return (1);
13289 }
13290
10384 vpip->flag &= ~EMLXS_VPI_LOGI;
10385 if (vpip->flag & EMLXS_VPI_VFI_LOGI) {
10386 vpip->flag &= ~EMLXS_VPI_VFI_LOGI;
13291 /* Fabric logo is complete */
13292 emlxs_vpi_logo_handler(port, vpip);
10387
13293
10388 if (vpip->vfip->logi_count > 0) {
10389 vpip->vfip->logi_count--;
10390 }
10391 }
10392
10393 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10394 "vpi_logo_cmpl_action:%d attempts=%d. Offline RPI's.",
10395 vpip->VPI,
10396 vpip->attempts);
10397
10398 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
10399 FCF_REASON_EVENT, evt, arg1);
10400
10401 return (rval);
10402
10403} /* emlxs_vpi_logo_cmpl_action() */
10404
10405
10406/*ARGSUSED*/
10407static uint32_t
10408emlxs_vpi_unreg_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10409 void *arg1)
10410{
13294 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13295 "vpi_logo_cmpl_action:%d attempts=%d. Offline RPI's.",
13296 vpip->VPI,
13297 vpip->attempts);
13298
13299 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
13300 FCF_REASON_EVENT, evt, arg1);
13301
13302 return (rval);
13303
13304} /* emlxs_vpi_logo_cmpl_action() */
13305
13306
13307/*ARGSUSED*/
13308static uint32_t
13309emlxs_vpi_unreg_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13310 void *arg1)
13311{
10411 uint32_t rval;
13312 uint32_t rval = 0;
10412
10413 vpip->attempts++;
10414
10415 if (vpip->state != VPI_STATE_UNREG_FAILED) {
10416 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10417 "vpi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
13313
13314 vpip->attempts++;
13315
13316 if (vpip->state != VPI_STATE_UNREG_FAILED) {
13317 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13318 "vpi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
10418 "Invalid state. Terminated.",
13319 "Invalid state. <",
10419 vpip->VPI,
10420 emlxs_vpi_state_xlate(vpip->state),
10421 emlxs_fcf_event_xlate(evt), arg1,
10422 vpip->attempts);
13320 vpip->VPI,
13321 emlxs_vpi_state_xlate(vpip->state),
13322 emlxs_fcf_event_xlate(evt), arg1,
13323 vpip->attempts);
10423
10424 return (1);
10425 }
10426
10427 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||
10428 (vpip->attempts >= 3)) {
10429 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10430 "vpi_unreg_failed_action:%d attempt=%d. Unreg cmpl.",
10431 vpip->VPI,

--- 30 unchanged lines hidden (view full) ---

10462
10463 vpip = (VPIobj_t *)mbq->context;
10464 mb4 = (MAILBOX4 *)mbq;
10465
10466 mutex_enter(&EMLXS_FCF_LOCK);
10467
10468 if (vpip->state != VPI_STATE_UNREG) {
10469 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13324 return (1);
13325 }
13326
13327 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||
13328 (vpip->attempts >= 3)) {
13329 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13330 "vpi_unreg_failed_action:%d attempt=%d. Unreg cmpl.",
13331 vpip->VPI,

--- 30 unchanged lines hidden (view full) ---

13362
13363 vpip = (VPIobj_t *)mbq->context;
13364 mb4 = (MAILBOX4 *)mbq;
13365
13366 mutex_enter(&EMLXS_FCF_LOCK);
13367
13368 if (vpip->state != VPI_STATE_UNREG) {
13369 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10470 "vpi_unreg_mbcmpl:%d state=%s. Terminated.",
13370 "vpi_unreg_mbcmpl:%d state=%s.",
10471 vpip->VPI,
10472 emlxs_vpi_state_xlate(vpip->state));
10473
10474 mutex_exit(&EMLXS_FCF_LOCK);
10475 return (0);
10476 }
10477
10478 if (mb4->mbxStatus) {
10479 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13371 vpip->VPI,
13372 emlxs_vpi_state_xlate(vpip->state));
13373
13374 mutex_exit(&EMLXS_FCF_LOCK);
13375 return (0);
13376 }
13377
13378 if (mb4->mbxStatus) {
13379 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10480 "vpi_unreg_mbcmpl:%d failed. status=%x",
13380 "vpi_unreg_mbcmpl:%d failed. %s. >",
10481 vpip->VPI,
13381 vpip->VPI,
10482 mb4->mbxStatus);
13382 emlxs_mb_xlate_status(mb4->mbxStatus));
10483
10484 (void) emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_FAILED,
10485 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
10486
10487 mutex_exit(&EMLXS_FCF_LOCK);
10488 return (0);
10489 }
10490
10491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13383
13384 (void) emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_FAILED,
13385 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
13386
13387 mutex_exit(&EMLXS_FCF_LOCK);
13388 return (0);
13389 }
13390
13391 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10492 "vpi_unreg_mbcmpl:%d Unregistered.",
13392 "vpi_unreg_mbcmpl:%d. Unreg complete. >",
10493 vpip->VPI);
10494
10495 vpip->flag &= ~(EMLXS_VPI_REG | EMLXS_VPI_INIT);
10496 (void) emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_CMPL, 0, 0, 0);
10497
10498 mutex_exit(&EMLXS_FCF_LOCK);
10499 return (0);
10500
10501} /* emlxs_vpi_unreg_mbcmpl() */
10502
10503
10504/*ARGSUSED*/
10505static uint32_t
10506emlxs_vpi_unreg_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10507 void *arg1)
10508{
10509 emlxs_hba_t *hba = HBA;
10510 MAILBOX4 *mb4;
10511 MAILBOXQ *mbq;
13393 vpip->VPI);
13394
13395 vpip->flag &= ~(EMLXS_VPI_REG | EMLXS_VPI_INIT);
13396 (void) emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_CMPL, 0, 0, 0);
13397
13398 mutex_exit(&EMLXS_FCF_LOCK);
13399 return (0);
13400
13401} /* emlxs_vpi_unreg_mbcmpl() */
13402
13403
13404/*ARGSUSED*/
13405static uint32_t
13406emlxs_vpi_unreg_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13407 void *arg1)
13408{
13409 emlxs_hba_t *hba = HBA;
13410 MAILBOX4 *mb4;
13411 MAILBOXQ *mbq;
10512 uint32_t rval;
13412 uint32_t rval = 0;
10513
10514 if (vpip->state != VPI_STATE_UNREG) {
10515 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10516 "vpi_unreg_action:%d %s:%s arg=%p. "
13413
13414 if (vpip->state != VPI_STATE_UNREG) {
13415 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13416 "vpi_unreg_action:%d %s:%s arg=%p. "
10517 "Invalid state. Terminated.",
13417 "Invalid state. <",
10518 vpip->VPI,
10519 emlxs_vpi_state_xlate(vpip->state),
10520 emlxs_fcf_event_xlate(evt), arg1);
13418 vpip->VPI,
13419 emlxs_vpi_state_xlate(vpip->state),
13420 emlxs_fcf_event_xlate(evt), arg1);
10521
10522 return (1);
10523 }
10524
13421 return (1);
13422 }
13423
10525 if ((vpip->rpi_online > 0) ||
10526 (vpip->rpip->state != RPI_STATE_FREE)) {
13424 if ((vpip->rpi_online > vpip->rpi_paused) ||
13425 (vpip->fabric_rpip->state != RPI_STATE_FREE)) {
10527 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13426 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10528 "vpi_unreg_action:%d rpi_online=%d,%d. Waiting for RPI's.",
10529 vpip->VPI,
10530 vpip->rpi_online, vpip->rpi_paused);
13427 "vpi_unreg_action:%d rpi_online=%d,%d fstate=%x. "
13428 "Waiting for RPI's.", vpip->VPI, vpip->rpi_online,
13429 vpip->rpi_paused, vpip->fabric_rpip->state);
10531
10532 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
10533 FCF_REASON_EVENT, evt, arg1);
10534 return (rval);
10535 }
10536
10537 if (!(vpip->flag & EMLXS_VPI_REG)) {
10538 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13430
13431 rval = emlxs_vpi_state(port, vpip, VPI_STATE_PORT_OFFLINE,
13432 FCF_REASON_EVENT, evt, arg1);
13433 return (rval);
13434 }
13435
13436 if (!(vpip->flag & EMLXS_VPI_REG)) {
13437 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10539 "vpi_unreg_action:%d. Not registered. Skipping unreg.",
13438 "vpi_unreg_action:%d. Not registered. Skipping UNREG_VPI.",
10540 vpip->VPI);
10541
10542 rval = emlxs_vpi_state(port, vpip, VPI_STATE_OFFLINE,
10543 FCF_REASON_EVENT, evt, arg1);
10544 return (rval);
10545 }
10546
10547 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {

--- 7 unchanged lines hidden (view full) ---

10555 return (rval);
10556 }
10557
10558 if (vpip->prev_state != VPI_STATE_UNREG_FAILED) {
10559 vpip->attempts = 0;
10560 }
10561
10562 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13439 vpip->VPI);
13440
13441 rval = emlxs_vpi_state(port, vpip, VPI_STATE_OFFLINE,
13442 FCF_REASON_EVENT, evt, arg1);
13443 return (rval);
13444 }
13445
13446 if (vpip->flag & EMLXS_VPI_PAUSE_REQ) {

--- 7 unchanged lines hidden (view full) ---

13454 return (rval);
13455 }
13456
13457 if (vpip->prev_state != VPI_STATE_UNREG_FAILED) {
13458 vpip->attempts = 0;
13459 }
13460
13461 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10563 "vpi_unreg_action:%d attempts=%d. Sending UNREG_VPI.",
13462 "vpi_unreg_action:%d attempts=%d. Sending UNREG_VPI. <",
10564 vpip->VPI,
10565 vpip->attempts);
10566
13463 vpip->VPI,
13464 vpip->attempts);
13465
10567 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
13466 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
10568 rval = emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_FAILED,
10569 FCF_REASON_NO_MBOX, 0, arg1);
10570
10571 return (rval);
10572 }
10573 mb4 = (MAILBOX4*)mbq;
10574 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
10575

--- 22 unchanged lines hidden (view full) ---

10598} /* emlxs_vpi_unreg_action() */
10599
10600
10601/*ARGSUSED*/
10602static uint32_t
10603emlxs_vpi_unreg_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10604 void *arg1)
10605{
13467 rval = emlxs_vpi_state(port, vpip, VPI_STATE_UNREG_FAILED,
13468 FCF_REASON_NO_MBOX, 0, arg1);
13469
13470 return (rval);
13471 }
13472 mb4 = (MAILBOX4*)mbq;
13473 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
13474

--- 22 unchanged lines hidden (view full) ---

13497} /* emlxs_vpi_unreg_action() */
13498
13499
13500/*ARGSUSED*/
13501static uint32_t
13502emlxs_vpi_unreg_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13503 void *arg1)
13504{
10606 uint32_t rval;
13505 uint32_t rval = 0;
10607
10608 if (vpip->state != VPI_STATE_UNREG_CMPL) {
10609 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10610 "vpi_unreg_cmpl_action:%d %s:%s arg=%p. "
13506
13507 if (vpip->state != VPI_STATE_UNREG_CMPL) {
13508 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13509 "vpi_unreg_cmpl_action:%d %s:%s arg=%p. "
10611 "Invalid state. Terminated.",
13510 "Invalid state. <",
10612 vpip->VPI,
10613 emlxs_vpi_state_xlate(vpip->state),
10614 emlxs_fcf_event_xlate(evt), arg1);
10615 return (1);
10616 }
10617
10618 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10619 "vpi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 8 unchanged lines hidden (view full) ---

10628} /* emlxs_vpi_unreg_cmpl_action() */
10629
10630
10631/*ARGSUSED*/
10632static uint32_t
10633emlxs_vpi_reg_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10634 void *arg1)
10635{
13511 vpip->VPI,
13512 emlxs_vpi_state_xlate(vpip->state),
13513 emlxs_fcf_event_xlate(evt), arg1);
13514 return (1);
13515 }
13516
13517 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13518 "vpi_unreg_cmpl_action:%d attempts=%d. Going offline.",

--- 8 unchanged lines hidden (view full) ---

13527} /* emlxs_vpi_unreg_cmpl_action() */
13528
13529
13530/*ARGSUSED*/
13531static uint32_t
13532emlxs_vpi_reg_failed_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13533 void *arg1)
13534{
10636 uint32_t rval;
13535 uint32_t rval = 0;
10637
10638 vpip->attempts++;
10639
10640 if (vpip->state != VPI_STATE_REG_FAILED) {
10641 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10642 "vpi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
13536
13537 vpip->attempts++;
13538
13539 if (vpip->state != VPI_STATE_REG_FAILED) {
13540 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13541 "vpi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
10643 "Invalid state. Terminated.",
13542 "Invalid state. <",
10644 vpip->VPI,
10645 emlxs_vpi_state_xlate(vpip->state),
10646 emlxs_fcf_event_xlate(evt), arg1,
10647 vpip->attempts);
10648 return (1);
10649 }
10650
10651 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||

--- 33 unchanged lines hidden (view full) ---

10685
10686 vpip = (VPIobj_t *)mbq->context;
10687 mb4 = (MAILBOX4 *)mbq;
10688
10689 mutex_enter(&EMLXS_FCF_LOCK);
10690
10691 if (vpip->state != VPI_STATE_REG) {
10692 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13543 vpip->VPI,
13544 emlxs_vpi_state_xlate(vpip->state),
13545 emlxs_fcf_event_xlate(evt), arg1,
13546 vpip->attempts);
13547 return (1);
13548 }
13549
13550 if ((vpip->reason == FCF_REASON_SEND_FAILED) ||

--- 33 unchanged lines hidden (view full) ---

13584
13585 vpip = (VPIobj_t *)mbq->context;
13586 mb4 = (MAILBOX4 *)mbq;
13587
13588 mutex_enter(&EMLXS_FCF_LOCK);
13589
13590 if (vpip->state != VPI_STATE_REG) {
13591 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10693 "vpi_reg_mbcmpl:%d state=%s. Terminated.",
13592 "vpi_reg_mbcmpl:%d state=%s.",
10694 vpip->VPI,
10695 emlxs_vpi_state_xlate(vpip->state));
10696
10697 mutex_exit(&EMLXS_FCF_LOCK);
10698 return (0);
10699 }
10700
10701 if (mb4->mbxStatus) {
10702 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13593 vpip->VPI,
13594 emlxs_vpi_state_xlate(vpip->state));
13595
13596 mutex_exit(&EMLXS_FCF_LOCK);
13597 return (0);
13598 }
13599
13600 if (mb4->mbxStatus) {
13601 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10703 "vpi_reg_mbcmpl:%d failed. status=%x",
13602 "vpi_reg_mbcmpl:%d failed. %s. >",
10704 vpip->VPI,
13603 vpip->VPI,
10705 mb4->mbxStatus);
13604 emlxs_mb_xlate_status(mb4->mbxStatus));
10706
13605
13606 if (mb4->mbxStatus == MBXERR_DID_INCONSISTENT) {
13607 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
13608 }
13609
10707 (void) emlxs_vpi_state(port, vpip, VPI_STATE_REG_FAILED,
10708 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
10709
10710 mutex_exit(&EMLXS_FCF_LOCK);
10711 return (0);
10712 }
10713
10714 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13610 (void) emlxs_vpi_state(port, vpip, VPI_STATE_REG_FAILED,
13611 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
13612
13613 mutex_exit(&EMLXS_FCF_LOCK);
13614 return (0);
13615 }
13616
13617 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10715 "vpi_reg_mbcmpl:%d. Registered.",
13618 "vpi_reg_mbcmpl:%d. Reg complete. >",
10716 vpip->VPI);
10717
10718 vpip->flag |= EMLXS_VPI_REG;
10719 (void) emlxs_vpi_state(port, vpip, VPI_STATE_REG_CMPL,
10720 0, 0, 0);
10721
10722 mutex_exit(&EMLXS_FCF_LOCK);
10723 return (0);

--- 5 unchanged lines hidden (view full) ---

10729static uint32_t
10730emlxs_vpi_reg_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10731 void *arg1)
10732{
10733 emlxs_hba_t *hba = HBA;
10734 uint32_t *wwpn;
10735 MAILBOX *mb;
10736 MAILBOXQ *mbq;
13619 vpip->VPI);
13620
13621 vpip->flag |= EMLXS_VPI_REG;
13622 (void) emlxs_vpi_state(port, vpip, VPI_STATE_REG_CMPL,
13623 0, 0, 0);
13624
13625 mutex_exit(&EMLXS_FCF_LOCK);
13626 return (0);

--- 5 unchanged lines hidden (view full) ---

13632static uint32_t
13633emlxs_vpi_reg_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13634 void *arg1)
13635{
13636 emlxs_hba_t *hba = HBA;
13637 uint32_t *wwpn;
13638 MAILBOX *mb;
13639 MAILBOXQ *mbq;
10737 uint32_t rval;
13640 uint32_t rval = 0;
10738
10739 if (vpip->state != VPI_STATE_REG) {
10740 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10741 "vpi_reg_action:%d %s:%s arg=%p. "
13641
13642 if (vpip->state != VPI_STATE_REG) {
13643 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13644 "vpi_reg_action:%d %s:%s arg=%p. "
10742 "Invalid state. Terminated.",
13645 "Invalid state. <",
10743 vpip->VPI,
10744 emlxs_vpi_state_xlate(vpip->state),
10745 emlxs_fcf_event_xlate(evt), arg1);
10746 return (1);
10747 }
10748
10749 if (vpip->prev_state != VPI_STATE_REG_FAILED) {
10750 vpip->attempts = 0;

--- 4 unchanged lines hidden (view full) ---

10755 "vpi_reg_action:%d attempts=%d. Offline requested.",
10756 vpip->VPI,
10757 vpip->attempts);
10758
10759 rval = emlxs_vpi_offline_handler(port, vpip, 0);
10760 return (rval);
10761 }
10762
13646 vpip->VPI,
13647 emlxs_vpi_state_xlate(vpip->state),
13648 emlxs_fcf_event_xlate(evt), arg1);
13649 return (1);
13650 }
13651
13652 if (vpip->prev_state != VPI_STATE_REG_FAILED) {
13653 vpip->attempts = 0;

--- 4 unchanged lines hidden (view full) ---

13658 "vpi_reg_action:%d attempts=%d. Offline requested.",
13659 vpip->VPI,
13660 vpip->attempts);
13661
13662 rval = emlxs_vpi_offline_handler(port, vpip, 0);
13663 return (rval);
13664 }
13665
10763 if (!(vpip->flag & EMLXS_VPI_REG) &&
10764 (vpip->vfip->vpi_online == 1)) {
10765 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10766 "vpi_reg_action:%d. First vpi. Skipping reg.",
10767 vpip->VPI);
13666 if (!(vpip->vfip->flag & EMLXS_VFI_REG)) {
13667 /* We can't register the VPI until our VFI is registered */
10768
13668
10769 rval = emlxs_vpi_state(port, vpip, VPI_STATE_ONLINE,
10770 FCF_REASON_EVENT, evt, arg1);
13669 /* If this is the flogi_vpip, then we can skip the REG_VPI. */
13670 /* REG_VPI will be performed later during REG_VFI */
13671 if (vpip == vpip->vfip->flogi_vpip) {
13672 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13673 "vpi_reg_action:%d. flogi_vpi. Skipping REG_VPI.",
13674 vpip->VPI);
10771
13675
13676 rval = emlxs_vpi_state(port, vpip, VPI_STATE_ONLINE,
13677 FCF_REASON_EVENT, evt, arg1);
13678
13679 return (rval);
13680 }
13681
13682 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13683 "vpi_reg_action:%d attempts=%d. VFI not registered. "
13684 "Offlining.",
13685 vpip->VPI,
13686 vpip->attempts);
13687
13688 vpip->flag &= ~EMLXS_VPI_REQ_MASK;
13689 vpip->flag |= EMLXS_VPI_OFFLINE_REQ;
13690 rval = emlxs_vpi_offline_handler(port, vpip, 0);
10772 return (rval);
10773 }
10774
10775 if (vpip->flag & EMLXS_VPI_REG) {
10776 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13691 return (rval);
13692 }
13693
13694 if (vpip->flag & EMLXS_VPI_REG) {
13695 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10777 "vpi_reg_action:%d attempts=%d. Updating REG_VPI.",
13696 "vpi_reg_action:%d attempts=%d. Updating REG_VPI. <",
10778 vpip->VPI,
10779 vpip->attempts);
10780 } else {
10781 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13697 vpip->VPI,
13698 vpip->attempts);
13699 } else {
13700 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10782 "vpi_reg_action:%d attempts=%d. Sending REG_VPI.",
13701 "vpi_reg_action:%d attempts=%d. Sending REG_VPI. <",
10783 vpip->VPI,
10784 vpip->attempts);
10785 }
10786
13702 vpip->VPI,
13703 vpip->attempts);
13704 }
13705
10787 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
13706 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
10788 rval = emlxs_vpi_state(port, vpip, VPI_STATE_REG_FAILED,
10789 FCF_REASON_NO_MBOX, 0, arg1);
10790
10791 return (rval);
10792 }
10793 mb = (MAILBOX*)mbq;
10794 bzero((void *) mb, MAILBOX_CMD_BSIZE);
10795

--- 30 unchanged lines hidden (view full) ---

10826} /* emlxs_vpi_reg_action() */
10827
10828
10829/*ARGSUSED*/
10830static uint32_t
10831emlxs_vpi_reg_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10832 void *arg1)
10833{
13707 rval = emlxs_vpi_state(port, vpip, VPI_STATE_REG_FAILED,
13708 FCF_REASON_NO_MBOX, 0, arg1);
13709
13710 return (rval);
13711 }
13712 mb = (MAILBOX*)mbq;
13713 bzero((void *) mb, MAILBOX_CMD_BSIZE);
13714

--- 30 unchanged lines hidden (view full) ---

13745} /* emlxs_vpi_reg_action() */
13746
13747
13748/*ARGSUSED*/
13749static uint32_t
13750emlxs_vpi_reg_cmpl_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13751 void *arg1)
13752{
10834 uint32_t rval;
13753 uint32_t rval = 0;
10835
10836 if (vpip->state != VPI_STATE_REG_CMPL) {
10837 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
10838 "vpi_reg_cmpl_action:%d %s:%s arg=%p. "
13754
13755 if (vpip->state != VPI_STATE_REG_CMPL) {
13756 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13757 "vpi_reg_cmpl_action:%d %s:%s arg=%p. "
10839 "Invalid state. Terminated.",
13758 "Invalid state. <",
10840 vpip->VPI,
10841 emlxs_vpi_state_xlate(vpip->state),
10842 emlxs_fcf_event_xlate(evt), arg1);
10843 return (1);
10844 }
10845
10846 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
10847 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 18 unchanged lines hidden (view full) ---

10866} /* emlxs_vpi_reg_cmpl_action() */
10867
10868
10869/*ARGSUSED*/
10870static uint32_t
10871emlxs_vpi_online_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
10872 void *arg1)
10873{
13759 vpip->VPI,
13760 emlxs_vpi_state_xlate(vpip->state),
13761 emlxs_fcf_event_xlate(evt), arg1);
13762 return (1);
13763 }
13764
13765 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
13766 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,

--- 18 unchanged lines hidden (view full) ---

13785} /* emlxs_vpi_reg_cmpl_action() */
13786
13787
13788/*ARGSUSED*/
13789static uint32_t
13790emlxs_vpi_online_action(emlxs_port_t *port, VPIobj_t *vpip, uint32_t evt,
13791 void *arg1)
13792{
10874 uint32_t rval;
13793 uint32_t rval = 0;
10875
10876 if (vpip->state != VPI_STATE_ONLINE) {
10877 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10878 "vpi_online_action:%d %s:%s arg=%p. "
13794
13795 if (vpip->state != VPI_STATE_ONLINE) {
13796 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13797 "vpi_online_action:%d %s:%s arg=%p. "
10879 "Invalid state. Terminated.",
13798 "Invalid state. <",
10880 vpip->VPI,
10881 emlxs_vpi_state_xlate(vpip->state),
10882 emlxs_fcf_event_xlate(evt), arg1);
10883 return (1);
10884 }
10885
10886 vpip->flag &= ~EMLXS_VPI_ONLINE_REQ;
10887
10888 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
10889 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10890 "vpi_online_action:%d attempts=%d. Offline requested.",
10891 vpip->VPI,
10892 vpip->attempts);
10893
10894 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
10895 return (rval);
10896 }
10897
10898 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13799 vpip->VPI,
13800 emlxs_vpi_state_xlate(vpip->state),
13801 emlxs_fcf_event_xlate(evt), arg1);
13802 return (1);
13803 }
13804
13805 vpip->flag &= ~EMLXS_VPI_ONLINE_REQ;
13806
13807 if (vpip->flag & EMLXS_VPI_OFFLINE_REQ) {
13808 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
13809 "vpi_online_action:%d attempts=%d. Offline requested.",
13810 vpip->VPI,
13811 vpip->attempts);
13812
13813 rval = emlxs_vpi_offline_handler(port, vpip, arg1);
13814 return (rval);
13815 }
13816
13817 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
10899 "vpi_online_action:%d. VPI online. Notifying VFI:%d",
13818 "vpi_online_action:%d. VPI online. Notifying VFI:%d >",
10900 vpip->VPI,
10901 vpip->vfip->VFI);
10902
10903 /* Notify VFI */
10904 rval = emlxs_vfi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
10905
10906 return (rval);
10907

--- 13 unchanged lines hidden (view full) ---

10921
10922 count = sizeof (emlxs_rpi_state_table) / sizeof (emlxs_table_t);
10923 for (i = 0; i < count; i++) {
10924 if (state == emlxs_rpi_state_table[i].code) {
10925 return (emlxs_rpi_state_table[i].string);
10926 }
10927 }
10928
13819 vpip->VPI,
13820 vpip->vfip->VFI);
13821
13822 /* Notify VFI */
13823 rval = emlxs_vfi_event(port, FCF_EVENT_VPI_ONLINE, vpip);
13824
13825 return (rval);
13826

--- 13 unchanged lines hidden (view full) ---

13840
13841 count = sizeof (emlxs_rpi_state_table) / sizeof (emlxs_table_t);
13842 for (i = 0; i < count; i++) {
13843 if (state == emlxs_rpi_state_table[i].code) {
13844 return (emlxs_rpi_state_table[i].string);
13845 }
13846 }
13847
10929 (void) sprintf(buffer, "state=0x%x", state);
13848 (void) snprintf(buffer, sizeof (buffer), "state=0x%x", state);
10930 return (buffer);
10931
10932} /* emlxs_rpi_state_xlate() */
10933
10934
10935static uint32_t
10936emlxs_rpi_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
10937 void *arg1)
10938{
13849 return (buffer);
13850
13851} /* emlxs_rpi_state_xlate() */
13852
13853
13854static uint32_t
13855emlxs_rpi_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
13856 void *arg1)
13857{
10939 uint32_t rval;
13858 uint32_t rval = 0;
10940 uint32_t(*func) (emlxs_port_t *, RPIobj_t *, uint32_t, void *);
10941 uint32_t index;
10942 uint32_t events;
10943 uint16_t state;
10944
10945 /* Convert event to action table index */
10946 switch (evt) {
10947 case FCF_EVENT_STATE_ENTER:

--- 19 unchanged lines hidden (view full) ---

10967 state = rpip->state;
10968
10969 index += (state * events);
10970 func = (uint32_t(*) (emlxs_port_t *, RPIobj_t *, uint32_t, void *))
10971 emlxs_rpi_action_table[index];
10972
10973 if (!func) {
10974 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
13859 uint32_t(*func) (emlxs_port_t *, RPIobj_t *, uint32_t, void *);
13860 uint32_t index;
13861 uint32_t events;
13862 uint16_t state;
13863
13864 /* Convert event to action table index */
13865 switch (evt) {
13866 case FCF_EVENT_STATE_ENTER:

--- 19 unchanged lines hidden (view full) ---

13886 state = rpip->state;
13887
13888 index += (state * events);
13889 func = (uint32_t(*) (emlxs_port_t *, RPIobj_t *, uint32_t, void *))
13890 emlxs_rpi_action_table[index];
13891
13892 if (!func) {
13893 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
10975 "rpi:%d %s:%s arg=%p. No action. Terminated.",
13894 "rpi_action:%d %s:%s arg=%p. No action. <",
10976 rpip->RPI,
10977 emlxs_rpi_state_xlate(rpip->state),
10978 emlxs_fcf_event_xlate(evt), arg1);
10979
10980 return (1);
10981 }
10982
10983 rval = (func)(port, rpip, evt, arg1);
10984
10985 return (rval);
10986
10987} /* emlxs_rpi_action() */
10988
10989
10990static uint32_t
10991emlxs_rpi_event(emlxs_port_t *port, uint32_t evt,
10992 void *arg1)
10993{
10994 RPIobj_t *rpip = NULL;
13895 rpip->RPI,
13896 emlxs_rpi_state_xlate(rpip->state),
13897 emlxs_fcf_event_xlate(evt), arg1);
13898
13899 return (1);
13900 }
13901
13902 rval = (func)(port, rpip, evt, arg1);
13903
13904 return (rval);
13905
13906} /* emlxs_rpi_action() */
13907
13908
13909static uint32_t
13910emlxs_rpi_event(emlxs_port_t *port, uint32_t evt,
13911 void *arg1)
13912{
13913 RPIobj_t *rpip = NULL;
10995 uint32_t rval;
13914 uint32_t rval = 0;
10996
10997 /* Filter events and acquire fcfi context */
10998 switch (evt) {
10999 case FCF_EVENT_RPI_ONLINE:
11000 case FCF_EVENT_RPI_OFFLINE:
11001 case FCF_EVENT_RPI_PAUSE:
11002 case FCF_EVENT_RPI_RESUME:
11003 rpip = (RPIobj_t *)arg1;
11004
11005 if (!rpip) {
11006 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
13915
13916 /* Filter events and acquire fcfi context */
13917 switch (evt) {
13918 case FCF_EVENT_RPI_ONLINE:
13919 case FCF_EVENT_RPI_OFFLINE:
13920 case FCF_EVENT_RPI_PAUSE:
13921 case FCF_EVENT_RPI_RESUME:
13922 rpip = (RPIobj_t *)arg1;
13923
13924 if (!rpip) {
13925 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11007 "rpi: %s arg=%p. Null RPI found. Terminated.",
13926 "rpi_event: %s arg=%p. Null RPI found. <",
11008 emlxs_fcf_event_xlate(evt), arg1);
11009
11010 return (1);
11011 }
11012
11013 break;
11014
11015 default:
11016 return (1);
11017 }
11018
11019 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
13927 emlxs_fcf_event_xlate(evt), arg1);
13928
13929 return (1);
13930 }
13931
13932 break;
13933
13934 default:
13935 return (1);
13936 }
13937
13938 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_event_msg,
11020 "rpi:%d %s:%s arg=%p",
13939 "rpi_event:%d %s:%s arg=%p",
11021 rpip->RPI,
11022 emlxs_rpi_state_xlate(rpip->state),
11023 emlxs_fcf_event_xlate(evt), arg1);
11024
11025 rval = emlxs_rpi_action(port, rpip, evt, arg1);
11026
11027 return (rval);
11028

--- 9 unchanged lines hidden (view full) ---

11038
11039 if (state >= RPI_ACTION_STATES) {
11040 return (1);
11041 }
11042
11043 if ((rpip->state == state) &&
11044 (reason != FCF_REASON_REENTER)) {
11045 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
13940 rpip->RPI,
13941 emlxs_rpi_state_xlate(rpip->state),
13942 emlxs_fcf_event_xlate(evt), arg1);
13943
13944 rval = emlxs_rpi_action(port, rpip, evt, arg1);
13945
13946 return (rval);
13947

--- 9 unchanged lines hidden (view full) ---

13957
13958 if (state >= RPI_ACTION_STATES) {
13959 return (1);
13960 }
13961
13962 if ((rpip->state == state) &&
13963 (reason != FCF_REASON_REENTER)) {
13964 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11046 "rpi_state:%d %s:%s:0x%x arg=%p. State not changed. "
11047 "Terminated.",
13965 "rpi_state:%d %s:%s:0x%x arg=%p. State not changed. <",
11048 rpip->RPI,
11049 emlxs_rpi_state_xlate(rpip->state),
11050 emlxs_fcf_reason_xlate(reason),
11051 explain, arg1);
13966 rpip->RPI,
13967 emlxs_rpi_state_xlate(rpip->state),
13968 emlxs_fcf_reason_xlate(reason),
13969 explain, arg1);
11052
11053 return (1);
11054 }
11055
11056 if (!reason) {
11057 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
13970 return (1);
13971 }
13972
13973 if (!reason) {
13974 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11058 "rpi:%d %s-->%s arg=%p",
13975 "rpi_state:%d %s-->%s arg=%p",
11059 rpip->RPI,
11060 emlxs_rpi_state_xlate(rpip->state),
11061 emlxs_rpi_state_xlate(state), arg1);
11062 } else if (reason == FCF_REASON_EVENT) {
11063 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
13976 rpip->RPI,
13977 emlxs_rpi_state_xlate(rpip->state),
13978 emlxs_rpi_state_xlate(state), arg1);
13979 } else if (reason == FCF_REASON_EVENT) {
13980 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11064 "rpi:%d %s-->%s:%s:%s arg=%p",
13981 "rpi_state:%d %s-->%s:%s:%s arg=%p",
11065 rpip->RPI,
11066 emlxs_rpi_state_xlate(rpip->state),
11067 emlxs_rpi_state_xlate(state),
11068 emlxs_fcf_reason_xlate(reason),
11069 emlxs_fcf_event_xlate(explain), arg1);
11070 } else if (explain) {
11071 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
13982 rpip->RPI,
13983 emlxs_rpi_state_xlate(rpip->state),
13984 emlxs_rpi_state_xlate(state),
13985 emlxs_fcf_reason_xlate(reason),
13986 emlxs_fcf_event_xlate(explain), arg1);
13987 } else if (explain) {
13988 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11072 "rpi:%d %s-->%s:%s:0x%x arg=%p",
13989 "rpi_state:%d %s-->%s:%s:0x%x arg=%p",
11073 rpip->RPI,
11074 emlxs_rpi_state_xlate(rpip->state),
11075 emlxs_rpi_state_xlate(state),
11076 emlxs_fcf_reason_xlate(reason),
11077 explain, arg1);
11078 } else {
11079 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
13990 rpip->RPI,
13991 emlxs_rpi_state_xlate(rpip->state),
13992 emlxs_rpi_state_xlate(state),
13993 emlxs_fcf_reason_xlate(reason),
13994 explain, arg1);
13995 } else {
13996 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_state_msg,
11080 "rpi:%d %s-->%s:%s arg=%p",
13997 "rpi_state:%d %s-->%s:%s arg=%p",
11081 rpip->RPI,
11082 emlxs_rpi_state_xlate(rpip->state),
11083 emlxs_rpi_state_xlate(state),
11084 emlxs_fcf_reason_xlate(reason), arg1);
11085 }
11086
11087 rpip->prev_state = rpip->state;
11088 rpip->prev_reason = rpip->reason;
11089 rpip->state = state;
11090 rpip->reason = reason;
11091
11092 rval = emlxs_rpi_action(port, rpip, FCF_EVENT_STATE_ENTER, arg1);
11093
11094 return (rval);
11095
11096} /* emlxs_rpi_state() */
11097
11098
13998 rpip->RPI,
13999 emlxs_rpi_state_xlate(rpip->state),
14000 emlxs_rpi_state_xlate(state),
14001 emlxs_fcf_reason_xlate(reason), arg1);
14002 }
14003
14004 rpip->prev_state = rpip->state;
14005 rpip->prev_reason = rpip->reason;
14006 rpip->state = state;
14007 rpip->reason = reason;
14008
14009 rval = emlxs_rpi_action(port, rpip, FCF_EVENT_STATE_ENTER, arg1);
14010
14011 return (rval);
14012
14013} /* emlxs_rpi_state() */
14014
14015
11099static RPIobj_t *
11100emlxs_rpi_alloc(emlxs_port_t *port, uint32_t did)
14016static void
14017emlxs_rpi_deferred_cmpl(emlxs_port_t *port, RPIobj_t *rpip, uint32_t status)
11101{
11102 emlxs_hba_t *hba = HBA;
14018{
14019 emlxs_hba_t *hba = HBA;
11103 uint16_t i;
11104 RPIobj_t *rpip;
14020 emlxs_deferred_cmpl_t *cmpl;
11105
14021
11106 /* Special handling for Fabric RPI */
11107 if (did == FABRIC_DID) {
11108 /* Use the reserved RPI in the port */
11109 rpip = &port->VPIobj.fcf_rpi;
14022 if (!rpip->cmpl) {
14023 return;
14024 }
11110
14025
11111 bzero(rpip, sizeof (RPIobj_t));
11112 rpip->index = 0xffff;
11113 rpip->RPI = 0xffff;
11114 rpip->did = FABRIC_DID;
11115 rpip->vpip = &port->VPIobj;
14026 cmpl = rpip->cmpl;
14027 rpip->cmpl = 0;
11116
14028
11117 (void) emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
11118 0, 0, 0);
14029 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14030 "rpi_deferred_cmpl:%d. status=%x ...",
14031 port->vpip->VPI,
14032 status);
11119
14033
11120 return (rpip);
14034 emlxs_thread_spawn(hba, emlxs_deferred_cmpl_thread, (void *)cmpl,
14035 (void*)(uintptr_t)status);
14036
14037 return;
14038
14039} /* emlxs_rpi_deferred_cmpl() */
14040
14041
14042static void
14043emlxs_rpi_idle_timer(emlxs_hba_t *hba)
14044{
14045 emlxs_config_t *cfg = &CFG;
14046 RPIobj_t *rpip;
14047 uint32_t i;
14048
14049 /* This timer monitors for idle timeout of an RPI in a */
14050 /* RESERVED state. */
14051 /* This means that the RPI was reserved, but never registered. */
14052 /* If the RPI sits for too long (~2 secs) in this state we free it */
14053 rpip = hba->sli.sli4.RPIp;
14054 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
14055 if (rpip->state != RPI_STATE_RESERVED) {
14056 continue;
14057 }
14058
14059 /* If RPI is active, then clear timer. */
14060 if (rpip->xri_count) {
14061 rpip->idle_timer = 0;
14062 continue;
14063 }
14064
14065 /* If an F-port RPI is found idle, then free it. */
14066 /* Since an F-port RPI is never registered after the login */
14067 /* completes, it is safe to free it immediately. */
14068 if ((rpip->did == FABRIC_DID) ||
14069 (rpip->did == SCR_DID)) {
14070 goto free_it;
14071 }
14072
14073 /* Start idle timer if not already active */
14074 if (!rpip->idle_timer) {
14075 rpip->idle_timer = hba->timer_tics +
14076 cfg[CFG_FCF_RPI_IDLE_TIMEOUT].current;
14077 }
14078
14079 /* Check for idle timeout */
14080 if (hba->timer_tics < rpip->idle_timer) {
14081 continue;
14082 }
14083 rpip->idle_timer = 0;
14084
14085free_it:
14086 (void) emlxs_rpi_state(rpip->vpip->port, rpip, RPI_STATE_FREE,
14087 FCF_REASON_UNUSED, 0, 0);
11121 }
11122
14088 }
14089
14090 return;
14091
14092} /* emlxs_rpi_idle_timer() */
14093
14094
14095static RPIobj_t *
14096emlxs_rpi_alloc(emlxs_port_t *port, uint32_t did)
14097{
14098 emlxs_hba_t *hba = HBA;
14099 uint16_t i;
14100 RPIobj_t *rpip;
14101
11123 rpip = hba->sli.sli4.RPIp;
11124 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
11125 /* To be consistent with SLI3, the RPI assignment */
11126 /* starts with 1. ONLY one SLI4 HBA in the entire */
11127 /* system will be sacrificed by one RPI and that */
11128 /* is the one having RPI base equal 0. */
11129 if ((rpip->state == RPI_STATE_FREE) && (rpip->RPI != 0)) {
11130
11131 bzero(rpip, sizeof (RPIobj_t));
11132 rpip->index = i;
14102 rpip = hba->sli.sli4.RPIp;
14103 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
14104 /* To be consistent with SLI3, the RPI assignment */
14105 /* starts with 1. ONLY one SLI4 HBA in the entire */
14106 /* system will be sacrificed by one RPI and that */
14107 /* is the one having RPI base equal 0. */
14108 if ((rpip->state == RPI_STATE_FREE) && (rpip->RPI != 0)) {
14109
14110 bzero(rpip, sizeof (RPIobj_t));
14111 rpip->index = i;
11133 rpip->RPI = hba->sli.sli4.RPIBase + i;
11134 rpip->vpip = &port->VPIobj;
14112 rpip->RPI = emlxs_sli4_index_to_rpi(hba, i);
14113 rpip->vpip = port->vpip;
11135 rpip->did = did;
11136
14114 rpip->did = did;
14115
11137 (void) emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
14116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14117 "rpi_alloc:%d. RPI allocated. >",
14118 rpip->RPI);
14119
14120 (void) emlxs_rpi_state(port, rpip, RPI_STATE_RESERVED,
11138 0, 0, 0);
11139
11140 return (rpip);
11141 }
11142 }
11143
14121 0, 0, 0);
14122
14123 return (rpip);
14124 }
14125 }
14126
14127 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14128 "rpi_alloc: Out of RPI objects.");
14129
11144 return (NULL);
11145
11146} /* emlxs_rpi_alloc() */
11147
11148
14130 return (NULL);
14131
14132} /* emlxs_rpi_alloc() */
14133
14134
14135/* Special routine for VPI object */
14136static void
14137emlxs_rpi_alloc_fabric_rpi(emlxs_port_t *port)
14138{
14139 RPIobj_t *fabric_rpip;
14140
14141 fabric_rpip = port->vpip->fabric_rpip;
14142
14143 if (fabric_rpip->state != RPI_STATE_FREE) {
14144 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14145 "rpi_alloc_fabric_rpi: Fabric RPI active:%s.",
14146 emlxs_rpi_state_xlate(fabric_rpip->state));
14147 return;
14148 }
14149
14150 bzero(fabric_rpip, sizeof (RPIobj_t));
14151 fabric_rpip->index = 0xffff;
14152 fabric_rpip->RPI = FABRIC_RPI;
14153 fabric_rpip->did = FABRIC_DID;
14154 fabric_rpip->vpip = port->vpip;
14155
14156 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14157 "rpi_alloc_fabric_rpi: Allocating Fabric RPI. >");
14158
14159 (void) emlxs_rpi_state(port, fabric_rpip, RPI_STATE_RESERVED,
14160 0, 0, 0);
14161
14162 return;
14163
14164} /* emlxs_rpi_alloc_fabric_rpi() */
14165
14166
11149static uint32_t
11150emlxs_rpi_free(emlxs_port_t *port, RPIobj_t *rpip)
11151{
14167static uint32_t
14168emlxs_rpi_free(emlxs_port_t *port, RPIobj_t *rpip)
14169{
11152 uint32_t rval;
14170 uint32_t rval = 0;
11153
14171
14172 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14173 "rpi_free:%d did=%x. Freeing RPI. >",
14174 rpip->RPI, rpip->did);
14175
11154 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE, 0, 0, 0);
11155
11156 return (rval);
11157
14176 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE, 0, 0, 0);
14177
14178 return (rval);
14179
11158} /* emlxs_fcfi_free() */
14180} /* emlxs_rpi_free() */
11159
11160
11161extern RPIobj_t *
11162emlxs_rpi_find(emlxs_port_t *port, uint16_t rpi)
11163{
11164 emlxs_hba_t *hba = HBA;
14181
14182
14183extern RPIobj_t *
14184emlxs_rpi_find(emlxs_port_t *port, uint16_t rpi)
14185{
14186 emlxs_hba_t *hba = HBA;
11165 RPIobj_t *rpip;
14187 RPIobj_t *rpip;
14188 uint32_t index;
11166
11167 /* Special handling for Fabric RPI */
14189
14190 /* Special handling for Fabric RPI */
11168 if (rpi == 0xffff) {
11169 return (port->VPIobj.rpip);
14191 if (rpi == FABRIC_RPI) {
14192 return (port->vpip->fabric_rpip);
11170 }
11171
14193 }
14194
11172 if ((rpi < hba->sli.sli4.RPIBase) ||
11173 (rpi >= hba->sli.sli4.RPIBase+hba->sli.sli4.RPICount)) {
14195 index = emlxs_sli4_rpi_to_index(hba, rpi);
14196
14197 if (index >= hba->sli.sli4.RPICount) {
11174 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14198 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11175 "rpi_find:%d. RPI out of range (%d,%d).",
11176 rpi,
11177 hba->sli.sli4.RPIBase,
11178 hba->sli.sli4.RPIBase+hba->sli.sli4.RPICount);
14199 "rpi_find:%d. RPI Invalid.",
14200 rpi);
11179
11180 return (NULL);
11181 }
11182
14201
14202 return (NULL);
14203 }
14204
11183 rpip = &hba->sli.sli4.RPIp[(rpi - hba->sli.sli4.RPIBase)];
14205 rpip = &hba->sli.sli4.RPIp[index];
11184
11185 if (rpip->state == RPI_STATE_FREE) {
11186 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11187 "rpi_find:%d RPI not active",
11188 rpi);
11189
11190 return (NULL);
11191 }

--- 6 unchanged lines hidden (view full) ---

11198static RPIobj_t *
11199emlxs_rpi_find_did(emlxs_port_t *port, uint32_t did)
11200{
11201 emlxs_hba_t *hba = HBA;
11202 RPIobj_t *rpip;
11203 RPIobj_t *rpip1;
11204 uint32_t i;
11205
14206
14207 if (rpip->state == RPI_STATE_FREE) {
14208 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14209 "rpi_find:%d RPI not active",
14210 rpi);
14211
14212 return (NULL);
14213 }

--- 6 unchanged lines hidden (view full) ---

14220static RPIobj_t *
14221emlxs_rpi_find_did(emlxs_port_t *port, uint32_t did)
14222{
14223 emlxs_hba_t *hba = HBA;
14224 RPIobj_t *rpip;
14225 RPIobj_t *rpip1;
14226 uint32_t i;
14227
11206 /* Special handling for Fabric RPI */
11207 if (did == FABRIC_DID) {
11208 return (port->VPIobj.rpip);
11209 }
11210
11211 rpip1 = NULL;
11212 rpip = hba->sli.sli4.RPIp;
11213 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
11214 if (rpip->state == RPI_STATE_FREE) {
11215 continue;
11216 }
11217
14228 rpip1 = NULL;
14229 rpip = hba->sli.sli4.RPIp;
14230 for (i = 0; i < hba->sli.sli4.RPICount; i++, rpip++) {
14231 if (rpip->state == RPI_STATE_FREE) {
14232 continue;
14233 }
14234
11218 if ((rpip->did == did) && (rpip->vpip == &port->VPIobj)) {
14235 if ((rpip->did == did) && (rpip->vpip == port->vpip)) {
11219 rpip1 = rpip;
11220 break;
11221 }
11222 }
11223
11224 return (rpip1);
11225
11226} /* emlxs_rpi_find_did() */
11227
11228
11229extern RPIobj_t *
14236 rpip1 = rpip;
14237 break;
14238 }
14239 }
14240
14241 return (rpip1);
14242
14243} /* emlxs_rpi_find_did() */
14244
14245
14246extern RPIobj_t *
11230emlxs_rpi_alloc_notify(emlxs_port_t *port, uint32_t did)
14247emlxs_rpi_reserve_notify(emlxs_port_t *port, uint32_t did, XRIobj_t *xrip)
11231{
14248{
11232 emlxs_hba_t *hba = HBA;
14249 emlxs_hba_t *hba = HBA;
11233 RPIobj_t *rpip;
11234
14250 RPIobj_t *rpip;
14251
14252 /* xrip will be NULL for unsolicited BLS requests */
14253
11235 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11236 return (NULL);
11237 }
11238
14254 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14255 return (NULL);
14256 }
14257
11239 /* Fabric RPI will be handled automatically */
11240 if (did == FABRIC_DID) {
14258 mutex_enter(&EMLXS_FCF_LOCK);
14259
14260 rpip = emlxs_rpi_find_did(port, did);
14261
14262 if (!rpip) {
14263 rpip = emlxs_rpi_alloc(port, did);
14264 }
14265
14266 if (!rpip) {
14267 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14268 "rpi_reserve_notify: Unable to reserve an rpi. "
14269 "did=%x xri=%d.",
14270 did, ((xrip)?xrip->XRI:0));
14271
14272 mutex_exit(&EMLXS_FCF_LOCK);
11241 return (NULL);
11242 }
11243
14273 return (NULL);
14274 }
14275
14276 /* Bind the XRI */
14277 if (xrip) {
14278 mutex_enter(&EMLXS_FCTAB_LOCK);
14279 xrip->reserved_rpip = rpip;
14280 rpip->xri_count++;
14281 mutex_exit(&EMLXS_FCTAB_LOCK);
14282 }
14283
14284 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14285 "rpi_reserve_notify:%d did=%x xri=%d.",
14286 rpip->RPI, rpip->did, ((xrip)?xrip->XRI:0));
14287
14288 mutex_exit(&EMLXS_FCF_LOCK);
14289
14290 return (rpip);
14291
14292} /* emlxs_rpi_reserve_notify() */
14293
14294
14295extern RPIobj_t *
14296emlxs_rpi_alloc_notify(emlxs_port_t *port, uint32_t did)
14297{
14298 emlxs_hba_t *hba = HBA;
14299 RPIobj_t *rpip;
14300
14301 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14302 return (NULL);
14303 }
14304
11244 mutex_enter(&EMLXS_FCF_LOCK);
11245
11246 rpip = emlxs_rpi_alloc(port, did);
11247
11248 mutex_exit(&EMLXS_FCF_LOCK);
11249
11250 return (rpip);
11251
11252} /* emlxs_rpi_alloc_notify() */
11253
11254
11255extern uint32_t
11256emlxs_rpi_free_notify(emlxs_port_t *port, RPIobj_t *rpip)
11257{
11258 emlxs_hba_t *hba = HBA;
14305 mutex_enter(&EMLXS_FCF_LOCK);
14306
14307 rpip = emlxs_rpi_alloc(port, did);
14308
14309 mutex_exit(&EMLXS_FCF_LOCK);
14310
14311 return (rpip);
14312
14313} /* emlxs_rpi_alloc_notify() */
14314
14315
14316extern uint32_t
14317emlxs_rpi_free_notify(emlxs_port_t *port, RPIobj_t *rpip)
14318{
14319 emlxs_hba_t *hba = HBA;
11259 uint32_t rval;
14320 uint32_t rval = 0;
11260
11261 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11262 return (1);
11263 }
11264
11265 if (!rpip) {
11266 return (1);
11267 }
11268
11269 /* Fabric RPI will be handled automatically */
14321
14322 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14323 return (1);
14324 }
14325
14326 if (!rpip) {
14327 return (1);
14328 }
14329
14330 /* Fabric RPI will be handled automatically */
11270 if (rpip->did == FABRIC_DID) {
14331 if (rpip->RPI == FABRIC_RPI) {
11271 return (1);
11272 }
11273
11274 mutex_enter(&EMLXS_FCF_LOCK);
11275
11276 rval = emlxs_rpi_free(port, rpip);
11277
11278 mutex_exit(&EMLXS_FCF_LOCK);

--- 10 unchanged lines hidden (view full) ---

11289
11290 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11291 return (1);
11292 }
11293
11294 if (!rpip) {
11295 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11296 "rpi_pause_notify: No RPI provided.");
14332 return (1);
14333 }
14334
14335 mutex_enter(&EMLXS_FCF_LOCK);
14336
14337 rval = emlxs_rpi_free(port, rpip);
14338
14339 mutex_exit(&EMLXS_FCF_LOCK);

--- 10 unchanged lines hidden (view full) ---

14350
14351 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14352 return (1);
14353 }
14354
14355 if (!rpip) {
14356 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14357 "rpi_pause_notify: No RPI provided.");
11297
11298 return (1);
11299 }
11300
11301 /* Fabric RPI will be handled automatically */
14358 return (1);
14359 }
14360
14361 /* Fabric RPI will be handled automatically */
11302 if (rpip->did == FABRIC_DID) {
14362 if (rpip->RPI == FABRIC_RPI) {
11303 return (1);
11304 }
11305
11306 mutex_enter(&EMLXS_FCF_LOCK);
11307
14363 return (1);
14364 }
14365
14366 mutex_enter(&EMLXS_FCF_LOCK);
14367
11308 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11309 "rpi_pause_notify:%d %s. Pausing.",
14368 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14369 "rpi_pause_notify:%d %s. Pausing RPI. >",
11310 rpip->RPI,
11311 emlxs_rpi_state_xlate(rpip->state));
11312
11313 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_PAUSE, rpip);
11314
11315 mutex_exit(&EMLXS_FCF_LOCK);
11316
11317 return (0);
11318
11319} /* emlxs_rpi_pause_notify() */
11320
11321
11322extern uint32_t
11323emlxs_rpi_online_notify(emlxs_port_t *port, RPIobj_t *rpip, uint32_t did,
11324 SERV_PARM *sparam, void *arg1, void *arg2, void *arg3)
11325{
11326 emlxs_hba_t *hba = HBA;
11327 emlxs_deferred_cmpl_t *cmpl;
11328 uint32_t allocated = 0;
14370 rpip->RPI,
14371 emlxs_rpi_state_xlate(rpip->state));
14372
14373 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_PAUSE, rpip);
14374
14375 mutex_exit(&EMLXS_FCF_LOCK);
14376
14377 return (0);
14378
14379} /* emlxs_rpi_pause_notify() */
14380
14381
14382extern uint32_t
14383emlxs_rpi_online_notify(emlxs_port_t *port, RPIobj_t *rpip, uint32_t did,
14384 SERV_PARM *sparam, void *arg1, void *arg2, void *arg3)
14385{
14386 emlxs_hba_t *hba = HBA;
14387 emlxs_deferred_cmpl_t *cmpl;
14388 uint32_t allocated = 0;
14389 uint32_t rval = 0;
11329
11330 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11331 return (1);
11332 }
11333
14390
14391 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14392 return (1);
14393 }
14394
11334 /* Fabric RPI will be handled automatically */
11335 if (did == FABRIC_DID) {
14395 if ((did == port->did) && (!(hba->flag & FC_LOOPBACK_MODE))) {
14396 /* We never register our local port */
11336 return (1);
11337 }
11338
11339 mutex_enter(&EMLXS_FCF_LOCK);
11340
14397 return (1);
14398 }
14399
14400 mutex_enter(&EMLXS_FCF_LOCK);
14401
11341 if (!(port->VPIobj.flag & EMLXS_VPI_PORT_ENABLED)) {
11342 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11343 "rpi_online_notify: vpi=%d. Port disabled.",
11344 port->VPIobj.VPI);
11345
11346 mutex_exit(&EMLXS_FCF_LOCK);
11347 return (1);
14402 if (!rpip && (did == FABRIC_DID)) {
14403 /* We never online the Fabric DID other */
14404 /* than the fabric_rpip */
14405 rpip = port->vpip->fabric_rpip;
11348 }
11349
11350 if (!rpip) {
11351 rpip = emlxs_rpi_find_did(port, did);
11352 }
11353
11354 if (!rpip) {
11355 rpip = emlxs_rpi_alloc(port, did);

--- 16 unchanged lines hidden (view full) ---

11372 cmpl = (emlxs_deferred_cmpl_t *)kmem_zalloc(
11373 sizeof (emlxs_deferred_cmpl_t), KM_SLEEP);
11374
11375 cmpl->port = port;
11376 cmpl->arg1 = arg1;
11377 cmpl->arg2 = arg2;
11378 cmpl->arg3 = arg3;
11379
14406 }
14407
14408 if (!rpip) {
14409 rpip = emlxs_rpi_find_did(port, did);
14410 }
14411
14412 if (!rpip) {
14413 rpip = emlxs_rpi_alloc(port, did);

--- 16 unchanged lines hidden (view full) ---

14430 cmpl = (emlxs_deferred_cmpl_t *)kmem_zalloc(
14431 sizeof (emlxs_deferred_cmpl_t), KM_SLEEP);
14432
14433 cmpl->port = port;
14434 cmpl->arg1 = arg1;
14435 cmpl->arg2 = arg2;
14436 cmpl->arg3 = arg3;
14437
14438 /* For safety */
14439 if (rpip->cmpl) {
14440 emlxs_rpi_deferred_cmpl(port, rpip, 1);
14441 }
14442
11380 rpip->cmpl = cmpl;
11381 }
11382
14443 rpip->cmpl = cmpl;
14444 }
14445
14446 if ((rpip->RPI == FABRIC_RPI) ||
14447 (hba->flag & FC_PT_TO_PT)) {
14448 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14449 "rpi_online_notify:%d %s. %s. Login cmpl.",
14450 rpip->RPI,
14451 emlxs_rpi_state_xlate(rpip->state),
14452 ((allocated)? "Allocated":"Updated"));
14453
14454 rval = emlxs_vpi_logi_cmpl_notify(port, rpip);
14455
14456 if (rval && rpip->cmpl) {
14457 kmem_free(rpip->cmpl, sizeof (emlxs_deferred_cmpl_t));
14458 rpip->cmpl = 0;
14459 }
14460
14461 mutex_exit(&EMLXS_FCF_LOCK);
14462 return (rval);
14463 }
14464
11383 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14465 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11384 "rpi_online_notify:%d %s. %s. Onlining.",
14466 "rpi_online_notify:%d %s. %s. Onlining RPI. >",
11385 rpip->RPI,
11386 emlxs_rpi_state_xlate(rpip->state),
11387 ((allocated)? "Allocated":"Updated"));
11388
11389 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_ONLINE, rpip);
11390
11391 if (rpip->cmpl) {
11392 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 4 unchanged lines hidden (view full) ---

11397 kmem_free(rpip->cmpl, sizeof (emlxs_deferred_cmpl_t));
11398 rpip->cmpl = 0;
11399
11400 mutex_exit(&EMLXS_FCF_LOCK);
11401 return (1);
11402 }
11403
11404 mutex_exit(&EMLXS_FCF_LOCK);
14467 rpip->RPI,
14468 emlxs_rpi_state_xlate(rpip->state),
14469 ((allocated)? "Allocated":"Updated"));
14470
14471 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_ONLINE, rpip);
14472
14473 if (rpip->cmpl) {
14474 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,

--- 4 unchanged lines hidden (view full) ---

14479 kmem_free(rpip->cmpl, sizeof (emlxs_deferred_cmpl_t));
14480 rpip->cmpl = 0;
14481
14482 mutex_exit(&EMLXS_FCF_LOCK);
14483 return (1);
14484 }
14485
14486 mutex_exit(&EMLXS_FCF_LOCK);
11405
11406 return (0);
11407
11408} /* emlxs_rpi_online_notify() */
11409
11410
11411extern uint32_t
11412emlxs_rpi_offline_notify(emlxs_port_t *port, RPIobj_t *rpip,
11413 void *arg1, void *arg2, void *arg3)
11414{
11415 emlxs_hba_t *hba = HBA;
11416 emlxs_deferred_cmpl_t *cmpl;
11417
11418 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11419 return (1);
11420 }
11421
11422 if (!rpip) {
11423 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11424 "rpi_offline_notify: No RPI provided.");
14487 return (0);
14488
14489} /* emlxs_rpi_online_notify() */
14490
14491
14492extern uint32_t
14493emlxs_rpi_offline_notify(emlxs_port_t *port, RPIobj_t *rpip,
14494 void *arg1, void *arg2, void *arg3)
14495{
14496 emlxs_hba_t *hba = HBA;
14497 emlxs_deferred_cmpl_t *cmpl;
14498
14499 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14500 return (1);
14501 }
14502
14503 if (!rpip) {
14504 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14505 "rpi_offline_notify: No RPI provided.");
11425
11426 return (1);
11427 }
11428
11429 /* Fabric RPI will be handled automatically */
14506 return (1);
14507 }
14508
14509 /* Fabric RPI will be handled automatically */
11430 if (rpip->did == FABRIC_DID) {
14510 if (rpip->RPI == FABRIC_RPI) {
11431 return (1);
11432 }
11433
11434 mutex_enter(&EMLXS_FCF_LOCK);
11435
11436 if (arg1 || arg2 || arg3) {
11437 cmpl = (emlxs_deferred_cmpl_t *)kmem_zalloc(
11438 sizeof (emlxs_deferred_cmpl_t), KM_SLEEP);
11439
11440 cmpl->port = port;
11441 cmpl->arg1 = arg1;
11442 cmpl->arg2 = arg2;
11443 cmpl->arg3 = arg3;
11444
11445 rpip->cmpl = cmpl;
11446 }
11447
11448 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14511 return (1);
14512 }
14513
14514 mutex_enter(&EMLXS_FCF_LOCK);
14515
14516 if (arg1 || arg2 || arg3) {
14517 cmpl = (emlxs_deferred_cmpl_t *)kmem_zalloc(
14518 sizeof (emlxs_deferred_cmpl_t), KM_SLEEP);
14519
14520 cmpl->port = port;
14521 cmpl->arg1 = arg1;
14522 cmpl->arg2 = arg2;
14523 cmpl->arg3 = arg3;
14524
14525 rpip->cmpl = cmpl;
14526 }
14527
14528 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11449 "rpi_offline_notify:%d %s. Offlining.",
14529 "rpi_offline_notify:%d %s. Offlining RPI. >",
11450 rpip->RPI,
11451 emlxs_rpi_state_xlate(rpip->state));
11452
11453 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE, rpip);
11454
11455 if (rpip->cmpl) {
11456 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11457 "rpi_offline_notify:%d %s. Deferred args not completed.",

--- 22 unchanged lines hidden (view full) ---

11480
11481 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
11482 return (1);
11483 }
11484
11485 if (!rpip) {
11486 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11487 "rpi_resume_notify: No RPI provided.");
14530 rpip->RPI,
14531 emlxs_rpi_state_xlate(rpip->state));
14532
14533 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_OFFLINE, rpip);
14534
14535 if (rpip->cmpl) {
14536 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14537 "rpi_offline_notify:%d %s. Deferred args not completed.",

--- 22 unchanged lines hidden (view full) ---

14560
14561 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
14562 return (1);
14563 }
14564
14565 if (!rpip) {
14566 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14567 "rpi_resume_notify: No RPI provided.");
11488
11489 return (1);
11490 }
11491
11492 /* Fabric RPI will be handled automatically */
14568 return (1);
14569 }
14570
14571 /* Fabric RPI will be handled automatically */
11493 if (rpip->did == FABRIC_DID) {
14572 if (rpip->RPI == FABRIC_RPI) {
11494 return (1);
11495 }
11496
11497 mutex_enter(&EMLXS_FCF_LOCK);
11498
11499 if (rpip->state != RPI_STATE_PAUSED) {
11500 mutex_exit(&EMLXS_FCF_LOCK);
11501 return (1);

--- 7 unchanged lines hidden (view full) ---

11509 cmpl->arg1 = (void *)sbp;
11510 cmpl->arg2 = 0;
11511 cmpl->arg3 = 0;
11512
11513 rpip->cmpl = cmpl;
11514 }
11515
11516 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14573 return (1);
14574 }
14575
14576 mutex_enter(&EMLXS_FCF_LOCK);
14577
14578 if (rpip->state != RPI_STATE_PAUSED) {
14579 mutex_exit(&EMLXS_FCF_LOCK);
14580 return (1);

--- 7 unchanged lines hidden (view full) ---

14588 cmpl->arg1 = (void *)sbp;
14589 cmpl->arg2 = 0;
14590 cmpl->arg3 = 0;
14591
14592 rpip->cmpl = cmpl;
14593 }
14594
14595 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11517 "rpi_resume_notify:%d %s. Resuming.",
14596 "rpi_resume_notify:%d %s. Resuming RPI. >",
11518 rpip->RPI,
11519 emlxs_rpi_state_xlate(rpip->state));
11520
11521 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_RESUME, rpip);
11522
11523 if (rpip->cmpl) {
11524 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11525 "rpi_resume_notify:%d %s. Deferred args not completed.",

--- 21 unchanged lines hidden (view full) ---

11547{
11548 emlxs_hba_t *hba = HBA;
11549 XRIobj_t *xrip;
11550 XRIobj_t *next_xrip;
11551
11552 if (rpip->state != RPI_STATE_FREE) {
11553 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11554 "rpi_free_action:%d %s:%s arg=%p. "
14597 rpip->RPI,
14598 emlxs_rpi_state_xlate(rpip->state));
14599
14600 (void) emlxs_rpi_event(port, FCF_EVENT_RPI_RESUME, rpip);
14601
14602 if (rpip->cmpl) {
14603 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14604 "rpi_resume_notify:%d %s. Deferred args not completed.",

--- 21 unchanged lines hidden (view full) ---

14626{
14627 emlxs_hba_t *hba = HBA;
14628 XRIobj_t *xrip;
14629 XRIobj_t *next_xrip;
14630
14631 if (rpip->state != RPI_STATE_FREE) {
14632 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14633 "rpi_free_action:%d %s:%s arg=%p. "
11555 "Invalid state. Terminated.",
14634 "Invalid state. <",
11556 rpip->RPI,
11557 emlxs_rpi_state_xlate(rpip->state),
11558 emlxs_fcf_event_xlate(evt), arg1);
11559 return (1);
11560 }
11561
14635 rpip->RPI,
14636 emlxs_rpi_state_xlate(rpip->state),
14637 emlxs_fcf_event_xlate(evt), arg1);
14638 return (1);
14639 }
14640
11562 if (rpip->did == FABRIC_DID) {
11563 if (rpip->vpip->flogi_sbp) {
11564 emlxs_vpi_flogi_cmpl(port, rpip->vpip, 1);
11565 }
14641 if (rpip->cmpl) {
14642 emlxs_rpi_deferred_cmpl(port, rpip, 1);
11566 }
11567
14643 }
14644
14645 if (rpip->vpip->p2p_rpip == rpip) {
14646 rpip->vpip->p2p_rpip = NULL;
14647 }
14648
11568 /* Break node/RPI binding */
11569 rw_enter(&port->node_rwlock, RW_WRITER);
11570 if (rpip->node) {
11571 rpip->node->rpip = NULL;
11572 rpip->node = NULL;
11573 }
11574 rw_exit(&port->node_rwlock);
11575

--- 5 unchanged lines hidden (view full) ---

11581 if (xrip->rpip == rpip) {
11582 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11583 "rpi_free_action:%d xri_count=%d. "
11584 "Removing XRI:%d iotag:%d.",
11585 rpip->RPI,
11586 rpip->xri_count,
11587 xrip->XRI, xrip->iotag);
11588
14649 /* Break node/RPI binding */
14650 rw_enter(&port->node_rwlock, RW_WRITER);
14651 if (rpip->node) {
14652 rpip->node->rpip = NULL;
14653 rpip->node = NULL;
14654 }
14655 rw_exit(&port->node_rwlock);
14656

--- 5 unchanged lines hidden (view full) ---

14662 if (xrip->rpip == rpip) {
14663 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14664 "rpi_free_action:%d xri_count=%d. "
14665 "Removing XRI:%d iotag:%d.",
14666 rpip->RPI,
14667 rpip->xri_count,
14668 xrip->XRI, xrip->iotag);
14669
11589 xrip->rpip->xri_count--;
14670 rpip->xri_count--;
11590 xrip->rpip = NULL;
11591 }
14671 xrip->rpip = NULL;
14672 }
14673
14674 if (xrip->reserved_rpip == rpip) {
14675 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14676 "rpi_free_action:%d xri_count=%d. "
14677 "Removing XRI:%d iotag:%d.",
14678 rpip->RPI,
14679 rpip->xri_count,
14680 xrip->XRI, xrip->iotag);
14681
14682 rpip->xri_count--;
14683 xrip->reserved_rpip = NULL;
14684 }
14685
11592 xrip = next_xrip;
11593 }
11594 mutex_exit(&EMLXS_FCTAB_LOCK);
11595
11596 if (rpip->xri_count) {
11597 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11598 "rpi_free_action:%d. xri_count=%d",
11599 rpip->RPI,
11600 rpip->xri_count);
11601 }
11602
11603 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14686 xrip = next_xrip;
14687 }
14688 mutex_exit(&EMLXS_FCTAB_LOCK);
14689
14690 if (rpip->xri_count) {
14691 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14692 "rpi_free_action:%d. xri_count=%d",
14693 rpip->RPI,
14694 rpip->xri_count);
14695 }
14696
14697 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11604 "rpi_free_action:%d flag=%x. RPI freed.",
14698 "rpi_free_action:%d flag=%x. RPI freed. <",
11605 rpip->RPI,
11606 rpip->flag);
11607
11608 rpip->flag = 0;
11609
11610 return (0);
11611
11612} /* emlxs_rpi_free_action() */

--- 4 unchanged lines hidden (view full) ---

11617emlxs_rpi_online_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11618 void *arg1)
11619{
11620 uint32_t rval = 1;
11621
11622 if (evt != FCF_EVENT_RPI_ONLINE) {
11623 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11624 "rpi_online_evt_action:%d %s:%s arg=%p. "
14699 rpip->RPI,
14700 rpip->flag);
14701
14702 rpip->flag = 0;
14703
14704 return (0);
14705
14706} /* emlxs_rpi_free_action() */

--- 4 unchanged lines hidden (view full) ---

14711emlxs_rpi_online_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14712 void *arg1)
14713{
14714 uint32_t rval = 1;
14715
14716 if (evt != FCF_EVENT_RPI_ONLINE) {
14717 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14718 "rpi_online_evt_action:%d %s:%s arg=%p. "
11625 "Invalid event type. Terminated.",
14719 "Invalid event type. <",
11626 rpip->RPI,
11627 emlxs_rpi_state_xlate(rpip->state),
11628 emlxs_fcf_event_xlate(evt), arg1);
11629 return (1);
11630 }
11631
11632 switch (rpip->state) {
11633 case RPI_STATE_REG:

--- 27 unchanged lines hidden (view full) ---

11661emlxs_rpi_offline_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11662 void *arg1)
11663{
11664 uint32_t rval = 1;
11665
11666 if (evt != FCF_EVENT_RPI_OFFLINE) {
11667 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11668 "rpi_offline_evt_action:%d %s:%s arg=%p. "
14720 rpip->RPI,
14721 emlxs_rpi_state_xlate(rpip->state),
14722 emlxs_fcf_event_xlate(evt), arg1);
14723 return (1);
14724 }
14725
14726 switch (rpip->state) {
14727 case RPI_STATE_REG:

--- 27 unchanged lines hidden (view full) ---

14755emlxs_rpi_offline_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14756 void *arg1)
14757{
14758 uint32_t rval = 1;
14759
14760 if (evt != FCF_EVENT_RPI_OFFLINE) {
14761 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14762 "rpi_offline_evt_action:%d %s:%s arg=%p. "
11669 "Invalid event type. Terminated.",
14763 "Invalid event type. <",
11670 rpip->RPI,
11671 emlxs_rpi_state_xlate(rpip->state),
11672 emlxs_fcf_event_xlate(evt), arg1);
11673 return (1);
11674 }
11675
11676 switch (rpip->state) {
14764 rpip->RPI,
14765 emlxs_rpi_state_xlate(rpip->state),
14766 emlxs_fcf_event_xlate(evt), arg1);
14767 return (1);
14768 }
14769
14770 switch (rpip->state) {
11677 case RPI_STATE_OFFLINE:
14771 case RPI_STATE_RESERVED:
11678 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14772 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11679 "rpi_offline_evt_action:%d flag=%x. Offlining RPI.",
14773 "rpi_offline_evt_action:%d flag=%x. Freeing RPI.",
11680 rpip->RPI,
11681 rpip->flag);
11682
14774 rpip->RPI,
14775 rpip->flag);
14776
11683 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
11684 FCF_REASON_REENTER, evt, arg1);
14777 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE,
14778 FCF_REASON_EVENT, evt, arg1);
11685 break;
11686
11687 case RPI_STATE_UNREG:
11688 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14779 break;
14780
14781 case RPI_STATE_UNREG:
14782 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11689 "rpi_offline_evt_action:%d flag=%x. Already unregistering. "
11690 "Terminated.",
14783 "rpi_offline_evt_action:%d flag=%x. "
14784 "Already unregistering. <",
11691 rpip->RPI,
11692 rpip->flag);
11693
11694 break;
11695
11696 default:
11697 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11698 "rpi_offline_evt_action:%d flag=%x. Unregistering.",

--- 11 unchanged lines hidden (view full) ---

11710} /* emlxs_rpi_offline_evt_action() */
11711
11712
11713/*ARGSUSED*/
11714static uint32_t
11715emlxs_rpi_pause_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11716 void *arg1)
11717{
14785 rpip->RPI,
14786 rpip->flag);
14787
14788 break;
14789
14790 default:
14791 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14792 "rpi_offline_evt_action:%d flag=%x. Unregistering.",

--- 11 unchanged lines hidden (view full) ---

14804} /* emlxs_rpi_offline_evt_action() */
14805
14806
14807/*ARGSUSED*/
14808static uint32_t
14809emlxs_rpi_pause_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14810 void *arg1)
14811{
14812 VPIobj_t *vpip;
11718 uint32_t rval = 1;
11719
14813 uint32_t rval = 1;
14814
14815 vpip = rpip->vpip;
14816
11720 if (evt != FCF_EVENT_RPI_PAUSE) {
11721 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11722 "rpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
14817 if (evt != FCF_EVENT_RPI_PAUSE) {
14818 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14819 "rpi_pause_evt_action:%d %s:%s arg=%p flag=%x. "
11723 "Invalid event type. Terminated.",
14820 "Invalid event type. <",
11724 rpip->RPI,
11725 emlxs_rpi_state_xlate(rpip->state),
11726 emlxs_fcf_event_xlate(evt), arg1,
11727 rpip->flag);
11728 return (1);
11729 }
11730
11731 switch (rpip->state) {
14821 rpip->RPI,
14822 emlxs_rpi_state_xlate(rpip->state),
14823 emlxs_fcf_event_xlate(evt), arg1,
14824 rpip->flag);
14825 return (1);
14826 }
14827
14828 switch (rpip->state) {
11732 case RPI_STATE_OFFLINE:
14829 case RPI_STATE_RESERVED:
11733 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14830 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11734 "rpi_pause_evt_action:%d flag=%x. Offlining RPI.",
14831 "rpi_pause_evt_action:%d flag=%x. Freeing RPI.",
11735 rpip->RPI,
11736 rpip->flag);
11737
14832 rpip->RPI,
14833 rpip->flag);
14834
11738 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
11739 FCF_REASON_REENTER, evt, arg1);
14835 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE,
14836 FCF_REASON_EVENT, evt, arg1);
11740 break;
11741
11742 case RPI_STATE_UNREG:
11743 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14837 break;
14838
14839 case RPI_STATE_UNREG:
14840 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11744 "rpi_pause_evt_action:%d flag=%x. Not online. "
11745 "Terminated.",
14841 "rpi_pause_evt_action:%d flag=%x. Not online. <",
11746 rpip->RPI,
11747 rpip->flag);
11748
11749 break;
11750
11751 case RPI_STATE_PAUSED:
11752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14842 rpip->RPI,
14843 rpip->flag);
14844
14845 break;
14846
14847 case RPI_STATE_PAUSED:
14848 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11753 "rpi_pause_evt_action:%d flag=%x. Already paused. "
11754 "Terminated.",
14849 "rpi_pause_evt_action:%d flag=%x. Already paused. <",
11755 rpip->RPI,
11756 rpip->flag);
11757
11758 break;
11759
11760 case RPI_STATE_REG:
11761 case RPI_STATE_ONLINE:
11762 case RPI_STATE_RESUME:
11763 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11764 "rpi_pause_evt_action:%d flag=%x. Pausing.",
11765 rpip->RPI,
11766 rpip->flag);
11767
14850 rpip->RPI,
14851 rpip->flag);
14852
14853 break;
14854
14855 case RPI_STATE_REG:
14856 case RPI_STATE_ONLINE:
14857 case RPI_STATE_RESUME:
14858 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14859 "rpi_pause_evt_action:%d flag=%x. Pausing.",
14860 rpip->RPI,
14861 rpip->flag);
14862
14863 /* Don't pause an RPI, if the VPI is not pausing too */
14864 if (!(vpip->flag & EMLXS_VPI_PAUSE_REQ)) {
14865 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14866 "rpi_pause_evt_action:%d rpi_online=%d,%d "
14867 "xri_count=%d. VPI:%d pause not requested. "
14868 "Unregistering.", rpip->RPI,
14869 vpip->rpi_online, vpip->rpi_paused,
14870 rpip->xri_count, vpip->VPI);
14871
14872 rval = emlxs_rpi_state(port, rpip, RPI_STATE_UNREG,
14873 FCF_REASON_EVENT, evt, arg1);
14874 break;
14875 }
14876
11768 rval = emlxs_rpi_state(port, rpip, RPI_STATE_PAUSED,
11769 FCF_REASON_EVENT, evt, arg1);
11770 break;
11771
11772 default:
11773 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14877 rval = emlxs_rpi_state(port, rpip, RPI_STATE_PAUSED,
14878 FCF_REASON_EVENT, evt, arg1);
14879 break;
14880
14881 default:
14882 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11774 "rpi_pause_evt_action:%d flag=%x. Terminated.",
14883 "rpi_pause_evt_action:%d flag=%x. <",
11775 rpip->RPI,
11776 rpip->flag);
11777 break;
11778 }
11779
11780 return (rval);
11781
11782} /* emlxs_rpi_pause_evt_action() */

--- 4 unchanged lines hidden (view full) ---

11787emlxs_rpi_resume_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11788 void *arg1)
11789{
11790 uint32_t rval = 1;
11791
11792 if (evt != FCF_EVENT_RPI_RESUME) {
11793 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11794 "rpi_resume_evt_action:%d %s:%s arg=%p flag=%x. "
14884 rpip->RPI,
14885 rpip->flag);
14886 break;
14887 }
14888
14889 return (rval);
14890
14891} /* emlxs_rpi_pause_evt_action() */

--- 4 unchanged lines hidden (view full) ---

14896emlxs_rpi_resume_evt_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14897 void *arg1)
14898{
14899 uint32_t rval = 1;
14900
14901 if (evt != FCF_EVENT_RPI_RESUME) {
14902 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
14903 "rpi_resume_evt_action:%d %s:%s arg=%p flag=%x. "
11795 "Invalid event type. Terminated.",
14904 "Invalid event type. <",
11796 rpip->RPI,
11797 emlxs_rpi_state_xlate(rpip->state),
11798 emlxs_fcf_event_xlate(evt), arg1,
11799 rpip->flag);
11800 return (1);
11801 }
11802
11803 switch (rpip->state) {

--- 4 unchanged lines hidden (view full) ---

11808 rpip->flag);
11809
11810 rval = emlxs_rpi_state(port, rpip, RPI_STATE_RESUME,
11811 FCF_REASON_EVENT, evt, arg1);
11812 break;
11813
11814 default:
11815 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14905 rpip->RPI,
14906 emlxs_rpi_state_xlate(rpip->state),
14907 emlxs_fcf_event_xlate(evt), arg1,
14908 rpip->flag);
14909 return (1);
14910 }
14911
14912 switch (rpip->state) {

--- 4 unchanged lines hidden (view full) ---

14917 rpip->flag);
14918
14919 rval = emlxs_rpi_state(port, rpip, RPI_STATE_RESUME,
14920 FCF_REASON_EVENT, evt, arg1);
14921 break;
14922
14923 default:
14924 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11816 "rpi_resume_evt_action:%d flag=%x. Not paused. Terminated.",
14925 "rpi_resume_evt_action:%d flag=%x. Not paused. <",
11817 rpip->RPI,
11818 rpip->flag);
11819 break;
11820 }
11821
11822 return (rval);
11823
11824} /* emlxs_rpi_resume_evt_action() */
11825
11826
11827/*ARGSUSED*/
11828static uint32_t
14926 rpip->RPI,
14927 rpip->flag);
14928 break;
14929 }
14930
14931 return (rval);
14932
14933} /* emlxs_rpi_resume_evt_action() */
14934
14935
14936/*ARGSUSED*/
14937static uint32_t
11829emlxs_rpi_offline_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14938emlxs_rpi_reserved_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11830 void *arg1)
11831{
14939 void *arg1)
14940{
11832 uint32_t rval;
11833 VPIobj_t *vpip;
11834
11835 vpip = rpip->vpip;
11836
14941 VPIobj_t *vpip;
14942
14943 vpip = rpip->vpip;
14944
11837 if (rpip->state != RPI_STATE_OFFLINE) {
14945 if (rpip->state != RPI_STATE_RESERVED) {
11838 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14946 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11839 "rpi_offline_action:%d %s:%s arg=%p. "
11840 "Invalid state. Terminated.",
14947 "rpi_reserved_action:%d %s:%s arg=%p. "
14948 "Invalid state. <",
11841 rpip->RPI,
11842 emlxs_rpi_state_xlate(rpip->state),
11843 emlxs_fcf_event_xlate(evt), arg1);
11844 return (1);
11845 }
11846
14949 rpip->RPI,
14950 emlxs_rpi_state_xlate(rpip->state),
14951 emlxs_fcf_event_xlate(evt), arg1);
14952 return (1);
14953 }
14954
11847 if (rpip->prev_state == RPI_STATE_FREE) {
14955 if (rpip->prev_state != RPI_STATE_FREE) {
11848 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14956 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11849 "rpi_offline_action:%d rpi_online=%d,%d. Terminated.",
14957 "rpi_reserved_action:%d %s:%s arg=%p. "
14958 "Invalid previous state. %s <",
11850 rpip->RPI,
14959 rpip->RPI,
11851 vpip->rpi_online, vpip->rpi_paused);
14960 emlxs_rpi_state_xlate(rpip->state),
14961 emlxs_fcf_event_xlate(evt), arg1,
14962 emlxs_rpi_state_xlate(rpip->prev_state));
11852
14963
11853 return (0);
14964 return (1);
11854 }
11855
14965 }
14966
14967 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14968 "rpi_reserved_action:%d rpi_online=%d,%d. <",
14969 rpip->RPI,
14970 vpip->rpi_online, vpip->rpi_paused);
14971
14972 return (0);
14973
14974} /* emlxs_rpi_reserved_action() */
14975
14976
14977/*ARGSUSED*/
14978static uint32_t
14979emlxs_rpi_offline_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
14980 void *arg1)
14981{
14982 uint32_t rval = 0;
14983 VPIobj_t *vpip;
14984
14985 vpip = rpip->vpip;
14986
14987 if (rpip->state != RPI_STATE_OFFLINE) {
14988 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
14989 "rpi_offline_action:%d %s:%s arg=%p. "
14990 "Invalid state. <",
14991 rpip->RPI,
14992 emlxs_rpi_state_xlate(rpip->state),
14993 emlxs_fcf_event_xlate(evt), arg1);
14994 return (1);
14995 }
14996
11856 if (rpip->flag & EMLXS_RPI_PAUSED) {
11857 rpip->flag &= ~EMLXS_RPI_PAUSED;
11858
11859 if (vpip->rpi_paused) {
11860 vpip->rpi_paused--;
11861 }
11862 }
11863

--- 5 unchanged lines hidden (view full) ---

11869 }
11870
11871 /* Added protection */
11872 if (vpip->rpi_online < vpip->rpi_paused) {
11873 vpip->rpi_paused = vpip->rpi_online;
11874 }
11875 }
11876
14997 if (rpip->flag & EMLXS_RPI_PAUSED) {
14998 rpip->flag &= ~EMLXS_RPI_PAUSED;
14999
15000 if (vpip->rpi_paused) {
15001 vpip->rpi_paused--;
15002 }
15003 }
15004

--- 5 unchanged lines hidden (view full) ---

15010 }
15011
15012 /* Added protection */
15013 if (vpip->rpi_online < vpip->rpi_paused) {
15014 vpip->rpi_paused = vpip->rpi_online;
15015 }
15016 }
15017
11877 if (rpip->did == FABRIC_DID) {
15018 if (rpip->RPI == FABRIC_RPI) {
11878 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11879 "rpi_offline_action:%d rpi_online=%d,%d xri_count=%d. "
11880 "Fabric RPI offline. Freeing.",
11881 rpip->RPI,
11882 vpip->rpi_online, vpip->rpi_paused,
11883 rpip->xri_count);
11884
11885 /* Free RPI */
11886 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE, 0, 0, 0);
11887
11888 return (rval);
11889 }
11890
11891 if ((vpip->rpi_online == 0) ||
11892 (vpip->rpi_online == vpip->rpi_paused)) {
11893 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11894 "rpi_offline_action:%d rpi_online=%d,%d xri_count=%d. "
11895 "RPI offline. "
15019 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15020 "rpi_offline_action:%d rpi_online=%d,%d xri_count=%d. "
15021 "Fabric RPI offline. Freeing.",
15022 rpip->RPI,
15023 vpip->rpi_online, vpip->rpi_paused,
15024 rpip->xri_count);
15025
15026 /* Free RPI */
15027 rval = emlxs_rpi_state(port, rpip, RPI_STATE_FREE, 0, 0, 0);
15028
15029 return (rval);
15030 }
15031
15032 if ((vpip->rpi_online == 0) ||
15033 (vpip->rpi_online == vpip->rpi_paused)) {
15034 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15035 "rpi_offline_action:%d rpi_online=%d,%d xri_count=%d. "
15036 "RPI offline. "
11896 "Notifying VPI:%d",
15037 "Notifying VPI:%d >",
11897 rpip->RPI,
11898 vpip->rpi_online, vpip->rpi_paused,
11899 rpip->xri_count,
11900 vpip->VPI);
11901
11902 /* Notify VPI */
11903 (void) emlxs_vpi_event(port, FCF_EVENT_RPI_OFFLINE, rpip);
11904

--- 15 unchanged lines hidden (view full) ---

11920
11921
11922/*ARGSUSED*/
11923static uint32_t
11924emlxs_rpi_paused_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11925 void *arg1)
11926{
11927 VPIobj_t *vpip;
15038 rpip->RPI,
15039 vpip->rpi_online, vpip->rpi_paused,
15040 rpip->xri_count,
15041 vpip->VPI);
15042
15043 /* Notify VPI */
15044 (void) emlxs_vpi_event(port, FCF_EVENT_RPI_OFFLINE, rpip);
15045

--- 15 unchanged lines hidden (view full) ---

15061
15062
15063/*ARGSUSED*/
15064static uint32_t
15065emlxs_rpi_paused_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15066 void *arg1)
15067{
15068 VPIobj_t *vpip;
15069 uint32_t rval = 0;
11928
11929 vpip = rpip->vpip;
11930
11931 if (rpip->state != RPI_STATE_PAUSED) {
11932 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11933 "rpi_paused_action:%d %s:%s arg=%p. "
15070
15071 vpip = rpip->vpip;
15072
15073 if (rpip->state != RPI_STATE_PAUSED) {
15074 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15075 "rpi_paused_action:%d %s:%s arg=%p. "
11934 "Invalid state. Terminated.",
15076 "Invalid state. <",
11935 rpip->RPI,
11936 emlxs_rpi_state_xlate(rpip->state),
11937 emlxs_fcf_event_xlate(evt), arg1);
11938 return (1);
11939 }
11940
15077 rpip->RPI,
15078 emlxs_rpi_state_xlate(rpip->state),
15079 emlxs_fcf_event_xlate(evt), arg1);
15080 return (1);
15081 }
15082
15083 if (!(vpip->flag & EMLXS_VPI_PAUSE_REQ)) {
15084 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15085 "rpi_paused_action:%d rpi_online=%d,%d xri_count=%d. "
15086 "VPI:%d pause not requested. Unregistering.",
15087 rpip->RPI,
15088 vpip->rpi_online, vpip->rpi_paused,
15089 rpip->xri_count,
15090 vpip->VPI);
15091
15092 rval = emlxs_rpi_state(port, rpip, RPI_STATE_UNREG,
15093 FCF_REASON_EVENT, evt, arg1);
15094 return (rval);
15095 }
15096
11941 if (!(rpip->flag & EMLXS_RPI_PAUSED)) {
11942 rpip->flag |= EMLXS_RPI_PAUSED;
11943 vpip->rpi_paused++;
11944 }
11945
11946 /* Check if all RPI's have been paused for a VPI */
11947 if (vpip->rpi_online == vpip->rpi_paused) {
11948 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11949 "rpi_paused_action:%d rpi_online=%d,%d xri_count=%d. "
11950 "RPI paused. "
15097 if (!(rpip->flag & EMLXS_RPI_PAUSED)) {
15098 rpip->flag |= EMLXS_RPI_PAUSED;
15099 vpip->rpi_paused++;
15100 }
15101
15102 /* Check if all RPI's have been paused for a VPI */
15103 if (vpip->rpi_online == vpip->rpi_paused) {
15104 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15105 "rpi_paused_action:%d rpi_online=%d,%d xri_count=%d. "
15106 "RPI paused. "
11951 "Notifying VPI:%d",
15107 "Notifying VPI:%d >",
11952 rpip->RPI,
11953 vpip->rpi_online, vpip->rpi_paused,
11954 rpip->xri_count,
11955 vpip->VPI);
11956
11957 /* Notify VPI */
11958 (void) emlxs_vpi_event(port, FCF_EVENT_RPI_PAUSE, rpip);
11959
11960 } else {
11961 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11962 "rpi_paused_action:%d rpi_online=%d,%d xri_count=%d. "
15108 rpip->RPI,
15109 vpip->rpi_online, vpip->rpi_paused,
15110 rpip->xri_count,
15111 vpip->VPI);
15112
15113 /* Notify VPI */
15114 (void) emlxs_vpi_event(port, FCF_EVENT_RPI_PAUSE, rpip);
15115
15116 } else {
15117 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15118 "rpi_paused_action:%d rpi_online=%d,%d xri_count=%d. "
11963 "RPI paused.",
15119 "RPI paused. <",
11964 rpip->RPI,
11965 vpip->rpi_online, vpip->rpi_paused,
11966 rpip->xri_count);
11967 }
11968
11969 return (0);
11970
11971} /* emlxs_rpi_paused_action() */
11972
11973
11974/*ARGSUSED*/
11975static uint32_t
11976emlxs_rpi_unreg_failed_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
11977 void *arg1)
11978{
15120 rpip->RPI,
15121 vpip->rpi_online, vpip->rpi_paused,
15122 rpip->xri_count);
15123 }
15124
15125 return (0);
15126
15127} /* emlxs_rpi_paused_action() */
15128
15129
15130/*ARGSUSED*/
15131static uint32_t
15132emlxs_rpi_unreg_failed_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15133 void *arg1)
15134{
11979 uint32_t rval;
15135 uint32_t rval = 0;
11980
11981 rpip->attempts++;
11982
11983 if (rpip->state != RPI_STATE_UNREG_FAILED) {
11984 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
11985 "rpi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
15136
15137 rpip->attempts++;
15138
15139 if (rpip->state != RPI_STATE_UNREG_FAILED) {
15140 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15141 "rpi_unreg_failed_action:%d %s:%s arg=%p attempt=%d. "
11986 "Invalid state. Terminated.",
15142 "Invalid state. <",
11987 rpip->RPI,
11988 emlxs_rpi_state_xlate(rpip->state),
11989 emlxs_fcf_event_xlate(evt), arg1,
11990 rpip->attempts);
15143 rpip->RPI,
15144 emlxs_rpi_state_xlate(rpip->state),
15145 emlxs_fcf_event_xlate(evt), arg1,
15146 rpip->attempts);
11991
11992 return (1);
11993 }
11994
11995 if ((rpip->reason == FCF_REASON_SEND_FAILED) ||
11996 !(rpip->flag & EMLXS_RPI_REG)) {
11997
11998 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
11999 "rpi_unreg_failed_action:%d reason=%x flag=%x. "

--- 26 unchanged lines hidden (view full) ---

12026{
12027 emlxs_hba_t *hba = HBA;
12028 VPIobj_t *vpip = rpip->vpip;
12029 emlxs_node_t *node = rpip->node;
12030 XRIobj_t *xrip;
12031 XRIobj_t *next_xrip;
12032
12033 /* Special handling for Fabric RPI */
15147 return (1);
15148 }
15149
15150 if ((rpip->reason == FCF_REASON_SEND_FAILED) ||
15151 !(rpip->flag & EMLXS_RPI_REG)) {
15152
15153 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15154 "rpi_unreg_failed_action:%d reason=%x flag=%x. "

--- 26 unchanged lines hidden (view full) ---

15181{
15182 emlxs_hba_t *hba = HBA;
15183 VPIobj_t *vpip = rpip->vpip;
15184 emlxs_node_t *node = rpip->node;
15185 XRIobj_t *xrip;
15186 XRIobj_t *next_xrip;
15187
15188 /* Special handling for Fabric RPI */
12034 if (rpip->did == FABRIC_DID) {
15189 if (rpip->RPI == FABRIC_RPI) {
12035 if (node) {
12036 (void) emlxs_tx_node_flush(port, node, 0, 0, 0);
12037 (void) emlxs_chipq_node_flush(port, 0, node, 0);
12038 }
12039
12040 /* Clear all reserved XRIs under this RPI */
12041 mutex_enter(&EMLXS_FCTAB_LOCK);
12042 xrip = (XRIobj_t *)hba->sli.sli4.XRIinuse_f;
12043 while (xrip != (XRIobj_t *)&hba->sli.sli4.XRIinuse_f) {
12044 next_xrip = xrip->_f;
15190 if (node) {
15191 (void) emlxs_tx_node_flush(port, node, 0, 0, 0);
15192 (void) emlxs_chipq_node_flush(port, 0, node, 0);
15193 }
15194
15195 /* Clear all reserved XRIs under this RPI */
15196 mutex_enter(&EMLXS_FCTAB_LOCK);
15197 xrip = (XRIobj_t *)hba->sli.sli4.XRIinuse_f;
15198 while (xrip != (XRIobj_t *)&hba->sli.sli4.XRIinuse_f) {
15199 next_xrip = xrip->_f;
15200 /* We don't need to worry about xrip->reserved_rpip */
15201 /* here because the Fabric RPI can never be reserved */
15202 /* by an xri. */
12045 if ((xrip->rpip == rpip) &&
12046 (xrip->flag & EMLXS_XRI_RESERVED)) {
12047 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12048 "rpi_unreg_action:%d xri_count=%d. "
12049 "Unreserving XRI:%d iotag:%d.",
12050 rpip->RPI,
12051 rpip->xri_count,
12052 xrip->XRI, xrip->iotag);
12053
15203 if ((xrip->rpip == rpip) &&
15204 (xrip->flag & EMLXS_XRI_RESERVED)) {
15205 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15206 "rpi_unreg_action:%d xri_count=%d. "
15207 "Unreserving XRI:%d iotag:%d.",
15208 rpip->RPI,
15209 rpip->xri_count,
15210 xrip->XRI, xrip->iotag);
15211
12054 (void) emlxs_sli4_unreserve_xri(hba,
15212 (void) emlxs_sli4_unreserve_xri(port,
12055 xrip->XRI, 0);
12056 }
12057 xrip = next_xrip;
12058 }
12059 mutex_exit(&EMLXS_FCTAB_LOCK);
12060 }
12061
12062 rpip->flag &= ~EMLXS_RPI_REG;

--- 47 unchanged lines hidden (view full) ---

12110
12111 rpip = (RPIobj_t *)mbq->context;
12112
12113 mb4 = (MAILBOX4 *)mbq;
12114
12115 if (rpip->state != RPI_STATE_UNREG) {
12116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12117 "rpi_unreg_mbcmpl:%d state=%s. "
15213 xrip->XRI, 0);
15214 }
15215 xrip = next_xrip;
15216 }
15217 mutex_exit(&EMLXS_FCTAB_LOCK);
15218 }
15219
15220 rpip->flag &= ~EMLXS_RPI_REG;

--- 47 unchanged lines hidden (view full) ---

15268
15269 rpip = (RPIobj_t *)mbq->context;
15270
15271 mb4 = (MAILBOX4 *)mbq;
15272
15273 if (rpip->state != RPI_STATE_UNREG) {
15274 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15275 "rpi_unreg_mbcmpl:%d state=%s. "
12118 "No longer in RPI_STATE_UNREG. Terminated.",
15276 "No longer in RPI_STATE_UNREG.",
12119 rpip->RPI,
12120 emlxs_rpi_state_xlate(rpip->state));
12121
12122 mutex_exit(&EMLXS_FCF_LOCK);
12123 return (0);
12124 }
12125
12126 if (mb4->mbxStatus) {
12127 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15277 rpip->RPI,
15278 emlxs_rpi_state_xlate(rpip->state));
15279
15280 mutex_exit(&EMLXS_FCF_LOCK);
15281 return (0);
15282 }
15283
15284 if (mb4->mbxStatus) {
15285 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12128 "rpi_unreg_mbcmpl:%d failed. status=%x",
15286 "rpi_unreg_mbcmpl:%d failed. %s. >",
12129 rpip->RPI,
15287 rpip->RPI,
12130 mb4->mbxStatus);
15288 emlxs_mb_xlate_status(mb4->mbxStatus));
12131
12132 (void) emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_FAILED,
12133 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
12134
12135 mutex_exit(&EMLXS_FCF_LOCK);
12136 return (0);
12137 }
12138
12139 emlxs_rpi_unreg_handler(port, rpip);
12140
12141 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15289
15290 (void) emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_FAILED,
15291 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
15292
15293 mutex_exit(&EMLXS_FCF_LOCK);
15294 return (0);
15295 }
15296
15297 emlxs_rpi_unreg_handler(port, rpip);
15298
15299 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12142 "rpi_unreg_mbcmpl:%d Unregistered. Unreg cmpl.",
15300 "rpi_unreg_mbcmpl:%d Unregistered. Unreg complete. >",
12143 rpip->RPI);
12144
12145 (void) emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_CMPL,
12146 0, 0, 0);
12147
12148 mutex_exit(&EMLXS_FCF_LOCK);
12149 return (0);
12150
12151} /* emlxs_rpi_unreg_mbcmpl() */
12152
12153
12154/*ARGSUSED*/
12155static uint32_t
12156emlxs_rpi_unreg_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12157 void *arg1)
12158{
12159 emlxs_hba_t *hba = HBA;
12160 MAILBOX4 *mb4;
12161 MAILBOXQ *mbq;
15301 rpip->RPI);
15302
15303 (void) emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_CMPL,
15304 0, 0, 0);
15305
15306 mutex_exit(&EMLXS_FCF_LOCK);
15307 return (0);
15308
15309} /* emlxs_rpi_unreg_mbcmpl() */
15310
15311
15312/*ARGSUSED*/
15313static uint32_t
15314emlxs_rpi_unreg_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15315 void *arg1)
15316{
15317 emlxs_hba_t *hba = HBA;
15318 MAILBOX4 *mb4;
15319 MAILBOXQ *mbq;
12162 uint32_t rval;
15320 uint32_t rval = 0;
12163 VPIobj_t *vpip = rpip->vpip;
12164
12165 if (rpip->state != RPI_STATE_UNREG) {
12166 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12167 "rpi_unreg_action:%d %s:%s arg=%p. "
15321 VPIobj_t *vpip = rpip->vpip;
15322
15323 if (rpip->state != RPI_STATE_UNREG) {
15324 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15325 "rpi_unreg_action:%d %s:%s arg=%p. "
12168 "Invalid state. Terminated.",
15326 "Invalid state. <",
12169 rpip->RPI,
12170 emlxs_rpi_state_xlate(rpip->state),
12171 emlxs_fcf_event_xlate(evt), arg1);
15327 rpip->RPI,
15328 emlxs_rpi_state_xlate(rpip->state),
15329 emlxs_fcf_event_xlate(evt), arg1);
12172
12173 return (1);
12174 }
12175
12176 if (!(rpip->flag & EMLXS_RPI_REG)) {
12177 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12178 "rpi_unreg_action:%d. Not registered. Going offline.",
12179 rpip->RPI);
12180
12181 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
12182 FCF_REASON_EVENT, evt, arg1);
12183
12184 return (rval);
12185 }
12186
12187 if (rpip->prev_state != RPI_STATE_UNREG_FAILED) {
12188 rpip->attempts = 0;
12189 }
12190
15330 return (1);
15331 }
15332
15333 if (!(rpip->flag & EMLXS_RPI_REG)) {
15334 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15335 "rpi_unreg_action:%d. Not registered. Going offline.",
15336 rpip->RPI);
15337
15338 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
15339 FCF_REASON_EVENT, evt, arg1);
15340
15341 return (rval);
15342 }
15343
15344 if (rpip->prev_state != RPI_STATE_UNREG_FAILED) {
15345 rpip->attempts = 0;
15346 }
15347
12191 if (rpip->did == FABRIC_DID) {
15348 if (rpip->RPI == FABRIC_RPI) {
12192 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12193 "rpi_unreg_action:%d did=%x vpi=%d. Fabric RPI. "
12194 "Going offline.",
12195 rpip->RPI,
12196 rpip->did,
12197 rpip->vpip->VPI);
12198
12199 /* Don't send UNREG_RPI, but process it as if we did */
12200 emlxs_rpi_unreg_handler(port, rpip);
12201
12202 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
12203 FCF_REASON_EVENT, evt, arg1);
12204
12205 return (rval);
12206 }
12207
12208 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15349 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15350 "rpi_unreg_action:%d did=%x vpi=%d. Fabric RPI. "
15351 "Going offline.",
15352 rpip->RPI,
15353 rpip->did,
15354 rpip->vpip->VPI);
15355
15356 /* Don't send UNREG_RPI, but process it as if we did */
15357 emlxs_rpi_unreg_handler(port, rpip);
15358
15359 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
15360 FCF_REASON_EVENT, evt, arg1);
15361
15362 return (rval);
15363 }
15364
15365 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12209 "rpi_unreg_action:%d attempts=%d. Sending UNREG_RPI.",
15366 "rpi_unreg_action:%d attempts=%d. Sending UNREG_RPI. <",
12210 rpip->RPI,
12211 rpip->attempts);
12212
15367 rpip->RPI,
15368 rpip->attempts);
15369
12213 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
15370 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
12214
12215 rval = emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_FAILED,
12216 FCF_REASON_NO_MBOX, 0, arg1);
12217
12218 return (rval);
12219 }
12220 mb4 = (MAILBOX4*)mbq;
12221 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);

--- 34 unchanged lines hidden (view full) ---

12256} /* emlxs_rpi_unreg_action() */
12257
12258
12259/*ARGSUSED*/
12260static uint32_t
12261emlxs_rpi_unreg_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12262 void *arg1)
12263{
15371
15372 rval = emlxs_rpi_state(port, rpip, RPI_STATE_UNREG_FAILED,
15373 FCF_REASON_NO_MBOX, 0, arg1);
15374
15375 return (rval);
15376 }
15377 mb4 = (MAILBOX4*)mbq;
15378 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);

--- 34 unchanged lines hidden (view full) ---

15413} /* emlxs_rpi_unreg_action() */
15414
15415
15416/*ARGSUSED*/
15417static uint32_t
15418emlxs_rpi_unreg_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15419 void *arg1)
15420{
12264 uint32_t rval;
15421 uint32_t rval = 0;
12265
12266 if (rpip->state != RPI_STATE_UNREG_CMPL) {
12267 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12268 "rpi_unreg_cmpl_action:%d %s:%s arg=%p. "
15422
15423 if (rpip->state != RPI_STATE_UNREG_CMPL) {
15424 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15425 "rpi_unreg_cmpl_action:%d %s:%s arg=%p. "
12269 "Invalid state. Terminated.",
15426 "Invalid state. <",
12270 rpip->RPI,
12271 emlxs_rpi_state_xlate(rpip->state),
12272 emlxs_fcf_event_xlate(evt), arg1);
12273 return (1);
12274 }
12275
12276 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12277 "rpi_unreg_cmpl_action:%d flag=%x. Going offline.",

--- 8 unchanged lines hidden (view full) ---

12286} /* emlxs_rpi_unreg_cmpl_action() */
12287
12288
12289/*ARGSUSED*/
12290static uint32_t
12291emlxs_rpi_reg_failed_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12292 void *arg1)
12293{
15427 rpip->RPI,
15428 emlxs_rpi_state_xlate(rpip->state),
15429 emlxs_fcf_event_xlate(evt), arg1);
15430 return (1);
15431 }
15432
15433 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15434 "rpi_unreg_cmpl_action:%d flag=%x. Going offline.",

--- 8 unchanged lines hidden (view full) ---

15443} /* emlxs_rpi_unreg_cmpl_action() */
15444
15445
15446/*ARGSUSED*/
15447static uint32_t
15448emlxs_rpi_reg_failed_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15449 void *arg1)
15450{
12294 uint32_t rval;
15451 uint32_t rval = 0;
12295
12296 rpip->attempts++;
12297
12298 if (rpip->state != RPI_STATE_REG_FAILED) {
12299 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12300 "rpi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
15452
15453 rpip->attempts++;
15454
15455 if (rpip->state != RPI_STATE_REG_FAILED) {
15456 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15457 "rpi_reg_failed_action:%d %s:%s arg=%p attempt=%d. "
12301 "Invalid state. Terminated.",
15458 "Invalid state. <",
12302 rpip->RPI,
12303 emlxs_rpi_state_xlate(rpip->state),
12304 emlxs_fcf_event_xlate(evt), arg1,
12305 rpip->attempts);
15459 rpip->RPI,
15460 emlxs_rpi_state_xlate(rpip->state),
15461 emlxs_fcf_event_xlate(evt), arg1,
15462 rpip->attempts);
12306
12307 return (1);
12308 }
12309
12310 if ((rpip->reason == FCF_REASON_SEND_FAILED) ||
12311 !(rpip->flag & EMLXS_RPI_REG)) {
12312 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12313 "rpi_reg_failed_action:%d reason=%x flag=%x. "
12314 "Going offline.",

--- 18 unchanged lines hidden (view full) ---

12333 return (rval);
12334
12335} /* emlxs_rpi_reg_failed_action() */
12336
12337
12338static uint32_t
12339emlxs_rpi_reg_handler(emlxs_port_t *port, RPIobj_t *rpip)
12340{
15463 return (1);
15464 }
15465
15466 if ((rpip->reason == FCF_REASON_SEND_FAILED) ||
15467 !(rpip->flag & EMLXS_RPI_REG)) {
15468 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15469 "rpi_reg_failed_action:%d reason=%x flag=%x. "
15470 "Going offline.",

--- 18 unchanged lines hidden (view full) ---

15489 return (rval);
15490
15491} /* emlxs_rpi_reg_failed_action() */
15492
15493
15494static uint32_t
15495emlxs_rpi_reg_handler(emlxs_port_t *port, RPIobj_t *rpip)
15496{
15497 emlxs_hba_t *hba = HBA;
12341 VPIobj_t *vpip;
12342 emlxs_node_t *node;
12343
12344 vpip = rpip->vpip;
12345
12346 rpip->flag |= EMLXS_RPI_REG;
12347
12348 if (rpip->flag & EMLXS_RPI_PAUSED) {
12349 rpip->flag &= ~EMLXS_RPI_PAUSED;
12350
12351 if (vpip->rpi_paused) {
12352 vpip->rpi_paused--;
12353 }
12354 }
12355
15498 VPIobj_t *vpip;
15499 emlxs_node_t *node;
15500
15501 vpip = rpip->vpip;
15502
15503 rpip->flag |= EMLXS_RPI_REG;
15504
15505 if (rpip->flag & EMLXS_RPI_PAUSED) {
15506 rpip->flag &= ~EMLXS_RPI_PAUSED;
15507
15508 if (vpip->rpi_paused) {
15509 vpip->rpi_paused--;
15510 }
15511 }
15512
12356 if (!(rpip->flag & EMLXS_RPI_VPI) &&
12357 (rpip->did != FABRIC_DID)) {
15513 if (!(rpip->flag & EMLXS_RPI_VPI) && (rpip->RPI != FABRIC_RPI)) {
12358 rpip->flag |= EMLXS_RPI_VPI;
12359 vpip->rpi_online++;
12360 }
12361
15514 rpip->flag |= EMLXS_RPI_VPI;
15515 vpip->rpi_online++;
15516 }
15517
15518 /* If private loop and this is fabric RPI, then exit now */
15519 if (!(hba->flag & FC_FABRIC_ATTACHED) && (rpip->RPI == FABRIC_RPI)) {
15520 return (0);
15521 }
15522
12362 /* Create or update the node */
12363 node = emlxs_node_create(port, rpip->did, rpip->RPI, &rpip->sparam);
12364
12365 if (!node) {
12366 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12367 "rpi_reg_handler:%d. Node create failed. Reg failed.",
12368 rpip->RPI);
12369

--- 8 unchanged lines hidden (view full) ---

12378/*ARGSUSED*/
12379static uint32_t
12380emlxs_rpi_reg_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
12381{
12382 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
12383 MAILBOX4 *mb4;
12384 RPIobj_t *rpip;
12385 emlxs_node_t *node;
15523 /* Create or update the node */
15524 node = emlxs_node_create(port, rpip->did, rpip->RPI, &rpip->sparam);
15525
15526 if (!node) {
15527 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15528 "rpi_reg_handler:%d. Node create failed. Reg failed.",
15529 rpip->RPI);
15530

--- 8 unchanged lines hidden (view full) ---

15539/*ARGSUSED*/
15540static uint32_t
15541emlxs_rpi_reg_mbcmpl(emlxs_hba_t *hba, MAILBOXQ *mbq)
15542{
15543 emlxs_port_t *port = (emlxs_port_t *)mbq->port;
15544 MAILBOX4 *mb4;
15545 RPIobj_t *rpip;
15546 emlxs_node_t *node;
12386 uint32_t rval;
15547 uint32_t rval = 0;
12387
12388 mutex_enter(&EMLXS_FCF_LOCK);
12389
12390 rpip = (RPIobj_t *)mbq->context;
12391 mb4 = (MAILBOX4 *)mbq;
12392
12393 if (rpip->state != RPI_STATE_REG) {
12394 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15548
15549 mutex_enter(&EMLXS_FCF_LOCK);
15550
15551 rpip = (RPIobj_t *)mbq->context;
15552 mb4 = (MAILBOX4 *)mbq;
15553
15554 if (rpip->state != RPI_STATE_REG) {
15555 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12395 "rpi_reg_mbcmpl:%d state=%s. No longer in RPI_STATE_REG. "
12396 "Terminated.",
15556 "rpi_reg_mbcmpl:%d state=%s. No longer in RPI_STATE_REG.",
12397 rpip->RPI,
12398 emlxs_rpi_state_xlate(rpip->state));
12399
12400 mutex_exit(&EMLXS_FCF_LOCK);
12401 return (0);
12402 }
12403
12404 if (mb4->mbxStatus) {
12405 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15557 rpip->RPI,
15558 emlxs_rpi_state_xlate(rpip->state));
15559
15560 mutex_exit(&EMLXS_FCF_LOCK);
15561 return (0);
15562 }
15563
15564 if (mb4->mbxStatus) {
15565 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12406 "rpi_reg_mbcmpl:%d failed. status=%x",
15566 "rpi_reg_mbcmpl:%d failed. %s. >",
12407 rpip->RPI,
15567 rpip->RPI,
12408 mb4->mbxStatus);
15568 emlxs_mb_xlate_status(mb4->mbxStatus));
12409
12410 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
12411 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
12412
12413 mutex_exit(&EMLXS_FCF_LOCK);
12414 return (0);
12415 }
12416
12417 rval = emlxs_rpi_reg_handler(port, rpip);
12418
12419 if (rval) {
15569
15570 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
15571 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, 0);
15572
15573 mutex_exit(&EMLXS_FCF_LOCK);
15574 return (0);
15575 }
15576
15577 rval = emlxs_rpi_reg_handler(port, rpip);
15578
15579 if (rval) {
15580 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15581 "rpi_reg_mbcmpl:%d. Reg failed. >",
15582 rpip->RPI);
15583
12420 mb4->mbxStatus = MBX_FAILURE;
12421
12422 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
12423 rval, 0, 0);
12424
12425 mutex_exit(&EMLXS_FCF_LOCK);
12426 return (0);
12427 }
12428
12429 node = rpip->node;
12430
12431 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15584 mb4->mbxStatus = MBX_FAILURE;
15585
15586 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
15587 rval, 0, 0);
15588
15589 mutex_exit(&EMLXS_FCF_LOCK);
15590 return (0);
15591 }
15592
15593 node = rpip->node;
15594
15595 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12432 "rpi_reg_mbcmpl:%d Registered. Reg cmpl.",
15596 "rpi_reg_mbcmpl:%d Registered. Reg complete. >",
12433 rpip->RPI);
12434
12435 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_CMPL, 0, 0, 0);
12436
12437 mutex_exit(&EMLXS_FCF_LOCK);
12438
12439 /* Needed for FCT trigger in emlxs_mb_deferred_cmpl */
12440 if (mbq->sbp) {

--- 21 unchanged lines hidden (view full) ---

12462static uint32_t
12463emlxs_rpi_reg_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12464 void *arg1)
12465{
12466 emlxs_hba_t *hba = HBA;
12467 MAILBOX4 *mb4;
12468 MAILBOXQ *mbq;
12469 MATCHMAP *mp;
15597 rpip->RPI);
15598
15599 (void) emlxs_rpi_state(port, rpip, RPI_STATE_REG_CMPL, 0, 0, 0);
15600
15601 mutex_exit(&EMLXS_FCF_LOCK);
15602
15603 /* Needed for FCT trigger in emlxs_mb_deferred_cmpl */
15604 if (mbq->sbp) {

--- 21 unchanged lines hidden (view full) ---

15626static uint32_t
15627emlxs_rpi_reg_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15628 void *arg1)
15629{
15630 emlxs_hba_t *hba = HBA;
15631 MAILBOX4 *mb4;
15632 MAILBOXQ *mbq;
15633 MATCHMAP *mp;
12470 uint32_t rval;
15634 uint32_t rval = 0;
12471
12472 if (rpip->state != RPI_STATE_REG) {
12473 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12474 "rpi_reg_action:%d %s:%s arg=%p. "
15635
15636 if (rpip->state != RPI_STATE_REG) {
15637 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15638 "rpi_reg_action:%d %s:%s arg=%p. "
12475 "Invalid state. Terminated.",
15639 "Invalid state. <",
12476 rpip->RPI,
12477 emlxs_rpi_state_xlate(rpip->state),
12478 emlxs_fcf_event_xlate(evt), arg1);
15640 rpip->RPI,
15641 emlxs_rpi_state_xlate(rpip->state),
15642 emlxs_fcf_event_xlate(evt), arg1);
12479
12480 return (1);
12481 }
12482
15643 return (1);
15644 }
15645
12483 if (rpip->did == FABRIC_DID) {
15646 if (rpip->RPI == FABRIC_RPI) {
12484 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12485 "rpi_reg_action:%d did=%x vpi=%d. Fabric RPI. "
12486 "Going online.",
12487 rpip->RPI,
12488 rpip->did,
12489 rpip->vpip->VPI);
12490
12491 /* Don't send REG_RPI, but process it as if we did */

--- 7 unchanged lines hidden (view full) ---

12499 }
12500
12501 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
12502 FCF_REASON_EVENT, evt, arg1);
12503
12504 return (rval);
12505 }
12506
15647 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15648 "rpi_reg_action:%d did=%x vpi=%d. Fabric RPI. "
15649 "Going online.",
15650 rpip->RPI,
15651 rpip->did,
15652 rpip->vpip->VPI);
15653
15654 /* Don't send REG_RPI, but process it as if we did */

--- 7 unchanged lines hidden (view full) ---

15662 }
15663
15664 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
15665 FCF_REASON_EVENT, evt, arg1);
15666
15667 return (rval);
15668 }
15669
12507 if (!(rpip->vpip->flag & EMLXS_VPI_PORT_ENABLED)) {
12508 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12509 "rpi_reg_action:%d did=%x. vpi=%d. Port disabled. "
12510 "Offlining RPI.",
12511 rpip->RPI,
12512 rpip->did,
12513 rpip->vpip->VPI);
12514
12515 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
12516 FCF_REASON_NOT_ALLOWED, evt, arg1);
12517
12518 return (rval);
12519 }
12520
12521 if (rpip->prev_state != RPI_STATE_REG_FAILED) {
12522 rpip->attempts = 0;
12523 }
12524
12525 if (rpip->flag & EMLXS_RPI_REG) {
12526 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15670 if (rpip->prev_state != RPI_STATE_REG_FAILED) {
15671 rpip->attempts = 0;
15672 }
15673
15674 if (rpip->flag & EMLXS_RPI_REG) {
15675 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12527 "rpi_reg_action:%d flag=%x. Already registered. "
12528 "Updating registration.",
12529 rpip->RPI, rpip->flag);
15676 "rpi_reg_action:%d attempts=%d. "
15677 "Updating REG_RPI. <",
15678 rpip->RPI,
15679 rpip->attempts);
15680 } else {
15681 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15682 "rpi_reg_action:%d attempts=%d. "
15683 "Sending REG_RPI. <",
15684 rpip->RPI,
15685 rpip->attempts);
12530 }
12531
15686 }
15687
12532 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12533 "rpi_reg_action:%d attempts=%d. Sending REG_RPI.",
12534 rpip->RPI,
12535 rpip->attempts);
15688 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
12536
15689
12537 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
12538
12539 rval = emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
12540 FCF_REASON_NO_MBOX, 0, arg1);
12541
12542 return (rval);
12543 }
12544
12545 mb4 = (MAILBOX4*)mbq;
12546 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
12547
15690 rval = emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
15691 FCF_REASON_NO_MBOX, 0, arg1);
15692
15693 return (rval);
15694 }
15695
15696 mb4 = (MAILBOX4*)mbq;
15697 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);
15698
12548 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
15699 if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF)) == 0) {
12549 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
12550
12551 rval = emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
12552 FCF_REASON_NO_BUFFER, 0, arg1);
12553
12554 return (rval);
12555 }
12556

--- 10 unchanged lines hidden (view full) ---

12567 mb4->un.varRegLogin.un.sp64.tus.f.bdeSize = sizeof (SERV_PARM);
12568 mb4->un.varRegLogin.un.sp64.addrHigh = PADDR_HI(mp->phys);
12569 mb4->un.varRegLogin.un.sp64.addrLow = PADDR_LO(mp->phys);
12570 mb4->un.varRegLogin.did = rpip->did;
12571 mb4->un.varWords[30] = 0; /* flags */
12572
12573 mb4->un.varRegLogin.vpi = rpip->vpip->VPI;
12574 mb4->un.varRegLogin.rpi = rpip->RPI;
15700 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq);
15701
15702 rval = emlxs_rpi_state(port, rpip, RPI_STATE_REG_FAILED,
15703 FCF_REASON_NO_BUFFER, 0, arg1);
15704
15705 return (rval);
15706 }
15707

--- 10 unchanged lines hidden (view full) ---

15718 mb4->un.varRegLogin.un.sp64.tus.f.bdeSize = sizeof (SERV_PARM);
15719 mb4->un.varRegLogin.un.sp64.addrHigh = PADDR_HI(mp->phys);
15720 mb4->un.varRegLogin.un.sp64.addrLow = PADDR_LO(mp->phys);
15721 mb4->un.varRegLogin.did = rpip->did;
15722 mb4->un.varWords[30] = 0; /* flags */
15723
15724 mb4->un.varRegLogin.vpi = rpip->vpip->VPI;
15725 mb4->un.varRegLogin.rpi = rpip->RPI;
15726 mb4->un.varRegLogin.update = (rpip->flag & EMLXS_RPI_REG)? 1:0;
12575
12576 bcopy((void *)&rpip->sparam, (void *)mp->virt, sizeof (SERV_PARM));
12577
12578 if (rpip->cmpl) {
12579 mbq->sbp = rpip->cmpl->arg1;
12580 mbq->ubp = rpip->cmpl->arg2;
12581 mbq->iocbq = rpip->cmpl->arg3;
12582 }

--- 19 unchanged lines hidden (view full) ---

12602} /* emlxs_rpi_reg_action() */
12603
12604
12605/*ARGSUSED*/
12606static uint32_t
12607emlxs_rpi_reg_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12608 void *arg1)
12609{
15727
15728 bcopy((void *)&rpip->sparam, (void *)mp->virt, sizeof (SERV_PARM));
15729
15730 if (rpip->cmpl) {
15731 mbq->sbp = rpip->cmpl->arg1;
15732 mbq->ubp = rpip->cmpl->arg2;
15733 mbq->iocbq = rpip->cmpl->arg3;
15734 }

--- 19 unchanged lines hidden (view full) ---

15754} /* emlxs_rpi_reg_action() */
15755
15756
15757/*ARGSUSED*/
15758static uint32_t
15759emlxs_rpi_reg_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15760 void *arg1)
15761{
12610 uint32_t rval;
15762 uint32_t rval = 0;
12611
12612 if (rpip->state != RPI_STATE_REG_CMPL) {
12613 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12614 "rpi_reg_cmpl_action:%d %s:%s arg=%p. "
15763
15764 if (rpip->state != RPI_STATE_REG_CMPL) {
15765 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15766 "rpi_reg_cmpl_action:%d %s:%s arg=%p. "
12615 "Invalid state. Terminated.",
15767 "Invalid state. <",
12616 rpip->RPI,
12617 emlxs_rpi_state_xlate(rpip->state),
12618 emlxs_fcf_event_xlate(evt), arg1);
12619 return (1);
12620 }
12621
12622 if (rpip->flag & EMLXS_RPI_REG) {
12623 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15768 rpip->RPI,
15769 emlxs_rpi_state_xlate(rpip->state),
15770 emlxs_fcf_event_xlate(evt), arg1);
15771 return (1);
15772 }
15773
15774 if (rpip->flag & EMLXS_RPI_REG) {
15775 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12624 "rpi_reg_cmpl_action:%d flag=%x. Going online",
15776 "rpi_reg_cmpl_action:%d flag=%x. Going online.",
12625 rpip->RPI,
12626 rpip->flag);
12627
12628 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
12629 FCF_REASON_EVENT, evt, arg1);
12630 } else {
12631 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12632 "rpi_reg_cmpl_action:%d flag=%x. Going offline.",

--- 9 unchanged lines hidden (view full) ---

12642} /* emlxs_rpi_reg_cmpl_action() */
12643
12644
12645/*ARGSUSED*/
12646static uint32_t
12647emlxs_rpi_resume_failed_action(emlxs_port_t *port, RPIobj_t *rpip,
12648 uint32_t evt, void *arg1)
12649{
15777 rpip->RPI,
15778 rpip->flag);
15779
15780 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
15781 FCF_REASON_EVENT, evt, arg1);
15782 } else {
15783 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15784 "rpi_reg_cmpl_action:%d flag=%x. Going offline.",

--- 9 unchanged lines hidden (view full) ---

15794} /* emlxs_rpi_reg_cmpl_action() */
15795
15796
15797/*ARGSUSED*/
15798static uint32_t
15799emlxs_rpi_resume_failed_action(emlxs_port_t *port, RPIobj_t *rpip,
15800 uint32_t evt, void *arg1)
15801{
12650 uint32_t rval;
15802 uint32_t rval = 0;
12651
12652 rpip->attempts++;
12653
12654 if (rpip->state != RPI_STATE_RESUME_FAILED) {
12655 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12656 "rpi_resume_failed_action:%d %s:%s arg=%p attempt=%d. "
15803
15804 rpip->attempts++;
15805
15806 if (rpip->state != RPI_STATE_RESUME_FAILED) {
15807 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15808 "rpi_resume_failed_action:%d %s:%s arg=%p attempt=%d. "
12657 "Invalid state. Terminated.",
15809 "Invalid state. <",
12658 rpip->RPI,
12659 emlxs_rpi_state_xlate(rpip->state),
12660 emlxs_fcf_event_xlate(evt), arg1,
12661 rpip->attempts);
15810 rpip->RPI,
15811 emlxs_rpi_state_xlate(rpip->state),
15812 emlxs_fcf_event_xlate(evt), arg1,
15813 rpip->attempts);
12662
12663 return (1);
12664 }
12665
12666 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12667 "rpi_resume_failed_action:%d attempt=%d. Unregistering.",
12668 rpip->RPI,
12669 rpip->attempts);
12670

--- 33 unchanged lines hidden (view full) ---

12704 mutex_enter(&EMLXS_FCF_LOCK);
12705
12706 rpip = (RPIobj_t *)mbq->context;
12707 mb4 = (MAILBOX4 *)mbq;
12708
12709 if (rpip->state != RPI_STATE_RESUME) {
12710 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12711 "rpi_resume_mbcmpl:%d state=%s. "
15814 return (1);
15815 }
15816
15817 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15818 "rpi_resume_failed_action:%d attempt=%d. Unregistering.",
15819 rpip->RPI,
15820 rpip->attempts);
15821

--- 33 unchanged lines hidden (view full) ---

15855 mutex_enter(&EMLXS_FCF_LOCK);
15856
15857 rpip = (RPIobj_t *)mbq->context;
15858 mb4 = (MAILBOX4 *)mbq;
15859
15860 if (rpip->state != RPI_STATE_RESUME) {
15861 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15862 "rpi_resume_mbcmpl:%d state=%s. "
12712 "No longer in RPI_STATE_RESUME. Terminated.",
15863 "No longer in RPI_STATE_RESUME.",
12713 rpip->RPI,
12714 emlxs_rpi_state_xlate(rpip->state));
12715
12716 mutex_exit(&EMLXS_FCF_LOCK);
12717 return (0);
12718 }
12719
12720 if (mb4->mbxStatus) {
12721 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15864 rpip->RPI,
15865 emlxs_rpi_state_xlate(rpip->state));
15866
15867 mutex_exit(&EMLXS_FCF_LOCK);
15868 return (0);
15869 }
15870
15871 if (mb4->mbxStatus) {
15872 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12722 "rpi_resume_mbcmpl:%d failed. status=%x",
15873 "rpi_resume_mbcmpl:%d failed. %s. >",
12723 rpip->RPI,
15874 rpip->RPI,
12724 mb4->mbxStatus);
15875 emlxs_mb_xlate_status(mb4->mbxStatus));
12725
12726 (void) emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_FAILED,
12727 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
12728
12729 mutex_exit(&EMLXS_FCF_LOCK);
12730 return (0);
12731 }
12732
12733 emlxs_rpi_resume_handler(port, rpip);
12734
12735 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15876
15877 (void) emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_FAILED,
15878 FCF_REASON_MBOX_FAILED, mb4->mbxStatus, (void *)mbq->sbp);
15879
15880 mutex_exit(&EMLXS_FCF_LOCK);
15881 return (0);
15882 }
15883
15884 emlxs_rpi_resume_handler(port, rpip);
15885
15886 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12736 "rpi_resume_mbcmpl:%d Resumed. Resume cmpl.",
15887 "rpi_resume_mbcmpl:%d Resumed. Resume complete. >",
12737 rpip->RPI);
12738
12739 (void) emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_CMPL, 0, 0, 0);
12740
12741 mutex_exit(&EMLXS_FCF_LOCK);
12742
12743 return (0);
12744
12745} /* emlxs_rpi_resume_mbcmpl() */
12746
12747
12748/*ARGSUSED*/
12749static uint32_t
12750emlxs_rpi_resume_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12751 void *arg1)
12752{
12753 emlxs_hba_t *hba = HBA;
12754 MAILBOX4 *mb4;
12755 MAILBOXQ *mbq;
15888 rpip->RPI);
15889
15890 (void) emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_CMPL, 0, 0, 0);
15891
15892 mutex_exit(&EMLXS_FCF_LOCK);
15893
15894 return (0);
15895
15896} /* emlxs_rpi_resume_mbcmpl() */
15897
15898
15899/*ARGSUSED*/
15900static uint32_t
15901emlxs_rpi_resume_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
15902 void *arg1)
15903{
15904 emlxs_hba_t *hba = HBA;
15905 MAILBOX4 *mb4;
15906 MAILBOXQ *mbq;
12756 uint32_t rval;
15907 uint32_t rval = 0;
12757
12758 if (rpip->state != RPI_STATE_RESUME) {
12759 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12760 "rpi_resume_action:%d %s:%s arg=%p. "
15908
15909 if (rpip->state != RPI_STATE_RESUME) {
15910 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
15911 "rpi_resume_action:%d %s:%s arg=%p. "
12761 "Invalid state. Terminated.",
15912 "Invalid state. <",
12762 rpip->RPI,
12763 emlxs_rpi_state_xlate(rpip->state),
12764 emlxs_fcf_event_xlate(evt), arg1);
15913 rpip->RPI,
15914 emlxs_rpi_state_xlate(rpip->state),
15915 emlxs_fcf_event_xlate(evt), arg1);
12765
12766 return (1);
12767 }
12768
12769 if (!(rpip->flag & EMLXS_RPI_PAUSED)) {
12770 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12771 "rpi_resume_action:%d flag=%x. Not Paused. Going online.",
12772 rpip->RPI, rpip->flag);
12773
12774 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
12775 FCF_REASON_EVENT, evt, arg1);
12776
12777 return (rval);
12778 }
12779
15916 return (1);
15917 }
15918
15919 if (!(rpip->flag & EMLXS_RPI_PAUSED)) {
15920 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15921 "rpi_resume_action:%d flag=%x. Not Paused. Going online.",
15922 rpip->RPI, rpip->flag);
15923
15924 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
15925 FCF_REASON_EVENT, evt, arg1);
15926
15927 return (rval);
15928 }
15929
12780 if (rpip->did == FABRIC_DID) {
15930 if (rpip->RPI == FABRIC_RPI) {
12781 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12782 "rpi_resume_action:%d. Fabric RPI. "
12783 "Going online.",
12784 rpip->RPI);
12785
12786 /* Don't send RESUME_RPI, but process it as if we did */
12787 emlxs_rpi_resume_handler(port, rpip);
12788
12789 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
12790 FCF_REASON_EVENT, evt, arg1);
12791
12792 return (rval);
12793 }
12794
12795 if (rpip->prev_state != RPI_STATE_RESUME_FAILED) {
12796 rpip->attempts = 0;
12797 }
12798
12799 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15931 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
15932 "rpi_resume_action:%d. Fabric RPI. "
15933 "Going online.",
15934 rpip->RPI);
15935
15936 /* Don't send RESUME_RPI, but process it as if we did */
15937 emlxs_rpi_resume_handler(port, rpip);
15938
15939 rval = emlxs_rpi_state(port, rpip, RPI_STATE_ONLINE,
15940 FCF_REASON_EVENT, evt, arg1);
15941
15942 return (rval);
15943 }
15944
15945 if (rpip->prev_state != RPI_STATE_RESUME_FAILED) {
15946 rpip->attempts = 0;
15947 }
15948
15949 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12800 "rpi_resume_action:%d attempts=%d. Sending RESUME_RPI.",
15950 "rpi_resume_action:%d attempts=%d. Sending RESUME_RPI. <",
12801 rpip->RPI,
12802 rpip->attempts);
12803
15951 rpip->RPI,
15952 rpip->attempts);
15953
12804 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
15954 if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX))) {
12805
12806 rval = emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_FAILED,
12807 FCF_REASON_NO_MBOX, 0, arg1);
12808
12809 return (rval);
12810 }
12811 mb4 = (MAILBOX4*)mbq;
12812 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);

--- 34 unchanged lines hidden (view full) ---

12847
12848} /* emlxs_rpi_resume_action() */
12849
12850
12851static uint32_t
12852emlxs_rpi_resume_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12853 void *arg1)
12854{
15955
15956 rval = emlxs_rpi_state(port, rpip, RPI_STATE_RESUME_FAILED,
15957 FCF_REASON_NO_MBOX, 0, arg1);
15958
15959 return (rval);
15960 }
15961 mb4 = (MAILBOX4*)mbq;
15962 bzero((void *) mb4, MAILBOX_CMD_SLI4_BSIZE);

--- 34 unchanged lines hidden (view full) ---

15997
15998} /* emlxs_rpi_resume_action() */
15999
16000
16001static uint32_t
16002emlxs_rpi_resume_cmpl_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
16003 void *arg1)
16004{
12855 uint32_t rval;
16005 uint32_t rval = 0;
12856
12857 if (rpip->state != RPI_STATE_RESUME_CMPL) {
12858 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
12859 "rpi_resume_cmpl_action:%d %s:%s arg=%p. "
16006
16007 if (rpip->state != RPI_STATE_RESUME_CMPL) {
16008 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_error_msg,
16009 "rpi_resume_cmpl_action:%d %s:%s arg=%p. "
12860 "Invalid state. Terminated.",
16010 "Invalid state. <",
12861 rpip->RPI,
12862 emlxs_rpi_state_xlate(rpip->state),
12863 emlxs_fcf_event_xlate(evt), arg1);
12864 return (1);
12865 }
12866
12867 if (rpip->flag & EMLXS_RPI_PAUSED) {
12868 if (rpip->flag & EMLXS_RPI_REG) {

--- 29 unchanged lines hidden (view full) ---

12898
12899
12900/*ARGSUSED*/
12901static uint32_t
12902emlxs_rpi_online_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
12903 void *arg1)
12904{
12905 emlxs_hba_t *hba = HBA;
16011 rpip->RPI,
16012 emlxs_rpi_state_xlate(rpip->state),
16013 emlxs_fcf_event_xlate(evt), arg1);
16014 return (1);
16015 }
16016
16017 if (rpip->flag & EMLXS_RPI_PAUSED) {
16018 if (rpip->flag & EMLXS_RPI_REG) {

--- 29 unchanged lines hidden (view full) ---

16048
16049
16050/*ARGSUSED*/
16051static uint32_t
16052emlxs_rpi_online_action(emlxs_port_t *port, RPIobj_t *rpip, uint32_t evt,
16053 void *arg1)
16054{
16055 emlxs_hba_t *hba = HBA;
12906 uint32_t rval;
16056 uint32_t rval = 0;
16057 RPIobj_t *p2p_rpip;
12907
12908 if (rpip->state != RPI_STATE_ONLINE) {
12909 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12910 "rpi_online_action:%d %s:%s arg=%p. "
16058
16059 if (rpip->state != RPI_STATE_ONLINE) {
16060 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
16061 "rpi_online_action:%d %s:%s arg=%p. "
12911 "Invalid state. Terminated.",
16062 "Invalid state. <",
12912 rpip->RPI,
12913 emlxs_rpi_state_xlate(rpip->state),
12914 emlxs_fcf_event_xlate(evt), arg1);
12915 return (1);
12916 }
12917
16063 rpip->RPI,
16064 emlxs_rpi_state_xlate(rpip->state),
16065 emlxs_fcf_event_xlate(evt), arg1);
16066 return (1);
16067 }
16068
12918 if (rpip->did == FABRIC_DID) {
16069 if (rpip->RPI == FABRIC_RPI) {
12919 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
16070 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12920 "rpi_online_action:%d did=%x. Fabric RPI online. "
12921 "Terminated.",
16071 "rpi_online_action:%d did=%x. Fabric RPI online. <",
12922 rpip->RPI,
12923 rpip->did,
12924 rpip->vpip->VPI);
12925
16072 rpip->RPI,
16073 rpip->did,
16074 rpip->vpip->VPI);
16075
16076 /* Now register the p2p_rpip */
16077 p2p_rpip = rpip->vpip->p2p_rpip;
16078 if (p2p_rpip) {
16079 rpip->vpip->p2p_rpip = NULL;
16080
16081 rval = emlxs_rpi_state(port, p2p_rpip, RPI_STATE_REG,
16082 FCF_REASON_EVENT, evt, arg1);
16083 }
16084
12926 EMLXS_STATE_CHANGE(hba, FC_READY);
12927
16085 EMLXS_STATE_CHANGE(hba, FC_READY);
16086
12928 if (rpip->vpip->flogi_sbp) {
12929 emlxs_vpi_flogi_cmpl(port, rpip->vpip, 0);
16087 if (rpip->cmpl) {
16088 emlxs_rpi_deferred_cmpl(port, rpip, 0);
12930 }
12931
12932 return (0);
12933 }
12934
16089 }
16090
16091 return (0);
16092 }
16093
12935 if (!(rpip->vpip->flag & EMLXS_VPI_PORT_ENABLED)) {
12936 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12937 "rpi_online_action:%d did=%x. vpi=%d. Port disabled. "
12938 "Offlining RPI.",
12939 rpip->RPI,
12940 rpip->did,
12941 rpip->vpip->VPI);
12942
12943 rval = emlxs_rpi_state(port, rpip, RPI_STATE_OFFLINE,
12944 FCF_REASON_NOT_ALLOWED, evt, arg1);
12945
12946 return (rval);
12947 }
12948
12949 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
16094 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcf_detail_msg,
12950 "rpi_online_action:%d did=%x. RPI online. Notifying VPI:%d.",
16095 "rpi_online_action:%d did=%x. RPI online. Notifying VPI:%d. >",
12951 rpip->RPI,
12952 rpip->did,
12953 rpip->vpip->VPI);
12954
12955 /* Notify VPI */
12956 rval = emlxs_vpi_event(port, FCF_EVENT_RPI_ONLINE, rpip);
12957
12958 return (rval);
12959
12960} /* emlxs_rpi_online_action() */
16096 rpip->RPI,
16097 rpip->did,
16098 rpip->vpip->VPI);
16099
16100 /* Notify VPI */
16101 rval = emlxs_vpi_event(port, FCF_EVENT_RPI_ONLINE, rpip);
16102
16103 return (rval);
16104
16105} /* emlxs_rpi_online_action() */