[v3,1/2] net/gve: fix Rx no mbufs stats counter update

Message ID 20230220211103.8282-1-levendsayar@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v3,1/2] net/gve: fix Rx no mbufs stats counter update |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Levend Sayar Feb. 20, 2023, 9:11 p.m. UTC
  rx no_mbufs stats counter update is added for another error case.

Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
Cc: junfeng.guo@intel.com

Signed-off-by: Levend Sayar <levendsayar@gmail.com>
---
 drivers/net/gve/gve_rx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Feb. 20, 2023, 10:57 p.m. UTC | #1
On 2/20/2023 9:11 PM, Levend Sayar wrote:
> rx no_mbufs stats counter update is added for another error case.
> 
> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
> Cc: junfeng.guo@intel.com
> 
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
> ---
>  drivers/net/gve/gve_rx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
> index 66fbcf3930..d346efa57c 100644
> --- a/drivers/net/gve/gve_rx.c
> +++ b/drivers/net/gve/gve_rx.c
> @@ -61,7 +61,10 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>  					break;
>  				rxq->sw_ring[idx + i] = nmb;
>  			}
> -			nb_alloc = i;
> +			if (i != nb_alloc) {
> +				rxq->no_mbufs += nb_alloc - i;
> +				nb_alloc = i;
> +			}
>  		}
>  		rxq->nb_avail -= nb_alloc;
>  		next_avail += nb_alloc;

Looks good to me,
there was a comment from Stephen to add 'unlikely()', is that issue
resolved?
  
Levend Sayar Feb. 21, 2023, 10:07 a.m. UTC | #2
Not only this if, there can be many places to add such branch prediction helpers
On the gve pmd code. 

I preferred to patch only the bug here and not used unlikely to minimize noise.

Imho, adding likely/unlikely to all gve pmd code can be topic of another patch maybe.

Levend

> On 21 Feb 2023, at 01:57, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>> rx no_mbufs stats counter update is added for another error case.
>> 
>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>> Cc: junfeng.guo@intel.com
>> 
>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>> ---
>> drivers/net/gve/gve_rx.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
>> index 66fbcf3930..d346efa57c 100644
>> --- a/drivers/net/gve/gve_rx.c
>> +++ b/drivers/net/gve/gve_rx.c
>> @@ -61,7 +61,10 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>> 					break;
>> 				rxq->sw_ring[idx + i] = nmb;
>> 			}
>> -			nb_alloc = i;
>> +			if (i != nb_alloc) {
>> +				rxq->no_mbufs += nb_alloc - i;
>> +				nb_alloc = i;
>> +			}
>> 		}
>> 		rxq->nb_avail -= nb_alloc;
>> 		next_avail += nb_alloc;
> 
> Looks good to me,
> there was a comment from Stephen to add 'unlikely()', is that issue
> resolved?
  
Ferruh Yigit Feb. 21, 2023, 10:30 a.m. UTC | #3
On 2/21/2023 10:07 AM, Levend Sayar wrote:
> Not only this if, there can be many places to add such branch prediction helpers
> On the gve pmd code. 
> 
> I preferred to patch only the bug here and not used unlikely to minimize noise.
> 
> Imho, adding likely/unlikely to all gve pmd code can be topic of another patch maybe.
> 

ack, sounds reasonable to me

> Levend
> 
>> On 21 Feb 2023, at 01:57, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>
>> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>>> rx no_mbufs stats counter update is added for another error case.
>>>
>>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>>> Cc: junfeng.guo@intel.com
>>>
>>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>>> ---
>>> drivers/net/gve/gve_rx.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
>>> index 66fbcf3930..d346efa57c 100644
>>> --- a/drivers/net/gve/gve_rx.c
>>> +++ b/drivers/net/gve/gve_rx.c
>>> @@ -61,7 +61,10 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>>> 					break;
>>> 				rxq->sw_ring[idx + i] = nmb;
>>> 			}
>>> -			nb_alloc = i;
>>> +			if (i != nb_alloc) {
>>> +				rxq->no_mbufs += nb_alloc - i;
>>> +				nb_alloc = i;
>>> +			}
>>> 		}
>>> 		rxq->nb_avail -= nb_alloc;
>>> 		next_avail += nb_alloc;
>>
>> Looks good to me,
>> there was a comment from Stephen to add 'unlikely()', is that issue
>> resolved?
>
  
Ferruh Yigit Feb. 21, 2023, 3:58 p.m. UTC | #4
On 2/20/2023 9:11 PM, Levend Sayar wrote:
> rx no_mbufs stats counter update is added for another error case.
> 
> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
> Cc: junfeng.guo@intel.com
> 
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>


(No problem for this time, but for future contributions, it is expected
to have new versions as a whole patchset, otherwise that becomes too
difficult to manage for maintainers to cherry pick various versions of
individual patches in a set, specially on peak time of release.
Also harder to backtrace from patchwork/list if someone wants the check
the history.)
  
Levend Sayar Feb. 21, 2023, 4:42 p.m. UTC | #5
Thanks Ferruh for the heads up.

It was a little confusion for me to decide what to do either. I will do as expected for future.
I did not want to overwrite any commit that is already acked.
So pushed new versions only for the ones needs recommits.

Levend 


> On 21 Feb 2023, at 18:58, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>> rx no_mbufs stats counter update is added for another error case.
>> 
>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>> Cc: junfeng.guo@intel.com
>> 
>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
> 
> 
> (No problem for this time, but for future contributions, it is expected
> to have new versions as a whole patchset, otherwise that becomes too
> difficult to manage for maintainers to cherry pick various versions of
> individual patches in a set, specially on peak time of release.
> Also harder to backtrace from patchwork/list if someone wants the check
> the history.)
>
  
Junfeng Guo Feb. 23, 2023, 4:34 a.m. UTC | #6
Acked-by: Junfeng Guo <junfeng.guo@intel.com>

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Tuesday, February 21, 2023 18:31
> To: Levend Sayar <levendsayar@gmail.com>
> Cc: Guo, Junfeng <junfeng.guo@intel.com>; dev@dpdk.org; Stephen
> Hemminger <stephen@networkplumber.org>
> Subject: Re: [PATCH v3 1/2] net/gve: fix Rx no mbufs stats counter update
> 
> On 2/21/2023 10:07 AM, Levend Sayar wrote:
> > Not only this if, there can be many places to add such branch prediction
> helpers
> > On the gve pmd code.
> >
> > I preferred to patch only the bug here and not used unlikely to minimize
> noise.
> >
> > Imho, adding likely/unlikely to all gve pmd code can be topic of another
> patch maybe.

Agreed. 
Adding likely/unlikely is more related to the performance with compiler.
This can be an optimization for performance. Thanks!

> >
> 
> ack, sounds reasonable to me
> 
> > Levend
> >
> >> On 21 Feb 2023, at 01:57, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >>
> >> On 2/20/2023 9:11 PM, Levend Sayar wrote:
> >>> rx no_mbufs stats counter update is added for another error case.
> >>>
> >>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
> >>> Cc: junfeng.guo@intel.com
> >>>
> >>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
> >>> ---
> >>> drivers/net/gve/gve_rx.c | 5 ++++-
> >>> 1 file changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
> >>> index 66fbcf3930..d346efa57c 100644
> >>> --- a/drivers/net/gve/gve_rx.c
> >>> +++ b/drivers/net/gve/gve_rx.c
> >>> @@ -61,7 +61,10 @@ gve_rx_refill(struct gve_rx_queue *rxq)
> >>> 					break;
> >>> 				rxq->sw_ring[idx + i] = nmb;
> >>> 			}
> >>> -			nb_alloc = i;
> >>> +			if (i != nb_alloc) {
> >>> +				rxq->no_mbufs += nb_alloc - i;
> >>> +				nb_alloc = i;
> >>> +			}
> >>> 		}
> >>> 		rxq->nb_avail -= nb_alloc;
> >>> 		next_avail += nb_alloc;
> >>
> >> Looks good to me,
> >> there was a comment from Stephen to add 'unlikely()', is that issue
> >> resolved?
> >
  
Levend Sayar Feb. 23, 2023, 6:29 a.m. UTC | #7
Thanks Junfeng for acknowledging.

> On 23 Feb 2023, at 07:34, Guo, Junfeng <junfeng.guo@intel.com> wrote:
> 
> Acked-by: Junfeng Guo <junfeng.guo@intel.com <mailto:junfeng.guo@intel.com>>
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@amd.com <mailto:ferruh.yigit@amd.com>>
>> Sent: Tuesday, February 21, 2023 18:31
>> To: Levend Sayar <levendsayar@gmail.com <mailto:levendsayar@gmail.com>>
>> Cc: Guo, Junfeng <junfeng.guo@intel.com <mailto:junfeng.guo@intel.com>>; dev@dpdk.org <mailto:dev@dpdk.org>; Stephen
>> Hemminger <stephen@networkplumber.org <mailto:stephen@networkplumber.org>>
>> Subject: Re: [PATCH v3 1/2] net/gve: fix Rx no mbufs stats counter update
>> 
>> On 2/21/2023 10:07 AM, Levend Sayar wrote:
>>> Not only this if, there can be many places to add such branch prediction
>> helpers
>>> On the gve pmd code.
>>> 
>>> I preferred to patch only the bug here and not used unlikely to minimize
>> noise.
>>> 
>>> Imho, adding likely/unlikely to all gve pmd code can be topic of another
>> patch maybe.
> 
> Agreed. 
> Adding likely/unlikely is more related to the performance with compiler.
> This can be an optimization for performance. Thanks!
> 
>>> 
>> 
>> ack, sounds reasonable to me
>> 
>>> Levend
>>> 
>>>> On 21 Feb 2023, at 01:57, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>>> 
>>>> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>>>>> rx no_mbufs stats counter update is added for another error case.
>>>>> 
>>>>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>>>>> Cc: junfeng.guo@intel.com
>>>>> 
>>>>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>>>>> ---
>>>>> drivers/net/gve/gve_rx.c | 5 ++++-
>>>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>>> 
>>>>> diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
>>>>> index 66fbcf3930..d346efa57c 100644
>>>>> --- a/drivers/net/gve/gve_rx.c
>>>>> +++ b/drivers/net/gve/gve_rx.c
>>>>> @@ -61,7 +61,10 @@ gve_rx_refill(struct gve_rx_queue *rxq)
>>>>> 					break;
>>>>> 				rxq->sw_ring[idx + i] = nmb;
>>>>> 			}
>>>>> -			nb_alloc = i;
>>>>> +			if (i != nb_alloc) {
>>>>> +				rxq->no_mbufs += nb_alloc - i;
>>>>> +				nb_alloc = i;
>>>>> +			}
>>>>> 		}
>>>>> 		rxq->nb_avail -= nb_alloc;
>>>>> 		next_avail += nb_alloc;
>>>> 
>>>> Looks good to me,
>>>> there was a comment from Stephen to add 'unlikely()', is that issue
>>>> resolved?
  
Ferruh Yigit Feb. 23, 2023, 11:10 a.m. UTC | #8
On 2/23/2023 4:34 AM, Guo, Junfeng wrote:

>>>> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>>>>> rx no_mbufs stats counter update is added for another error case.
>>>>>
>>>>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>>>>> Cc: junfeng.guo@intel.com
>>>>>
>>>>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>>>>> ---
>
> Acked-by: Junfeng Guo <junfeng.guo@intel.com>
> >
> Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
>

Applied to dpdk-next-net/main, thanks.
  
Levend Sayar Feb. 23, 2023, 12:29 p.m. UTC | #9
Thanks Ferruh For applying.

> On 23 Feb 2023, at 14:10, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
> On 2/23/2023 4:34 AM, Guo, Junfeng wrote:
> 
>>>>> On 2/20/2023 9:11 PM, Levend Sayar wrote:
>>>>>> rx no_mbufs stats counter update is added for another error case.
>>>>>> 
>>>>>> Fixes: 4f6b1dd8240c ("net/gve: support basic statistics")
>>>>>> Cc: junfeng.guo@intel.com
>>>>>> 
>>>>>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
>>>>>> ---
>> 
>> Acked-by: Junfeng Guo <junfeng.guo@intel.com>
>>> 
>> Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
>> 
> 
> Applied to dpdk-next-net/main, thanks.
>
  

Patch

diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
index 66fbcf3930..d346efa57c 100644
--- a/drivers/net/gve/gve_rx.c
+++ b/drivers/net/gve/gve_rx.c
@@ -61,7 +61,10 @@  gve_rx_refill(struct gve_rx_queue *rxq)
 					break;
 				rxq->sw_ring[idx + i] = nmb;
 			}
-			nb_alloc = i;
+			if (i != nb_alloc) {
+				rxq->no_mbufs += nb_alloc - i;
+				nb_alloc = i;
+			}
 		}
 		rxq->nb_avail -= nb_alloc;
 		next_avail += nb_alloc;