Skip to content

Commit f3ecbba

Browse files
mchp-memcgowenmartinkpetersen
authored andcommitted
scsi: smartpqi: Add timeout value to RAID path requests to physical devices
Add a timeout value to requests sent to physical devices via the RAID path. A timeout value of zero means wait indefinitely, which may cause the OS to issue Target Management Function (TMF) commands if the device does not respond. For input timeouts of 8 seconds or greater, the value sent to firmware is reduced by 3 seconds to provide an earlier firmware timeout and allow the OS additional time before timing out. This change improves timeout handling between the driver, firmware, and OS, helping to better manage device responsiveness and avoid indefinite waits. Reviewed-by: David Strahan <david.strahan@microchip.com> Reviewed-by: Scott Benesh <scott.benesh@microchip.com> Reviewed-by: Scott Teel <scott.teel@microchip.com> Signed-off-by: Mike McGowen <Mike.McGowen@microchip.com> Signed-off-by: Don Brace <don.brace@microchip.com> Link: https://patch.msgid.link/20251106163823.786828-2-don.brace@microchip.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 3a86608 commit f3ecbba

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5555,14 +5555,25 @@ static void pqi_raid_io_complete(struct pqi_io_request *io_request,
55555555
pqi_scsi_done(scmd);
55565556
}
55575557

5558+
/*
5559+
* Adjust the timeout value for physical devices sent to the firmware
5560+
* by subtracting 3 seconds for timeouts greater than or equal to 8 seconds.
5561+
*
5562+
* This provides the firmware with additional time to attempt early recovery
5563+
* before the OS-level timeout occurs.
5564+
*/
5565+
#define ADJUST_SECS_TIMEOUT_VALUE(tv) (((tv) >= 8) ? ((tv) - 3) : (tv))
5566+
55585567
static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
55595568
struct pqi_scsi_dev *device, struct scsi_cmnd *scmd,
55605569
struct pqi_queue_group *queue_group, bool io_high_prio)
55615570
{
55625571
int rc;
5572+
u32 timeout;
55635573
size_t cdb_length;
55645574
struct pqi_io_request *io_request;
55655575
struct pqi_raid_path_request *request;
5576+
struct request *rq;
55665577

55675578
io_request = pqi_alloc_io_request(ctrl_info, scmd);
55685579
if (!io_request)
@@ -5634,6 +5645,12 @@ static int pqi_raid_submit_io(struct pqi_ctrl_info *ctrl_info,
56345645
return SCSI_MLQUEUE_HOST_BUSY;
56355646
}
56365647

5648+
if (device->is_physical_device) {
5649+
rq = scsi_cmd_to_rq(scmd);
5650+
timeout = rq->timeout / HZ;
5651+
put_unaligned_le32(ADJUST_SECS_TIMEOUT_VALUE(timeout), &request->timeout);
5652+
}
5653+
56375654
pqi_start_io(ctrl_info, queue_group, RAID_PATH, io_request);
56385655

56395656
return 0;

0 commit comments

Comments
 (0)