Commit 56f0fd80 authored by Vasundhara Volam's avatar Vasundhara Volam Committed by David S. Miller

bnxt_en: assign CPU affinity hints to bnxt_en IRQs

This patch provides hints to irqbalance to map bnxt_en device IRQs
to specific CPU cores. cpumask_local_spread() is used, which first
maps IRQs to near NUMA cores; when those cores are exhausted, IRQs
are mapped to far NUMA cores.
Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 98fdbe73
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <linux/aer.h> #include <linux/aer.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/cpu_rmap.h> #include <linux/cpu_rmap.h>
#include <linux/cpumask.h>
#include "bnxt_hsi.h" #include "bnxt_hsi.h"
#include "bnxt.h" #include "bnxt.h"
...@@ -5554,8 +5555,15 @@ static void bnxt_free_irq(struct bnxt *bp) ...@@ -5554,8 +5555,15 @@ static void bnxt_free_irq(struct bnxt *bp)
for (i = 0; i < bp->cp_nr_rings; i++) { for (i = 0; i < bp->cp_nr_rings; i++) {
irq = &bp->irq_tbl[i]; irq = &bp->irq_tbl[i];
if (irq->requested) if (irq->requested) {
if (irq->have_cpumask) {
irq_set_affinity_hint(irq->vector, NULL);
free_cpumask_var(irq->cpu_mask);
irq->have_cpumask = 0;
}
free_irq(irq->vector, bp->bnapi[i]); free_irq(irq->vector, bp->bnapi[i]);
}
irq->requested = 0; irq->requested = 0;
} }
} }
...@@ -5588,6 +5596,21 @@ static int bnxt_request_irq(struct bnxt *bp) ...@@ -5588,6 +5596,21 @@ static int bnxt_request_irq(struct bnxt *bp)
break; break;
irq->requested = 1; irq->requested = 1;
if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
int numa_node = dev_to_node(&bp->pdev->dev);
irq->have_cpumask = 1;
cpumask_set_cpu(cpumask_local_spread(i, numa_node),
irq->cpu_mask);
rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
if (rc) {
netdev_warn(bp->dev,
"Set affinity failed, IRQ = %d\n",
irq->vector);
break;
}
}
} }
return rc; return rc;
} }
......
...@@ -701,8 +701,10 @@ struct bnxt_napi { ...@@ -701,8 +701,10 @@ struct bnxt_napi {
struct bnxt_irq { struct bnxt_irq {
irq_handler_t handler; irq_handler_t handler;
unsigned int vector; unsigned int vector;
u8 requested; u8 requested:1;
u8 have_cpumask:1;
char name[IFNAMSIZ + 2]; char name[IFNAMSIZ + 2];
cpumask_var_t cpu_mask;
}; };
#define HWRM_RING_ALLOC_TX 0x1 #define HWRM_RING_ALLOC_TX 0x1
......
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