Lines Matching full:node

35  * This file implements remote node state machines for:
43 @defgroup fabric_sm Node State Machine: Fabric States
44 @defgroup ns_sm Node State Machine: Name/Directory Services States
45 @defgroup p2p_sm Node State Machine: Point-to-Point Node States
53 static void ocs_fabric_initiate_shutdown(ocs_node_t *node);
57 static int32_t ocs_process_gidpt_payload(ocs_node_t *node, fcct_gidpt_acc_t *gidpt, uint32_t gidpt_…
58 static void ocs_process_rscn(ocs_node_t *node, ocs_node_cb_t *cbdata);
64 * @brief Fabric node state machine: Initial state.
69 * @param ctx Remote node sm context.
84 ocs_log_debug(node->ocs, ">>> reenter !!\n"); in __ocs_fabric_init()
88 ocs_send_flogi(node, OCS_FC_FLOGI_TIMEOUT_SEC, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_fabric_init()
89 ocs_node_transition(node, __ocs_fabric_flogi_wait_rsp, NULL); in __ocs_fabric_init()
107 * @param node Pointer to the node for which the topology is set.
113 ocs_fabric_set_topology(ocs_node_t *node, ocs_sport_topology_e topology) in ocs_fabric_set_topology() argument
115 node->sport->topology = topology; in ocs_fabric_set_topology()
123 * @param node Pointer to the node for which the topology is set.
127 ocs_fabric_notify_topology(ocs_node_t *node) in ocs_fabric_notify_topology() argument
131 ocs_sport_topology_e topology = node->sport->topology; in ocs_fabric_notify_topology()
134 ocs_sport_lock(node->sport); in ocs_fabric_notify_topology()
135 ocs_list_foreach_safe(&node->sport->node_list, tmp_node, next) { in ocs_fabric_notify_topology()
136 if (tmp_node != node) { in ocs_fabric_notify_topology()
140 ocs_sport_unlock(node->sport); in ocs_fabric_notify_topology()
145 * @brief Fabric node state machine: Wait for an FLOGI response.
150 * @param ctx Remote node state machine context.
170 ocs_assert(node->els_req_cnt, NULL); in __ocs_fabric_flogi_wait_rsp()
171 node->els_req_cnt--; in __ocs_fabric_flogi_wait_rsp()
173 ocs_domain_save_sparms(node->sport->domain, cbdata->els->els_rsp.virt); in __ocs_fabric_flogi_wait_rsp()
175 ocs_display_sparams(node->display_name, "flogi rcvd resp", 0, NULL, in __ocs_fabric_flogi_wait_rsp()
181 ocs_fabric_set_topology(node, OCS_SPORT_TOPOLOGY_P2P); in __ocs_fabric_flogi_wait_rsp()
182 if (ocs_p2p_setup(node->sport)) { in __ocs_fabric_flogi_wait_rsp()
183 node_printf(node, "p2p setup failed, shutting down node\n"); in __ocs_fabric_flogi_wait_rsp()
184 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabric_flogi_wait_rsp()
185 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_flogi_wait_rsp()
187 if (node->sport->p2p_winner) { in __ocs_fabric_flogi_wait_rsp()
188 ocs_node_transition(node, __ocs_p2p_wait_domain_attach, NULL); in __ocs_fabric_flogi_wait_rsp()
189 if (!node->sport->domain->attached) { in __ocs_fabric_flogi_wait_rsp()
190 node_printf(node, "p2p winner, domain not attached\n"); in __ocs_fabric_flogi_wait_rsp()
191 ocs_domain_attach(node->sport->domain, node->sport->p2p_port_id); in __ocs_fabric_flogi_wait_rsp()
194 node_printf(node, "p2p winner, domain already attached\n"); in __ocs_fabric_flogi_wait_rsp()
195 ocs_node_post_event(node, OCS_EVT_DOMAIN_ATTACH_OK, NULL); in __ocs_fabric_flogi_wait_rsp()
199 * remote SID=1 node; this node has served its purpose in __ocs_fabric_flogi_wait_rsp()
201 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabric_flogi_wait_rsp()
202 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_flogi_wait_rsp()
208 ocs_fabric_set_topology(node, OCS_SPORT_TOPOLOGY_FABRIC); in __ocs_fabric_flogi_wait_rsp()
209 ocs_fabric_notify_topology(node); in __ocs_fabric_flogi_wait_rsp()
210 ocs_assert(!node->sport->domain->attached, NULL); in __ocs_fabric_flogi_wait_rsp()
211 ocs_domain_attach(node->sport->domain, cbdata->ext_status); in __ocs_fabric_flogi_wait_rsp()
212 ocs_node_transition(node, __ocs_fabric_wait_domain_attach, NULL); in __ocs_fabric_flogi_wait_rsp()
221 ocs_sport_t *sport = node->sport; in __ocs_fabric_flogi_wait_rsp()
229 ocs_assert(node->els_req_cnt, NULL); in __ocs_fabric_flogi_wait_rsp()
230 node->els_req_cnt--; in __ocs_fabric_flogi_wait_rsp()
232 if (node->sport->topology == OCS_SPORT_TOPOLOGY_P2P && !node->sport->p2p_winner) { in __ocs_fabric_flogi_wait_rsp()
233 node_printf(node, "FLOGI failed, peer p2p winner, shutdown node\n"); in __ocs_fabric_flogi_wait_rsp()
234 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabric_flogi_wait_rsp()
235 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_flogi_wait_rsp()
239 node_printf(node, "FLOGI failed evt=%s, shutting down sport [%s]\n", ocs_sm_event_name(evt), in __ocs_fabric_flogi_wait_rsp()
255 * @brief Fabric node state machine: Initial state for a virtual port.
260 * @param ctx Remote node state machine context.
276 ocs_send_fdisc(node, OCS_FC_FLOGI_TIMEOUT_SEC, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_vport_fabric_init()
277 ocs_node_transition(node, __ocs_fabric_fdisc_wait_rsp, NULL); in __ocs_vport_fabric_init()
290 * @brief Fabric node state machine: Wait for an FDISC response
295 * @param ctx Remote node state machine context.
316 ocs_display_sparams(node->display_name, "fdisc rcvd resp", 0, NULL, in __ocs_fabric_fdisc_wait_rsp()
319 ocs_assert(node->els_req_cnt, NULL); in __ocs_fabric_fdisc_wait_rsp()
320 node->els_req_cnt--; in __ocs_fabric_fdisc_wait_rsp()
322 ocs_sport_attach(node->sport, cbdata->ext_status); in __ocs_fabric_fdisc_wait_rsp()
323 ocs_node_transition(node, __ocs_fabric_wait_domain_attach, NULL); in __ocs_fabric_fdisc_wait_rsp()
332 ocs_assert(node->els_req_cnt, NULL); in __ocs_fabric_fdisc_wait_rsp()
333 node->els_req_cnt--; in __ocs_fabric_fdisc_wait_rsp()
336 ocs_sm_post_event(&node->sport->sm, OCS_EVT_SHUTDOWN, NULL); in __ocs_fabric_fdisc_wait_rsp()
350 * @brief Fabric node state machine: Wait for a domain/sport attach event.
355 * @param ctx Remote node state machine context.
370 ocs_node_hold_frames(node); in __ocs_fabric_wait_domain_attach()
374 ocs_node_accept_frames(node); in __ocs_fabric_wait_domain_attach()
380 rc = ocs_start_ns_node(node->sport); in __ocs_fabric_wait_domain_attach()
384 /* sm: if enable_ini / start fabctl node in __ocs_fabric_wait_domain_attach()
386 if (node->sport->enable_rscn) { in __ocs_fabric_wait_domain_attach()
387 rc = ocs_start_fabctl_node(node->sport); in __ocs_fabric_wait_domain_attach()
391 ocs_node_transition(node, __ocs_fabric_idle, NULL); in __ocs_fabric_wait_domain_attach()
404 * @brief Fabric node state machine: Fabric node is idle.
407 * Wait for fabric node events.
409 * @param ctx Remote node state machine context.
435 * @brief Name services node state machine: Initialize.
438 * A PLOGI is sent to the well-known name/directory services node.
440 * @param ctx Remote node state machine context.
456 ocs_send_plogi(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_ns_init()
457 ocs_node_transition(node, __ocs_ns_plogi_wait_rsp, NULL); in __ocs_ns_init()
469 * @brief Name services node state machine: Wait for a PLOGI response.
472 * Waits for a response from PLOGI to name services node, then issues a
473 * node attach request to the HW.
475 * @param ctx Remote node state machine context.
496 ocs_assert(node->els_req_cnt, NULL); in __ocs_ns_plogi_wait_rsp()
497 node->els_req_cnt--; in __ocs_ns_plogi_wait_rsp()
499 ocs_node_save_sparms(node, cbdata->els->els_rsp.virt); in __ocs_ns_plogi_wait_rsp()
500 ocs_display_sparams(node->display_name, "plogi rcvd resp", 0, NULL, in __ocs_ns_plogi_wait_rsp()
502 rc = ocs_node_attach(node); in __ocs_ns_plogi_wait_rsp()
503 ocs_node_transition(node, __ocs_ns_wait_node_attach, NULL); in __ocs_ns_plogi_wait_rsp()
505 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_ns_plogi_wait_rsp()
519 * @brief Name services node state machine: Wait for a node attach completion.
522 * Waits for a node attach completion, then issues an RFTID name services
525 * @param ctx Remote node state machine context.
540 ocs_node_hold_frames(node); in __ocs_ns_wait_node_attach()
544 ocs_node_accept_frames(node); in __ocs_ns_wait_node_attach()
548 node->attached = TRUE; in __ocs_ns_wait_node_attach()
550 ocs_ns_send_rftid(node, OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT, in __ocs_ns_wait_node_attach()
552 ocs_node_transition(node, __ocs_ns_rftid_wait_rsp, NULL); in __ocs_ns_wait_node_attach()
556 /* node attach failed, shutdown the node */ in __ocs_ns_wait_node_attach()
557 node->attached = FALSE; in __ocs_ns_wait_node_attach()
558 node_printf(node, "Node attach failed\n"); in __ocs_ns_wait_node_attach()
559 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_ns_wait_node_attach()
560 ocs_fabric_initiate_shutdown(node); in __ocs_ns_wait_node_attach()
564 node_printf(node, "Shutdown event received\n"); in __ocs_ns_wait_node_attach()
565 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_ns_wait_node_attach()
566 ocs_node_transition(node, __ocs_fabric_wait_attach_evt_shutdown, NULL); in __ocs_ns_wait_node_attach()
570 * we haven't sent GID_PT yet (ACC sent by fabctl node) */ in __ocs_ns_wait_node_attach()
584 * @brief Wait for a domain/sport/node attach completion, then
588 * Waits for a domain/sport/node attach completion, then shuts
589 * node down.
591 * @param ctx Remote node state machine context.
606 ocs_node_hold_frames(node); in __ocs_fabric_wait_attach_evt_shutdown()
610 ocs_node_accept_frames(node); in __ocs_fabric_wait_attach_evt_shutdown()
615 node->attached = TRUE; in __ocs_fabric_wait_attach_evt_shutdown()
616 node_printf(node, "Attach evt=%s, proceed to shutdown\n", ocs_sm_event_name(evt)); in __ocs_fabric_wait_attach_evt_shutdown()
617 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_wait_attach_evt_shutdown()
621 node->attached = FALSE; in __ocs_fabric_wait_attach_evt_shutdown()
622 node_printf(node, "Attach evt=%s, proceed to shutdown\n", ocs_sm_event_name(evt)); in __ocs_fabric_wait_attach_evt_shutdown()
623 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_wait_attach_evt_shutdown()
628 node_printf(node, "Shutdown event received\n"); in __ocs_fabric_wait_attach_evt_shutdown()
641 * @brief Name services node state machine: Wait for an RFTID response event.
647 * @param ctx Remote node state machine context.
665 ocs_assert(node->els_req_cnt, NULL); in __ocs_ns_rftid_wait_rsp()
666 node->els_req_cnt--; in __ocs_ns_rftid_wait_rsp()
668 ocs_ns_send_rffid(node, OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT, in __ocs_ns_rftid_wait_rsp()
670 ocs_node_transition(node, __ocs_ns_rffid_wait_rsp, NULL); in __ocs_ns_rftid_wait_rsp()
674 * we haven't sent GID_PT yet (ACC sent by fabctl node) */ in __ocs_ns_rftid_wait_rsp()
688 * @brief Fabric node state machine: Wait for RFFID response event.
694 * @param ctx Remote node state machine context.
712 ocs_assert(node->els_req_cnt, NULL); in __ocs_ns_rffid_wait_rsp()
713 node->els_req_cnt--; in __ocs_ns_rffid_wait_rsp()
714 if (node->sport->enable_rscn) { in __ocs_ns_rffid_wait_rsp()
716 ocs_ns_send_gidpt(node, OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT, in __ocs_ns_rffid_wait_rsp()
718 ocs_node_transition(node, __ocs_ns_gidpt_wait_rsp, NULL); in __ocs_ns_rffid_wait_rsp()
721 ocs_node_transition(node, __ocs_ns_idle, NULL); in __ocs_ns_rffid_wait_rsp()
726 * we haven't sent GID_PT yet (ACC sent by fabctl node) */ in __ocs_ns_rffid_wait_rsp()
740 * @brief Name services node state machine: Wait for a GIDPT response.
746 * @param ctx Remote node state machine context.
765 ocs_assert(node->els_req_cnt, NULL); in __ocs_ns_gidpt_wait_rsp()
766 node->els_req_cnt--; in __ocs_ns_gidpt_wait_rsp()
768 ocs_process_gidpt_payload(node, cbdata->els->els_rsp.virt, cbdata->els->els_rsp.len); in __ocs_ns_gidpt_wait_rsp()
770 ocs_node_transition(node, __ocs_ns_idle, NULL); in __ocs_ns_gidpt_wait_rsp()
776 node_printf(node, "GID_PT failed to complete\n"); in __ocs_ns_gidpt_wait_rsp()
777 ocs_assert(node->els_req_cnt, NULL); in __ocs_ns_gidpt_wait_rsp()
778 node->els_req_cnt--; in __ocs_ns_gidpt_wait_rsp()
779 ocs_node_transition(node, __ocs_ns_idle, NULL); in __ocs_ns_gidpt_wait_rsp()
785 node_printf(node, "RSCN received during GID_PT processing\n"); in __ocs_ns_gidpt_wait_rsp()
786 node->rscn_pending = 1; in __ocs_ns_gidpt_wait_rsp()
800 * @brief Name services node state machine: Idle state.
806 * @param ctx Remote node state machine context.
821 if (!node->rscn_pending) { in __ocs_ns_idle()
824 node_printf(node, "RSCN pending, restart discovery\n"); in __ocs_ns_idle()
825 node->rscn_pending = 0; in __ocs_ns_idle()
835 if ((ocs->tgt_rscn_delay_msec != 0) && !node->sport->enable_ini && node->sport->enable_tgt && in __ocs_ns_idle()
837 ocs_node_transition(node, __ocs_ns_gidpt_delay, NULL); in __ocs_ns_idle()
839 ocs_ns_send_gidpt(node, OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT, in __ocs_ns_idle()
841 ocs_node_transition(node, __ocs_ns_gidpt_wait_rsp, NULL); in __ocs_ns_idle()
858 * Post an OCS_EVT_GIDPT_DEIALY_EXPIRED event to the passed in node.
860 * @param arg Pointer to node.
867 ocs_node_t *node = arg; in gidpt_delay_timer_cb() local
870 ocs_del_timer(&node->gidpt_delay_timer); in gidpt_delay_timer_cb()
871 …rc = ocs_xport_control(node->ocs->xport, OCS_XPORT_POST_NODE_EVENT, node, OCS_EVT_GIDPT_DELAY_EXPI… in gidpt_delay_timer_cb()
873 ocs_log_err(node->ocs, "ocs_xport_control(OCS_XPORT_POST_NODE_EVENT) failed: %d\n", rc); in gidpt_delay_timer_cb()
879 * @brief Name services node state machine: Delayed GIDPT.
884 * @param ctx Remote node state machine context.
908 if ((ocs_msectime() - node->time_last_gidpt_msec) < ocs->tgt_rscn_period_msec) { in __ocs_ns_gidpt_delay()
912 ocs_setup_timer(ocs, &node->gidpt_delay_timer, gidpt_delay_timer_cb, node, delay_msec); in __ocs_ns_gidpt_delay()
918 node->time_last_gidpt_msec = ocs_msectime(); in __ocs_ns_gidpt_delay()
919 ocs_ns_send_gidpt(node, OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT, in __ocs_ns_gidpt_delay()
921 ocs_node_transition(node, __ocs_ns_gidpt_wait_rsp, NULL); in __ocs_ns_gidpt_delay()
939 * @brief Fabric controller node state machine: Initial state.
944 * @param ctx Remote node state machine context.
953 ocs_node_t *node = ctx->app; in __ocs_fabctl_init() local
960 ocs_send_scr(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_fabctl_init()
961 ocs_node_transition(node, __ocs_fabctl_wait_scr_rsp, NULL); in __ocs_fabctl_init()
965 node->attached = TRUE; in __ocs_fabctl_init()
978 * @brief Fabric controller node state machine: Wait for a node attach request
982 * Wait for a node attach to complete. If successful, issue an SCR
985 * @param ctx Remote node state machine context.
1001 ocs_node_hold_frames(node); in __ocs_fabctl_wait_node_attach()
1005 ocs_node_accept_frames(node); in __ocs_fabctl_wait_node_attach()
1009 node->attached = TRUE; in __ocs_fabctl_wait_node_attach()
1011 ocs_send_scr(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_fabctl_wait_node_attach()
1012 ocs_node_transition(node, __ocs_fabctl_wait_scr_rsp, NULL); in __ocs_fabctl_wait_node_attach()
1016 /* node attach failed, shutdown the node */ in __ocs_fabctl_wait_node_attach()
1017 node->attached = FALSE; in __ocs_fabctl_wait_node_attach()
1018 node_printf(node, "Node attach failed\n"); in __ocs_fabctl_wait_node_attach()
1019 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabctl_wait_node_attach()
1020 ocs_fabric_initiate_shutdown(node); in __ocs_fabctl_wait_node_attach()
1024 node_printf(node, "Shutdown event received\n"); in __ocs_fabctl_wait_node_attach()
1025 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabctl_wait_node_attach()
1026 ocs_node_transition(node, __ocs_fabric_wait_attach_evt_shutdown, NULL); in __ocs_fabctl_wait_node_attach()
1039 * @brief Fabric controller node state machine: Wait for an SCR response from the
1045 * @param ctx Remote node state machine context.
1063 ocs_assert(node->els_req_cnt, NULL); in __ocs_fabctl_wait_scr_rsp()
1064 node->els_req_cnt--; in __ocs_fabctl_wait_scr_rsp()
1065 ocs_node_transition(node, __ocs_fabctl_ready, NULL); in __ocs_fabctl_wait_scr_rsp()
1078 * @brief Fabric controller node state machine: Ready.
1082 * by this node and is forwarded to the name services node object; and
1085 * @param ctx Remote node state machine context.
1104 /* sm: / process RSCN (forward to name services node), in __ocs_fabctl_ready()
1106 ocs_process_rscn(node, cbdata); in __ocs_fabctl_ready()
1108 ocs_node_transition(node, __ocs_fabctl_wait_ls_acc_cmpl, NULL); in __ocs_fabctl_ready()
1122 * @brief Fabric controller node state machine: Wait for LS_ACC.
1127 * @param ctx Remote node state machine context.
1143 ocs_node_hold_frames(node); in __ocs_fabctl_wait_ls_acc_cmpl()
1147 ocs_node_accept_frames(node); in __ocs_fabctl_wait_ls_acc_cmpl()
1151 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_fabctl_wait_ls_acc_cmpl()
1152 node->els_cmpl_cnt--; in __ocs_fabctl_wait_ls_acc_cmpl()
1153 ocs_node_transition(node, __ocs_fabctl_ready, NULL); in __ocs_fabctl_wait_ls_acc_cmpl()
1166 * @brief Initiate fabric node shutdown.
1168 * @param node Node for which shutdown is initiated.
1174 ocs_fabric_initiate_shutdown(ocs_node_t *node) in ocs_fabric_initiate_shutdown() argument
1177 ocs_t *ocs = node->ocs; in ocs_fabric_initiate_shutdown()
1178 ocs_scsi_io_alloc_disable(node); in ocs_fabric_initiate_shutdown()
1180 if (node->attached) { in ocs_fabric_initiate_shutdown()
1181 /* issue hw node free; don't care if succeeds right away in ocs_fabric_initiate_shutdown()
1182 * or sometime later, will check node->attached later in in ocs_fabric_initiate_shutdown()
1185 rc = ocs_hw_node_detach(&ocs->hw, &node->rnode); in ocs_fabric_initiate_shutdown()
1186 if (node->rnode.free_group) { in ocs_fabric_initiate_shutdown()
1187 ocs_remote_node_group_free(node->node_group); in ocs_fabric_initiate_shutdown()
1188 node->node_group = NULL; in ocs_fabric_initiate_shutdown()
1189 node->rnode.free_group = FALSE; in ocs_fabric_initiate_shutdown()
1192 node_printf(node, "Failed freeing HW node, rc=%d\n", rc); in ocs_fabric_initiate_shutdown()
1196 * node has either been detached or is in the process of being detached, in ocs_fabric_initiate_shutdown()
1197 * call common node's initiate cleanup function in ocs_fabric_initiate_shutdown()
1199 ocs_node_initiate_cleanup(node); in ocs_fabric_initiate_shutdown()
1204 * @brief Fabric node state machine: Handle the common fabric node events.
1207 * @param ctx Remote node state machine context.
1217 ocs_node_t *node = NULL; in __ocs_fabric_common() local
1220 node = ctx->app; in __ocs_fabric_common()
1226 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_fabric_common()
1227 ocs_fabric_initiate_shutdown(node); in __ocs_fabric_common()
1239 * @brief Return TRUE if the remote node is an NPORT.
1242 * Examines the service parameters. Returns TRUE if the node reports itself as
1245 * @param remote_sparms Remote node service parameters.
1257 * @brief Return the node's WWPN as an uint64_t.
1275 * @brief Return TRUE if the remote node is the point-to-point winner.
1278 * Compares WWPNs. Returns TRUE if the remote node's WWPN is numerically
1279 * higher than the local node's WWPN.
1284 * - 0, if the remote node is the loser.
1285 * - 1, if the remote node is the winner.
1286 * - (-1), if remote node is neither the loser nor the winner
1310 ocs_log_warn(sport->ocs, "WWPN of remote node [%08x %08x] matches local WWPN\n", in ocs_rnode_is_winner()
1324 * winning point-to-point node).
1326 * @param ctx Remote node state machine context.
1342 ocs_node_hold_frames(node); in __ocs_p2p_wait_domain_attach()
1346 ocs_node_accept_frames(node); in __ocs_p2p_wait_domain_attach()
1350 ocs_sport_t *sport = node->sport; in __ocs_p2p_wait_domain_attach()
1353 /* this transient node (SID=0 (recv'd FLOGI) or DID=fabric (sent FLOGI)) in __ocs_p2p_wait_domain_attach()
1354 * is the p2p winner, will use a separate node to send PLOGI to peer in __ocs_p2p_wait_domain_attach()
1356 ocs_assert (node->sport->p2p_winner, NULL); in __ocs_p2p_wait_domain_attach()
1358 rnode = ocs_node_find(sport, node->sport->p2p_remote_port_id); in __ocs_p2p_wait_domain_attach()
1360 /* the "other" transient p2p node has already kicked off the in __ocs_p2p_wait_domain_attach()
1361 * new node from which PLOGI is sent */ in __ocs_p2p_wait_domain_attach()
1362 node_printf(node, "Node with fc_id x%x already exists\n", rnode->rnode.fc_id); in __ocs_p2p_wait_domain_attach()
1363 ocs_assert (rnode != node, NULL); in __ocs_p2p_wait_domain_attach()
1365 /* create new node (SID=1, DID=2) from which to send PLOGI */ in __ocs_p2p_wait_domain_attach()
1368 ocs_log_err(ocs, "node alloc failed\n"); in __ocs_p2p_wait_domain_attach()
1372 ocs_fabric_notify_topology(node); in __ocs_p2p_wait_domain_attach()
1373 /* sm: allocate p2p remote node */ in __ocs_p2p_wait_domain_attach()
1377 /* the transient node (SID=0 or DID=fabric) has served its purpose */ in __ocs_p2p_wait_domain_attach()
1378 if (node->rnode.fc_id == 0) { in __ocs_p2p_wait_domain_attach()
1379 /* if this is the SID=0 node, move to the init state in case peer in __ocs_p2p_wait_domain_attach()
1383 ocs_node_init_device(node, FALSE); in __ocs_p2p_wait_domain_attach()
1385 /* if this is the DID=fabric node (we initiated FLOGI), shut it down */ in __ocs_p2p_wait_domain_attach()
1386 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_domain_attach()
1387 ocs_fabric_initiate_shutdown(node); in __ocs_p2p_wait_domain_attach()
1402 * @brief Point-to-point state machine: Remote node initialization state.
1405 * This state is entered after winning point-to-point, and the remote node
1408 * @param ctx Remote node state machine context.
1426 ocs_send_plogi(node, OCS_FC_ELS_SEND_DEFAULT_TIMEOUT, OCS_FC_ELS_DEFAULT_RETRIES, NULL, NULL); in __ocs_p2p_rnode_init()
1427 ocs_node_transition(node, __ocs_p2p_wait_plogi_rsp, NULL); in __ocs_p2p_rnode_init()
1445 * @brief Point-to-point node state machine: Wait for the FLOGI accept completion.
1450 * @param ctx Remote node state machine context.
1467 ocs_node_hold_frames(node); in __ocs_p2p_wait_flogi_acc_cmpl()
1471 ocs_node_accept_frames(node); in __ocs_p2p_wait_flogi_acc_cmpl()
1475 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_p2p_wait_flogi_acc_cmpl()
1476 node->els_cmpl_cnt--; in __ocs_p2p_wait_flogi_acc_cmpl()
1479 if (node->sport->p2p_winner) { in __ocs_p2p_wait_flogi_acc_cmpl()
1480 ocs_node_transition(node, __ocs_p2p_wait_domain_attach, NULL); in __ocs_p2p_wait_flogi_acc_cmpl()
1481 if (node->sport->domain->attached && in __ocs_p2p_wait_flogi_acc_cmpl()
1482 !(node->sport->domain->domain_notify_pend)) { in __ocs_p2p_wait_flogi_acc_cmpl()
1483 node_printf(node, "Domain already attached\n"); in __ocs_p2p_wait_flogi_acc_cmpl()
1484 ocs_node_post_event(node, OCS_EVT_DOMAIN_ATTACH_OK, NULL); in __ocs_p2p_wait_flogi_acc_cmpl()
1487 /* this node has served its purpose; we'll expect a PLOGI on a separate in __ocs_p2p_wait_flogi_acc_cmpl()
1488 * node (remote SID=0x1); return this node to init state in case peer in __ocs_p2p_wait_flogi_acc_cmpl()
1492 ocs_node_init_device(node, FALSE); in __ocs_p2p_wait_flogi_acc_cmpl()
1497 /* LS_ACC failed, possibly due to link down; shutdown node and wait in __ocs_p2p_wait_flogi_acc_cmpl()
1499 node_printf(node, "FLOGI LS_ACC failed, shutting down\n"); in __ocs_p2p_wait_flogi_acc_cmpl()
1500 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_p2p_wait_flogi_acc_cmpl()
1501 node->els_cmpl_cnt--; in __ocs_p2p_wait_flogi_acc_cmpl()
1502 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_flogi_acc_cmpl()
1503 ocs_fabric_initiate_shutdown(node); in __ocs_p2p_wait_flogi_acc_cmpl()
1522 * @brief Point-to-point node state machine: Wait for a PLOGI response
1526 * Wait for a PLOGI response from the remote node as a point-to-point winner.
1527 * Submit node attach request to the HW.
1529 * @param ctx Remote node state machine context.
1550 ocs_assert(node->els_req_cnt, NULL); in __ocs_p2p_wait_plogi_rsp()
1551 node->els_req_cnt--; in __ocs_p2p_wait_plogi_rsp()
1553 ocs_node_save_sparms(node, cbdata->els->els_rsp.virt); in __ocs_p2p_wait_plogi_rsp()
1554 rc = ocs_node_attach(node); in __ocs_p2p_wait_plogi_rsp()
1555 ocs_node_transition(node, __ocs_p2p_wait_node_attach, NULL); in __ocs_p2p_wait_plogi_rsp()
1557 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_p2p_wait_plogi_rsp()
1565 node_printf(node, "PLOGI failed, shutting down\n"); in __ocs_p2p_wait_plogi_rsp()
1566 ocs_assert(node->els_req_cnt, NULL); in __ocs_p2p_wait_plogi_rsp()
1567 node->els_req_cnt--; in __ocs_p2p_wait_plogi_rsp()
1568 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_plogi_rsp()
1569 ocs_fabric_initiate_shutdown(node); in __ocs_p2p_wait_plogi_rsp()
1576 if (node->ocs->external_loopback) { in __ocs_p2p_wait_plogi_rsp()
1588 * PRLI from the remote node (WCQEs and RCQEs come in on in __ocs_p2p_wait_plogi_rsp()
1593 ocs_process_prli_payload(node, cbdata->payload->dma.virt); in __ocs_p2p_wait_plogi_rsp()
1595 ocs_node_transition(node, __ocs_p2p_wait_plogi_rsp_recvd_prli, NULL); in __ocs_p2p_wait_plogi_rsp()
1607 * @brief Point-to-point node state machine: Waiting on a response for a
1616 * @param ctx Remote node state machine context.
1636 * just need to wait for the PLOGI response to do the node in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1644 ocs_node_hold_frames(node); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1648 ocs_node_accept_frames(node); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1656 ocs_assert(node->els_req_cnt, NULL); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1657 node->els_req_cnt--; in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1659 ocs_node_save_sparms(node, cbdata->els->els_rsp.virt); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1660 ocs_display_sparams(node->display_name, "plogi rcvd resp", 0, NULL, in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1662 rc = ocs_node_attach(node); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1663 ocs_node_transition(node, __ocs_p2p_wait_node_attach, NULL); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1665 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1671 /* PLOGI failed, shutdown the node */ in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1675 ocs_assert(node->els_req_cnt, NULL); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1676 node->els_req_cnt--; in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1677 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1678 ocs_fabric_initiate_shutdown(node); in __ocs_p2p_wait_plogi_rsp_recvd_prli()
1691 * @brief Point-to-point node state machine: Wait for a point-to-point node attach
1695 * Waits for the point-to-point node attach to complete.
1697 * @param ctx Remote node state machine context.
1714 ocs_node_hold_frames(node); in __ocs_p2p_wait_node_attach()
1718 ocs_node_accept_frames(node); in __ocs_p2p_wait_node_attach()
1722 node->attached = TRUE; in __ocs_p2p_wait_node_attach()
1723 switch (node->send_ls_acc) { in __ocs_p2p_wait_node_attach()
1725 ocs_d_send_prli_rsp(node->ls_acc_io, node->ls_acc_oxid); in __ocs_p2p_wait_node_attach()
1726 node->send_ls_acc = OCS_NODE_SEND_LS_ACC_NONE; in __ocs_p2p_wait_node_attach()
1727 node->ls_acc_io = NULL; in __ocs_p2p_wait_node_attach()
1735 ocs_node_transition(node, __ocs_d_port_logged_in, NULL); in __ocs_p2p_wait_node_attach()
1741 /* node attach failed, shutdown the node */ in __ocs_p2p_wait_node_attach()
1742 node->attached = FALSE; in __ocs_p2p_wait_node_attach()
1743 node_printf(node, "Node attach failed\n"); in __ocs_p2p_wait_node_attach()
1744 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_node_attach()
1745 ocs_fabric_initiate_shutdown(node); in __ocs_p2p_wait_node_attach()
1749 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_p2p_wait_node_attach()
1750 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_p2p_wait_node_attach()
1751 ocs_node_transition(node, __ocs_fabric_wait_attach_evt_shutdown, NULL); in __ocs_p2p_wait_node_attach()
1754 node_printf(node, "%s: PRLI received before node is attached\n", ocs_sm_event_name(evt)); in __ocs_p2p_wait_node_attach()
1755 ocs_process_prli_payload(node, cbdata->payload->dma.virt); in __ocs_p2p_wait_node_attach()
1767 * @brief Start up the name services node.
1770 * Allocates and starts up the name services node.
1782 /* Instantiate a name services node */ in ocs_start_ns_node()
1803 * @brief Start up the fabric controller node.
1806 * Allocates and starts up the fabric controller node.
1839 * @param node Pointer to the node structure.
1847 ocs_process_gidpt_payload(ocs_node_t *node, fcct_gidpt_acc_t *gidpt, uint32_t gidpt_len) in ocs_process_gidpt_payload() argument
1852 ocs_sport_t *sport = node->sport; in ocs_process_gidpt_payload()
1853 ocs_t *ocs = node->ocs; in ocs_process_gidpt_payload()
1864 ocs_log_debug(node->ocs, "residual is %u words\n", residual); in ocs_process_gidpt_payload()
1868 node_printf(node, "GIDPT request failed: rsn x%x rsn_expl x%x\n", in ocs_process_gidpt_payload()
1883 …active_nodes = ocs_malloc(node->ocs, port_count * sizeof(*active_nodes), OCS_M_NOWAIT | OCS_M_ZERO… in ocs_process_gidpt_payload()
1885 node_printf(node, "ocs_malloc failed\n"); in ocs_process_gidpt_payload()
1923 /* if we're an initiator and the remote node is a target, then in ocs_process_gidpt_payload()
1924 * post the node missing event. if we're target and we have enabled in ocs_process_gidpt_payload()
1925 * target RSCN, then post the node missing event. in ocs_process_gidpt_payload()
1928 if ((node->sport->enable_ini && active_nodes[i]->targ) || in ocs_process_gidpt_payload()
1929 (node->sport->enable_tgt && enable_target_rscn(ocs))) { in ocs_process_gidpt_payload()
1932 node_printf(node, "GID_PT: skipping non-tgt port_id x%06x\n", in ocs_process_gidpt_payload()
1942 /* node_printf(node, "GID_PT: port_id x%06x\n", port_id); */ in ocs_process_gidpt_payload()
1944 /* Don't create node for ourselves or the associated NPIV ports */ in ocs_process_gidpt_payload()
1945 if (port_id != node->rnode.sport->fc_id && !ocs_sport_find(sport->domain, port_id)) { in ocs_process_gidpt_payload()
1948 /* TODO: what if node deleted here?? */ in ocs_process_gidpt_payload()
1949 if (node->sport->enable_ini && newnode->targ) { in ocs_process_gidpt_payload()
1954 if (node->sport->enable_ini) { in ocs_process_gidpt_payload()
1979 * The remote node service parameters are examined, and various point-to-point
2007 * External loopback mode enabled; local sport and remote node in ocs_p2p_setup()
2023 * @brief Process the FABCTL node RSCN.
2026 * Processes the FABCTL node RSCN payload, simply passes the event to the name server.
2028 * @param node Pointer to the node structure.
2035 ocs_process_rscn(ocs_node_t *node, ocs_node_cb_t *cbdata) in ocs_process_rscn() argument
2037 ocs_t *ocs = node->ocs; in ocs_process_rscn()
2038 ocs_sport_t *sport = node->sport; in ocs_process_rscn()
2041 /* Forward this event to the name-services node */ in ocs_process_rscn()
2046 ocs_log_warn(ocs, "can't find name server node\n"); in ocs_process_rscn()