summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael Chan <michael.chan@broadcom.com>2024-08-28 20:32:34 +0200
committerJakub Kicinski <kuba@kernel.org>2024-08-30 00:33:25 +0200
commitf049d699aeee219ca33d08b48b7e14d7d86aebd5 (patch)
treeae06f080a85e6e7858a56860ddf9b724639076c2 /drivers/net
parentbnxt_en: Replace deprecated PCI MSIX APIs (diff)
downloadlinux-f049d699aeee219ca33d08b48b7e14d7d86aebd5.tar.xz
linux-f049d699aeee219ca33d08b48b7e14d7d86aebd5.zip
bnxt_en: Allocate the max bp->irq_tbl size for dynamic msix allocation
If dynamic MSIX allocation is supported, additional MSIX can be allocated at run-time without reinitializing the existing MSIX entries. The first step to support this dynamic scheme is to allocate a large enough bp->irq_tbl if dynamic allocation is supported. Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20240828183235.128948-9-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 03598f8e0e07..fa4115f6dafe 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10722,7 +10722,7 @@ static int bnxt_get_num_msix(struct bnxt *bp)
static int bnxt_init_int_mode(struct bnxt *bp)
{
- int i, total_vecs, max, rc = 0, min = 1, ulp_msix, tx_cp;
+ int i, total_vecs, max, rc = 0, min = 1, ulp_msix, tx_cp, tbl_size;
total_vecs = bnxt_get_num_msix(bp);
max = bnxt_get_max_func_irqs(bp);
@@ -10743,7 +10743,10 @@ static int bnxt_init_int_mode(struct bnxt *bp)
goto msix_setup_exit;
}
- bp->irq_tbl = kcalloc(total_vecs, sizeof(struct bnxt_irq), GFP_KERNEL);
+ tbl_size = total_vecs;
+ if (pci_msix_can_alloc_dyn(bp->pdev))
+ tbl_size = max;
+ bp->irq_tbl = kcalloc(tbl_size, sizeof(*bp->irq_tbl), GFP_KERNEL);
if (bp->irq_tbl) {
for (i = 0; i < total_vecs; i++)
bp->irq_tbl[i].vector = pci_irq_vector(bp->pdev, i);