From: Bruce Richardson <bruce.richardson@intel.com>
To: stable@dpdk.org
Cc: christian.ehrhardt@canonical.com,
Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 19.11 2/4] eal: fix C++ include
Date: Tue, 1 Mar 2022 14:08:36 +0000 [thread overview]
Message-ID: <20220301140838.406891-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20220301140838.406891-1-bruce.richardson@intel.com>
C++ files could not include some headers because "new" is a keyword in
C++, so can't be a variable name
Fixes: 184104fc6121 ("ticketlock: introduce fair ticket based locking")
Cc: stable@dpdk.org
(This is a backport of patch 59144f6edd from mainline)
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
.../common/include/generic/rte_ticketlock.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/include/generic/rte_ticketlock.h b/lib/librte_eal/common/include/generic/rte_ticketlock.h
index d9bec87692..5f432cfbe8 100644
--- a/lib/librte_eal/common/include/generic/rte_ticketlock.h
+++ b/lib/librte_eal/common/include/generic/rte_ticketlock.h
@@ -96,13 +96,13 @@ __rte_experimental
static inline int
rte_ticketlock_trylock(rte_ticketlock_t *tl)
{
- rte_ticketlock_t old, new;
- old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
- new.tickets = old.tickets;
- new.s.next++;
- if (old.s.next == old.s.current) {
- if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets,
- new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ rte_ticketlock_t oldl, newl;
+ oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
+ newl.tickets = oldl.tickets;
+ newl.s.next++;
+ if (oldl.s.next == oldl.s.current) {
+ if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets,
+ newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
return 1;
}
--
2.32.0
next prev parent reply other threads:[~2022-03-01 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 14:08 [PATCH 19.11 0/4] Patch backports from main Bruce Richardson
2022-03-01 14:08 ` [PATCH 19.11 1/4] eventdev: fix C++ include Bruce Richardson
2022-03-01 14:08 ` Bruce Richardson [this message]
2022-03-01 14:08 ` [PATCH 19.11 3/4] build: remove deprecated Meson functions Bruce Richardson
2022-03-01 14:08 ` [PATCH 19.11 4/4] build: fix warnings when running external commands Bruce Richardson
2022-03-01 14:43 ` [PATCH 19.11 v2 0/5] Patch backports from main Bruce Richardson
2022-03-01 14:43 ` [PATCH 19.11 v2 1/5] eventdev: fix C++ include Bruce Richardson
2022-03-01 14:44 ` [PATCH 19.11 v2 2/5] eal: " Bruce Richardson
2022-03-01 14:44 ` [PATCH 19.11 v2 3/5] build: remove deprecated Meson functions Bruce Richardson
2022-03-01 14:44 ` [PATCH 19.11 v2 4/5] build: fix warnings when running external commands Bruce Richardson
2022-03-01 14:44 ` [PATCH 19.11 v2 5/5] drivers: remove warning with Meson 0.59 Bruce Richardson
2022-03-09 7:59 ` [PATCH 19.11 v2 0/5] Patch backports from main Christian Ehrhardt
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=20220301140838.406891-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=christian.ehrhardt@canonical.com \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).