Skip to contentSkip to conversation

mpt3sas: Few enhancements and fixes

PATCH Applied Sreekanth Reddy 2 participants 6 messages Aug 25, 2022 – Sep 1, 2022

Subsystems (2)
lore
Share & tools
lore

Sreekanth Reddy

author maintainer
#0 lore raw

v2 cover mpt3sas: Few enhancements and fixes

Few enhancements and fixes of mpt3sas driver.

V2:
Updated the patch description for patch 3/4

Sreekanth Reddy (4):
mpt3sas: Don't change dma mask while reallocating pools
mpt3sas: Fix trace buffer registration failed
mpt3sas: Increase cmd_per_lun to 128
mpt3sas: Update driver version to 43.100.00.00

 drivers/scsi/mpt3sas/mpt3sas_base.c  | 21 ++++++++++++++-------
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  4 ++--
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |  4 ++++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  2 +-
 4 files changed, 21 insertions(+), 10 deletions(-)
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH v2 1/4 mpt3sas: Don't change dma mask while reallocating pools

When a pool crosses the 4gb boundary region then before reallocation pools just change the coherent dma mask to 32bit and keep the normal dma mask to 63/64 bit.

---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +14 -7
index eeebe80..f8a3b0d 100644
@@ -2990,19 +2990,26 @@ static int
 _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
 {
 	struct sysinfo s;
+	u64 coherent_dma_mask, dma_mask;
 
-	if (ioc->is_mcpu_endpoint ||
-	    sizeof(dma_addr_t) == 4 || ioc->use_32bit_dma ||
-	    dma_get_required_mask(&pdev->dev) <= 32)
+	if (ioc->is_mcpu_endpoint || sizeof(dma_addr_t) == 4 ||
+	    dma_get_required_mask(&pdev->dev) <= 32) {
 		ioc->dma_mask = 32;
+		coherent_dma_mask = dma_mask = DMA_BIT_MASK(32);
 	/* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */
-	else if (ioc->hba_mpi_version_belonged > MPI2_VERSION)
+	} else if (ioc->hba_mpi_version_belonged > MPI2_VERSION) {
 		ioc->dma_mask = 63;
-	else
+		coherent_dma_mask = dma_mask = DMA_BIT_MASK(63);
+	} else {
 		ioc->dma_mask = 64;
+		coherent_dma_mask = dma_mask = DMA_BIT_MASK(64);
+	}
+
+	if (ioc->use_32bit_dma)
+		coherent_dma_mask = DMA_BIT_MASK(32);
 
-	if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(ioc->dma_mask)) ||
-	    dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(ioc->dma_mask)))
+	if (dma_set_mask(&pdev->dev, dma_mask) ||
+	    dma_set_coherent_mask(&pdev->dev, coherent_dma_mask))
 		return -ENODEV;
 
 	if (ioc->dma_mask > 32) {
Signature · 1 line
2.27.0
author maintainer
#2 lore raw

PATCH v2 2/4 mpt3sas: Fix trace buffer registration failed

In reply to Sreekanth Reddy

The ExtendedType field was set to one in the diag buffer register command and hence MPT Endpoint firmware is failing the request with Invalid Field IOCStatus.

So, memset the request frame to zero before framing the diag buffer register command.

---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_ctl.c +4 -0
index c47da95..0d8b1e9 100644
@@ -1694,6 +1694,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
 	ioc->ctl_cmds.status = MPT3_CMD_PENDING;
 	memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz);
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+	memset(mpi_request, 0, ioc->request_sz);
 	ioc->ctl_cmds.smid = smid;
 
 	request_data = ioc->diag_buffer[buffer_type];
@@ -1795,6 +1796,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
 	if (rc && request_data) {
 		dma_free_coherent(&ioc->pdev->dev, request_data_sz,
 		    request_data, request_data_dma);
+		ioc->diag_buffer[buffer_type] = NULL;
 		ioc->diag_buffer_status[buffer_type] &=
 		    ~MPT3_DIAG_BUFFER_IS_DRIVER_ALLOCATED;
 	}
@@ -2171,6 +2173,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
 	ioc->ctl_cmds.status = MPT3_CMD_PENDING;
 	memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz);
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+	memset(mpi_request, 0, ioc->request_sz);
 	ioc->ctl_cmds.smid = smid;
 
 	mpi_request->Function = MPI2_FUNCTION_DIAG_RELEASE;
@@ -2425,6 +2428,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
 	ioc->ctl_cmds.status = MPT3_CMD_PENDING;
 	memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz);
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+	memset(mpi_request, 0, ioc->request_sz);
 	ioc->ctl_cmds.smid = smid;
 
 	mpi_request->Function = MPI2_FUNCTION_DIAG_BUFFER_POST;
Signature · 1 line
2.27.0
author maintainer
#3 lore raw

PATCH v2 3/4 mpt3sas: Increase cmd_per_lun to 128

In reply to Sreekanth Reddy

With cmd_per_lun value 7, a higher number of cache lines (map_nr) are needed while allocating sdev->budget_map which is not reasonable and hence increasing the cmd_per_lun value to 128.

---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 -1
index 3507e2a..4ce1c01 100644
@@ -11975,7 +11975,7 @@ static struct scsi_host_template mpt3sas_driver_template = {
 	.sg_tablesize			= MPT3SAS_SG_DEPTH,
 	.max_sectors			= 32767,
 	.max_segment_size		= 0xffffffff,
-	.cmd_per_lun			= 7,
+	.cmd_per_lun			= 128,
 	.shost_groups			= mpt3sas_host_groups,
 	.sdev_groups			= mpt3sas_dev_groups,
 	.track_queue_depth		= 1,
Signature · 1 line
2.27.0
author maintainer
#4 lore raw

PATCH v2 4/4 mpt3sas: Update driver version to 43.100.00.00

In reply to Sreekanth Reddy

Update driver version to 43.100.00.00.

---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.h +2 -2
index 542fb74..05364aa 100644
@@ -77,8 +77,8 @@
 #define MPT3SAS_DRIVER_NAME		"mpt3sas"
 #define MPT3SAS_AUTHOR "Avago Technologies <[email protected]>"
 #define MPT3SAS_DESCRIPTION	"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION		"42.100.00.00"
-#define MPT3SAS_MAJOR_VERSION		42
+#define MPT3SAS_DRIVER_VERSION		"43.100.00.00"
+#define MPT3SAS_MAJOR_VERSION		43
 #define MPT3SAS_MINOR_VERSION		100
 #define MPT3SAS_BUILD_VERSION		0
 #define MPT3SAS_RELEASE_VERSION	00
Signature · 1 line
2.27.0