scsi: arcmsr: Configure the default command timeout value

Allow configuring the default command timeout value for devices attached to
arcmsr controllers.

Link: https://lore.kernel.org/r/27c0cda7fd103f05021adaf67490e9298ed5cc3f.camel@areca.com.tw
Signed-off-by: ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
ching Huang 2020-10-27 11:31:31 +08:00 committed by Martin K. Petersen
parent 61906fd465
commit 4f1826b8e5
2 changed files with 17 additions and 0 deletions

View File

@ -83,6 +83,7 @@ struct device_attribute;
#define PCI_DEVICE_ID_ARECA_1886 0x188A #define PCI_DEVICE_ID_ARECA_1886 0x188A
#define ARCMSR_HOURS (1000 * 60 * 60 * 4) #define ARCMSR_HOURS (1000 * 60 * 60 * 4)
#define ARCMSR_MINUTES (1000 * 60 * 60) #define ARCMSR_MINUTES (1000 * 60 * 60)
#define ARCMSR_DEFAULT_TIMEOUT 90
/* /*
********************************************************************************** **********************************************************************************
** **

View File

@ -99,6 +99,10 @@ static int set_date_time = 0;
module_param(set_date_time, int, S_IRUGO); module_param(set_date_time, int, S_IRUGO);
MODULE_PARM_DESC(set_date_time, " send date, time to iop(0 ~ 1), set_date_time=1(enable), default(=0) is disable"); MODULE_PARM_DESC(set_date_time, " send date, time to iop(0 ~ 1), set_date_time=1(enable), default(=0) is disable");
static int cmd_timeout = ARCMSR_DEFAULT_TIMEOUT;
module_param(cmd_timeout, int, S_IRUGO);
MODULE_PARM_DESC(cmd_timeout, " scsi cmd timeout(0 ~ 120 sec.), default is 90");
#define ARCMSR_SLEEPTIME 10 #define ARCMSR_SLEEPTIME 10
#define ARCMSR_RETRYCOUNT 12 #define ARCMSR_RETRYCOUNT 12
@ -140,6 +144,7 @@ static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
static void arcmsr_free_irq(struct pci_dev *, struct AdapterControlBlock *); static void arcmsr_free_irq(struct pci_dev *, struct AdapterControlBlock *);
static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb); static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb);
static void arcmsr_set_iop_datetime(struct timer_list *); static void arcmsr_set_iop_datetime(struct timer_list *);
static int arcmsr_slave_config(struct scsi_device *sdev);
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, int queue_depth) static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, int queue_depth)
{ {
if (queue_depth > ARCMSR_MAX_CMD_PERLUN) if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
@ -155,6 +160,7 @@ static struct scsi_host_template arcmsr_scsi_host_template = {
.eh_abort_handler = arcmsr_abort, .eh_abort_handler = arcmsr_abort,
.eh_bus_reset_handler = arcmsr_bus_reset, .eh_bus_reset_handler = arcmsr_bus_reset,
.bios_param = arcmsr_bios_param, .bios_param = arcmsr_bios_param,
.slave_configure = arcmsr_slave_config,
.change_queue_depth = arcmsr_adjust_disk_queue_depth, .change_queue_depth = arcmsr_adjust_disk_queue_depth,
.can_queue = ARCMSR_DEFAULT_OUTSTANDING_CMD, .can_queue = ARCMSR_DEFAULT_OUTSTANDING_CMD,
.this_id = ARCMSR_SCSI_INITIATOR_ID, .this_id = ARCMSR_SCSI_INITIATOR_ID,
@ -3256,6 +3262,16 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
static DEF_SCSI_QCMD(arcmsr_queue_command) static DEF_SCSI_QCMD(arcmsr_queue_command)
static int arcmsr_slave_config(struct scsi_device *sdev)
{
unsigned int dev_timeout;
dev_timeout = sdev->request_queue->rq_timeout;
if ((cmd_timeout > 0) && ((cmd_timeout * HZ) > dev_timeout))
blk_queue_rq_timeout(sdev->request_queue, cmd_timeout * HZ);
return 0;
}
static void arcmsr_get_adapter_config(struct AdapterControlBlock *pACB, uint32_t *rwbuffer) static void arcmsr_get_adapter_config(struct AdapterControlBlock *pACB, uint32_t *rwbuffer)
{ {
int count; int count;