]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
qedi: Use hwfns and affin_hwfn_idx to get MSI-X vector index
authorManish Rangankar <mrangankar@marvell.com>
Sun, 26 May 2019 12:22:29 +0000 (15:22 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 26 May 2019 20:04:12 +0000 (13:04 -0700)
MSI-X vector index is determined using qed device information and
affinity to use.

Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/scsi/qedi/qedi_main.c

index f07e0814a6578974f25f000e6ff8965ce28b0b4a..1a62ab0867ef30a6e320d690d9f3e67d47b073e7 100644 (file)
@@ -1313,13 +1313,20 @@ static void qedi_simd_int_handler(void *cookie)
 static void qedi_sync_free_irqs(struct qedi_ctx *qedi)
 {
        int i;
+       u16 idx;
 
        if (qedi->int_info.msix_cnt) {
                for (i = 0; i < qedi->int_info.used_cnt; i++) {
-                       synchronize_irq(qedi->int_info.msix[i].vector);
-                       irq_set_affinity_hint(qedi->int_info.msix[i].vector,
+                       idx = i * qedi->dev_info.common.num_hwfns +
+                       qedi_ops->common->get_affin_hwfn_idx(qedi->cdev);
+
+                       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                                 "Freeing IRQ #%d vector_idx=%d.\n", i, idx);
+
+                       synchronize_irq(qedi->int_info.msix[idx].vector);
+                       irq_set_affinity_hint(qedi->int_info.msix[idx].vector,
                                              NULL);
-                       free_irq(qedi->int_info.msix[i].vector,
+                       free_irq(qedi->int_info.msix[idx].vector,
                                 &qedi->fp_array[i]);
                }
        } else {
@@ -1334,20 +1341,28 @@ static void qedi_sync_free_irqs(struct qedi_ctx *qedi)
 static int qedi_request_msix_irq(struct qedi_ctx *qedi)
 {
        int i, rc, cpu;
+       u16 idx;
 
        cpu = cpumask_first(cpu_online_mask);
        for (i = 0; i < MIN_NUM_CPUS_MSIX(qedi); i++) {
-               rc = request_irq(qedi->int_info.msix[i].vector,
+               idx = i * qedi->dev_info.common.num_hwfns +
+                         qedi_ops->common->get_affin_hwfn_idx(qedi->cdev);
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "dev_info: num_hwfns=%d affin_hwfn_idx=%d.\n",
+                         qedi->dev_info.common.num_hwfns,
+                         qedi_ops->common->get_affin_hwfn_idx(qedi->cdev));
+
+               rc = request_irq(qedi->int_info.msix[idx].vector,
                                 qedi_msix_handler, 0, "qedi",
                                 &qedi->fp_array[i]);
-
                if (rc) {
                        QEDI_WARN(&qedi->dbg_ctx, "request_irq failed.\n");
                        qedi_sync_free_irqs(qedi);
                        return rc;
                }
                qedi->int_info.used_cnt++;
-               rc = irq_set_affinity_hint(qedi->int_info.msix[i].vector,
+               rc = irq_set_affinity_hint(qedi->int_info.msix[idx].vector,
                                           get_cpu_mask(cpu));
                cpu = cpumask_next(cpu, cpu_online_mask);
        }
@@ -2415,6 +2430,11 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
        if (rc)
                goto free_host;
 
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "dev_info: num_hwfns=%d affin_hwfn_idx=%d.\n",
+                 qedi->dev_info.common.num_hwfns,
+                 qedi_ops->common->get_affin_hwfn_idx(qedi->cdev));
+
        if (mode != QEDI_MODE_RECOVERY) {
                rc = qedi_set_iscsi_pf_param(qedi);
                if (rc) {