From 8baf75dd36d8e311434162c6a2c74a45262dc0d4 Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Thu, 6 Dec 2018 21:34:42 +0800 Subject: [PATCH 16/31] scsi: hisi_sas: Make sg_tablesize consistent value Origin: https://git.kernel.org/linus/6db831f4ef764ca19d7300d56ab9455af3cb930d Sht->sg_tablesize is set in the driver, and it will be assigned to shost->sg_tablesize in SCSI mid-layer. So it is not necessary to assign shost->sg_table one more time in the driver. In addition to the change, change each scsi_host_template.sg_tablesize to HISI_SAS_SGE_PAGE_CNT instead of SG_ALL. Signed-off-by: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen --- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-) Index: linux/drivers/scsi/hisi_sas/hisi_sas_main.c =================================================================== --- linux.orig/drivers/scsi/hisi_sas/hisi_sas_main.c +++ linux/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2426,7 +2426,6 @@ int hisi_sas_probe(struct platform_devic shost->max_lun = ~0; shost->max_channel = 1; shost->max_cmd_len = 16; - shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT); if (hisi_hba->hw->slot_index_alloc) { shost->can_queue = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries; Index: linux/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c =================================================================== --- linux.orig/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ linux/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1814,7 +1814,7 @@ static struct scsi_host_template sht_v1_ .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, Index: linux/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c =================================================================== --- linux.orig/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ linux/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3576,7 +3576,7 @@ static struct scsi_host_template sht_v2_ .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, Index: linux/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c =================================================================== --- linux.orig/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ linux/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2229,7 +2229,7 @@ static struct scsi_host_template sht_v3_ .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, @@ -2371,7 +2371,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, shost->max_lun = ~0; shost->max_channel = 1; shost->max_cmd_len = 16; - shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT); shost->can_queue = hisi_hba->hw->max_command_entries - HISI_SAS_RESERVED_IPTT_CNT; shost->cmd_per_lun = hisi_hba->hw->max_command_entries -