From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [memnic PATCH] pmd: use memory barrier function instead of asm volatile
Date: Fri, 24 Jan 2014 16:59:17 +0100 [thread overview]
Message-ID: <1390579157-23890-1-git-send-email-olivier.matz@6wind.com> (raw)
Use the DPDK specific function rte_mb() instead of
the GCC statement asm volatile ("" ::: "memory").
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
common/memnic.h | 2 --
pmd/pmd_memnic.c | 6 +++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/common/memnic.h b/common/memnic.h
index 6ff38a0..fdc9fa3 100644
--- a/common/memnic.h
+++ b/common/memnic.h
@@ -123,8 +123,6 @@ struct memnic_area {
/* for userspace */
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
-#define barrier() do { asm volatile("": : :"memory"); } while (0)
-
static inline uint32_t cmpxchg(uint32_t *dst, uint32_t old, uint32_t new)
{
volatile uint32_t *ptr = (volatile uint32_t *)dst;
diff --git a/pmd/pmd_memnic.c b/pmd/pmd_memnic.c
index bc01746..1586222 100644
--- a/pmd/pmd_memnic.c
+++ b/pmd/pmd_memnic.c
@@ -100,7 +100,7 @@ static int memnic_dev_start(struct rte_eth_dev *dev)
/* invalidate */
adapter->nic->hdr.valid = 0;
- barrier();
+ rte_mb();
/* reset */
adapter->nic->hdr.reset = 1;
/* no need to wait here */
@@ -242,7 +242,7 @@ static uint16_t memnic_recv_pkts(void *rx_queue,
mb->pkt.data_len = p->len;
rx_pkts[nr] = mb;
- barrier();
+ rte_mb();
p->status = MEMNIC_PKT_ST_FREE;
if (++idx >= MEMNIC_NR_PACKET)
@@ -290,7 +290,7 @@ retry:
rte_memcpy(p->data, rte_pktmbuf_mtod(tx_pkts[nr], void *), len);
- barrier();
+ rte_mb();
p->status = MEMNIC_PKT_ST_FILLED;
rte_pktmbuf_free(tx_pkts[nr]);
--
1.8.4.rc3
next reply other threads:[~2014-01-24 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 15:59 Olivier Matz [this message]
2014-01-30 11:42 ` Hiroshi Shimamoto
2014-01-31 9:52 ` Olivier MATZ
2014-02-04 13:08 ` Thomas Monjalon
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=1390579157-23890-1-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.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;
as well as URLs for NNTP newsgroup(s).