Commit a9b02c61 authored by Chad Dupuis's avatar Chad Dupuis Committed by David S. Miller

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

MSI-X vector index is determined using qed device information and
affinity to use.
Signed-off-by: default avatarChad Dupuis <cdupuis@marvell.com>
Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2bfbc570
...@@ -2218,16 +2218,21 @@ static void qedf_simd_int_handler(void *cookie) ...@@ -2218,16 +2218,21 @@ static void qedf_simd_int_handler(void *cookie)
static void qedf_sync_free_irqs(struct qedf_ctx *qedf) static void qedf_sync_free_irqs(struct qedf_ctx *qedf)
{ {
int i; int i;
u16 vector_idx = 0;
u32 vector;
if (qedf->int_info.msix_cnt) { if (qedf->int_info.msix_cnt) {
for (i = 0; i < qedf->int_info.used_cnt; i++) { for (i = 0; i < qedf->int_info.used_cnt; i++) {
synchronize_irq(qedf->int_info.msix[i].vector); vector_idx = i * qedf->dev_info.common.num_hwfns +
irq_set_affinity_hint(qedf->int_info.msix[i].vector, qed_ops->common->get_affin_hwfn_idx(qedf->cdev);
NULL); QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
irq_set_affinity_notifier(qedf->int_info.msix[i].vector, "Freeing IRQ #%d vector_idx=%d.\n",
NULL); i, vector_idx);
free_irq(qedf->int_info.msix[i].vector, vector = qedf->int_info.msix[vector_idx].vector;
&qedf->fp_array[i]); synchronize_irq(vector);
irq_set_affinity_hint(vector, NULL);
irq_set_affinity_notifier(vector, NULL);
free_irq(vector, &qedf->fp_array[i]);
} }
} else } else
qed_ops->common->simd_handler_clean(qedf->cdev, qed_ops->common->simd_handler_clean(qedf->cdev,
...@@ -2240,11 +2245,19 @@ static void qedf_sync_free_irqs(struct qedf_ctx *qedf) ...@@ -2240,11 +2245,19 @@ static void qedf_sync_free_irqs(struct qedf_ctx *qedf)
static int qedf_request_msix_irq(struct qedf_ctx *qedf) static int qedf_request_msix_irq(struct qedf_ctx *qedf)
{ {
int i, rc, cpu; int i, rc, cpu;
u16 vector_idx = 0;
u32 vector;
cpu = cpumask_first(cpu_online_mask); cpu = cpumask_first(cpu_online_mask);
for (i = 0; i < qedf->num_queues; i++) { for (i = 0; i < qedf->num_queues; i++) {
rc = request_irq(qedf->int_info.msix[i].vector, vector_idx = i * qedf->dev_info.common.num_hwfns +
qedf_msix_handler, 0, "qedf", &qedf->fp_array[i]); qed_ops->common->get_affin_hwfn_idx(qedf->cdev);
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
"Requesting IRQ #%d vector_idx=%d.\n",
i, vector_idx);
vector = qedf->int_info.msix[vector_idx].vector;
rc = request_irq(vector, qedf_msix_handler, 0, "qedf",
&qedf->fp_array[i]);
if (rc) { if (rc) {
QEDF_WARN(&(qedf->dbg_ctx), "request_irq failed.\n"); QEDF_WARN(&(qedf->dbg_ctx), "request_irq failed.\n");
...@@ -2253,8 +2266,7 @@ static int qedf_request_msix_irq(struct qedf_ctx *qedf) ...@@ -2253,8 +2266,7 @@ static int qedf_request_msix_irq(struct qedf_ctx *qedf)
} }
qedf->int_info.used_cnt++; qedf->int_info.used_cnt++;
rc = irq_set_affinity_hint(qedf->int_info.msix[i].vector, rc = irq_set_affinity_hint(vector, get_cpu_mask(cpu));
get_cpu_mask(cpu));
cpu = cpumask_next(cpu, cpu_online_mask); cpu = cpumask_next(cpu, cpu_online_mask);
} }
...@@ -3211,6 +3223,11 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) ...@@ -3211,6 +3223,11 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
goto err1; goto err1;
} }
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
"dev_info: num_hwfns=%d affin_hwfn_idx=%d.\n",
qedf->dev_info.common.num_hwfns,
qed_ops->common->get_affin_hwfn_idx(qedf->cdev));
/* queue allocation code should come here /* queue allocation code should come here
* order should be * order should be
* slowpath_start * slowpath_start
......
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