From: Suganath prabu Subaramani <suganath-prabu.subramani@avagotech.com>
To: JBottomley@Parallels.com, jejb@kernel.org, hch@infradead.org
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
Sathya.Prakash@avagotech.com, kashyap.desai@avagotech.com,
krishnaraddi.mankani@avagotech.com, linux-kernel@vger.kernel.org,
suganath-prabu.subramani@avagotech.com,
chaitra.basappa@avagotech.com, sreekanth.reddy@avagotech.com
Subject: [mpt3sas driver 07/10] mpt3sas: Add support for configurable Chain Frame Size
Date: Thu, 28 Jan 2016 12:07:04 +0530 [thread overview]
Message-ID: <1453963027-19770-8-git-send-email-suganath-prabu.subramani@avagotech.com> (raw)
In-Reply-To: <1453963027-19770-1-git-send-email-suganath-prabu.subramani@avagotech.com>
From: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
Added support for configurable Chain Frame Size. Calculate the
Chain Message Frame size from the IOCMaxChainSegementSize (iocfacts).
Applicable only for mpt3sas/SAS3.0 HBA's.
Signed-off-by: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
Signed-off-by: Chaitra P B <chaitra.basappa@avagotech.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 27 ++++++++++++++++++++++-----
drivers/scsi/mpt3sas/mpt3sas_base.h | 8 +++++++-
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index a1a3b39..0f623fb 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3248,6 +3248,19 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
/* reply frame size */
ioc->reply_sz = facts->ReplyFrameSize * 4;
+ /* chain segment size */
+ if (ioc->hba_mpi_version_belonged != MPI2_VERSION) {
+ if (facts->IOCMaxChainSegmentSize)
+ ioc->chain_segment_sz =
+ facts->IOCMaxChainSegmentSize *
+ MAX_CHAIN_ELEMT_SZ;
+ else
+ /* set to 128 bytes size if IOCMaxChainSegmentSize is zero */
+ ioc->chain_segment_sz = DEFAULT_NUM_FWCHAIN_ELEMTS *
+ MAX_CHAIN_ELEMT_SZ;
+ } else
+ ioc->chain_segment_sz = ioc->request_sz;
+
/* calculate the max scatter element size */
sge_size = max_t(u16, ioc->sge_size, ioc->sge_size_ieee);
@@ -3259,7 +3272,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
ioc->max_sges_in_main_message = max_sge_elements/sge_size;
/* now do the same for a chain buffer */
- max_sge_elements = ioc->request_sz - sge_size;
+ max_sge_elements = ioc->chain_segment_sz - sge_size;
ioc->max_sges_in_chain_message = max_sge_elements/sge_size;
/*
@@ -3451,7 +3464,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
goto out;
}
ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev,
- ioc->request_sz, 16, 0);
+ ioc->chain_segment_sz, 16, 0);
if (!ioc->chain_dma_pool) {
pr_err(MPT3SAS_FMT "chain_dma_pool: pci_pool_create failed\n",
ioc->name);
@@ -3465,13 +3478,13 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
ioc->chain_depth = i;
goto chain_done;
}
- total_sz += ioc->request_sz;
+ total_sz += ioc->chain_segment_sz;
}
chain_done:
dinitprintk(ioc, pr_info(MPT3SAS_FMT
"chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",
- ioc->name, ioc->chain_depth, ioc->request_sz,
- ((ioc->chain_depth * ioc->request_sz))/1024));
+ ioc->name, ioc->chain_depth, ioc->chain_segment_sz,
+ ((ioc->chain_depth * ioc->chain_segment_sz))/1024));
/* initialize hi-priority queue smid's */
ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth,
@@ -4332,6 +4345,10 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
facts->FWVersion.Word = le32_to_cpu(mpi_reply.FWVersion.Word);
facts->IOCRequestFrameSize =
le16_to_cpu(mpi_reply.IOCRequestFrameSize);
+ if (ioc->hba_mpi_version_belonged != MPI2_VERSION) {
+ facts->IOCMaxChainSegmentSize =
+ le16_to_cpu(mpi_reply.IOCMaxChainSegmentSize);
+ }
facts->MaxInitiators = le16_to_cpu(mpi_reply.MaxInitiators);
facts->MaxTargets = le16_to_cpu(mpi_reply.MaxTargets);
ioc->shost->max_id = -1;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 4b52a07..d1fee34 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -129,6 +129,9 @@
#define MPT3SAS_INVALID_DEVICE_HANDLE 0xFFFF
+#define MAX_CHAIN_ELEMT_SZ 16
+#define DEFAULT_NUM_FWCHAIN_ELEMTS 8
+
/*
* reset phases
*/
@@ -759,7 +762,7 @@ struct mpt3sas_facts {
u32 IOCCapabilities;
union mpi3_version_union FWVersion;
u16 IOCRequestFrameSize;
- u16 Reserved3;
+ u16 IOCMaxChainSegmentSize;
u16 MaxInitiators;
u16 MaxTargets;
u16 MaxSasExpanders;
@@ -906,6 +909,8 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
* @max_sges_in_chain_message: number sg elements per chain
* @chains_needed_per_io: max chains per io
* @chain_depth: total chains allocated
+ * @chain_segment_sz: gives the max number of
+ * SGEs accommodate on single chain buffer
* @hi_priority_smid:
* @hi_priority:
* @hi_priority_dma:
@@ -1113,6 +1118,7 @@ struct MPT3SAS_ADAPTER {
u16 max_sges_in_chain_message;
u16 chains_needed_per_io;
u32 chain_depth;
+ u16 chain_segment_sz;
/* hi-priority queue */
u16 hi_priority_smid;
--
1.8.3.1
next prev parent reply other threads:[~2016-01-28 6:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 6:36 [mpt3sas driver patches 00/10] mpt3sas driver enhancements and Suganath prabu Subaramani
2016-01-28 6:36 ` [mpt3sas driver 01/10] mpt3sas: Added support for high port count HBA variants Suganath prabu Subaramani
2016-02-04 14:14 ` Tomas Henzl
2016-01-28 6:36 ` [mpt3sas driver 02/10] mpt3sas: Used IEEE SGL instead of MPI SGL while framing a SMP Passthrough request message Suganath prabu Subaramani
2016-01-28 9:16 ` Christoph Hellwig
2016-02-04 14:18 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 03/10] mpt3sas: Fix static analyzer(coverity) tool identified defects Suganath prabu Subaramani
2016-02-04 14:18 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 04/10] mpt3sas: Never block the Enclosure device Suganath prabu Subaramani
2016-02-04 14:19 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 05/10] mpt3sas: Make use of additional HighPriority credit message frames for sending SCSI IO's Suganath prabu Subaramani
2016-02-04 14:24 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter Suganath prabu Subaramani
2016-02-04 15:01 ` Tomas Henzl
2016-02-08 6:01 ` Suganath Prabu Subramani
2016-02-08 12:38 ` Tomas Henzl
2016-01-28 6:37 ` Suganath prabu Subaramani [this message]
2016-02-04 15:05 ` [mpt3sas driver 07/10] mpt3sas: Add support for configurable Chain Frame Size Tomas Henzl
2016-02-05 7:56 ` Sreekanth Reddy
2016-02-08 13:55 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 08/10] mpt3sas: Updated MPI Header to 2.00.42 Suganath prabu Subaramani
2016-02-04 15:06 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 09/10] mpt3sas: Fix for Asynchronous completion of timedout IO and task abort of timedout IO Suganath prabu Subaramani
2016-02-04 15:07 ` Tomas Henzl
2016-01-28 6:37 ` [mpt3sas driver 10/10] mpt3sas: Updating mpt3sas driver version to 12.100.00.00 Suganath prabu Subaramani
2016-02-04 15:08 ` Tomas Henzl
2016-02-05 2:04 ` [mpt3sas driver patches 00/10] mpt3sas driver enhancements and Martin K. Petersen
2016-02-10 17:20 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453963027-19770-8-git-send-email-suganath-prabu.subramani@avagotech.com \
--to=suganath-prabu.subramani@avagotech.com \
--cc=JBottomley@Parallels.com \
--cc=Sathya.Prakash@avagotech.com \
--cc=chaitra.basappa@avagotech.com \
--cc=hch@infradead.org \
--cc=jejb@kernel.org \
--cc=kashyap.desai@avagotech.com \
--cc=krishnaraddi.mankani@avagotech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sreekanth.reddy@avagotech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).