Skip to contentSkip to conversation

intel: ice: Do not enable NAPI on q_vectors that have no rings

PATCH New Yang Xiao 2 participants 3 messages Nov 28, 2018 – Nov 29, 2018

Subsystems (2)
lore
Share & tools
lore

Yang Xiao

author
#0 lore raw

PATCH 1/1 intel: ice: Do not enable NAPI on q_vectors that have no rings

From: Young Xiao <[email protected]>

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 13a8cd191a2b ("i40e: Do not enable NAPI on q_vectors that have no rings") for detail.

---
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +12 -4
index 333312a..9cc988a 100644
@@ -2563,8 +2563,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi)
 	if (!vsi->netdev)
 		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_enable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);
+	}
 }
 
 /**
@@ -2931,8 +2935,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)
 	if (!vsi->netdev)
 		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_disable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);
+	}
 }
 
 /**
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 intel: ice: Do not enable NAPI on q_vectors that have no rings

Quoted 38 lines · Yang Xiao

From: Young Xiao <[email protected]>

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 13a8cd191a2b ("i40e: Do not enable NAPI on q_vectors that have no rings") for detail.

---
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
index 333312a..9cc988a 100644
@@ -2563,8 +2563,12 @@ static void ice_napi_enable_all(struct ice_vsi
 *vsi)
 	if (!vsi->netdev)
 		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_enable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);
+	}
 }
 

/**

drivers/net/ethernet/intel/ice/ice_main.c +0 -0
@@ -2931,8 +2935,12 @@ static void ice_napi_disable_all(struct
 ice_vsi *vsi)

drivers/net/ethernet/intel/ice/ice_main.c static void ice_napi_disable_all(struct · line 2943

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +5 -2
 	if (!vsi->netdev)
 		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_disable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);

Looks like a cut and paste error, you should be 'disabling' NAPI, not enabling it here.

Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_main.c +1 -0
+	}
 }
 

/**

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20181128/da72db41/attachment.asc>

author
#2 lore raw

PATCH 1/1 intel: ice: Do not enable NAPI on q_vectors that have no rings

Sorry for the copy-and-paste error, I will submit a new patch.

Young

Quoted 56 lines · Jeff Kirsher
Quoted 38 lines · Yang Xiao

From: Young Xiao <[email protected]>

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 13a8cd191a2b ("i40e: Do not enable NAPI on q_vectors that have no rings") for detail.

---
  drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
index 333312a..9cc988a 100644
@@ -2563,8 +2563,12 @@ static void ice_napi_enable_all(struct ice_vsi
 *vsi)
  	if (!vsi->netdev)
  		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_enable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);
+	}
  }
 

/**

drivers/net/ethernet/intel/ice/ice_main.c +0 -0
@@ -2931,8 +2935,12 @@ static void ice_napi_disable_all(struct
 ice_vsi *vsi)

drivers/net/ethernet/intel/ice/ice_main.c static void ice_napi_disable_all(struct · line 2943

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +5 -2
  	if (!vsi->netdev)
  		return;
 
-	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)
-		napi_disable(&vsi->q_vectors[q_idx]->napi);
+	for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {
+		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);

Looks like a cut and paste error, you should be 'disabling' NAPI, not enabling it here.

Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_main.c +1 -0
+	}
  }
 

/**