Bug in non-power-of-2 rings?

Morten Brørup mb at smartsharesystems.com
Sun Aug 20 11:07:33 CEST 2023


Bruce, Honnappa, Konstantin,

Back in 2017, Bruce added support for non-power-of-2 rings with this patch [1].

[1]: https://git.dpdk.org/dpdk/commit/lib/librte_ring/rte_ring.h?id=b74461155543430f5253e96ad6d413ebcad36693

I think that the calculation of "entries" in __rte_ring_move_cons_head() [2][3] is incorrect when the ring capacity is not power-of-2, because it is missing the capacity comparison you added to rte_ring_count() [4]. Please review if I'm mistaken.

[2]: https://elixir.bootlin.com/dpdk/v23.07/source/lib/ring/rte_ring_c11_pvt.h#L159
[3]: https://elixir.bootlin.com/dpdk/v23.07/source/lib/ring/rte_ring_generic_pvt.h#L150
[4]: https://elixir.bootlin.com/dpdk/v23.07/source/lib/ring/rte_ring.h#L502

-Morten



More information about the dev mailing list