[SCSI] megaraid_sas: Add input parameter for max_sectors

Driver add the input parameters support for max_sectors for megaraid
sas gen2 chip. Customer can set the max_sectors support to 1MB for
gen2 chip during the driver load.

Signed-off-by Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by Yang, Bo and committed by James Bottomley 1fd10685 837f5fe8

+31
+30
drivers/scsi/megaraid/megaraid_sas.c
··· 56 56 MODULE_PARM_DESC(poll_mode_io, 57 57 "Complete cmds from IO path, (default=0)"); 58 58 59 + /* 60 + * Number of sectors per IO command 61 + * Will be set in megasas_init_mfi if user does not provide 62 + */ 63 + static unsigned int max_sectors; 64 + module_param_named(max_sectors, max_sectors, int, 0); 65 + MODULE_PARM_DESC(max_sectors, 66 + "Maximum number of sectors per IO command"); 67 + 59 68 MODULE_LICENSE("GPL"); 60 69 MODULE_VERSION(MEGASAS_VERSION); 61 70 MODULE_AUTHOR("megaraidlinux@lsi.com"); ··· 3595 3586 instance->max_fw_cmds - MEGASAS_INT_CMDS; 3596 3587 host->this_id = instance->init_id; 3597 3588 host->sg_tablesize = instance->max_num_sge; 3589 + /* 3590 + * Check if the module parameter value for max_sectors can be used 3591 + */ 3592 + if (max_sectors && max_sectors < instance->max_sectors_per_req) 3593 + instance->max_sectors_per_req = max_sectors; 3594 + else { 3595 + if (max_sectors) { 3596 + if (((instance->pdev->device == 3597 + PCI_DEVICE_ID_LSI_SAS1078GEN2) || 3598 + (instance->pdev->device == 3599 + PCI_DEVICE_ID_LSI_SAS0079GEN2)) && 3600 + (max_sectors <= MEGASAS_MAX_SECTORS)) { 3601 + instance->max_sectors_per_req = max_sectors; 3602 + } else { 3603 + printk(KERN_INFO "megasas: max_sectors should be > 0" 3604 + "and <= %d (or < 1MB for GEN2 controller)\n", 3605 + instance->max_sectors_per_req); 3606 + } 3607 + } 3608 + } 3609 + 3598 3610 host->max_sectors = instance->max_sectors_per_req; 3599 3611 host->cmd_per_lun = 128; 3600 3612 host->max_channel = MEGASAS_MAX_CHANNELS - 1;
+1
drivers/scsi/megaraid/megaraid_sas.h
··· 706 706 #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ 707 707 MEGASAS_MAX_DEV_PER_CHANNEL) 708 708 709 + #define MEGASAS_MAX_SECTORS (2*1024) 709 710 #define MEGASAS_DBG_LVL 1 710 711 711 712 #define MEGASAS_FW_BUSY 1