Lines Matching refs:sc_cmd
375 /* Clear any stale sc_cmd back pointer */
376 io_req->sc_cmd = NULL;
449 WARN_ON(io_req->sc_cmd);
478 struct scsi_cmnd *sc = io_req->sc_cmd;
535 struct scsi_cmnd *sc = io_req->sc_cmd;
556 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
562 int_to_scsilun(sc_cmd->device->lun,
575 if (sc_cmd->sc_data_direction == DMA_TO_DEVICE)
577 else if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE)
585 memcpy(fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len);
596 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
618 if (sc_cmd->sc_data_direction == DMA_TO_DEVICE) {
648 scsi_bufflen(io_req->sc_cmd);
810 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
820 io_log->lun = sc_cmd->device->lun;
821 io_log->op = op = sc_cmd->cmnd[0];
822 io_log->lba[0] = sc_cmd->cmnd[2];
823 io_log->lba[1] = sc_cmd->cmnd[3];
824 io_log->lba[2] = sc_cmd->cmnd[4];
825 io_log->lba[3] = sc_cmd->cmnd[5];
826 io_log->bufflen = scsi_bufflen(sc_cmd);
827 io_log->sg_count = scsi_sg_count(sc_cmd);
828 io_log->result = sc_cmd->result;
854 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
855 struct Scsi_Host *host = sc_cmd->device->host;
864 io_req->data_xfer_len = scsi_bufflen(sc_cmd);
865 sc_cmd->SCp.ptr = (char *)io_req;
871 if (sc_cmd->sc_data_direction == DMA_FROM_DEVICE) {
874 } else if (sc_cmd->sc_data_direction == DMA_TO_DEVICE) {
887 /* Release cmd will release io_req, but sc_cmd is assigned */
888 io_req->sc_cmd = NULL;
896 /* Release cmd will release io_req, but sc_cmd is assigned */
897 io_req->sc_cmd = NULL;
903 io_req->lun = (int)sc_cmd->device->lun;
915 /* Release cmd will release io_req, but sc_cmd is assigned */
916 io_req->sc_cmd = NULL;
929 if (qedf_io_tracing && io_req->sc_cmd)
936 qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
940 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
949 num_sgs = scsi_sg_count(sc_cmd);
950 if (scsi_sg_count(sc_cmd) > QEDF_MAX_BDS_PER_CMD) {
954 sc_cmd->result = DID_ERROR;
955 sc_cmd->scsi_done(sc_cmd);
964 sc_cmd->result = DID_NO_CONNECT << 16;
965 sc_cmd->scsi_done(sc_cmd);
971 "Completing sc_cmd=%p DID_NO_CONNECT as MSI-X is not enabled.\n",
972 sc_cmd);
973 sc_cmd->result = DID_NO_CONNECT << 16;
974 sc_cmd->scsi_done(sc_cmd);
983 sc_cmd->result = rval;
984 sc_cmd->scsi_done(sc_cmd);
1039 io_req->sc_cmd = sc_cmd;
1059 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
1073 CMD_SCSI_STATUS(sc_cmd) = io_req->cdb_status =
1105 if (sc_cmd->sense_buffer) {
1106 memset(sc_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
1108 memcpy(sc_cmd->sense_buffer, sense_data,
1115 struct scsi_cmnd *sc = io_req->sc_cmd;
1127 struct scsi_cmnd *sc_cmd;
1150 sc_cmd = io_req->sc_cmd;
1153 if (!sc_cmd) {
1154 QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd is NULL!\n");
1158 if (!sc_cmd->SCp.ptr) {
1164 if (!sc_cmd->device) {
1166 "Device for sc_cmd %p is NULL.\n", sc_cmd);
1170 if (!sc_cmd->request) {
1171 QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd->request is NULL, "
1172 "sc_cmd=%p.\n", sc_cmd);
1176 if (!sc_cmd->request->q) {
1178 "is not valid, sc_cmd=%p.\n", sc_cmd);
1190 sc_cmd->device->lun == (u64)fcport->lun_reset_lun)) {
1207 sc_cmd->result = DID_BUS_BUSY << 16;
1218 cqe->cqe_info.rsp_info.fw_residual, sc_cmd->cmnd[2],
1219 sc_cmd->cmnd[3], sc_cmd->cmnd[4], sc_cmd->cmnd[5]);
1222 sc_cmd->result = (DID_ERROR << 16) | io_req->cdb_status;
1224 sc_cmd->result = (DID_OK << 16) | io_req->cdb_status;
1230 scsi_set_resid(sc_cmd, scsi_bufflen(sc_cmd));
1238 sc_cmd->result = DID_OK << 16;
1245 qedf->lport->host->host_no, sc_cmd->device->id,
1246 sc_cmd->device->lun, io_req->xid,
1247 sc_cmd->cmnd[0], sc_cmd->cmnd[2], sc_cmd->cmnd[3],
1248 sc_cmd->cmnd[4], sc_cmd->cmnd[5],
1251 sc_cmd->result = (DID_OK << 16) | io_req->cdb_status;
1277 scsi_set_resid(sc_cmd, io_req->fcp_resid);
1325 io_req->sc_cmd = NULL;
1326 sc_cmd->SCp.ptr = NULL;
1327 sc_cmd->scsi_done(sc_cmd);
1335 struct scsi_cmnd *sc_cmd;
1356 sc_cmd = io_req->sc_cmd;
1358 if (!sc_cmd) {
1359 QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd is NULL!\n");
1363 if (!virt_addr_valid(sc_cmd)) {
1364 QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%p is not valid.", sc_cmd);
1368 if (!sc_cmd->SCp.ptr) {
1374 if (!sc_cmd->device) {
1375 QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %p is NULL.\n",
1376 sc_cmd);
1380 if (!virt_addr_valid(sc_cmd->device)) {
1382 "Device pointer for sc_cmd %p is bad.\n", sc_cmd);
1386 if (!sc_cmd->sense_buffer) {
1388 "sc_cmd->sense_buffer for sc_cmd %p is NULL.\n",
1389 sc_cmd);
1393 if (!virt_addr_valid(sc_cmd->sense_buffer)) {
1395 "sc_cmd->sense_buffer for sc_cmd %p is bad.\n",
1396 sc_cmd);
1400 if (!sc_cmd->scsi_done) {
1402 "sc_cmd->scsi_done for sc_cmd %p is NULL.\n",
1403 sc_cmd);
1409 sc_cmd->result = result << 16;
1412 "sc_cmd=%p result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, "
1414 qedf->lport->host->host_no, sc_cmd->device->id,
1415 sc_cmd->device->lun, sc_cmd, sc_cmd->result, sc_cmd->cmnd[0],
1416 sc_cmd->cmnd[2], sc_cmd->cmnd[3], sc_cmd->cmnd[4],
1417 sc_cmd->cmnd[5], sc_cmd->allowed, sc_cmd->retries,
1424 scsi_set_resid(sc_cmd, scsi_bufflen(sc_cmd));
1429 io_req->sc_cmd = NULL;
1430 sc_cmd->SCp.ptr = NULL;
1431 sc_cmd->scsi_done(sc_cmd);
1437 * Clear the io_req->sc_cmd backpointer so we don't try to process
1440 io_req->sc_cmd = NULL;
1554 io_req->sc_cmd->device->lun == (u64)io_req->fcport->lun_reset_lun)) {
1779 if (!io_req->sc_cmd)
1781 if (!io_req->sc_cmd->device) {
1783 "Device backpointer NULL for sc_cmd=%p.\n",
1784 io_req->sc_cmd);
1786 io_req->sc_cmd = NULL;
1845 "Outstanding io_req =%p xid=0x%x flags=0x%lx, sc_cmd=%p refcount=%d cmd_type=%d.\n",
1848 io_req->sc_cmd,
1932 "io_req xid=0x%x sc_cmd=%p already in cleanup or abort processing or already completed.\n",
1933 io_req->xid, io_req->sc_cmd);
2050 if (io_req->sc_cmd) {
2232 "Entered xid=0x%x sc_cmd=%p cmd_type=%d flags=0x%lx refcount=%d fcport=%p port_id=0x%06x\n",
2233 io_req->xid, io_req->sc_cmd, io_req->cmd_type, io_req->flags,
2276 io_req->sc_cmd = NULL;
2281 if (io_req->sc_cmd) {
2310 static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd,
2325 if (!sc_cmd) {
2326 QEDF_ERR(&qedf->dbg_ctx, "sc_cmd is NULL\n");
2330 lun = (int)sc_cmd->device->lun;
2350 io_req->sc_cmd = sc_cmd;
2396 io_req->sc_cmd = NULL;
2433 int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
2435 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
2439 struct fc_lport *lport = shost_priv(sc_cmd->device->host);
2447 "tm_flags 0x%x sc_cmd %p op = 0x%02x target_id = 0x%x lun=%d\n",
2448 tm_flags, sc_cmd, sc_cmd->cmd_len ? sc_cmd->cmnd[0] : 0xff,
2449 rport->scsi_target_id, (int)sc_cmd->device->lun);
2460 if (sc_cmd->SCp.ptr) {
2461 io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr;
2475 rc = fc_block_scsi_eh(sc_cmd);
2523 rc = qedf_execute_tmf(fcport, sc_cmd, tm_flags);
2540 io_req->sc_cmd = NULL;