Lines Matching +full:re +full:- +full:attached

1 // SPDX-License-Identifier: GPL-2.0
9 * - Fabric logins.
10 * - Fabric controller events.
11 * - Name/directory services interaction.
12 * - Point-to-point logins.
18 * p2p_sm Node State Machine: Point-to-Point Node States
26 struct efc *efc = node->efc; in efc_fabric_initiate_shutdown()
28 node->els_io_enabled = false; in efc_fabric_initiate_shutdown()
30 if (node->attached) { in efc_fabric_initiate_shutdown()
34 * or sometime later, will check node->attached later in in efc_fabric_initiate_shutdown()
37 rc = efc_cmd_node_detach(efc, &node->rnode); in efc_fabric_initiate_shutdown()
56 node = ctx->app; in __efc_fabric_common()
62 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_fabric_common()
76 struct efc_node *node = ctx->app; in __efc_fabric_init()
77 struct efc *efc = node->efc; in __efc_fabric_init()
103 node->nport->topology = topology; in efc_fabric_set_topology()
116 xa_for_each(&node->nport->lookup, index, tmp_node) { in efc_fabric_notify_topology()
120 &node->nport->topology); in efc_fabric_notify_topology()
127 return !(ntohs(rsp->fl_csp.sp_features) & FC_SP_FT_FPORT); in efc_rnode_is_nport()
135 struct efc_node *node = ctx->app; in __efc_fabric_flogi_wait_rsp()
147 WARN_ON(!node->els_req_cnt); in __efc_fabric_flogi_wait_rsp()
148 node->els_req_cnt--; in __efc_fabric_flogi_wait_rsp()
150 memcpy(node->nport->domain->flogi_service_params, in __efc_fabric_flogi_wait_rsp()
151 cbdata->els_rsp.virt, in __efc_fabric_flogi_wait_rsp()
155 if (!efc_rnode_is_nport(cbdata->els_rsp.virt)) { in __efc_fabric_flogi_wait_rsp()
160 WARN_ON(node->nport->domain->attached); in __efc_fabric_flogi_wait_rsp()
161 efc_domain_attach(node->nport->domain, in __efc_fabric_flogi_wait_rsp()
162 cbdata->ext_status); in __efc_fabric_flogi_wait_rsp()
171 if (efc_p2p_setup(node->nport)) { in __efc_fabric_flogi_wait_rsp()
174 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_fabric_flogi_wait_rsp()
179 if (node->nport->p2p_winner) { in __efc_fabric_flogi_wait_rsp()
183 if (node->nport->domain->attached && in __efc_fabric_flogi_wait_rsp()
184 !node->nport->domain->domain_notify_pend) { in __efc_fabric_flogi_wait_rsp()
186 * already attached, in __efc_fabric_flogi_wait_rsp()
190 "p2p winner, domain already attached\n"); in __efc_fabric_flogi_wait_rsp()
202 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_fabric_flogi_wait_rsp()
212 struct efc_nport *nport = node->nport; in __efc_fabric_flogi_wait_rsp()
224 efc_sm_event_name(evt), nport->display_name); in __efc_fabric_flogi_wait_rsp()
225 WARN_ON(!node->els_req_cnt); in __efc_fabric_flogi_wait_rsp()
226 node->els_req_cnt--; in __efc_fabric_flogi_wait_rsp()
227 efc_sm_post_event(&nport->sm, EFC_EVT_SHUTDOWN, NULL); in __efc_fabric_flogi_wait_rsp()
240 struct efc_node *node = ctx->app; in __efc_vport_fabric_init()
263 struct efc_node *node = ctx->app; in __efc_fabric_fdisc_wait_rsp()
277 WARN_ON(!node->els_req_cnt); in __efc_fabric_fdisc_wait_rsp()
278 node->els_req_cnt--; in __efc_fabric_fdisc_wait_rsp()
280 efc_nport_attach(node->nport, cbdata->ext_status); in __efc_fabric_fdisc_wait_rsp()
292 WARN_ON(!node->els_req_cnt); in __efc_fabric_fdisc_wait_rsp()
293 node->els_req_cnt--; in __efc_fabric_fdisc_wait_rsp()
294 efc_log_err(node->efc, "FDISC failed, shutting down nport\n"); in __efc_fabric_fdisc_wait_rsp()
296 efc_sm_post_event(&node->nport->sm, EFC_EVT_SHUTDOWN, NULL); in __efc_fabric_fdisc_wait_rsp()
315 return -EIO; in efc_start_ns_node()
323 if (ns->efc->nodedb_mask & EFC_NODEDB_PAUSE_NAMESERVER) in efc_start_ns_node()
340 return -EIO; in efc_start_fabctl_node()
356 struct efc_node *node = ctx->app; in __efc_fabric_wait_domain_attach()
374 rc = efc_start_ns_node(node->nport); in __efc_fabric_wait_domain_attach()
380 if (node->nport->enable_rscn) { in __efc_fabric_wait_domain_attach()
381 rc = efc_start_fabctl_node(node->nport); in __efc_fabric_wait_domain_attach()
397 struct efc_node *node = ctx->app; in __efc_fabric_idle()
414 struct efc_node *node = ctx->app; in __efc_ns_init()
436 struct efc_node *node = ctx->app; in __efc_ns_plogi_wait_rsp()
451 WARN_ON(!node->els_req_cnt); in __efc_ns_plogi_wait_rsp()
452 node->els_req_cnt--; in __efc_ns_plogi_wait_rsp()
454 efc_node_save_sparms(node, cbdata->els_rsp.virt); in __efc_ns_plogi_wait_rsp()
471 struct efc_node *node = ctx->app; in __efc_ns_wait_node_attach()
487 node->attached = true; in __efc_ns_wait_node_attach()
495 node->attached = false; in __efc_ns_wait_node_attach()
497 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_ns_wait_node_attach()
503 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_ns_wait_node_attach()
525 struct efc_node *node = ctx->app; in __efc_fabric_wait_attach_evt_shutdown()
542 node->attached = true; in __efc_fabric_wait_attach_evt_shutdown()
549 node->attached = false; in __efc_fabric_wait_attach_evt_shutdown()
555 /* ignore shutdown event as we're already in shutdown path */ in __efc_fabric_wait_attach_evt_shutdown()
569 struct efc_node *node = ctx->app; in __efc_ns_rftid_wait_rsp()
581 WARN_ON(!node->els_req_cnt); in __efc_ns_rftid_wait_rsp()
582 node->els_req_cnt--; in __efc_ns_rftid_wait_rsp()
604 struct efc_node *node = ctx->app; in __efc_ns_rffid_wait_rsp()
620 WARN_ON(!node->els_req_cnt); in __efc_ns_rffid_wait_rsp()
621 node->els_req_cnt--; in __efc_ns_rffid_wait_rsp()
622 if (node->nport->enable_rscn) { in __efc_ns_rffid_wait_rsp()
629 /* if 'T' only, we're done, go to idle */ in __efc_ns_rffid_wait_rsp()
652 struct efc_nport *nport = node->nport; in efc_process_gidpt_payload()
653 struct efc *efc = node->efc; in efc_process_gidpt_payload()
666 gidpt = &rsp->pn_rsp; in efc_process_gidpt_payload()
667 residual = be16_to_cpu(rsp->hdr.ct_mr_size); in efc_process_gidpt_payload()
670 efc_log_debug(node->efc, "residual is %u words\n", residual); in efc_process_gidpt_payload()
672 if (be16_to_cpu(rsp->hdr.ct_cmd) == FC_FS_RJT) { in efc_process_gidpt_payload()
675 rsp->hdr.ct_reason, rsp->hdr.ct_explan); in efc_process_gidpt_payload()
676 return -EIO; in efc_process_gidpt_payload()
679 plist_count = (gidpt_len - sizeof(struct fc_ct_hdr)) / sizeof(*gidpt); in efc_process_gidpt_payload()
683 xa_for_each(&nport->lookup, index, n) { in efc_process_gidpt_payload()
691 return -EIO; in efc_process_gidpt_payload()
696 xa_for_each(&nport->lookup, index, n) { in efc_process_gidpt_payload()
697 port_id = n->rnode.fc_id; in efc_process_gidpt_payload()
716 port_id == active_nodes[j]->rnode.fc_id) { in efc_process_gidpt_payload()
728 * if we're an initiator and the remote node in efc_process_gidpt_payload()
730 * if we're target and we have enabled in efc_process_gidpt_payload()
736 if ((node->nport->enable_ini && active_nodes[i]->targ) || in efc_process_gidpt_payload()
737 (node->nport->enable_tgt && enable_target_rscn(efc))) { in efc_process_gidpt_payload()
742 "GID_PT: skipping non-tgt port_id x%06x\n", in efc_process_gidpt_payload()
743 active_nodes[i]->rnode.fc_id); in efc_process_gidpt_payload()
752 if (port_id == node->rnode.nport->fc_id) { in efc_process_gidpt_payload()
760 if (!node->nport->enable_ini) in efc_process_gidpt_payload()
766 return -EIO; in efc_process_gidpt_payload()
775 if (node->nport->enable_ini && newnode->targ) { in efc_process_gidpt_payload()
791 struct efc_node *node = ctx->app; in __efc_ns_gidpt_wait_rsp()
807 WARN_ON(!node->els_req_cnt); in __efc_ns_gidpt_wait_rsp()
808 node->els_req_cnt--; in __efc_ns_gidpt_wait_rsp()
810 efc_process_gidpt_payload(node, cbdata->els_rsp.virt, in __efc_ns_gidpt_wait_rsp()
811 cbdata->els_rsp.len); in __efc_ns_gidpt_wait_rsp()
819 WARN_ON(!node->els_req_cnt); in __efc_ns_gidpt_wait_rsp()
820 node->els_req_cnt--; in __efc_ns_gidpt_wait_rsp()
828 node->rscn_pending = true; in __efc_ns_gidpt_wait_rsp()
840 struct efc_node *node = ctx->app; in __efc_ns_idle()
841 struct efc *efc = node->efc; in __efc_ns_idle()
854 if (!node->rscn_pending) in __efc_ns_idle()
858 node->rscn_pending = false; in __efc_ns_idle()
866 * and tgt_rscn_delay is non-zero, in __efc_ns_idle()
869 if (efc->tgt_rscn_delay_msec != 0 && in __efc_ns_idle()
870 !node->nport->enable_ini && node->nport->enable_tgt && in __efc_ns_idle()
891 del_timer(&node->gidpt_delay_timer); in gidpt_delay_timer_cb()
900 struct efc_node *node = ctx->app; in __efc_ns_gidpt_delay()
901 struct efc *efc = node->efc; in __efc_ns_gidpt_delay()
916 delay_msec = efc->tgt_rscn_delay_msec; in __efc_ns_gidpt_delay()
917 tmp = jiffies_to_msecs(jiffies) - node->time_last_gidpt_msec; in __efc_ns_gidpt_delay()
918 if (tmp < efc->tgt_rscn_period_msec) in __efc_ns_gidpt_delay()
919 delay_msec = efc->tgt_rscn_period_msec; in __efc_ns_gidpt_delay()
921 timer_setup(&node->gidpt_delay_timer, &gidpt_delay_timer_cb, in __efc_ns_gidpt_delay()
923 mod_timer(&node->gidpt_delay_timer, in __efc_ns_gidpt_delay()
930 node->time_last_gidpt_msec = jiffies_to_msecs(jiffies); in __efc_ns_gidpt_delay()
938 "RSCN received while in GIDPT delay - no action\n"); in __efc_ns_gidpt_delay()
951 struct efc_node *node = ctx->app; in __efc_fabctl_init()
963 node->attached = true; in __efc_fabctl_init()
975 struct efc_node *node = ctx->app; in __efc_fabctl_wait_scr_rsp()
991 WARN_ON(!node->els_req_cnt); in __efc_fabctl_wait_scr_rsp()
992 node->els_req_cnt--; in __efc_fabctl_wait_scr_rsp()
1004 struct efc *efc = node->efc; in efc_process_rscn()
1005 struct efc_nport *nport = node->nport; in efc_process_rscn()
1008 /* Forward this event to the name-services node */ in efc_process_rscn()
1021 struct efc_node *node = ctx->app; in __efc_fabctl_ready()
1035 struct fc_frame_header *hdr = cbdata->header->dma.virt; in __efc_fabctl_ready()
1042 efc_send_ls_acc(node, be16_to_cpu(hdr->fh_ox_id)); in __efc_fabctl_ready()
1057 struct efc_node *node = ctx->app; in __efc_fabctl_wait_ls_acc_cmpl()
1073 WARN_ON(!node->els_cmpl_cnt); in __efc_fabctl_wait_ls_acc_cmpl()
1074 node->els_cmpl_cnt--; in __efc_fabctl_wait_ls_acc_cmpl()
1086 return be64_to_cpu(sp->fl_wwnn); in efc_get_wwpn()
1094 u64 local_wwpn = nport->wwpn; in efc_rnode_is_winner()
1097 remote_sp = (struct fc_els_flogi *)nport->domain->flogi_service_params; in efc_rnode_is_winner()
1102 efc_log_debug(nport->efc, "r: %llx\n", in efc_rnode_is_winner()
1103 be64_to_cpu(remote_sp->fl_wwpn)); in efc_rnode_is_winner()
1104 efc_log_debug(nport->efc, "l: %llx\n", local_wwpn); in efc_rnode_is_winner()
1107 efc_log_warn(nport->efc, in efc_rnode_is_winner()
1111 return -1; in efc_rnode_is_winner()
1121 struct efc_node *node = ctx->app; in __efc_p2p_wait_domain_attach()
1122 struct efc *efc = node->efc; in __efc_p2p_wait_domain_attach()
1138 struct efc_nport *nport = node->nport; in __efc_p2p_wait_domain_attach()
1147 WARN_ON(!node->nport->p2p_winner); in __efc_p2p_wait_domain_attach()
1149 rnode = efc_node_find(nport, node->nport->p2p_remote_port_id); in __efc_p2p_wait_domain_attach()
1158 rnode->rnode.fc_id); in __efc_p2p_wait_domain_attach()
1165 nport->p2p_remote_port_id, in __efc_p2p_wait_domain_attach()
1182 if (node->rnode.fc_id == 0) { in __efc_p2p_wait_domain_attach()
1195 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_domain_attach()
1211 struct efc_node *node = ctx->app; in __efc_p2p_rnode_init()
1226 efc_send_bls_acc(node, cbdata->header->dma.virt); in __efc_p2p_rnode_init()
1240 struct efc_node *node = ctx->app; in __efc_p2p_wait_flogi_acc_cmpl()
1256 WARN_ON(!node->els_cmpl_cnt); in __efc_p2p_wait_flogi_acc_cmpl()
1257 node->els_cmpl_cnt--; in __efc_p2p_wait_flogi_acc_cmpl()
1260 if (node->nport->p2p_winner) { in __efc_p2p_wait_flogi_acc_cmpl()
1264 if (!node->nport->domain->attached) { in __efc_p2p_wait_flogi_acc_cmpl()
1265 node_printf(node, "Domain not attached\n"); in __efc_p2p_wait_flogi_acc_cmpl()
1266 efc_domain_attach(node->nport->domain, in __efc_p2p_wait_flogi_acc_cmpl()
1267 node->nport->p2p_port_id); in __efc_p2p_wait_flogi_acc_cmpl()
1269 node_printf(node, "Domain already attached\n"); in __efc_p2p_wait_flogi_acc_cmpl()
1279 * restarts discovery -- it may already in __efc_p2p_wait_flogi_acc_cmpl()
1294 WARN_ON(!node->els_cmpl_cnt); in __efc_p2p_wait_flogi_acc_cmpl()
1295 node->els_cmpl_cnt--; in __efc_p2p_wait_flogi_acc_cmpl()
1296 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_flogi_acc_cmpl()
1302 efc_send_bls_acc(node, cbdata->header->dma.virt); in __efc_p2p_wait_flogi_acc_cmpl()
1316 struct efc_node *node = ctx->app; in __efc_p2p_wait_plogi_rsp()
1330 WARN_ON(!node->els_req_cnt); in __efc_p2p_wait_plogi_rsp()
1331 node->els_req_cnt--; in __efc_p2p_wait_plogi_rsp()
1333 efc_node_save_sparms(node, cbdata->els_rsp.virt); in __efc_p2p_wait_plogi_rsp()
1347 WARN_ON(!node->els_req_cnt); in __efc_p2p_wait_plogi_rsp()
1348 node->els_req_cnt--; in __efc_p2p_wait_plogi_rsp()
1349 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_plogi_rsp()
1355 struct fc_frame_header *hdr = cbdata->header->dma.virt; in __efc_p2p_wait_plogi_rsp()
1356 /* if we're in external loopback mode, just send LS_ACC */ in __efc_p2p_wait_plogi_rsp()
1357 if (node->efc->external_loopback) { in __efc_p2p_wait_plogi_rsp()
1358 efc_send_plogi_acc(node, be16_to_cpu(hdr->fh_ox_id)); in __efc_p2p_wait_plogi_rsp()
1376 efc_process_prli_payload(node, cbdata->payload->dma.virt); in __efc_p2p_wait_plogi_rsp()
1378 cbdata->header->dma.virt, in __efc_p2p_wait_plogi_rsp()
1393 struct efc_node *node = ctx->app; in __efc_p2p_wait_plogi_rsp_recvd_prli()
1427 WARN_ON(!node->els_req_cnt); in __efc_p2p_wait_plogi_rsp_recvd_prli()
1428 node->els_req_cnt--; in __efc_p2p_wait_plogi_rsp_recvd_prli()
1430 efc_node_save_sparms(node, cbdata->els_rsp.virt); in __efc_p2p_wait_plogi_rsp_recvd_prli()
1445 WARN_ON(!node->els_req_cnt); in __efc_p2p_wait_plogi_rsp_recvd_prli()
1446 node->els_req_cnt--; in __efc_p2p_wait_plogi_rsp_recvd_prli()
1447 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_plogi_rsp_recvd_prli()
1461 struct efc_node *node = ctx->app; in __efc_p2p_wait_node_attach()
1477 node->attached = true; in __efc_p2p_wait_node_attach()
1478 switch (node->send_ls_acc) { in __efc_p2p_wait_node_attach()
1480 efc_d_send_prli_rsp(node->ls_acc_io, in __efc_p2p_wait_node_attach()
1481 node->ls_acc_oxid); in __efc_p2p_wait_node_attach()
1482 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_NONE; in __efc_p2p_wait_node_attach()
1483 node->ls_acc_io = NULL; in __efc_p2p_wait_node_attach()
1499 node->attached = false; in __efc_p2p_wait_node_attach()
1501 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_node_attach()
1507 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT; in __efc_p2p_wait_node_attach()
1513 node_printf(node, "%s: PRLI received before node is attached\n", in __efc_p2p_wait_node_attach()
1515 efc_process_prli_payload(node, cbdata->payload->dma.virt); in __efc_p2p_wait_node_attach()
1517 cbdata->header->dma.virt, in __efc_p2p_wait_node_attach()
1529 struct efc *efc = nport->efc; in efc_p2p_setup()
1536 nport->p2p_remote_port_id = 0; in efc_p2p_setup()
1537 nport->p2p_port_id = 0; in efc_p2p_setup()
1538 nport->p2p_winner = false; in efc_p2p_setup()
1540 nport->p2p_remote_port_id = 2; in efc_p2p_setup()
1541 nport->p2p_port_id = 1; in efc_p2p_setup()
1542 nport->p2p_winner = true; in efc_p2p_setup()
1545 if (nport->efc->external_loopback) { in efc_p2p_setup()
1553 nport->p2p_remote_port_id = 1; in efc_p2p_setup()
1554 nport->p2p_port_id = 1; in efc_p2p_setup()
1555 nport->p2p_winner = true; in efc_p2p_setup()