Lines Matching full:node
38 @defgroup device_sm Node State Machine: Remote Device States
68 ocs_node_t *node = io->node; in ocs_d_send_prli_rsp() local
71 if (ocs->fc_type != node->fc_type) { in ocs_d_send_prli_rsp()
72 node_printf(node, "PRLI rejected by target-server, fc-type not supported\n"); in ocs_d_send_prli_rsp()
75 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in ocs_d_send_prli_rsp()
76 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in ocs_d_send_prli_rsp()
80 if (node->sport->enable_tgt && (ocs_scsi_validate_initiator(node) == 0)) { in ocs_d_send_prli_rsp()
81 node_printf(node, "PRLI rejected by target-server\n"); in ocs_d_send_prli_rsp()
84 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in ocs_d_send_prli_rsp()
85 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in ocs_d_send_prli_rsp()
93 ocs_node_transition(node, __ocs_d_device_ready, NULL); in ocs_d_send_prli_rsp()
99 * @brief Device node state machine: Initiate node shutdown
101 * @param ctx Remote node state machine context.
119 ocs_scsi_io_alloc_disable(node); in __ocs_d_initiate_shutdown()
122 if (node->init && !node->targ) { in __ocs_d_initiate_shutdown()
123 ocs_log_debug(node->ocs, in __ocs_d_initiate_shutdown()
125 node->display_name, node->wwpn, node->wwnn); in __ocs_d_initiate_shutdown()
126 ocs_node_transition(node, __ocs_d_wait_del_node, NULL); in __ocs_d_initiate_shutdown()
127 if (node->sport->enable_tgt) { in __ocs_d_initiate_shutdown()
128 rc = ocs_scsi_del_initiator(node, in __ocs_d_initiate_shutdown()
132 ocs_node_post_event(node, in __ocs_d_initiate_shutdown()
135 } else if (node->targ && !node->init) { in __ocs_d_initiate_shutdown()
136 ocs_log_debug(node->ocs, in __ocs_d_initiate_shutdown()
138 node->display_name, node->wwpn, node->wwnn); in __ocs_d_initiate_shutdown()
139 ocs_node_transition(node, __ocs_d_wait_del_node, NULL); in __ocs_d_initiate_shutdown()
140 if (node->sport->enable_ini) { in __ocs_d_initiate_shutdown()
141 rc = ocs_scsi_del_target(node, in __ocs_d_initiate_shutdown()
145 ocs_node_post_event(node, in __ocs_d_initiate_shutdown()
148 } else if (node->init && node->targ) { in __ocs_d_initiate_shutdown()
149 ocs_log_debug(node->ocs, in __ocs_d_initiate_shutdown()
151 node->display_name, node->wwpn, node->wwnn); in __ocs_d_initiate_shutdown()
152 ocs_node_transition(node, __ocs_d_wait_del_ini_tgt, NULL); in __ocs_d_initiate_shutdown()
153 if (node->sport->enable_tgt) { in __ocs_d_initiate_shutdown()
154 rc = ocs_scsi_del_initiator(node, in __ocs_d_initiate_shutdown()
158 ocs_node_post_event(node, in __ocs_d_initiate_shutdown()
162 if (node->sport->enable_ini) { in __ocs_d_initiate_shutdown()
163 rc = ocs_scsi_del_target(node, in __ocs_d_initiate_shutdown()
167 ocs_node_post_event(node, in __ocs_d_initiate_shutdown()
172 /* we've initiated the upcalls as needed, now kick off the node in __ocs_d_initiate_shutdown()
174 * associated with said node in __ocs_d_initiate_shutdown()
180 if (node->attached) { in __ocs_d_initiate_shutdown()
181 /* issue hw node free; don't care if succeeds right away in __ocs_d_initiate_shutdown()
182 * or sometime later, will check node->attached later in in __ocs_d_initiate_shutdown()
185 rc = ocs_hw_node_detach(&ocs->hw, &node->rnode); in __ocs_d_initiate_shutdown()
186 if (node->rnode.free_group) { in __ocs_d_initiate_shutdown()
187 ocs_remote_node_group_free(node->node_group); in __ocs_d_initiate_shutdown()
188 node->node_group = NULL; in __ocs_d_initiate_shutdown()
189 node->rnode.free_group = FALSE; in __ocs_d_initiate_shutdown()
193 node_printf(node, in __ocs_d_initiate_shutdown()
194 "Failed freeing HW node, rc=%d\n", rc); in __ocs_d_initiate_shutdown()
199 if (!node->init && !node->targ){ in __ocs_d_initiate_shutdown()
201 * node has either been detached or is in the process in __ocs_d_initiate_shutdown()
202 * of being detached, call common node's initiate in __ocs_d_initiate_shutdown()
205 ocs_node_initiate_cleanup(node); in __ocs_d_initiate_shutdown()
222 * @brief Device node state machine: Common device event handler.
228 * @param ctx Remote node state machine context.
238 ocs_node_t *node = NULL; in __ocs_d_common() local
241 node = ctx->app; in __ocs_d_common()
242 ocs_assert(node, NULL); in __ocs_d_common()
243 ocs = node->ocs; in __ocs_d_common()
249 ocs_log_debug(ocs, "[%s] %-20s %-20s\n", node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_d_common()
250 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_common()
251 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_common()
254 ocs_log_debug(ocs, "[%s] %-20s %-20s\n", node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_d_common()
255 node->shutdown_reason = OCS_NODE_SHUTDOWN_EXPLICIT_LOGO; in __ocs_d_common()
256 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_common()
259 ocs_log_debug(ocs, "[%s] %-20s %-20s\n", node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_d_common()
260 node->shutdown_reason = OCS_NODE_SHUTDOWN_IMPLICIT_LOGO; in __ocs_d_common()
261 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_common()
274 * @brief Device node state machine: Wait for a domain-attach completion in loop topology.
279 * @param ctx Remote node state machine context.
295 ocs_node_hold_frames(node); in __ocs_d_wait_loop()
299 ocs_node_accept_frames(node); in __ocs_d_wait_loop()
304 ocs_node_init_device(node, TRUE); in __ocs_d_wait_loop()
317 * @brief state: wait for node resume event
319 * State is entered when a node is in I+T mode and sends a delete initiator/target
322 * @param ctx Remote node state machine context.
338 ocs_node_hold_frames(node); in __ocs_d_wait_del_ini_tgt()
348 ocs_node_transition(node, __ocs_d_wait_del_node, NULL); in __ocs_d_wait_del_ini_tgt()
352 ocs_node_accept_frames(node); in __ocs_d_wait_del_ini_tgt()
357 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_del_ini_tgt()
358 node->els_req_cnt--; in __ocs_d_wait_del_ini_tgt()
364 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_del_ini_tgt()
368 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_del_ini_tgt()
383 * @brief state: Wait for node resume event.
385 * State is entered when a node sends a delete initiator/target call to the
388 * @param ctx Remote node state machine context.
404 ocs_node_hold_frames(node); in __ocs_d_wait_del_node()
415 * node has either been detached or is in the process of being detached, in __ocs_d_wait_del_node()
416 * call common node's initiate cleanup function in __ocs_d_wait_del_node()
418 ocs_node_initiate_cleanup(node); in __ocs_d_wait_del_node()
422 ocs_node_accept_frames(node); in __ocs_d_wait_del_node()
427 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_del_node()
428 node->els_req_cnt--; in __ocs_d_wait_del_node()
434 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_del_node()
438 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_del_node()
469 ocs_node_t *node = io->node; in ocs_send_ls_acc_after_attach() local
472 ocs_assert(node->send_ls_acc == OCS_NODE_SEND_LS_ACC_NONE); in ocs_send_ls_acc_after_attach()
474 node->ls_acc_oxid = ox_id; in ocs_send_ls_acc_after_attach()
475 node->send_ls_acc = ls; in ocs_send_ls_acc_after_attach()
476 node->ls_acc_io = io; in ocs_send_ls_acc_after_attach()
477 node->ls_acc_did = fc_be24toh(hdr->d_id); in ocs_send_ls_acc_after_attach()
485 * remote node are extracted and saved in the node object.
487 * @param node Pointer to the node object.
494 ocs_process_prli_payload(ocs_node_t *node, fc_prli_payload_t *prli) in ocs_process_prli_payload() argument
496 node->init = (ocs_be16toh(prli->service_params) & FC_PRLI_INITIATOR_FUNCTION) != 0; in ocs_process_prli_payload()
497 node->targ = (ocs_be16toh(prli->service_params) & FC_PRLI_TARGET_FUNCTION) != 0; in ocs_process_prli_payload()
498 node->fcp2device = (ocs_be16toh(prli->service_params) & FC_PRLI_RETRY) != 0; in ocs_process_prli_payload()
499 node->fc_type = prli->type; in ocs_process_prli_payload()
519 ocs_node_t *node = io->node; in ocs_process_abts() local
520 ocs_t *ocs = node->ocs; in ocs_process_abts()
525 abortio = ocs_io_find_tgt_io(ocs, node, ox_id, rx_id); in ocs_process_abts()
530 node_printf(node, "Abort request: ox_id [%04x] rx_id [%04x]\n", in ocs_process_abts()
561 node_printf(node, "Abort request: ox_id [%04x], IO not found (exists=%d)\n", in ocs_process_abts()
572 * @brief Device node state machine: Wait for the PLOGI accept to complete.
574 * @param ctx Remote node state machine context.
590 ocs_node_hold_frames(node); in __ocs_d_wait_plogi_acc_cmpl()
594 ocs_node_accept_frames(node); in __ocs_d_wait_plogi_acc_cmpl()
598 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_wait_plogi_acc_cmpl()
599 node->els_cmpl_cnt--; in __ocs_d_wait_plogi_acc_cmpl()
600 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_plogi_acc_cmpl()
601 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_wait_plogi_acc_cmpl()
605 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_wait_plogi_acc_cmpl()
606 node->els_cmpl_cnt--; in __ocs_d_wait_plogi_acc_cmpl()
607 ocs_node_transition(node, __ocs_d_port_logged_in, NULL); in __ocs_d_wait_plogi_acc_cmpl()
620 * @brief Device node state machine: Wait for the LOGO response.
622 * @param ctx Remote node state machine context.
640 ocs_node_hold_frames(node); in __ocs_d_wait_logo_rsp()
644 ocs_node_accept_frames(node); in __ocs_d_wait_logo_rsp()
654 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_logo_rsp()
655 node->els_req_cnt--; in __ocs_d_wait_logo_rsp()
656 node_printf(node, "LOGO sent (evt=%s), shutdown node\n", ocs_sm_event_name(evt)); in __ocs_d_wait_logo_rsp()
658 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_wait_logo_rsp()
672 * @brief Device node state machine: Wait for the PRLO response.
674 * @param ctx Remote node state machine context.
690 ocs_node_hold_frames(node); in __ocs_d_wait_prlo_rsp()
694 ocs_node_accept_frames(node); in __ocs_d_wait_prlo_rsp()
703 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_prlo_rsp()
704 node->els_req_cnt--; in __ocs_d_wait_prlo_rsp()
705 node_printf(node, "PRLO sent (evt=%s)\n", ocs_sm_event_name(evt)); in __ocs_d_wait_prlo_rsp()
706 ocs_node_transition(node, __ocs_d_port_logged_in, NULL); in __ocs_d_wait_prlo_rsp()
717 * @brief Initialize device node.
719 * Initialize device node. If a node is an initiator, then send a PLOGI and transition
722 * @param node Pointer to the node object.
729 ocs_node_init_device(ocs_node_t *node, int send_plogi) in ocs_node_init_device() argument
731 node->send_plogi = send_plogi; in ocs_node_init_device()
732 …if ((node->ocs->nodedb_mask & OCS_NODEDB_PAUSE_NEW_NODES) && !FC_ADDR_IS_DOMAIN_CTRL(node->rnode.f… in ocs_node_init_device()
733 node->nodedb_state = __ocs_d_init; in ocs_node_init_device()
734 ocs_node_transition(node, __ocs_node_paused, NULL); in ocs_node_init_device()
736 ocs_node_transition(node, __ocs_d_init, NULL); in ocs_node_init_device()
742 * @brief Device node state machine: Initial node state for an initiator or a target.
745 * This state is entered when a node is instantiated, either having been
748 * @param ctx Remote node state machine context.
770 if (node->send_plogi) { in __ocs_d_init()
772 if (node->sport->enable_ini && node->sport->domain->attached) { in __ocs_d_init()
773 ocs_send_plogi(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, in __ocs_d_init()
775 ocs_node_transition(node, __ocs_d_wait_plogi_rsp, NULL); in __ocs_d_init()
777 node_printf(node, "not sending plogi sport.ini=%d, domain attached=%d\n", in __ocs_d_init()
778 node->sport->enable_ini, node->sport->domain->attached); in __ocs_d_init()
787 ocs_node_save_sparms(node, cbdata->payload->dma.virt); in __ocs_d_init()
791 if (node->sport->domain->attached) { in __ocs_d_init()
792 rc = ocs_node_attach(node); in __ocs_d_init()
793 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_init()
795 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_init()
801 switch (node->sport->topology) { in __ocs_d_init()
804 ocs_domain_attach(node->sport->domain, d_id); in __ocs_d_init()
805 ocs_node_transition(node, __ocs_d_wait_domain_attach, NULL); in __ocs_d_init()
811 ocs_node_transition(node, __ocs_d_wait_domain_attach, NULL); in __ocs_d_init()
818 * node to tell us; in __ocs_d_init()
824 node_printf(node, "received PLOGI, with unknown topology did=0x%x\n", d_id); in __ocs_d_init()
825 ocs_node_transition(node, __ocs_d_wait_topology_notify, NULL); in __ocs_d_init()
828 node_printf(node, "received PLOGI, with unexpectd topology %d\n", in __ocs_d_init()
829 node->sport->topology); in __ocs_d_init()
848 ocs_domain_save_sparms(node->sport->domain, cbdata->payload->dma.virt); in __ocs_d_init()
851 ocs_fabric_set_topology(node, OCS_SPORT_TOPOLOGY_P2P); in __ocs_d_init()
853 if (ocs_p2p_setup(node->sport)) { in __ocs_d_init()
854 node_printf(node, "p2p setup failed, shutting down node\n"); in __ocs_d_init()
855 ocs_node_post_event(node, OCS_EVT_SHUTDOWN, NULL); in __ocs_d_init()
857 ocs_node_transition(node, __ocs_p2p_wait_flogi_acc_cmpl, NULL); in __ocs_d_init()
866 if (!node->sport->domain->attached) { in __ocs_d_init()
868 * shut node down w/ "explicit logout" so pending frames are processed */ in __ocs_d_init()
869 node_printf(node, "%s domain not attached, dropping\n", ocs_sm_event_name(evt)); in __ocs_d_init()
870 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_init()
874 ocs_node_transition(node, __ocs_d_wait_logo_acc_cmpl, NULL); in __ocs_d_init()
884 if (!node->sport->domain->attached) { in __ocs_d_init()
886 * shut node down w/ "explicit logout" so pending frames are processed */ in __ocs_d_init()
887 node_printf(node, "%s domain not attached, dropping\n", ocs_sm_event_name(evt)); in __ocs_d_init()
888 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_init()
891 node_printf(node, "%s received, sending reject\n", ocs_sm_event_name(evt)); in __ocs_d_init()
902 if (!node->sport->domain->attached) { in __ocs_d_init()
904 * shut node down w/ "explicit logout" so pending frames are processed */ in __ocs_d_init()
905 node_printf(node, "%s domain not attached, dropping\n", ocs_sm_event_name(evt)); in __ocs_d_init()
906 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_init()
911 node_printf(node, "FCP_CMND received, send LOGO\n"); in __ocs_d_init()
912 if (ocs_send_logo(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, 0, NULL, NULL) == NULL) { in __ocs_d_init()
913 /* failed to send LOGO, go ahead and cleanup node anyways */ in __ocs_d_init()
914 node_printf(node, "Failed to send LOGO\n"); in __ocs_d_init()
915 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_init()
918 ocs_node_transition(node, __ocs_d_wait_logo_rsp, NULL); in __ocs_d_init()
936 * @brief Device node state machine: Wait on a response for a sent PLOGI.
939 * State is entered when an initiator-capable node has sent
942 * @param ctx Remote node state machine context.
961 /* received PLOGI with svc parms, go ahead and attach node in __ocs_d_wait_plogi_rsp()
967 ocs_node_save_sparms(node, cbdata->payload->dma.virt); in __ocs_d_wait_plogi_rsp()
970 rc = ocs_node_attach(node); in __ocs_d_wait_plogi_rsp()
971 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_wait_plogi_rsp()
973 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_wait_plogi_rsp()
981 * PRLI from the remote node (WCQEs and RCQEs come in on in __ocs_d_wait_plogi_rsp()
986 ocs_process_prli_payload(node, cbdata->payload->dma.virt); in __ocs_d_wait_plogi_rsp()
987 if (ocs->fc_type == node->fc_type) { in __ocs_d_wait_plogi_rsp()
989 ocs_node_transition(node, __ocs_d_wait_plogi_rsp_recvd_prli, NULL); in __ocs_d_wait_plogi_rsp()
1004 node_printf(node, "%s received, sending reject\n", ocs_sm_event_name(evt)); in __ocs_d_wait_plogi_rsp()
1017 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_plogi_rsp()
1018 node->els_req_cnt--; in __ocs_d_wait_plogi_rsp()
1020 ocs_node_save_sparms(node, cbdata->els->els_rsp.virt); in __ocs_d_wait_plogi_rsp()
1021 ocs_display_sparams(node->display_name, "plogi rcvd resp", 0, NULL, in __ocs_d_wait_plogi_rsp()
1023 rc = ocs_node_attach(node); in __ocs_d_wait_plogi_rsp()
1024 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_wait_plogi_rsp()
1026 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_wait_plogi_rsp()
1031 /* PLOGI failed, shutdown the node */ in __ocs_d_wait_plogi_rsp()
1035 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_plogi_rsp()
1036 node->els_req_cnt--; in __ocs_d_wait_plogi_rsp()
1037 ocs_node_post_event(node, OCS_EVT_SHUTDOWN, NULL); in __ocs_d_wait_plogi_rsp()
1044 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_plogi_rsp()
1045 node->els_req_cnt--; in __ocs_d_wait_plogi_rsp()
1052 node_printf(node, "FCP_CMND received, drop\n"); in __ocs_d_wait_plogi_rsp()
1066 * @brief Device node state machine: Waiting on a response for a
1070 * State is entered when an initiator-capable node has sent
1075 * @param ctx Remote node state machine context.
1095 * just need to wait for the PLOGI response to do the node in __ocs_d_wait_plogi_rsp_recvd_prli()
1103 ocs_node_hold_frames(node); in __ocs_d_wait_plogi_rsp_recvd_prli()
1107 ocs_node_accept_frames(node); in __ocs_d_wait_plogi_rsp_recvd_prli()
1115 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_plogi_rsp_recvd_prli()
1116 node->els_req_cnt--; in __ocs_d_wait_plogi_rsp_recvd_prli()
1118 ocs_node_save_sparms(node, cbdata->els->els_rsp.virt); in __ocs_d_wait_plogi_rsp_recvd_prli()
1119 ocs_display_sparams(node->display_name, "plogi rcvd resp", 0, NULL, in __ocs_d_wait_plogi_rsp_recvd_prli()
1121 rc = ocs_node_attach(node); in __ocs_d_wait_plogi_rsp_recvd_prli()
1122 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_wait_plogi_rsp_recvd_prli()
1124 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_wait_plogi_rsp_recvd_prli()
1130 /* PLOGI failed, shutdown the node */ in __ocs_d_wait_plogi_rsp_recvd_prli()
1134 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_plogi_rsp_recvd_prli()
1135 node->els_req_cnt--; in __ocs_d_wait_plogi_rsp_recvd_prli()
1136 ocs_node_post_event(node, OCS_EVT_SHUTDOWN, NULL); in __ocs_d_wait_plogi_rsp_recvd_prli()
1149 * @brief Device node state machine: Wait for a domain attach.
1154 * @param ctx Remote node state machine context.
1171 ocs_node_hold_frames(node); in __ocs_d_wait_domain_attach()
1175 ocs_node_accept_frames(node); in __ocs_d_wait_domain_attach()
1179 ocs_assert(node->sport->domain->attached, NULL); in __ocs_d_wait_domain_attach()
1181 rc = ocs_node_attach(node); in __ocs_d_wait_domain_attach()
1182 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_wait_domain_attach()
1184 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_wait_domain_attach()
1197 * @brief Device node state machine: Wait for topology
1201 * Waits for topology notification from fabric node, then
1202 * attaches domain and node.
1204 * @param ctx Remote node state machine context.
1221 ocs_node_hold_frames(node); in __ocs_d_wait_topology_notify()
1225 ocs_node_accept_frames(node); in __ocs_d_wait_topology_notify()
1230 ocs_assert(!node->sport->domain->attached, NULL); in __ocs_d_wait_topology_notify()
1231 ocs_assert(node->send_ls_acc == OCS_NODE_SEND_LS_ACC_PLOGI, NULL); in __ocs_d_wait_topology_notify()
1232 node_printf(node, "topology notification, topology=%d\n", topology); in __ocs_d_wait_topology_notify()
1235 * so we didn't know which node would perform the domain attach: in __ocs_d_wait_topology_notify()
1236 * 1. The node from which the PLOGI was sent (p2p) or in __ocs_d_wait_topology_notify()
1237 * 2. The node to which the FLOGI was sent (fabric). in __ocs_d_wait_topology_notify()
1243 ocs_domain_attach(node->sport->domain, node->ls_acc_did); in __ocs_d_wait_topology_notify()
1246 * by the fabric node (node sending FLOGI); just wait for attach in __ocs_d_wait_topology_notify()
1250 ocs_node_transition(node, __ocs_d_wait_domain_attach, NULL); in __ocs_d_wait_topology_notify()
1254 ocs_assert(node->sport->domain->attached, NULL); in __ocs_d_wait_topology_notify()
1255 node_printf(node, "domain attach ok\n"); in __ocs_d_wait_topology_notify()
1257 rc = ocs_node_attach(node); in __ocs_d_wait_topology_notify()
1258 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_d_wait_topology_notify()
1260 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_d_wait_topology_notify()
1273 * @brief Device node state machine: Wait for a node attach when found by a remote node.
1275 * @param ctx Remote node state machine context.
1291 ocs_node_hold_frames(node); in __ocs_d_wait_node_attach()
1295 ocs_node_accept_frames(node); in __ocs_d_wait_node_attach()
1299 node->attached = TRUE; in __ocs_d_wait_node_attach()
1300 switch (node->send_ls_acc) { in __ocs_d_wait_node_attach()
1304 ocs_send_plogi_acc(node->ls_acc_io, node->ls_acc_oxid, NULL, NULL); in __ocs_d_wait_node_attach()
1305 ocs_node_transition(node, __ocs_d_wait_plogi_acc_cmpl, NULL); in __ocs_d_wait_node_attach()
1306 node->send_ls_acc = OCS_NODE_SEND_LS_ACC_NONE; in __ocs_d_wait_node_attach()
1307 node->ls_acc_io = NULL; in __ocs_d_wait_node_attach()
1311 ocs_d_send_prli_rsp(node->ls_acc_io, node->ls_acc_oxid); in __ocs_d_wait_node_attach()
1312 node->send_ls_acc = OCS_NODE_SEND_LS_ACC_NONE; in __ocs_d_wait_node_attach()
1313 node->ls_acc_io = NULL; in __ocs_d_wait_node_attach()
1320 ocs_node_transition(node, __ocs_d_port_logged_in, NULL); in __ocs_d_wait_node_attach()
1326 /* node attach failed, shutdown the node */ in __ocs_d_wait_node_attach()
1327 node->attached = FALSE; in __ocs_d_wait_node_attach()
1328 node_printf(node, "node attach failed\n"); in __ocs_d_wait_node_attach()
1329 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_node_attach()
1330 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_wait_node_attach()
1335 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_node_attach()
1336 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_node_attach()
1337 ocs_node_transition(node, __ocs_d_wait_attach_evt_shutdown, NULL); in __ocs_d_wait_node_attach()
1340 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_node_attach()
1341 node->shutdown_reason = OCS_NODE_SHUTDOWN_EXPLICIT_LOGO; in __ocs_d_wait_node_attach()
1342 ocs_node_transition(node, __ocs_d_wait_attach_evt_shutdown, NULL); in __ocs_d_wait_node_attach()
1345 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_node_attach()
1346 node->shutdown_reason = OCS_NODE_SHUTDOWN_IMPLICIT_LOGO; in __ocs_d_wait_node_attach()
1347 ocs_node_transition(node, __ocs_d_wait_attach_evt_shutdown, NULL); in __ocs_d_wait_node_attach()
1359 * @brief Device node state machine: Wait for a node/domain
1360 * attach then shutdown node.
1362 * @param ctx Remote node state machine context.
1378 ocs_node_hold_frames(node); in __ocs_d_wait_attach_evt_shutdown()
1382 ocs_node_accept_frames(node); in __ocs_d_wait_attach_evt_shutdown()
1387 node->attached = TRUE; in __ocs_d_wait_attach_evt_shutdown()
1388 node_printf(node, "Attach evt=%s, proceed to shutdown\n", ocs_sm_event_name(evt)); in __ocs_d_wait_attach_evt_shutdown()
1389 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_wait_attach_evt_shutdown()
1393 /* node attach failed, shutdown the node */ in __ocs_d_wait_attach_evt_shutdown()
1394 node->attached = FALSE; in __ocs_d_wait_attach_evt_shutdown()
1395 node_printf(node, "Attach evt=%s, proceed to shutdown\n", ocs_sm_event_name(evt)); in __ocs_d_wait_attach_evt_shutdown()
1396 ocs_node_transition(node, __ocs_d_initiate_shutdown, NULL); in __ocs_d_wait_attach_evt_shutdown()
1402 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_d_wait_attach_evt_shutdown()
1406 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_d_wait_attach_evt_shutdown()
1419 * @brief Device node state machine: Port is logged in.
1424 * @param ctx Remote node state machine context.
1443 if (node->sport->enable_ini && !FC_ADDR_IS_DOMAIN_CTRL(node->rnode.fc_id) in __ocs_d_port_logged_in()
1444 && !node->sent_prli) { in __ocs_d_port_logged_in()
1446 ocs_send_prli(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_d_port_logged_in()
1447 node->sent_prli = TRUE; in __ocs_d_port_logged_in()
1454 if (node->sport->enable_tgt) { in __ocs_d_port_logged_in()
1455 if (ocs_send_prlo(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, in __ocs_d_port_logged_in()
1457 ocs_node_transition(node, __ocs_d_wait_prlo_rsp, NULL); in __ocs_d_port_logged_in()
1468 ocs_process_prli_payload(node, cbdata->payload->dma.virt); in __ocs_d_port_logged_in()
1478 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_port_logged_in()
1479 node->els_req_cnt--; in __ocs_d_port_logged_in()
1481 ocs_process_prli_payload(node, cbdata->els->els_rsp.virt); in __ocs_d_port_logged_in()
1482 ocs_node_transition(node, __ocs_d_device_ready, NULL); in __ocs_d_port_logged_in()
1487 /* I, I+T, assume some link failure, shutdown node */ in __ocs_d_port_logged_in()
1491 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_port_logged_in()
1492 node->els_req_cnt--; in __ocs_d_port_logged_in()
1493 ocs_node_post_event(node, OCS_EVT_SHUTDOWN, NULL); in __ocs_d_port_logged_in()
1499 /* Node doesn't want to be a target, stay here and wait for a PRLI from the remote node in __ocs_d_port_logged_in()
1504 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_port_logged_in()
1505 node->els_req_cnt--; in __ocs_d_port_logged_in()
1512 * do nothing. (note: as T only we could shutdown the node) in __ocs_d_port_logged_in()
1514 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_port_logged_in()
1515 node->els_cmpl_cnt--; in __ocs_d_port_logged_in()
1522 ocs_node_save_sparms(node, cbdata->payload->dma.virt); in __ocs_d_port_logged_in()
1525 /* Restart node attach with new service parameters, and send ACC */ in __ocs_d_port_logged_in()
1526 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_IMPLICIT_LOGO, NULL); in __ocs_d_port_logged_in()
1533 node_printf(node, "%s received attached=%d\n", ocs_sm_event_name(evt), node->attached); in __ocs_d_port_logged_in()
1535 ocs_node_transition(node, __ocs_d_wait_logo_acc_cmpl, NULL); in __ocs_d_port_logged_in()
1549 * @brief Device node state machine: Wait for a LOGO accept.
1554 * @param ctx Remote node state machine context.
1570 ocs_node_hold_frames(node); in __ocs_d_wait_logo_acc_cmpl()
1574 ocs_node_accept_frames(node); in __ocs_d_wait_logo_acc_cmpl()
1580 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_wait_logo_acc_cmpl()
1581 node->els_cmpl_cnt--; in __ocs_d_wait_logo_acc_cmpl()
1582 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_wait_logo_acc_cmpl()
1594 * @brief Device node state machine: Device is ready.
1596 * @param ctx Remote node state machine context.
1615 node->fcp_enabled = TRUE; in __ocs_d_device_ready()
1616 if (node->init) { in __ocs_d_device_ready()
1617 device_printf(ocs->dev, "[%s] found (initiator) WWPN %s WWNN %s\n", node->display_name, in __ocs_d_device_ready()
1618 node->wwpn, node->wwnn); in __ocs_d_device_ready()
1619 if (node->sport->enable_tgt) in __ocs_d_device_ready()
1620 ocs_scsi_new_initiator(node); in __ocs_d_device_ready()
1622 if (node->targ) { in __ocs_d_device_ready()
1623 device_printf(ocs->dev, "[%s] found (target) WWPN %s WWNN %s\n", node->display_name, in __ocs_d_device_ready()
1624 node->wwpn, node->wwnn); in __ocs_d_device_ready()
1625 if (node->sport->enable_ini) in __ocs_d_device_ready()
1626 ocs_scsi_new_target(node); in __ocs_d_device_ready()
1631 node->fcp_enabled = FALSE; in __ocs_d_device_ready()
1637 ocs_node_save_sparms(node, cbdata->payload->dma.virt); in __ocs_d_device_ready()
1640 /* Restart node attach with new service parameters, and send ACC */ in __ocs_d_device_ready()
1641 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_IMPLICIT_LOGO, NULL); in __ocs_d_device_ready()
1655 ocs_process_prli_payload(node, cbdata->payload->dma.virt); in __ocs_d_device_ready()
1658 if (ocs->fc_type == node->fc_type) in __ocs_d_device_ready()
1682 node_printf(node, "%s received attached=%d\n", ocs_sm_event_name(evt), node->attached); in __ocs_d_device_ready()
1684 ocs_node_transition(node, __ocs_d_wait_logo_acc_cmpl, NULL); in __ocs_d_device_ready()
1712 if (node->sport->enable_rscn) { in __ocs_d_device_ready()
1713 ocs_node_transition(node, __ocs_d_device_gone, NULL); in __ocs_d_device_ready()
1719 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_device_ready()
1720 node->els_cmpl_cnt--; in __ocs_d_device_ready()
1725 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_d_device_ready()
1726 node->els_cmpl_cnt--; in __ocs_d_device_ready()
1727 node_printf(node, "Failed to send PRLI LS_ACC\n"); in __ocs_d_device_ready()
1740 * @brief Device node state machine: Node is gone (absent from GID_PT).
1743 * State entered when a node is detected as being gone (absent from GID_PT).
1745 * @param ctx Remote node state machine context.
1766 device_printf(ocs->dev, "[%s] missing (%s) WWPN %s WWNN %s\n", node->display_name, in __ocs_d_device_gone()
1767 labels[(node->targ << 1) | (node->init)], node->wwpn, node->wwnn); in __ocs_d_device_gone()
1769 switch(ocs_node_get_enable(node)) { in __ocs_d_device_gone()
1773 rc = ocs_scsi_del_target(node, OCS_SCSI_TARGET_MISSING); in __ocs_d_device_gone()
1779 rc = ocs_scsi_del_initiator(node, OCS_SCSI_INITIATOR_MISSING); in __ocs_d_device_gone()
1783 rc = ocs_scsi_del_initiator(node, OCS_SCSI_INITIATOR_MISSING); in __ocs_d_device_gone()
1787 rc = ocs_scsi_del_target(node, OCS_SCSI_TARGET_MISSING); in __ocs_d_device_gone()
1791 rc = ocs_scsi_del_initiator(node, OCS_SCSI_INITIATOR_MISSING); in __ocs_d_device_gone()
1792 rc_2 = ocs_scsi_del_target(node, OCS_SCSI_TARGET_MISSING); in __ocs_d_device_gone()
1801 ocs_node_post_event(node, OCS_EVT_SHUTDOWN, NULL); in __ocs_d_device_gone()
1810 /* ocs_node_transition(node, __ocs_d_discovered, NULL); */ in __ocs_d_device_gone()
1814 ocs_send_adisc(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_d_device_gone()
1815 ocs_node_transition(node, __ocs_d_wait_adisc_rsp, NULL); in __ocs_d_device_gone()
1821 ocs_node_save_sparms(node, cbdata->payload->dma.virt); in __ocs_d_device_gone()
1824 /* Restart node attach with new service parameters, and send ACC */ in __ocs_d_device_gone()
1825 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_IMPLICIT_LOGO, NULL); in __ocs_d_device_gone()
1833 node_printf(node, "FCP_CMND received, drop\n"); in __ocs_d_device_gone()
1839 node_printf(node, "%s received attached=%d\n", ocs_sm_event_name(evt), node->attached); in __ocs_d_device_gone()
1842 ocs_node_transition(node, __ocs_d_wait_logo_acc_cmpl, NULL); in __ocs_d_device_gone()
1855 * @brief Device node state machine: Wait for the ADISC response.
1858 * Waits for the ADISC response from the remote node.
1860 * @param ctx Remote node state machine context.
1880 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_adisc_rsp()
1881 node->els_req_cnt--; in __ocs_d_wait_adisc_rsp()
1882 ocs_node_transition(node, __ocs_d_device_ready, NULL); in __ocs_d_wait_adisc_rsp()
1887 * event which will unregister the node, and start over with PLOGI in __ocs_d_wait_adisc_rsp()
1892 ocs_assert(node->els_req_cnt, NULL); in __ocs_d_wait_adisc_rsp()
1893 node->els_req_cnt--; in __ocs_d_wait_adisc_rsp()
1895 ocs_node_post_event(node, OCS_EVT_SHUTDOWN_EXPLICIT_LOGO, NULL); in __ocs_d_wait_adisc_rsp()
1904 node_printf(node, "%s received attached=%d\n", ocs_sm_event_name(evt), node->attached); in __ocs_d_wait_adisc_rsp()
1906 ocs_node_transition(node, __ocs_d_wait_logo_acc_cmpl, NULL); in __ocs_d_wait_adisc_rsp()