qedi: Use hwfns and affin_hwfn_idx to get MSI-X vector index

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>
This commit is contained in:
Manish Rangankar 2019-05-26 15:22:29 +03:00 committed by David S. Miller
parent 13b99d3d39
commit 2bfbc57058
1 changed files with 26 additions and 6 deletions

View 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) {