Skip to content

Commit 30564db

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: csio: Stop using the SCSI pointer
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>
1 parent 34f5b53 commit 30564db

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

drivers/scsi/csiostor/csio_scsi.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
166166
struct scsi_cmnd *scmnd = csio_scsi_cmnd(req);
167167

168168
/* Check for Task Management */
169-
if (likely(scmnd->SCp.Message == 0)) {
169+
if (likely(csio_priv(scmnd)->fc_tm_flags == 0)) {
170170
int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
171171
fcp_cmnd->fc_tm_flags = 0;
172172
fcp_cmnd->fc_cmdref = 0;
@@ -185,7 +185,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
185185
} else {
186186
memset(fcp_cmnd, 0, sizeof(*fcp_cmnd));
187187
int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
188-
fcp_cmnd->fc_tm_flags = (uint8_t)scmnd->SCp.Message;
188+
fcp_cmnd->fc_tm_flags = csio_priv(scmnd)->fc_tm_flags;
189189
}
190190
}
191191

@@ -1855,7 +1855,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
18551855

18561856
/* Needed during abort */
18571857
cmnd->host_scribble = (unsigned char *)ioreq;
1858-
cmnd->SCp.Message = 0;
1858+
csio_priv(cmnd)->fc_tm_flags = 0;
18591859

18601860
/* Kick off SCSI IO SM on the ioreq */
18611861
spin_lock_irqsave(&hw->lock, flags);
@@ -2026,7 +2026,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)
20262026
req, req->wr_status);
20272027

20282028
/* Cache FW return status */
2029-
cmnd->SCp.Status = req->wr_status;
2029+
csio_priv(cmnd)->wr_status = req->wr_status;
20302030

20312031
/* Special handling based on FCP response */
20322032

@@ -2049,7 +2049,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)
20492049
/* Modify return status if flags indicate success */
20502050
if (flags & FCP_RSP_LEN_VAL)
20512051
if (rsp_info->rsp_code == FCP_TMF_CMPL)
2052-
cmnd->SCp.Status = FW_SUCCESS;
2052+
csio_priv(cmnd)->wr_status = FW_SUCCESS;
20532053

20542054
csio_dbg(hw, "TM FCP rsp code: %d\n", rsp_info->rsp_code);
20552055
}
@@ -2125,9 +2125,9 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
21252125

21262126
csio_scsi_cmnd(ioreq) = cmnd;
21272127
cmnd->host_scribble = (unsigned char *)ioreq;
2128-
cmnd->SCp.Status = 0;
2128+
csio_priv(cmnd)->wr_status = 0;
21292129

2130-
cmnd->SCp.Message = FCP_TMF_LUN_RESET;
2130+
csio_priv(cmnd)->fc_tm_flags = FCP_TMF_LUN_RESET;
21312131
ioreq->tmo = CSIO_SCSI_LUNRST_TMO_MS / 1000;
21322132

21332133
/*
@@ -2178,9 +2178,10 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
21782178
}
21792179

21802180
/* LUN reset returned, check cached status */
2181-
if (cmnd->SCp.Status != FW_SUCCESS) {
2181+
if (csio_priv(cmnd)->wr_status != FW_SUCCESS) {
21822182
csio_err(hw, "LUN reset failed (%d:%llu), status: %d\n",
2183-
cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status);
2183+
cmnd->device->id, cmnd->device->lun,
2184+
csio_priv(cmnd)->wr_status);
21842185
goto fail;
21852186
}
21862187

@@ -2271,6 +2272,7 @@ struct scsi_host_template csio_fcoe_shost_template = {
22712272
.name = CSIO_DRV_DESC,
22722273
.proc_name = KBUILD_MODNAME,
22732274
.queuecommand = csio_queuecommand,
2275+
.cmd_size = sizeof(struct csio_cmd_priv),
22742276
.eh_timed_out = fc_eh_timed_out,
22752277
.eh_abort_handler = csio_eh_abort_handler,
22762278
.eh_device_reset_handler = csio_eh_lun_reset_handler,

drivers/scsi/csiostor/csio_scsi.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ struct csio_scsi_level_data {
188188
uint64_t oslun;
189189
};
190190

191+
struct csio_cmd_priv {
192+
uint8_t fc_tm_flags; /* task management flags */
193+
uint16_t wr_status;
194+
};
195+
196+
static inline struct csio_cmd_priv *csio_priv(struct scsi_cmnd *cmd)
197+
{
198+
return scsi_cmd_priv(cmd);
199+
}
200+
191201
static inline struct csio_ioreq *
192202
csio_get_scsi_ioreq(struct csio_scsim *scm)
193203
{

0 commit comments

Comments
 (0)