Commit 34f5b537 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: bfa: 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-17-bvanassche@acm.orgReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3ac6aba3
...@@ -150,10 +150,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, ...@@ -150,10 +150,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk; struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk;
wait_queue_head_t *wq; wait_queue_head_t *wq;
cmnd->SCp.Status |= tsk_status << 1; bfad_priv(cmnd)->status |= tsk_status << 1;
set_bit(IO_DONE_BIT, (unsigned long *)&cmnd->SCp.Status); set_bit(IO_DONE_BIT, &bfad_priv(cmnd)->status);
wq = (wait_queue_head_t *) cmnd->SCp.ptr; wq = bfad_priv(cmnd)->wq;
cmnd->SCp.ptr = NULL; bfad_priv(cmnd)->wq = NULL;
if (wq) if (wq)
wake_up(wq); wake_up(wq);
...@@ -259,7 +259,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, ...@@ -259,7 +259,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
* happens. * happens.
*/ */
cmnd->host_scribble = NULL; cmnd->host_scribble = NULL;
cmnd->SCp.Status = 0; bfad_priv(cmnd)->status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
/* /*
* bfa_itnim can be NULL if the port gets disconnected and the bfa * bfa_itnim can be NULL if the port gets disconnected and the bfa
...@@ -326,8 +326,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) ...@@ -326,8 +326,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
* if happens. * if happens.
*/ */
cmnd->host_scribble = NULL; cmnd->host_scribble = NULL;
cmnd->SCp.ptr = (char *)&wq; bfad_priv(cmnd)->wq = &wq;
cmnd->SCp.Status = 0; bfad_priv(cmnd)->status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
/* /*
* bfa_itnim can be NULL if the port gets disconnected and the bfa * bfa_itnim can be NULL if the port gets disconnected and the bfa
...@@ -347,10 +347,9 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) ...@@ -347,10 +347,9 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO); FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);
spin_unlock_irqrestore(&bfad->bfad_lock, flags); spin_unlock_irqrestore(&bfad->bfad_lock, flags);
wait_event(wq, test_bit(IO_DONE_BIT, wait_event(wq, test_bit(IO_DONE_BIT, &bfad_priv(cmnd)->status));
(unsigned long *)&cmnd->SCp.Status));
task_status = cmnd->SCp.Status >> 1; task_status = bfad_priv(cmnd)->status >> 1;
if (task_status != BFI_TSKIM_STS_OK) { if (task_status != BFI_TSKIM_STS_OK) {
BFA_LOG(KERN_ERR, bfad, bfa_log_level, BFA_LOG(KERN_ERR, bfad, bfa_log_level,
"LUN reset failure, status: %d\n", task_status); "LUN reset failure, status: %d\n", task_status);
...@@ -381,16 +380,16 @@ bfad_im_reset_target_handler(struct scsi_cmnd *cmnd) ...@@ -381,16 +380,16 @@ bfad_im_reset_target_handler(struct scsi_cmnd *cmnd)
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
itnim = bfad_get_itnim(im_port, starget->id); itnim = bfad_get_itnim(im_port, starget->id);
if (itnim) { if (itnim) {
cmnd->SCp.ptr = (char *)&wq; bfad_priv(cmnd)->wq = &wq;
rc = bfad_im_target_reset_send(bfad, cmnd, itnim); rc = bfad_im_target_reset_send(bfad, cmnd, itnim);
if (rc == BFA_STATUS_OK) { if (rc == BFA_STATUS_OK) {
/* wait target reset to complete */ /* wait target reset to complete */
spin_unlock_irqrestore(&bfad->bfad_lock, flags); spin_unlock_irqrestore(&bfad->bfad_lock, flags);
wait_event(wq, test_bit(IO_DONE_BIT, wait_event(wq, test_bit(IO_DONE_BIT,
(unsigned long *)&cmnd->SCp.Status)); &bfad_priv(cmnd)->status));
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
task_status = cmnd->SCp.Status >> 1; task_status = bfad_priv(cmnd)->status >> 1;
if (task_status != BFI_TSKIM_STS_OK) if (task_status != BFI_TSKIM_STS_OK)
BFA_LOG(KERN_ERR, bfad, bfa_log_level, BFA_LOG(KERN_ERR, bfad, bfa_log_level,
"target reset failure," "target reset failure,"
...@@ -797,6 +796,7 @@ struct scsi_host_template bfad_im_scsi_host_template = { ...@@ -797,6 +796,7 @@ struct scsi_host_template bfad_im_scsi_host_template = {
.name = BFAD_DRIVER_NAME, .name = BFAD_DRIVER_NAME,
.info = bfad_im_info, .info = bfad_im_info,
.queuecommand = bfad_im_queuecommand, .queuecommand = bfad_im_queuecommand,
.cmd_size = sizeof(struct bfad_cmd_priv),
.eh_timed_out = fc_eh_timed_out, .eh_timed_out = fc_eh_timed_out,
.eh_abort_handler = bfad_im_abort_handler, .eh_abort_handler = bfad_im_abort_handler,
.eh_device_reset_handler = bfad_im_reset_lun_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,
...@@ -819,6 +819,7 @@ struct scsi_host_template bfad_im_vport_template = { ...@@ -819,6 +819,7 @@ struct scsi_host_template bfad_im_vport_template = {
.name = BFAD_DRIVER_NAME, .name = BFAD_DRIVER_NAME,
.info = bfad_im_info, .info = bfad_im_info,
.queuecommand = bfad_im_queuecommand, .queuecommand = bfad_im_queuecommand,
.cmd_size = sizeof(struct bfad_cmd_priv),
.eh_timed_out = fc_eh_timed_out, .eh_timed_out = fc_eh_timed_out,
.eh_abort_handler = bfad_im_abort_handler, .eh_abort_handler = bfad_im_abort_handler,
.eh_device_reset_handler = bfad_im_reset_lun_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,
......
...@@ -43,6 +43,22 @@ u32 bfad_im_supported_speeds(struct bfa_s *bfa); ...@@ -43,6 +43,22 @@ u32 bfad_im_supported_speeds(struct bfa_s *bfa);
*/ */
#define IO_DONE_BIT 0 #define IO_DONE_BIT 0
/**
* struct bfad_cmd_priv - private data per SCSI command.
* @status: Lowest bit represents IO_DONE. The next seven bits hold a value of
* type enum bfi_tskim_status.
* @wq: Wait queue used to wait for completion of an operation.
*/
struct bfad_cmd_priv {
unsigned long status;
wait_queue_head_t *wq;
};
static inline struct bfad_cmd_priv *bfad_priv(struct scsi_cmnd *cmd)
{
return scsi_cmd_priv(cmd);
}
struct bfad_itnim_data_s { struct bfad_itnim_data_s {
struct bfad_itnim_s *itnim; struct bfad_itnim_s *itnim;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment