[PATCH v6 5/6] ring: use inline instead of always inline in soring

Stephen Hemminger
2026-02-05T17:58:28Z

With LTO enabled, always_inline forces GCC to inline the full
soring call chain, triggering a false -Wstringop-overflow
warning. GCC cannot prove the 128-bit element copy path is
unreachable when the ring uses 4-byte elements.

Use plain inline instead, giving the compiler discretion over
inlining. At -O2/-O3 these small hot functions are still
inlined by the compiler's own heuristics.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
lib/ring/soring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ring/soring.c b/lib/ring/soring.c
index 797484d6bf..3b90521bdb 100644
--- a/lib/ring/soring.c
+++ b/lib/ring/soring.c
@@ -249,7 +249,7 @@ __rte_soring_stage_move_head(struct soring_stage_headtail *d,
return n;
}

-static __rte_always_inline uint32_t
+static inline uint32_t
soring_enqueue(struct rte_soring *r, const void *objs,
const void *meta, uint32_t n, enum rte_ring_queue_behavior behavior,
uint32_t *free_space)
@@ -278,7 +278,7 @@ soring_enqueue(struct rte_soring *r, const void *objs,
return n;
}

-static __rte_always_inline uint32_t
+static inline uint32_t
soring_dequeue(struct rte_soring *r, void *objs, void *meta,
uint32_t num, enum rte_ring_queue_behavior behavior,
uint32_t *available)
--
2.51.0