scsi: csio: Stop using the SCSI pointer
authorBart Van Assche <bvanassche@acm.org>
Fri, 18 Feb 2022 19:50:45 +0000 (11:50 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:11:04 +0000 (21:11 -0500)
Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-18-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/csiostor/csio_scsi.c
drivers/scsi/csiostor/csio_scsi.h

index 55db025..9aafe00 100644 (file)
@@ -166,7 +166,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
        struct scsi_cmnd *scmnd = csio_scsi_cmnd(req);
 
        /* Check for Task Management */
-       if (likely(scmnd->SCp.Message == 0)) {
+       if (likely(csio_priv(scmnd)->fc_tm_flags == 0)) {
                int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
                fcp_cmnd->fc_tm_flags = 0;
                fcp_cmnd->fc_cmdref = 0;
@@ -185,7 +185,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
        } else {
                memset(fcp_cmnd, 0, sizeof(*fcp_cmnd));
                int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
-               fcp_cmnd->fc_tm_flags = (uint8_t)scmnd->SCp.Message;
+               fcp_cmnd->fc_tm_flags = csio_priv(scmnd)->fc_tm_flags;
        }
 }
 
@@ -1855,7 +1855,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
 
        /* Needed during abort */
        cmnd->host_scribble = (unsigned char *)ioreq;
-       cmnd->SCp.Message = 0;
+       csio_priv(cmnd)->fc_tm_flags = 0;
 
        /* Kick off SCSI IO SM on the ioreq */
        spin_lock_irqsave(&hw->lock, flags);
@@ -2026,7 +2026,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)
                      req, req->wr_status);
 
        /* Cache FW return status */
-       cmnd->SCp.Status = req->wr_status;
+       csio_priv(cmnd)->wr_status = req->wr_status;
 
        /* Special handling based on FCP response */
 
@@ -2049,7 +2049,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)
                /* Modify return status if flags indicate success */
                if (flags & FCP_RSP_LEN_VAL)
                        if (rsp_info->rsp_code == FCP_TMF_CMPL)
-                               cmnd->SCp.Status = FW_SUCCESS;
+                               csio_priv(cmnd)->wr_status = FW_SUCCESS;
 
                csio_dbg(hw, "TM FCP rsp code: %d\n", rsp_info->rsp_code);
        }
@@ -2125,9 +2125,9 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
 
        csio_scsi_cmnd(ioreq)   = cmnd;
        cmnd->host_scribble     = (unsigned char *)ioreq;
-       cmnd->SCp.Status        = 0;
+       csio_priv(cmnd)->wr_status = 0;
 
-       cmnd->SCp.Message       = FCP_TMF_LUN_RESET;
+       csio_priv(cmnd)->fc_tm_flags = FCP_TMF_LUN_RESET;
        ioreq->tmo              = CSIO_SCSI_LUNRST_TMO_MS / 1000;
 
        /*
@@ -2178,9 +2178,10 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
        }
 
        /* LUN reset returned, check cached status */
-       if (cmnd->SCp.Status != FW_SUCCESS) {
+       if (csio_priv(cmnd)->wr_status != FW_SUCCESS) {
                csio_err(hw, "LUN reset failed (%d:%llu), status: %d\n",
-                        cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status);
+                        cmnd->device->id, cmnd->device->lun,
+                        csio_priv(cmnd)->wr_status);
                goto fail;
        }
 
@@ -2271,6 +2272,7 @@ struct scsi_host_template csio_fcoe_shost_template = {
        .name                   = CSIO_DRV_DESC,
        .proc_name              = KBUILD_MODNAME,
        .queuecommand           = csio_queuecommand,
+       .cmd_size               = sizeof(struct csio_cmd_priv),
        .eh_timed_out           = fc_eh_timed_out,
        .eh_abort_handler       = csio_eh_abort_handler,
        .eh_device_reset_handler = csio_eh_lun_reset_handler,
index 2257c3d..39dda3c 100644 (file)
@@ -188,6 +188,16 @@ struct csio_scsi_level_data {
        uint64_t                oslun;
 };
 
+struct csio_cmd_priv {
+       uint8_t fc_tm_flags;    /* task management flags */
+       uint16_t wr_status;
+};
+
+static inline struct csio_cmd_priv *csio_priv(struct scsi_cmnd *cmd)
+{
+       return scsi_cmd_priv(cmd);
+}
+
 static inline struct csio_ioreq *
 csio_get_scsi_ioreq(struct csio_scsim *scm)
 {