From: "Morten Brørup" <mb@smartsharesystems.com>
To: dev@dpdk.org
Cc: "Morten Brørup" <mb@smartsharesystems.com>
Subject: [PATCH] stack: improve source code readability
Date: Tue, 11 Aug 2026 12:17:27 +0000 [thread overview]
Message-ID: <20260811121727.1706225-1-mb@smartsharesystems.com> (raw)
Fixed misleading local variable names in the standard stack,
for improved source code readability.
No functional change.
Fixes: 05d3b5283cc1 ("stack: introduce stack library")
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
No need to backport.
---
lib/stack/rte_stack_std.h | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/lib/stack/rte_stack_std.h b/lib/stack/rte_stack_std.h
index ae28add5c4..d5b21defb0 100644
--- a/lib/stack/rte_stack_std.h
+++ b/lib/stack/rte_stack_std.h
@@ -25,20 +25,20 @@ __rte_stack_std_push(struct rte_stack *s, void * const *obj_table,
{
struct rte_stack_std *stack = &s->stack_std;
unsigned int index;
- void **cache_objs;
+ void **stack_objs;
rte_spinlock_lock(&stack->lock);
- cache_objs = &stack->objs[stack->len];
+ stack_objs = &stack->objs[stack->len];
- /* Is there sufficient space in the stack? */
- if ((stack->len + n) > s->capacity) {
+ if (unlikely((stack->len + n) > s->capacity)) {
+ /* Insufficient space in the stack. */
rte_spinlock_unlock(&stack->lock);
return 0;
}
- /* Add elements back into the cache */
+ /* Push objects to the stack */
for (index = 0; index < n; ++index, obj_table++)
- cache_objs[index] = *obj_table;
+ stack_objs[index] = *obj_table;
stack->len += n;
@@ -63,20 +63,22 @@ __rte_stack_std_pop(struct rte_stack *s, void **obj_table, unsigned int n)
{
struct rte_stack_std *stack = &s->stack_std;
unsigned int index, len;
- void **cache_objs;
+ void **stack_objs;
rte_spinlock_lock(&stack->lock);
if (unlikely(n > stack->len)) {
+ /* Insufficient objects in the stack. */
rte_spinlock_unlock(&stack->lock);
return 0;
}
- cache_objs = stack->objs;
+ stack_objs = stack->objs;
+ /* Pop objects from the stack */
for (index = 0, len = stack->len - 1; index < n;
++index, len--, obj_table++)
- *obj_table = cache_objs[len];
+ *obj_table = stack_objs[len];
stack->len -= n;
rte_spinlock_unlock(&stack->lock);
--
2.43.0
next reply other threads:[~2026-08-11 12:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 12:17 Morten Brørup [this message]
2026-08-11 15:48 ` [PATCH] stack: improve source code readability Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260811121727.1706225-1-mb@smartsharesystems.com \
--to=mb@smartsharesystems.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox