Lines Matching +full:im +full:-

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.
12 * bfad_im.c Linux driver IM module.
21 BFA_TRC_FILE(LDRV, IM);
52 memcpy(cmnd->sense_buffer, sns_info, sns_len); in bfa_cb_ioim_done()
59 (scsi_bufflen(cmnd) - residue) < in bfa_cb_ioim_done()
60 cmnd->underflow) { in bfa_cb_ioim_done()
65 cmnd->result = host_status << 16 | scsi_status; in bfa_cb_ioim_done()
70 cmnd->result = DID_TIME_OUT << 16; in bfa_cb_ioim_done()
73 cmnd->result = DID_TRANSPORT_DISRUPTED << 16; in bfa_cb_ioim_done()
76 cmnd->result = DID_ERROR << 16; in bfa_cb_ioim_done()
80 if (cmnd->device->host != NULL) in bfa_cb_ioim_done()
83 cmnd->host_scribble = NULL; in bfa_cb_ioim_done()
84 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_done()
86 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_done()
88 itnim = itnim_data->itnim; in bfa_cb_ioim_done()
89 if (!cmnd->result && itnim && in bfa_cb_ioim_done()
90 (bfa_lun_queue_depth > cmnd->device->queue_depth)) { in bfa_cb_ioim_done()
92 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_done()
93 } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { in bfa_cb_ioim_done()
95 bfad_handle_qfull(itnim, cmnd->device); in bfa_cb_ioim_done()
99 cmnd->scsi_done(cmnd); in bfa_cb_ioim_done()
109 cmnd->result = DID_OK << 16 | SCSI_STATUS_GOOD; in bfa_cb_ioim_good_comp()
112 if (cmnd->device->host != NULL) in bfa_cb_ioim_good_comp()
115 cmnd->host_scribble = NULL; in bfa_cb_ioim_good_comp()
118 if (bfa_lun_queue_depth > cmnd->device->queue_depth) { in bfa_cb_ioim_good_comp()
119 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_good_comp()
121 itnim = itnim_data->itnim; in bfa_cb_ioim_good_comp()
123 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_good_comp()
127 cmnd->scsi_done(cmnd); in bfa_cb_ioim_good_comp()
136 cmnd->result = DID_ERROR << 16; in bfa_cb_ioim_abort()
139 if (cmnd->device->host != NULL) in bfa_cb_ioim_abort()
142 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_abort()
143 cmnd->host_scribble = NULL; in bfa_cb_ioim_abort()
153 cmnd->SCp.Status |= tsk_status << 1; in bfa_cb_tskim_done()
154 set_bit(IO_DONE_BIT, (unsigned long *)&cmnd->SCp.Status); in bfa_cb_tskim_done()
155 wq = (wait_queue_head_t *) cmnd->SCp.ptr; in bfa_cb_tskim_done()
156 cmnd->SCp.ptr = NULL; in bfa_cb_tskim_done()
173 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_info()
174 struct bfad_s *bfad = im_port->bfad; in bfad_im_info()
178 "QLogic BR-series FC/FCOE Adapter, hwpath: %s driver: %s", in bfad_im_info()
179 bfad->pci_name, BFAD_DRIVER_VERSION); in bfad_im_info()
192 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_abort_handler()
194 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_abort_handler()
195 struct bfad_s *bfad = im_port->bfad; in bfad_im_abort_handler()
201 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_abort_handler()
202 hal_io = (struct bfa_ioim_s *) cmnd->host_scribble; in bfad_im_abort_handler()
208 if (hal_io->dio != (struct bfad_ioim_s *) cmnd) { in bfad_im_abort_handler()
213 bfa_trc(bfad, hal_io->iotag); in bfad_im_abort_handler()
216 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
218 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_abort_handler()
222 while ((struct bfa_ioim_s *) cmnd->host_scribble == hal_io) { in bfad_im_abort_handler()
229 cmnd->scsi_done(cmnd); in bfad_im_abort_handler()
230 bfa_trc(bfad, hal_io->iotag); in bfad_im_abort_handler()
233 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
236 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_abort_handler()
249 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_target_reset_send()
261 cmnd->host_scribble = NULL; in bfad_im_target_reset_send()
262 cmnd->SCp.Status = 0; in bfad_im_target_reset_send()
263 bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); in bfad_im_target_reset_send()
293 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_lun_handler()
295 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_reset_lun_handler()
296 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_reset_lun_handler()
297 struct bfad_s *bfad = im_port->bfad; in bfad_im_reset_lun_handler()
307 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_reset_lun_handler()
308 itnim = itnim_data->itnim; in bfad_im_reset_lun_handler()
310 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_lun_handler()
315 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_reset_lun_handler()
319 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_lun_handler()
328 cmnd->host_scribble = NULL; in bfad_im_reset_lun_handler()
329 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_lun_handler()
330 cmnd->SCp.Status = 0; in bfad_im_reset_lun_handler()
331 bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); in bfad_im_reset_lun_handler()
341 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_lun_handler()
345 int_to_scsilun(cmnd->device->lun, &scsilun); in bfad_im_reset_lun_handler()
348 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_lun_handler()
351 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_lun_handler()
353 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_lun_handler()
370 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_target_handler()
371 struct scsi_target *starget = scsi_target(cmnd->device); in bfad_im_reset_target_handler()
373 (struct bfad_im_port_s *) shost->hostdata[0]; in bfad_im_reset_target_handler()
374 struct bfad_s *bfad = im_port->bfad; in bfad_im_reset_target_handler()
381 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_reset_target_handler()
382 itnim = bfad_get_itnim(im_port, starget->id); in bfad_im_reset_target_handler()
384 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_target_handler()
388 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_target_handler()
390 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_target_handler()
391 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_reset_target_handler()
393 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_target_handler()
402 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_reset_target_handler()
413 sdev->hostdata = NULL; in bfad_im_slave_destroy()
431 return -ENOMEM; in bfa_fcb_itnim_alloc()
433 (*itnim_drv)->im = bfad->im; in bfa_fcb_itnim_alloc()
434 *itnim = &(*itnim_drv)->fcs_itnim; in bfa_fcb_itnim_alloc()
435 (*itnim_drv)->state = ITNIM_STATE_NONE; in bfa_fcb_itnim_alloc()
440 INIT_WORK(&(*itnim_drv)->itnim_work, bfad_im_itnim_work_handler); in bfa_fcb_itnim_alloc()
441 bfad->bfad_flags |= BFAD_RPORT_ONLINE; in bfa_fcb_itnim_alloc()
456 struct bfad_im_s *im = itnim_drv->im; in bfa_fcb_itnim_free() local
459 WARN_ON(itnim_drv->state == ITNIM_STATE_ONLINE); in bfa_fcb_itnim_free()
461 itnim_drv->queue_work = 1; in bfa_fcb_itnim_free()
463 if (itnim_drv->state == ITNIM_STATE_OFFLINE_PENDING) in bfa_fcb_itnim_free()
464 itnim_drv->queue_work = 0; in bfa_fcb_itnim_free()
466 itnim_drv->state = ITNIM_STATE_FREE; in bfa_fcb_itnim_free()
467 port = bfa_fcs_itnim_get_drvport(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_free()
468 itnim_drv->im_port = port->im_port; in bfa_fcb_itnim_free()
469 wwpn = bfa_fcs_itnim_get_pwwn(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_free()
470 fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_free()
475 port->im_port->shost->host_no, in bfa_fcb_itnim_free()
479 if (itnim_drv->queue_work) in bfa_fcb_itnim_free()
480 queue_work(im->drv_workq, &itnim_drv->itnim_work); in bfa_fcb_itnim_free()
491 struct bfad_im_s *im = itnim_drv->im; in bfa_fcb_itnim_online() local
493 itnim_drv->bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_online()
494 port = bfa_fcs_itnim_get_drvport(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_online()
495 itnim_drv->state = ITNIM_STATE_ONLINE; in bfa_fcb_itnim_online()
496 itnim_drv->queue_work = 1; in bfa_fcb_itnim_online()
497 itnim_drv->im_port = port->im_port; in bfa_fcb_itnim_online()
500 if (itnim_drv->queue_work) in bfa_fcb_itnim_online()
501 queue_work(im->drv_workq, &itnim_drv->itnim_work); in bfa_fcb_itnim_online()
513 struct bfad_im_s *im = itnim_drv->im; in bfa_fcb_itnim_offline() local
515 port = bfa_fcs_itnim_get_drvport(&itnim_drv->fcs_itnim); in bfa_fcb_itnim_offline()
516 bfad = port->bfad; in bfa_fcb_itnim_offline()
517 if ((bfad->pport.flags & BFAD_PORT_DELETE) || in bfa_fcb_itnim_offline()
518 (port->flags & BFAD_PORT_DELETE)) { in bfa_fcb_itnim_offline()
519 itnim_drv->state = ITNIM_STATE_OFFLINE; in bfa_fcb_itnim_offline()
522 itnim_drv->im_port = port->im_port; in bfa_fcb_itnim_offline()
523 itnim_drv->state = ITNIM_STATE_OFFLINE_PENDING; in bfa_fcb_itnim_offline()
524 itnim_drv->queue_work = 1; in bfa_fcb_itnim_offline()
527 if (itnim_drv->queue_work) in bfa_fcb_itnim_offline()
528 queue_work(im->drv_workq, &itnim_drv->itnim_work); in bfa_fcb_itnim_offline()
548 im_port->idr_id = error; in bfad_im_scsi_host_alloc()
551 im_port->shost = bfad_scsi_host_alloc(im_port, bfad); in bfad_im_scsi_host_alloc()
552 if (!im_port->shost) { in bfad_im_scsi_host_alloc()
557 im_portp = shost_priv(im_port->shost); in bfad_im_scsi_host_alloc()
558 im_portp->p = im_port; in bfad_im_scsi_host_alloc()
559 im_port->shost->unique_id = im_port->idr_id; in bfad_im_scsi_host_alloc()
560 im_port->shost->this_id = -1; in bfad_im_scsi_host_alloc()
561 im_port->shost->max_id = MAX_FCP_TARGET; in bfad_im_scsi_host_alloc()
562 im_port->shost->max_lun = MAX_FCP_LUN; in bfad_im_scsi_host_alloc()
563 im_port->shost->max_cmd_len = 16; in bfad_im_scsi_host_alloc()
564 im_port->shost->can_queue = bfad->cfg_data.ioc_queue_depth; in bfad_im_scsi_host_alloc()
565 if (im_port->port->pvb_type == BFAD_PORT_PHYS_BASE) in bfad_im_scsi_host_alloc()
566 im_port->shost->transportt = bfad_im_scsi_transport_template; in bfad_im_scsi_host_alloc()
568 im_port->shost->transportt = in bfad_im_scsi_host_alloc()
571 error = scsi_add_host_with_dma(im_port->shost, dev, &bfad->pcidev->dev); in bfad_im_scsi_host_alloc()
580 scsi_host_put(im_port->shost); in bfad_im_scsi_host_alloc()
581 im_port->shost = NULL; in bfad_im_scsi_host_alloc()
584 idr_remove(&bfad_im_port_index, im_port->idr_id); in bfad_im_scsi_host_alloc()
593 bfa_trc(bfad, bfad->inst_no); in bfad_im_scsi_host_free()
595 im_port->shost->host_no); in bfad_im_scsi_host_free()
597 fc_remove_host(im_port->shost); in bfad_im_scsi_host_free()
599 scsi_remove_host(im_port->shost); in bfad_im_scsi_host_free()
600 scsi_host_put(im_port->shost); in bfad_im_scsi_host_free()
603 idr_remove(&bfad_im_port_index, im_port->idr_id); in bfad_im_scsi_host_free()
613 if (im_port->port->pvb_type != BFAD_PORT_PHYS_BASE) { in bfad_im_port_delete_handler()
614 im_port->flags |= BFAD_PORT_DELETE; in bfad_im_port_delete_handler()
615 fc_vport_terminate(im_port->fc_vport); in bfad_im_port_delete_handler()
630 port->im_port = im_port; in bfad_im_port_new()
631 im_port->port = port; in bfad_im_port_new()
632 im_port->bfad = bfad; in bfad_im_port_new()
634 INIT_WORK(&im_port->port_delete_work, bfad_im_port_delete_handler); in bfad_im_port_new()
635 INIT_LIST_HEAD(&im_port->itnim_mapped_list); in bfad_im_port_new()
636 INIT_LIST_HEAD(&im_port->binding_list); in bfad_im_port_new()
645 struct bfad_im_port_s *im_port = port->im_port; in bfad_im_port_delete()
647 queue_work(bfad->im->drv_workq, in bfad_im_port_delete()
648 &im_port->port_delete_work); in bfad_im_port_delete()
656 struct bfad_s *bfad = im_port->bfad; in bfad_im_port_clean()
658 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_port_clean()
659 list_for_each_entry_safe(bp, bp_new, &im_port->binding_list, in bfad_im_port_clean()
661 list_del(&bp->list_entry); in bfad_im_port_clean()
666 WARN_ON(!list_empty(&im_port->itnim_mapped_list)); in bfad_im_port_clean()
668 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_port_clean()
673 struct bfad_im_s *im = in bfad_aen_im_notify_handler() local
676 struct bfad_s *bfad = im->bfad; in bfad_aen_im_notify_handler()
677 struct Scsi_Host *shost = bfad->pport.im_port->shost; in bfad_aen_im_notify_handler()
681 while (!list_empty(&bfad->active_aen_q)) { in bfad_aen_im_notify_handler()
682 spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags); in bfad_aen_im_notify_handler()
683 bfa_q_deq(&bfad->active_aen_q, &aen_entry); in bfad_aen_im_notify_handler()
684 spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags); in bfad_aen_im_notify_handler()
687 sizeof(struct bfa_aen_entry_s) - in bfad_aen_im_notify_handler()
690 spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags); in bfad_aen_im_notify_handler()
691 list_add_tail(&aen_entry->qe, &bfad->free_aen_q); in bfad_aen_im_notify_handler()
692 spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags); in bfad_aen_im_notify_handler()
699 struct bfad_im_s *im; in bfad_im_probe() local
701 im = kzalloc(sizeof(struct bfad_im_s), GFP_KERNEL); in bfad_im_probe()
702 if (im == NULL) in bfad_im_probe()
705 bfad->im = im; in bfad_im_probe()
706 im->bfad = bfad; in bfad_im_probe()
709 kfree(im); in bfad_im_probe()
713 INIT_WORK(&im->aen_im_notify_work, bfad_aen_im_notify_handler); in bfad_im_probe()
720 if (bfad->im) { in bfad_im_probe_undo()
721 bfad_destroy_workq(bfad->im); in bfad_im_probe_undo()
722 kfree(bfad->im); in bfad_im_probe_undo()
723 bfad->im = NULL; in bfad_im_probe_undo()
732 if (im_port->port->pvb_type == BFAD_PORT_PHYS_BASE) in bfad_scsi_host_alloc()
738 sht->max_sectors = max_xfer_size << 1; in bfad_scsi_host_alloc()
740 sht->sg_tablesize = bfad->cfg_data.io_max_sge; in bfad_scsi_host_alloc()
748 if (!(im_port->flags & BFAD_PORT_DELETE)) in bfad_scsi_host_free()
749 flush_workqueue(bfad->im->drv_workq); in bfad_scsi_host_free()
750 bfad_im_scsi_host_free(im_port->bfad, im_port); in bfad_scsi_host_free()
756 bfad_destroy_workq(struct bfad_im_s *im) in bfad_destroy_workq() argument
758 if (im && im->drv_workq) { in bfad_destroy_workq()
759 flush_workqueue(im->drv_workq); in bfad_destroy_workq()
760 destroy_workqueue(im->drv_workq); in bfad_destroy_workq()
761 im->drv_workq = NULL; in bfad_destroy_workq()
768 struct bfad_im_s *im = bfad->im; in bfad_thread_workq() local
771 snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d", in bfad_thread_workq()
772 bfad->inst_no); in bfad_thread_workq()
773 im->drv_workq = create_singlethread_workqueue(im->drv_workq_name); in bfad_thread_workq()
774 if (!im->drv_workq) in bfad_thread_workq()
784 * OS entry point to adjust the queue_depths on a per-device basis.
786 * Return non-zero if fails.
809 .this_id = -1,
831 .this_id = -1,
873 if (((jiffies - itnim->last_ramp_up_time) > in bfad_ramp_up_qdepth()
875 ((jiffies - itnim->last_queue_full_time) > in bfad_ramp_up_qdepth()
877 shost_for_each_device(tmp_sdev, sdev->host) { in bfad_ramp_up_qdepth()
878 if (bfa_lun_queue_depth > tmp_sdev->queue_depth) { in bfad_ramp_up_qdepth()
879 if (tmp_sdev->id != sdev->id) in bfad_ramp_up_qdepth()
882 tmp_sdev->queue_depth + 1); in bfad_ramp_up_qdepth()
884 itnim->last_ramp_up_time = jiffies; in bfad_ramp_up_qdepth()
895 itnim->last_queue_full_time = jiffies; in bfad_handle_qfull()
897 shost_for_each_device(tmp_sdev, sdev->host) { in bfad_handle_qfull()
898 if (tmp_sdev->id != sdev->id) in bfad_handle_qfull()
900 scsi_track_queue_full(tmp_sdev, tmp_sdev->queue_depth - 1); in bfad_handle_qfull()
910 list_for_each_entry(itnim, &im_port->itnim_mapped_list, list_entry) { in bfad_get_itnim()
911 if (id == itnim->scsi_tgt_id) in bfad_get_itnim()
921 * be made visible to the SCSI mid-layer or not.
924 * Returns -ENXIO to notify SCSI mid-layer to not add this LUN to the OS stack.
931 (struct bfad_itnim_data_s *) rport->dd_data; in bfad_im_check_if_make_lun_visible()
932 struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; in bfad_im_check_if_make_lun_visible()
933 struct bfa_rport_s *bfa_rport = itnim_data->itnim->bfa_itnim->rport; in bfad_im_check_if_make_lun_visible()
935 int i = 0, ret = -ENXIO; in bfad_im_check_if_make_lun_visible()
939 scsilun_to_int(&lun_list[i].lun) == sdev->lun && in bfad_im_check_if_make_lun_visible()
940 lun_list[i].rp_tag == bfa_rport->rport_tag && in bfad_im_check_if_make_lun_visible()
941 lun_list[i].lp_tag == (u8)bfa_rport->rport_info.lp_tag) { in bfad_im_check_if_make_lun_visible()
960 return -ENXIO; in bfad_im_slave_alloc()
962 itnim_data = (struct bfad_itnim_data_s *) rport->dd_data; in bfad_im_slave_alloc()
963 bfa = itnim_data->itnim->bfa_itnim->bfa; in bfad_im_slave_alloc()
967 * We should not mask LUN 0 - since this will translate in bfad_im_slave_alloc()
970 if (sdev->lun == 0) { in bfad_im_slave_alloc()
971 sdev->sdev_bflags |= BLIST_NOREPORTLUN | in bfad_im_slave_alloc()
977 * Query LUN Mask configuration - to expose this LUN in bfad_im_slave_alloc()
978 * to the SCSI mid-layer or to mask it. in bfad_im_slave_alloc()
982 return -ENXIO; in bfad_im_slave_alloc()
985 sdev->hostdata = rport->dd_data; in bfad_im_slave_alloc()
1000 bfa_ioc_get_attr(&bfa->ioc, ioc_attr); in bfad_im_supported_speeds()
1001 if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_16GBPS) in bfad_im_supported_speeds()
1004 else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) { in bfad_im_supported_speeds()
1005 if (ioc_attr->adapter_attr.is_mezz) { in bfad_im_supported_speeds()
1014 } else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_4GBPS) { in bfad_im_supported_speeds()
1017 } else if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_10GBPS) { in bfad_im_supported_speeds()
1027 struct Scsi_Host *host = im_port->shost; in bfad_fc_host_init()
1028 struct bfad_s *bfad = im_port->bfad; in bfad_fc_host_init()
1029 struct bfad_port_s *port = im_port->port; in bfad_fc_host_init()
1031 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa); in bfad_fc_host_init()
1034 cpu_to_be64((bfa_fcs_lport_get_nwwn(port->fcs_port))); in bfad_fc_host_init()
1036 cpu_to_be64((bfa_fcs_lport_get_pwwn(port->fcs_port))); in bfad_fc_host_init()
1037 fc_host_max_npiv_vports(host) = bfa_lps_get_max_vport(&bfad->bfa); in bfad_fc_host_init()
1049 strlcpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname, in bfad_fc_host_init()
1053 fc_host_supported_speeds(host) = bfad_im_supported_speeds(&bfad->bfa); in bfad_fc_host_init()
1054 fc_host_maxframe_size(host) = fcport->cfg.maxfrsize; in bfad_fc_host_init()
1065 cpu_to_be64(bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim)); in bfad_im_fc_rport_add()
1067 cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); in bfad_im_fc_rport_add()
1069 bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); in bfad_im_fc_rport_add()
1072 itnim->fc_rport = fc_rport = in bfad_im_fc_rport_add()
1073 fc_remote_port_add(im_port->shost, 0, &rport_ids); in bfad_im_fc_rport_add()
1078 fc_rport->maxframe_size = in bfad_im_fc_rport_add()
1079 bfa_fcs_itnim_get_maxfrsize(&itnim->fcs_itnim); in bfad_im_fc_rport_add()
1080 fc_rport->supported_classes = bfa_fcs_itnim_get_cos(&itnim->fcs_itnim); in bfad_im_fc_rport_add()
1082 itnim_data = fc_rport->dd_data; in bfad_im_fc_rport_add()
1083 itnim_data->itnim = itnim; in bfad_im_fc_rport_add()
1090 if ((fc_rport->scsi_target_id != -1) in bfad_im_fc_rport_add()
1091 && (fc_rport->scsi_target_id < MAX_FCP_TARGET)) in bfad_im_fc_rport_add()
1092 itnim->scsi_tgt_id = fc_rport->scsi_target_id; in bfad_im_fc_rport_add()
1094 itnim->channel = fc_rport->channel; in bfad_im_fc_rport_add()
1108 struct bfad_im_s *im = itnim->im; in bfad_im_itnim_work_handler() local
1109 struct bfad_s *bfad = im->bfad; in bfad_im_itnim_work_handler()
1117 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1118 im_port = itnim->im_port; in bfad_im_itnim_work_handler()
1119 bfa_trc(bfad, itnim->state); in bfad_im_itnim_work_handler()
1120 switch (itnim->state) { in bfad_im_itnim_work_handler()
1122 if (!itnim->fc_rport) { in bfad_im_itnim_work_handler()
1123 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1125 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1126 wwpn = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); in bfad_im_itnim_work_handler()
1127 fcid = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); in bfad_im_itnim_work_handler()
1130 list_add_tail(&itnim->list_entry, in bfad_im_itnim_work_handler()
1131 &im_port->itnim_mapped_list); in bfad_im_itnim_work_handler()
1135 im_port->shost->host_no, in bfad_im_itnim_work_handler()
1136 itnim->scsi_tgt_id, in bfad_im_itnim_work_handler()
1142 bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); in bfad_im_itnim_work_handler()
1147 itnim->state = ITNIM_STATE_OFFLINE; in bfad_im_itnim_work_handler()
1148 if (itnim->fc_rport) { in bfad_im_itnim_work_handler()
1149 fc_rport = itnim->fc_rport; in bfad_im_itnim_work_handler()
1151 fc_rport->dd_data)->itnim = NULL; in bfad_im_itnim_work_handler()
1152 itnim->fc_rport = NULL; in bfad_im_itnim_work_handler()
1153 if (!(im_port->port->flags & BFAD_PORT_DELETE)) { in bfad_im_itnim_work_handler()
1154 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1155 fc_rport->dev_loss_tmo = in bfad_im_itnim_work_handler()
1156 bfa_fcpim_path_tov_get(&bfad->bfa) + 1; in bfad_im_itnim_work_handler()
1158 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1160 wwpn = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); in bfad_im_itnim_work_handler()
1161 fcid = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); in bfad_im_itnim_work_handler()
1164 list_del(&itnim->list_entry); in bfad_im_itnim_work_handler()
1168 im_port->shost->host_no, in bfad_im_itnim_work_handler()
1169 itnim->scsi_tgt_id, in bfad_im_itnim_work_handler()
1174 if (itnim->fc_rport) { in bfad_im_itnim_work_handler()
1175 fc_rport = itnim->fc_rport; in bfad_im_itnim_work_handler()
1177 fc_rport->dd_data)->itnim = NULL; in bfad_im_itnim_work_handler()
1178 itnim->fc_rport = NULL; in bfad_im_itnim_work_handler()
1179 if (!(im_port->port->flags & BFAD_PORT_DELETE)) { in bfad_im_itnim_work_handler()
1180 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1181 fc_rport->dev_loss_tmo = in bfad_im_itnim_work_handler()
1182 bfa_fcpim_path_tov_get(&bfad->bfa) + 1; in bfad_im_itnim_work_handler()
1184 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1186 list_del(&itnim->list_entry); in bfad_im_itnim_work_handler()
1196 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_itnim_work_handler()
1206 (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; in bfad_im_queuecommand_lck()
1207 struct bfad_s *bfad = im_port->bfad; in bfad_im_queuecommand_lck()
1208 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_queuecommand_lck()
1214 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); in bfad_im_queuecommand_lck()
1218 cmnd->result = rc; in bfad_im_queuecommand_lck()
1223 if (bfad->bfad_flags & BFAD_EEH_BUSY) { in bfad_im_queuecommand_lck()
1224 if (bfad->bfad_flags & BFAD_EEH_PCI_CHANNEL_IO_PERM_FAILURE) in bfad_im_queuecommand_lck()
1225 cmnd->result = DID_NO_CONNECT << 16; in bfad_im_queuecommand_lck()
1227 cmnd->result = DID_REQUEUE << 16; in bfad_im_queuecommand_lck()
1236 cmnd->scsi_done = done; in bfad_im_queuecommand_lck()
1238 spin_lock_irqsave(&bfad->bfad_lock, flags); in bfad_im_queuecommand_lck()
1239 if (!(bfad->bfad_flags & BFAD_HAL_START_DONE)) { in bfad_im_queuecommand_lck()
1242 bfad->inst_no, cmnd, cmnd->cmnd[0]); in bfad_im_queuecommand_lck()
1243 cmnd->result = DID_NO_CONNECT << 16; in bfad_im_queuecommand_lck()
1248 itnim = itnim_data->itnim; in bfad_im_queuecommand_lck()
1250 cmnd->result = DID_IMM_RETRY << 16; in bfad_im_queuecommand_lck()
1254 hal_io = bfa_ioim_alloc(&bfad->bfa, (struct bfad_ioim_s *) cmnd, in bfad_im_queuecommand_lck()
1255 itnim->bfa_itnim, sg_cnt); in bfad_im_queuecommand_lck()
1258 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_queuecommand_lck()
1263 cmnd->host_scribble = (char *)hal_io; in bfad_im_queuecommand_lck()
1265 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_queuecommand_lck()
1270 spin_unlock_irqrestore(&bfad->bfad_lock, flags); in bfad_im_queuecommand_lck()
1286 for (i = 0; !(bfad->bfad_flags & BFAD_PORT_ONLINE) in DEF_SCSI_QCMD()
1292 if (bfad->bfad_flags & BFAD_PORT_ONLINE) { in DEF_SCSI_QCMD()
1295 for (i = 0; !(bfad->bfad_flags & BFAD_RPORT_ONLINE) in DEF_SCSI_QCMD()
1301 if (rport_delay > 0 && (bfad->bfad_flags & BFAD_RPORT_ONLINE)) { in DEF_SCSI_QCMD()
1317 * -- read from boot information in flash. in bfad_get_linkup_delay()
1322 bfa_iocfc_get_bootwwns(&bfad->bfa, &nwwns, wwns); in bfad_get_linkup_delay()