1a9800bebSGarrett D'Amore /* 2a9800bebSGarrett D'Amore * CDDL HEADER START 3a9800bebSGarrett D'Amore * 4a9800bebSGarrett D'Amore * The contents of this file are subject to the terms of the 5a9800bebSGarrett D'Amore * Common Development and Distribution License (the "License"). 6a9800bebSGarrett D'Amore * You may not use this file except in compliance with the License. 7a9800bebSGarrett D'Amore * 8*8f23e9faSHans Rosenfeld * You can obtain a copy of the license at 9*8f23e9faSHans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt. 10a9800bebSGarrett D'Amore * See the License for the specific language governing permissions 11a9800bebSGarrett D'Amore * and limitations under the License. 12a9800bebSGarrett D'Amore * 13a9800bebSGarrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each 14a9800bebSGarrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15a9800bebSGarrett D'Amore * If applicable, add the following below this CDDL HEADER, with the 16a9800bebSGarrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying 17a9800bebSGarrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner] 18a9800bebSGarrett D'Amore * 19a9800bebSGarrett D'Amore * CDDL HEADER END 20a9800bebSGarrett D'Amore */ 21a9800bebSGarrett D'Amore 22a9800bebSGarrett D'Amore /* 23*8f23e9faSHans Rosenfeld * Copyright (c) 2004-2012 Emulex. All rights reserved. 24a9800bebSGarrett D'Amore * Use is subject to license terms. 25a9800bebSGarrett D'Amore */ 26a9800bebSGarrett D'Amore 27a9800bebSGarrett D'Amore #include <emlxs.h> 28a9800bebSGarrett D'Amore 29a9800bebSGarrett D'Amore /* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */ 30a9800bebSGarrett D'Amore EMLXS_MSG_DEF(EMLXS_FCF_C); 31a9800bebSGarrett D'Amore 32a9800bebSGarrett D'Amore /* 33a9800bebSGarrett D'Amore * STATE MACHINE RULES: 34a9800bebSGarrett D'Amore * 35a9800bebSGarrett D'Amore * - State change requests to an XXXX object when operating within 36a9800bebSGarrett D'Amore * an emlxs_XXXX state management function must be made 37a9800bebSGarrett D'Amore * using the emlxs_XXXX_state() call. 38a9800bebSGarrett D'Amore * 39a9800bebSGarrett D'Amore * - State change requests to an XXXX object when operating outside 40a9800bebSGarrett D'Amore * an emlxs_XXXX state management function must be made 41a9800bebSGarrett D'Amore * using the emlxs_XXXX_alloc(), emlxs_XXXX_free(), emlxs_XXXX_event() 42a9800bebSGarrett D'Amore * or emlxs_XXXX_..._notify() calls. 43a9800bebSGarrett D'Amore * 44a9800bebSGarrett D'Amore * - emlxs_XXXX_..._notify() calls are used by routines outside 45a9800bebSGarrett D'Amore * this fcf module to enter the state machine. 46a9800bebSGarrett D'Amore * 47a9800bebSGarrett D'Amore * - It is forbidden to make direct calls to emlxs_XXXX_...._action() 48a9800bebSGarrett D'Amore * functions. Only emlxs_XXXX_action() routines may make calls to 49a9800bebSGarrett D'Amore * emlxs_XXXX_...._action() functions. 50a9800bebSGarrett D'Amore * 51a9800bebSGarrett D'Amore * - Its is forbidden to make direct calls to emlxs_XXXX_action(). 52a9800bebSGarrett D'Amore * Only emlxs_XXXX_state() and emlxs_XXXX_event() routines may make 53a9800bebSGarrett D'Amore * calls to emlxs_XXXX_action(). 54a9800bebSGarrett D'Amore * 55a9800bebSGarrett D'Amore * - The EMLXS_FCF_LOCK must be held before calling: 56a9800bebSGarrett D'Amore * emlxs_XXXX_state(), emlxs_XXXX_event() and emlxs_XXXX_action(). 57a9800bebSGarrett D'Amore * 58*8f23e9faSHans Rosenfeld * - All other calls touching fcftab, fcfi, vfi, vpi, rpi objects 59*8f23e9faSHans Rosenfeld * must hold the EMLXS_FCF_LOCK to protect these objects. 60*8f23e9faSHans Rosenfeld */ 61*8f23e9faSHans Rosenfeld 62*8f23e9faSHans Rosenfeld /* 63*8f23e9faSHans Rosenfeld * DEBUG MESSAGE TERMINATION RULES: 64*8f23e9faSHans Rosenfeld * 65*8f23e9faSHans Rosenfeld * - A message should end in ">" if a thread operating outside the 66*8f23e9faSHans Rosenfeld * XXXX state machine enters the XXXX state machine with a call to 67*8f23e9faSHans Rosenfeld * emlxs_XXXX_event() or emlxs_XXXX_state(). This includes calls made 68*8f23e9faSHans Rosenfeld * from emlxs_..._notify(), emlxs_..._mbcmpl() and emlxs_..._timer() 69*8f23e9faSHans Rosenfeld * routines since they represent the beginnning of new threads. 70*8f23e9faSHans Rosenfeld * 71*8f23e9faSHans Rosenfeld * - A message should end in "<" if the thread is about exit 72*8f23e9faSHans Rosenfeld * an emlxs_XXXX_..._action() without previously calling the 73*8f23e9faSHans Rosenfeld * next emlxs_XXXX_state(). This includes the emlxs_XXXX_action() 74*8f23e9faSHans Rosenfeld * and emlxs_XXXX_state() routines themselves since errors 75*8f23e9faSHans Rosenfeld * in these routines represent the termination of state change 76*8f23e9faSHans Rosenfeld * thread. 77*8f23e9faSHans Rosenfeld * 78*8f23e9faSHans Rosenfeld * - A message should end in "." if none of the previous 79*8f23e9faSHans Rosenfeld * conditions apply. 80a9800bebSGarrett D'Amore */ 81a9800bebSGarrett D'Amore 82a9800bebSGarrett D'Amore /* ************************************************************************** */ 83a9800bebSGarrett D'Amore /* FCF Generic */ 84a9800bebSGarrett D'Amore /* ************************************************************************** */ 85a9800bebSGarrett D'Amore 86a9800bebSGarrett D'Amore /* 87a9800bebSGarrett D'Amore * EVENT ARG1 88a9800bebSGarrett D'Amore * -------------------------------------------- 89a9800bebSGarrett D'Amore * FCF_EVENT_STATE_ENTER None 90a9800bebSGarrett D'Amore * 91a9800bebSGarrett D'Amore * FCF_EVENT_LINKUP None 92a9800bebSGarrett D'Amore * FCF_EVENT_LINKDOWN None 93a9800bebSGarrett D'Amore * FCF_EVENT_CVL vpi 94a9800bebSGarrett D'Amore * FCF_EVENT_FCFTAB_FULL None 95a9800bebSGarrett D'Amore * FCF_EVENT_FCF_FOUND fcf_index 96a9800bebSGarrett D'Amore * FCF_EVENT_FCF_LOST fcf_index 97a9800bebSGarrett D'Amore * FCF_EVENT_FCF_CHANGED fcf_index 98a9800bebSGarrett D'Amore * 99a9800bebSGarrett D'Amore * FCF_EVENT_FCFI_ONLINE FCFIobj_t* 100a9800bebSGarrett D'Amore * FCF_EVENT_FCFI_OFFLINE FCFIobj_t* 101a9800bebSGarrett D'Amore * FCF_EVENT_FCFI_PAUSE FCFIobj_t* 102a9800bebSGarrett D'Amore * 103a9800bebSGarrett D'Amore * FCF_EVENT_VFI_ONLINE VFIobj_t* 104a9800bebSGarrett D'Amore * FCF_EVENT_VFI_OFFLINE VFIobj_t* 105a9800bebSGarrett D'Amore * FCF_EVENT_VFI_PAUSE VFIobj_t* 106a9800bebSGarrett D'Amore * 107a9800bebSGarrett D'Amore * FCF_EVENT_VPI_ONLINE VPIobj_t* 108a9800bebSGarrett D'Amore * FCF_EVENT_VPI_OFFLINE VPIobj_t* 109a9800bebSGarrett D'Amore * FCF_EVENT_VPI_PAUSE VPIobj_t* 110a9800bebSGarrett D'Amore * 111a9800bebSGarrett D'Amore * FCF_EVENT_RPI_ONLINE RPIobj_t* 112a9800bebSGarrett D'Amore * FCF_EVENT_RPI_OFFLINE RPIobj_t* 113a9800bebSGarrett D'Amore * FCF_EVENT_RPI_PAUSE RPIobj_t* 114a9800bebSGarrett D'Amore * FCF_EVENT_RPI_RESUME RPIobj_t* 115*8f23e9faSHans Rosenfeld * FCF_EVENT_RPI_TIMEOUT RPIobj_t* 116a9800bebSGarrett D'Amore */ 117a9800bebSGarrett D'Amore 118a9800bebSGarrett D'Amore /* Order does not matter */ 119a9800bebSGarrett D'Amore emlxs_table_t emlxs_fcf_event_table[] = 120a9800bebSGarrett D'Amore { 121*8f23e9faSHans Rosenfeld {FCF_EVENT_STATE_ENTER, "E_ENTER"}, 122a9800bebSGarrett D'Amore 123*8f23e9faSHans Rosenfeld {FCF_EVENT_SHUTDOWN, "E_SHUTDOWN"}, 124*8f23e9faSHans Rosenfeld {FCF_EVENT_LINKUP, "E_LINKUP"}, 125*8f23e9faSHans Rosenfeld {FCF_EVENT_LINKDOWN, "E_LINKDOWN"}, 126*8f23e9faSHans Rosenfeld {FCF_EVENT_CVL, "E_CVL"}, 127*8f23e9faSHans Rosenfeld {FCF_EVENT_FCFTAB_FULL, "E_TABLE_FULL"}, 128*8f23e9faSHans Rosenfeld {FCF_EVENT_FCF_FOUND, "E_FCF_FOUND"}, 129*8f23e9faSHans Rosenfeld {FCF_EVENT_FCF_LOST, "E_FCF_LOST"}, 130*8f23e9faSHans Rosenfeld {FCF_EVENT_FCF_CHANGED, "E_FCF_CHANGED"}, 131a9800bebSGarrett D'Amore 132*8f23e9faSHans Rosenfeld {FCF_EVENT_FCFI_ONLINE, "E_FCFI_ONLINE"}, 133*8f23e9faSHans Rosenfeld {FCF_EVENT_FCFI_OFFLINE, "E_FCFI_OFFLINE"}, 134*8f23e9faSHans Rosenfeld {FCF_EVENT_FCFI_PAUSE, "E_FCFI_PAUSE"}, 135a9800bebSGarrett D'Amore 136*8f23e9faSHans Rosenfeld {FCF_EVENT_VFI_ONLINE, "E_VFI_ONLINE"}, 137*8f23e9faSHans Rosenfeld {FCF_EVENT_VFI_OFFLINE, "E_VFI_OFFLINE"}, 138*8f23e9faSHans Rosenfeld {FCF_EVENT_VFI_PAUSE, "E_VFI_PAUSE"}, 139a9800bebSGarrett D'Amore 140*8f23e9faSHans Rosenfeld {FCF_EVENT_VPI_ONLINE, "E_VPI_ONLINE"}, 141*8f23e9faSHans Rosenfeld {FCF_EVENT_VPI_OFFLINE, "E_VPI_OFFLINE"}, 142*8f23e9faSHans Rosenfeld {FCF_EVENT_VPI_PAUSE, "E_VPI_PAUSE"}, 143a9800bebSGarrett D'Amore 144*8f23e9faSHans Rosenfeld {FCF_EVENT_RPI_ONLINE, "E_RPI_ONLINE"}, 145*8f23e9faSHans Rosenfeld {FCF_EVENT_RPI_OFFLINE, "E_RPI_OFFLINE"}, 146*8f23e9faSHans Rosenfeld {FCF_EVENT_RPI_PAUSE, "E_RPI_PAUSE"}, 147*8f23e9faSHans Rosenfeld {FCF_EVENT_RPI_RESUME, "E_RPI_RESUME"}, 148a9800bebSGarrett D'Amore 149a9800bebSGarrett D'Amore }; /* emlxs_fcf_event_table */ 150a9800bebSGarrett D'Amore 151a9800bebSGarrett D'Amore 152a9800bebSGarrett D'Amore /* Order does not matter */ 153a9800bebSGarrett D'Amore emlxs_table_t emlxs_fcf_reason_table[] = 154a9800bebSGarrett D'Amore { 155*8f23e9faSHans Rosenfeld {FCF_REASON_NONE, "R_NONE"}, 156*8f23e9faSHans Rosenfeld {FCF_REASON_REENTER, "R_REENTER"}, 157*8f23e9faSHans Rosenfeld {FCF_REASON_EVENT, "R_EVENT"}, 158*8f23e9faSHans Rosenfeld {FCF_REASON_REQUESTED, "R_REQUESTED"}, 159*8f23e9faSHans Rosenfeld {FCF_REASON_NO_MBOX, "R_NO_MBOX"}, 160*8f23e9faSHans Rosenfeld {FCF_REASON_NO_BUFFER, "R_NO_BUFFER"}, 161*8f23e9faSHans Rosenfeld {FCF_REASON_SEND_FAILED, "R_SEND_FAILED"}, 162*8f23e9faSHans Rosenfeld {FCF_REASON_MBOX_FAILED, "R_MBOX_FAILED"}, 163*8f23e9faSHans Rosenfeld {FCF_REASON_MBOX_BUSY, "R_MBOX_BUSY"}, 164*8f23e9faSHans Rosenfeld {FCF_REASON_NO_FCFI, "R_NO_FCFI"}, 165*8f23e9faSHans Rosenfeld {FCF_REASON_NO_VFI, "R_NO_VFI"}, 166*8f23e9faSHans Rosenfeld {FCF_REASON_ONLINE_FAILED, "R_ONLINE_FAILED"}, 167*8f23e9faSHans Rosenfeld {FCF_REASON_OFFLINE_FAILED, "R_OFFLINE_FAILED"}, 168*8f23e9faSHans Rosenfeld {FCF_REASON_OP_FAILED, "R_OP_FAILED"}, 169*8f23e9faSHans Rosenfeld {FCF_REASON_NO_PKT, "R_NO_PKT"}, 170*8f23e9faSHans Rosenfeld {FCF_REASON_NO_NODE, "R_NO_NODE"}, 171*8f23e9faSHans Rosenfeld {FCF_REASON_NOT_ALLOWED, "R_NOT_ALLOWED"}, 172*8f23e9faSHans Rosenfeld {FCF_REASON_UNUSED, "R_UNUSED"}, 173*8f23e9faSHans Rosenfeld {FCF_REASON_INVALID, "R_INVALID"}, 174a9800bebSGarrett D'Amore 175a9800bebSGarrett D'Amore }; /* emlxs_fcf_reason_table */ 176a9800bebSGarrett D'Amore 177a9800bebSGarrett D'Amore 178a9800bebSGarrett D'Amore /* ********************************************************************** */ 179*8f23e9faSHans Rosenfeld /* FCFTAB Generic */ 180*8f23e9faSHans Rosenfeld /* ********************************************************************** */ 181*8f23e9faSHans Rosenfeld static char *emlxs_fcftab_state_xlate(emlxs_port_t *port, 182*8f23e9faSHans Rosenfeld uint32_t state); 183*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcftab_event(emlxs_port_t *port, uint32_t evt, 184*8f23e9faSHans Rosenfeld void *arg1); 185*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcftab_shutdown_action(emlxs_port_t *port, 186*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 187*8f23e9faSHans Rosenfeld 188*8f23e9faSHans Rosenfeld /* ********************************************************************** */ 189*8f23e9faSHans Rosenfeld /* FC FCFTAB */ 190a9800bebSGarrett D'Amore /* ********************************************************************** */ 191a9800bebSGarrett D'Amore 192a9800bebSGarrett D'Amore /* Order does not matter */ 193*8f23e9faSHans Rosenfeld emlxs_table_t emlxs_fc_fcftab_state_table[] = 194a9800bebSGarrett D'Amore { 195*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"}, 196*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"}, 197*8f23e9faSHans Rosenfeld 198*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_TOPO, "FCFTAB_TOPO"}, 199*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_TOPO_FAILED, "FCFTAB_TOPO_FAILED"}, 200*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_TOPO_CMPL, "FCFTAB_TOPO_CMPL"}, 201*8f23e9faSHans Rosenfeld 202*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_CFGLINK, "FCFTAB_CFGLINK"}, 203*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_CFGLINK_FAILED, "FCFTAB_CFGLINK_FAILED"}, 204*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_CFGLINK_CMPL, "FCFTAB_CFGLINK_CMPL"}, 205*8f23e9faSHans Rosenfeld 206*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_SPARM, "FCFTAB_SPARM"}, 207*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_SPARM_FAILED, "FCFTAB_SPARM_FAILED"}, 208*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_SPARM_CMPL, "FCFTAB_SPARM_CMPL"}, 209*8f23e9faSHans Rosenfeld 210*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL, 211*8f23e9faSHans Rosenfeld "FCFTAB_FCFI_OFFLINE_CMPL"}, 212*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"}, 213*8f23e9faSHans Rosenfeld 214*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"}, 215*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_FCFI_ONLINE_CMPL, "FCFTAB_FCFI_ONLINE_CMPL"}, 216*8f23e9faSHans Rosenfeld 217*8f23e9faSHans Rosenfeld {FC_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"}, 218a9800bebSGarrett D'Amore 219*8f23e9faSHans Rosenfeld }; /* emlxs_fc_fcftab_state_table */ 220a9800bebSGarrett D'Amore 221*8f23e9faSHans Rosenfeld static void emlxs_fc_fcftab_online_timer(emlxs_hba_t *hba); 222a9800bebSGarrett D'Amore 223*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_offline_action(emlxs_port_t *port, 224*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 225*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_online_action(emlxs_port_t *port, 226*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 227*8f23e9faSHans Rosenfeld 228*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_topo_cmpl_action(emlxs_port_t *port, 229*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 230*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_topo_failed_action(emlxs_port_t *port, 231*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 232*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_topo_action(emlxs_port_t *port, 233*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 234*8f23e9faSHans Rosenfeld 235*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_cfglink_cmpl_action(emlxs_port_t *port, 236*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 237*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_cfglink_failed_action(emlxs_port_t *port, 238*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 239*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_cfglink_action(emlxs_port_t *port, 240*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 241a9800bebSGarrett D'Amore 242*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_sparm_cmpl_action(emlxs_port_t *port, 243*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 244*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_sparm_failed_action(emlxs_port_t *port, 245*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 246*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_sparm_action(emlxs_port_t *port, 247*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 248a9800bebSGarrett D'Amore 249*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_linkup_evt_action(emlxs_port_t *port, 250*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 251*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_linkdown_evt_action(emlxs_port_t *port, 252*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 253a9800bebSGarrett D'Amore 254*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_online_evt_action(emlxs_port_t *port, 255*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 256*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_offline_evt_action(emlxs_port_t *port, 257*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 258a9800bebSGarrett D'Amore 259*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_shutdown_evt_action(emlxs_port_t *port, 260*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 261*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_offline_action(emlxs_port_t *port, 262*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 263*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port, 264*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 265*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_online_action(emlxs_port_t *port, 266*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 267*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port, 268*8f23e9faSHans Rosenfeld uint32_t evt, void *arg1); 269a9800bebSGarrett D'Amore 270*8f23e9faSHans Rosenfeld static char *emlxs_fc_fcftab_state_xlate(uint32_t state); 271*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_event(emlxs_port_t *port, 272a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 273*8f23e9faSHans Rosenfeld static uint32_t emlxs_fc_fcftab_req_handler(emlxs_port_t *port, void *arg1); 274*8f23e9faSHans Rosenfeld 275*8f23e9faSHans Rosenfeld /* 276*8f23e9faSHans Rosenfeld * - Online sequencing can start from FC_FCFTAB_STATE_OFFLINE state 277*8f23e9faSHans Rosenfeld * 278*8f23e9faSHans Rosenfeld * - Offline sequencing can interrupt the online sequencing at the 279*8f23e9faSHans Rosenfeld * entry of the next wait state. 280*8f23e9faSHans Rosenfeld * 281*8f23e9faSHans Rosenfeld * NORMAL ONLINE SEQ 282*8f23e9faSHans Rosenfeld * --------------------------- 283*8f23e9faSHans Rosenfeld * LINK_UP event <-- Adapter 284*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_OFFLINE 285*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_TOPO 286*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_TOPO_CMPL 287*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_CFGLINK 288*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_CFGLINK_CMPL 289*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_SPARM 290*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_SPARM_CMPL 291*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_FCFI_ONLINE 292*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_FCFI_ONLINE_CMPL 293*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_ONLINE 294*8f23e9faSHans Rosenfeld * 295*8f23e9faSHans Rosenfeld * 296*8f23e9faSHans Rosenfeld * NORMAL OFFLINE SEQ 297*8f23e9faSHans Rosenfeld * --------------------------- 298*8f23e9faSHans Rosenfeld * LINK_DOWN event <-- Adapter 299*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_ONLINE 300*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_FCFI_OFFLINE 301*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL 302*8f23e9faSHans Rosenfeld * FC_FCFTAB_STATE_OFFLINE 303*8f23e9faSHans Rosenfeld * 304*8f23e9faSHans Rosenfeld */ 305*8f23e9faSHans Rosenfeld /* Order does matter */ 306*8f23e9faSHans Rosenfeld static void *emlxs_fc_fcftab_action_table[] = 307*8f23e9faSHans Rosenfeld { 308*8f23e9faSHans Rosenfeld /* Action routine Event */ 309*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_SHUTDOWN 0 (Requires adapter reset) */ 310*8f23e9faSHans Rosenfeld (void *) emlxs_fcftab_shutdown_action, /* STATE_ENTER */ 311*8f23e9faSHans Rosenfeld (void *) NULL, /* SHUTDOWN */ 312*8f23e9faSHans Rosenfeld (void *) NULL, /* LINK_UP */ 313*8f23e9faSHans Rosenfeld (void *) NULL, /* LINK_DOWN */ 314*8f23e9faSHans Rosenfeld (void *) NULL, /* FCFI_ONLINE */ 315*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 316*8f23e9faSHans Rosenfeld 317*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_OFFLINE 1 (Wait for LINK_UP event) */ 318*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_offline_action, /* STATE_ENTER */ 319*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 320*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 321*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 322*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 323*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 324*8f23e9faSHans Rosenfeld 325*8f23e9faSHans Rosenfeld 326*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_TOPO 2 (Wait for topo mbcmpl) */ 327*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_topo_action, /* STATE_ENTER */ 328*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 329*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 330*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 331*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 332*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 333*8f23e9faSHans Rosenfeld 334*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_TOPO_FAILED 3 (Transitional) */ 335*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_topo_failed_action, /* STATE_ENTER */ 336*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 337*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 338*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 339*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 340*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 341*8f23e9faSHans Rosenfeld 342*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_TOPO_CMPL 4 (Transitional) */ 343*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_topo_cmpl_action, /* STATE_ENTER */ 344*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 345*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 346*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 347*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 348*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 349*8f23e9faSHans Rosenfeld 350*8f23e9faSHans Rosenfeld 351*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_CFGLINK 5 (Wait for cfglink mbcmpl) */ 352*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_cfglink_action, /* STATE_ENTER */ 353*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 354*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 355*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 356*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 357*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 358*8f23e9faSHans Rosenfeld 359*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_CFGLINK_FAILED 6 (Transitional) */ 360*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_cfglink_failed_action, /* STATE_ENTER */ 361*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 362*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 363*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 364*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 365*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 366*8f23e9faSHans Rosenfeld 367*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_CFGLINK_CMPL 7 (Transitional) */ 368*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_cfglink_cmpl_action, /* STATE_ENTER */ 369*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 370*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 371*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 372*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 373*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 374*8f23e9faSHans Rosenfeld 375*8f23e9faSHans Rosenfeld 376*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_SPARM 8 (Wait for sparm mbcmpl) */ 377*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_sparm_action, /* STATE_ENTER */ 378*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 379*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 380*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 381*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 382*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 383*8f23e9faSHans Rosenfeld 384*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_SPARM_FAILED 9 (Transitional) */ 385*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_sparm_failed_action, /* STATE_ENTER */ 386*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 387*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 388*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 389*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 390*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 391*8f23e9faSHans Rosenfeld 392*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_SPARM_CMPL 10 (Transitional) */ 393*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_sparm_cmpl_action, /* STATE_ENTER */ 394*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 395*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 396*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 397*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 398*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 399*8f23e9faSHans Rosenfeld 400*8f23e9faSHans Rosenfeld 401*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL 11 (Transitional) */ 402*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */ 403*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 404*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 405*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 406*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 407*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 408*8f23e9faSHans Rosenfeld 409*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_FCFI_OFFLINE 12 (Wait for FCFI_OFFLINE event) */ 410*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_action, /* STATE_ENTER */ 411*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 412*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 413*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 414*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 415*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 416*8f23e9faSHans Rosenfeld 417*8f23e9faSHans Rosenfeld 418*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_FCFI_ONLINE 13 (Wait for FCFI_ONLINE event) */ 419*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_action, /* STATE_ENTER */ 420*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 421*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 422*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 423*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 424*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 425*8f23e9faSHans Rosenfeld 426*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_FCFI_ONLINE_CMPL 14 (Transitional) */ 427*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_cmpl_action, /* STATE_ENTER */ 428*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 429*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 430*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 431*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 432*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 433*8f23e9faSHans Rosenfeld 434*8f23e9faSHans Rosenfeld 435*8f23e9faSHans Rosenfeld /* FC_FCFTAB_STATE_ONLINE 15 (Wait for LINK_DOWN evt) */ 436*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_online_action, /* STATE_ENTER */ 437*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_shutdown_evt_action, /* SHUTDOWN */ 438*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkup_evt_action, /* LINK_UP */ 439*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_linkdown_evt_action, /* LINK_DOWN */ 440*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 441*8f23e9faSHans Rosenfeld (void *) emlxs_fc_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 442*8f23e9faSHans Rosenfeld 443*8f23e9faSHans Rosenfeld }; /* emlxs_fc_fcftab_action_table[] */ 444*8f23e9faSHans Rosenfeld #define FC_FCFTAB_ACTION_EVENTS 6 445*8f23e9faSHans Rosenfeld #define FC_FCFTAB_ACTION_STATES \ 446*8f23e9faSHans Rosenfeld (sizeof (emlxs_fc_fcftab_action_table)/ \ 447*8f23e9faSHans Rosenfeld (FC_FCFTAB_ACTION_EVENTS * sizeof (void *))) 448*8f23e9faSHans Rosenfeld 449*8f23e9faSHans Rosenfeld 450*8f23e9faSHans Rosenfeld /* ********************************************************************** */ 451*8f23e9faSHans Rosenfeld /* FCOE FCFTAB */ 452*8f23e9faSHans Rosenfeld /* ********************************************************************** */ 453*8f23e9faSHans Rosenfeld 454*8f23e9faSHans Rosenfeld /* Order does not matter */ 455*8f23e9faSHans Rosenfeld emlxs_table_t emlxs_fcoe_fcftab_state_table[] = 456*8f23e9faSHans Rosenfeld { 457*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_SHUTDOWN, "FCFTAB_SHUTDOWN"}, 458*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_OFFLINE, "FCFTAB_OFFLINE"}, 459*8f23e9faSHans Rosenfeld 460*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_SOLICIT, "FCFTAB_SOLICIT"}, 461*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_SOLICIT_FAILED, "FCFTAB_SOLICIT_FAILED"}, 462*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_SOLICIT_CMPL, "FCFTAB_SOLICIT_CMPL"}, 463*8f23e9faSHans Rosenfeld 464*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_READ, "FCFTAB_READ"}, 465*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_READ_FAILED, "FCFTAB_READ_FAILED"}, 466*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_READ_CMPL, "FCFTAB_READ_CMPL"}, 467*8f23e9faSHans Rosenfeld 468*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL, 469*8f23e9faSHans Rosenfeld "FCFTAB_FCFI_OFFLINE_CMPL"}, 470*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_FCFI_OFFLINE, "FCFTAB_FCFI_OFFLINE"}, 471*8f23e9faSHans Rosenfeld 472*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_FCFI_ONLINE, "FCFTAB_FCFI_ONLINE"}, 473*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL, 474*8f23e9faSHans Rosenfeld "FCFTAB_FCFI_ONLINE_CMPL"}, 475*8f23e9faSHans Rosenfeld 476*8f23e9faSHans Rosenfeld {FCOE_FCFTAB_STATE_ONLINE, "FCFTAB_ONLINE"}, 477*8f23e9faSHans Rosenfeld 478*8f23e9faSHans Rosenfeld }; /* emlxs_fcoe_fcftab_state_table */ 479*8f23e9faSHans Rosenfeld 480*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_sol_cmpl_action(emlxs_port_t *port, 481a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 482*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_sol_failed_action(emlxs_port_t *port, 483a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 484*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_sol_action(emlxs_port_t *port, 485a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 486*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_shutdown_evt_action(emlxs_port_t *port, 487a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 488*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_linkdown_evt_action(emlxs_port_t *port, 489a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 490*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_read_action(emlxs_port_t *port, 491a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 492*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_read_failed_action(emlxs_port_t *port, 493a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 494*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_read_cmpl_action(emlxs_port_t *port, 495a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 496*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_online_action(emlxs_port_t *port, 497a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 498*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_online_cmpl_action(emlxs_port_t *port, 499a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 500*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_offline_action(emlxs_port_t *port, 501a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 502*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_offline_cmpl_action(emlxs_port_t *port, 503a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 504*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_found_evt_action(emlxs_port_t *port, 505a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 506*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_lost_evt_action(emlxs_port_t *port, 507a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 508*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_changed_evt_action(emlxs_port_t *port, 509a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 510*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_full_evt_action(emlxs_port_t *port, 511a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 512*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_linkup_evt_action(emlxs_port_t *port, 513a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 514*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_cvl_evt_action(emlxs_port_t *port, 515a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 516*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_online_action(emlxs_port_t *port, 517a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 518*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_offline_action(emlxs_port_t *port, 519a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 520*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_offline_evt_action(emlxs_port_t *port, 521a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 522*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_fcfi_online_evt_action(emlxs_port_t *port, 523a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 524a9800bebSGarrett D'Amore 525*8f23e9faSHans Rosenfeld static void emlxs_fcoe_fcftab_read_timer(emlxs_hba_t *hba); 526*8f23e9faSHans Rosenfeld static void emlxs_fcoe_fcftab_sol_timer(emlxs_hba_t *hba); 527*8f23e9faSHans Rosenfeld static void emlxs_fcoe_fcftab_offline_timer(emlxs_hba_t *hba); 528*8f23e9faSHans Rosenfeld static char *emlxs_fcoe_fcftab_state_xlate(uint32_t state); 529*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_event(emlxs_port_t *port, 530a9800bebSGarrett D'Amore uint32_t evt, void *arg1); 531*8f23e9faSHans Rosenfeld static uint32_t emlxs_fcoe_fcftab_state(emlxs_port_t *port, uint16_t state, 532*8f23e9faSHans Rosenfeld uint16_t reason, uint32_t explain, void *arg1); 533a9800bebSGarrett D'Amore 534a9800bebSGarrett D'Amore /* 535*8f23e9faSHans Rosenfeld * - Online sequencing can start from FCOE_FCFTAB_STATE_OFFLINE state 536a9800bebSGarrett D'Amore * 537a9800bebSGarrett D'Amore * - Offline sequencing can interrupt the online sequencing at the 538a9800bebSGarrett D'Amore * entry of the next wait state. 539a9800bebSGarrett D'Amore * 540a9800bebSGarrett D'Amore * NORMAL ONLINE SEQ 541a9800bebSGarrett D'Amore * --------------------------- 542a9800bebSGarrett D'Amore * LINK_UP event <-- Adapter 543*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_OFFLINE 544*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_SOLICIT 545*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_SOLICIT_CMPL 546*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_READ 547*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_READ_CMPL 548*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE 549*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL 550*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_ONLINE 551*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL 552*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_ONLINE 553a9800bebSGarrett D'Amore * 554a9800bebSGarrett D'Amore * 555a9800bebSGarrett D'Amore * NORMAL OFFLINE SEQ 556a9800bebSGarrett D'Amore * --------------------------- 557a9800bebSGarrett D'Amore * LINK_DOWN event <-- Adapter 558*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_ONLINE 559*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE 560*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL 561*8f23e9faSHans Rosenfeld * FCOE_FCFTAB_STATE_OFFLINE 562a9800bebSGarrett D'Amore * 563a9800bebSGarrett D'Amore */ 564a9800bebSGarrett D'Amore /* Order does matter */ 565*8f23e9faSHans Rosenfeld static void *emlxs_fcoe_fcftab_action_table[] = 566a9800bebSGarrett D'Amore { 567a9800bebSGarrett D'Amore /* Action routine Event */ 568*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_SHUTDOWN 0 (Requires adapter reset) */ 569a9800bebSGarrett D'Amore (void *) emlxs_fcftab_shutdown_action, /* STATE_ENTER */ 570a9800bebSGarrett D'Amore (void *) NULL, /* SHUTDOWN */ 571a9800bebSGarrett D'Amore (void *) NULL, /* LINK_UP */ 572a9800bebSGarrett D'Amore (void *) NULL, /* LINK_DOWN */ 573a9800bebSGarrett D'Amore (void *) NULL, /* CVL_RECD */ 574a9800bebSGarrett D'Amore (void *) NULL, /* FCF_FOUND */ 575a9800bebSGarrett D'Amore (void *) NULL, /* FCF_LOST */ 576a9800bebSGarrett D'Amore (void *) NULL, /* FCF_CHANGED */ 577a9800bebSGarrett D'Amore (void *) NULL, /* TABLE_FULL */ 578a9800bebSGarrett D'Amore (void *) NULL, /* FCFI_ONLINE */ 579*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 580*8f23e9faSHans Rosenfeld 581*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_OFFLINE 1 (Wait for LINK_UP event) */ 582*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_offline_action, /* STATE_ENTER */ 583*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 584*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 585*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 586*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 587*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 588*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 589*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 590*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 591*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 592*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 593*8f23e9faSHans Rosenfeld 594*8f23e9faSHans Rosenfeld 595*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_SOLICIT 2 (Wait on fcf_solicit cmpl) */ 596*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_sol_action, /* STATE_ENTER */ 597*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 598*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 599*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 600*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 601*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 602*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 603*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 604*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 605*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 606*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 607*8f23e9faSHans Rosenfeld 608*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_SOLICIT_FAILED 3 (Transitional) */ 609*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_sol_failed_action, /* STATE_ENTER */ 610*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 611*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 612*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 613*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 614*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 615*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 616*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 617*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 618*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 619*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 620*8f23e9faSHans Rosenfeld 621*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_SOLICIT_CMPL 4 (Wait on fcf timer cmpl) */ 622*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_sol_cmpl_action, /* STATE_ENTER */ 623*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 624*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 625*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 626*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 627*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 628*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 629*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 630*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 631*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 632*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 633*8f23e9faSHans Rosenfeld 634*8f23e9faSHans Rosenfeld 635*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_READ 5 (Wait on fcf_read cmpl) */ 636*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_read_action, /* STATE_ENTER */ 637*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 638*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 639*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 640*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 641*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 642*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 643*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 644*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 645*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 646*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 647*8f23e9faSHans Rosenfeld 648*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_READ_FAILED 6 (Transitional) */ 649*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_read_failed_action, /* STATE_ENTER */ 650*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 651*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 652*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 653*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 654*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 655*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 656*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 657*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 658*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 659*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 660*8f23e9faSHans Rosenfeld 661*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_READ_CMPL 7 (Transitional) */ 662*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_read_cmpl_action, /* STATE_ENTER */ 663*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 664*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 665*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 666*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 667*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 668*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 669*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 670*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 671*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 672*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 673*8f23e9faSHans Rosenfeld 674*8f23e9faSHans Rosenfeld 675*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL 8 (Transitional) */ 676*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_cmpl_action, /* STATE_ENTER */ 677*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 678*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 679*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 680*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 681*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 682*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 683*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_changed_evt_action, /* FCF_CHANGED */ 684*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_full_evt_action, /* TABLE_FULL */ 685*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_online_evt_action, /* FCFI_ONLINE */ 686*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_evt_action, /* FCFI_OFFLINE */ 687*8f23e9faSHans Rosenfeld 688*8f23e9faSHans Rosenfeld /* FCOE_FCFTAB_STATE_FCFI_OFFLINE 9 (Wait for FCFI_OFFLINE event) */ 689*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_fcfi_offline_action, /* STATE_ENTER */ 690*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_shutdown_evt_action, /* SHUTDOWN */ 691*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkup_evt_action, /* LINK_UP */ 692*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_linkdown_evt_action, /* LINK_DOWN */ 693*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_cvl_evt_action, /* CVL_RECD */ 694*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_found_evt_action, /* FCF_FOUND */ 695*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_lost_evt_action, /* FCF_LOST */ 696*8f23e9faSHans Rosenfeld (void *) emlxs_fcoe_fcftab_c