Lines Matching +full:rst +full:- +full:mgr

1 // SPDX-License-Identifier: GPL-2.0-only
97 * also unmap and free the device-private scatter/gather list.
103 if (io_req->sgl_list_pa) in fnic_release_ioreq_buf()
104 dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa, in fnic_release_ioreq_buf()
105 sizeof(io_req->sgl_list[0]) * io_req->sgl_cnt, in fnic_release_ioreq_buf()
109 if (io_req->sgl_cnt) in fnic_release_ioreq_buf()
110 mempool_free(io_req->sgl_list_alloc, in fnic_release_ioreq_buf()
111 fnic->io_sgl_pool[io_req->sgl_type]); in fnic_release_ioreq_buf()
112 if (io_req->sense_buf_pa) in fnic_release_ioreq_buf()
113 dma_unmap_single(&fnic->pdev->dev, io_req->sense_buf_pa, in fnic_release_ioreq_buf()
121 if (!fnic->fw_ack_recd[hwq]) in free_wq_copy_descs()
128 if (wq->to_clean_index <= fnic->fw_ack_index[hwq]) in free_wq_copy_descs()
129 wq->ring.desc_avail += (fnic->fw_ack_index[hwq] in free_wq_copy_descs()
130 - wq->to_clean_index + 1); in free_wq_copy_descs()
132 wq->ring.desc_avail += (wq->ring.desc_count in free_wq_copy_descs()
133 - wq->to_clean_index in free_wq_copy_descs()
134 + fnic->fw_ack_index[hwq] + 1); in free_wq_copy_descs()
141 wq->to_clean_index = in free_wq_copy_descs()
142 (fnic->fw_ack_index[hwq] + 1) % wq->ring.desc_count; in free_wq_copy_descs()
145 fnic->fw_ack_recd[hwq] = 0; in free_wq_copy_descs()
160 spin_lock_irqsave(&fnic->fnic_lock, flags); in __fnic_set_state_flags()
163 fnic->state_flags &= ~st_flags; in __fnic_set_state_flags()
165 fnic->state_flags |= st_flags; in __fnic_set_state_flags()
167 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in __fnic_set_state_flags()
179 struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0]; in fnic_fw_reset_handler()
186 skb_queue_purge(&fnic->frame_queue); in fnic_fw_reset_handler()
187 skb_queue_purge(&fnic->tx_queue); in fnic_fw_reset_handler()
190 while (atomic_read(&fnic->in_flight)) in fnic_fw_reset_handler()
193 spin_lock_irqsave(&fnic->wq_copy_lock[0], flags); in fnic_fw_reset_handler()
195 if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[0]) in fnic_fw_reset_handler()
199 ret = -EAGAIN; in fnic_fw_reset_handler()
202 atomic64_inc(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_fw_reset_handler()
203 if (atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs) > in fnic_fw_reset_handler()
204 atomic64_read(&fnic->fnic_stats.fw_stats.max_fw_reqs)) in fnic_fw_reset_handler()
205 atomic64_set(&fnic->fnic_stats.fw_stats.max_fw_reqs, in fnic_fw_reset_handler()
207 &fnic->fnic_stats.fw_stats.active_fw_reqs)); in fnic_fw_reset_handler()
210 spin_unlock_irqrestore(&fnic->wq_copy_lock[0], flags); in fnic_fw_reset_handler()
213 atomic64_inc(&fnic->fnic_stats.reset_stats.fw_resets); in fnic_fw_reset_handler()
214 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fw_reset_handler()
218 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fw_reset_handler()
232 struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0]; in fnic_flogi_reg_handler()
234 struct fc_lport *lp = fnic->lport; in fnic_flogi_reg_handler()
239 spin_lock_irqsave(&fnic->wq_copy_lock[0], flags); in fnic_flogi_reg_handler()
241 if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[0]) in fnic_flogi_reg_handler()
245 ret = -EAGAIN; in fnic_flogi_reg_handler()
249 if (fnic->ctlr.map_dest) { in fnic_flogi_reg_handler()
253 memcpy(gw_mac, fnic->ctlr.dest_addr, ETH_ALEN); in fnic_flogi_reg_handler()
257 if ((fnic->config.flags & VFCF_FIP_CAPABLE) && !fnic->ctlr.map_dest) { in fnic_flogi_reg_handler()
260 fnic->data_src_addr, in fnic_flogi_reg_handler()
261 lp->r_a_tov, lp->e_d_tov); in fnic_flogi_reg_handler()
262 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_flogi_reg_handler()
264 fc_id, fnic->data_src_addr, gw_mac); in fnic_flogi_reg_handler()
268 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_flogi_reg_handler()
270 fc_id, fnic->ctlr.map_dest, gw_mac); in fnic_flogi_reg_handler()
273 atomic64_inc(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_flogi_reg_handler()
274 if (atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs) > in fnic_flogi_reg_handler()
275 atomic64_read(&fnic->fnic_stats.fw_stats.max_fw_reqs)) in fnic_flogi_reg_handler()
276 atomic64_set(&fnic->fnic_stats.fw_stats.max_fw_reqs, in fnic_flogi_reg_handler()
277 atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs)); in fnic_flogi_reg_handler()
280 spin_unlock_irqrestore(&fnic->wq_copy_lock[0], flags); in fnic_flogi_reg_handler()
297 struct fc_rport *rport = starget_to_rport(scsi_target(sc->device)); in fnic_queue_wq_copy_desc()
298 struct fc_rport_libfc_priv *rp = rport->dd_data; in fnic_queue_wq_copy_desc()
300 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; in fnic_queue_wq_copy_desc()
308 desc = io_req->sgl_list; in fnic_queue_wq_copy_desc()
310 desc->addr = cpu_to_le64(sg_dma_address(sg)); in fnic_queue_wq_copy_desc()
311 desc->len = cpu_to_le32(sg_dma_len(sg)); in fnic_queue_wq_copy_desc()
312 desc->_resvd = 0; in fnic_queue_wq_copy_desc()
316 io_req->sgl_list_pa = dma_map_single(&fnic->pdev->dev, in fnic_queue_wq_copy_desc()
317 io_req->sgl_list, in fnic_queue_wq_copy_desc()
318 sizeof(io_req->sgl_list[0]) * sg_count, in fnic_queue_wq_copy_desc()
320 if (dma_mapping_error(&fnic->pdev->dev, io_req->sgl_list_pa)) { in fnic_queue_wq_copy_desc()
326 io_req->sense_buf_pa = dma_map_single(&fnic->pdev->dev, in fnic_queue_wq_copy_desc()
327 sc->sense_buffer, in fnic_queue_wq_copy_desc()
330 if (dma_mapping_error(&fnic->pdev->dev, io_req->sense_buf_pa)) { in fnic_queue_wq_copy_desc()
331 dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa, in fnic_queue_wq_copy_desc()
332 sizeof(io_req->sgl_list[0]) * sg_count, in fnic_queue_wq_copy_desc()
338 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_queue_wq_copy_desc()
341 if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[hwq]) in fnic_queue_wq_copy_desc()
345 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_queue_wq_copy_desc()
346 "fnic_queue_wq_copy_desc failure - no descriptors\n"); in fnic_queue_wq_copy_desc()
347 atomic64_inc(&misc_stats->io_cpwq_alloc_failures); in fnic_queue_wq_copy_desc()
352 if (sc->sc_data_direction == DMA_FROM_DEVICE) in fnic_queue_wq_copy_desc()
354 else if (sc->sc_data_direction == DMA_TO_DEVICE) in fnic_queue_wq_copy_desc()
358 if ((fnic->config.flags & VFCF_FCP_SEQ_LVL_ERR) && in fnic_queue_wq_copy_desc()
359 (rp->flags & FC_RP_FLAGS_RETRY)) in fnic_queue_wq_copy_desc()
363 0, exch_flags, io_req->sgl_cnt, in fnic_queue_wq_copy_desc()
365 io_req->sgl_list_pa, in fnic_queue_wq_copy_desc()
366 io_req->sense_buf_pa, in fnic_queue_wq_copy_desc()
371 sc->cmnd, sc->cmd_len, in fnic_queue_wq_copy_desc()
373 fc_lun.scsi_lun, io_req->port_id, in fnic_queue_wq_copy_desc()
374 rport->maxframe_size, rp->r_a_tov, in fnic_queue_wq_copy_desc()
375 rp->e_d_tov); in fnic_queue_wq_copy_desc()
377 atomic64_inc(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_queue_wq_copy_desc()
378 if (atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs) > in fnic_queue_wq_copy_desc()
379 atomic64_read(&fnic->fnic_stats.fw_stats.max_fw_reqs)) in fnic_queue_wq_copy_desc()
380 atomic64_set(&fnic->fnic_stats.fw_stats.max_fw_reqs, in fnic_queue_wq_copy_desc()
381 atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs)); in fnic_queue_wq_copy_desc()
391 struct fc_lport *lp = shost_priv(sc->device->host); in fnic_queuecommand()
395 struct fnic_stats *fnic_stats = &fnic->fnic_stats; in fnic_queuecommand()
407 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_queuecommand()
410 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
411 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
413 fnic->state_flags); in fnic_queuecommand()
418 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
419 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
421 fnic->state_flags); in fnic_queuecommand()
425 rport = starget_to_rport(scsi_target(sc->device)); in fnic_queuecommand()
427 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
428 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
430 sc->result = DID_NO_CONNECT << 16; in fnic_queuecommand()
437 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
438 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
440 atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); in fnic_queuecommand()
441 sc->result = ret; in fnic_queuecommand()
446 rp = rport->dd_data; in fnic_queuecommand()
447 if (!rp || rp->rp_state == RPORT_ST_DELETE) { in fnic_queuecommand()
448 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
449 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
451 rport->port_id); in fnic_queuecommand()
453 atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); in fnic_queuecommand()
454 sc->result = DID_NO_CONNECT<<16; in fnic_queuecommand()
459 if (rp->rp_state != RPORT_ST_READY) { in fnic_queuecommand()
460 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
461 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
463 rport->port_id, rp->rp_state); in fnic_queuecommand()
465 sc->result = DID_IMM_RETRY << 16; in fnic_queuecommand()
470 if (lp->state != LPORT_ST_READY || !(lp->link_up)) { in fnic_queuecommand()
471 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
472 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_queuecommand()
474 lp->state, lp->link_up); in fnic_queuecommand()
478 atomic_inc(&fnic->in_flight); in fnic_queuecommand()
480 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queuecommand()
481 fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED; in fnic_queuecommand()
482 fnic_priv(sc)->flags = FNIC_NO_FLAGS; in fnic_queuecommand()
485 io_req = mempool_alloc(fnic->io_req_pool, GFP_ATOMIC); in fnic_queuecommand()
487 atomic64_inc(&fnic_stats->io_stats.alloc_failures); in fnic_queuecommand()
496 FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no, in fnic_queuecommand()
497 mqtag, sc, 0, sc->cmnd[0], sg_count, fnic_priv(sc)->state); in fnic_queuecommand()
498 mempool_free(io_req, fnic->io_req_pool); in fnic_queuecommand()
503 io_req->sgl_cnt = sg_count; in fnic_queuecommand()
504 io_req->sgl_type = FNIC_SGL_CACHE_DFLT; in fnic_queuecommand()
506 io_req->sgl_type = FNIC_SGL_CACHE_MAX; in fnic_queuecommand()
509 io_req->sgl_list = in fnic_queuecommand()
510 mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type], in fnic_queuecommand()
512 if (!io_req->sgl_list) { in fnic_queuecommand()
513 atomic64_inc(&fnic_stats->io_stats.alloc_failures); in fnic_queuecommand()
516 mempool_free(io_req, fnic->io_req_pool); in fnic_queuecommand()
521 io_req->sgl_list_alloc = io_req->sgl_list; in fnic_queuecommand()
522 ptr = (unsigned long) io_req->sgl_list; in fnic_queuecommand()
524 io_req->sgl_list = (struct host_sg_desc *) in fnic_queuecommand()
526 + FNIC_SG_DESC_ALIGN - 1) in fnic_queuecommand()
527 & ~(FNIC_SG_DESC_ALIGN - 1)); in fnic_queuecommand()
535 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_queuecommand()
539 io_req->port_id = rport->port_id; in fnic_queuecommand()
540 io_req->start_time = jiffies; in fnic_queuecommand()
541 fnic_priv(sc)->state = FNIC_IOREQ_CMD_PENDING; in fnic_queuecommand()
542 fnic_priv(sc)->io_req = io_req; in fnic_queuecommand()
543 fnic_priv(sc)->flags |= FNIC_IO_INITIALIZED; in fnic_queuecommand()
544 io_req->sc = sc; in fnic_queuecommand()
546 if (fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] != NULL) { in fnic_queuecommand()
548 fnic->fnic_num, __func__, hwq, blk_mq_unique_tag_to_tag(mqtag)); in fnic_queuecommand()
549 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queuecommand()
553 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] = io_req; in fnic_queuecommand()
554 io_req->tag = mqtag; in fnic_queuecommand()
557 wq = &fnic->hw_copy_wq[hwq]; in fnic_queuecommand()
558 atomic64_inc(&fnic_stats->io_stats.ios[hwq]); in fnic_queuecommand()
565 FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no, in fnic_queuecommand()
567 io_req = fnic_priv(sc)->io_req; in fnic_queuecommand()
568 fnic_priv(sc)->io_req = NULL; in fnic_queuecommand()
570 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] = NULL; in fnic_queuecommand()
571 fnic_priv(sc)->state = FNIC_IOREQ_CMD_COMPLETE; in fnic_queuecommand()
572 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queuecommand()
575 mempool_free(io_req, fnic->io_req_pool); in fnic_queuecommand()
577 atomic_dec(&fnic->in_flight); in fnic_queuecommand()
580 atomic64_inc(&fnic_stats->io_stats.active_ios); in fnic_queuecommand()
581 atomic64_inc(&fnic_stats->io_stats.num_ios); in fnic_queuecommand()
582 if (atomic64_read(&fnic_stats->io_stats.active_ios) > in fnic_queuecommand()
583 atomic64_read(&fnic_stats->io_stats.max_active_ios)) in fnic_queuecommand()
584 atomic64_set(&fnic_stats->io_stats.max_active_ios, in fnic_queuecommand()
585 atomic64_read(&fnic_stats->io_stats.active_ios)); in fnic_queuecommand()
588 fnic_priv(sc)->flags |= FNIC_IO_ISSUED; in fnic_queuecommand()
591 cmd_trace = ((u64)sc->cmnd[0] << 56 | (u64)sc->cmnd[7] << 40 | in fnic_queuecommand()
592 (u64)sc->cmnd[8] << 32 | (u64)sc->cmnd[2] << 24 | in fnic_queuecommand()
593 (u64)sc->cmnd[3] << 16 | (u64)sc->cmnd[4] << 8 | in fnic_queuecommand()
594 sc->cmnd[5]); in fnic_queuecommand()
596 FNIC_TRACE(fnic_queuecommand, sc->device->host->host_no, in fnic_queuecommand()
602 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queuecommand()
604 atomic_dec(&fnic->in_flight); in fnic_queuecommand()
621 struct reset_stats *reset_stats = &fnic->fnic_stats.reset_stats; in fnic_fcpio_fw_reset_cmpl_handler()
623 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag); in fnic_fcpio_fw_reset_cmpl_handler()
625 atomic64_inc(&reset_stats->fw_reset_completions); in fnic_fcpio_fw_reset_cmpl_handler()
630 atomic64_set(&fnic->fnic_stats.fw_stats.active_fw_reqs, 0); in fnic_fcpio_fw_reset_cmpl_handler()
631 atomic64_set(&fnic->fnic_stats.io_stats.active_ios, 0); in fnic_fcpio_fw_reset_cmpl_handler()
632 atomic64_set(&fnic->io_cmpl_skip, 0); in fnic_fcpio_fw_reset_cmpl_handler()
634 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_fcpio_fw_reset_cmpl_handler()
637 if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) { in fnic_fcpio_fw_reset_cmpl_handler()
640 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_fw_reset_cmpl_handler()
643 fnic->state = FNIC_IN_ETH_MODE; in fnic_fcpio_fw_reset_cmpl_handler()
645 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_fw_reset_cmpl_handler()
655 fnic->state = FNIC_IN_FC_MODE; in fnic_fcpio_fw_reset_cmpl_handler()
656 atomic64_inc(&reset_stats->fw_reset_failures); in fnic_fcpio_fw_reset_cmpl_handler()
657 ret = -1; in fnic_fcpio_fw_reset_cmpl_handler()
660 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_fw_reset_cmpl_handler()
662 fnic_state_to_str(fnic->state)); in fnic_fcpio_fw_reset_cmpl_handler()
663 atomic64_inc(&reset_stats->fw_reset_failures); in fnic_fcpio_fw_reset_cmpl_handler()
664 ret = -1; in fnic_fcpio_fw_reset_cmpl_handler()
668 if (fnic->remove_wait) in fnic_fcpio_fw_reset_cmpl_handler()
669 complete(fnic->remove_wait); in fnic_fcpio_fw_reset_cmpl_handler()
675 if (fnic->remove_wait || ret) { in fnic_fcpio_fw_reset_cmpl_handler()
676 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_fcpio_fw_reset_cmpl_handler()
677 skb_queue_purge(&fnic->tx_queue); in fnic_fcpio_fw_reset_cmpl_handler()
681 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_fcpio_fw_reset_cmpl_handler()
683 queue_work(fnic_event_queue, &fnic->flush_work); in fnic_fcpio_fw_reset_cmpl_handler()
704 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag); in fnic_fcpio_flogi_reg_cmpl_handler()
707 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_fcpio_flogi_reg_cmpl_handler()
709 if (fnic->state == FNIC_IN_ETH_TRANS_FC_MODE) { in fnic_fcpio_flogi_reg_cmpl_handler()
713 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_flogi_reg_cmpl_handler()
715 fnic->state = FNIC_IN_FC_MODE; in fnic_fcpio_flogi_reg_cmpl_handler()
718 fnic->lport->host, fnic->fnic_num, in fnic_fcpio_flogi_reg_cmpl_handler()
721 fnic->state = FNIC_IN_ETH_MODE; in fnic_fcpio_flogi_reg_cmpl_handler()
722 ret = -1; in fnic_fcpio_flogi_reg_cmpl_handler()
725 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_flogi_reg_cmpl_handler()
728 fnic_state_to_str(fnic->state)); in fnic_fcpio_flogi_reg_cmpl_handler()
729 ret = -1; in fnic_fcpio_flogi_reg_cmpl_handler()
733 if (fnic->stop_rx_link_events) { in fnic_fcpio_flogi_reg_cmpl_handler()
734 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_fcpio_flogi_reg_cmpl_handler()
737 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_fcpio_flogi_reg_cmpl_handler()
739 queue_work(fnic_event_queue, &fnic->flush_work); in fnic_fcpio_flogi_reg_cmpl_handler()
740 queue_work(fnic_event_queue, &fnic->frame_work); in fnic_fcpio_flogi_reg_cmpl_handler()
742 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_fcpio_flogi_reg_cmpl_handler()
752 if (wq->to_clean_index <= wq->to_use_index) { in is_ack_index_in_range()
754 if (request_out < wq->to_clean_index || in is_ack_index_in_range()
755 request_out >= wq->to_use_index) in is_ack_index_in_range()
759 if (request_out < wq->to_clean_index && in is_ack_index_in_range()
760 request_out >= wq->to_use_index) in is_ack_index_in_range()
779 u16 request_out = desc->u.ack.request_out; in fnic_fcpio_ack_handler()
785 wq = &fnic->hw_copy_wq[cq_index]; in fnic_fcpio_ack_handler()
786 spin_lock_irqsave(&fnic->wq_copy_lock[wq_index], flags); in fnic_fcpio_ack_handler()
788 fnic->fnic_stats.misc_stats.last_ack_time = jiffies; in fnic_fcpio_ack_handler()
790 fnic->fw_ack_index[wq_index] = request_out; in fnic_fcpio_ack_handler()
791 fnic->fw_ack_recd[wq_index] = 1; in fnic_fcpio_ack_handler()
794 &fnic->fnic_stats.misc_stats.ack_index_out_of_range); in fnic_fcpio_ack_handler()
796 spin_unlock_irqrestore(&fnic->wq_copy_lock[wq_index], flags); in fnic_fcpio_ack_handler()
798 fnic->lport->host->host_no, 0, 0, ox_id_tag[2], ox_id_tag[3], in fnic_fcpio_ack_handler()
817 struct fnic_stats *fnic_stats = &fnic->fnic_stats; in fnic_fcpio_icmnd_cmpl_handler()
827 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &ftag); in fnic_fcpio_icmnd_cmpl_handler()
829 icmnd_cmpl = &desc->u.icmnd_cmpl; in fnic_fcpio_icmnd_cmpl_handler()
836 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_icmnd_cmpl_handler()
839 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_icmnd_cmpl_handler()
844 if (tag >= fnic->fnic_max_tag_id) { in fnic_fcpio_icmnd_cmpl_handler()
845 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_icmnd_cmpl_handler()
848 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_icmnd_cmpl_handler()
853 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
855 sc = scsi_host_find_tag(fnic->lport->host, id); in fnic_fcpio_icmnd_cmpl_handler()
858 atomic64_inc(&fnic_stats->io_stats.sc_null); in fnic_fcpio_icmnd_cmpl_handler()
859 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
860 shost_printk(KERN_ERR, fnic->lport->host, in fnic_fcpio_icmnd_cmpl_handler()
861 "icmnd_cmpl sc is null - " in fnic_fcpio_icmnd_cmpl_handler()
865 fnic->lport->host->host_no, id, in fnic_fcpio_icmnd_cmpl_handler()
866 ((u64)icmnd_cmpl->_resvd0[1] << 16 | in fnic_fcpio_icmnd_cmpl_handler()
867 (u64)icmnd_cmpl->_resvd0[0]), in fnic_fcpio_icmnd_cmpl_handler()
869 (u64)icmnd_cmpl->scsi_status << 8 | in fnic_fcpio_icmnd_cmpl_handler()
870 (u64)icmnd_cmpl->flags), desc, in fnic_fcpio_icmnd_cmpl_handler()
871 (u64)icmnd_cmpl->residual, 0); in fnic_fcpio_icmnd_cmpl_handler()
875 io_req = fnic_priv(sc)->io_req; in fnic_fcpio_icmnd_cmpl_handler()
876 if (fnic->sw_copy_wq[hwq].io_req_table[tag] != io_req) { in fnic_fcpio_icmnd_cmpl_handler()
879 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
885 atomic64_inc(&fnic_stats->io_stats.ioreq_null); in fnic_fcpio_icmnd_cmpl_handler()
886 fnic_priv(sc)->flags |= FNIC_IO_REQ_NULL; in fnic_fcpio_icmnd_cmpl_handler()
887 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
888 shost_printk(KERN_ERR, fnic->lport->host, in fnic_fcpio_icmnd_cmpl_handler()
889 "icmnd_cmpl io_req is null - " in fnic_fcpio_icmnd_cmpl_handler()
894 start_time = io_req->start_time; in fnic_fcpio_icmnd_cmpl_handler()
897 io_req->io_completed = 1; in fnic_fcpio_icmnd_cmpl_handler()
900 * if SCSI-ML has already issued abort on this command, in fnic_fcpio_icmnd_cmpl_handler()
903 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) { in fnic_fcpio_icmnd_cmpl_handler()
909 fnic_priv(sc)->flags |= FNIC_IO_DONE; in fnic_fcpio_icmnd_cmpl_handler()
910 fnic_priv(sc)->flags |= FNIC_IO_ABTS_PENDING; in fnic_fcpio_icmnd_cmpl_handler()
911 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
913 fnic_priv(sc)->flags |= FNIC_IO_ABORTED; in fnic_fcpio_icmnd_cmpl_handler()
915 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_icmnd_cmpl_handler()
921 icmnd_cmpl->scsi_status, in fnic_fcpio_icmnd_cmpl_handler()
922 icmnd_cmpl->residual); in fnic_fcpio_icmnd_cmpl_handler()
927 fnic_priv(sc)->state = FNIC_IOREQ_CMD_COMPLETE; in fnic_fcpio_icmnd_cmpl_handler()
929 icmnd_cmpl = &desc->u.icmnd_cmpl; in fnic_fcpio_icmnd_cmpl_handler()
933 sc->result = (DID_OK << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
936 if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER) { in fnic_fcpio_icmnd_cmpl_handler()
937 xfer_len -= icmnd_cmpl->residual; in fnic_fcpio_icmnd_cmpl_handler()
938 scsi_set_resid(sc, icmnd_cmpl->residual); in fnic_fcpio_icmnd_cmpl_handler()
941 if (icmnd_cmpl->scsi_status == SAM_STAT_CHECK_CONDITION) in fnic_fcpio_icmnd_cmpl_handler()
942 atomic64_inc(&fnic_stats->misc_stats.check_condition); in fnic_fcpio_icmnd_cmpl_handler()
944 if (icmnd_cmpl->scsi_status == SAM_STAT_TASK_SET_FULL) in fnic_fcpio_icmnd_cmpl_handler()
945 atomic64_inc(&fnic_stats->misc_stats.queue_fulls); in fnic_fcpio_icmnd_cmpl_handler()
949 atomic64_inc(&fnic_stats->misc_stats.fcpio_timeout); in fnic_fcpio_icmnd_cmpl_handler()
950 sc->result = (DID_TIME_OUT << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
954 atomic64_inc(&fnic_stats->misc_stats.fcpio_aborted); in fnic_fcpio_icmnd_cmpl_handler()
955 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
959 atomic64_inc(&fnic_stats->misc_stats.data_count_mismatch); in fnic_fcpio_icmnd_cmpl_handler()
960 scsi_set_resid(sc, icmnd_cmpl->residual); in fnic_fcpio_icmnd_cmpl_handler()
961 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
965 atomic64_inc(&fnic_stats->fw_stats.fw_out_of_resources); in fnic_fcpio_icmnd_cmpl_handler()
966 sc->result = (DID_REQUEUE << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
970 atomic64_inc(&fnic_stats->io_stats.io_not_found); in fnic_fcpio_icmnd_cmpl_handler()
971 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
975 atomic64_inc(&fnic_stats->misc_stats.sgl_invalid); in fnic_fcpio_icmnd_cmpl_handler()
976 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
980 atomic64_inc(&fnic_stats->fw_stats.io_fw_errs); in fnic_fcpio_icmnd_cmpl_handler()
981 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
985 atomic64_inc(&fnic_stats->misc_stats.mss_invalid); in fnic_fcpio_icmnd_cmpl_handler()
986 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
993 sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; in fnic_fcpio_icmnd_cmpl_handler()
998 fnic_priv(sc)->io_req = NULL; in fnic_fcpio_icmnd_cmpl_handler()
999 io_req->sc = NULL; in fnic_fcpio_icmnd_cmpl_handler()
1000 fnic_priv(sc)->flags |= FNIC_IO_DONE; in fnic_fcpio_icmnd_cmpl_handler()
1001 fnic->sw_copy_wq[hwq].io_req_table[tag] = NULL; in fnic_fcpio_icmnd_cmpl_handler()
1003 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_icmnd_cmpl_handler()
1006 atomic64_inc(&fnic_stats->io_stats.io_failures); in fnic_fcpio_icmnd_cmpl_handler()
1007 shost_printk(KERN_ERR, fnic->lport->host, "hdr status = %s\n", in fnic_fcpio_icmnd_cmpl_handler()
1014 (u64)icmnd_cmpl->scsi_status << 48 | in fnic_fcpio_icmnd_cmpl_handler()
1015 (u64)icmnd_cmpl->flags << 40 | (u64)sc->cmnd[0] << 32 | in fnic_fcpio_icmnd_cmpl_handler()
1016 (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 | in fnic_fcpio_icmnd_cmpl_handler()
1017 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]; in fnic_fcpio_icmnd_cmpl_handler()
1020 sc->device->host->host_no, id, sc, in fnic_fcpio_icmnd_cmpl_handler()
1021 ((u64)icmnd_cmpl->_resvd0[1] << 56 | in fnic_fcpio_icmnd_cmpl_handler()
1022 (u64)icmnd_cmpl->_resvd0[0] << 48 | in fnic_fcpio_icmnd_cmpl_handler()
1023 jiffies_to_msecs(jiffies - start_time)), in fnic_fcpio_icmnd_cmpl_handler()
1026 if (sc->sc_data_direction == DMA_FROM_DEVICE) { in fnic_fcpio_icmnd_cmpl_handler()
1027 fnic->lport->host_stats.fcp_input_requests++; in fnic_fcpio_icmnd_cmpl_handler()
1028 fnic->fcp_input_bytes += xfer_len; in fnic_fcpio_icmnd_cmpl_handler()
1029 } else if (sc->sc_data_direction == DMA_TO_DEVICE) { in fnic_fcpio_icmnd_cmpl_handler()
1030 fnic->lport->host_stats.fcp_output_requests++; in fnic_fcpio_icmnd_cmpl_handler()
1031 fnic->fcp_output_bytes += xfer_len; in fnic_fcpio_icmnd_cmpl_handler()
1033 fnic->lport->host_stats.fcp_control_requests++; in fnic_fcpio_icmnd_cmpl_handler()
1038 mempool_free(io_req, fnic->io_req_pool); in fnic_fcpio_icmnd_cmpl_handler()
1040 atomic64_dec(&fnic_stats->io_stats.active_ios); in fnic_fcpio_icmnd_cmpl_handler()
1041 if (atomic64_read(&fnic->io_cmpl_skip)) in fnic_fcpio_icmnd_cmpl_handler()
1042 atomic64_dec(&fnic->io_cmpl_skip); in fnic_fcpio_icmnd_cmpl_handler()
1044 atomic64_inc(&fnic_stats->io_stats.io_completions); in fnic_fcpio_icmnd_cmpl_handler()
1047 io_duration_time = jiffies_to_msecs(jiffies) - in fnic_fcpio_icmnd_cmpl_handler()
1051 atomic64_inc(&fnic_stats->io_stats.io_btw_0_to_10_msec); in fnic_fcpio_icmnd_cmpl_handler()
1053 atomic64_inc(&fnic_stats->io_stats.io_btw_10_to_100_msec); in fnic_fcpio_icmnd_cmpl_handler()
1055 atomic64_inc(&fnic_stats->io_stats.io_btw_100_to_500_msec); in fnic_fcpio_icmnd_cmpl_handler()
1057 atomic64_inc(&fnic_stats->io_stats.io_btw_500_to_5000_msec); in fnic_fcpio_icmnd_cmpl_handler()
1059 atomic64_inc(&fnic_stats->io_stats.io_btw_5000_to_10000_msec); in fnic_fcpio_icmnd_cmpl_handler()
1061 atomic64_inc(&fnic_stats->io_stats.io_btw_10000_to_30000_msec); in fnic_fcpio_icmnd_cmpl_handler()
1063 atomic64_inc(&fnic_stats->io_stats.io_greater_than_30000_msec); in fnic_fcpio_icmnd_cmpl_handler()
1065 if(io_duration_time > atomic64_read(&fnic_stats->io_stats.current_max_io_time)) in fnic_fcpio_icmnd_cmpl_handler()
1066 atomic64_set(&fnic_stats->io_stats.current_max_io_time, io_duration_time); in fnic_fcpio_icmnd_cmpl_handler()
1082 struct fnic_stats *fnic_stats = &fnic->fnic_stats; in fnic_fcpio_itmf_cmpl_handler()
1083 struct abort_stats *abts_stats = &fnic->fnic_stats.abts_stats; in fnic_fcpio_itmf_cmpl_handler()
1084 struct terminate_stats *term_stats = &fnic->fnic_stats.term_stats; in fnic_fcpio_itmf_cmpl_handler()
1085 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; in fnic_fcpio_itmf_cmpl_handler()
1092 fcpio_header_dec(&desc->hdr, &type, &hdr_status, &ftag); in fnic_fcpio_itmf_cmpl_handler()
1100 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1103 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1108 if (tag > fnic->fnic_max_tag_id) { in fnic_fcpio_itmf_cmpl_handler()
1109 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1112 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1116 } else if ((tag == fnic->fnic_max_tag_id) && !(id & FNIC_TAG_DEV_RST)) { in fnic_fcpio_itmf_cmpl_handler()
1117 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1120 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1126 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1131 if ((mqtag == fnic->fnic_max_tag_id) && (id & FNIC_TAG_DEV_RST)) { in fnic_fcpio_itmf_cmpl_handler()
1132 io_req = fnic->sw_copy_wq[hwq].io_req_table[tag]; in fnic_fcpio_itmf_cmpl_handler()
1134 sc = io_req->sc; in fnic_fcpio_itmf_cmpl_handler()
1136 sc = scsi_host_find_tag(fnic->lport->host, id & FNIC_TAG_MASK); in fnic_fcpio_itmf_cmpl_handler()
1141 atomic64_inc(&fnic_stats->io_stats.sc_null); in fnic_fcpio_itmf_cmpl_handler()
1142 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1143 shost_printk(KERN_ERR, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1144 "itmf_cmpl sc is null - hdr status = %s tag = 0x%x\n", in fnic_fcpio_itmf_cmpl_handler()
1149 io_req = fnic_priv(sc)->io_req; in fnic_fcpio_itmf_cmpl_handler()
1152 atomic64_inc(&fnic_stats->io_stats.ioreq_null); in fnic_fcpio_itmf_cmpl_handler()
1153 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1154 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_REQ_NULL; in fnic_fcpio_itmf_cmpl_handler()
1155 shost_printk(KERN_ERR, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1156 "itmf_cmpl io_req is null - " in fnic_fcpio_itmf_cmpl_handler()
1161 start_time = io_req->start_time; in fnic_fcpio_itmf_cmpl_handler()
1166 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1170 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_COMPLETE; in fnic_fcpio_itmf_cmpl_handler()
1171 fnic_priv(sc)->abts_status = hdr_status; in fnic_fcpio_itmf_cmpl_handler()
1172 fnic_priv(sc)->flags |= FNIC_DEV_RST_DONE; in fnic_fcpio_itmf_cmpl_handler()
1173 if (io_req->abts_done) in fnic_fcpio_itmf_cmpl_handler()
1174 complete(io_req->abts_done); in fnic_fcpio_itmf_cmpl_handler()
1175 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1178 shost_printk(KERN_DEBUG, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1186 if (fnic_priv(sc)->flags & FNIC_IO_ABTS_ISSUED) in fnic_fcpio_itmf_cmpl_handler()
1187 atomic64_inc(&abts_stats->abort_fw_timeouts); in fnic_fcpio_itmf_cmpl_handler()
1190 &term_stats->terminate_fw_timeouts); in fnic_fcpio_itmf_cmpl_handler()
1193 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1198 if (fnic_priv(sc)->flags & FNIC_IO_ABTS_ISSUED) in fnic_fcpio_itmf_cmpl_handler()
1199 atomic64_inc(&abts_stats->abort_io_not_found); in fnic_fcpio_itmf_cmpl_handler()
1202 &term_stats->terminate_io_not_found); in fnic_fcpio_itmf_cmpl_handler()
1205 if (fnic_priv(sc)->flags & FNIC_IO_ABTS_ISSUED) in fnic_fcpio_itmf_cmpl_handler()
1206 atomic64_inc(&abts_stats->abort_failures); in fnic_fcpio_itmf_cmpl_handler()
1209 &term_stats->terminate_failures); in fnic_fcpio_itmf_cmpl_handler()
1212 if (fnic_priv(sc)->state != FNIC_IOREQ_ABTS_PENDING) { in fnic_fcpio_itmf_cmpl_handler()
1214 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1218 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_DONE; in fnic_fcpio_itmf_cmpl_handler()
1219 fnic_priv(sc)->abts_status = hdr_status; in fnic_fcpio_itmf_cmpl_handler()
1223 fnic_priv(sc)->abts_status = FCPIO_SUCCESS; in fnic_fcpio_itmf_cmpl_handler()
1225 if (!(fnic_priv(sc)->flags & (FNIC_IO_ABORTED | FNIC_IO_DONE))) in fnic_fcpio_itmf_cmpl_handler()
1226 atomic64_inc(&misc_stats->no_icmnd_itmf_cmpls); in fnic_fcpio_itmf_cmpl_handler()
1228 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1238 if (io_req->abts_done) { in fnic_fcpio_itmf_cmpl_handler()
1239 complete(io_req->abts_done); in fnic_fcpio_itmf_cmpl_handler()
1240 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1241 shost_printk(KERN_INFO, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1245 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1249 fnic_priv(sc)->io_req = NULL; in fnic_fcpio_itmf_cmpl_handler()
1250 sc->result = (DID_ERROR << 16); in fnic_fcpio_itmf_cmpl_handler()
1251 fnic->sw_copy_wq[hwq].io_req_table[tag] = NULL; in fnic_fcpio_itmf_cmpl_handler()
1252 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1255 mempool_free(io_req, fnic->io_req_pool); in fnic_fcpio_itmf_cmpl_handler()
1257 sc->device->host->host_no, id, in fnic_fcpio_itmf_cmpl_handler()
1259 jiffies_to_msecs(jiffies - start_time), in fnic_fcpio_itmf_cmpl_handler()
1262 (u64)sc->cmnd[0] << 32 | in fnic_fcpio_itmf_cmpl_handler()
1263 (u64)sc->cmnd[2] << 24 | in fnic_fcpio_itmf_cmpl_handler()
1264 (u64)sc->cmnd[3] << 16 | in fnic_fcpio_itmf_cmpl_handler()
1265 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), in fnic_fcpio_itmf_cmpl_handler()
1268 atomic64_dec(&fnic_stats->io_stats.active_ios); in fnic_fcpio_itmf_cmpl_handler()
1269 if (atomic64_read(&fnic->io_cmpl_skip)) in fnic_fcpio_itmf_cmpl_handler()
1270 atomic64_dec(&fnic->io_cmpl_skip); in fnic_fcpio_itmf_cmpl_handler()
1272 atomic64_inc(&fnic_stats->io_stats.io_completions); in fnic_fcpio_itmf_cmpl_handler()
1276 shost_printk(KERN_INFO, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1280 fnic_priv(sc)->lr_status = hdr_status; in fnic_fcpio_itmf_cmpl_handler()
1281 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) { in fnic_fcpio_itmf_cmpl_handler()
1282 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1283 fnic_priv(sc)->flags |= FNIC_DEV_RST_ABTS_PENDING; in fnic_fcpio_itmf_cmpl_handler()
1285 sc->device->host->host_no, id, sc, in fnic_fcpio_itmf_cmpl_handler()
1286 jiffies_to_msecs(jiffies - start_time), in fnic_fcpio_itmf_cmpl_handler()
1288 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1294 if (fnic_priv(sc)->flags & FNIC_DEV_RST_TIMED_OUT) { in fnic_fcpio_itmf_cmpl_handler()
1296 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1298 sc->device->host->host_no, id, sc, in fnic_fcpio_itmf_cmpl_handler()
1299 jiffies_to_msecs(jiffies - start_time), in fnic_fcpio_itmf_cmpl_handler()
1301 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1308 fnic_priv(sc)->state = FNIC_IOREQ_CMD_COMPLETE; in fnic_fcpio_itmf_cmpl_handler()
1309 fnic_priv(sc)->flags |= FNIC_DEV_RST_DONE; in fnic_fcpio_itmf_cmpl_handler()
1310 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_itmf_cmpl_handler()
1314 if (io_req->dr_done) in fnic_fcpio_itmf_cmpl_handler()
1315 complete(io_req->dr_done); in fnic_fcpio_itmf_cmpl_handler()
1316 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1319 shost_printk(KERN_ERR, fnic->lport->host, in fnic_fcpio_itmf_cmpl_handler()
1321 __func__, hwq, id, fnic_ioreq_state_to_str(fnic_priv(sc)->state)); in fnic_fcpio_itmf_cmpl_handler()
1322 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_fcpio_itmf_cmpl_handler()
1337 switch (desc->hdr.type) { in fnic_fcpio_cmpl_handler()
1343 atomic64_dec(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_fcpio_cmpl_handler()
1349 cq_index -= fnic->copy_wq_base; in fnic_fcpio_cmpl_handler()
1351 switch (desc->hdr.type) { in fnic_fcpio_cmpl_handler()
1374 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_fcpio_cmpl_handler()
1376 desc->hdr.type); in fnic_fcpio_cmpl_handler()
1390 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; in fnic_wq_copy_cmpl_handler()
1397 cur_work_done = vnic_cq_copy_service(&fnic->cq[cq_index], in fnic_wq_copy_cmpl_handler()
1401 delta_jiffies = end_jiffies - start_jiffies; in fnic_wq_copy_cmpl_handler()
1402 if (delta_jiffies > (u64) atomic64_read(&misc_stats->max_isr_jiffies)) { in fnic_wq_copy_cmpl_handler()
1403 atomic64_set(&misc_stats->max_isr_jiffies, delta_jiffies); in fnic_wq_copy_cmpl_handler()
1405 atomic64_set(&misc_stats->max_isr_time_ms, delta_ms); in fnic_wq_copy_cmpl_handler()
1406 atomic64_set(&misc_stats->corr_work_done, cur_work_done); in fnic_wq_copy_cmpl_handler()
1419 struct fnic_stats *fnic_stats = &fnic->fnic_stats; in fnic_cleanup_io_iter()
1428 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_cleanup_io_iter()
1430 fnic->sw_copy_wq[hwq].io_req_table[tag] = NULL; in fnic_cleanup_io_iter()
1432 io_req = fnic_priv(sc)->io_req; in fnic_cleanup_io_iter()
1434 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_cleanup_io_iter()
1435 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_cleanup_io_iter()
1437 hwq, mqtag, tag, fnic_priv(sc)->flags); in fnic_cleanup_io_iter()
1441 if ((fnic_priv(sc)->flags & FNIC_DEVICE_RESET) && in fnic_cleanup_io_iter()
1442 !(fnic_priv(sc)->flags & FNIC_DEV_RST_DONE)) { in fnic_cleanup_io_iter()
1447 fnic_priv(sc)->flags |= FNIC_DEV_RST_DONE; in fnic_cleanup_io_iter()
1448 if (io_req && io_req->dr_done) in fnic_cleanup_io_iter()
1449 complete(io_req->dr_done); in fnic_cleanup_io_iter()
1450 else if (io_req && io_req->abts_done) in fnic_cleanup_io_iter()
1451 complete(io_req->abts_done); in fnic_cleanup_io_iter()
1452 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_cleanup_io_iter()
1454 } else if (fnic_priv(sc)->flags & FNIC_DEVICE_RESET) { in fnic_cleanup_io_iter()
1455 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_cleanup_io_iter()
1459 fnic_priv(sc)->io_req = NULL; in fnic_cleanup_io_iter()
1460 io_req->sc = NULL; in fnic_cleanup_io_iter()
1461 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_cleanup_io_iter()
1467 start_time = io_req->start_time; in fnic_cleanup_io_iter()
1469 mempool_free(io_req, fnic->io_req_pool); in fnic_cleanup_io_iter()
1471 sc->result = DID_TRANSPORT_DISRUPTED << 16; in fnic_cleanup_io_iter()
1472 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_cleanup_io_iter()
1474 mqtag, tag, sc, (jiffies - start_time)); in fnic_cleanup_io_iter()
1476 if (atomic64_read(&fnic->io_cmpl_skip)) in fnic_cleanup_io_iter()
1477 atomic64_dec(&fnic->io_cmpl_skip); in fnic_cleanup_io_iter()
1479 atomic64_inc(&fnic_stats->io_stats.io_completions); in fnic_cleanup_io_iter()
1482 sc->device->host->host_no, tag, sc, in fnic_cleanup_io_iter()
1483 jiffies_to_msecs(jiffies - start_time), in fnic_cleanup_io_iter()
1484 0, ((u64)sc->cmnd[0] << 32 | in fnic_cleanup_io_iter()
1485 (u64)sc->cmnd[2] << 24 | in fnic_cleanup_io_iter()
1486 (u64)sc->cmnd[3] << 16 | in fnic_cleanup_io_iter()
1487 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), in fnic_cleanup_io_iter()
1497 scsi_host_busy_iter(fnic->lport->host, in fnic_cleanup_io()
1505 struct fnic *fnic = vnic_dev_priv(wq->vdev); in fnic_wq_copy_cleanup_handler()
1513 fcpio_tag_id_dec(&desc->hdr.tag, &id); in fnic_wq_copy_cleanup_handler()
1516 if (id >= fnic->fnic_max_tag_id) in fnic_wq_copy_cleanup_handler()
1519 sc = scsi_host_find_tag(fnic->lport->host, id); in fnic_wq_copy_cleanup_handler()
1524 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_wq_copy_cleanup_handler()
1527 io_req = fnic_priv(sc)->io_req; in fnic_wq_copy_cleanup_handler()
1532 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_wq_copy_cleanup_handler()
1536 fnic_priv(sc)->io_req = NULL; in fnic_wq_copy_cleanup_handler()
1537 io_req->sc = NULL; in fnic_wq_copy_cleanup_handler()
1538 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(id)] = NULL; in fnic_wq_copy_cleanup_handler()
1540 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_wq_copy_cleanup_handler()
1542 start_time = io_req->start_time; in fnic_wq_copy_cleanup_handler()
1544 mempool_free(io_req, fnic->io_req_pool); in fnic_wq_copy_cleanup_handler()
1547 sc->result = DID_NO_CONNECT << 16; in fnic_wq_copy_cleanup_handler()
1548 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, "wq_copy_cleanup_handler:" in fnic_wq_copy_cleanup_handler()
1552 sc->device->host->host_no, id, sc, in fnic_wq_copy_cleanup_handler()
1553 jiffies_to_msecs(jiffies - start_time), in fnic_wq_copy_cleanup_handler()
1554 0, ((u64)sc->cmnd[0] << 32 | in fnic_wq_copy_cleanup_handler()
1555 (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 | in fnic_wq_copy_cleanup_handler()
1556 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), in fnic_wq_copy_cleanup_handler()
1567 struct vnic_wq_copy *wq = &fnic->hw_copy_wq[hwq]; in fnic_queue_abort_io_req()
1568 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; in fnic_queue_abort_io_req()
1571 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_queue_abort_io_req()
1574 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queue_abort_io_req()
1577 atomic_inc(&fnic->in_flight); in fnic_queue_abort_io_req()
1578 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queue_abort_io_req()
1580 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_queue_abort_io_req()
1582 if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[hwq]) in fnic_queue_abort_io_req()
1586 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queue_abort_io_req()
1587 atomic_dec(&fnic->in_flight); in fnic_queue_abort_io_req()
1588 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queue_abort_io_req()
1590 atomic64_inc(&misc_stats->abts_cpwq_alloc_failures); in fnic_queue_abort_io_req()
1594 0, task_req, tag, fc_lun, io_req->port_id, in fnic_queue_abort_io_req()
1595 fnic->config.ra_tov, fnic->config.ed_tov); in fnic_queue_abort_io_req()
1597 atomic64_inc(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_queue_abort_io_req()
1598 if (atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs) > in fnic_queue_abort_io_req()
1599 atomic64_read(&fnic->fnic_stats.fw_stats.max_fw_reqs)) in fnic_queue_abort_io_req()
1600 atomic64_set(&fnic->fnic_stats.fw_stats.max_fw_reqs, in fnic_queue_abort_io_req()
1601 atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs)); in fnic_queue_abort_io_req()
1603 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queue_abort_io_req()
1604 atomic_dec(&fnic->in_flight); in fnic_queue_abort_io_req()
1619 struct fnic *fnic = iter_data->fnic; in fnic_rport_abort_io_iter()
1623 struct reset_stats *reset_stats = &fnic->fnic_stats.reset_stats; in fnic_rport_abort_io_iter()
1624 struct terminate_stats *term_stats = &fnic->fnic_stats.term_stats; in fnic_rport_abort_io_iter()
1632 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1634 io_req = fnic_priv(sc)->io_req; in fnic_rport_abort_io_iter()
1636 if (!io_req || io_req->port_id != iter_data->port_id) { in fnic_rport_abort_io_iter()
1637 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1641 if ((fnic_priv(sc)->flags & FNIC_DEVICE_RESET) && in fnic_rport_abort_io_iter()
1642 !(fnic_priv(sc)->flags & FNIC_DEV_RST_ISSUED)) { in fnic_rport_abort_io_iter()
1643 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_rport_abort_io_iter()
1645 hwq, abt_tag, fnic_priv(sc)->flags); in fnic_rport_abort_io_iter()
1646 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1654 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) { in fnic_rport_abort_io_iter()
1655 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1658 if (io_req->abts_done) { in fnic_rport_abort_io_iter()
1659 shost_printk(KERN_ERR, fnic->lport->host, in fnic_rport_abort_io_iter()
1660 "fnic_rport_exch_reset: io_req->abts_done is set " in fnic_rport_abort_io_iter()
1662 fnic_ioreq_state_to_str(fnic_priv(sc)->state)); in fnic_rport_abort_io_iter()
1665 if (!(fnic_priv(sc)->flags & FNIC_IO_ISSUED)) { in fnic_rport_abort_io_iter()
1666 shost_printk(KERN_ERR, fnic->lport->host, in fnic_rport_abort_io_iter()
1670 sc, abt_tag, fnic_priv(sc)->flags, fnic_priv(sc)->state); in fnic_rport_abort_io_iter()
1672 old_ioreq_state = fnic_priv(sc)->state; in fnic_rport_abort_io_iter()
1673 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_PENDING; in fnic_rport_abort_io_iter()
1674 fnic_priv(sc)->abts_status = FCPIO_INVALID_CODE; in fnic_rport_abort_io_iter()
1675 if (fnic_priv(sc)->flags & FNIC_DEVICE_RESET) { in fnic_rport_abort_io_iter()
1676 atomic64_inc(&reset_stats->device_reset_terminates); in fnic_rport_abort_io_iter()
1679 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_rport_abort_io_iter()
1680 "fnic_rport_exch_reset dev rst sc 0x%p\n", sc); in fnic_rport_abort_io_iter()
1681 BUG_ON(io_req->abts_done); in fnic_rport_abort_io_iter()
1683 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_rport_abort_io_iter()
1686 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1689 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_rport_abort_io_iter()
1700 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1701 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_rport_abort_io_iter()
1703 hwq, abt_tag, fnic_priv(sc)->flags); in fnic_rport_abort_io_iter()
1704 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) in fnic_rport_abort_io_iter()
1705 fnic_priv(sc)->state = old_ioreq_state; in fnic_rport_abort_io_iter()
1706 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1708 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1709 if (fnic_priv(sc)->flags & FNIC_DEVICE_RESET) in fnic_rport_abort_io_iter()
1710 fnic_priv(sc)->flags |= FNIC_DEV_RST_TERM_ISSUED; in fnic_rport_abort_io_iter()
1712 fnic_priv(sc)->flags |= FNIC_IO_INTERNAL_TERM_ISSUED; in fnic_rport_abort_io_iter()
1713 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_rport_abort_io_iter()
1714 atomic64_inc(&term_stats->terminates); in fnic_rport_abort_io_iter()
1715 iter_data->term_cnt++; in fnic_rport_abort_io_iter()
1722 struct terminate_stats *term_stats = &fnic->fnic_stats.term_stats; in fnic_rport_exch_reset()
1730 fnic->lport->host, fnic->fnic_num, in fnic_rport_exch_reset()
1734 if (fnic->in_remove) in fnic_rport_exch_reset()
1737 scsi_host_busy_iter(fnic->lport->host, fnic_rport_abort_io_iter, in fnic_rport_exch_reset()
1739 if (iter_data.term_cnt > atomic64_read(&term_stats->max_terminates)) in fnic_rport_exch_reset()
1740 atomic64_set(&term_stats->max_terminates, iter_data.term_cnt); in fnic_rport_exch_reset()
1754 rdata = rport->dd_data; in fnic_terminate_rport_io()
1760 lport = rdata->local_port; in fnic_terminate_rport_io()
1767 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_terminate_rport_io()
1769 rport->port_name, rport->node_name, rport, in fnic_terminate_rport_io()
1770 rport->port_id); in fnic_terminate_rport_io()
1772 if (fnic->in_remove) in fnic_terminate_rport_io()
1775 fnic_rport_exch_reset(fnic, rport->port_id); in fnic_terminate_rport_io()
1808 /* Get local-port, check ready and link up */ in fnic_abort_cmd()
1809 lp = shost_priv(sc->device->host); in fnic_abort_cmd()
1813 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_abort_cmd()
1814 fnic_stats = &fnic->fnic_stats; in fnic_abort_cmd()
1815 abts_stats = &fnic->fnic_stats.abts_stats; in fnic_abort_cmd()
1816 term_stats = &fnic->fnic_stats.term_stats; in fnic_abort_cmd()
1818 rport = starget_to_rport(scsi_target(sc->device)); in fnic_abort_cmd()
1822 fnic_priv(sc)->flags = FNIC_NO_FLAGS; in fnic_abort_cmd()
1824 if (lp->state != LPORT_ST_READY || !(lp->link_up)) { in fnic_abort_cmd()
1826 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_abort_cmd()
1830 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_abort_cmd()
1843 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1844 io_req = fnic_priv(sc)->io_req; in fnic_abort_cmd()
1846 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1850 io_req->abts_done = &tm_done; in fnic_abort_cmd()
1852 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) { in fnic_abort_cmd()
1853 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1857 abt_issued_time = jiffies_to_msecs(jiffies) - jiffies_to_msecs(io_req->start_time); in fnic_abort_cmd()
1859 atomic64_inc(&abts_stats->abort_issued_btw_0_to_6_sec); in fnic_abort_cmd()
1861 atomic64_inc(&abts_stats->abort_issued_btw_6_to_20_sec); in fnic_abort_cmd()
1863 atomic64_inc(&abts_stats->abort_issued_btw_20_to_30_sec); in fnic_abort_cmd()
1865 atomic64_inc(&abts_stats->abort_issued_btw_30_to_40_sec); in fnic_abort_cmd()
1867 atomic64_inc(&abts_stats->abort_issued_btw_40_to_50_sec); in fnic_abort_cmd()
1869 atomic64_inc(&abts_stats->abort_issued_btw_50_to_60_sec); in fnic_abort_cmd()
1871 atomic64_inc(&abts_stats->abort_issued_greater_than_60_sec); in fnic_abort_cmd()
1873 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_abort_cmd()
1875 sc->cmnd[0], abt_issued_time); in fnic_abort_cmd()
1879 * the completion wont be done till mid-layer, since abort in fnic_abort_cmd()
1882 old_ioreq_state = fnic_priv(sc)->state; in fnic_abort_cmd()
1883 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_PENDING; in fnic_abort_cmd()
1884 fnic_priv(sc)->abts_status = FCPIO_INVALID_CODE; in fnic_abort_cmd()
1886 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1896 atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); in fnic_abort_cmd()
1901 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_abort_cmd()
1905 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1906 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) in fnic_abort_cmd()
1907 fnic_priv(sc)->state = old_ioreq_state; in fnic_abort_cmd()
1908 io_req = fnic_priv(sc)->io_req; in fnic_abort_cmd()
1910 io_req->abts_done = NULL; in fnic_abort_cmd()
1911 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1916 fnic_priv(sc)->flags |= FNIC_IO_ABTS_ISSUED; in fnic_abort_cmd()
1917 atomic64_inc(&fnic_stats->abts_stats.aborts); in fnic_abort_cmd()
1919 fnic_priv(sc)->flags |= FNIC_IO_TERM_ISSUED; in fnic_abort_cmd()
1920 atomic64_inc(&fnic_stats->term_stats.terminates); in fnic_abort_cmd()
1931 (2 * fnic->config.ra_tov + in fnic_abort_cmd()
1932 fnic->config.ed_tov)); in fnic_abort_cmd()
1935 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1937 io_req = fnic_priv(sc)->io_req; in fnic_abort_cmd()
1939 atomic64_inc(&fnic_stats->io_stats.ioreq_null); in fnic_abort_cmd()
1940 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1941 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_REQ_NULL; in fnic_abort_cmd()
1945 io_req->abts_done = NULL; in fnic_abort_cmd()
1948 if (fnic_priv(sc)->abts_status == FCPIO_INVALID_CODE) { in fnic_abort_cmd()
1949 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1951 atomic64_inc(&abts_stats->abort_drv_timeouts); in fnic_abort_cmd()
1953 atomic64_inc(&term_stats->terminate_drv_timeouts); in fnic_abort_cmd()
1955 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_TIMED_OUT; in fnic_abort_cmd()
1962 if (!(fnic_priv(sc)->flags & (FNIC_IO_ABORTED | FNIC_IO_DONE))) { in fnic_abort_cmd()
1963 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1964 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_abort_cmd()
1971 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_COMPLETE; in fnic_abort_cmd()
1973 start_time = io_req->start_time; in fnic_abort_cmd()
1979 if (fnic_priv(sc)->abts_status == FCPIO_SUCCESS || in fnic_abort_cmd()
1980 (fnic_priv(sc)->abts_status == FCPIO_ABORTED)) { in fnic_abort_cmd()
1981 fnic_priv(sc)->io_req = NULL; in fnic_abort_cmd()
1982 io_req->sc = NULL; in fnic_abort_cmd()
1985 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1989 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] = NULL; in fnic_abort_cmd()
1990 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abort_cmd()
1993 mempool_free(io_req, fnic->io_req_pool); in fnic_abort_cmd()
1996 sc->result = DID_ABORT << 16; in fnic_abort_cmd()
1998 atomic64_dec(&fnic_stats->io_stats.active_ios); in fnic_abort_cmd()
1999 if (atomic64_read(&fnic->io_cmpl_skip)) in fnic_abort_cmd()
2000 atomic64_dec(&fnic->io_cmpl_skip); in fnic_abort_cmd()
2002 atomic64_inc(&fnic_stats->io_stats.io_completions); in fnic_abort_cmd()
2005 FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, mqtag, sc, in fnic_abort_cmd()
2006 jiffies_to_msecs(jiffies - start_time), in fnic_abort_cmd()
2007 0, ((u64)sc->cmnd[0] << 32 | in fnic_abort_cmd()
2008 (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 | in fnic_abort_cmd()
2009 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), in fnic_abort_cmd()
2012 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_abort_cmd()
2024 struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; in fnic_queue_dr_io_req()
2031 tag = io_req->tag; in fnic_queue_dr_io_req()
2033 wq = &fnic->hw_copy_wq[hwq]; in fnic_queue_dr_io_req()
2035 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_queue_dr_io_req()
2038 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queue_dr_io_req()
2041 atomic_inc(&fnic->in_flight); in fnic_queue_dr_io_req()
2042 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_queue_dr_io_req()
2044 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_queue_dr_io_req()
2046 if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[hwq]) in fnic_queue_dr_io_req()
2050 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_queue_dr_io_req()
2051 "queue_dr_io_req failure - no descriptors\n"); in fnic_queue_dr_io_req()
2052 atomic64_inc(&misc_stats->devrst_cpwq_alloc_failures); in fnic_queue_dr_io_req()
2053 ret = -EAGAIN; in fnic_queue_dr_io_req()
2058 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_queue_dr_io_req()
2063 fc_lun.scsi_lun, io_req->port_id, in fnic_queue_dr_io_req()
2064 fnic->config.ra_tov, fnic->config.ed_tov); in fnic_queue_dr_io_req()
2066 atomic64_inc(&fnic->fnic_stats.fw_stats.active_fw_reqs); in fnic_queue_dr_io_req()
2067 if (atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs) > in fnic_queue_dr_io_req()
2068 atomic64_read(&fnic->fnic_stats.fw_stats.max_fw_reqs)) in fnic_queue_dr_io_req()
2069 atomic64_set(&fnic->fnic_stats.fw_stats.max_fw_reqs, in fnic_queue_dr_io_req()
2070 atomic64_read(&fnic->fnic_stats.fw_stats.active_fw_reqs)); in fnic_queue_dr_io_req()
2073 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_queue_dr_io_req()
2074 atomic_dec(&fnic->in_flight); in fnic_queue_dr_io_req()
2090 struct fnic *fnic = iter_data->fnic; in fnic_pending_aborts_iter()
2091 struct scsi_device *lun_dev = iter_data->lun_dev; in fnic_pending_aborts_iter()
2100 if (sc == iter_data->lr_sc || sc->device != lun_dev) in fnic_pending_aborts_iter()
2106 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2107 io_req = fnic_priv(sc)->io_req; in fnic_pending_aborts_iter()
2109 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2117 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_pending_aborts_iter()
2119 fnic_ioreq_state_to_str(fnic_priv(sc)->state)); in fnic_pending_aborts_iter()
2121 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) { in fnic_pending_aborts_iter()
2122 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2125 if ((fnic_priv(sc)->flags & FNIC_DEVICE_RESET) && in fnic_pending_aborts_iter()
2126 (!(fnic_priv(sc)->flags & FNIC_DEV_RST_ISSUED))) { in fnic_pending_aborts_iter()
2127 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_pending_aborts_iter()
2128 "dev rst not pending sc 0x%p\n", sc); in fnic_pending_aborts_iter()
2129 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2133 if (io_req->abts_done) in fnic_pending_aborts_iter()
2134 shost_printk(KERN_ERR, fnic->lport->host, in fnic_pending_aborts_iter()
2135 "%s: io_req->abts_done is set state is %s\n", in fnic_pending_aborts_iter()
2136 __func__, fnic_ioreq_state_to_str(fnic_priv(sc)->state)); in fnic_pending_aborts_iter()
2137 old_ioreq_state = fnic_priv(sc)->state; in fnic_pending_aborts_iter()
2145 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_PENDING; in fnic_pending_aborts_iter()
2147 BUG_ON(io_req->abts_done); in fnic_pending_aborts_iter()
2149 if (fnic_priv(sc)->flags & FNIC_DEVICE_RESET) { in fnic_pending_aborts_iter()
2150 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_pending_aborts_iter()
2151 "dev rst sc 0x%p\n", sc); in fnic_pending_aborts_iter()
2154 fnic_priv(sc)->abts_status = FCPIO_INVALID_CODE; in fnic_pending_aborts_iter()
2155 io_req->abts_done = &tm_done; in fnic_pending_aborts_iter()
2156 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2159 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_pending_aborts_iter()
2164 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2165 io_req = fnic_priv(sc)->io_req; in fnic_pending_aborts_iter()
2167 io_req->abts_done = NULL; in fnic_pending_aborts_iter()
2168 if (fnic_priv(sc)->state == FNIC_IOREQ_ABTS_PENDING) in fnic_pending_aborts_iter()
2169 fnic_priv(sc)->state = old_ioreq_state; in fnic_pending_aborts_iter()
2170 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2171 iter_data->ret = FAILED; in fnic_pending_aborts_iter()
2172 FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num, in fnic_pending_aborts_iter()
2177 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2178 if (fnic_priv(sc)->flags & FNIC_DEVICE_RESET) in fnic_pending_aborts_iter()
2179 fnic_priv(sc)->flags |= FNIC_DEV_RST_TERM_ISSUED; in fnic_pending_aborts_iter()
2180 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2182 fnic_priv(sc)->flags |= FNIC_IO_INTERNAL_TERM_ISSUED; in fnic_pending_aborts_iter()
2185 (fnic->config.ed_tov)); in fnic_pending_aborts_iter()
2188 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2189 io_req = fnic_priv(sc)->io_req; in fnic_pending_aborts_iter()
2191 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2192 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_REQ_NULL; in fnic_pending_aborts_iter()
2196 io_req->abts_done = NULL; in fnic_pending_aborts_iter()
2199 if (fnic_priv(sc)->abts_status == FCPIO_INVALID_CODE) { in fnic_pending_aborts_iter()
2200 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2201 fnic_priv(sc)->flags |= FNIC_IO_ABT_TERM_DONE; in fnic_pending_aborts_iter()
2202 iter_data->ret = FAILED; in fnic_pending_aborts_iter()
2205 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_COMPLETE; in fnic_pending_aborts_iter()
2208 if (sc != iter_data->lr_sc) { in fnic_pending_aborts_iter()
2209 fnic_priv(sc)->io_req = NULL; in fnic_pending_aborts_iter()
2210 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(abt_tag)] = NULL; in fnic_pending_aborts_iter()
2212 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_pending_aborts_iter()
2215 if (sc != iter_data->lr_sc) { in fnic_pending_aborts_iter()
2217 mempool_free(io_req, fnic->io_req_pool); in fnic_pending_aborts_iter()
2225 sc->result = DID_RESET << 16; in fnic_pending_aborts_iter()
2245 .lun_dev = lr_sc->device, in fnic_clean_pending_aborts()
2251 scsi_host_busy_iter(fnic->lport->host, in fnic_clean_pending_aborts()
2257 schedule_timeout(msecs_to_jiffies(2 * fnic->config.ed_tov)); in fnic_clean_pending_aborts()
2264 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_clean_pending_aborts()
2288 int mqtag = rq->tag; in fnic_device_reset()
2296 /* Get local-port, check ready and link up */ in fnic_device_reset()
2297 lp = shost_priv(sc->device->host); in fnic_device_reset()
2300 fnic_stats = &fnic->fnic_stats; in fnic_device_reset()
2301 reset_stats = &fnic->fnic_stats.reset_stats; in fnic_device_reset()
2303 atomic64_inc(&reset_stats->device_resets); in fnic_device_reset()
2305 rport = starget_to_rport(scsi_target(sc->device)); in fnic_device_reset()
2306 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2308 rport->port_id, sc->device->lun, hwq, mqtag, in fnic_device_reset()
2309 fnic_priv(sc)->flags); in fnic_device_reset()
2311 if (lp->state != LPORT_ST_READY || !(lp->link_up)) in fnic_device_reset()
2316 atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); in fnic_device_reset()
2320 fnic_priv(sc)->flags = FNIC_DEVICE_RESET; in fnic_device_reset()
2330 mutex_lock(&fnic->sgreset_mutex); in fnic_device_reset()
2331 mqtag = fnic->fnic_max_tag_id; in fnic_device_reset()
2338 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2339 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2346 io_req = mempool_alloc(fnic->io_req_pool, GFP_ATOMIC); in fnic_device_reset()
2348 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2352 io_req->port_id = rport->port_id; in fnic_device_reset()
2353 io_req->tag = mqtag; in fnic_device_reset()
2354 fnic_priv(sc)->io_req = io_req; in fnic_device_reset()
2355 io_req->sc = sc; in fnic_device_reset()
2357 if (fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] != NULL) in fnic_device_reset()
2359 fnic->fnic_num, __func__, blk_mq_unique_tag_to_tag(mqtag)); in fnic_device_reset()
2361 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(mqtag)] = in fnic_device_reset()
2364 io_req->dr_done = &tm_done; in fnic_device_reset()
2365 fnic_priv(sc)->state = FNIC_IOREQ_CMD_PENDING; in fnic_device_reset()
2366 fnic_priv(sc)->lr_status = FCPIO_INVALID_CODE; in fnic_device_reset()
2367 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2369 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, "TAG %x\n", mqtag); in fnic_device_reset()
2376 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2377 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2379 io_req->dr_done = NULL; in fnic_device_reset()
2382 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2383 fnic_priv(sc)->flags |= FNIC_DEV_RST_ISSUED; in fnic_device_reset()
2384 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2393 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2394 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2396 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2397 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2401 io_req->dr_done = NULL; in fnic_device_reset()
2403 status = fnic_priv(sc)->lr_status; in fnic_device_reset()
2410 atomic64_inc(&reset_stats->device_reset_timeouts); in fnic_device_reset()
2411 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2413 fnic_priv(sc)->flags |= FNIC_DEV_RST_TIMED_OUT; in fnic_device_reset()
2414 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2415 int_to_scsilun(sc->device->lun, &fc_lun); in fnic_device_reset()
2421 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2422 if (fnic_priv(sc)->flags & FNIC_DEV_RST_TERM_ISSUED) { in fnic_device_reset()
2423 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2426 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2434 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2435 fnic_priv(sc)->flags |= FNIC_DEV_RST_TERM_ISSUED; in fnic_device_reset()
2436 fnic_priv(sc)->state = FNIC_IOREQ_ABTS_PENDING; in fnic_device_reset()
2437 io_req->abts_done = &tm_done; in fnic_device_reset()
2438 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2439 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2446 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2447 if (!(fnic_priv(sc)->flags & FNIC_DEV_RST_DONE)) { in fnic_device_reset()
2448 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2453 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2454 io_req->abts_done = NULL; in fnic_device_reset()
2459 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2464 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2466 fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2467 "Device reset completed - failed\n"); in fnic_device_reset()
2468 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2480 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2481 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2482 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2489 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2490 io_req = fnic_priv(sc)->io_req; in fnic_device_reset()
2497 fnic_priv(sc)->io_req = NULL; in fnic_device_reset()
2498 io_req->sc = NULL; in fnic_device_reset()
2499 fnic->sw_copy_wq[hwq].io_req_table[blk_mq_unique_tag_to_tag(io_req->tag)] = NULL; in fnic_device_reset()
2502 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_device_reset()
2505 start_time = io_req->start_time; in fnic_device_reset()
2507 mempool_free(io_req, fnic->io_req_pool); in fnic_device_reset()
2511 FNIC_TRACE(fnic_device_reset, sc->device->host->host_no, rq->tag, sc, in fnic_device_reset()
2512 jiffies_to_msecs(jiffies - start_time), in fnic_device_reset()
2513 0, ((u64)sc->cmnd[0] << 32 | in fnic_device_reset()
2514 (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 | in fnic_device_reset()
2515 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), in fnic_device_reset()
2519 fnic->sgreset_sc = NULL; in fnic_device_reset()
2520 mutex_unlock(&fnic->sgreset_mutex); in fnic_device_reset()
2523 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_device_reset()
2529 atomic64_inc(&reset_stats->device_reset_failures); in fnic_device_reset()
2544 reset_stats = &fnic->fnic_stats.reset_stats; in fnic_reset()
2546 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_reset()
2549 atomic64_inc(&reset_stats->fnic_resets); in fnic_reset()
2557 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_reset()
2562 atomic64_inc(&reset_stats->fnic_reset_completions); in fnic_reset()
2564 atomic64_inc(&reset_stats->fnic_reset_failures); in fnic_reset()
2582 struct Scsi_Host *shost = sc->device->host; in fnic_host_reset()
2587 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_host_reset()
2588 if (!fnic->internal_reset_inprogress) { in fnic_host_reset()
2589 fnic->internal_reset_inprogress = true; in fnic_host_reset()
2591 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_host_reset()
2592 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_host_reset()
2596 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_host_reset()
2600 * scsi-ml tries to send a TUR to every device if host reset is in fnic_host_reset()
2608 if ((lp->state == LPORT_ST_READY) && in fnic_host_reset()
2609 (lp->link_up)) { in fnic_host_reset()
2617 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_host_reset()
2618 fnic->internal_reset_inprogress = false; in fnic_host_reset()
2619 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_host_reset()
2636 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2637 if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) && in fnic_scsi_abort_io()
2638 fnic->link_events) { in fnic_scsi_abort_io()
2640 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2645 fnic->remove_wait = &remove_wait; in fnic_scsi_abort_io()
2646 old_state = fnic->state; in fnic_scsi_abort_io()
2647 fnic->state = FNIC_IN_FC_TRANS_ETH_MODE; in fnic_scsi_abort_io()
2648 fnic_update_mac_locked(fnic, fnic->ctlr.ctl_src_addr); in fnic_scsi_abort_io()
2649 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2653 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2654 if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) in fnic_scsi_abort_io()
2655 fnic->state = old_state; in fnic_scsi_abort_io()
2656 fnic->remove_wait = NULL; in fnic_scsi_abort_io()
2657 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2665 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2666 fnic->remove_wait = NULL; in fnic_scsi_abort_io()
2667 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num, in fnic_scsi_abort_io()
2669 (fnic->state == FNIC_IN_ETH_MODE) ? in fnic_scsi_abort_io()
2671 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_abort_io()
2686 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_scsi_cleanup()
2687 if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)) { in fnic_scsi_cleanup()
2689 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_cleanup()
2693 old_state = fnic->state; in fnic_scsi_cleanup()
2694 fnic->state = FNIC_IN_FC_TRANS_ETH_MODE; in fnic_scsi_cleanup()
2695 fnic_update_mac_locked(fnic, fnic->ctlr.ctl_src_addr); in fnic_scsi_cleanup()
2696 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_cleanup()
2699 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_scsi_cleanup()
2700 if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) in fnic_scsi_cleanup()
2701 fnic->state = old_state; in fnic_scsi_cleanup()
2702 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_scsi_cleanup()
2715 /* Non-zero sid, nothing to do */ in fnic_exch_mgr_reset()
2728 if (!fnic->in_remove) in fnic_exch_mgr_reset()
2733 /* call libFC exch mgr reset to reset its exchanges */ in fnic_exch_mgr_reset()
2743 struct fnic *fnic = iter_data->fnic; in fnic_abts_pending_iter()
2757 if (iter_data->lr_sc && sc == iter_data->lr_sc) in fnic_abts_pending_iter()
2759 if (iter_data->lun_dev && sc->device != iter_data->lun_dev) in fnic_abts_pending_iter()
2762 spin_lock_irqsave(&fnic->wq_copy_lock[hwq], flags); in fnic_abts_pending_iter()
2764 io_req = fnic_priv(sc)->io_req; in fnic_abts_pending_iter()
2766 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abts_pending_iter()
2774 FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num, in fnic_abts_pending_iter()
2777 fnic_ioreq_state_to_str(fnic_priv(sc)->state)); in fnic_abts_pending_iter()
2778 cmd_state = fnic_priv(sc)->state; in fnic_abts_pending_iter()
2779 spin_unlock_irqrestore(&fnic->wq_copy_lock[hwq], flags); in fnic_abts_pending_iter()
2781 iter_data->ret = 1; in fnic_abts_pending_iter()
2783 return iter_data->ret ? false : true; in fnic_abts_pending_iter()
2802 iter_data.lun_dev = lr_sc->device; in fnic_is_abts_pending()
2807 scsi_host_busy_iter(fnic->lport->host, in fnic_is_abts_pending()