Commit 0448f019 authored by Suganath Prabu Subramani's avatar Suganath Prabu Subramani Committed by Martin K. Petersen

scsi: mpt3sas: Configure reply post queue depth, DMA and sgl tablesize.

This configures shost max sector to 128, single reply descriptor post
queue, sgl table size to 16 and 32 bit DMA for MPI Endpoint and it
supports 64K as max IO.
Signed-off-by: default avatarSuganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c520691b
...@@ -2214,6 +2214,9 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2214,6 +2214,9 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
struct sysinfo s; struct sysinfo s;
u64 consistent_dma_mask; u64 consistent_dma_mask;
if (ioc->is_mcpu_endpoint)
goto try_32bit;
if (ioc->dma_mask) if (ioc->dma_mask)
consistent_dma_mask = DMA_BIT_MASK(64); consistent_dma_mask = DMA_BIT_MASK(64);
else else
...@@ -2232,6 +2235,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2232,6 +2235,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
} }
} }
try_32bit:
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
&& !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
ioc->base_add_sg_single = &_base_add_sg_single_32; ioc->base_add_sg_single = &_base_add_sg_single_32;
...@@ -3887,17 +3891,21 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -3887,17 +3891,21 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
sg_tablesize = min_t(unsigned short, sg_tablesize, sg_tablesize = min_t(unsigned short, sg_tablesize,
MPT_KDUMP_MIN_PHYS_SEGMENTS); MPT_KDUMP_MIN_PHYS_SEGMENTS);
if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS) if (ioc->is_mcpu_endpoint)
sg_tablesize = MPT_MIN_PHYS_SEGMENTS; ioc->shost->sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) { else {
sg_tablesize = min_t(unsigned short, sg_tablesize, if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
SG_MAX_SEGMENTS); sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
pr_warn(MPT3SAS_FMT else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
"sg_tablesize(%u) is bigger than kernel" sg_tablesize = min_t(unsigned short, sg_tablesize,
" defined SG_CHUNK_SIZE(%u)\n", ioc->name, SG_MAX_SEGMENTS);
sg_tablesize, MPT_MAX_PHYS_SEGMENTS); pr_warn(MPT3SAS_FMT
"sg_tablesize(%u) is bigger than kernel "
"defined SG_CHUNK_SIZE(%u)\n", ioc->name,
sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
}
ioc->shost->sg_tablesize = sg_tablesize;
} }
ioc->shost->sg_tablesize = sg_tablesize;
ioc->internal_depth = min_t(int, (facts->HighPriorityCredit + (5)), ioc->internal_depth = min_t(int, (facts->HighPriorityCredit + (5)),
(facts->RequestCredit / 4)); (facts->RequestCredit / 4));
...@@ -3982,13 +3990,18 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -3982,13 +3990,18 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
/* reply free queue sizing - taking into account for 64 FW events */ /* reply free queue sizing - taking into account for 64 FW events */
ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
/* calculate reply descriptor post queue depth */ /* mCPU manage single counters for simplicity */
ioc->reply_post_queue_depth = ioc->hba_queue_depth + if (ioc->is_mcpu_endpoint)
ioc->reply_free_queue_depth + 1 ; ioc->reply_post_queue_depth = ioc->reply_free_queue_depth;
/* align the reply post queue on the next 16 count boundary */ else {
if (ioc->reply_post_queue_depth % 16) /* calculate reply descriptor post queue depth */
ioc->reply_post_queue_depth += 16 - ioc->reply_post_queue_depth = ioc->hba_queue_depth +
(ioc->reply_post_queue_depth % 16); ioc->reply_free_queue_depth + 1;
/* align the reply post queue on the next 16 count boundary */
if (ioc->reply_post_queue_depth % 16)
ioc->reply_post_queue_depth += 16 -
(ioc->reply_post_queue_depth % 16);
}
if (ioc->reply_post_queue_depth > if (ioc->reply_post_queue_depth >
facts->MaxReplyDescriptorPostQueueDepth) { facts->MaxReplyDescriptorPostQueueDepth) {
......
...@@ -10521,26 +10521,34 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -10521,26 +10521,34 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
shost->transportt = mpt3sas_transport_template; shost->transportt = mpt3sas_transport_template;
shost->unique_id = ioc->id; shost->unique_id = ioc->id;
if (max_sectors != 0xFFFF) { if (ioc->is_mcpu_endpoint) {
if (max_sectors < 64) { /* mCPU MPI support 64K max IO */
shost->max_sectors = 64; shost->max_sectors = 128;
pr_warn(MPT3SAS_FMT "Invalid value %d passed " \ pr_info(MPT3SAS_FMT
"for max_sectors, range is 64 to 32767. Assigning "
"value of 64.\n", ioc->name, max_sectors);
} else if (max_sectors > 32767) {
shost->max_sectors = 32767;
pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
"for max_sectors, range is 64 to 32767. Assigning "
"default value of 32767.\n", ioc->name,
max_sectors);
} else {
shost->max_sectors = max_sectors & 0xFFFE;
pr_info(MPT3SAS_FMT
"The max_sectors value is set to %d\n", "The max_sectors value is set to %d\n",
ioc->name, shost->max_sectors); ioc->name, shost->max_sectors);
} else {
if (max_sectors != 0xFFFF) {
if (max_sectors < 64) {
shost->max_sectors = 64;
pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
"for max_sectors, range is 64 to 32767. " \
"Assigning value of 64.\n", \
ioc->name, max_sectors);
} else if (max_sectors > 32767) {
shost->max_sectors = 32767;
pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
"for max_sectors, range is 64 to 32767." \
"Assigning default value of 32767.\n", \
ioc->name, max_sectors);
} else {
shost->max_sectors = max_sectors & 0xFFFE;
pr_info(MPT3SAS_FMT
"The max_sectors value is set to %d\n",
ioc->name, shost->max_sectors);
}
} }
} }
/* register EEDP capabilities with SCSI layer */ /* register EEDP capabilities with SCSI layer */
if (prot_mask > 0) if (prot_mask > 0)
scsi_host_set_prot(shost, prot_mask); scsi_host_set_prot(shost, prot_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment