Commit eec90376 authored by Young Xiao's avatar Young Xiao Committed by Jeff Kirsher

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 13a8cd19 ("i40e: Do not enable NAPI on q_vectors
that have no rings") for detail.
Signed-off-by: default avatarYoung Xiao <YangX92@hotmail.com>
Acked-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 9a2d57a7
...@@ -2564,8 +2564,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi) ...@@ -2564,8 +2564,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi)
if (!vsi->netdev) if (!vsi->netdev)
return; return;
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
napi_enable(&vsi->q_vectors[q_idx]->napi); struct ice_q_vector *q_vector = vsi->q_vectors[q_idx];
if (q_vector->rx.ring || q_vector->tx.ring)
napi_enable(&q_vector->napi);
}
} }
/** /**
...@@ -2932,8 +2936,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi) ...@@ -2932,8 +2936,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)
if (!vsi->netdev) if (!vsi->netdev)
return; return;
for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
napi_disable(&vsi->q_vectors[q_idx]->napi); struct ice_q_vector *q_vector = vsi->q_vectors[q_idx];
if (q_vector->rx.ring || q_vector->tx.ring)
napi_disable(&q_vector->napi);
}
} }
/** /**
......
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