From: Matan Azrad <matan@mellanox.com>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 2/3] net/failsafe: mitigate data plan atomic operations
Date: Tue, 19 Dec 2017 17:14:28 +0000 [thread overview]
Message-ID: <1513703669-29363-3-git-send-email-matan@mellanox.com> (raw)
In-Reply-To: <1513703669-29363-1-git-send-email-matan@mellanox.com>
Fail-safe uses atomic operations to protect sub-device close operation
calling by host thread in removal time while the removed sub-device
burst functions are still in process by application threads.
Using "set" atomic operations is a liitle bit more efficient than "add"
or "sub" atomic operations because "set" shouldn't read the value and
in fact, it does not need a special atomic mechanism in x86 platforms.
Replace "add 1" and "sub 1" atomic operations by "set 1" and "set 0"
atomic operations.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
drivers/net/failsafe/failsafe_private.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index d81cc3c..4196ece 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -269,13 +269,13 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id,
* a: (rte_atomic64_t)
*/
#define FS_ATOMIC_P(a) \
- rte_atomic64_add(&(a), 1)
+ rte_atomic64_set(&(a), 1)
/**
* a: (rte_atomic64_t)
*/
#define FS_ATOMIC_V(a) \
- rte_atomic64_sub(&(a), 1)
+ rte_atomic64_set(&(a), 0)
/**
* s: (struct sub_device *)
--
1.8.3.1
next prev parent reply other threads:[~2017-12-19 17:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-19 17:14 [dpdk-dev] [PATCH v3 0/3] improve failsafe performance Matan Azrad
2017-12-19 17:14 ` [dpdk-dev] [PATCH v3 1/3] net/failsafe: fix Rx safe check compiler hint Matan Azrad
2017-12-19 17:14 ` Matan Azrad [this message]
2017-12-19 17:14 ` [dpdk-dev] [PATCH v3 3/3] net/failsafe: improve Rx sub-devices iteration Matan Azrad
2018-01-12 10:28 ` Gaëtan Rivet
2018-01-12 13:29 ` Matan Azrad
2018-01-12 14:01 ` Gaëtan Rivet
2017-12-19 17:21 ` [dpdk-dev] [PATCH v3 0/3] improve failsafe performance Matan Azrad
2018-01-11 17:58 ` Ferruh Yigit
2018-01-12 10:14 ` Gaëtan Rivet
2018-01-12 15:10 ` Ferruh Yigit
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=1513703669-29363-3-git-send-email-matan@mellanox.com \
--to=matan@mellanox.com \
--cc=dev@dpdk.org \
--cc=gaetan.rivet@6wind.com \
/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).