Lines Matching refs:node
16 efc_d_send_prli_rsp(struct efc_node *node, u16 ox_id)
19 struct efc *efc = node->efc;
21 node->ls_acc_oxid = ox_id;
22 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_PRLI;
29 if (node->init) {
31 node->display_name, node->wwpn, node->wwnn);
32 if (node->nport->enable_tgt)
33 rc = efc->tt.scsi_new_node(efc, node);
37 efc_node_post_event(node, EFC_EVT_NODE_SESS_REG_FAIL, NULL);
40 efc_node_post_event(node, EFC_EVT_NODE_SESS_REG_OK, NULL);
47 struct efc_node *node = NULL;
50 node = ctx->app;
51 efc = node->efc;
56 efc_log_debug(efc, "[%s] %-20s %-20s\n", node->display_name,
58 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
59 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
63 node->display_name, funcname,
65 node->shutdown_reason = EFC_NODE_SHUTDOWN_EXPLICIT_LOGO;
66 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
69 efc_log_debug(efc, "[%s] %-20s %-20s\n", node->display_name,
71 node->shutdown_reason = EFC_NODE_SHUTDOWN_IMPLICIT_LOGO;
72 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
85 struct efc_node *node = ctx->app;
90 * State is entered when a node sends a delete initiator/target call
98 efc_node_hold_frames(node);
109 * node has either been detached or is in the process
111 * call common node's initiate cleanup function
113 efc_node_initiate_cleanup(node);
117 efc_node_accept_frames(node);
122 WARN_ON(!node->els_req_cnt);
123 node->els_req_cnt--;
129 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
134 node_printf(node, "%s received\n", efc_sm_event_name(evt));
148 struct efc_node *node = ctx->app;
156 efc_node_hold_frames(node);
166 efc_node_transition(node, __efc_d_wait_del_node, NULL);
170 efc_node_accept_frames(node);
175 WARN_ON(!node->els_req_cnt);
176 node->els_req_cnt--;
182 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
187 node_printf(node, "%s received\n", efc_sm_event_name(evt));
201 struct efc_node *node = ctx->app;
202 struct efc *efc = node->efc;
213 node->els_io_enabled = false;
216 if (node->init && !node->targ) {
217 efc_log_info(node->efc,
219 node->display_name,
220 node->wwpn, node->wwnn);
221 efc_node_transition(node,
224 if (node->nport->enable_tgt)
225 rc = efc->tt.scsi_del_node(efc, node,
229 efc_node_post_event(node,
232 } else if (node->targ && !node->init) {
233 efc_log_info(node->efc,
235 node->display_name,
236 node->wwpn, node->wwnn);
237 efc_node_transition(node,
240 if (node->nport->enable_ini)
241 rc = efc->tt.scsi_del_node(efc, node,
245 efc_node_post_event(node,
248 } else if (node->init && node->targ) {
249 efc_log_info(node->efc,
251 node->display_name, node->wwpn, node->wwnn);
252 efc_node_transition(node, __efc_d_wait_del_ini_tgt,
254 if (node->nport->enable_tgt)
255 rc = efc->tt.scsi_del_node(efc, node,
259 efc_node_post_event(node,
263 if (node->nport->enable_ini)
264 rc = efc->tt.scsi_del_node(efc, node,
268 efc_node_post_event(node,
272 /* we've initiated the upcalls as needed, now kick off the node
274 * associated with said node
280 if (node->attached) {
281 /* issue hw node free; don't care if succeeds right
282 * away or sometime later, will check node->attached
285 rc = efc_cmd_node_detach(efc, &node->rnode);
287 node_printf(node,
288 "Failed freeing HW node, rc=%d\n",
293 if (!node->init && !node->targ) {
295 * node has either been detached or is in
297 * call common node's initiate cleanup function
299 efc_node_initiate_cleanup(node);
317 struct efc_node *node = ctx->app;
325 efc_node_hold_frames(node);
329 efc_node_accept_frames(node);
334 efc_node_init_device(node, true);
343 efc_send_ls_acc_after_attach(struct efc_node *node,
350 WARN_ON(node->send_ls_acc != EFC_NODE_SEND_LS_ACC_NONE);
352 node->ls_acc_oxid = ox_id;
353 node->send_ls_acc = ls;
354 node->ls_acc_did = ntoh24(hdr->fh_d_id);
358 efc_process_prli_payload(struct efc_node *node, void *prli)
366 node->init = (pp->sp.spp_flags & FCP_SPPF_INIT_FCN) != 0;
367 node->targ = (pp->sp.spp_flags & FCP_SPPF_TARG_FCN) != 0;
374 struct efc_node *node = ctx->app;
382 efc_node_hold_frames(node);
386 efc_node_accept_frames(node);
390 WARN_ON(!node->els_cmpl_cnt);
391 node->els_cmpl_cnt--;
392 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
393 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
397 WARN_ON(!node->els_cmpl_cnt);
398 node->els_cmpl_cnt--;
399 efc_node_transition(node, __efc_d_port_logged_in, NULL);
411 struct efc_node *node = ctx->app;
419 efc_node_hold_frames(node);
423 efc_node_accept_frames(node);
434 WARN_ON(!node->els_req_cnt);
435 node->els_req_cnt--;
436 node_printf(node,
437 "LOGO sent (evt=%s), shutdown node\n",
440 efc_node_post_event(node, EFC_EVT_SHUTDOWN_EXPLICIT_LOGO,
450 efc_node_init_device(struct efc_node *node, bool send_plogi)
452 node->send_plogi = send_plogi;
453 if ((node->efc->nodedb_mask & EFC_NODEDB_PAUSE_NEW_NODES) &&
454 (node->rnode.fc_id != FC_FID_DOM_MGR)) {
455 node->nodedb_state = __efc_d_init;
456 efc_node_transition(node, __efc_node_paused, NULL);
458 efc_node_transition(node, __efc_d_init, NULL);
463 efc_d_check_plogi_topology(struct efc_node *node, u32 d_id)
465 switch (node->nport->topology) {
470 efc_domain_attach(node->nport->domain, d_id);
471 efc_node_transition(node, __efc_d_wait_domain_attach, NULL);
478 efc_node_transition(node, __efc_d_wait_domain_attach, NULL);
486 * fabric node to tell us;
493 node_printf(node, "received PLOGI, unknown topology did=0x%x\n",
495 efc_node_transition(node, __efc_d_wait_topology_notify, NULL);
498 node_printf(node, "received PLOGI, unexpected topology %d\n",
499 node->nport->topology);
507 struct efc_node *node = ctx->app;
514 * This state is entered when a node is instantiated,
520 if (!node->send_plogi)
525 if (node->nport->enable_ini &&
526 node->nport->domain->attached) {
527 efc_send_plogi(node);
529 efc_node_transition(node, __efc_d_wait_plogi_rsp, NULL);
531 node_printf(node, "not sending plogi nport.ini=%d,",
532 node->nport->enable_ini);
533 node_printf(node, "domain attached=%d\n",
534 node->nport->domain->attached);
542 efc_node_save_sparms(node, cbdata->payload->dma.virt);
543 efc_send_ls_acc_after_attach(node,
548 if (!node->nport->domain->attached) {
549 efc_d_check_plogi_topology(node, ntoh24(hdr->fh_d_id));
554 rc = efc_node_attach(node);
555 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
557 efc_node_post_event(node, EFC_EVT_NODE_ATTACH_FAIL, NULL);
572 memcpy(node->nport->domain->flogi_service_params,
577 efc_fabric_set_topology(node, EFC_NPORT_TOPO_P2P);
579 efc_send_flogi_p2p_acc(node, be16_to_cpu(hdr->fh_ox_id), d_id);
581 if (efc_p2p_setup(node->nport)) {
582 node_printf(node, "p2p failed, shutting down node\n");
583 efc_node_post_event(node, EFC_EVT_SHUTDOWN, NULL);
587 efc_node_transition(node, __efc_p2p_wait_flogi_acc_cmpl, NULL);
594 if (!node->nport->domain->attached) {
597 * shut node down w/ "explicit logout" so pending
600 node_printf(node, "%s domain not attached, dropping\n",
602 efc_node_post_event(node,
607 efc_send_logo_acc(node, be16_to_cpu(hdr->fh_ox_id));
608 efc_node_transition(node, __efc_d_wait_logo_acc_cmpl, NULL);
619 if (!node->nport->domain->attached) {
621 * down; drop and shut node down w/ "explicit logout"
624 node_printf(node, "%s domain not attached, dropping\n",
627 efc_node_post_event(node,
632 node_printf(node, "%s received, sending reject\n",
635 efc_send_ls_rjt(node, be16_to_cpu(hdr->fh_ox_id),
645 if (!node->nport->domain->attached) {
648 * shut node down w/ "explicit logout" so pending
651 node_printf(node, "%s domain not attached, dropping\n",
653 efc_node_post_event(node,
660 node_printf(node, "FCP_CMND received, send LOGO\n");
661 if (efc_send_logo(node)) {
663 * failed to send LOGO, go ahead and cleanup node
666 node_printf(node, "Failed to send LOGO\n");
667 efc_node_post_event(node,
672 efc_node_transition(node,
692 struct efc_node *node = ctx->app;
701 /* received PLOGI with svc parms, go ahead and attach node
708 efc_node_save_sparms(node, cbdata->payload->dma.virt);
709 efc_send_ls_acc_after_attach(node,
713 rc = efc_node_attach(node);
714 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
716 efc_node_post_event(node,
725 * PRLI from the remote node (WCQEs and RCQEs come in on
730 efc_process_prli_payload(node, cbdata->payload->dma.virt);
731 efc_send_ls_acc_after_attach(node,
734 efc_node_transition(node, __efc_d_wait_plogi_rsp_recvd_prli,
747 node_printf(node, "%s received, sending reject\n",
750 efc_send_ls_rjt(node, be16_to_cpu(hdr->fh_ox_id),
762 WARN_ON(!node->els_req_cnt);
763 node->els_req_cnt--;
765 efc_node_save_sparms(node, cbdata->els_rsp.virt);
766 rc = efc_node_attach(node);
767 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
769 efc_node_post_event(node,
775 /* PLOGI failed, shutdown the node */
780 WARN_ON(!node->els_req_cnt);
781 node->els_req_cnt--;
782 efc_node_post_event(node, EFC_EVT_SHUTDOWN, NULL);
791 WARN_ON(!node->els_req_cnt);
792 node->els_req_cnt--;
799 node_printf(node, "FCP_CMND received, drop\n");
814 struct efc_node *node = ctx->app;
824 * just need to wait for the PLOGI response to do the node
832 efc_node_hold_frames(node);
836 efc_node_accept_frames(node);
845 WARN_ON(!node->els_req_cnt);
846 node->els_req_cnt--;
848 efc_node_save_sparms(node, cbdata->els_rsp.virt);
849 rc = efc_node_attach(node);
850 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
852 efc_node_post_event(node, EFC_EVT_NODE_ATTACH_FAIL,
859 /* PLOGI failed, shutdown the node */
864 WARN_ON(!node->els_req_cnt);
865 node->els_req_cnt--;
866 efc_node_post_event(node, EFC_EVT_SHUTDOWN, NULL);
879 struct efc_node *node = ctx->app;
887 efc_node_hold_frames(node);
891 efc_node_accept_frames(node);
895 WARN_ON(!node->nport->domain->attached);
897 rc = efc_node_attach(node);
898 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
900 efc_node_post_event(node, EFC_EVT_NODE_ATTACH_FAIL,
915 struct efc_node *node = ctx->app;
923 efc_node_hold_frames(node);
927 efc_node_accept_frames(node);
933 WARN_ON(node->nport->domain->attached);
935 WARN_ON(node->send_ls_acc != EFC_NODE_SEND_LS_ACC_PLOGI);
937 node_printf(node, "topology notification, topology=%d\n",
941 * so we didn't know which node would perform the domain attach:
942 * 1. The node from which the PLOGI was sent (p2p) or
943 * 2. The node to which the FLOGI was sent (fabric).
949 efc_domain_attach(node->nport->domain,
950 node->ls_acc_did);
953 * should be performed by the fabric node (node sending FLOGI);
957 efc_node_transition(node, __efc_d_wait_domain_attach, NULL);
961 WARN_ON(!node->nport->domain->attached);
962 node_printf(node, "domain attach ok\n");
964 rc = efc_node_attach(node);
965 efc_node_transition(node, __efc_d_wait_node_attach, NULL);
967 efc_node_post_event(node,
981 struct efc_node *node = ctx->app;
989 efc_node_hold_frames(node);
993 efc_node_accept_frames(node);
997 node->attached = true;
998 switch (node->send_ls_acc) {
1002 efc_send_plogi_acc(node, node->ls_acc_oxid);
1003 efc_node_transition(node, __efc_d_wait_plogi_acc_cmpl,
1005 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_NONE;
1006 node->ls_acc_io = NULL;
1010 efc_d_send_prli_rsp(node, node->ls_acc_oxid);
1011 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_NONE;
1012 node->ls_acc_io = NULL;
1019 efc_node_transition(node,
1026 /* node attach failed, shutdown the node */
1027 node->attached = false;
1028 node_printf(node, "node attach failed\n");
1029 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
1030 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
1035 node_printf(node, "%s received\n", efc_sm_event_name(evt));
1036 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
1037 efc_node_transition(node, __efc_d_wait_attach_evt_shutdown,
1041 node_printf(node, "%s received\n", efc_sm_event_name(evt));
1042 node->shutdown_reason = EFC_NODE_SHUTDOWN_EXPLICIT_LOGO;
1043 efc_node_transition(node, __efc_d_wait_attach_evt_shutdown,
1047 node_printf(node, "%s received\n", efc_sm_event_name(evt));
1048 node->shutdown_reason = EFC_NODE_SHUTDOWN_IMPLICIT_LOGO;
1049 efc_node_transition(node,
1061 struct efc_node *node = ctx->app;
1069 efc_node_hold_frames(node);
1073 efc_node_accept_frames(node);
1078 node->attached = true;
1079 node_printf(node, "Attach evt=%s, proceed to shutdown\n",
1081 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
1085 /* node attach failed, shutdown the node */
1086 node->attached = false;
1087 node_printf(node, "Attach evt=%s, proceed to shutdown\n",
1089 efc_node_transition(node, __efc_d_initiate_shutdown, NULL);
1095 node->shutdown_reason = EFC_NODE_SHUTDOWN_DEFAULT;
1100 node_printf(node, "%s received\n", efc_sm_event_name(evt));
1113 struct efc_node *node = ctx->app;
1122 if (node->nport->enable_ini &&
1123 !(node->rnode.fc_id != FC_FID_DOM_MGR)) {
1125 efc_send_prli(node);
1145 efc_send_ls_rjt(node, be16_to_cpu(hdr->fh_ox_id),
1150 efc_process_prli_payload(node, cbdata->payload->dma.virt);
1151 efc_d_send_prli_rsp(node, be16_to_cpu(hdr->fh_ox_id));
1156 if (node->send_ls_acc == EFC_NODE_SEND_LS_ACC_PRLI)
1157 efc_send_prli_acc(node, node->ls_acc_oxid);
1159 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_NONE;
1160 efc_node_transition(node, __efc_d_device_ready, NULL);
1164 efc_send_ls_rjt(node, node->ls_acc_oxid, ELS_RJT_UNAB,
1166 node->send_ls_acc = EFC_NODE_SEND_LS_ACC_NONE;
1175 WARN_ON(!node->els_req_cnt);
1176 node->els_req_cnt--;
1178 efc_process_prli_payload(node, cbdata->els_rsp.virt);
1179 efc_node_transition(node, __efc_d_device_ready, NULL);
1184 /* I, I+T, assume some link failure, shutdown node */
1189 WARN_ON(!node->els_req_cnt);
1190 node->els_req_cnt--;
1191 efc_node_post_event(node, EFC_EVT_SHUTDOWN, NULL);
1199 * PRLI from the remote node
1206 WARN_ON(!node->els_req_cnt);
1207 node->els_req_cnt--;
1215 * do nothing. (note: as T only we could shutdown the node)
1217 WARN_ON(!node->els_cmpl_cnt);
1218 node->els_cmpl_cnt--;
1227 efc_node_save_sparms(node, cbdata->payload->dma.virt);
1228 efc_send_ls_acc_after_attach(node,
1232 /* Restart node attach with new service parameters,
1235 efc_node_post_event(node, EFC_EVT_SHUTDOWN_IMPLICIT_LOGO,
1244 node_printf(node, "%s received attached=%d\n",
1246 node->attached);
1248 efc_send_logo_acc(node, be16_to_cpu(hdr->fh_ox_id));
1249 efc_node_transition(node, __efc_d_wait_logo_acc_cmpl, NULL);
1262 struct efc_node *node = ctx->app;
1270 efc_node_hold_frames(node);
1274 efc_node_accept_frames(node);
1280 WARN_ON(!node->els_cmpl_cnt);
1281 node->els_cmpl_cnt--;
1282 efc_node_post_event(node,
1295 struct efc_node *node = ctx->app;
1296 struct efc *efc = node->efc;
1305 node->fcp_enabled = true;
1306 if (node->targ) {
1309 node->display_name,
1310 node->wwpn, node->wwnn);
1311 if (node->nport->enable_ini)
1312 efc->tt.scsi_new_node(efc, node);
1317 node->fcp_enabled = false;
1325 efc_node_save_sparms(node, cbdata->payload->dma.virt);
1326 efc_send_ls_acc_after_attach(node,
1331 * Restart node attach with new service parameters,
1334 efc_node_post_event(node,
1350 efc_send_ls_rjt(node, be16_to_cpu(hdr->fh_ox_id),
1355 efc_process_prli_payload(node, cbdata->payload->dma.virt);
1356 efc_send_prli_acc(node, be16_to_cpu(hdr->fh_ox_id));
1363 efc_send_prlo_acc(node, be16_to_cpu(hdr->fh_ox_id));
1371 node_printf(node, "%s received attached=%d\n",
1372 efc_sm_event_name(evt), node->attached);
1374 efc_send_logo_acc(node, be16_to_cpu(hdr->fh_ox_id));
1375 efc_node_transition(node, __efc_d_wait_logo_acc_cmpl, NULL);
1382 efc_send_adisc_acc(node, be16_to_cpu(hdr->fh_ox_id));
1399 if (node->nport->enable_rscn)
1400 efc_node_transition(node, __efc_d_device_gone, NULL);
1406 WARN_ON(!node->els_cmpl_cnt);
1407 node->els_cmpl_cnt--;
1412 WARN_ON(!node->els_cmpl_cnt);
1413 node->els_cmpl_cnt--;
1414 node_printf(node, "Failed to send PRLI LS_ACC\n");
1427 struct efc_node *node = ctx->app;
1428 struct efc *efc = node->efc;
1443 node->display_name,
1444 labels[(node->targ << 1) | (node->init)],
1445 node->wwpn, node->wwnn);
1447 switch (efc_node_get_enable(node)) {
1451 rc = efc->tt.scsi_del_node(efc, node,
1458 rc = efc->tt.scsi_del_node(efc, node,
1463 rc = efc->tt.scsi_del_node(efc, node,
1468 rc = efc->tt.scsi_del_node(efc, node,
1473 rc = efc->tt.scsi_del_node(efc, node,
1475 rc_2 = efc->tt.scsi_del_node(efc, node,
1486 efc_node_post_event(node, EFC_EVT_SHUTDOWN, NULL);
1494 /* efc_node_transition(node, __efc_d_discovered, NULL); */
1498 efc_send_adisc(node);
1499 efc_node_transition(node, __efc_d_wait_adisc_rsp, NULL);
1507 efc_node_save_sparms(node, cbdata->payload->dma.virt);
1508 efc_send_ls_acc_after_attach(node,
1513 * Restart node attach with new service parameters, and send
1516 efc_node_post_event(node, EFC_EVT_SHUTDOWN_IMPLICIT_LOGO,
1526 node_printf(node, "FCP_CMND received, drop\n");
1533 node_printf(node, "%s received attached=%d\n",
1534 efc_sm_event_name(evt), node->attached);
1536 efc_send_logo_acc(node, be16_to_cpu(hdr->fh_ox_id));
1537 efc_node_transition(node, __efc_d_wait_logo_acc_cmpl, NULL);
1550 struct efc_node *node = ctx->app;
1562 WARN_ON(!node->els_req_cnt);
1563 node->els_req_cnt--;
1564 efc_node_transition(node, __efc_d_device_ready, NULL);
1569 * (explicit logo) event which will unregister the node,
1576 WARN_ON(!node->els_req_cnt);
1577 node->els_req_cnt--;
1579 efc_node_post_event(node,
1592 node_printf(node, "%s received attached=%d\n",
1593 efc_sm_event_name(evt), node->attached);
1595 efc_send_logo_acc(node, be16_to_cpu(hdr->fh_ox_id));
1596 efc_node_transition(node, __efc_d_wait_logo_acc_cmpl, NULL);