Commit 4c8bb609 authored by Igor Russkikh's avatar Igor Russkikh Committed by David S. Miller

net: aquantia: Limit number of MSIX irqs to the number of cpus

There is no much practical use from having MSIX vectors more that number
of cpus, thus cap this first with preconfigured limit, then with number
of cpus online.
Signed-off-by: default avatarPavel Belous <pavel.belous@aquantia.com>
Signed-off-by: default avatarIgor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93d87b8f
...@@ -85,6 +85,7 @@ int aq_pci_func_init(struct aq_pci_func_s *self) ...@@ -85,6 +85,7 @@ int aq_pci_func_init(struct aq_pci_func_s *self)
int err = 0; int err = 0;
unsigned int bar = 0U; unsigned int bar = 0U;
unsigned int port = 0U; unsigned int port = 0U;
unsigned int numvecs = 0U;
err = pci_enable_device(self->pdev); err = pci_enable_device(self->pdev);
if (err < 0) if (err < 0)
...@@ -142,10 +143,12 @@ int aq_pci_func_init(struct aq_pci_func_s *self) ...@@ -142,10 +143,12 @@ int aq_pci_func_init(struct aq_pci_func_s *self)
} }
} }
/*enable interrupts */ numvecs = min((u8)AQ_CFG_VECS_DEF, self->aq_hw_caps.msix_irqs);
numvecs = min(numvecs, num_online_cpus());
/* enable interrupts */
#if !AQ_CFG_FORCE_LEGACY_INT #if !AQ_CFG_FORCE_LEGACY_INT
err = pci_alloc_irq_vectors(self->pdev, self->aq_hw_caps.msix_irqs, err = pci_alloc_irq_vectors(self->pdev, numvecs, numvecs, PCI_IRQ_MSIX);
self->aq_hw_caps.msix_irqs, PCI_IRQ_MSIX);
if (err < 0) { if (err < 0) {
err = pci_alloc_irq_vectors(self->pdev, 1, 1, err = pci_alloc_irq_vectors(self->pdev, 1, 1,
...@@ -153,7 +156,7 @@ int aq_pci_func_init(struct aq_pci_func_s *self) ...@@ -153,7 +156,7 @@ int aq_pci_func_init(struct aq_pci_func_s *self)
if (err < 0) if (err < 0)
goto err_exit; goto err_exit;
} }
#endif #endif /* AQ_CFG_FORCE_LEGACY_INT */
/* net device init */ /* net device init */
for (port = 0; port < self->ports; ++port) { for (port = 0; port < self->ports; ++port) {
......
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