scsi: mpt3sas: Optimize I/O memory consumption in driver.
authorChaitra P B <chaitra.basappa@broadcom.com>
Tue, 24 Apr 2018 09:28:33 +0000 (05:28 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 May 2018 04:34:19 +0000 (00:34 -0400)
commit74522a92bbf003111852d77f1a95d961c1de7baf
treec80eb150c5c8c6360ec14e2928ad267f19179523
parent93204b782a88f2067ff83cb732b66236644c4c56
scsi: mpt3sas: Optimize I/O memory consumption in driver.

For every IO, memory of PAGE size is allocated for handling NVMe native
PRPS. And in addition to that for every IO (chains need per IO * chain
buffer size, e.g. 38 * 128byte) amount of memory is allocated for chain
buffers.

However, at any point of time; the IO request can be for NVMe target
device (where PRP's page is used for framing PRP's) or can be for SCSI
target device (where chain buffers are used for framing chain
SGE's). This patch modifies the driver to reuse same pre-allocated PRP
page buffers as a chain buffer for IO's targeted for SCSI target
devices. No need to allocate separate buffers for chain SGE's buffers.

Suppose if the number of chain buffers need for IO doesn't fit in the
PRP Page size then driver maintain's separate buffers for those extra
chain buffers that exceeds the PRP page size. For example consider PRP
page size as 4K and chain buffer size as 128 bytes, then number of chain
buffers that can fit in PRP page is 4096/128 => 32. if the number of
chain buffer need per IO exceeds 32; for example consider number of
chains need per IO is 36 then for remaining 4 chain buffer's driver
allocates them individual.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c