Lines Matching +full:tmr +full:- +full:add
1 // SPDX-License-Identifier: GPL-2.0-only
39 se_cmd = &cmd->se_cmd; in _ft_dump_cmd()
41 caller, cmd, cmd->sess, cmd->seq, se_cmd); in _ft_dump_cmd()
44 caller, cmd, se_cmd->t_data_nents, in _ft_dump_cmd()
45 se_cmd->data_length, se_cmd->se_cmd_flags); in _ft_dump_cmd()
47 for_each_sg(se_cmd->t_data_sg, sg, se_cmd->t_data_nents, count) in _ft_dump_cmd()
51 sg_page(sg), sg->length, sg->offset); in _ft_dump_cmd()
53 sp = cmd->seq; in _ft_dump_cmd()
58 caller, cmd, ep->sid, ep->did, ep->oxid, ep->rxid, in _ft_dump_cmd()
59 sp->id, ep->esb_stat); in _ft_dump_cmd()
76 sess = cmd->sess; in ft_free_cmd()
77 fp = cmd->req_frame; in ft_free_cmd()
81 target_free_tag(sess->se_sess, &cmd->se_cmd); in ft_free_cmd()
110 if (cmd->aborted) in ft_queue_status()
113 ep = fc_seq_exch(cmd->seq); in ft_queue_status()
114 lport = ep->lp; in ft_queue_status()
115 len = sizeof(*fcp) + se_cmd->scsi_sense_length; in ft_queue_status()
118 se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL; in ft_queue_status()
119 return -ENOMEM; in ft_queue_status()
124 fcp->resp.fr_status = se_cmd->scsi_status; in ft_queue_status()
126 len = se_cmd->scsi_sense_length; in ft_queue_status()
128 fcp->resp.fr_flags |= FCP_SNS_LEN_VAL; in ft_queue_status()
129 fcp->ext.fr_sns_len = htonl(len); in ft_queue_status()
130 memcpy((fcp + 1), se_cmd->sense_buffer, len); in ft_queue_status()
137 if (se_cmd->se_cmd_flags & (SCF_OVERFLOW_BIT | SCF_UNDERFLOW_BIT)) { in ft_queue_status()
138 if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) in ft_queue_status()
139 fcp->resp.fr_flags |= FCP_RESID_OVER; in ft_queue_status()
141 fcp->resp.fr_flags |= FCP_RESID_UNDER; in ft_queue_status()
142 fcp->ext.fr_resid = cpu_to_be32(se_cmd->residual_count); in ft_queue_status()
148 cmd->seq = fc_seq_start_next(cmd->seq); in ft_queue_status()
149 fc_fill_fc_hdr(fp, FC_RCTL_DD_CMD_STATUS, ep->did, ep->sid, FC_TYPE_FCP, in ft_queue_status()
152 rc = fc_seq_send(lport, cmd->seq, fp); in ft_queue_status()
155 "xid <0x%x>\n", __func__, fp, ep->xid); in ft_queue_status()
159 * been re-queued by target-core. in ft_queue_status()
161 se_cmd->scsi_status = SAM_STAT_TASK_SET_FULL; in ft_queue_status()
162 return -ENOMEM; in ft_queue_status()
164 fc_exch_done(cmd->seq); in ft_queue_status()
167 * ahead of ft_check_stop_free() -> transport_generic_free_cmd() in ft_queue_status()
168 * final se_cmd->cmd_kref put. in ft_queue_status()
170 target_put_sess_cmd(&cmd->se_cmd); in ft_queue_status()
189 if (cmd->aborted) in ft_write_pending()
191 ep = fc_seq_exch(cmd->seq); in ft_write_pending()
192 lport = ep->lp; in ft_write_pending()
195 return -ENOMEM; /* Signal QUEUE_FULL */ in ft_write_pending()
199 txrdy->ft_burst_len = htonl(se_cmd->data_length); in ft_write_pending()
201 cmd->seq = fc_seq_start_next(cmd->seq); in ft_write_pending()
202 fc_fill_fc_hdr(fp, FC_RCTL_DD_DATA_DESC, ep->did, ep->sid, FC_TYPE_FCP, in ft_write_pending()
206 f_ctl = ntoh24(fh->fh_f_ctl); in ft_write_pending()
213 if ((ep->xid <= lport->lro_xid) && in ft_write_pending()
214 (fh->fh_r_ctl == FC_RCTL_DD_DATA_DESC)) { in ft_write_pending()
215 if ((se_cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) && in ft_write_pending()
216 lport->tt.ddp_target(lport, ep->xid, in ft_write_pending()
217 se_cmd->t_data_sg, in ft_write_pending()
218 se_cmd->t_data_nents)) in ft_write_pending()
219 cmd->was_ddp_setup = 1; in ft_write_pending()
222 fc_seq_send(lport, cmd->seq, fp); in ft_write_pending()
227 * FC sequence response handler for follow-on sequences (data) and aborts.
236 cmd->seq = NULL; in ft_recv_seq()
237 cmd->aborted = true; in ft_recv_seq()
243 switch (fh->fh_r_ctl) { in ft_recv_seq()
252 __func__, fh->fh_r_ctl); in ft_recv_seq()
255 transport_generic_free_cmd(&cmd->se_cmd, 0); in ft_recv_seq()
278 ntoh24(fh->fh_s_id), ntohs(fh->fh_ox_id), status, code); in ft_send_resp_status()
287 fcp->resp.fr_status = status; in ft_send_resp_status()
289 fcp->ext.fr_rsp_len = htonl(sizeof(*info)); in ft_send_resp_status()
290 fcp->resp.fr_flags |= FCP_RSP_LEN_VAL; in ft_send_resp_status()
292 info->rsp_code = code; in ft_send_resp_status()
301 lport->tt.frame_send(lport, fp); in ft_send_resp_status()
311 ft_send_resp_status(cmd->sess->tport->lport, in ft_send_resp_code()
312 cmd->req_frame, SAM_STAT_GOOD, code); in ft_send_resp_code()
336 fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); in ft_send_tm()
338 switch (fcp->fc_tm_flags) { in ft_send_tm()
359 pr_debug("invalid FCP tm_flags %x\n", fcp->fc_tm_flags); in ft_send_tm()
364 /* FIXME: Add referenced task tag for ABORT_TASK */ in ft_send_tm()
365 rc = target_submit_tmr(&cmd->se_cmd, cmd->sess->se_sess, in ft_send_tm()
366 &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), in ft_send_tm()
378 struct se_tmr_req *tmr = se_cmd->se_tmr_req; in ft_queue_tm_resp() local
381 if (cmd->aborted) in ft_queue_tm_resp()
383 switch (tmr->response) { in ft_queue_tm_resp()
399 pr_debug("tmr fn %d resp %d fcp code %d\n", in ft_queue_tm_resp()
400 tmr->function, tmr->response, code); in ft_queue_tm_resp()
404 * ahead of ft_check_stop_free() -> transport_generic_free_cmd() in ft_queue_tm_resp()
405 * final se_cmd->cmd_kref put. in ft_queue_tm_resp()
407 target_put_sess_cmd(&cmd->se_cmd); in ft_queue_tm_resp()
423 struct fc_lport *lport = sess->tport->lport; in ft_recv_cmd()
424 struct se_session *se_sess = sess->se_sess; in ft_recv_cmd()
427 tag = sbitmap_queue_get(&se_sess->sess_tag_pool, &cpu); in ft_recv_cmd()
431 cmd = &((struct ft_cmd *)se_sess->sess_cmd_map)[tag]; in ft_recv_cmd()
434 cmd->se_cmd.map_tag = tag; in ft_recv_cmd()
435 cmd->se_cmd.map_cpu = cpu; in ft_recv_cmd()
436 cmd->sess = sess; in ft_recv_cmd()
437 cmd->seq = fc_seq_assign(lport, fp); in ft_recv_cmd()
438 if (!cmd->seq) { in ft_recv_cmd()
439 target_free_tag(se_sess, &cmd->se_cmd); in ft_recv_cmd()
442 cmd->req_frame = fp; /* hold frame during cmd */ in ft_recv_cmd()
444 INIT_WORK(&cmd->work, ft_send_work); in ft_recv_cmd()
445 queue_work(sess->tport->tpg->workqueue, &cmd->work); in ft_recv_cmd()
449 pr_debug("cmd or seq allocation failure - sending BUSY\n"); in ft_recv_cmd()
464 switch (fh->fh_r_ctl) { in ft_recv_req()
475 __func__, fh->fh_r_ctl); in ft_recv_req()
488 struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); in ft_send_work()
493 fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); in ft_send_work()
497 if (fcp->fc_flags & FCP_CFL_LEN_MASK) in ft_send_work()
503 if (fcp->fc_tm_flags) { in ft_send_work()
508 switch (fcp->fc_flags & (FCP_CFL_RDDATA | FCP_CFL_WRDATA)) { in ft_send_work()
524 switch (fcp->fc_pri_ta & FCP_PTA_MASK) { in ft_send_work()
539 fc_seq_set_resp(cmd->seq, ft_recv_seq, cmd); in ft_send_work()
540 cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; in ft_send_work()
543 * Use a single se_cmd->cmd_kref as we expect to release se_cmd in ft_send_work()
546 if (target_init_cmd(&cmd->se_cmd, cmd->sess->se_sess, in ft_send_work()
547 &cmd->ft_sense_buffer[0], in ft_send_work()
548 scsilun_to_int(&fcp->fc_lun), ntohl(fcp->fc_dl), in ft_send_work()
552 if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, in ft_send_work()
556 target_submit(&cmd->se_cmd); in ft_send_work()
557 pr_debug("r_ctl %x target_submit_cmd %p\n", fh->fh_r_ctl, cmd); in ft_send_work()