Skip to content

Commit b33ae99

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: replace num_irqs with max_r_vecs
num_irqs is not used anywhere, replace it with max_r_vecs which holds number of allocated RX/TX vectors and is going to be useful soon. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4b27a1e commit b33ae99

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ struct nfp_stat_pair {
456456
* @rxd_cnt: Size of the RX ring in number of descriptors
457457
* @tx_rings: Array of pre-allocated TX ring structures
458458
* @rx_rings: Array of pre-allocated RX ring structures
459-
* @num_irqs: Number of allocated interrupt vectors
459+
* @max_r_vecs: Number of allocated interrupt vectors for RX/TX
460460
* @num_r_vecs: Number of used ring vectors
461461
* @r_vecs: Pre-allocated array of ring vectors
462462
* @irq_entries: Pre-allocated array of MSI-X entries
@@ -540,7 +540,7 @@ struct nfp_net {
540540
int txd_cnt;
541541
int rxd_cnt;
542542

543-
unsigned int num_irqs;
543+
unsigned int max_r_vecs;
544544
unsigned int num_r_vecs;
545545
struct nfp_net_r_vector r_vecs[NFP_NET_MAX_R_VECS];
546546
struct msix_entry irq_entries[NFP_NET_MAX_IRQS];

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,22 +316,24 @@ static int nfp_net_msix_alloc(struct nfp_net *nn, int nr_vecs)
316316
int nfp_net_irqs_alloc(struct nfp_net *nn)
317317
{
318318
int wanted_irqs;
319+
unsigned int n;
319320

320321
wanted_irqs = nn->num_r_vecs + NFP_NET_NON_Q_VECTORS;
321322

322-
nn->num_irqs = nfp_net_msix_alloc(nn, wanted_irqs);
323-
if (nn->num_irqs == 0) {
323+
n = nfp_net_msix_alloc(nn, wanted_irqs);
324+
if (n == 0) {
324325
nn_err(nn, "Failed to allocate MSI-X IRQs\n");
325326
return 0;
326327
}
327328

328-
nn->num_r_vecs = nn->num_irqs - NFP_NET_NON_Q_VECTORS;
329+
nn->max_r_vecs = n - NFP_NET_NON_Q_VECTORS;
330+
nn->num_r_vecs = nn->max_r_vecs;
329331

330-
if (nn->num_irqs < wanted_irqs)
332+
if (n < wanted_irqs)
331333
nn_warn(nn, "Unable to allocate %d vectors. Got %d instead\n",
332-
wanted_irqs, nn->num_irqs);
334+
wanted_irqs, n);
333335

334-
return nn->num_irqs;
336+
return n;
335337
}
336338

337339
/**

0 commit comments

Comments
 (0)