scsi: mpt3sas: Improve device discovery and readiness handling for slow devices

Introduce a new module parameter "issue_scsi_cmd_to_bringup_drive"
(default=1) which allows overriding the driver's behavior of issuing
SCSI TEST_UNIT_READY/START_UNIT commands to bring devices to READY state
during unblock.

Improve device discovery and I/O unblocking reliability by adding
robust device readiness checks and separate callback handling for
discovery I/O.  This introduces new helper routines for SCSI command
execution and readiness determination, ensuring smoother recovery and
initialization for slow or transient devices.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510310924.crvtELzs-lkp@intel.com/
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://patch.msgid.link/20251113153712.31850-4-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Ranjan Kumar 2025-11-13 21:07:06 +05:30 committed by Martin K. Petersen
parent 6b553f2a5c
commit aee682fad6
3 changed files with 1119 additions and 17 deletions

View File

@ -1564,6 +1564,8 @@ _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid)
int i;
u16 ctl_smid = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT + 1;
u8 cb_idx = 0xFF;
u16 discovery_smid =
ioc->shost->can_queue + INTERNAL_SCSIIO_FOR_DISCOVERY;
if (smid < ioc->hi_priority_smid) {
struct scsiio_tracker *st;
@ -1572,8 +1574,10 @@ _base_get_cb_idx(struct MPT3SAS_ADAPTER *ioc, u16 smid)
st = _get_st_from_smid(ioc, smid);
if (st)
cb_idx = st->cb_idx;
} else if (smid == ctl_smid)
} else if (smid < discovery_smid)
cb_idx = ioc->ctl_cb_idx;
else
cb_idx = ioc->scsih_cb_idx;
} else if (smid < ioc->internal_smid) {
i = smid - ioc->hi_priority_smid;
cb_idx = ioc->hpr_lookup[i].cb_idx;

View File

@ -147,6 +147,7 @@
#define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
/* reserved for issuing internally framed scsi io cmds */
#define INTERNAL_SCSIIO_CMDS_COUNT 3
#define INTERNAL_SCSIIO_FOR_DISCOVERY 2
#define MPI3_HIM_MASK 0xFFFFFFFF /* mask every bit*/
@ -480,6 +481,7 @@ struct MPT3SAS_DEVICE {
u32 flags;
u8 configured_lun;
u8 block;
u8 deleted;
u8 tlr_snoop_check;
u8 ignore_delay_remove;
/* Iopriority Command Handling */
@ -577,7 +579,9 @@ struct _sas_device {
u8 chassis_slot;
u8 is_chassis_slot_valid;
u8 connector_name[5];
u8 ssd_device;
struct kref refcount;
u8 port_type;
struct hba_port *port;
struct sas_rphy *rphy;

File diff suppressed because it is too large Load Diff