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.yi...@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....@intel.com
>> 
>> Signed-off-by: Levend Sayar <levendsa...@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?

Reply via email to