mpt3sas: Improve device readiness handling and event recovery
Subsystems (2)
Ranjan Kumar
maintainerv2 cover mpt3sas: Improve device readiness handling and event recovery
This patch series enhances the mpt3sas driver’s device bring-up, readiness detection, and event recovery mechanisms to improve robustness in environments with slow-responding or transient SAS/PCIe devices.
The series introduces optional control over issuing TEST UNIT READY (TUR) commands during device unblocking, configurable retry limits, and a mechanism to requeue firmware topology events when devices are temporarily busy. Together, these updates reduce discovery failures and improve recovery reliability following firmware or link events.
Change since v1:
- Fixed test robot build warnings
- Fixed W=1 compilation warnings
Ranjan Kumar (6):
mpt3sas: Added no_turs flag to device unblock logic
mpt3sas: Added issue_scsi_cmd_to_bringup_drive module parameter part-1
mpt3sas: improve device discovery and readiness handling for slow
devices part-2
mpt3sas: Add firmware event requeue support for busy devices
mpt3sas: Add configurable command retry limit for slow-to-respond
devices
mpt3sas: Fixed the W=1 compilation warning
drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1458 ++++++++++++++++++++++++-- 3 files changed, 1376 insertions(+), 100 deletions(-)
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 1/6 mpt3sas: Added no_turs flag to device unblock logic
Add a "no_turs" flag to _scsih_ublock_io_all_device() to optionally skip TEST UNIT READY (TUR) checks while unblocking devices. This is used after broadcast events where sending TURs is not required.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +11 -3
@@ -3825,11 +3825,12 @@ _scsih_internal_device_unblock(struct scsi_device *sdev,/** * _scsih_ublock_io_all_device - unblock every device * @ioc: per adapter object +* @no_turs: flag to disable TEST UNIT READY checks during device unblocking * * change the device state from block to running */ static void -_scsih_ublock_io_all_device (struct MPT3SAS_ADAPTER *ioc) +_scsih_ublock_io_all_device (struct MPT3SAS_ADAPTER *ioc,u8 no_turs) {struct MPT3SAS_DEVICE *sas_device_priv_data;struct scsi_device *sdev;
@@ -3841,6 +3842,13 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc)if (!sas_device_priv_data->block)continue ; +if (no_turs) { +sdev_printk (KERN_WARNING , sdev,"device_unblocked handle(0x%04x)\n" , + sas_device_priv_data->sas_target->handle); +_scsih_internal_device_unblock (sdev, sas_device_priv_data); +continue ; + } +dewtprintk (ioc,sdev_printk (KERN_INFO , sdev,"device_running, handle(0x%04x)\n" , sas_device_priv_data->sas_target->handle));
@@ -8810,7 +8818,7 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, ioc->broadcast_aen_busy =0 ;if (!ioc->shost_recovery) -_scsih_ublock_io_all_device (ioc); +_scsih_ublock_io_all_device (ioc,1 );mutex_unlock (&ioc->tm_cmds.mutex); }
@@ -10344,7 +10352,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc)ioc_info (ioc,"removing unresponding devices: complete\n" );/* unblock devices */ -_scsih_ublock_io_all_device (ioc); +_scsih_ublock_io_all_device (ioc,0 ); } static void
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 2/6 mpt3sas: Added issue_scsi_cmd_to_bringup_drive module parameter part-1
In reply to Ranjan KumarIntroduced 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.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +9 -0
@@ -159,6 +159,15 @@ module_param(enable_sdev_max_qd, bool, 0444);MODULE_PARM_DESC (enable_sdev_max_qd,"Enable sdev max qd as can_queue, def=disabled(0)" ); +/* +* permit overriding the SCSI command issuing capability of +* the driver to bring the drive to READY state +*/ +static int issue_scsi_cmd_to_bringup_drive =1 ; +module_param (issue_scsi_cmd_to_bringup_drive, int,0444 ); +MODULE_PARM_DESC (issue_scsi_cmd_to_bringup_drive,"allow host driver to\n" +"issue SCSI commands to bring the drive to READY state, default=1 " ); +static int multipath_on_hba =-1 ;module_param (multipath_on_hba, int,0 ); MODULE_PARM_DESC(multipath_on_hba,
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 3/6 mpt3sas: improve device discovery and readiness handling for slow devices part-2
In reply to Ranjan KumarImproves device discovery and I/O unblocking reliability in the mpt3sas driver by adding robust device readiness checks and separate callback handling for discovery I/O. It introduces new helper routines for SCSI command execution and readiness determination, ensuring smoother recovery and initialization for slow or transient devices.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 6 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1117 +++++++++++++++++++++++++- 3 files changed, 1110 insertions(+), 17 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +5 -1
@@ -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;
drivers/scsi/mpt3sas/mpt3sas_base.h +4 -0
@@ -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;
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1101 -16
1,318 lines not on this page · raw message
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 4/6 mpt3sas: Add firmware event requeue support for busy devices
In reply to Ranjan KumarAdd support to requeue SAS/PCIe topology change events when devices are busy or not ready. Introduce delayed work with retry counters so events are retried instead of dropped, improving device discovery by retrying transient failures instead of dropping events.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 130 +++++++++++++++++++++++---- 1 file changed, 112 insertions(+), 18 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +112 -18
@@ -89,6 +89,7 @@ _scsih_ata_pass_thru_idd(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 *is_ssd_devstatic enum device_responsive_state _scsih_wait_for_device_to_become_ready (struct MPT3SAS_ADAPTER *ioc,u16 handle,u8 retry_count,u8 is_pd,int lun,u8 tr_timeout,u8 tr_method); +static void _firmware_event_work_delayed (struct work_struct *work);/* global parameters */ LIST_HEAD (mpt3sas_ioc_list);
@@ -275,11 +276,16 @@ struct fw_event_work {u16 event;struct kref refcount;char event_data[]__aligned(4) ; + };static void fw_event_work_free (struct kref *r) { -kfree (container_of(r ,struct fw_event_work ,refcount )); +struct fw_event_work *fw_work; + + fw_work = container_of(r, struct fw_event_work, refcount); +kfree (fw_work->retries); +kfree (fw_work); }static void fw_event_work_get (struct fw_event_work *fw_work)
@@ -3651,6 +3657,37 @@ _scsih_fw_event_del_from_list(struct MPT3SAS_ADAPTER *ioc, struct fw_event_workspin_unlock_irqrestore (&ioc->fw_event_lock, flags); } +/** +* _scsih_fw_event_requeue - requeue an event +* @ioc: per adapter object +* @fw_event: object describing the event +* @delay: time in milliseconds to wait before retrying the event +* +* Context: This function will acquire ioc->fw_event_lock. +* +* Return nothing. +*/ +static void +_scsih_fw_event_requeue (struct MPT3SAS_ADAPTER *ioc,struct fw_event_work + *fw_event,unsigned long delay) +{ +unsigned long flags; + +if (ioc->firmware_event_thread ==NULL ) +return ; + +spin_lock_irqsave (&ioc->fw_event_lock, flags); +fw_event_work_get (fw_event); +list_add_tail (&fw_event->list, &ioc->fw_event_list); +if (!fw_event->delayed_work_active) { + fw_event->delayed_work_active =1 ; +INIT_DELAYED_WORK (&fw_event->delayed_work, + _firmware_event_work_delayed); + } +queue_delayed_work (ioc->firmware_event_thread, &fw_event->delayed_work, +msecs_to_jiffies (delay)); +spin_unlock_irqrestore (&ioc->fw_event_lock, flags); +}/** * mpt3sas_send_trigger_data_event - send event for processing trigger data
@@ -8589,6 +8626,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, {int i;int rc; +int requeue_event;u16 parent_handle, handle;u16 reason_code;u8 phy_number, max_phys;
@@ -8643,7 +8681,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,spin_unlock_irqrestore (&ioc->sas_node_lock, flags);/* handle siblings events */ -for (i =0 ; i < event_data->NumEntries; i++) { +for (i =0 , requeue_event =0 ; i < event_data->NumEntries; i++) {if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring expander event\n" ));
@@ -8663,7 +8701,14 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,if (fw_event->delayed_work_active && (reason_code ==MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING )) {dewtprintk (ioc,ioc_info (ioc,"ignoring\n" -"Targ not responding event phy in re-queued event processing\n" )); +"Target not responding event phy in re-queued event processing\n" )); +continue ; + } + +if (fw_event->delayed_work_active && (reason_code == +MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING )) { +dewtprintk (ioc,ioc_info (ioc,"ignoring Target not responding\n" +"event phy in re-queued event processing\n" ));continue ; }
@@ -8714,7 +8759,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, "event to a device add\n", handle)); event_data->PHY[i].PhyStatus &=0xF0 ; event_data->PHY[i].PhyStatus |= -MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED ; +MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED ; fallthrough;
@@ -8731,11 +8776,13 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, rc =_scsih_add_device (ioc, handle, fw_event->retries[i],0 ); -if (rc)/* retry due to busy device */ +if (rc) {/* retry due to busy device */ fw_event->retries[i]++; -else /* mark entry vacant */ + requeue_event =1 ; + }else {/* mark entry vacant */ event_data->PHY[i].PhyStatus |= -MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT ; +MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT ; + }break ;case MPI2_EVENT_SAS_TOPO_RC_TARG_NOT_RESPONDING :
@@ -8750,7 +8797,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, sas_expander)mpt3sas_expander_remove (ioc ,sas_address ,port ); -return 0 ; +return requeue_event; }/**
@@ -9428,7 +9475,7 @@ _scsih_pcie_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc,* Context: user. * */ -static void +static int _scsih_pcie_topology_change_event (struct MPT3SAS_ADAPTER *ioc,struct fw_event_work *fw_event) {
@@ -9438,6 +9485,7 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,u8 link_rate, prev_link_rate;unsigned long flags;int rc; +int requeue_event;Mpi26EventDataPCIeTopologyChangeList_t *event_data = (Mpi26EventDataPCIeTopologyChangeList_t *) fw_event->event_data;struct _pcie_device *pcie_device;
@@ -9447,22 +9495,22 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,if (ioc->shost_recovery || ioc->remove_host || ioc->pci_error_recovery) -return ; +return 0 ;if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring switch event\n" )); -return ; +return 0 ; }/* handle siblings events */ -for (i =0 ; i < event_data->NumEntries; i++) { +for (i =0 , requeue_event =0 ; i < event_data->NumEntries; i++) {if (fw_event->ignore) {dewtprintk (ioc,ioc_info (ioc,"ignoring switch event\n" )); -return ; +return 0 ; }if (ioc->remove_host || ioc->pci_error_recovery) -return ; +return 0 ; reason_code = event_data->PortEntry[i].PortStatus; handle =le16_to_cpu (event_data->PortEntry[i].AttachedDevHandle);
@@ -9518,8 +9566,8 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, rc =_scsih_pcie_add_device (ioc, handle, fw_event->retries[i]);if (rc) {/* retry due to busy device */ - fw_event->retries[i]++; + requeue_event =1 ; }else {/* mark entry vacant */ /* TODO This needs to be reviewed and fixed,
@@ -9535,11 +9583,12 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,break ; } } +return requeue_event; }/** * _scsih_pcie_device_status_change_event_debug - debug for device event -* @ioc: ? +* @ioc: per adapter object * @event_data: event data payload * Context: user. */
@@ -11870,7 +11919,11 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)_scsih_turn_on_pfa_led (ioc, fw_event->device_handle);break ;case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST : -_scsih_sas_topology_change_event (ioc, fw_event); +if (_scsih_sas_topology_change_event (ioc, fw_event)) { +_scsih_fw_event_requeue (ioc, fw_event,1000 ); + ioc->current_event =NULL ; +return ; + }break ;case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE :if (ioc->logging_level &MPT_DEBUG_EVENT_WORK_TASK )
@@ -11910,7 +11963,11 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)_scsih_pcie_enumeration_event (ioc, fw_event);break ;case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST : -_scsih_pcie_topology_change_event (ioc, fw_event); +if (_scsih_pcie_topology_change_event (ioc, fw_event)) { +_scsih_fw_event_requeue (ioc, fw_event,1000 ); + ioc->current_event =NULL ; +return ; + }break ; } out:
@@ -11935,6 +11992,15 @@ _firmware_event_work(struct work_struct *work)_mpt3sas_fw_work (fw_event->ioc, fw_event); } +static void +_firmware_event_work_delayed (struct work_struct *work) +{ +struct fw_event_work *fw_event =container_of (work, + struct fw_event_work, delayed_work.work); + +_mpt3sas_fw_work (fw_event->ioc, fw_event); +} +/** * mpt3sas_scsih_event_callback - firmware event handler (called at ISR time) * @ioc: per adapter object
@@ -12115,6 +12181,34 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,return 1 ; } +if (event ==MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST ) { +Mpi2EventDataSasTopologyChangeList_t *topo_event_data = + (Mpi2EventDataSasTopologyChangeList_t *) + mpi_reply->EventData; + fw_event->retries =kzalloc (topo_event_data->NumEntries, +GFP_ATOMIC ); +if (!fw_event->retries) { + +ioc_err (ioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +kfree (fw_event->event_data); +fw_event_work_put (fw_event); +return 1 ; + } + } + +if (event ==MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST ) { +Mpi26EventDataPCIeTopologyChangeList_t *topo_event_data = + (Mpi26EventDataPCIeTopologyChangeList_t *) mpi_reply->EventData; + fw_event->retries =kzalloc (topo_event_data->NumEntries, +GFP_ATOMIC ); +if (!fw_event->retries) { + +ioc_err (ioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +fw_event_work_put (fw_event); +return 1 ; + } + } +memcpy (fw_event->event_data, mpi_reply->EventData, sz); fw_event->ioc = ioc; fw_event->VF_ID = mpi_reply->VF_ID;
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 5/6 mpt3sas: Add configurable command retry limit for slow-to-respond devices
In reply to Ranjan KumarAdds a new module parameter "command_retry_count" to control the number of retries during device discovery and readiness checks, improving reliability for slow or transient SAS/PCIe devices.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 84 ++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +78 -6
@@ -195,6 +195,11 @@ module_param(host_tagset_enable, int, 0444);MODULE_PARM_DESC (host_tagset_enable,"Shared host tagset enable/disable Default: enable(1)" ); +static int command_retry_count =144 ; +module_param (command_retry_count, int,0444 ); +MODULE_PARM_DESC (command_retry_count,"Device discovery TUR command retry\n" +"count: (default=144)" ); +/* raid transport support */ static struct raid_template *mpt3sas_raid_template;static struct raid_template *mpt2sas_raid_template;
@@ -3927,11 +3932,24 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs) {struct MPT3SAS_DEVICE *sas_device_priv_data;struct scsi_device *sdev; +struct MPT3SAS_TARGET *sas_target; +enum device_responsive_state rc; +struct _sas_device *sas_device =NULL ; +struct _pcie_device *pcie_device =NULL ; +int count =0 ; +u8 tr_method =0 ; +u8 tr_timeout =30 ; +shost_for_each_device (sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata;if (!sas_device_priv_data)continue ; + + sas_target = sas_device_priv_data->sas_target; +if (!sas_target || sas_target->deleted) +continue ; +if (!sas_device_priv_data->block)continue ;
@@ -3942,10 +3960,62 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs)continue ; } -dewtprintk (ioc,sdev_printk (KERN_INFO , sdev, -"device_running, handle(0x%04x)\n" , - sas_device_priv_data->sas_target->handle)); +do { + pcie_device =mpt3sas_get_pdev_by_handle (ioc, sas_target->handle); +if (pcie_device && (!ioc->tm_custom_handling) && + (!(mpt3sas_scsih_is_pcie_scsi_device (pcie_device->device_info)))) { + tr_timeout = pcie_device->reset_timeout; + tr_method =MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE ; + } + rc =_scsih_wait_for_device_to_become_ready (ioc, + sas_target->handle,0 , (sas_target->flags & +MPT_TARGET_FLAGS_RAID_COMPONENT ), sdev->lun, tr_timeout, tr_method); +if (rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) +ssleep (1 ); +if (pcie_device) +pcie_device_put (pcie_device); + }while ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) + && count++ < command_retry_count); + sas_device_priv_data->block =0 ; +if (rc !=DEVICE_READY ) + sas_device_priv_data->deleted =1 ; +_scsih_internal_device_unblock (sdev, sas_device_priv_data); + +if (rc !=DEVICE_READY ) { +sdev_printk (KERN_WARNING , sdev,"%s: device_offlined,\n" +"handle(0x%04x)\n" , + __func__, sas_device_priv_data->sas_target->handle); +scsi_device_set_state (sdev,SDEV_OFFLINE ); + sas_device =mpt3sas_get_sdev_by_addr (ioc, + sas_device_priv_data->sas_target->sas_address, + sas_device_priv_data->sas_target->port); +if (sas_device) { +_scsih_display_enclosure_chassis_info (NULL , sas_device, sdev,NULL ); +sas_device_put (sas_device); + }else { + pcie_device =mpt3sas_get_pdev_by_wwid (ioc, + sas_device_priv_data->sas_target->sas_address); +if (pcie_device) { +if (pcie_device->enclosure_handle !=0 ) +sdev_printk (KERN_INFO , sdev,"enclosure logical id\n" +"(0x%016llx), slot(%d)\n" , (unsigned long long ) + pcie_device->enclosure_logical_id, + pcie_device->slot); +if (pcie_device->connector_name[0 ] !='\0' ) +sdev_printk (KERN_INFO , sdev,"enclosure level(0x%04x),\n" +" connector name( %s)\n" , + pcie_device->enclosure_level, + pcie_device->connector_name); +pcie_device_put (pcie_device); + } + } + }else +sdev_printk (KERN_WARNING , sdev,"device_unblocked,\n" +"handle(0x%04x)\n" , + sas_device_priv_data->sas_target->handle); } }
@@ -3970,6 +4040,7 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,struct _pcie_device *pcie_device;u8 tr_timeout =30 ;u8 tr_method =0 ; +int count =0 ;/* moving devices from SDEV_OFFLINE to SDEV_BLOCK */ shost_for_each_device (sdev, ioc->shost) {
@@ -4036,7 +4107,8 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,if (pcie_device)pcie_device_put (pcie_device); }while ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA )); + rc ==DEVICE_STOP_UNIT || rc ==DEVICE_RETRY_UA ) + && count++ <= command_retry_count); sas_device_priv_data->block =0 ;if (rc !=DEVICE_READY )
@@ -7771,7 +7843,7 @@ _scsih_report_luns(struct MPT3SAS_ADAPTER *ioc, u16 handle, void *data,kfree (transfer_packet);if ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_RETRY_UA )) + rc ==DEVICE_RETRY_UA ) && retry_count >= command_retry_count) rc =DEVICE_ERROR ;return rc;
@@ -8027,7 +8099,7 @@ _scsih_wait_for_device_to_become_ready(struct MPT3SAS_ADAPTER *ioc, u16 handle, }if ((rc ==DEVICE_RETRY || rc ==DEVICE_START_UNIT || - rc ==DEVICE_RETRY_UA )) + rc ==DEVICE_RETRY_UA ) && retry_count >= command_retry_count) rc =DEVICE_ERROR ;return rc; }
Signature · 1 line
2.47.3
Ranjan Kumar
maintainerPATCH v2 6/6 mpt3sas: Fixed the W=1 compilation warning
In reply to Ranjan KumarFix W=1 compilation warnings.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +4 -4
@@ -843,7 +843,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)/* initialize fault polling */ INIT_DELAYED_WORK (&ioc->fault_reset_work, _base_fault_reset_work); -snprintf (ioc->fault_reset_work_q_name, +scnprintf (ioc->fault_reset_work_q_name,sizeof (ioc->fault_reset_work_q_name),"poll_%s%d_status" , ioc->driver_name, ioc->id); ioc->fault_reset_work_q = alloc_ordered_workqueue(
@@ -3178,7 +3178,7 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index)if (index >= ioc->iopoll_q_start_index) { qid = index - ioc->iopoll_q_start_index; -snprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d-mq-poll%d" , +scnprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d-mq-poll%d" , ioc->driver_name, ioc->id, qid); reply_q->is_iouring_poll_q =1 ; ioc->io_uring_poll_queues[qid].reply_q = reply_q;
@@ -3187,10 +3187,10 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index)if (ioc->msix_enable) -snprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d-msix%d" , +scnprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d-msix%d" , ioc->driver_name, ioc->id, index);else -snprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d" , +scnprintf (reply_q->name,MPT_NAME_LENGTH ,"%s%d" , ioc->driver_name, ioc->id); r =request_irq (pci_irq_vector (pdev, index), _base_interrupt,IRQF_SHARED , reply_q->name, reply_q);
Signature · 1 line
2.47.3
Martin K. Petersen
AppliedRanjan,
Quoted 4 lines
This patch series enhances the mpt3sas driver’s device bring-up, readiness detection, and event recovery mechanisms to improve robustness in environments with slow-responding or transient SAS/PCIe devices.
Applied to 6.20/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 5 lines · Ranjan Kumar
This patch series enhances the mpt3sas driver’s device bring-up, readiness detection, and event recovery mechanisms to improve robustness in environments with slow-responding or transient SAS/PCIe devices.
Quoted 7 lines
The series introduces optional control over issuing TEST UNIT READY (TUR) commands during device unblocking, configurable retry limits, and a mechanism to requeue firmware topology events when devices are temporarily busy. Together, these updates reduce discovery failures and improve recovery reliability following firmware or link events.
[...]
Applied to 6.20/scsi-queue, thanks!
[1/6] mpt3sas: Added no_turs flag to device unblock logic
https://git.kernel.org/mkp/scsi/c/6b553f2a5c84 [3/6] mpt3sas: improve device discovery and readiness handling for slow devices part-2 https://git.kernel.org/mkp/scsi/c/aee682fad6cd [4/6] mpt3sas: Add firmware event requeue support for busy devices https://git.kernel.org/mkp/scsi/c/ad5957193107 [5/6] mpt3sas: Add configurable command retry limit for slow-to-respond devices https://git.kernel.org/mkp/scsi/c/72340fecd0c8 [6/6] mpt3sas: Fixed the W=1 compilation warning https://git.kernel.org/mkp/scsi/c/39680c59f10c
Signature · 1 line
Martin K. Petersen