Commit 4b27a1eb authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: remove nfp_net_irqs_wanted()

nfp_net_irqs_wanted() doesn't really encapsulate much logic,
remove it and inline the calculations.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4b562bb
...@@ -307,28 +307,6 @@ static int nfp_net_msix_alloc(struct nfp_net *nn, int nr_vecs) ...@@ -307,28 +307,6 @@ static int nfp_net_msix_alloc(struct nfp_net *nn, int nr_vecs)
return nvecs; return nvecs;
} }
/**
* nfp_net_irqs_wanted() - Work out how many interrupt vectors we want
* @nn: NFP Network structure
*
* We want a vector per CPU (or ring), whatever is smaller plus
* NFP_NET_NON_Q_VECTORS for LSC etc.
*
* Return: Number of interrupts wanted
*/
static int nfp_net_irqs_wanted(struct nfp_net *nn)
{
unsigned int vecs;
int ncpus;
ncpus = num_online_cpus();
vecs = max_t(int, nn->num_tx_rings, nn->num_rx_rings);
vecs = min_t(int, vecs, ncpus);
return vecs + NFP_NET_NON_Q_VECTORS;
}
/** /**
* nfp_net_irqs_alloc() - allocates MSI-X irqs * nfp_net_irqs_alloc() - allocates MSI-X irqs
* @nn: NFP Network structure * @nn: NFP Network structure
...@@ -339,7 +317,7 @@ int nfp_net_irqs_alloc(struct nfp_net *nn) ...@@ -339,7 +317,7 @@ int nfp_net_irqs_alloc(struct nfp_net *nn)
{ {
int wanted_irqs; int wanted_irqs;
wanted_irqs = nfp_net_irqs_wanted(nn); wanted_irqs = nn->num_r_vecs + NFP_NET_NON_Q_VECTORS;
nn->num_irqs = nfp_net_msix_alloc(nn, wanted_irqs); nn->num_irqs = nfp_net_msix_alloc(nn, wanted_irqs);
if (nn->num_irqs == 0) { if (nn->num_irqs == 0) {
...@@ -2726,6 +2704,9 @@ struct nfp_net *nfp_net_netdev_alloc(struct pci_dev *pdev, ...@@ -2726,6 +2704,9 @@ struct nfp_net *nfp_net_netdev_alloc(struct pci_dev *pdev,
nn->num_tx_rings = min_t(int, nqs, max_tx_rings); nn->num_tx_rings = min_t(int, nqs, max_tx_rings);
nn->num_rx_rings = min_t(int, nqs, max_rx_rings); nn->num_rx_rings = min_t(int, nqs, max_rx_rings);
nn->num_r_vecs = max(nn->num_tx_rings, nn->num_rx_rings);
nn->num_r_vecs = min_t(unsigned int, nn->num_r_vecs, num_online_cpus());
nn->txd_cnt = NFP_NET_TX_DESCS_DEFAULT; nn->txd_cnt = NFP_NET_TX_DESCS_DEFAULT;
nn->rxd_cnt = NFP_NET_RX_DESCS_DEFAULT; nn->rxd_cnt = NFP_NET_RX_DESCS_DEFAULT;
......
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