Lines Matching +full:send +full:- +full:flush +full:- +full:out +full:- +full:sequence

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2016-2018 Cavium Inc.
29 rc = -EINVAL; in qedf_initiate_els()
33 qedf = fcport->qedf; in qedf_initiate_els()
34 lport = qedf->lport; in qedf_initiate_els()
36 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending ELS\n"); in qedf_initiate_els()
38 rc = fc_remote_port_chkready(fcport->rport); in qedf_initiate_els()
40 QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: rport not ready\n", op); in qedf_initiate_els()
41 rc = -EAGAIN; in qedf_initiate_els()
44 if (lport->state != LPORT_ST_READY || !(lport->link_up)) { in qedf_initiate_els()
45 QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: link is not ready\n", in qedf_initiate_els()
47 rc = -EAGAIN; in qedf_initiate_els()
51 if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { in qedf_initiate_els()
52 QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: fcport not ready\n", op); in qedf_initiate_els()
53 rc = -EINVAL; in qedf_initiate_els()
59 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, in qedf_initiate_els()
61 rc = -ENOMEM; in qedf_initiate_els()
65 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = " in qedf_initiate_els()
67 els_req->xid); in qedf_initiate_els()
68 els_req->sc_cmd = NULL; in qedf_initiate_els()
69 els_req->cmd_type = QEDF_ELS; in qedf_initiate_els()
70 els_req->fcport = fcport; in qedf_initiate_els()
71 els_req->cb_func = cb_func; in qedf_initiate_els()
72 cb_arg->io_req = els_req; in qedf_initiate_els()
73 cb_arg->op = op; in qedf_initiate_els()
74 els_req->cb_arg = cb_arg; in qedf_initiate_els()
75 els_req->data_xfer_len = data_len; in qedf_initiate_els()
78 els_req->cpu = smp_processor_id(); in qedf_initiate_els()
80 mp_req = (struct qedf_mp_req *)&(els_req->mp_req); in qedf_initiate_els()
83 QEDF_ERR(&(qedf->dbg_ctx), "ELS MP request init failed\n"); in qedf_initiate_els()
84 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_initiate_els()
92 memcpy(mp_req->req_buf, data, data_len); in qedf_initiate_els()
94 QEDF_ERR(&(qedf->dbg_ctx), "Invalid ELS op 0x%x\n", op); in qedf_initiate_els()
95 els_req->cb_func = NULL; in qedf_initiate_els()
96 els_req->cb_arg = NULL; in qedf_initiate_els()
97 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_initiate_els()
98 rc = -EINVAL; in qedf_initiate_els()
105 fc_hdr = &(mp_req->req_fc_hdr); in qedf_initiate_els()
107 did = fcport->rdata->ids.port_id; in qedf_initiate_els()
108 sid = fcport->sid; in qedf_initiate_els()
115 xid = els_req->xid; in qedf_initiate_els()
117 spin_lock_irqsave(&fcport->rport_lock, flags); in qedf_initiate_els()
120 sqe = &fcport->sq[sqe_idx]; in qedf_initiate_els()
124 task = qedf_get_task_mem(&qedf->tasks, xid); in qedf_initiate_els()
132 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Ringing doorbell for ELS " in qedf_initiate_els()
135 set_bit(QEDF_CMD_OUTSTANDING, &els_req->flags); in qedf_initiate_els()
137 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_initiate_els()
148 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered with xid = 0x%x" in qedf_process_els_compl()
149 " cmd_type = %d.\n", els_req->xid, els_req->cmd_type); in qedf_process_els_compl()
151 if ((els_req->event == QEDF_IOREQ_EV_ELS_FLUSH) in qedf_process_els_compl()
152 || (els_req->event == QEDF_IOREQ_EV_CLEANUP_SUCCESS) in qedf_process_els_compl()
153 || (els_req->event == QEDF_IOREQ_EV_CLEANUP_FAILED)) { in qedf_process_els_compl()
154 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, in qedf_process_els_compl()
155 "ELS completion xid=0x%x after flush event=0x%x", in qedf_process_els_compl()
156 els_req->xid, els_req->event); in qedf_process_els_compl()
160 fcport = els_req->fcport; in qedf_process_els_compl()
162 /* When flush is active, in qedf_process_els_compl()
165 if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags) || in qedf_process_els_compl()
166 test_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags)) { in qedf_process_els_compl()
167 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, in qedf_process_els_compl()
169 els_req->xid); in qedf_process_els_compl()
173 clear_bit(QEDF_CMD_OUTSTANDING, &els_req->flags); in qedf_process_els_compl()
176 cancel_delayed_work(&els_req->timeout_work); in qedf_process_els_compl()
179 mp_info = &cqe->cqe_info.midpath_info; in qedf_process_els_compl()
180 els_req->mp_req.resp_len = mp_info->data_placement_size; in qedf_process_els_compl()
183 if ((els_req->cb_func) && (els_req->cb_arg)) { in qedf_process_els_compl()
184 els_req->cb_func(els_req->cb_arg); in qedf_process_els_compl()
185 els_req->cb_arg = NULL; in qedf_process_els_compl()
188 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_process_els_compl()
198 rrq_req = cb_arg->io_req; in qedf_rrq_compl()
199 qedf = rrq_req->fcport->qedf; in qedf_rrq_compl()
201 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered.\n"); in qedf_rrq_compl()
203 orig_io_req = cb_arg->aborted_io_req; in qedf_rrq_compl()
206 QEDF_ERR(&qedf->dbg_ctx, in qedf_rrq_compl()
211 refcount = kref_read(&orig_io_req->refcount); in qedf_rrq_compl()
212 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "rrq_compl: orig io = %p," in qedf_rrq_compl()
214 orig_io_req, orig_io_req->xid, rrq_req->xid, refcount); in qedf_rrq_compl()
222 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_rrq_compl()
226 * Release a reference to the rrq request if we timed out as the in qedf_rrq_compl()
231 if (rrq_req->event == QEDF_IOREQ_EV_ELS_TMO) in qedf_rrq_compl()
232 kref_put(&rrq_req->refcount, qedf_release_cmd); in qedf_rrq_compl()
252 return -EINVAL; in qedf_send_rrq()
255 fcport = aborted_io_req->fcport; in qedf_send_rrq()
258 refcount = kref_read(&aborted_io_req->refcount); in qedf_send_rrq()
260 "RRQ work was queued prior to a flush xid=0x%x, refcount=%d.\n", in qedf_send_rrq()
261 aborted_io_req->xid, refcount); in qedf_send_rrq()
262 kref_put(&aborted_io_req->refcount, qedf_release_cmd); in qedf_send_rrq()
263 return -EINVAL; in qedf_send_rrq()
267 if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { in qedf_send_rrq()
269 return -EINVAL; in qedf_send_rrq()
272 if (!fcport->qedf) { in qedf_send_rrq()
273 QEDF_ERR(NULL, "fcport->qedf is NULL.\n"); in qedf_send_rrq()
274 return -EINVAL; in qedf_send_rrq()
277 qedf = fcport->qedf; in qedf_send_rrq()
280 * Sanity check that we can send a RRQ to make sure that refcount isn't in qedf_send_rrq()
283 refcount = kref_read(&aborted_io_req->refcount); in qedf_send_rrq()
285 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, in qedf_send_rrq()
287 aborted_io_req->xid, aborted_io_req, refcount); in qedf_send_rrq()
288 return -EINVAL; in qedf_send_rrq()
291 lport = qedf->lport; in qedf_send_rrq()
292 sid = fcport->sid; in qedf_send_rrq()
293 r_a_tov = lport->r_a_tov; in qedf_send_rrq()
295 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending RRQ orig " in qedf_send_rrq()
297 aborted_io_req->xid); in qedf_send_rrq()
302 QEDF_ERR(&(qedf->dbg_ctx), "Unable to allocate cb_arg for " in qedf_send_rrq()
304 rc = -ENOMEM; in qedf_send_rrq()
308 cb_arg->aborted_io_req = aborted_io_req; in qedf_send_rrq()
312 rrq.rrq_ox_id = htons(aborted_io_req->xid); in qedf_send_rrq()
314 htons(aborted_io_req->task->tstorm_st_context.read_write.rx_id); in qedf_send_rrq()
321 QEDF_ERR(&(qedf->dbg_ctx), "RRQ failed - release orig io " in qedf_send_rrq()
322 "req 0x%x\n", aborted_io_req->xid); in qedf_send_rrq()
324 kref_put(&aborted_io_req->refcount, qedf_release_cmd); in qedf_send_rrq()
333 struct fc_lport *lport = fcport->qedf->lport; in qedf_process_l2_frame_compl()
341 fh->fh_ox_id = htons(l2_oxid); in qedf_process_l2_frame_compl()
344 fh->fh_r_ctl = FC_RCTL_ELS_REP; in qedf_process_l2_frame_compl()
345 fh->fh_type = FC_TYPE_ELS; in qedf_process_l2_frame_compl()
346 /* Last sequence, end sequence */ in qedf_process_l2_frame_compl()
347 fh->fh_f_ctl[0] = 0x98; in qedf_process_l2_frame_compl()
348 hton24(fh->fh_d_id, lport->port_id); in qedf_process_l2_frame_compl()
349 hton24(fh->fh_s_id, fcport->rdata->ids.port_id); in qedf_process_l2_frame_compl()
350 fh->fh_rx_id = 0xffff; in qedf_process_l2_frame_compl()
360 /* Send completed request to libfc */ in qedf_process_l2_frame_compl()
365 * In instances where an ELS command times out we may need to restart the
366 * rport by logging out and then logging back in.
380 spin_lock_irqsave(&fcport->rport_lock, flags); in qedf_restart_rport()
381 if (test_bit(QEDF_RPORT_IN_RESET, &fcport->flags) || in qedf_restart_rport()
382 !test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) || in qedf_restart_rport()
383 test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) { in qedf_restart_rport()
384 QEDF_ERR(&(fcport->qedf->dbg_ctx), "fcport %p already in reset or not offloaded.\n", in qedf_restart_rport()
386 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_restart_rport()
391 set_bit(QEDF_RPORT_IN_RESET, &fcport->flags); in qedf_restart_rport()
392 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_restart_rport()
394 rdata = fcport->rdata; in qedf_restart_rport()
395 if (rdata && !kref_get_unless_zero(&rdata->kref)) { in qedf_restart_rport()
396 fcport->rdata = NULL; in qedf_restart_rport()
400 if (rdata && rdata->rp_state == RPORT_ST_READY) { in qedf_restart_rport()
401 lport = fcport->qedf->lport; in qedf_restart_rport()
402 port_id = rdata->ids.port_id; in qedf_restart_rport()
403 QEDF_ERR(&(fcport->qedf->dbg_ctx), in qedf_restart_rport()
406 kref_put(&rdata->kref, fc_rport_destroy); in qedf_restart_rport()
407 mutex_lock(&lport->disc.disc_mutex); in qedf_restart_rport()
410 mutex_unlock(&lport->disc.disc_mutex); in qedf_restart_rport()
413 fcport->rdata = rdata; in qedf_restart_rport()
415 clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags); in qedf_restart_rport()
429 l2_oxid = cb_arg->l2_oxid; in qedf_l2_els_compl()
430 els_req = cb_arg->io_req; in qedf_l2_els_compl()
441 if (els_req->event == QEDF_IOREQ_EV_ELS_FLUSH) { in qedf_l2_els_compl()
442 QEDF_ERR(NULL, "els_req xid=0x%x event is flush.\n", in qedf_l2_els_compl()
443 els_req->xid); in qedf_l2_els_compl()
447 fcport = els_req->fcport; in qedf_l2_els_compl()
448 mp_req = &(els_req->mp_req); in qedf_l2_els_compl()
449 mp_fc_hdr = &(mp_req->resp_fc_hdr); in qedf_l2_els_compl()
450 resp_len = mp_req->resp_len; in qedf_l2_els_compl()
451 resp_buf = mp_req->resp_buf; in qedf_l2_els_compl()
454 * If a middle path ELS command times out, don't try to return in qedf_l2_els_compl()
458 if (els_req->event == QEDF_IOREQ_EV_ELS_TMO) { in qedf_l2_els_compl()
460 * If ADISC times out, libfc will timeout the exchange and then in qedf_l2_els_compl()
461 * try to send a PLOGI which will timeout since the session is in qedf_l2_els_compl()
466 if (cb_arg->op == ELS_ADISC) in qedf_l2_els_compl()
472 QEDF_ERR(&(fcport->qedf->dbg_ctx), "resp_len is " in qedf_l2_els_compl()
477 fp = fc_frame_alloc(fcport->qedf->lport, resp_len); in qedf_l2_els_compl()
479 QEDF_ERR(&(fcport->qedf->dbg_ctx), in qedf_l2_els_compl()
492 QEDF_INFO(&(fcport->qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_l2_els_compl()
504 struct fc_lport *lport = fcport->qedf->lport; in qedf_send_adisc()
507 uint32_t r_a_tov = lport->r_a_tov; in qedf_send_adisc()
510 qedf = fcport->qedf; in qedf_send_adisc()
515 QEDF_ERR(&(qedf->dbg_ctx), "Unable to allocate cb_arg for " in qedf_send_adisc()
517 rc = -ENOMEM; in qedf_send_adisc()
520 cb_arg->l2_oxid = ntohs(fh->fh_ox_id); in qedf_send_adisc()
522 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_send_adisc()
523 "Sending ADISC ox_id=0x%x.\n", cb_arg->l2_oxid); in qedf_send_adisc()
532 QEDF_ERR(&(qedf->dbg_ctx), "ADISC failed.\n"); in qedf_send_adisc()
552 srr_req = cb_arg->io_req; in qedf_srr_compl()
553 qedf = srr_req->fcport->qedf; in qedf_srr_compl()
554 lport = qedf->lport; in qedf_srr_compl()
556 orig_io_req = cb_arg->aborted_io_req; in qedf_srr_compl()
563 clear_bit(QEDF_CMD_SRR_SENT, &orig_io_req->flags); in qedf_srr_compl()
565 if (srr_req->event != QEDF_IOREQ_EV_ELS_TMO && in qedf_srr_compl()
566 srr_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT) in qedf_srr_compl()
567 cancel_delayed_work_sync(&orig_io_req->timeout_work); in qedf_srr_compl()
569 refcount = kref_read(&orig_io_req->refcount); in qedf_srr_compl()
570 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p," in qedf_srr_compl()
572 orig_io_req, orig_io_req->xid, srr_req->xid, refcount); in qedf_srr_compl()
574 /* If a SRR times out, simply free resources */ in qedf_srr_compl()
575 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO) { in qedf_srr_compl()
576 QEDF_ERR(&qedf->dbg_ctx, in qedf_srr_compl()
577 "ELS timeout rec_xid=0x%x.\n", srr_req->xid); in qedf_srr_compl()
582 mp_req = &(srr_req->mp_req); in qedf_srr_compl()
583 mp_fc_hdr = &(mp_req->resp_fc_hdr); in qedf_srr_compl()
584 resp_len = mp_req->resp_len; in qedf_srr_compl()
585 resp_buf = mp_req->resp_buf; in qedf_srr_compl()
589 QEDF_ERR(&(qedf->dbg_ctx), in qedf_srr_compl()
605 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_srr_compl()
609 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, in qedf_srr_compl()
618 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_srr_compl()
635 return -EINVAL; in qedf_send_srr()
638 fcport = orig_io_req->fcport; in qedf_send_srr()
641 if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { in qedf_send_srr()
643 return -EINVAL; in qedf_send_srr()
646 if (!fcport->qedf) { in qedf_send_srr()
647 QEDF_ERR(NULL, "fcport->qedf is NULL.\n"); in qedf_send_srr()
648 return -EINVAL; in qedf_send_srr()
652 kref_get(&orig_io_req->refcount); in qedf_send_srr()
654 qedf = fcport->qedf; in qedf_send_srr()
655 lport = qedf->lport; in qedf_send_srr()
656 r_a_tov = lport->r_a_tov; in qedf_send_srr()
658 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending SRR orig_io=%p, " in qedf_send_srr()
659 "orig_xid=0x%x\n", orig_io_req, orig_io_req->xid); in qedf_send_srr()
664 QEDF_ERR(&(qedf->dbg_ctx), "Unable to allocate cb_arg for " in qedf_send_srr()
666 rc = -ENOMEM; in qedf_send_srr()
670 cb_arg->aborted_io_req = orig_io_req; in qedf_send_srr()
673 srr.srr_ox_id = htons(orig_io_req->xid); in qedf_send_srr()
674 srr.srr_rx_id = htons(orig_io_req->rx_id); in qedf_send_srr()
683 QEDF_ERR(&(qedf->dbg_ctx), "SRR failed - release orig_io_req" in qedf_send_srr()
684 "=0x%x\n", orig_io_req->xid); in qedf_send_srr()
686 /* If we fail to queue SRR, send ABTS to orig_io */ in qedf_send_srr()
688 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_send_srr()
691 set_bit(QEDF_CMD_SRR_SENT, &orig_io_req->flags); in qedf_send_srr()
705 fcport = orig_io_req->fcport; in qedf_initiate_seq_cleanup()
707 QEDF_INFO(&(fcport->qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_initiate_seq_cleanup()
708 "Doing sequence cleanup for xid=0x%x offset=%u.\n", in qedf_initiate_seq_cleanup()
709 orig_io_req->xid, offset); in qedf_initiate_seq_cleanup()
713 QEDF_ERR(&(fcport->qedf->dbg_ctx), "Unable to allocate cb_arg " in qedf_initiate_seq_cleanup()
714 "for sequence cleanup\n"); in qedf_initiate_seq_cleanup()
719 kref_get(&orig_io_req->refcount); in qedf_initiate_seq_cleanup()
721 orig_io_req->cmd_type = QEDF_SEQ_CLEANUP; in qedf_initiate_seq_cleanup()
722 cb_arg->offset = offset; in qedf_initiate_seq_cleanup()
723 cb_arg->r_ctl = r_ctl; in qedf_initiate_seq_cleanup()
724 orig_io_req->cb_arg = cb_arg; in qedf_initiate_seq_cleanup()
726 qedf_cmd_timer_set(fcport->qedf, orig_io_req, in qedf_initiate_seq_cleanup()
729 spin_lock_irqsave(&fcport->rport_lock, flags); in qedf_initiate_seq_cleanup()
732 sqe = &fcport->sq[sqe_idx]; in qedf_initiate_seq_cleanup()
734 orig_io_req->task_params->sqe = sqe; in qedf_initiate_seq_cleanup()
736 init_initiator_sequence_recovery_fcoe_task(orig_io_req->task_params, in qedf_initiate_seq_cleanup()
740 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_initiate_seq_cleanup()
749 cb_arg = io_req->cb_arg; in qedf_process_seq_cleanup_compl()
751 /* If we timed out just free resources */ in qedf_process_seq_cleanup_compl()
752 if (io_req->event == QEDF_IOREQ_EV_ELS_TMO || !cqe) { in qedf_process_seq_cleanup_compl()
753 QEDF_ERR(&qedf->dbg_ctx, in qedf_process_seq_cleanup_compl()
754 "cqe is NULL or timeout event (0x%x)", io_req->event); in qedf_process_seq_cleanup_compl()
759 cancel_delayed_work_sync(&io_req->timeout_work); in qedf_process_seq_cleanup_compl()
761 rc = qedf_send_srr(io_req, cb_arg->offset, cb_arg->r_ctl); in qedf_process_seq_cleanup_compl()
763 QEDF_ERR(&(qedf->dbg_ctx), "Unable to send SRR, I/O will " in qedf_process_seq_cleanup_compl()
764 "abort, xid=0x%x.\n", io_req->xid); in qedf_process_seq_cleanup_compl()
767 kref_put(&io_req->refcount, qedf_release_cmd); in qedf_process_seq_cleanup_compl()
777 fcport = orig_io_req->fcport; in qedf_requeue_io_req()
780 goto out; in qedf_requeue_io_req()
783 if (!orig_io_req->sc_cmd) { in qedf_requeue_io_req()
784 QEDF_ERR(&(fcport->qedf->dbg_ctx), "sc_cmd is NULL for " in qedf_requeue_io_req()
785 "xid=0x%x.\n", orig_io_req->xid); in qedf_requeue_io_req()
786 goto out; in qedf_requeue_io_req()
791 QEDF_ERR(&(fcport->qedf->dbg_ctx), "Could not allocate new " in qedf_requeue_io_req()
793 goto out; in qedf_requeue_io_req()
796 new_io_req->sc_cmd = orig_io_req->sc_cmd; in qedf_requeue_io_req()
804 orig_io_req->sc_cmd = NULL; in qedf_requeue_io_req()
805 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_requeue_io_req()
807 spin_lock_irqsave(&fcport->rport_lock, flags); in qedf_requeue_io_req()
811 QEDF_ERR(&(fcport->qedf->dbg_ctx), "Unable to post io_req\n"); in qedf_requeue_io_req()
813 atomic_inc(&fcport->free_sqes); in qedf_requeue_io_req()
815 QEDF_INFO(&(fcport->qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_requeue_io_req()
817 "new_xid=0x%x.\n", orig_io_req->xid, new_io_req->xid); in qedf_requeue_io_req()
822 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_requeue_io_req()
824 goto out; in qedf_requeue_io_req()
827 spin_unlock_irqrestore(&fcport->rport_lock, flags); in qedf_requeue_io_req()
828 out: in qedf_requeue_io_req()
853 rec_req = cb_arg->io_req; in qedf_rec_compl()
854 qedf = rec_req->fcport->qedf; in qedf_rec_compl()
855 lport = qedf->lport; in qedf_rec_compl()
857 orig_io_req = cb_arg->aborted_io_req; in qedf_rec_compl()
864 if (rec_req->event != QEDF_IOREQ_EV_ELS_TMO && in qedf_rec_compl()
865 rec_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT) in qedf_rec_compl()
866 cancel_delayed_work_sync(&orig_io_req->timeout_work); in qedf_rec_compl()
868 refcount = kref_read(&orig_io_req->refcount); in qedf_rec_compl()
869 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p," in qedf_rec_compl()
871 orig_io_req, orig_io_req->xid, rec_req->xid, refcount); in qedf_rec_compl()
873 /* If a REC times out, free resources */ in qedf_rec_compl()
874 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO) { in qedf_rec_compl()
875 QEDF_ERR(&qedf->dbg_ctx, in qedf_rec_compl()
877 orig_io_req, orig_io_req->xid); in qedf_rec_compl()
882 mp_req = &(rec_req->mp_req); in qedf_rec_compl()
883 mp_fc_hdr = &(mp_req->resp_fc_hdr); in qedf_rec_compl()
884 resp_len = mp_req->resp_len; in qedf_rec_compl()
885 acc = resp_buf = mp_req->resp_buf; in qedf_rec_compl()
889 QEDF_ERR(&(qedf->dbg_ctx), in qedf_rec_compl()
906 QEDF_ERR(&qedf->dbg_ctx, "payload get failed"); in qedf_rec_compl()
910 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
912 "er_explan=0x%x.\n", rjt->er_reason, rjt->er_explan); in qedf_rec_compl()
919 if ((rjt->er_reason == ELS_RJT_LOGIC || in qedf_rec_compl()
920 rjt->er_reason == ELS_RJT_UNAB) && in qedf_rec_compl()
921 rjt->er_explan == ELS_EXPL_OXID_RXID) { in qedf_rec_compl()
922 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
927 offset = ntohl(acc->reca_fc4value); in qedf_rec_compl()
928 e_stat = ntohl(acc->reca_e_stat); in qedf_rec_compl()
929 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
933 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
937 sc_cmd = orig_io_req->sc_cmd; in qedf_rec_compl()
939 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
941 orig_io_req->xid); in qedf_rec_compl()
945 if (sc_cmd->sc_data_direction == DMA_TO_DEVICE) { in qedf_rec_compl()
946 if (offset == orig_io_req->data_xfer_len) { in qedf_rec_compl()
947 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
948 "WRITE - response lost.\n"); in qedf_rec_compl()
953 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
954 "WRITE - XFER_RDY/DATA lost.\n"); in qedf_rec_compl()
957 offset = orig_io_req->tx_buf_off; in qedf_rec_compl()
961 if (orig_io_req->rx_buf_off == in qedf_rec_compl()
962 orig_io_req->data_xfer_len) { in qedf_rec_compl()
963 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
964 "READ - response lost.\n"); in qedf_rec_compl()
969 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, in qedf_rec_compl()
970 "READ - DATA lost.\n"); in qedf_rec_compl()
973 * for sequence recovery task. in qedf_rec_compl()
990 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_rec_compl()
1010 return -EINVAL; in qedf_send_rec()
1013 fcport = orig_io_req->fcport; in qedf_send_rec()
1016 if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { in qedf_send_rec()
1018 return -EINVAL; in qedf_send_rec()
1021 if (!fcport->qedf) { in qedf_send_rec()
1022 QEDF_ERR(NULL, "fcport->qedf is NULL.\n"); in qedf_send_rec()
1023 return -EINVAL; in qedf_send_rec()
1027 kref_get(&orig_io_req->refcount); in qedf_send_rec()
1029 qedf = fcport->qedf; in qedf_send_rec()
1030 lport = qedf->lport; in qedf_send_rec()
1031 sid = fcport->sid; in qedf_send_rec()
1032 r_a_tov = lport->r_a_tov; in qedf_send_rec()
1038 QEDF_ERR(&(qedf->dbg_ctx), "Unable to allocate cb_arg for " in qedf_send_rec()
1040 rc = -ENOMEM; in qedf_send_rec()
1044 cb_arg->aborted_io_req = orig_io_req; in qedf_send_rec()
1048 rec.rec_ox_id = htons(orig_io_req->xid); in qedf_send_rec()
1050 htons(orig_io_req->task->tstorm_st_context.read_write.rx_id); in qedf_send_rec()
1052 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending REC orig_io=%p, " in qedf_send_rec()
1054 orig_io_req->xid, rec.rec_rx_id); in qedf_send_rec()
1060 QEDF_ERR(&(qedf->dbg_ctx), "REC failed - release orig_io_req" in qedf_send_rec()
1061 "=0x%x\n", orig_io_req->xid); in qedf_send_rec()
1063 kref_put(&orig_io_req->refcount, qedf_release_cmd); in qedf_send_rec()