]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
scsi: mpt3sas: As per MPI-spec, use combined reply queue for SAS3.5 controllers when...
authorChaitra P B <chaitra.basappa@broadcom.com>
Mon, 7 Jan 2019 15:21:27 +0000 (13:21 -0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
BugLink: https://bugs.launchpad.net/bugs/1810781
Presently driver is using combined reply queue feature when MSI-x vectors >
8 for both SAS3 and SAS3.5 controllers.  But as per MPI-spec,

1. For SAS3 controllers, driver should use combined reply queue when HBA
supports more than 8 MSI-x vectors.

2. For SAS3.5 controllers, driver should use combined reply queue when HBA
supports more than 16 MSI-x vectors.

Modified driver code to use combined reply queue for SAS3 controllers when
HBA supports > 8 MSI-x vectors and for SAS3.5 controllers when HBA supports
> 16 MSI-x vectors.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2b48be65685a23f4ffc7a06858992bc31e98e198)
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_base.h

index 0eed58e77562aa4b8907b77e74ed040f657f3846..785594cc9f9ac12c9660f05dbba1ec7d6e1c5ff2 100644 (file)
@@ -2527,10 +2527,9 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
        _base_free_irq(ioc);
        _base_disable_msix(ioc);
 
-       if (ioc->combined_reply_queue) {
-               kfree(ioc->replyPostRegisterIndex);
-               ioc->replyPostRegisterIndex = NULL;
-       }
+       kfree(ioc->replyPostRegisterIndex);
+       ioc->replyPostRegisterIndex = NULL;
+
 
        if (ioc->chip_phys) {
                iounmap(ioc->chip);
@@ -2637,7 +2636,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
        /* Use the Combined reply queue feature only for SAS3 C0 & higher
         * revision HBAs and also only when reply queue count is greater than 8
         */
-       if (ioc->combined_reply_queue && ioc->reply_queue_count > 8) {
+       if (ioc->combined_reply_queue) {
                /* Determine the Supplemental Reply Post Host Index Registers
                 * Addresse. Supplemental Reply Post Host Index Registers
                 * starts at offset MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET and
@@ -2661,8 +2660,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
                             MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
                             (i * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET));
                }
-       } else
-               ioc->combined_reply_queue = 0;
+       }
 
        if (ioc->is_warpdrive) {
                ioc->reply_post_host_index[0] = (resource_size_t __iomem *)
@@ -5047,6 +5045,9 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc)
        facts->WhoInit = mpi_reply.WhoInit;
        facts->NumberOfPorts = mpi_reply.NumberOfPorts;
        facts->MaxMSIxVectors = mpi_reply.MaxMSIxVectors;
+       if (ioc->msix_enable && (facts->MaxMSIxVectors <=
+           MAX_COMBINED_MSIX_VECTORS(ioc->is_gen35_ioc)))
+               ioc->combined_reply_queue = 0;
        facts->RequestCredit = le16_to_cpu(mpi_reply.RequestCredit);
        facts->MaxReplyDescriptorPostQueueDepth =
            le16_to_cpu(mpi_reply.MaxReplyDescriptorPostQueueDepth);
index 69022b10a3d89f2572a021a0766147d601527092..2429bb7029f39d5295e025984f0d1a1fe1cf9a38 100644 (file)
  * There are twelve Supplemental Reply Post Host Index Registers
  * and each register is at offset 0x10 bytes from the previous one.
  */
+#define MAX_COMBINED_MSIX_VECTORS(gen35) ((gen35 == 1) ? 16 : 8)
 #define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3    12
 #define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G35   16
 #define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET      (0x10)