[dpdk-dev] [PATCH 2/2] ring: empty optimization
Stephen Hemminger
stephen at networkplumber.org
Tue May 19 17:52:23 CEST 2020
On Tue, 19 May 2020 15:27:25 +0000
Morten Brørup <mb at smartsharesystems.com> wrote:
> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> index 9078e7c24..f67141482 100644
> --- a/lib/librte_ring/rte_ring.h
> +++ b/lib/librte_ring/rte_ring.h
> @@ -733,7 +733,9 @@ rte_ring_full(const struct rte_ring *r)
> static inline int
> rte_ring_empty(const struct rte_ring *r)
> {
> - return rte_ring_count(r) == 0;
> + uint32_t prod_tail = r->prod.tail;
> + uint32_t cons_tail = r->cons.tail;
> + return cons_tail == prod_tail;
> }
Blank line after declarations?
Are the temporary variable even needed?
More information about the dev
mailing list