From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org,
Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Subject: [PATCH net-next 03/11] bnxt_en: assign CPU affinity hints to bnxt_en IRQs
Date: Mon, 28 Aug 2017 13:40:27 -0400 [thread overview]
Message-ID: <1503942035-24924-4-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1503942035-24924-1-git-send-email-michael.chan@broadcom.com>
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
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: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 25 ++++++++++++++++++++++++-
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +++-
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4b0a807..9657bfb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -49,6 +49,7 @@
#include <linux/aer.h>
#include <linux/bitmap.h>
#include <linux/cpu_rmap.h>
+#include <linux/cpumask.h>
#include "bnxt_hsi.h"
#include "bnxt.h"
@@ -5554,8 +5555,15 @@ static void bnxt_free_irq(struct bnxt *bp)
for (i = 0; i < bp->cp_nr_rings; 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]);
+ }
+
irq->requested = 0;
}
}
@@ -5588,6 +5596,21 @@ static int bnxt_request_irq(struct bnxt *bp)
break;
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;
}
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 568516f..801c0f7 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -701,8 +701,10 @@ struct bnxt_napi {
struct bnxt_irq {
irq_handler_t handler;
unsigned int vector;
- u8 requested;
+ u8 requested:1;
+ u8 have_cpumask:1;
char name[IFNAMSIZ + 2];
+ cpumask_var_t cpu_mask;
};
#define HWRM_RING_ALLOC_TX 0x1
--
1.8.3.1
next prev parent reply other threads:[~2017-08-28 17:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 17:40 [PATCH net-next 00/11] bnxt_en: Updates Michael Chan
2017-08-28 17:40 ` [PATCH net-next 01/11] bnxt_en: Update firmware interface spec. to 1.8.1.4 Michael Chan
2017-08-28 17:40 ` [PATCH net-next 02/11] bnxt_en: Improve tx ring reservation logic Michael Chan
2017-08-28 17:40 ` Michael Chan [this message]
2017-08-28 17:40 ` [PATCH net-next 04/11] bnxt: Add PCIe device IDs for bcm58802/bcm58808 Michael Chan
2017-08-28 17:40 ` [PATCH net-next 05/11] bnxt: initialize board_info values with proper enums Michael Chan
2017-08-28 17:40 ` [PATCH net-next 06/11] bnxt_en: Improve -ENOMEM logic in NAPI poll loop Michael Chan
2017-08-28 19:05 ` Martin KaFai Lau
2017-08-28 17:40 ` [PATCH net-next 07/11] bnxt_en: Reduce default rings on multi-port cards Michael Chan
2017-08-28 17:40 ` [PATCH net-next 08/11] bnxt_en: fix clearing devlink ptr from bnxt struct Michael Chan
2017-08-28 17:40 ` [PATCH net-next 09/11] bnxt_en: bnxt: add TC flower filter offload support Michael Chan
2017-09-11 13:36 ` Jiri Pirko
[not found] ` <CAKvpyk1iV4z_f7cUA8DL1nU772hPtiZC4MtjA9t=S5J=8EcD-A@mail.gmail.com>
2017-09-18 9:52 ` Jiri Pirko
2017-08-28 17:40 ` [PATCH net-next 10/11] bnxt_en: add TC flower offload flow_alloc/free FW cmds Michael Chan
2017-08-28 17:40 ` [PATCH net-next 11/11] bnxt_en: add code to query TC flower offload stats Michael Chan
2017-08-28 23:57 ` [PATCH net-next 00/11] bnxt_en: Updates David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1503942035-24924-4-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=vasundhara-v.volam@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.