Skip to content

Commit eec9037

Browse files
Yoha-testJeff Kirsher
authored andcommitted
ice: Do not enable NAPI on q_vectors that have no rings
If ice driver has q_vectors w/ active NAPI that has no rings, then this will result 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. See commit 13a8cd1 ("i40e: Do not enable NAPI on q_vectors that have no rings") for detail. Signed-off-by: Young Xiao <[email protected]> Acked-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 9a2d57a commit eec9037

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,8 +2564,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi)
25642564
if (!vsi->netdev)
25652565
return;
25662566

2567-
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
2568-
napi_enable(&vsi->q_vectors[q_idx]->napi);
2567+
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
2568+
struct ice_q_vector *q_vector = vsi->q_vectors[q_idx];
2569+
2570+
if (q_vector->rx.ring || q_vector->tx.ring)
2571+
napi_enable(&q_vector->napi);
2572+
}
25692573
}
25702574

25712575
/**
@@ -2932,8 +2936,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)
29322936
if (!vsi->netdev)
29332937
return;
29342938

2935-
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
2936-
napi_disable(&vsi->q_vectors[q_idx]->napi);
2939+
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
2940+
struct ice_q_vector *q_vector = vsi->q_vectors[q_idx];
2941+
2942+
if (q_vector->rx.ring || q_vector->tx.ring)
2943+
napi_disable(&q_vector->napi);
2944+
}
29372945
}
29382946

29392947
/**

0 commit comments

Comments
 (0)