For performance reasons, remove the redundant updates of the cleaned_count
variable, as its value can be computed based on the ring next-to-clean
variable, which is consistently updated.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
                        bi = i40e_rx_bi(rx_ring, next_to_clean);
                        xsk_buff_free(*bi);
                        *bi = NULL;
-                       cleaned_count++;
                        next_to_clean = (next_to_clean + 1) & count_mask;
                        continue;
                }
                        total_rx_bytes += size;
                        total_rx_packets++;
 
-                       cleaned_count++;
                        next_to_clean = (next_to_clean + 1) & count_mask;
                        continue;
                }
                }
 
                *bi = NULL;
-               cleaned_count++;
                next_to_clean = (next_to_clean + 1) & count_mask;
 
                if (eth_skb_pad(skb))
        }
 
        rx_ring->next_to_clean = next_to_clean;
+       cleaned_count = (next_to_clean - rx_ring->next_to_use - 1) & count_mask;
 
        if (cleaned_count >= I40E_RX_BUFFER_WRITE)
                failure = !i40e_alloc_rx_buffers_zc(rx_ring, cleaned_count);