megaraid_sas : Move controller's queue depth calculation in adapter specific function
authorSumit.Saxena@avagotech.com <Sumit.Saxena@avagotech.com>
Thu, 23 Apr 2015 11:00:54 +0000 (16:30 +0530)
committerJames Bottomley <JBottomley@Odin.com>
Mon, 25 May 2015 15:46:27 +0000 (08:46 -0700)
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c

index bdcf2b69778dcddc90e07ca78ffa621042bd4740..762de8ada155358e04e35c5bd7d78bf4c6bd6d21 100644 (file)
@@ -1084,6 +1084,7 @@ enum MR_SCSI_CMD_TYPE {
 #define MEGASAS_SKINNY_INT_CMDS                        5
 #define MEGASAS_FUSION_INTERNAL_CMDS           5
 #define MEGASAS_FUSION_IOCTL_CMDS              3
+#define MEGASAS_MFI_IOCTL_CMDS                 27
 
 #define MEGASAS_MAX_MSIX_QUEUES                        128
 /*
index 1bd32721131d6427c372b0b8d233d3715b358196..dee61e8348fbdcc6cdd4cb70f8cb14eefa665de9 100644 (file)
@@ -4353,6 +4353,21 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
        instance->max_mfi_cmds = instance->max_fw_cmds;
        instance->max_num_sge = (instance->instancet->read_fw_status_reg(reg_set) & 0xFF0000) >>
                                        0x10;
+       /*
+        * For MFI skinny adapters, MEGASAS_SKINNY_INT_CMDS commands
+        * are reserved for IOCTL + driver's internal DCMDs.
+        */
+       if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
+               (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
+               instance->max_scsi_cmds = (instance->max_fw_cmds -
+                       MEGASAS_SKINNY_INT_CMDS);
+               sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS);
+       } else {
+               instance->max_scsi_cmds = (instance->max_fw_cmds -
+                       MEGASAS_INT_CMDS);
+               sema_init(&instance->ioctl_sem, (MEGASAS_MFI_IOCTL_CMDS));
+       }
+
        /*
         * Create a pool of commands
         */
@@ -4788,30 +4803,6 @@ static int megasas_init_fw(struct megasas_instance *instance)
        if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors))
                instance->max_sectors_per_req = tmp_sectors;
 
-       /*
-        * 1. For fusion adapters, 3 commands for IOCTL and 5 commands
-        *    for driver's internal DCMDs.
-        * 2. For MFI skinny adapters, 5 commands for IOCTL + driver's
-        *    internal DCMDs.
-        * 3. For rest of MFI adapters, 27 commands reserved for IOCTLs
-        *    and 5 commands for drivers's internal DCMD.
-        */
-       if (instance->ctrl_context) {
-               instance->max_scsi_cmds = instance->max_fw_cmds -
-                                       (MEGASAS_FUSION_INTERNAL_CMDS +
-                                       MEGASAS_FUSION_IOCTL_CMDS);
-               sema_init(&instance->ioctl_sem, MEGASAS_FUSION_IOCTL_CMDS);
-       } else if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
-               (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
-               instance->max_scsi_cmds = instance->max_fw_cmds -
-                                               MEGASAS_SKINNY_INT_CMDS;
-               sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS);
-       } else {
-               instance->max_scsi_cmds = instance->max_fw_cmds -
-                                               MEGASAS_INT_CMDS;
-               sema_init(&instance->ioctl_sem, (MEGASAS_INT_CMDS - 5));
-       }
-
        /* Check for valid throttlequeuedepth module parameter */
        if (throttlequeuedepth &&
                        throttlequeuedepth <= instance->max_scsi_cmds)
index d38f85e6f26e2d5e86eeeba943de58e101c0dd9c..3e9dd6a7d7d5b061fdfaeaaa247adb3804075ed3 100644 (file)
@@ -1060,6 +1060,15 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
        for (i = 0 ; i < count; i++)
                fusion->last_reply_idx[i] = 0;
 
+       /*
+        * For fusion adapters, 3 commands for IOCTL and 5 commands
+        * for driver's internal DCMDs.
+        */
+       instance->max_scsi_cmds = instance->max_fw_cmds -
+                               (MEGASAS_FUSION_INTERNAL_CMDS +
+                               MEGASAS_FUSION_IOCTL_CMDS);
+       sema_init(&instance->ioctl_sem, MEGASAS_FUSION_IOCTL_CMDS);
+
        /*
         * Allocate memory for descriptors
         * Create a pool of commands