ath10k: fix MSI-X registering for qca99x0
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Thu, 17 Sep 2015 06:17:33 +0000 (08:17 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Sun, 27 Sep 2015 12:57:38 +0000 (15:57 +0300)
In case of qca99x0 and MSI-X supported/enabled we
failed during interrupts registering with message:

ath10k_pci 0000:04:00.0: failed to request MSI-X ce irq 50: -22

Issue/fix was reproduced/tested using Dell Latitude E6430 laptop.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/hw.h
drivers/net/wireless/ath/ath10k/pci.c

index 23afcda..bc421a5 100644 (file)
@@ -413,16 +413,6 @@ enum ath10k_hw_rate_cck {
 /* Number of Copy Engines supported */
 #define CE_COUNT ar->hw_values->ce_count
 
-/*
- * Total number of PCIe MSI interrupts requested for all interrupt sources.
- * PCIe standard forces this to be a power of 2.
- * Some Host OS's limit MSI requests that can be granted to 8
- * so for now we abide by this limit and avoid requesting more
- * than that.
- */
-#define MSI_NUM_REQUEST_LOG2   3
-#define MSI_NUM_REQUEST                (1<<MSI_NUM_REQUEST_LOG2)
-
 /*
  * Granted MSIs are assigned as follows:
  * Firmware uses the first
index 1046ab6..110fcad 100644 (file)
@@ -2609,12 +2609,9 @@ static int ath10k_pci_request_irq(struct ath10k *ar)
                return ath10k_pci_request_irq_legacy(ar);
        case 1:
                return ath10k_pci_request_irq_msi(ar);
-       case MSI_NUM_REQUEST:
+       default:
                return ath10k_pci_request_irq_msix(ar);
        }
-
-       ath10k_warn(ar, "unknown irq configuration upon request\n");
-       return -EINVAL;
 }
 
 static void ath10k_pci_free_irq(struct ath10k *ar)
@@ -2657,7 +2654,7 @@ static int ath10k_pci_init_irq(struct ath10k *ar)
 
        /* Try MSI-X */
        if (ath10k_pci_irq_mode == ATH10K_PCI_IRQ_AUTO) {
-               ar_pci->num_msi_intrs = MSI_NUM_REQUEST;
+               ar_pci->num_msi_intrs = MSI_ASSIGN_CE_MAX + 1;
                ret = pci_enable_msi_range(ar_pci->pdev, ar_pci->num_msi_intrs,
                                           ar_pci->num_msi_intrs);
                if (ret > 0)
@@ -2705,18 +2702,13 @@ static int ath10k_pci_deinit_irq(struct ath10k *ar)
        switch (ar_pci->num_msi_intrs) {
        case 0:
                ath10k_pci_deinit_irq_legacy(ar);
-               return 0;
-       case 1:
-               /* fall-through */
-       case MSI_NUM_REQUEST:
-               pci_disable_msi(ar_pci->pdev);
-               return 0;
+               break;
        default:
                pci_disable_msi(ar_pci->pdev);
+               break;
        }
 
-       ath10k_warn(ar, "unknown irq configuration upon deinit\n");
-       return -EINVAL;
+       return 0;
 }
 
 static int ath10k_pci_wait_for_target_init(struct ath10k *ar)