Skip to content

Commit 924cb24

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: fnic: 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-23-bvanassche@acm.org Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 3032ed7 commit 924cb24

File tree

3 files changed

+163
-154
lines changed

3 files changed

+163
-154
lines changed

drivers/scsi/fnic/fnic.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,28 @@
8989
#define FNIC_DEV_RST_ABTS_PENDING BIT(21)
9090

9191
/*
92-
* Usage of the scsi_cmnd scratchpad.
92+
* fnic private data per SCSI command.
9393
* These fields are locked by the hashed io_req_lock.
9494
*/
95-
#define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
96-
#define CMD_STATE(Cmnd) ((Cmnd)->SCp.phase)
97-
#define CMD_ABTS_STATUS(Cmnd) ((Cmnd)->SCp.Message)
98-
#define CMD_LR_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
99-
#define CMD_TAG(Cmnd) ((Cmnd)->SCp.sent_command)
100-
#define CMD_FLAGS(Cmnd) ((Cmnd)->SCp.Status)
95+
struct fnic_cmd_priv {
96+
struct fnic_io_req *io_req;
97+
enum fnic_ioreq_state state;
98+
u32 flags;
99+
u16 abts_status;
100+
u16 lr_status;
101+
};
102+
103+
static inline struct fnic_cmd_priv *fnic_priv(struct scsi_cmnd *cmd)
104+
{
105+
return scsi_cmd_priv(cmd);
106+
}
107+
108+
static inline u64 fnic_flags_and_state(struct scsi_cmnd *cmd)
109+
{
110+
struct fnic_cmd_priv *fcmd = fnic_priv(cmd);
111+
112+
return ((u64)fcmd->flags << 32) | fcmd->state;
113+
}
101114

102115
#define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */
103116

drivers/scsi/fnic/fnic_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = {
124124
.max_sectors = 0xffff,
125125
.shost_groups = fnic_host_groups,
126126
.track_queue_depth = 1,
127+
.cmd_size = sizeof(struct fnic_cmd_priv),
127128
};
128129

129130
static void

0 commit comments

Comments
 (0)