On 1/24/2023 10:47 AM, David Marchand wrote:
> Reduce code duplication by introducing a helper that takes care of
> receiving packets and incrementing rx counter.
> 
> Signed-off-by: David Marchand <david.march...@redhat.com>

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


<...>


> @@ -857,6 +857,18 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx)
>       if (record_burst_stats)
>               fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
>  }
> +static inline uint16_t
> +common_fwd_stream_receive(struct fwd_stream *fs, struct rte_mbuf **burst,
> +     unsigned int count)
> +{
> +     uint16_t nb_rx;
> +
> +     nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, burst, count);
> +     inc_rx_burst_stats(fs, nb_rx);
> +     if (likely(nb_rx != 0))
> +             fs->rx_packets += nb_rx;


Minor but since "nb_rx != 0" is likely case, perhaps we can drop the
check and just have "fs->rx_packets += nb_rx;"?

Reply via email to