All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
@ 2018-11-28 12:24 Yang Xiao
  2018-11-28 19:43 ` Jeff Kirsher
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xiao @ 2018-11-28 12:24 UTC (permalink / raw)
  To: intel-wired-lan

From: Young Xiao <YangX92@hotmail.com>

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.

Signed-off-by: Young Xiao <YangX92@hotmail.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 333312a..9cc988a 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -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);
+	}
 }
 
 /**
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
  2018-11-28 12:24 [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings Yang Xiao
@ 2018-11-28 19:43 ` Jeff Kirsher
  2018-11-29  1:52   ` Yang Xiao
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2018-11-28 19:43 UTC (permalink / raw)
  To: intel-wired-lan

On Wed, 2018-11-28 at 12:24 +0000, Yang Xiao wrote:
> From: Young Xiao <YangX92@hotmail.com>
> 
> 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.
> 
> Signed-off-by: Young Xiao <YangX92@hotmail.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 333312a..9cc988a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -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);

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

> +	}
>  }
>  
>  /**

-------------- 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>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
  2018-11-28 19:43 ` Jeff Kirsher
@ 2018-11-29  1:52   ` Yang Xiao
  0 siblings, 0 replies; 7+ messages in thread
From: Yang Xiao @ 2018-11-29  1:52 UTC (permalink / raw)
  To: intel-wired-lan

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


Young

On 2018/11/29 3:43, Jeff Kirsher wrote:
> On Wed, 2018-11-28 at 12:24 +0000, Yang Xiao wrote:
>> From: Young Xiao <YangX92@hotmail.com>
>>
>> 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.
>>
>> Signed-off-by: Young Xiao <YangX92@hotmail.com>
>> ---
>>   drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>>   1 file changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
>> b/drivers/net/ethernet/intel/ice/ice_main.c
>> index 333312a..9cc988a 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -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);
> Looks like a cut and paste error, you should be 'disabling' NAPI, not
> enabling it here.
>
>> +	}
>>   }
>>   
>>   /**

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
  2018-11-29  1:54 Yang Xiao
  2018-11-29 16:57   ` Venkataramanan, Anirudh
@ 2018-12-04 17:01 ` Bowers, AndrewX
  1 sibling, 0 replies; 7+ messages in thread
From: Bowers, AndrewX @ 2018-12-04 17:01 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Yang Xiao
> Sent: Wednesday, November 28, 2018 5:54 PM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; davem at davemloft.net
> Cc: netdev at vger.kernel.org; intel-wired-lan at lists.osuosl.org; Yang Xiao
> <YangX92@hotmail.com>
> Subject: [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on
> q_vectors that have no rings
> 
> From: Young Xiao <YangX92@hotmail.com>
> 
> 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.
> 
> Signed-off-by: Young Xiao <YangX92@hotmail.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
  2018-11-29  1:54 Yang Xiao
@ 2018-11-29 16:57   ` Venkataramanan, Anirudh
  2018-12-04 17:01 ` Bowers, AndrewX
  1 sibling, 0 replies; 7+ messages in thread
From: Venkataramanan, Anirudh @ 2018-11-29 16:57 UTC (permalink / raw)
  To: davem, Kirsher, Jeffrey T, YangX92; +Cc: netdev, intel-wired-lan

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

On Thu, 2018-11-29 at 01:54 +0000, Yang Xiao wrote:
> From: Young Xiao <YangX92@hotmail.com>
> 
> 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.
> 
> Signed-off-by: Young Xiao <YangX92@hotmail.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 333312a..9450004 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -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_disable(&q_vector->napi);
> +	}
>  }
>  
>  /**

Acked-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>

Thanks for the patch, Yang!

- Ani

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3302 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
@ 2018-11-29 16:57   ` Venkataramanan, Anirudh
  0 siblings, 0 replies; 7+ messages in thread
From: Venkataramanan, Anirudh @ 2018-11-29 16:57 UTC (permalink / raw)
  To: intel-wired-lan

On Thu, 2018-11-29 at 01:54 +0000, Yang Xiao wrote:
> From: Young Xiao <YangX92@hotmail.com>
> 
> 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.
> 
> Signed-off-by: Young Xiao <YangX92@hotmail.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 333312a..9450004 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -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_disable(&q_vector->napi);
> +	}
>  }
>  
>  /**

Acked-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>

Thanks for the patch, Yang!

- Ani
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3302 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20181129/16e1b1f6/attachment-0001.bin>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings
@ 2018-11-29  1:54 Yang Xiao
  2018-11-29 16:57   ` Venkataramanan, Anirudh
  2018-12-04 17:01 ` Bowers, AndrewX
  0 siblings, 2 replies; 7+ messages in thread
From: Yang Xiao @ 2018-11-29  1:54 UTC (permalink / raw)
  To: intel-wired-lan

From: Young Xiao <YangX92@hotmail.com>

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.

Signed-off-by: Young Xiao <YangX92@hotmail.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 333312a..9450004 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -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_disable(&q_vector->napi);
+	}
 }
 
 /**
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-04 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 12:24 [Intel-wired-lan] [PATCH] intel: ice: Do not enable NAPI on q_vectors that have no rings Yang Xiao
2018-11-28 19:43 ` Jeff Kirsher
2018-11-29  1:52   ` Yang Xiao
2018-11-29  1:54 Yang Xiao
2018-11-29 16:57 ` Venkataramanan, Anirudh
2018-11-29 16:57   ` Venkataramanan, Anirudh
2018-12-04 17:01 ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.