Lines Matching +full:comp +full:- +full:disable

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
4 * Copyright (c) 2014- QLogic Corporation.
8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
28 u32 fc_id = -1; in bfad_im_get_starget_port_id()
31 shost = dev_to_shost(starget->dev.parent); in bfad_im_get_starget_port_id()
32 im_port = (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_starget_port_id()
33 bfad = im_port->bfad; in bfad_im_get_starget_port_id()
34 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_get_starget_port_id()
36 itnim = bfad_get_itnim(im_port, starget->id); in bfad_im_get_starget_port_id()
38 fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); in bfad_im_get_starget_port_id()
41 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_get_starget_port_id()
57 shost = dev_to_shost(starget->dev.parent); in bfad_im_get_starget_node_name()
58 im_port = (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_starget_node_name()
59 bfad = im_port->bfad; in bfad_im_get_starget_node_name()
60 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_get_starget_node_name()
62 itnim = bfad_get_itnim(im_port, starget->id); in bfad_im_get_starget_node_name()
64 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); in bfad_im_get_starget_node_name()
67 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_get_starget_node_name()
83 shost = dev_to_shost(starget->dev.parent); in bfad_im_get_starget_port_name()
84 im_port = (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_starget_port_name()
85 bfad = im_port->bfad; in bfad_im_get_starget_port_name()
86 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_get_starget_port_name()
88 itnim = bfad_get_itnim(im_port, starget->id); in bfad_im_get_starget_port_name()
90 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); in bfad_im_get_starget_port_name()
93 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_get_starget_port_name()
103 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_port_id()
104 struct bfad_port_s *port = im_port->port; in bfad_im_get_host_port_id()
107 bfa_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); in bfad_im_get_host_port_id()
117 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_port_type()
118 struct bfad_s *bfad = im_port->bfad; in bfad_im_get_host_port_type()
121 bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); in bfad_im_get_host_port_type()
149 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_port_state()
150 struct bfad_s *bfad = im_port->bfad; in bfad_im_get_host_port_state()
153 bfa_fcport_get_attr(&bfad->bfa, &attr); in bfad_im_get_host_port_state()
186 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_active_fc4s()
187 struct bfad_port_s *port = im_port->port; in bfad_im_get_host_active_fc4s()
192 if (port->supported_fc4s & BFA_LPORT_ROLE_FCP_IM) in bfad_im_get_host_active_fc4s()
205 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_speed()
206 struct bfad_s *bfad = im_port->bfad; in bfad_im_get_host_speed()
209 bfa_fcport_get_attr(&bfad->bfa, &attr); in bfad_im_get_host_speed()
242 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_host_fabric_name()
243 struct bfad_port_s *port = im_port->port; in bfad_im_get_host_fabric_name()
246 fabric_nwwn = bfa_fcs_lport_get_fabric_name(port->fcs_port); in bfad_im_get_host_fabric_name()
259 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_get_stats()
260 struct bfad_s *bfad = im_port->bfad; in bfad_im_get_stats()
271 hstats = &bfad->link_stats; in bfad_im_get_stats()
272 init_completion(&fcomp.comp); in bfad_im_get_stats()
273 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_get_stats()
275 rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), in bfad_im_get_stats()
277 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_get_stats()
283 wait_for_completion(&fcomp.comp); in bfad_im_get_stats()
286 hstats->seconds_since_last_reset = fcstats->fc.secs_reset; in bfad_im_get_stats()
287 hstats->tx_frames = fcstats->fc.tx_frames; in bfad_im_get_stats()
288 hstats->tx_words = fcstats->fc.tx_words; in bfad_im_get_stats()
289 hstats->rx_frames = fcstats->fc.rx_frames; in bfad_im_get_stats()
290 hstats->rx_words = fcstats->fc.rx_words; in bfad_im_get_stats()
291 hstats->lip_count = fcstats->fc.lip_count; in bfad_im_get_stats()
292 hstats->nos_count = fcstats->fc.nos_count; in bfad_im_get_stats()
293 hstats->error_frames = fcstats->fc.error_frames; in bfad_im_get_stats()
294 hstats->dumped_frames = fcstats->fc.dropped_frames; in bfad_im_get_stats()
295 hstats->link_failure_count = fcstats->fc.link_failures; in bfad_im_get_stats()
296 hstats->loss_of_sync_count = fcstats->fc.loss_of_syncs; in bfad_im_get_stats()
297 hstats->loss_of_signal_count = fcstats->fc.loss_of_signals; in bfad_im_get_stats()
298 hstats->prim_seq_protocol_err_count = fcstats->fc.primseq_errs; in bfad_im_get_stats()
299 hstats->invalid_crc_count = fcstats->fc.invalid_crcs; in bfad_im_get_stats()
312 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_reset_stats()
313 struct bfad_s *bfad = im_port->bfad; in bfad_im_reset_stats()
318 init_completion(&fcomp.comp); in bfad_im_reset_stats()
319 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_reset_stats()
320 rc = bfa_port_clear_stats(BFA_FCPORT(&bfad->bfa), bfad_hcb_comp, in bfad_im_reset_stats()
322 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_stats()
327 wait_for_completion(&fcomp.comp); in bfad_im_reset_stats()
341 struct bfad_itnim_data_s *itnim_data = rport->dd_data; in bfad_im_set_rport_loss_tmo()
342 struct bfad_itnim_s *itnim = itnim_data->itnim; in bfad_im_set_rport_loss_tmo()
343 struct bfad_s *bfad = itnim->im->bfad; in bfad_im_set_rport_loss_tmo()
344 uint16_t path_tov = bfa_fcpim_path_tov_get(&bfad->bfa); in bfad_im_set_rport_loss_tmo()
346 rport->dev_loss_tmo = timeout; in bfad_im_set_rport_loss_tmo()
348 rport->dev_loss_tmo = path_tov + 1; in bfad_im_set_rport_loss_tmo()
352 bfad_im_vport_create(struct fc_vport *fc_vport, bool disable) in bfad_im_vport_create() argument
354 char *vname = fc_vport->symbolic_name; in bfad_im_vport_create()
355 struct Scsi_Host *shost = fc_vport->shost; in bfad_im_vport_create()
357 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_vport_create()
358 struct bfad_s *bfad = im_port->bfad; in bfad_im_vport_create()
365 u64_to_wwn(fc_vport->node_name, (u8 *)&port_cfg.nwwn); in bfad_im_vport_create()
366 u64_to_wwn(fc_vport->port_name, (u8 *)&port_cfg.pwwn); in bfad_im_vport_create()
371 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_create()
372 list_for_each_entry(vp, &bfad->pbc_vport_list, list_entry) { in bfad_im_vport_create()
374 vp->fcs_vport.lport.port_cfg.pwwn) { in bfad_im_vport_create()
376 vp->fcs_vport.lport.port_cfg.preboot_vp; in bfad_im_vport_create()
380 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_create()
382 rc = bfad_vport_create(bfad, 0, &port_cfg, &fc_vport->dev); in bfad_im_vport_create()
388 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_create()
389 fcs_vport = bfa_fcs_vport_lookup(&bfad->bfa_fcs, 0, in bfad_im_vport_create()
391 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_create()
396 if (disable) { in bfad_im_vport_create()
397 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_create()
399 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_create()
403 vport = fcs_vport->vport_drv; in bfad_im_vport_create()
404 vshost = vport->drv_port.im_port->shost; in bfad_im_vport_create()
420 bfad_im_supported_speeds(&bfad->bfa); in bfad_im_vport_create()
422 bfa_fcport_get_maxfrsize(&bfad->bfa); in bfad_im_vport_create()
424 fc_vport->dd_data = vport; in bfad_im_vport_create()
425 vport->drv_port.im_port->fc_vport = fc_vport; in bfad_im_vport_create()
444 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_issue_fc_host_lip()
445 struct bfad_s *bfad = im_port->bfad; in bfad_im_issue_fc_host_lip()
450 init_completion(&fcomp.comp); in bfad_im_issue_fc_host_lip()
451 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_issue_fc_host_lip()
452 status = bfa_port_disable(&bfad->bfa.modules.port, in bfad_im_issue_fc_host_lip()
454 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_issue_fc_host_lip()
457 return -EIO; in bfad_im_issue_fc_host_lip()
459 wait_for_completion(&fcomp.comp); in bfad_im_issue_fc_host_lip()
461 return -EIO; in bfad_im_issue_fc_host_lip()
463 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_issue_fc_host_lip()
464 status = bfa_port_enable(&bfad->bfa.modules.port, in bfad_im_issue_fc_host_lip()
466 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_issue_fc_host_lip()
468 return -EIO; in bfad_im_issue_fc_host_lip()
470 wait_for_completion(&fcomp.comp); in bfad_im_issue_fc_host_lip()
472 return -EIO; in bfad_im_issue_fc_host_lip()
480 struct bfad_vport_s *vport = (struct bfad_vport_s *)fc_vport->dd_data; in bfad_im_vport_delete()
482 (struct bfad_im_port_s *) vport->drv_port.im_port; in bfad_im_vport_delete()
483 struct bfad_s *bfad = im_port->bfad; in bfad_im_vport_delete()
491 if (im_port->flags & BFAD_PORT_DELETE) { in bfad_im_vport_delete()
493 list_del(&vport->list_entry); in bfad_im_vport_delete()
498 vshost = vport->drv_port.im_port->shost; in bfad_im_vport_delete()
501 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_delete()
502 fcs_vport = bfa_fcs_vport_lookup(&bfad->bfa_fcs, 0, pwwn); in bfad_im_vport_delete()
503 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_delete()
508 vport->drv_port.flags |= BFAD_PORT_DELETE; in bfad_im_vport_delete()
510 vport->comp_del = &fcomp; in bfad_im_vport_delete()
511 init_completion(vport->comp_del); in bfad_im_vport_delete()
513 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_delete()
514 rc = bfa_fcs_vport_delete(&vport->fcs_vport); in bfad_im_vport_delete()
515 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_delete()
518 vport->drv_port.flags &= ~BFAD_PORT_DELETE; in bfad_im_vport_delete()
519 vport->comp_del = NULL; in bfad_im_vport_delete()
520 return -1; in bfad_im_vport_delete()
523 wait_for_completion(vport->comp_del); in bfad_im_vport_delete()
526 list_del(&vport->list_entry); in bfad_im_vport_delete()
533 bfad_im_vport_disable(struct fc_vport *fc_vport, bool disable) in bfad_im_vport_disable() argument
542 vport = (struct bfad_vport_s *)fc_vport->dd_data; in bfad_im_vport_disable()
543 bfad = vport->drv_port.bfad; in bfad_im_vport_disable()
544 vshost = vport->drv_port.im_port->shost; in bfad_im_vport_disable()
547 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_disable()
548 fcs_vport = bfa_fcs_vport_lookup(&bfad->bfa_fcs, 0, pwwn); in bfad_im_vport_disable()
549 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_disable()
554 if (disable) { in bfad_im_vport_disable()
568 struct bfad_vport_s *vport = (struct bfad_vport_s *)fc_vport->dd_data; in bfad_im_vport_set_symbolic_name()
570 (struct bfad_im_port_s *)vport->drv_port.im_port; in bfad_im_vport_set_symbolic_name()
571 struct bfad_s *bfad = im_port->bfad; in bfad_im_vport_set_symbolic_name()
572 struct Scsi_Host *vshost = vport->drv_port.im_port->shost; in bfad_im_vport_set_symbolic_name()
573 char *sym_name = fc_vport->symbolic_name; in bfad_im_vport_set_symbolic_name()
580 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_set_symbolic_name()
581 fcs_vport = bfa_fcs_vport_lookup(&bfad->bfa_fcs, 0, pwwn); in bfad_im_vport_set_symbolic_name()
582 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_set_symbolic_name()
587 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_vport_set_symbolic_name()
589 bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name); in bfad_im_vport_set_symbolic_name()
590 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_vport_set_symbolic_name()
709 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_serial_num_show()
710 struct bfad_s *bfad = im_port->bfad; in bfad_im_serial_num_show()
713 bfa_get_adapter_serial_num(&bfad->bfa, serial_num); in bfad_im_serial_num_show()
723 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_model_show()
724 struct bfad_s *bfad = im_port->bfad; in bfad_im_model_show()
727 bfa_get_adapter_model(&bfad->bfa, model); in bfad_im_model_show()
737 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_model_desc_show()
738 struct bfad_s *bfad = im_port->bfad; in bfad_im_model_desc_show()
743 bfa_get_adapter_model(&bfad->bfa, model); in bfad_im_model_desc_show()
744 nports = bfa_get_nports(&bfad->bfa); in bfad_im_model_desc_show()
745 if (!strcmp(model, "QLogic-425")) in bfad_im_model_desc_show()
747 "QLogic BR-series 4Gbps PCIe dual port FC HBA"); in bfad_im_model_desc_show()
748 else if (!strcmp(model, "QLogic-825")) in bfad_im_model_desc_show()
750 "QLogic BR-series 8Gbps PCIe dual port FC HBA"); in bfad_im_model_desc_show()
751 else if (!strcmp(model, "QLogic-42B")) in bfad_im_model_desc_show()
753 "QLogic BR-series 4Gbps PCIe dual port FC HBA for HP"); in bfad_im_model_desc_show()
754 else if (!strcmp(model, "QLogic-82B")) in bfad_im_model_desc_show()
756 "QLogic BR-series 8Gbps PCIe dual port FC HBA for HP"); in bfad_im_model_desc_show()
757 else if (!strcmp(model, "QLogic-1010")) in bfad_im_model_desc_show()
759 "QLogic BR-series 10Gbps single port CNA"); in bfad_im_model_desc_show()
760 else if (!strcmp(model, "QLogic-1020")) in bfad_im_model_desc_show()
762 "QLogic BR-series 10Gbps dual port CNA"); in bfad_im_model_desc_show()
763 else if (!strcmp(model, "QLogic-1007")) in bfad_im_model_desc_show()
765 "QLogic BR-series 10Gbps CNA for IBM Blade Center"); in bfad_im_model_desc_show()
766 else if (!strcmp(model, "QLogic-415")) in bfad_im_model_desc_show()
768 "QLogic BR-series 4Gbps PCIe single port FC HBA"); in bfad_im_model_desc_show()
769 else if (!strcmp(model, "QLogic-815")) in bfad_im_model_desc_show()
771 "QLogic BR-series 8Gbps PCIe single port FC HBA"); in bfad_im_model_desc_show()
772 else if (!strcmp(model, "QLogic-41B")) in bfad_im_model_desc_show()
774 "QLogic BR-series 4Gbps PCIe single port FC HBA for HP"); in bfad_im_model_desc_show()
775 else if (!strcmp(model, "QLogic-81B")) in bfad_im_model_desc_show()
777 "QLogic BR-series 8Gbps PCIe single port FC HBA for HP"); in bfad_im_model_desc_show()
778 else if (!strcmp(model, "QLogic-804")) in bfad_im_model_desc_show()
780 "QLogic BR-series 8Gbps FC HBA for HP Bladesystem C-class"); in bfad_im_model_desc_show()
781 else if (!strcmp(model, "QLogic-1741")) in bfad_im_model_desc_show()
783 "QLogic BR-series 10Gbps CNA for Dell M-Series Blade Servers"); in bfad_im_model_desc_show()
784 else if (strstr(model, "QLogic-1860")) { in bfad_im_model_desc_show()
785 if (nports == 1 && bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
787 "QLogic BR-series 10Gbps single port CNA"); in bfad_im_model_desc_show()
788 else if (nports == 1 && !bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
790 "QLogic BR-series 16Gbps PCIe single port FC HBA"); in bfad_im_model_desc_show()
791 else if (nports == 2 && bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
793 "QLogic BR-series 10Gbps dual port CNA"); in bfad_im_model_desc_show()
794 else if (nports == 2 && !bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
796 "QLogic BR-series 16Gbps PCIe dual port FC HBA"); in bfad_im_model_desc_show()
797 } else if (!strcmp(model, "QLogic-1867")) { in bfad_im_model_desc_show()
798 if (nports == 1 && !bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
800 "QLogic BR-series 16Gbps PCIe single port FC HBA for IBM"); in bfad_im_model_desc_show()
801 else if (nports == 2 && !bfa_ioc_is_cna(&bfad->bfa.ioc)) in bfad_im_model_desc_show()
803 "QLogic BR-series 16Gbps PCIe dual port FC HBA for IBM"); in bfad_im_model_desc_show()
817 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_node_name_show()
818 struct bfad_port_s *port = im_port->port; in bfad_im_node_name_show()
821 nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port); in bfad_im_node_name_show()
831 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_symbolic_name_show()
832 struct bfad_s *bfad = im_port->bfad; in bfad_im_symbolic_name_show()
836 bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); in bfad_im_symbolic_name_show()
848 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_hw_version_show()
849 struct bfad_s *bfad = im_port->bfad; in bfad_im_hw_version_show()
852 bfa_get_pci_chip_rev(&bfad->bfa, hw_ver); in bfad_im_hw_version_show()
862 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_optionrom_version_show()
863 struct bfad_s *bfad = im_port->bfad; in bfad_im_optionrom_version_show()
866 bfa_get_adapter_optrom_ver(&bfad->bfa, optrom_ver); in bfad_im_optionrom_version_show()
876 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_fw_version_show()
877 struct bfad_s *bfad = im_port->bfad; in bfad_im_fw_version_show()
880 bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); in bfad_im_fw_version_show()
890 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_num_of_ports_show()
891 struct bfad_s *bfad = im_port->bfad; in bfad_im_num_of_ports_show()
894 bfa_get_nports(&bfad->bfa)); in bfad_im_num_of_ports_show()
903 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_num_of_discovered_ports_show()
904 struct bfad_port_s *port = im_port->port; in bfad_im_num_of_discovered_ports_show()
905 struct bfad_s *bfad = im_port->bfad; in bfad_im_num_of_discovered_ports_show()
915 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_num_of_discovered_ports_show()
916 bfa_fcs_lport_get_rport_quals(port->fcs_port, rports, &nrports); in bfad_im_num_of_discovered_ports_show()
917 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_num_of_discovered_ports_show()