Commit d658d98a authored by Padmanabh Ratnakar's avatar Padmanabh Ratnakar Committed by David S. Miller

be2net: assign CPU affinity hints to be2net IRQs

This patch provides hints to irqbalance to map be2net IRQs to
specific CPU cores. cpumask_set_cpu_local_first() 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 avatarPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 41d25fe0
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/u64_stats_sync.h> #include <linux/u64_stats_sync.h>
#include <linux/cpumask.h>
#include "be_hw.h" #include "be_hw.h"
#include "be_roce.h" #include "be_roce.h"
...@@ -183,6 +184,7 @@ struct be_eq_obj { ...@@ -183,6 +184,7 @@ struct be_eq_obj {
u16 spurious_intr; u16 spurious_intr;
struct napi_struct napi; struct napi_struct napi;
struct be_adapter *adapter; struct be_adapter *adapter;
cpumask_var_t affinity_mask;
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
#define BE_EQ_IDLE 0 #define BE_EQ_IDLE 0
......
...@@ -2342,6 +2342,7 @@ static void be_evt_queues_destroy(struct be_adapter *adapter) ...@@ -2342,6 +2342,7 @@ static void be_evt_queues_destroy(struct be_adapter *adapter)
napi_hash_del(&eqo->napi); napi_hash_del(&eqo->napi);
netif_napi_del(&eqo->napi); netif_napi_del(&eqo->napi);
} }
free_cpumask_var(eqo->affinity_mask);
be_queue_free(adapter, &eqo->q); be_queue_free(adapter, &eqo->q);
} }
} }
...@@ -2357,6 +2358,11 @@ static int be_evt_queues_create(struct be_adapter *adapter) ...@@ -2357,6 +2358,11 @@ static int be_evt_queues_create(struct be_adapter *adapter)
adapter->cfg_num_qs); adapter->cfg_num_qs);
for_all_evt_queues(adapter, eqo, i) { for_all_evt_queues(adapter, eqo, i) {
if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))
return -ENOMEM;
cpumask_set_cpu_local_first(i, dev_to_node(&adapter->pdev->dev),
eqo->affinity_mask);
netif_napi_add(adapter->netdev, &eqo->napi, be_poll, netif_napi_add(adapter->netdev, &eqo->napi, be_poll,
BE_NAPI_WEIGHT); BE_NAPI_WEIGHT);
napi_hash_add(&eqo->napi); napi_hash_add(&eqo->napi);
...@@ -3028,6 +3034,8 @@ static int be_msix_register(struct be_adapter *adapter) ...@@ -3028,6 +3034,8 @@ static int be_msix_register(struct be_adapter *adapter)
status = request_irq(vec, be_msix, 0, eqo->desc, eqo); status = request_irq(vec, be_msix, 0, eqo->desc, eqo);
if (status) if (status)
goto err_msix; goto err_msix;
irq_set_affinity_hint(vec, eqo->affinity_mask);
} }
return 0; return 0;
...@@ -3072,7 +3080,7 @@ static void be_irq_unregister(struct be_adapter *adapter) ...@@ -3072,7 +3080,7 @@ static void be_irq_unregister(struct be_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct be_eq_obj *eqo; struct be_eq_obj *eqo;
int i; int i, vec;
if (!adapter->isr_registered) if (!adapter->isr_registered)
return; return;
...@@ -3084,8 +3092,11 @@ static void be_irq_unregister(struct be_adapter *adapter) ...@@ -3084,8 +3092,11 @@ static void be_irq_unregister(struct be_adapter *adapter)
} }
/* MSIx */ /* MSIx */
for_all_evt_queues(adapter, eqo, i) for_all_evt_queues(adapter, eqo, i) {
free_irq(be_msix_vec_get(adapter, eqo), eqo); vec = be_msix_vec_get(adapter, eqo);
irq_set_affinity_hint(vec, NULL);
free_irq(vec, eqo);
}
done: done:
adapter->isr_registered = false; adapter->isr_registered = false;
......
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