Commit b0cd285e authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: mpt3sas: always use first reserved smid for ioctl passthrough

ioctl passthrough commands require a SCSIIO smid, but cannot easily
integrate with the block layer. But the driver already has reserved some
SCSIIO smids and we're only ever allowing one ioctl command at a time we
can use the first reserved smid for ioctl commands.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarSuganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9961c9bb
...@@ -908,14 +908,18 @@ static u8 ...@@ -908,14 +908,18 @@ static u8
_base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid) _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid)
{ {
int i; int i;
u16 ctl_smid = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT + 1;
u8 cb_idx = 0xFF; u8 cb_idx = 0xFF;
if (smid < ioc->hi_priority_smid) { if (smid < ioc->hi_priority_smid) {
struct scsiio_tracker *st; struct scsiio_tracker *st;
st = mpt3sas_get_st_from_smid(ioc, smid); if (smid < ctl_smid) {
if (st) st = mpt3sas_get_st_from_smid(ioc, smid);
cb_idx = st->cb_idx; if (st)
cb_idx = st->cb_idx;
} else if (smid == ctl_smid)
cb_idx = ioc->ctl_cb_idx;
} else if (smid < ioc->internal_smid) { } else if (smid < ioc->internal_smid) {
i = smid - ioc->hi_priority_smid; i = smid - ioc->hi_priority_smid;
cb_idx = ioc->hpr_lookup[i].cb_idx; cb_idx = ioc->hpr_lookup[i].cb_idx;
...@@ -2922,7 +2926,9 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid) ...@@ -2922,7 +2926,9 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
ioc->scsi_lookup[i].cb_idx = 0xFF; ioc->scsi_lookup[i].cb_idx = 0xFF;
ioc->scsi_lookup[i].scmd = NULL; ioc->scsi_lookup[i].scmd = NULL;
ioc->scsi_lookup[i].direct_io = 0; ioc->scsi_lookup[i].direct_io = 0;
list_add(&ioc->scsi_lookup[i].tracker_list, &ioc->free_list); if (i < ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT)
list_add(&ioc->scsi_lookup[i].tracker_list,
&ioc->free_list);
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
_base_recovery_check(ioc); _base_recovery_check(ioc);
...@@ -5787,8 +5793,9 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) ...@@ -5787,8 +5793,9 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
ioc->scsi_lookup[i].smid = smid; ioc->scsi_lookup[i].smid = smid;
ioc->scsi_lookup[i].scmd = NULL; ioc->scsi_lookup[i].scmd = NULL;
ioc->scsi_lookup[i].direct_io = 0; ioc->scsi_lookup[i].direct_io = 0;
list_add_tail(&ioc->scsi_lookup[i].tracker_list, if (i < ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT)
&ioc->free_list); list_add_tail(&ioc->scsi_lookup[i].tracker_list,
&ioc->free_list);
} }
/* hi-priority queue */ /* hi-priority queue */
......
...@@ -724,14 +724,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, ...@@ -724,14 +724,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
goto out; goto out;
} }
} else { } else {
/* Use first reserved smid for passthrough ioctls */
smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->ctl_cb_idx, NULL); smid = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT + 1;
if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
ioc->name, __func__);
ret = -EAGAIN;
goto out;
}
} }
ret = 0; ret = 0;
......
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