Skip to content

Commit 13a8cd1

Browse files
Alexander Duyckdavem330
authored andcommitted
i40e: Do not enable NAPI on q_vectors that have no rings
When testing the epoll w/ busy poll code I found that I could get into a state where the i40e driver had q_vectors w/ active NAPI that had no rings. This was resulting in a divide by zero error. To correct it I am updating the driver code so that we only support NAPI on q_vectors that have 1 or more rings allocated to them. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 28ee1b7 commit 13a8cd1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4438,8 +4438,12 @@ static void i40e_napi_enable_all(struct i40e_vsi *vsi)
44384438
if (!vsi->netdev)
44394439
return;
44404440

4441-
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
4442-
napi_enable(&vsi->q_vectors[q_idx]->napi);
4441+
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
4442+
struct i40e_q_vector *q_vector = vsi->q_vectors[q_idx];
4443+
4444+
if (q_vector->rx.ring || q_vector->tx.ring)
4445+
napi_enable(&q_vector->napi);
4446+
}
44434447
}
44444448

44454449
/**
@@ -4453,8 +4457,12 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi)
44534457
if (!vsi->netdev)
44544458
return;
44554459

4456-
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
4457-
napi_disable(&vsi->q_vectors[q_idx]->napi);
4460+
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
4461+
struct i40e_q_vector *q_vector = vsi->q_vectors[q_idx];
4462+
4463+
if (q_vector->rx.ring || q_vector->tx.ring)
4464+
napi_disable(&q_vector->napi);
4465+
}
44584466
}
44594467

44604468
/**

0 commit comments

Comments
 (0)