Commit 2bfbc570 authored by Manish Rangankar's avatar Manish Rangankar Committed by David S. Miller

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: default avatarManish Rangankar <mrangankar@marvell.com>
Signed-off-by: default avatarAriel Elior <ariel.elior@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 13b99d3d
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment