Lines Matching +full:down +full:- +full:counters

1 // SPDX-License-Identifier: GPL-2.0
35 xport->efct = efct; in efct_xport_alloc()
49 if (!efct->sess_debugfs_dir) { in efct_xport_init_debugfs()
50 efct->sess_debugfs_dir = debugfs_create_dir("sessions", in efct_xport_init_debugfs()
52 if (IS_ERR(efct->sess_debugfs_dir)) { in efct_xport_init_debugfs()
63 return -EIO; in efct_xport_init_debugfs()
69 debugfs_remove(efct->sess_debugfs_dir); in efct_xport_delete_debugfs()
70 efct->sess_debugfs_dir = NULL; in efct_xport_delete_debugfs()
83 struct efct *efct = xport->efct; in efct_xport_attach()
86 rc = efct_hw_setup(&efct->hw, efct, efct->pci); in efct_xport_attach()
88 efc_log_err(efct, "%s: Can't setup hardware\n", efct->desc); in efct_xport_attach()
92 efct_hw_parse_filter(&efct->hw, (void *)efct->filter_def); in efct_xport_attach()
94 xport->io_pool = efct_io_pool_create(efct, efct->hw.config.n_sgl); in efct_xport_attach()
95 if (!xport->io_pool) { in efct_xport_attach()
97 return -ENOMEM; in efct_xport_attach()
105 struct efct_hw_link_stat_counts *counters, void *arg) in efct_xport_link_stats_cb() argument
109 result->stats.link_stats.link_failure_error_count = in efct_xport_link_stats_cb()
110 counters[EFCT_HW_LINK_STAT_LINK_FAILURE_COUNT].counter; in efct_xport_link_stats_cb()
111 result->stats.link_stats.loss_of_sync_error_count = in efct_xport_link_stats_cb()
112 counters[EFCT_HW_LINK_STAT_LOSS_OF_SYNC_COUNT].counter; in efct_xport_link_stats_cb()
113 result->stats.link_stats.primitive_sequence_error_count = in efct_xport_link_stats_cb()
114 counters[EFCT_HW_LINK_STAT_PRIMITIVE_SEQ_COUNT].counter; in efct_xport_link_stats_cb()
115 result->stats.link_stats.invalid_transmission_word_error_count = in efct_xport_link_stats_cb()
116 counters[EFCT_HW_LINK_STAT_INVALID_XMIT_WORD_COUNT].counter; in efct_xport_link_stats_cb()
117 result->stats.link_stats.crc_error_count = in efct_xport_link_stats_cb()
118 counters[EFCT_HW_LINK_STAT_CRC_COUNT].counter; in efct_xport_link_stats_cb()
120 complete(&result->stats.done); in efct_xport_link_stats_cb()
125 struct efct_hw_host_stat_counts *counters, void *arg) in efct_xport_host_stats_cb() argument
129 result->stats.host_stats.transmit_kbyte_count = in efct_xport_host_stats_cb()
130 counters[EFCT_HW_HOST_STAT_TX_KBYTE_COUNT].counter; in efct_xport_host_stats_cb()
131 result->stats.host_stats.receive_kbyte_count = in efct_xport_host_stats_cb()
132 counters[EFCT_HW_HOST_STAT_RX_KBYTE_COUNT].counter; in efct_xport_host_stats_cb()
133 result->stats.host_stats.transmit_frame_count = in efct_xport_host_stats_cb()
134 counters[EFCT_HW_HOST_STAT_TX_FRAME_COUNT].counter; in efct_xport_host_stats_cb()
135 result->stats.host_stats.receive_frame_count = in efct_xport_host_stats_cb()
136 counters[EFCT_HW_HOST_STAT_RX_FRAME_COUNT].counter; in efct_xport_host_stats_cb()
138 complete(&result->stats.done); in efct_xport_host_stats_cb()
143 struct efct_hw_link_stat_counts *counters, in efct_xport_async_link_stats_cb() argument
148 result->stats.link_stats.link_failure_error_count = in efct_xport_async_link_stats_cb()
149 counters[EFCT_HW_LINK_STAT_LINK_FAILURE_COUNT].counter; in efct_xport_async_link_stats_cb()
150 result->stats.link_stats.loss_of_sync_error_count = in efct_xport_async_link_stats_cb()
151 counters[EFCT_HW_LINK_STAT_LOSS_OF_SYNC_COUNT].counter; in efct_xport_async_link_stats_cb()
152 result->stats.link_stats.primitive_sequence_error_count = in efct_xport_async_link_stats_cb()
153 counters[EFCT_HW_LINK_STAT_PRIMITIVE_SEQ_COUNT].counter; in efct_xport_async_link_stats_cb()
154 result->stats.link_stats.invalid_transmission_word_error_count = in efct_xport_async_link_stats_cb()
155 counters[EFCT_HW_LINK_STAT_INVALID_XMIT_WORD_COUNT].counter; in efct_xport_async_link_stats_cb()
156 result->stats.link_stats.crc_error_count = in efct_xport_async_link_stats_cb()
157 counters[EFCT_HW_LINK_STAT_CRC_COUNT].counter; in efct_xport_async_link_stats_cb()
162 struct efct_hw_host_stat_counts *counters, in efct_xport_async_host_stats_cb() argument
167 result->stats.host_stats.transmit_kbyte_count = in efct_xport_async_host_stats_cb()
168 counters[EFCT_HW_HOST_STAT_TX_KBYTE_COUNT].counter; in efct_xport_async_host_stats_cb()
169 result->stats.host_stats.receive_kbyte_count = in efct_xport_async_host_stats_cb()
170 counters[EFCT_HW_HOST_STAT_RX_KBYTE_COUNT].counter; in efct_xport_async_host_stats_cb()
171 result->stats.host_stats.transmit_frame_count = in efct_xport_async_host_stats_cb()
172 counters[EFCT_HW_HOST_STAT_TX_FRAME_COUNT].counter; in efct_xport_async_host_stats_cb()
173 result->stats.host_stats.receive_frame_count = in efct_xport_async_host_stats_cb()
174 counters[EFCT_HW_HOST_STAT_RX_FRAME_COUNT].counter; in efct_xport_async_host_stats_cb()
184 struct efct *efct = xport->efct; in efct_xport_stats_timer_cb()
200 xport = efct->xport; in efct_xport_config_stats_timer()
201 efct_hw_get_link_stats(&efct->hw, 0, 0, 0, in efct_xport_config_stats_timer()
203 &xport->fc_xport_stats); in efct_xport_config_stats_timer()
204 efct_hw_get_host_stats(&efct->hw, 0, efct_xport_async_host_stats_cb, in efct_xport_config_stats_timer()
205 &xport->fc_xport_stats); in efct_xport_config_stats_timer()
207 timer_setup(&xport->stats_timer, in efct_xport_config_stats_timer()
209 mod_timer(&xport->stats_timer, in efct_xport_config_stats_timer()
216 struct efct *efct = xport->efct; in efct_xport_initialize()
220 spin_lock_init(&xport->io_pending_lock); in efct_xport_initialize()
221 INIT_LIST_HEAD(&xport->io_pending_list); in efct_xport_initialize()
222 atomic_set(&xport->io_active_count, 0); in efct_xport_initialize()
223 atomic_set(&xport->io_pending_count, 0); in efct_xport_initialize()
224 atomic_set(&xport->io_total_free, 0); in efct_xport_initialize()
225 atomic_set(&xport->io_total_pending, 0); in efct_xport_initialize()
226 atomic_set(&xport->io_alloc_failed_count, 0); in efct_xport_initialize()
227 atomic_set(&xport->io_pending_recursing, 0); in efct_xport_initialize()
229 rc = efct_hw_init(&efct->hw); in efct_xport_initialize()
258 efct_hw_teardown(&efct->hw); in efct_xport_initialize()
271 efct = xport->efct; in efct_xport_status()
275 if (xport->configured_link_state == 0) { in efct_xport_status()
280 xport->configured_link_state = EFCT_XPORT_PORT_OFFLINE; in efct_xport_status()
282 result->value = xport->configured_link_state; in efct_xport_status()
287 value.value = efct_hw_get_link_speed(&efct->hw); in efct_xport_status()
289 result->value = EFCT_XPORT_PORT_OFFLINE; in efct_xport_status()
291 result->value = EFCT_XPORT_PORT_ONLINE; in efct_xport_status()
295 result->value = efct_hw_get_link_speed(&efct->hw); in efct_xport_status()
299 memcpy((void *)result, &efct->xport->fc_xport_stats, in efct_xport_status()
304 init_completion(&result->stats.done); in efct_xport_status()
307 rc = efct_hw_get_link_stats(&efct->hw, 0, 1, 1, in efct_xport_status()
313 if (wait_for_completion_interruptible(&result->stats.done)) { in efct_xport_status()
316 rc = -EIO; in efct_xport_status()
321 rc = efct_hw_get_host_stats(&efct->hw, 1, in efct_xport_status()
328 if (wait_for_completion_interruptible(&result->stats.done)) { in efct_xport_status()
331 rc = -EIO; in efct_xport_status()
337 rc = -EIO; in efct_xport_status()
363 link_module_type = sli_get_lmt(&efct->hw.sli); in efct_get_link_supported_speeds()
384 return -ENOMEM; in efct_scsi_new_device()
387 /* save shost to initiator-client context */ in efct_scsi_new_device()
388 efct->shost = shost; in efct_scsi_new_device()
390 /* save efct information to shost LLD-specific space */ in efct_scsi_new_device()
391 vport = (struct efct_vport *)shost->hostdata; in efct_scsi_new_device()
392 vport->efct = efct; in efct_scsi_new_device()
396 * global queue depth (as opposed to the per-LUN queue depth -- in efct_scsi_new_device()
399 shost->can_queue = efct->hw.config.n_io; in efct_scsi_new_device()
400 shost->max_cmd_len = 16; /* 16-byte CDBs */ in efct_scsi_new_device()
401 shost->max_id = 0xffff; in efct_scsi_new_device()
402 shost->max_lun = 0xffffffff; in efct_scsi_new_device()
405 * can only accept (from mid-layer) as many SGEs as we've in efct_scsi_new_device()
406 * pre-registered in efct_scsi_new_device()
408 shost->sg_tablesize = sli_get_max_sgl(&efct->hw.sli); in efct_scsi_new_device()
411 shost->transportt = efct_xport_fc_tt; in efct_scsi_new_device()
415 error = scsi_add_host_with_dma(shost, &efct->pci->dev, in efct_scsi_new_device()
416 &efct->pci->dev); in efct_scsi_new_device()
419 return -EIO; in efct_scsi_new_device()
425 "Emulex %s FV%s DV%s", efct->model, in efct_scsi_new_device()
426 efct->hw.sli.fw_name[0], EFCT_DRIVER_VERSION); in efct_scsi_new_device()
433 fc_host_node_name(shost) = efct_get_wwnn(&efct->hw); in efct_scsi_new_device()
434 fc_host_port_name(shost) = efct_get_wwpn(&efct->hw); in efct_scsi_new_device()
473 return -EIO; in efct_scsi_reg_fc_transport()
481 return -EIO; in efct_scsi_reg_fc_transport()
502 struct efct *efct = xport->efct; in efct_xport_detach()
504 /* free resources associated with target-server and initiator-client */ in efct_xport_detach()
510 if (timer_pending(&xport->stats_timer)) in efct_xport_detach()
511 del_timer(&xport->stats_timer); in efct_xport_detach()
513 efct_hw_teardown(&efct->hw); in efct_xport_detach()
533 efct = xport->efct; in efct_xport_control()
537 /* Bring the port on-line */ in efct_xport_control()
538 rc = efct_hw_port_control(&efct->hw, EFCT_HW_PORT_INIT, 0, in efct_xport_control()
542 "%s: Can't init port\n", efct->desc); in efct_xport_control()
544 xport->configured_link_state = cmd; in efct_xport_control()
548 if (efct_hw_port_control(&efct->hw, EFCT_HW_PORT_SHUTDOWN, 0, in efct_xport_control()
552 xport->configured_link_state = cmd; in efct_xport_control()
564 if (sli_reset_required(&efct->hw.sli)) { in efct_xport_control()
565 struct efc_domain *domain = efct->efcport->domain; in efct_xport_control()
568 efc_domain_cb(efct->efcport, EFC_HW_DOMAIN_LOST, in efct_xport_control()
571 efct_hw_port_control(&efct->hw, EFCT_HW_PORT_SHUTDOWN, in efct_xport_control()
577 efc_register_domain_free_cb(efct->efcport, in efct_xport_control()
589 efc_register_domain_free_cb(efct->efcport, NULL, NULL); in efct_xport_control()
592 efc_vport_del_all(efct->efcport); in efct_xport_control()
609 xport->req_wwnn = wwnn; in efct_xport_control()
626 xport->req_wwpn = wwpn; in efct_xport_control()
641 efct_io_pool_free(xport->io_pool); in efct_xport_free()
666 if (!efct->shost) in efct_scsi_del_device()
670 efct_xport_remove_host(efct->shost); in efct_scsi_del_device()
672 scsi_remove_host(efct->shost); in efct_scsi_del_device()
673 scsi_host_put(efct->shost); in efct_scsi_del_device()
674 efct->shost = NULL; in efct_scsi_del_device()
680 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_host_port_id()
681 struct efct *efct = vport->efct; in efct_get_host_port_id()
682 struct efc *efc = efct->efcport; in efct_get_host_port_id()
685 if (efc->domain && efc->domain->nport) { in efct_get_host_port_id()
686 nport = efc->domain->nport; in efct_get_host_port_id()
687 fc_host_port_id(shost) = nport->fc_id; in efct_get_host_port_id()
694 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_host_port_type()
695 struct efct *efct = vport->efct; in efct_get_host_port_type()
696 struct efc *efc = efct->efcport; in efct_get_host_port_type()
699 if (efc->domain && efc->domain->nport) { in efct_get_host_port_type()
700 if (efc->domain->is_loop) { in efct_get_host_port_type()
703 struct efc_nport *nport = efc->domain->nport; in efct_get_host_port_type()
705 if (nport->is_vport) in efct_get_host_port_type()
707 else if (nport->topology == EFC_NPORT_TOPO_P2P) in efct_get_host_port_type()
709 else if (nport->topology == EFC_NPORT_TOPO_UNKNOWN) in efct_get_host_port_type()
727 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_host_port_state()
728 struct efct *efct = vport->efct; in efct_get_host_port_state()
732 rc = efct_xport_status(efct->xport, EFCT_XPORT_PORT_STATUS, &status); in efct_get_host_port_state()
742 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_host_speed()
743 struct efct *efct = vport->efct; in efct_get_host_speed()
744 struct efc *efc = efct->efcport; in efct_get_host_speed()
749 if (!efc->domain || !efc->domain->nport) { in efct_get_host_speed()
754 rc = efct_xport_status(efct->xport, EFCT_XPORT_LINK_SPEED, &speed); in efct_get_host_speed()
793 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_host_fabric_name()
794 struct efct *efct = vport->efct; in efct_get_host_fabric_name()
795 struct efc *efc = efct->efcport; in efct_get_host_fabric_name()
797 if (efc->domain) { in efct_get_host_fabric_name()
800 efc->domain->flogi_service_params; in efct_get_host_fabric_name()
802 fc_host_fabric_name(shost) = be64_to_cpu(sp->fl_wwnn); in efct_get_host_fabric_name()
809 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_get_stats()
810 struct efct *efct = vport->efct; in efct_get_stats()
812 struct efct_xport *xport = efct->xport; in efct_get_stats()
817 pr_err("efct_xport_status returned non 0 - %d\n", rc); in efct_get_stats()
821 vport->fc_host_stats.loss_of_sync_count = in efct_get_stats()
823 vport->fc_host_stats.link_failure_count = in efct_get_stats()
825 vport->fc_host_stats.prim_seq_protocol_err_count = in efct_get_stats()
827 vport->fc_host_stats.invalid_tx_word_count = in efct_get_stats()
829 vport->fc_host_stats.invalid_crc_count = in efct_get_stats()
832 vport->fc_host_stats.tx_words = in efct_get_stats()
835 vport->fc_host_stats.rx_words = in efct_get_stats()
837 vport->fc_host_stats.tx_frames = in efct_get_stats()
839 vport->fc_host_stats.rx_frames = in efct_get_stats()
842 vport->fc_host_stats.fcp_input_requests = in efct_get_stats()
843 xport->fcp_stats.input_requests; in efct_get_stats()
844 vport->fc_host_stats.fcp_output_requests = in efct_get_stats()
845 xport->fcp_stats.output_requests; in efct_get_stats()
846 vport->fc_host_stats.fcp_output_megabytes = in efct_get_stats()
847 xport->fcp_stats.output_bytes >> 20; in efct_get_stats()
848 vport->fc_host_stats.fcp_input_megabytes = in efct_get_stats()
849 xport->fcp_stats.input_bytes >> 20; in efct_get_stats()
850 vport->fc_host_stats.fcp_control_requests = in efct_get_stats()
851 xport->fcp_stats.control_requests; in efct_get_stats()
853 return &vport->fc_host_stats; in efct_get_stats()
859 struct efct_vport *vport = (struct efct_vport *)shost->hostdata; in efct_reset_stats()
860 struct efct *efct = vport->efct; in efct_reset_stats()
865 rc = efct_xport_status(efct->xport, EFCT_XPORT_LINK_STAT_RESET, &dummy); in efct_reset_stats()
867 pr_err("efct_xport_status returned non 0 - %d\n", rc); in efct_reset_stats()
874 shost ? (struct efct_vport *)shost->hostdata : NULL; in efct_issue_lip()
875 struct efct *efct = vport ? vport->efct : NULL; in efct_issue_lip()
880 return -EPERM; in efct_issue_lip()
884 * Bring the link down gracefully then re-init the link. in efct_issue_lip()
885 * The firmware will re-initialize the Fibre Channel interface as in efct_issue_lip()
889 if (efct_xport_control(efct->xport, EFCT_XPORT_PORT_OFFLINE)) in efct_issue_lip()
892 if (efct_xport_control(efct->xport, EFCT_XPORT_PORT_ONLINE)) in efct_issue_lip()
911 /* save efct information to shost LLD-specific space */ in efct_scsi_new_vport()
912 vport = (struct efct_vport *)shost->hostdata; in efct_scsi_new_vport()
913 vport->efct = efct; in efct_scsi_new_vport()
914 vport->is_vport = true; in efct_scsi_new_vport()
916 shost->can_queue = efct->hw.config.n_io; in efct_scsi_new_vport()
917 shost->max_cmd_len = 16; /* 16-byte CDBs */ in efct_scsi_new_vport()
918 shost->max_id = 0xffff; in efct_scsi_new_vport()
919 shost->max_lun = 0xffffffff; in efct_scsi_new_vport()
921 /* can only accept (from mid-layer) as many SGEs as we've pre-regited*/ in efct_scsi_new_vport()
922 shost->sg_tablesize = sli_get_max_sgl(&efct->hw.sli); in efct_scsi_new_vport()
925 shost->transportt = efct_vport_fc_tt; in efct_scsi_new_vport()
930 error = scsi_add_host_with_dma(shost, dev, &efct->pci->dev); in efct_scsi_new_vport()
939 "Emulex %s FV%s DV%s", efct->model, efct->hw.sli.fw_name[0], in efct_scsi_new_vport()
946 vport->shost = shost; in efct_scsi_new_vport()
962 return -EIO; in efct_scsi_del_vport()
968 struct Scsi_Host *shost = fc_vport ? fc_vport->shost : NULL; in efct_vport_create()
970 (struct efct_vport *)shost->hostdata : in efct_vport_create()
972 struct efct *efct = pport ? pport->efct : NULL; in efct_vport_create()
978 vport = efct_scsi_new_vport(efct, &fc_vport->dev); in efct_vport_create()
984 vport->fc_vport = fc_vport; in efct_vport_create()
985 vport->npiv_wwpn = fc_vport->port_name; in efct_vport_create()
986 vport->npiv_wwnn = fc_vport->node_name; in efct_vport_create()
987 fc_host_node_name(vport->shost) = vport->npiv_wwnn; in efct_vport_create()
988 fc_host_port_name(vport->shost) = vport->npiv_wwpn; in efct_vport_create()
989 *(struct efct_vport **)fc_vport->dd_data = vport; in efct_vport_create()
994 return -EIO; in efct_vport_create()
1000 struct efct_vport *vport = *(struct efct_vport **)fc_vport->dd_data; in efct_vport_delete()
1001 struct Scsi_Host *shost = vport ? vport->shost : NULL; in efct_vport_delete()
1002 struct efct *efct = vport ? vport->efct : NULL; in efct_vport_delete()
1033 /* allocation lengths for host-specific data */
1080 /* allocation lengths for host-specific data */