Lines Matching refs:node
53 io->node->display_name, SCSI_IOFMT_ARGS(io), ##__VA_ARGS__)
55 void ocs_mgmt_node_list(ocs_textbuf_t *textbuf, void *node);
56 void ocs_mgmt_node_get_all(ocs_textbuf_t *textbuf, void *node);
57 int ocs_mgmt_node_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *node);
58 int ocs_mgmt_node_set(char *parent, char *name, char *value, void *node);
60 void *arg_out, uint32_t arg_out_length, void *node);
80 ocs_node_abort_all_els(ocs_node_t *node) in ocs_node_abort_all_els() argument
86 ocs_node_hold_frames(node); in ocs_node_abort_all_els()
87 ocs_lock(&node->active_ios_lock); in ocs_node_abort_all_els()
88 ocs_list_foreach_safe(&node->els_io_active_list, els, els_next) { in ocs_node_abort_all_els()
89 ocs_log_debug(node->ocs, "[%s] initiate ELS abort %s\n", node->display_name, els->display_name); in ocs_node_abort_all_els()
90 ocs_unlock(&node->active_ios_lock); in ocs_node_abort_all_els()
93 ocs_lock(&node->active_ios_lock); in ocs_node_abort_all_els()
95 ocs_unlock(&node->active_ios_lock); in ocs_node_abort_all_els()
117 ocs_node_t *node = rnode->node; in ocs_remote_node_cb() local
142 if ((node->node_group != NULL) && in ocs_remote_node_cb()
147 ocs_sport_lock(node->sport); in ocs_remote_node_cb()
149 ocs_list_foreach(&node->sport->node_list, n) { in ocs_remote_node_cb()
150 if (node == n) { in ocs_remote_node_cb()
154 if ((!n->rnode.attached) && (node->node_group == n->node_group)) { in ocs_remote_node_cb()
164 ocs_sport_unlock(node->sport); in ocs_remote_node_cb()
167 ocs_node_post_event(node, sm_event, NULL); in ocs_remote_node_cb()
184 ocs_node_t *node; in ocs_node_find() local
188 node = spv_get(sport->lookup, port_id); in ocs_node_find()
190 return node; in ocs_node_find()
205 ocs_node_t *node = NULL; in ocs_node_find_wwpn() local
210 ocs_list_foreach(&sport->node_list, node) { in ocs_node_find_wwpn()
211 if (ocs_node_get_wwpn(node) == wwpn) { in ocs_node_find_wwpn()
213 return node; in ocs_node_find_wwpn()
237 ocs_node_t *node; in ocs_node_create_pool() local
264 node = ocs_malloc(ocs, sizeof(ocs_node_t), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_node_create_pool()
265 if (node == NULL) { in ocs_node_create_pool()
271 node->instance_index = i; in ocs_node_create_pool()
272 node->max_wr_xfer_size = max_xfer_size; in ocs_node_create_pool()
273 node->rnode.indicator = UINT32_MAX; in ocs_node_create_pool()
275 rc = ocs_dma_alloc(ocs, &node->sparm_dma_buf, 256, 16); in ocs_node_create_pool()
277 ocs_free(ocs, node, sizeof(ocs_node_t)); in ocs_node_create_pool()
282 xport->nodes[i] = node; in ocs_node_create_pool()
283 ocs_list_add_tail(&xport->nodes_free_list, node); in ocs_node_create_pool()
307 ocs_node_t *node; in ocs_node_free_pool() local
316 node = xport->nodes[i]; in ocs_node_free_pool()
317 if (node) { in ocs_node_free_pool()
319 ocs_dma_free(ocs, &node->sparm_dma_buf); in ocs_node_free_pool()
320 ocs_free(ocs, node, sizeof(ocs_node_t)); in ocs_node_free_pool()
346 ocs_node_t *node = NULL; in ocs_node_get_instance() local
352 node = xport->nodes[index]; in ocs_node_get_instance()
353 return node->attached ? node : NULL; in ocs_node_get_instance()
372 ocs_node_t *node = NULL; in ocs_node_alloc() local
387 node = ocs_list_remove_head(&xport->nodes_free_list); in ocs_node_alloc()
389 if (node == NULL) { in ocs_node_alloc()
395 instance_index = node->instance_index; in ocs_node_alloc()
396 max_wr_xfer_size = node->max_wr_xfer_size; in ocs_node_alloc()
397 sparm_dma_buf = node->sparm_dma_buf; in ocs_node_alloc()
399 ocs_memset(node, 0, sizeof(*node)); in ocs_node_alloc()
400 node->instance_index = instance_index; in ocs_node_alloc()
401 node->max_wr_xfer_size = max_wr_xfer_size; in ocs_node_alloc()
402 node->sparm_dma_buf = sparm_dma_buf; in ocs_node_alloc()
403 node->rnode.indicator = UINT32_MAX; in ocs_node_alloc()
405 node->sport = sport; in ocs_node_alloc()
408 node->ocs = ocs; in ocs_node_alloc()
409 node->init = init; in ocs_node_alloc()
410 node->targ = targ; in ocs_node_alloc()
412 rc = ocs_hw_node_alloc(&ocs->hw, &node->rnode, port_id, sport); in ocs_node_alloc()
419 ocs_list_add_tail(&xport->nodes_free_list, node); in ocs_node_alloc()
424 ocs_list_add_tail(&sport->node_list, node); in ocs_node_alloc()
426 ocs_node_lock_init(node); in ocs_node_alloc()
427 ocs_lock_init(ocs, &node->pend_frames_lock, "pend_frames_lock[%d]", node->instance_index); in ocs_node_alloc()
428 ocs_list_init(&node->pend_frames, ocs_hw_sequence_t, link); in ocs_node_alloc()
429 ocs_lock_init(ocs, &node->active_ios_lock, "active_ios[%d]", node->instance_index); in ocs_node_alloc()
430 ocs_list_init(&node->active_ios, ocs_io_t, link); in ocs_node_alloc()
431 ocs_list_init(&node->els_io_pend_list, ocs_io_t, link); in ocs_node_alloc()
432 ocs_list_init(&node->els_io_active_list, ocs_io_t, link); in ocs_node_alloc()
433 ocs_scsi_io_alloc_enable(node); in ocs_node_alloc()
436 ocs_memset(node->sparm_dma_buf.virt, 0, node->sparm_dma_buf.size); in ocs_node_alloc()
438 node->rnode.node = node; in ocs_node_alloc()
439 node->sm.app = node; in ocs_node_alloc()
440 node->evtdepth = 0; in ocs_node_alloc()
442 ocs_node_update_display_name(node); in ocs_node_alloc()
444 spv_set(sport->lookup, port_id, node); in ocs_node_alloc()
446 node->mgmt_functions = &node_mgmt_functions; in ocs_node_alloc()
448 return node; in ocs_node_alloc()
463 ocs_node_free(ocs_node_t *node) in ocs_node_free() argument
472 ocs_assert(node, -1); in ocs_node_free()
473 ocs_assert(node->sport, -1); in ocs_node_free()
474 ocs_assert(node->ocs, -1); in ocs_node_free()
475 sport = node->sport; in ocs_node_free()
477 ocs = node->ocs; in ocs_node_free()
481 node_printf(node, "Free'd\n"); in ocs_node_free()
483 if(node->refound) { in ocs_node_free()
488 ns = ocs_node_find(node->sport, FC_ADDR_NAMESERVER); in ocs_node_free()
493 ocs_list_remove(&sport->node_list, node); in ocs_node_free()
496 if (OCS_HW_RTN_IS_ERROR((rc = ocs_hw_node_free_resources(&ocs->hw, &node->rnode)))) { in ocs_node_free()
502 if (ocs_timer_pending(&node->gidpt_delay_timer)) { in ocs_node_free()
503 ocs_del_timer(&node->gidpt_delay_timer); in ocs_node_free()
506 if (node->fcp2device) { in ocs_node_free()
507 ocs_del_crn(node); in ocs_node_free()
512 ocs_log_test(node->ocs, "assertion failed: sport lookup is NULL\n"); in ocs_node_free()
517 spv_set(sport->lookup, node->rnode.fc_id, NULL); in ocs_node_free()
533 node->sport = NULL; in ocs_node_free()
534 node->sm.current_state = NULL; in ocs_node_free()
536 ocs_node_lock_free(node); in ocs_node_free()
537 ocs_lock_free(&node->pend_frames_lock); in ocs_node_free()
538 ocs_lock_free(&node->active_ios_lock); in ocs_node_free()
542 ocs_list_add_tail(&xport->nodes_free_list, node); in ocs_node_free()
565 ocs_node_force_free(ocs_node_t *node) in ocs_node_force_free() argument
573 ocs_sm_disable(&node->sm); in ocs_node_force_free()
574 ocs_strncpy(node->prev_state_name, node->current_state_name, sizeof(node->prev_state_name)); in ocs_node_force_free()
575 ocs_strncpy(node->current_state_name, "disabled", sizeof(node->current_state_name)); in ocs_node_force_free()
578 ocs_scsi_notify_node_force_free(node); in ocs_node_force_free()
580 ocs_lock(&node->active_ios_lock); in ocs_node_force_free()
581 ocs_list_foreach_safe(&node->active_ios, io, next) { in ocs_node_force_free()
582 ocs_list_remove(&io->node->active_ios, io); in ocs_node_force_free()
583 ocs_io_free(node->ocs, io); in ocs_node_force_free()
585 ocs_unlock(&node->active_ios_lock); in ocs_node_force_free()
588 ocs_lock(&node->active_ios_lock); in ocs_node_force_free()
589 ocs_list_foreach_safe(&node->els_io_pend_list, els, els_next) { in ocs_node_force_free()
591 ocs_list_remove(&node->els_io_pend_list, els); in ocs_node_force_free()
593 ocs_io_free(node->ocs, els); in ocs_node_force_free()
595 ocs_unlock(&node->active_ios_lock); in ocs_node_force_free()
598 ocs_lock(&node->active_ios_lock); in ocs_node_force_free()
599 ocs_list_foreach_safe(&node->els_io_active_list, els, els_next) { in ocs_node_force_free()
601 ocs_list_remove(&node->els_io_active_list, els); in ocs_node_force_free()
603 ocs_io_free(node->ocs, els); in ocs_node_force_free()
605 ocs_unlock(&node->active_ios_lock); in ocs_node_force_free()
608 ocs_node_purge_pending(node); in ocs_node_force_free()
610 ocs_node_free(node); in ocs_node_force_free()
622 ocs_node_attach(ocs_node_t *node) in ocs_node_attach() argument
625 ocs_sport_t *sport = node->sport; in ocs_node_attach()
627 ocs_t *ocs = node->ocs; in ocs_node_attach()
635 ocs_node_build_eui_name(node->wwpn, sizeof(node->wwpn), ocs_node_get_wwpn(node)); in ocs_node_attach()
636 ocs_node_build_eui_name(node->wwnn, sizeof(node->wwnn), ocs_node_get_wwnn(node)); in ocs_node_attach()
639 ocs_node_group_init(node); in ocs_node_attach()
642 ocs_dma_copy_in(&node->sparm_dma_buf, node->service_params+4, sizeof(node->service_params)-4); in ocs_node_attach()
645 ocs_node_lock(node); in ocs_node_attach()
646 rc = ocs_hw_node_attach(&ocs->hw, &node->rnode, &node->sparm_dma_buf); in ocs_node_attach()
650 ocs_node_unlock(node); in ocs_node_attach()
706 ocs_node_update_display_name(ocs_node_t *node) in ocs_node_update_display_name() argument
708 uint32_t port_id = node->rnode.fc_id; in ocs_node_update_display_name()
709 ocs_sport_t *sport = node->sport; in ocs_node_update_display_name()
716 …ocs_snprintf(node->display_name, sizeof(node->display_name), "%s.%s", sport->display_name, portid_… in ocs_node_update_display_name()
730 ocs_node_send_ls_io_cleanup(ocs_node_t *node) in ocs_node_send_ls_io_cleanup() argument
732 ocs_t *ocs = node->ocs; in ocs_node_send_ls_io_cleanup()
734 if (node->send_ls_acc != OCS_NODE_SEND_LS_ACC_NONE) { in ocs_node_send_ls_io_cleanup()
735 ocs_assert(node->ls_acc_io); in ocs_node_send_ls_io_cleanup()
737 node->display_name, node->ls_acc_oxid); in ocs_node_send_ls_io_cleanup()
739 node->ls_acc_io->hio = NULL; in ocs_node_send_ls_io_cleanup()
740 ocs_els_io_free(node->ls_acc_io); in ocs_node_send_ls_io_cleanup()
741 node->send_ls_acc = OCS_NODE_SEND_LS_ACC_NONE; in ocs_node_send_ls_io_cleanup()
742 node->ls_acc_io = NULL; in ocs_node_send_ls_io_cleanup()
771 ocs_node_hold_frames(node); in __ocs_node_shutdown()
772 ocs_assert(ocs_node_active_ios_empty(node), NULL); in __ocs_node_shutdown()
773 ocs_assert(ocs_els_io_list_empty(node, &node->els_io_active_list), NULL); in __ocs_node_shutdown()
776 node->req_free = 1; in __ocs_node_shutdown()
778 switch (node->shutdown_reason) { in __ocs_node_shutdown()
789 ocs_assert(node->send_ls_acc == OCS_NODE_SEND_LS_ACC_PLOGI, NULL); in __ocs_node_shutdown()
790 node_printf(node, "Shutdown reason: implicit logout, re-authenticate\n"); in __ocs_node_shutdown()
792 ocs_scsi_io_alloc_enable(node); in __ocs_node_shutdown()
795 node->req_free = 0; in __ocs_node_shutdown()
796 rc = ocs_node_attach(node); in __ocs_node_shutdown()
797 ocs_node_transition(node, __ocs_d_wait_node_attach, NULL); in __ocs_node_shutdown()
799 ocs_node_post_event(node, OCS_EVT_NODE_ATTACH_OK, NULL); in __ocs_node_shutdown()
806 ocs_node_send_ls_io_cleanup(node); in __ocs_node_shutdown()
807 ocs_assert(ocs_els_io_list_empty(node, &node->els_io_pend_list), NULL); in __ocs_node_shutdown()
809 ocs_lock(&node->pend_frames_lock); in __ocs_node_shutdown()
810 pend_frames_empty = ocs_list_empty(&node->pend_frames); in __ocs_node_shutdown()
811 ocs_unlock(&node->pend_frames_lock); in __ocs_node_shutdown()
818 node_printf(node, "Shutdown: explicit logo pend=%d sport.ini=%d node.tgt=%d\n", in __ocs_node_shutdown()
819 !pend_frames_empty, node->sport->enable_ini, node->targ); in __ocs_node_shutdown()
821 if((!pend_frames_empty) || (node->sport->enable_ini && node->targ)) { in __ocs_node_shutdown()
823 if (node->sport->enable_ini && node->targ) { in __ocs_node_shutdown()
831 ocs_scsi_io_alloc_enable(node); in __ocs_node_shutdown()
832 node->req_free = 0; in __ocs_node_shutdown()
837 ocs_node_init_device(node, send_plogi); in __ocs_node_shutdown()
849 ocs_node_send_ls_io_cleanup(node); in __ocs_node_shutdown()
850 ocs_assert(ocs_els_io_list_empty(node, &node->els_io_pend_list), NULL); in __ocs_node_shutdown()
852 node_printf(node, "Shutdown reason: default, purge pending\n"); in __ocs_node_shutdown()
853 ocs_node_purge_pending(node); in __ocs_node_shutdown()
860 ocs_node_accept_frames(node); in __ocs_node_shutdown()
883 ocs_node_check_els_quiesced(ocs_node_t *node) in ocs_node_check_els_quiesced() argument
885 ocs_assert(node, -1); in ocs_node_check_els_quiesced()
888 if ((node->els_req_cnt == 0) && (node->els_cmpl_cnt == 0) && in ocs_node_check_els_quiesced()
889 ocs_els_io_list_empty(node, &node->els_io_active_list)) { in ocs_node_check_els_quiesced()
890 if (!node->attached) { in ocs_node_check_els_quiesced()
892 node_printf(node, "HW node not attached\n"); in ocs_node_check_els_quiesced()
893 ocs_node_transition(node, __ocs_node_wait_ios_shutdown, NULL); in ocs_node_check_els_quiesced()
896 node_printf(node, "HW node still attached\n"); in ocs_node_check_els_quiesced()
897 ocs_node_transition(node, __ocs_node_wait_node_free, NULL); in ocs_node_check_els_quiesced()
918 ocs_node_initiate_cleanup(ocs_node_t *node) in ocs_node_initiate_cleanup() argument
923 ocs_assert(node); in ocs_node_initiate_cleanup()
924 ocs = node->ocs; in ocs_node_initiate_cleanup()
927 ocs_lock(&node->active_ios_lock); in ocs_node_initiate_cleanup()
928 ocs_list_foreach_safe(&node->els_io_pend_list, els, els_next) { in ocs_node_initiate_cleanup()
930 if ((node->send_ls_acc != OCS_NODE_SEND_LS_ACC_NONE) && in ocs_node_initiate_cleanup()
931 (els == node->ls_acc_io)) { in ocs_node_initiate_cleanup()
935 node_printf(node, "Freeing pending els %s\n", els->display_name); in ocs_node_initiate_cleanup()
936 ocs_list_remove(&node->els_io_pend_list, els); in ocs_node_initiate_cleanup()
938 ocs_io_free(node->ocs, els); in ocs_node_initiate_cleanup()
940 ocs_unlock(&node->active_ios_lock); in ocs_node_initiate_cleanup()
942 if (node->ls_acc_io && node->ls_acc_io->hio != NULL) { in ocs_node_initiate_cleanup()
950 ocs_assert(node->shutdown_reason == OCS_NODE_SHUTDOWN_IMPLICIT_LOGO); in ocs_node_initiate_cleanup()
951 ocs_assert(node->send_ls_acc == OCS_NODE_SEND_LS_ACC_PLOGI); in ocs_node_initiate_cleanup()
952 node_printf(node, "invalidating ls_acc_io due to implicit logo\n"); in ocs_node_initiate_cleanup()
955 ocs_hw_io_free(&ocs->hw, node->ls_acc_io->hio); in ocs_node_initiate_cleanup()
958 node->ls_acc_io->hio = NULL; in ocs_node_initiate_cleanup()
965 if (ocs_node_check_els_quiesced(node) == 0) { in ocs_node_initiate_cleanup()
970 ocs_node_abort_all_els(node); in ocs_node_initiate_cleanup()
971 ocs_node_transition(node, __ocs_node_wait_els_shutdown, NULL); in ocs_node_initiate_cleanup()
1000 ocs_node_hold_frames(node); in __ocs_node_wait_els_shutdown()
1001 if (ocs_els_io_list_empty(node, &node->els_io_active_list)) { in __ocs_node_wait_els_shutdown()
1002 node_printf(node, "All ELS IOs complete\n"); in __ocs_node_wait_els_shutdown()
1008 ocs_node_accept_frames(node); in __ocs_node_wait_els_shutdown()
1015 ocs_assert(node->els_req_cnt, NULL); in __ocs_node_wait_els_shutdown()
1016 node->els_req_cnt--; in __ocs_node_wait_els_shutdown()
1022 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_node_wait_els_shutdown()
1023 node->els_cmpl_cnt--; in __ocs_node_wait_els_shutdown()
1029 node_printf(node, "All ELS IOs complete\n"); in __ocs_node_wait_els_shutdown()
1030 ocs_assert(ocs_els_io_list_empty(node, &node->els_io_active_list), NULL); in __ocs_node_wait_els_shutdown()
1044 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_node_wait_els_shutdown()
1048 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_node_wait_els_shutdown()
1057 ocs_node_check_els_quiesced(node); in __ocs_node_wait_els_shutdown()
1086 ocs_node_hold_frames(node); in __ocs_node_wait_node_free()
1090 ocs_node_accept_frames(node); in __ocs_node_wait_node_free()
1095 node->attached = FALSE; in __ocs_node_wait_node_free()
1096 ocs_node_transition(node, __ocs_node_wait_ios_shutdown, NULL); in __ocs_node_wait_node_free()
1111 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_node_wait_node_free()
1115 node_printf(node, "%s received\n", ocs_sm_event_name(evt)); in __ocs_node_wait_node_free()
1150 ocs_node_hold_frames(node); in __ocs_node_wait_ios_shutdown()
1153 if (ocs_els_io_list_empty(node, &node->els_io_active_list)) { in __ocs_node_wait_ios_shutdown()
1155 if (!ocs_node_active_ios_empty(node)) { in __ocs_node_wait_ios_shutdown()
1156 ocs_lock(&node->active_ios_lock); in __ocs_node_wait_ios_shutdown()
1157 ocs_list_foreach_safe(&node->active_ios, io, next) { in __ocs_node_wait_ios_shutdown()
1158 ocs_list_remove(&io->node->active_ios, io); in __ocs_node_wait_ios_shutdown()
1159 ocs_io_free(node->ocs, io); in __ocs_node_wait_ios_shutdown()
1161 ocs_unlock(&node->active_ios_lock); in __ocs_node_wait_ios_shutdown()
1163 ocs_node_transition(node, __ocs_node_shutdown, NULL); in __ocs_node_wait_ios_shutdown()
1169 if (ocs_node_active_ios_empty(node) && in __ocs_node_wait_ios_shutdown()
1170 ocs_els_io_list_empty(node, &node->els_io_active_list)) { in __ocs_node_wait_ios_shutdown()
1171 ocs_node_transition(node, __ocs_node_shutdown, NULL); in __ocs_node_wait_ios_shutdown()
1177 ocs_node_accept_frames(node); in __ocs_node_wait_ios_shutdown()
1182 ocs_assert(node->els_req_cnt, NULL); in __ocs_node_wait_ios_shutdown()
1183 node->els_req_cnt--; in __ocs_node_wait_ios_shutdown()
1189 node->shutdown_reason = OCS_NODE_SHUTDOWN_DEFAULT; in __ocs_node_wait_ios_shutdown()
1193 ocs_log_debug(ocs, "[%s] %-20s\n", node->display_name, ocs_sm_event_name(evt)); in __ocs_node_wait_ios_shutdown()
1223 ocs_node_t *node = NULL; in __ocs_node_common() local
1228 node = ctx->app; in __ocs_node_common()
1229 ocs_assert(node->ocs, NULL); in __ocs_node_common()
1230 ocs = node->ocs; in __ocs_node_common()
1242 node->refound = 1; in __ocs_node_common()
1247 node->attached = TRUE; in __ocs_node_common()
1252 node->attached = FALSE; in __ocs_node_common()
1260 ocs_assert(node->els_cmpl_cnt, NULL); in __ocs_node_common()
1261 node->els_cmpl_cnt--; in __ocs_node_common()
1271 ocs_assert(node->els_req_cnt, NULL); in __ocs_node_common()
1272 node->els_req_cnt--; in __ocs_node_common()
1280 node->display_name, funcname, ((uint8_t*)cbdata->payload->dma.virt)[0]); in __ocs_node_common()
1300 node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_node_common()
1313 node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_node_common()
1321 node->display_name, funcname, ocs_sm_event_name(evt)); in __ocs_node_common()
1329 ocs_log_test(node->ocs, "[%s] %-20s %-20s not handled\n", node->display_name, funcname, in __ocs_node_common()
1349 ocs_node_save_sparms(ocs_node_t *node, void *payload) in ocs_node_save_sparms() argument
1351 ocs_memcpy(node->service_params, payload, sizeof(node->service_params)); in ocs_node_save_sparms()
1370 ocs_node_post_event(ocs_node_t *node, ocs_sm_event_t evt, void *arg) in ocs_node_post_event() argument
1373 ocs_assert(node); in ocs_node_post_event()
1375 ocs_node_lock(node); in ocs_node_post_event()
1376 node->evtdepth ++; in ocs_node_post_event()
1378 ocs_sm_post_event(&node->sm, evt, arg); in ocs_node_post_event()
1384 if (!node->hold_frames && (node->evtdepth == 1)) { in ocs_node_post_event()
1385 ocs_process_node_pending(node); in ocs_node_post_event()
1387 node->evtdepth --; in ocs_node_post_event()
1392 if ((node->evtdepth == 0) && node->req_free) { in ocs_node_post_event()
1395 ocs_node_unlock(node); in ocs_node_post_event()
1398 ocs_node_free(node); in ocs_node_post_event()
1419 ocs_node_transition(ocs_node_t *node, ocs_sm_function_t state, void *data) in ocs_node_transition() argument
1421 ocs_sm_ctx_t *ctx = &node->sm; in ocs_node_transition()
1423 ocs_node_lock(node); in ocs_node_transition()
1425 ocs_node_post_event(node, OCS_EVT_REENTER, data); in ocs_node_transition()
1427 ocs_node_post_event(node, OCS_EVT_EXIT, data); in ocs_node_transition()
1429 ocs_node_post_event(node, OCS_EVT_ENTER, data); in ocs_node_transition()
1431 ocs_node_unlock(node); in ocs_node_transition()
1469 ocs_node_get_wwpn(ocs_node_t *node) in ocs_node_get_wwpn() argument
1471 fc_plogi_payload_t *sp = (fc_plogi_payload_t*) node->service_params; in ocs_node_get_wwpn()
1489 ocs_node_get_wwnn(ocs_node_t *node) in ocs_node_get_wwnn() argument
1491 fc_plogi_payload_t *sp = (fc_plogi_payload_t*) node->service_params; in ocs_node_get_wwnn()
1508 ocs_ddump_node(ocs_textbuf_t *textbuf, ocs_node_t *node) in ocs_ddump_node() argument
1514 ocs_ddump_section(textbuf, "node", node->instance_index); in ocs_ddump_node()
1515 ocs_ddump_value(textbuf, "display_name", "%s", node->display_name); in ocs_ddump_node()
1516 ocs_ddump_value(textbuf, "current_state", "%s", node->current_state_name); in ocs_ddump_node()
1517 ocs_ddump_value(textbuf, "prev_state", "%s", node->prev_state_name); in ocs_ddump_node()
1518 ocs_ddump_value(textbuf, "current_evt", "%s", ocs_sm_event_name(node->current_evt)); in ocs_ddump_node()
1519 ocs_ddump_value(textbuf, "prev_evt", "%s", ocs_sm_event_name(node->prev_evt)); in ocs_ddump_node()
1521 ocs_ddump_value(textbuf, "indicator", "%#x", node->rnode.indicator); in ocs_ddump_node()
1522 ocs_ddump_value(textbuf, "fc_id", "%#06x", node->rnode.fc_id); in ocs_ddump_node()
1523 ocs_ddump_value(textbuf, "attached", "%d", node->rnode.attached); in ocs_ddump_node()
1525 ocs_ddump_value(textbuf, "hold_frames", "%d", node->hold_frames); in ocs_ddump_node()
1526 ocs_ddump_value(textbuf, "io_alloc_enabled", "%d", node->io_alloc_enabled); in ocs_ddump_node()
1527 ocs_ddump_value(textbuf, "shutdown_reason", "%d", node->shutdown_reason); in ocs_ddump_node()
1528 ocs_ddump_value(textbuf, "send_ls_acc", "%d", node->send_ls_acc); in ocs_ddump_node()
1529 ocs_ddump_value(textbuf, "ls_acc_did", "%d", node->ls_acc_did); in ocs_ddump_node()
1530 ocs_ddump_value(textbuf, "ls_acc_oxid", "%#04x", node->ls_acc_oxid); in ocs_ddump_node()
1531 ocs_ddump_value(textbuf, "req_free", "%d", node->req_free); in ocs_ddump_node()
1532 ocs_ddump_value(textbuf, "els_req_cnt", "%d", node->els_req_cnt); in ocs_ddump_node()
1533 ocs_ddump_value(textbuf, "els_cmpl_cnt", "%d", node->els_cmpl_cnt); in ocs_ddump_node()
1535 ocs_ddump_value(textbuf, "targ", "%d", node->targ); in ocs_ddump_node()
1536 ocs_ddump_value(textbuf, "init", "%d", node->init); in ocs_ddump_node()
1537 ocs_ddump_value(textbuf, "wwnn", "%s", node->wwnn); in ocs_ddump_node()
1538 ocs_ddump_value(textbuf, "wwpn", "%s", node->wwpn); in ocs_ddump_node()
1539 …ocs_ddump_value(textbuf, "login_state", "%d", (node->sm.current_state == __ocs_d_device_ready) ? 1… in ocs_ddump_node()
1540 ocs_ddump_value(textbuf, "chained_io_count", "%d", node->chained_io_count); in ocs_ddump_node()
1541 ocs_ddump_value(textbuf, "abort_cnt", "%d", node->abort_cnt); in ocs_ddump_node()
1543 ocs_display_sparams(NULL, "node_sparams", 1, textbuf, node->service_params+4); in ocs_ddump_node()
1545 ocs_lock(&node->pend_frames_lock); in ocs_ddump_node()
1546 if (!ocs_list_empty(&node->pend_frames)) { in ocs_ddump_node()
1549 ocs_list_foreach(&node->pend_frames, frame) { in ocs_ddump_node()
1561 ocs_unlock(&node->pend_frames_lock); in ocs_ddump_node()
1563 ocs_scsi_ini_ddump(textbuf, OCS_SCSI_DDUMP_NODE, node); in ocs_ddump_node()
1564 ocs_scsi_tgt_ddump(textbuf, OCS_SCSI_DDUMP_NODE, node); in ocs_ddump_node()
1566 ocs_lock(&node->active_ios_lock); in ocs_ddump_node()
1568 ocs_list_foreach(&node->active_ios, io) { in ocs_ddump_node()
1574 ocs_list_foreach(&node->els_io_pend_list, els) { in ocs_ddump_node()
1580 ocs_list_foreach(&node->els_io_active_list, els) { in ocs_ddump_node()
1584 ocs_unlock(&node->active_ios_lock); in ocs_ddump_node()
1586 ocs_ddump_endsection(textbuf, "node", node->instance_index); in ocs_ddump_node()
1611 ocs_node_t *node = NULL; in node_check_els_req() local
1616 node = ctx->app; in node_check_els_req()
1617 ocs_assert(node, -1); in node_check_els_req()
1618 ocs = node->ocs; in node_check_els_req()
1628 ocs_log_debug(node->ocs, "[%s] %-20s expecting ELS cmd=x%x received type=%d\n", in node_check_els_req()
1629 node->display_name, funcname, cmd, cbdata->els->hio_type); in node_check_els_req()
1631 ocs_log_debug(node->ocs, "[%s] %-20s expecting ELS cmd=x%x received cmd=x%x\n", in node_check_els_req()
1632 node->display_name, funcname, cmd, els_gen->command_code); in node_check_els_req()
1661 ocs_node_t *node = NULL; in node_check_ns_req() local
1666 node = ctx->app; in node_check_ns_req()
1667 ocs_assert(node, -1); in node_check_ns_req()
1668 ocs = node->ocs; in node_check_ns_req()
1678 ocs_log_debug(node->ocs, "[%s] %-20s expecting NS cmd=x%x received type=%d\n", in node_check_ns_req()
1679 node->display_name, funcname, cmd, cbdata->els->hio_type); in node_check_ns_req()
1681 ocs_log_debug(node->ocs, "[%s] %-20s expecting NS cmd=x%x received cmd=x%x\n", in node_check_ns_req()
1682 node->display_name, funcname, cmd, fcct->cmd_rsp_code); in node_check_ns_req()
1695 ocs_node_t *node = (ocs_node_t *)object; in ocs_mgmt_node_list() local
1697 ocs_mgmt_start_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_list()
1720 ocs_lock(&node->active_ios_lock); in ocs_mgmt_node_list()
1721 ocs_list_foreach(&node->active_ios, io) { in ocs_mgmt_node_list()
1726 ocs_unlock(&node->active_ios_lock); in ocs_mgmt_node_list()
1728 ocs_mgmt_end_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_list()
1735 ocs_node_t *node = (ocs_node_t *)object; in ocs_mgmt_node_get() local
1739 ocs_mgmt_start_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_get()
1741 ocs_snprintf(qualifier, sizeof(qualifier), "%s/node[%d]", parent, node->instance_index); in ocs_mgmt_node_get()
1749 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "display_name", node->display_name); in ocs_mgmt_node_get()
1752 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "indicator", "0x%x", node->rnode.indicator); in ocs_mgmt_node_get()
1755 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fc_id", "0x%06x", node->rnode.fc_id); in ocs_mgmt_node_get()
1758 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "attached", node->rnode.attached); in ocs_mgmt_node_get()
1761 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "hold_frames", node->hold_frames); in ocs_mgmt_node_get()
1764 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "io_alloc_enabled", node->io_alloc_enabled); in ocs_mgmt_node_get()
1767 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "req_free", node->req_free); in ocs_mgmt_node_get()
1770 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ls_acc_oxid", "0x%#04x", node->ls_acc_oxid); in ocs_mgmt_node_get()
1773 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ls_acc_did", "0x%#04x", node->ls_acc_did); in ocs_mgmt_node_get()
1776 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "abort_cnt", "%d", node->abort_cnt); in ocs_mgmt_node_get()
1779 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "targ", node->targ); in ocs_mgmt_node_get()
1782 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "init", node->init); in ocs_mgmt_node_get()
1785 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "wwpn", "%s", node->wwpn); in ocs_mgmt_node_get()
1788 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "wwnn", "%s", node->wwnn); in ocs_mgmt_node_get()
1791 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "current_state", node->current_state_name); in ocs_mgmt_node_get()
1794 …ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "login_state", "%d", (node->sm.current_state == __ocs_d_d… in ocs_mgmt_node_get()
1798 ocs_lock(&node->pend_frames_lock); in ocs_mgmt_node_get()
1799 ocs_list_foreach(&node->pend_frames, frame) { in ocs_mgmt_node_get()
1809 ocs_unlock(&node->pend_frames_lock); in ocs_mgmt_node_get()
1812 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "chained_io_count", "%d", node->chained_io_count); in ocs_mgmt_node_get()
1816 ocs_lock(&node->active_ios_lock); in ocs_mgmt_node_get()
1817 ocs_list_foreach(&node->active_ios, io) { in ocs_mgmt_node_get()
1826 ocs_unlock(&node->active_ios_lock); in ocs_mgmt_node_get()
1830 ocs_mgmt_end_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_get()
1839 ocs_node_t *node = (ocs_node_t *)object; in ocs_mgmt_node_get_all() local
1842 ocs_mgmt_start_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_get_all()
1844 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "display_name", node->display_name); in ocs_mgmt_node_get_all()
1845 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "indicator", "0x%x", node->rnode.indicator); in ocs_mgmt_node_get_all()
1846 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fc_id", "0x%06x", node->rnode.fc_id); in ocs_mgmt_node_get_all()
1847 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "attached", node->rnode.attached); in ocs_mgmt_node_get_all()
1848 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "hold_frames", node->hold_frames); in ocs_mgmt_node_get_all()
1849 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "io_alloc_enabled", node->io_alloc_enabled); in ocs_mgmt_node_get_all()
1850 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "req_free", node->req_free); in ocs_mgmt_node_get_all()
1851 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ls_acc_oxid", "0x%#04x", node->ls_acc_oxid); in ocs_mgmt_node_get_all()
1852 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ls_acc_did", "0x%#04x", node->ls_acc_did); in ocs_mgmt_node_get_all()
1853 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "abort_cnt", "%d", node->abort_cnt); in ocs_mgmt_node_get_all()
1854 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "targ", node->targ); in ocs_mgmt_node_get_all()
1855 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "init", node->init); in ocs_mgmt_node_get_all()
1856 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "wwpn", "%s", node->wwpn); in ocs_mgmt_node_get_all()
1857 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "wwnn", "%s", node->wwnn); in ocs_mgmt_node_get_all()
1859 ocs_lock(&node->pend_frames_lock); in ocs_mgmt_node_get_all()
1860 ocs_list_foreach(&node->pend_frames, frame) { in ocs_mgmt_node_get_all()
1870 ocs_unlock(&node->pend_frames_lock); in ocs_mgmt_node_get_all()
1872 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "chained_io_count", "%d", node->chained_io_count); in ocs_mgmt_node_get_all()
1874 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "current_state", node->current_state_name); in ocs_mgmt_node_get_all()
1875 …ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "login_state", "%d", (node->sm.current_state == __ocs_d_d… in ocs_mgmt_node_get_all()
1877 ocs_lock(&node->active_ios_lock); in ocs_mgmt_node_get_all()
1878 ocs_list_foreach(&node->active_ios, io) { in ocs_mgmt_node_get_all()
1883 ocs_unlock(&node->active_ios_lock); in ocs_mgmt_node_get_all()
1885 ocs_mgmt_end_section(textbuf, "node", node->instance_index); in ocs_mgmt_node_get_all()
1892 ocs_node_t *node = (ocs_node_t *)object; in ocs_mgmt_node_set() local
1896 ocs_snprintf(qualifier, sizeof(qualifier), "%s/node[%d]", parent, node->instance_index); in ocs_mgmt_node_set()
1900 ocs_lock(&node->active_ios_lock); in ocs_mgmt_node_set()
1901 ocs_list_foreach(&node->active_ios, io) { in ocs_mgmt_node_set()
1910 ocs_unlock(&node->active_ios_lock); in ocs_mgmt_node_set()
1921 ocs_node_t *node = (ocs_node_t *)object; in ocs_mgmt_node_exec() local
1925 ocs_snprintf(qualifier, sizeof(qualifier), "%s.node%d", parent, node->instance_index); in ocs_mgmt_node_exec()
1932 ocs_node_post_event(node, OCS_EVT_RESUME, NULL); in ocs_mgmt_node_exec()
1937 ocs_lock(&node->active_ios_lock); in ocs_mgmt_node_exec()
1938 ocs_list_foreach(&node->active_ios, io) { in ocs_mgmt_node_exec()
1948 ocs_unlock(&node->active_ios_lock); in ocs_mgmt_node_exec()
1966 ocs_node_active_ios_empty(ocs_node_t *node) in ocs_node_active_ios_empty() argument
1970 ocs_lock(&node->active_ios_lock); in ocs_node_active_ios_empty()
1971 empty = ocs_list_empty(&node->active_ios); in ocs_node_active_ios_empty()
1972 ocs_unlock(&node->active_ios_lock); in ocs_node_active_ios_empty()
1989 ocs_node_pause(ocs_node_t *node, ocs_sm_function_t state) in ocs_node_pause() argument
1991 node->nodedb_state = state; in ocs_node_pause()
1992 ocs_node_transition(node, __ocs_node_paused, NULL); in ocs_node_pause()
2017 node_printf(node, "Paused\n"); in __ocs_node_paused()
2021 ocs_sm_function_t pf = node->nodedb_state; in __ocs_node_paused()
2023 node->nodedb_state = NULL; in __ocs_node_paused()
2024 ocs_node_transition(node, pf, NULL); in __ocs_node_paused()
2032 node->req_free = 1; in __ocs_node_paused()
2053 ocs_node_resume(ocs_node_t *node) in ocs_node_resume() argument
2055 ocs_assert(node != NULL, -1); in ocs_node_resume()
2057 ocs_node_post_event(node, OCS_EVT_RESUME, NULL); in ocs_node_resume()
2080 ocs_node_recv_els_frame(ocs_node_t *node, ocs_hw_sequence_t *seq) in ocs_node_recv_els_frame() argument
2099 ocs_t *ocs = node->ocs; in ocs_node_recv_els_frame()
2122 …ocs_display_sparams(node->display_name, "flogi rcvd req", 0, NULL, ((uint8_t*)seq->payload->dma.vi… in ocs_node_recv_els_frame()
2125 …ocs_display_sparams(node->display_name, "fdisc rcvd req", 0, NULL, ((uint8_t*)seq->payload->dma.vi… in ocs_node_recv_els_frame()
2128 …ocs_display_sparams(node->display_name, "plogi rcvd req", 0, NULL, ((uint8_t*)seq->payload->dma.vi… in ocs_node_recv_els_frame()
2134 cbdata.io = ocs_els_io_alloc(node, payload_size, OCS_ELS_ROLE_RESPONDER); in ocs_node_recv_els_frame()
2141 ocs_node_post_event(node, evt, &cbdata); in ocs_node_recv_els_frame()
2143 …node_printf(node, "failure to allocate SCSI IO for ELS s_id %06x d_id %06x ox_id %04x rx_id %04x\n… in ocs_node_recv_els_frame()
2167 ocs_node_recv_abts_frame(ocs_node_t *node, ocs_hw_sequence_t *seq) in ocs_node_recv_abts_frame() argument
2169 ocs_t *ocs = node->ocs; in ocs_node_recv_abts_frame()
2177 node->abort_cnt++; in ocs_node_recv_abts_frame()
2183 if (ocs_io_find_tgt_io(ocs, node, ox_id, rx_id) == NULL) { in ocs_node_recv_abts_frame()
2191 rc = ocs_sframe_send_bls_acc(node, seq); in ocs_node_recv_abts_frame()
2204 cbdata.io = ocs_scsi_io_alloc(node, OCS_SCSI_IO_ROLE_RESPONDER); in ocs_node_recv_abts_frame()
2212 cbdata.io->node = node; in ocs_node_recv_abts_frame()
2215 ocs_node_post_event(node, OCS_EVT_ABTS_RCVD, &cbdata); in ocs_node_recv_abts_frame()
2218 …node_printf(node, "SCSI IO allocation failed for ABTS received s_id %06x d_id %06x ox_id %04x rx_i… in ocs_node_recv_abts_frame()
2245 ocs_node_recv_ct_frame(ocs_node_t *node, ocs_hw_sequence_t *seq) in ocs_node_recv_ct_frame() argument
2247 ocs_t *ocs = node->ocs; in ocs_node_recv_ct_frame()
2291 cbdata.io = ocs_els_io_alloc(node, payload_size, OCS_ELS_ROLE_RESPONDER); in ocs_node_recv_ct_frame()
2293 node_printf(node, "GS IO failed for s_id %06x d_id %06x ox_id %04x rx_id %04x\n", in ocs_node_recv_ct_frame()
2299 ocs_node_post_event(node, evt, &cbdata); in ocs_node_recv_ct_frame()
2320 ocs_node_recv_fcp_cmd(ocs_node_t *node, ocs_hw_sequence_t *seq) in ocs_node_recv_fcp_cmd() argument
2323 ocs_t *ocs = node->ocs; in ocs_node_recv_fcp_cmd()
2328 ocs_node_post_event(node, OCS_EVT_FCP_CMD_RCVD, &cbdata); in ocs_node_recv_fcp_cmd()
2347 ocs_node_recv_bls_no_sit(ocs_node_t *node, ocs_hw_sequence_t *seq) in ocs_node_recv_bls_no_sit() argument
2351 node_printf(node, "Dropping frame hdr = %08x %08x %08x %08x %08x %08x\n", in ocs_node_recv_bls_no_sit()