aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/arcmsr/arcmsr_hba.c
diff options
context:
space:
mode:
authorChing Huang <ching2048@areca.com.tw>2014-08-19 02:29:41 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-16 12:39:34 -0400
commit3df824aff935444601101cc329ebe3f52e126a4e (patch)
tree65d46e5879f6e012e528fef4f03f273365dc474f /drivers/scsi/arcmsr/arcmsr_hba.c
parent61cda87f33be22828c3b52863da1c456ba108d37 (diff)
arcmsr: limit max. number of SCSI command request
This patch limits the max. number of SCSI commmand request to avoid command overflow. Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/arcmsr/arcmsr_hba.c')
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index b338a3b05549..ed61ee283a61 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -134,7 +134,7 @@ static struct scsi_host_template arcmsr_scsi_host_template = {
134 .eh_bus_reset_handler = arcmsr_bus_reset, 134 .eh_bus_reset_handler = arcmsr_bus_reset,
135 .bios_param = arcmsr_bios_param, 135 .bios_param = arcmsr_bios_param,
136 .change_queue_depth = arcmsr_adjust_disk_queue_depth, 136 .change_queue_depth = arcmsr_adjust_disk_queue_depth,
137 .can_queue = ARCMSR_MAX_FREECCB_NUM, 137 .can_queue = ARCMSR_MAX_OUTSTANDING_CMD,
138 .this_id = ARCMSR_SCSI_INITIATOR_ID, 138 .this_id = ARCMSR_SCSI_INITIATOR_ID,
139 .sg_tablesize = ARCMSR_DEFAULT_SG_ENTRIES, 139 .sg_tablesize = ARCMSR_DEFAULT_SG_ENTRIES,
140 .max_sectors = ARCMSR_MAX_XFER_SECTORS_C, 140 .max_sectors = ARCMSR_MAX_XFER_SECTORS_C,
@@ -693,7 +693,7 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
693 host->max_lun = ARCMSR_MAX_TARGETLUN; 693 host->max_lun = ARCMSR_MAX_TARGETLUN;
694 host->max_id = ARCMSR_MAX_TARGETID; /*16:8*/ 694 host->max_id = ARCMSR_MAX_TARGETID; /*16:8*/
695 host->max_cmd_len = 16; /*this is issue of 64bit LBA ,over 2T byte*/ 695 host->max_cmd_len = 16; /*this is issue of 64bit LBA ,over 2T byte*/
696 host->can_queue = ARCMSR_MAX_FREECCB_NUM; /* max simultaneous cmds */ 696 host->can_queue = ARCMSR_MAX_OUTSTANDING_CMD;
697 host->cmd_per_lun = ARCMSR_MAX_CMD_PERLUN; 697 host->cmd_per_lun = ARCMSR_MAX_CMD_PERLUN;
698 host->this_id = ARCMSR_SCSI_INITIATOR_ID; 698 host->this_id = ARCMSR_SCSI_INITIATOR_ID;
699 host->unique_id = (bus << 8) | dev_fun; 699 host->unique_id = (bus << 8) | dev_fun;
@@ -2216,9 +2216,6 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
2216 arcmsr_handle_virtual_command(acb, cmd); 2216 arcmsr_handle_virtual_command(acb, cmd);
2217 return 0; 2217 return 0;
2218 } 2218 }
2219 if (atomic_read(&acb->ccboutstandingcount) >=
2220 ARCMSR_MAX_OUTSTANDING_CMD)
2221 return SCSI_MLQUEUE_HOST_BUSY;
2222 ccb = arcmsr_get_freeccb(acb); 2219 ccb = arcmsr_get_freeccb(acb);
2223 if (!ccb) 2220 if (!ccb)
2224 return SCSI_MLQUEUE_HOST_BUSY; 2221 return SCSI_MLQUEUE_HOST_BUSY;
@@ -2428,12 +2425,27 @@ static bool arcmsr_get_hbc_config(struct AdapterControlBlock *pACB)
2428} 2425}
2429static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb) 2426static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
2430{ 2427{
2431 if (acb->adapter_type == ACB_ADAPTER_TYPE_A) 2428 bool rtn = false;
2432 return arcmsr_get_hba_config(acb); 2429
2433 else if (acb->adapter_type == ACB_ADAPTER_TYPE_B) 2430 switch (acb->adapter_type) {
2434 return arcmsr_get_hbb_config(acb); 2431 case ACB_ADAPTER_TYPE_A:
2432 rtn = arcmsr_get_hba_config(acb);
2433 break;
2434 case ACB_ADAPTER_TYPE_B:
2435 rtn = arcmsr_get_hbb_config(acb);
2436 break;
2437 case ACB_ADAPTER_TYPE_C:
2438 rtn = arcmsr_get_hbc_config(acb);
2439 break;
2440 default:
2441 break;
2442 }
2443 if (acb->firm_numbers_queue > ARCMSR_MAX_OUTSTANDING_CMD)
2444 acb->maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD;
2435 else 2445 else
2436 return arcmsr_get_hbc_config(acb); 2446 acb->maxOutstanding = acb->firm_numbers_queue - 1;
2447 acb->host->can_queue = acb->maxOutstanding;
2448 return rtn;
2437} 2449}
2438 2450
2439static int arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, 2451static int arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,