Blob Blame History Raw
From: Justin Tee <justin.tee@broadcom.com>
Date: Mon, 9 Jan 2023 15:33:09 -0800
Subject: scsi: lpfc: Set max DMA segment size to HBA supported SGE length
Patch-mainline: v6.3-rc1
Git-commit: b5c894cf430e779826612cf2acb508d78bf210ce
References: bsc#1208607

During I/O, the following warning message occasionally appears:

DMA-API: lpfc 0000:04:00.0: mapping sg segment longer than device claims to
support [len=131072] [max=65536]

The HBA is capable of supporting 131,072 bytes, so notify DMA layer via the
dma_set_max_seg_size() API during hba initialization.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/lpfc/lpfc_init.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -13905,6 +13905,13 @@ lpfc_get_sli4_parameters(struct lpfc_hba
 	if (sli4_params->sge_supp_len > LPFC_MAX_SGE_SIZE)
 		sli4_params->sge_supp_len = LPFC_MAX_SGE_SIZE;
 
+	rc = dma_set_max_seg_size(&phba->pcidev->dev, sli4_params->sge_supp_len);
+	if (unlikely(rc)) {
+		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+				"6400 Can't set dma maximum segment size\n");
+		return rc;
+	}
+
 	/*
 	 * Check whether the adapter supports an embedded copy of the
 	 * FCP CMD IU within the WQE for FCP_Ixxx commands. In order